4

I have two forest figures in the same figure environment and I want to use tikzmark in both of them. The outcome is supposed to look like this:

enter image description here

My current code is this:

\documentclass{article}                          


\usepackage{forest}

\usetikzlibrary{tikzmark}

\forestset{
sn edges/.style={for tree={parent anchor=south, child
anchor=north,align=center,base=bottom,
where n children=0{tier=word}{}}}
}


\newcommand{\spirit}[1]{%
{\renewcommand{\arraystretch}{0}%
\begin{tabular}[t]{@{}c@{}}%
\ibox{#1}\\[-3.2mm]
\large/\\%
\end{tabular}}}

\newcommand{\sliste}[1]{%
\mbox{%
$\left\langle\mbox{\upshape\scshape #1}\right\rangle$}%
}

\def\ibox#1{\mbox{}\setbox2=\hbox{$\scriptstyle #1$}\lower.2ex\vbox{\hrule
        \hbox{\vrule\kern1.25pt 
        \vbox{\kern1.25pt\box2\kern1.25pt}\kern1.25pt\vrule}\hrule}}

\begin{document}


\begin{figure}
\hfill\resizebox{0.47\linewidth}{!}{%
\begin{forest}
sn edges, for tree={l sep= 6ex}
[V{[{\sc subcat} \sliste{ \spirit{1}, \spirit{2} }]}
        [\ibox{1} NP{[\textit{nom}]}
                [er]]
        [V{[{\sc subcat} \sliste{ \ibox{1}, \spirit{2} } ]}
                [\ibox{2} NP{[\textit{acc}]}
                        [die Äpfel,triangle]]
                [V{[{\sc subcat} \sliste{ \ibox{1}, \ibox{2} } ]}
                        [\tikzmark{ap1}{AP}
                                [ungewaschen]]
                        [V{[{\sc subcat} \sliste{ \tikzmark{arg11}{\ibox{1}}, \tikzmark{arg12}{\ibox{2}} }]}
                                [isst]]]]]
\end{forest}
}
\hfill\resizebox{0.47\linewidth}{!}{%
\begin{forest}
sn edges, for tree={l sep= 6ex}
[V{[{\sc subcat} \sliste{ \spirit{1}, \spirit{2} } ]}
        [\ibox{1} NP{[\textit{nom}]}
                [er]]
        [V{[{\sc subcat} \sliste{ \ibox{1}, \spirit{2} } ]}
                [\tikzmark{ap2}{AP}
                        [ungewaschen]]
                [V{[{\sc subcat} \sliste{ \tikzmark{arg21}{\ibox{1}}, \spirit{2} } ]}
                        [\ibox{2} NP{[\textit{acc}]}
                                [die Äpfel,triangle]]
                        [V{[{\sc subcat} \sliste{ \ibox{1}, \ibox{2} } ]}
                                [isst]]]]]
\end{forest}
\begin{tikzpicture}[overlay,remember picture]
\draw[->, bend angle=40, bend left] ($(pic cs:ap1)+(1ex,2ex)$) to($(pic cs:arg11)+(1ex,2.5ex)$);
\draw[->, bend angle=40, bend left] ($(pic cs:ap1)+(1ex,2ex)$) to($(pic cs:arg12)+(1ex,2.5ex)$); % 1ex links, 2ex hoch
%
\draw[->, bend angle=40, bend left] ($(pic cs:ap2)+(1ex,2ex)$) to($(pic cs:arg21)+(1ex,2.5ex)$);
\end{tikzpicture}
}
\hfill\mbox{}
\caption{Analysis of \emph{dass er die Äpfel ungewaschen isst} and \emph{dass er ungewaschen die Äpfel isst}}
\end{figure}


\end{document}

The problem is that I do not know how to draw the arrows. I put the commands for the first figure after the first figure and the ones for the second figure after the last one, but this did not work. So the current minimal example put all drawing commands after the last figure but this does not work either:

enter image description here

Edit: The solution below worked fine until I updated to texlive 2014 and did all updates. Now I get:

enter image description here

Is there anything I can do?

8

You had scaled after remembering the coordinates, which is the wrong order:

enter image description here

\documentclass{article}
\usepackage{forest}

\usetikzlibrary{tikzmark}

\forestset{
sn edges/.style={for tree={parent anchor=south, child
anchor=north,align=center,base=bottom,
where n children=0{tier=word}{}}}
}


\newcommand{\spirit}[1]{%
{\renewcommand{\arraystretch}{0}%
\begin{tabular}[t]{@{}c@{}}%
\ibox{#1}\\[-3.2mm]
\large/\\%
\end{tabular}}}

\newcommand{\sliste}[1]{%
\mbox{%
$\left\langle\mbox{\upshape\scshape #1}\right\rangle$}%
}

\def\ibox#1{\mbox{}\setbox2=\hbox{$\scriptstyle #1$}\lower.2ex\vbox{\hrule
        \hbox{\vrule\kern1.25pt 
        \vbox{\kern1.25pt\box2\kern1.25pt}\kern1.25pt\vrule}\hrule}}

\begin{document}


\begin{figure}
\resizebox{\linewidth}{!}{%
\begin{forest}
sn edges, for tree={l sep= 6ex}
[V{[{\sc subcat} \sliste{ \spirit{1}, \spirit{2} }]}
        [\ibox{1} NP{[\textit{nom}]}
                [er]]
        [V{[{\sc subcat} \sliste{ \ibox{1}, \spirit{2} } ]}
                [\ibox{2} NP{[\textit{acc}]}
                        [die Äpfel,triangle]]
                [V{[{\sc subcat} \sliste{ \ibox{1}, \ibox{2} } ]}
                        [\tikzmark{ap1}{AP}
                                [ungewaschen]]
                        [V{[{\sc subcat} \sliste{ \tikzmark{arg11}{\ibox{1}}, \tikzmark{arg12}{\ibox{2}} }]}
                                [isst]]]]]
\end{forest}
\begin{forest}
sn edges, for tree={l sep= 6ex}
[V{[{\sc subcat} \sliste{ \spirit{1}, \spirit{2} } ]}
        [\ibox{1} NP{[\textit{nom}]}
                [er]]
        [V{[{\sc subcat} \sliste{ \ibox{1}, \spirit{2} } ]}
                [\tikzmark{ap2}{AP}
                        [ungewaschen]]
                [V{[{\sc subcat} \sliste{ \tikzmark{arg21}{\ibox{1}}, \spirit{2} } ]}
                        [\ibox{2} NP{[\textit{acc}]}
                                [die Äpfel,triangle]]
                        [V{[{\sc subcat} \sliste{ \ibox{1}, \ibox{2} } ]}
                                [isst]]]]]
\end{forest}
\begin{tikzpicture}[overlay,remember picture]
\draw[->, bend angle=40, bend left] ($(pic cs:ap1)+(1ex,2ex)$) to($(pic cs:arg11)+(1ex,2.5ex)$);
\draw[->, bend angle=40, bend left] ($(pic cs:ap1)+(1ex,2ex)$) to($(pic cs:arg12)+(1ex,2.5ex)$); % 1ex links, 2ex hoch
%
\draw[->, bend angle=40, bend left] ($(pic cs:ap2)+(1ex,2ex)$) to($(pic cs:arg21)+(1ex,2.5ex)$);
\end{tikzpicture}}

\caption{Analysis of \emph{dass er die Äpfel ungewaschen isst} and \emph{dass er ungewaschen die Äpfel isst}}
\end{figure}


\end{document}
  • How silly of me! Thanks! I first had two separate tikzpictures in the scalings but then broke it by fixing ... – Stefan Müller Dec 12 '14 at 11:25
  • A recent update seems to have brooken this (see edit in the question). What now? Shall I ask a new question about this? – Stefan Müller Feb 19 '15 at 10:41
  • @StefanMüller I just did a full update of TL2014 this morning to check, and it works OK for me. – David Carlisle Feb 19 '15 at 12:04
  • Oh, cool: It is a xelatex bug. It works with pdflatexbut it does not with xelatex. – Stefan Müller Feb 19 '15 at 13:56
  • @StefanMüller ah. OK in that case it's definitely a new question:-) or perhaps better to ask on the xetex list. (I can confirm same here) – David Carlisle Feb 19 '15 at 13:57

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.