The following doesn't render well with tikz and forest used together:

\tikzstyle{every picture}+=[remember picture,inner xsep=0,inner ysep=0.25ex]

\Forest{[A[a][B, calign with current [A, calign with current][a]]]}

To see the bad effect, you have to run pdflatex twice on the .tex file. The first time, the pdf renders well, the second time, the branches are separated from the text.

This is related to How do I make a straight skeleton with qtree?

  • 3
    What's the purpose of remember picture for every picture? – egreg Apr 12 '18 at 13:06
  • Forest uses TikZ. You're applying remember to every forest, which won't work. Generally, better apply remember just to the pictures you need it for as it causes all kinds of complications (and excludes externalising with the external library). – cfr Apr 14 '18 at 3:02

I completely agree with the comment from @egreg. The clash of forest with tikz is really in the remember picture.

That being said I would like to propose a working solution, in this case using tikzmark assuming you do want to connect individual figures, while removing remember picture from the tikzstyle. The result is as such:

tikz forest

Notice the arrow created by incorporating the \subnode{ } commands and adding an overlay tikzpicture according to:


\tikzstyle{every picture}+=[inner xsep=0,inner ysep=0.25ex]


[A[a][B, calign with current [{A}, calign with current][\subnode{argA1}{a}]]]

[A[\subnode{argB2}{a}][{B}, calign with current [A, calign with current][a]]]

\begin{tikzpicture}[overlay,remember picture]
\draw[-latex, bend angle=40, bend right] (argA1.north) to (argB2.south);

  • thanks. I have another place with a tikzpicture where if I don't have the tikzstyle in general with "remember picture", then it doesn't work (even when I add remember picture to that specific tikzpicture). Any ideas why? (though your solution works for the forest picture.) – user2299502 Apr 12 '18 at 14:22
  • I fixed that! I didn't put "remember picture" in all places I should have. – user2299502 Apr 12 '18 at 15:04
  • That would explain it ;). Great that you found the solution to this minor problem and to the overall one. – Steyn W. Apr 13 '18 at 8:25

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.