On Fri, Mar 30, 2018 at 5:02 PM, Scott Kostyshak <skost...@lyx.org> wrote:

> On Fri, Mar 30, 2018 at 04:55:10PM -0600, Joel Kulesza wrote:
> > On Fri, Mar 30, 2018 at 4:35 PM, Scott Kostyshak <skost...@lyx.org>
> wrote:
> >
> > > I would like to make a simple tree that uses math. The current way I do
> > > it is to use the linguistics module, which gives access to the forest
> > > package. Then I go to Insert > custom insets > Structure tree. I then
> > > wrap the math I want to write in \protect. Attached is an example of
> > > what I'm currently doing. It works, but I don't like writing out
> > > \protect, and I have the feeling I'm asking the forest package to do
> > > something it was not meant to do (include math).
> > >
> > > Does someone recommend a different way?
> > >
> >
> > I'm a fan of TikZ.
> >
> > http://www.texample.net/tikz/examples/feature/trees/
>
> Do you write out the TikZ each time? Or did you make an inset or macro
> that makes it quicker?
>
> I will be making several of these small trees. I can just copy paste the
> code each time and it is not so much trouble, but I'm curious if you
> have a smoother setup than that.


My workflow is to put global style definitions, etc. into a preamble.tex
file that I \input within LyX's Document Settings.  Or, if minimal, I
include them directly in the LyX file.

I then create the graphics as individual .tex files (usually
image_name.tikz.tex) that I then include as a Child Document in LyX.
The image_name.tikz.tex
are fully renderable files that I work with independently (these days, with
vimtex and Skim) while I tweak everything to my liking.  Because of this, I
also \usepackage{standalone} so that they inherit the parent document
style, font, etc. settings when rendered out via LyX.

I find this approach gives me the fine-grained control I need/want while
reducing repetition in the preamble.  Note that the preamble can also be
included in the individual standalone .tikz.tex files to make sure
everything is kept synchronized.

Crude demonstration attached.

- Joel

Attachment: tikz_mwe.lyx
Description: Binary data

Attachment: icon_magnifying_glass.tikz.tex
Description: Binary data

Attachment: test1.tikz.tex
Description: Binary data

Reply via email to