有兩個森林人物並使用 tikzmark

有兩個森林人物並使用 tikzmark

forest在同一figure環境中有兩個人物,我想tikzmark在兩個人物中使用。結果應該是這樣的:

在此輸入影像描述

我目前的程式碼是這樣的:

\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}

問題是我不知道如何繪製箭頭。我將第一個數字的命令放在第一個數字之後,將第二個數字的命令放在最後一個數字之後,但這不起作用。因此,目前的最小範例將所有繪圖命令放在最後一個圖形之後,但這也不起作用:

在此輸入影像描述

編輯:下面的解決方案工作正常,直到我更新到 texlive 2014 並完成所有更新。現在我得到:

在此輸入影像描述

有什麼我可以做的嗎?

答案1

您在記住坐標後進行了縮放,這是錯誤的順序:

在此輸入影像描述

\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}

相關內容