Drawing nice side-by-side trees in LaTeX

In my work I often have to describe the model I use. For this it is almost inevitable to draw some hierarchical production functions. The following shows you how to draw two production functions side by side using Tik/. TikZ is a German acronym and stands for “TikZ ist kein Zeichenprogramm” (TikZ is not a drawing program) and produces high-quality drawings in LaTeX.

This is how the two production function look in the paper:

2017-12-06 12_04_12-Report top-down modeling.pdf - SumatraPDF

I use the Latex package subcaption (as the package subfigure is deprecated) to get the two production functions side by side. You further need to load Tikz and Tikz-qtree.

Some remarks:

  • The following line starts the left panel of the figure. I set the width to 0.45 of the text width, so both pictures can fit easily. Furthermore, I use the option “t”, so that both figures align at the bottom.
  • The following code starts the TikZ picture with some style settings. The size of the picture is slightly reduced
  • The direction of growth for the production function is down. I change this direction to “up” to add the top of the picture.
  • Each nest starts with a top node by adding a dot right after the square parenthesis, like: [.{your text}. Every child is added by some text between two curly brackets like