4

I am using gb4e for numbered examples in my dissertation, since most of my examples are interlinear glosses. I am also including syntax trees, using tikz-qtree. One problem, though, is how to keep item numbers together with the trees. The university's editorial office is notoriously picky (and in this case, so am I). Below is a MWE illustrating the issue.

How do I keep the example number with the tree (without having to manually fix each problem)?

\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 Answer 1

5

Rather than trying to hack the position of the tikzpicture environment using \vadjust it is better to adjust the baseline of the tikzpicture environment. Doing this puts your graph onto the second page with the equation number:

enter image description here

To do this I have commented out your hack using \vadjust and added baseline=(current bounding box.center) to the tikzpicture environment.

Here's the adjusted version of your code:

\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}
2
  • Andrew, Your solution was great, with just one little tweak. I really need the top of the tree to align with the example number (rather than having the example number appear in the middle of tree). I used [baseline=(current bounding box.north)], and it did exactly what I needed it to do. Thanks for putting me on the right track.
    – ToddAO
    Sep 22, 2014 at 0:18
  • 3
    @ToddAO to achieve that behavior, you can also simply write \begin{tikzpicture}[baseline], rather than typing out the whole baseline=(current bounding box.north).
    – Adam Liter
    Sep 22, 2014 at 19:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .