带有 tikz-qtree 树的 gb4e 项目编号

带有 tikz-qtree 树的 gb4e 项目编号

我在论文中使用 gb4e 来编号示例,因为我的大多数示例都是行间注释。我还使用 tikz-qtree 来包含语法树。不过,有一个问题是如何将项目编号与树放在一起。众所周知,大学的编辑部非常挑剔(在这种情况下,我也是)。下面是一个 MWE,说明了这个问题。

我如何将示例编号与树一起保存(而不必手动修复每个问题)?

\documentclass{article}
\usepackage{lipsum}
\usepackage{tikz-qtree,tikz-qtree-compat}
\usepackage{gb4e}
\tikzset{every tree node/.style={align=center, anchor=north}}
\begin{document}
The relevant structure in \ref{tree:opt-marker-verb-move} shows the necessary movement for the verb to precede the suffix. XP refers to some unknown structure to which the verb is drawn.
\lipsum[3-6]
\begin{exe}
\ex
\leavevmode\vadjust{\vspace{-\baselineskip}}\newline %this command makes the example number line up with the top of the tree, rather than the bottom
\begin{tikzpicture}
\tikzset{every tree node/.style={align=center,anchor=north}}
\Tree [.XP \node(XP){}; 
[.\textsc{FocusP} =em 
[.TP
[.vP {} 
[.VP {} 
[.V \node(VERB){puv}; ] 
] ] ] ] ]
\draw[->] (VERB) [in=-130,out=-180,looseness=1.5] to (XP);
\end{tikzpicture}\label{tree:opt-marker-verb-move}
\end{exe}
\end{document}

答案1

与其尝试使用\vadjust它来破解 tikzpicture 环境的位置,不如调整baselinetikzpicture 环境的位置。这样做会将您的图表放到第二页,其中包含方程编号:

在此处输入图片描述

为此,我已注释掉您的 hack 使用\vadjust并将其添加baseline=(current bounding box.center)到 tikzpicture 环境中。

这是您的代码的调整版本:

\documentclass{article}
\usepackage{lipsum}
\usepackage{tikz-qtree,tikz-qtree-compat}
\usepackage{gb4e}
\tikzset{every tree node/.style={align=center, anchor=north}}
\begin{document}
The relevant structure in \ref{tree:opt-marker-verb-move} shows the necessary movement for the verb to precede the suffix. XP refers to some unknown structure to which the verb is drawn.
\lipsum[3-6]
\begin{exe}
\ex
%\leavevmode\vadjust{\vspace{-\baselineskip}}\newline %this command makes the example number line up with the top of the tree, rather than the bottom
\begin{tikzpicture}[baseline=(current bounding box.center)]
\tikzset{every tree node/.style={align=center,anchor=north}}
\Tree [.XP \node(XP){};
[.\textsc{FocusP} =em
[.TP
[.vP {}
[.VP {}
[.V \node(VERB){puv}; ]
] ] ] ] ]
\draw[->] (VERB) [in=-130,out=-180,looseness=1.5] to (XP);
\end{tikzpicture}\label{tree:opt-marker-verb-move}
\end{exe}
\end{document}

相关内容