2

I am using forest package to write some algebra with planar trees. However, when I combine automatically sized brackets with my forest picture, the bracket size and position is completely wrong: it goes all the way below the forest. How do I get the adequately sized and positioned brackets?

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{forest}

\begin{document}
$$\left ( \begin{forest}
for tree = {grow'=90,circle, fill, minimum width = 4pt, inner sep = 0pt, s sep = 13pt}
[{},phantom
[{},name = one [[]] [[][]] ]
[{},name = two [[]] [[]] ]
]
\draw[black] (one) -- (two);
\end{forest},
\begin{forest}
for tree = {grow'=90,circle, fill, minimum width = 4pt, inner sep = 0pt, s sep = 13pt}
[{},phantom
[{},name = one [[]] [[][]] ]
[{},name = two [[]] [[]] ]
[{},name = three [  [][]]]
[{},name = four [ [] [] []] [[]]  ]
]
\draw[black] (one) -- (two) -- (three) -- (four);
\end{forest} \right )$$

\end{document}

This is what happens

3

Do not use $$ ... $$ but use \[ ... \] instead. You need to center the tree vertically, which can be done with \vcenter.

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{forest}

\begin{document}
\[\left (\vcenter{\hbox{\begin{forest}
for tree = {grow'=90,circle, fill, minimum width = 4pt, inner sep = 0pt, s sep = 13pt}
[{},phantom
[{},name = one [[]] [[][]] ]
[{},name = two [[]] [[]] ]
]
\draw[black] (one) -- (two);
\end{forest},
\begin{forest}
for tree = {grow'=90,circle, fill, minimum width = 4pt, inner sep = 0pt, s sep = 13pt}
[{},phantom
[{},name = one [[]] [[][]] ]
[{},name = two [[]] [[]] ]
[{},name = three [  [][]]]
[{},name = four [ [] [] []] [[]]  ]
]
\draw[black] (one) -- (two) -- (three) -- (four);
\end{forest}}} \right )\]

\end{document}

enter image description here

1
  • Yes, now this looks fine! Thank you very much. – Dasha Poliakova Nov 12 '20 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.