As it is well known, some tex projects need to be compiled several times to get things done.
I have this case with the forest package where the output is as expected at the first compilation.
However, I need to run the compilation command more than once as the rest of my slides have references, for instance.
The problem is that the frame became a pretty mess after two or more compilations.
Besides, the figure is fixed after I delete the .aux files.
I'm using lualatex v1.13, but the problem remains with other compilers. Does anyone knows what is the problem here?
\documentclass[notes,11pt, aspectratio=169]{beamer}
\usepackage{tikz}
\usepackage{forest}
\usetikzlibrary{overlay-beamer-styles}
\usetikzlibrary{snakes, arrows, fit, arrows.meta}
\tikzset{
every picture/.style={remember picture,baseline},
alt/.code args={<#1>#2#3}{%
\alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
},
temporal/.code args={<#1>#2#3#4}{%
\temporal<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}{\pgfkeysalso{#4}}
},
onslide/.code args={<#1>#2}{%
\only<#1>{\pgfkeysalso{#2}}
}
}
\begin{document}
\begin{frame}{Test}
\begin{forest}
for tree={
treenode/.style = {draw,align=center, inner sep=3pt,
text centered, font=\sffamily},
arn_n/.style = {treenode, rectangle},
arn_x/.style = {treenode},
gray-arrow/.style = {draw=gray},
edge=-{Stealth}}
[$c_{44}$, arn_n,
[$c_{38}$, arn_n, temporal=<2>{fill=yellow}{fill=yellow!50}{fill=yellow!25}, name=c38,
[$c_{26}$, arn_n, temporal=<2>{fill=green}{fill=yellow}{fill=yellow!50}, name=c26,
[$c_{1}$, arn_x, temporal=<2>{}{fill=green}{}, name=c1],
[$c_{2}$, arn_x, temporal=<2>{}{fill=green}{}, name=c2
]
],
[$c_{27}$, arn_n, temporal=<2>{fill=green}{fill=yellow}{fill=yellow!50},
[$c_{3}$, arn_x, temporal=<2>{}{fill=green}{}],
[$c_{4}$, arn_x, temporal=<2>{}{fill=green}{}
]
]
],
[$c_{39}$, arn_n,
[$c_{28}$, arn_n,
[$c_{5}$, arn_x],
[$c_{6}$, arn_x]
],
[$c_{29}$, arn_n,
[$c_{7}$, arn_x],
[$c_{8}$, arn_x]
]
]
]
\draw[->, dashed] (c1) to[out=north west, in=west] (c26);
\draw[->, dashed] (c2) to[out=north east, in=east] (c26);
\draw[->, dashed] (c26) to[out=north, in=west] (c38);
\end{forest}
\end{frame}
\end{document}


remember pictureat least, remove that and it works fine. Beyond that, I have no idea though .. – Torbjørn T. Apr 03 '22 at 17:29remember picturewas useless in my slides (newbie here!)... While it solved my question, I'm curious to know what was affecting it! – José Joaquim Apr 03 '22 at 17:49remeber pictureistikzinstruction which need that document should be compiled at least twice (simplified: at first image coordinates are stored in .aux` file, at second are correct establish on image). – Zarko Apr 03 '22 at 18:34forestcleans away its coordinates etc. (unless you tell it not to). I'm guessing thetikzstorage is interfering and you're getting multiple things floating around with the same identifiers, but I don't know. – cfr Aug 09 '23 at 00:59