Forest beyond basics
Baris Erkus
bariserkus at hotmail.com
Mon Dec 20 08:52:50 UTC 2021
On 19-Dec-21 8:20 PM, Maria Gouskova via lyx-users wrote:
> Dear LyX users,
>
> (Actually, I suspect this is a question for Jürgen S., but on the off
> chance that someone else knows the answer...)
>
> I need to produce a diagram with the structure shown here. It was
> produced using the obsolete xyling package (see the attached
> xyling_test files):
> tree_i_want.png
> All the nodes will have a lot of linguist-specific bells and whistles,
> like IPA fonts and small caps and other stuff. XYling has not been
> updated in 15 years; I barely got the doc to compile. So, xyling is no
> good for what I need.
>
> In the process of trying to work out how to make that tree happen in
> forest, the package that LyX's linguistics module directly supports, I
> concluded that I will need to use the "draw" functionality. But I
> can't work out how to make the \draw commands work inside the tree
> insets. I tried to follow an example from the forest manual (number
> (21) on p. 9 of this,
> http://mirrors.ctan.org/graphics/pgf/contrib/forest/forest-doc.pdf,
> and realized that there is no obvious way to pass options in the
> \begin{forest} ... \end{forest} space beyond those that pertain to
> nodes (i.e., appear inside the [ ] brackets). The options just get
> ignored, or else prevent the PDF from being compiled.
>
> Things I've tried:
>
> 1) Declaring forest overtly in the preamble and passing the whole
> \begin{forest} ...\end{forest} block as ERT. That throws errors.
>
> 2) Using the native LyX forest support, and passing options as ERT
> inside the Tree inset. I noticed in the code preview pane that the
> \draw backslash is replaced with \textbackslash. I tried replacing the
> $s$ stuff with ERT, too. The code pane preview looks correct, but the
> file does not compile, throwing a bunch of errors along the lines of
> "Package pgfkeys Error:", etc. (I assume people can reproduce these...)
>
> Oh, also, I tried the example from the manual in TeXMaker to verify it
> wasn't some oddity of my TeX installation, and it compiled okay
> (except for the "background tree" option). It looked a lot more like
> what's in the manual than anything LyX produced (attached).
>
> So, yeah, I have a workaround in case it can't work--I could produce
> the doc in LyX, then export to TeX and finish the lattice thing there.
> I was just hoping there was an easier way.
>
> Linux Mint 19.1
> texlive ~2017
> LyX 2.3.6.1
>
> Maria
Hello,
I think you should do this in TikZ. You would not regret.
Attached is a simple setup for you get started. Compile the LaTeX file
Fig01.tex and get the PDF of your figure first. Then, you can insert the
PDF into your LyX file. If you want to change your figure, just compile
the file again and LyX will do the job automatically for you.
My recommendation is: do not insert your code for figures (whether TikZ
or not) into LyX as ERT box. Compile them separately and generate the
figure PDF first. Then, insert the figure PDF into LyX. This will help
you find errors and change the figures more easily without compiling
whole LyX file. Also, it would be easier for LyX to compile the document.
Baris
--
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
Please bottom-post. Start your reply here:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20211220/b07fdee5/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tree_i_want.png
Type: image/png
Size: 3542 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20211220/b07fdee5/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fig01.pdf
Type: application/pdf
Size: 12241 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20211220/b07fdee5/attachment-0001.pdf>
-------------- next part --------------
\documentclass[]{standalone}
\input{figs_opts.tex}
\begin{document}
\begin{tikzpicture}[line join=round]
\draw[anchor=mid]
(0,0) node (a) {a}
(1,0) node (b) {b}
(0,-1) node (c) {c}
(1,-1) node (d) {d};
\node (e) at (1,-2) {e};
\node (f) at (1,-3) {f};
\draw (a) -- (c);
\draw (a.south) -- (d.north);
\draw (c.north) -- (b.south);
\draw (b) -- (d);
\draw (d) -- (e);
\draw (e) -- (f);
\end{tikzpicture}
\end{document}
-------------- next part --------------
%\usepackage{mathptmx}
%\renewcommand{\familydefault}{\rmdefault}
%\usepackage[T1]{fontenc}
%\usepackage[latin9]{inputenc}
\usepackage{siunitx}
\usepackage{array}
\usepackage{amsmath}
\usepackage{ifthen}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\usepackage{titling, graphicx}
\usepackage{tikz}
\usepackage{upgreek}
\usepackage{amsmath,amsthm}
\usepackage{strtikz}
\usetikzlibrary{shapes,arrows.meta,intersections,graphs,graphs.standard}
\usetikzlibrary{math,fit}
\usetikzlibrary{calc,intersections,through,backgrounds,decorations.pathmorphing}
\usetikzlibrary{patterns}
More information about the lyx-users
mailing list