# Example number from bottom to top of a Tree in Forest

After a recent update from MacTex 2015 to 2016, the forest package also updates, which caused problems for an existing tree had. The problem concerns the example number the gb4e package creates. Before the update the number appeared at the same height as the node CP-phase. In this version the example number appears at the bottom.

\documentclass{minimal}
\usepackage{forest, gb4e}

\forestset{
fairly nice empty nodes/.style={
delay={where content={}{shape=coordinate,for parent={
for children={anchor=north}}}{}}
}}
\useforestlibrary{linguistics}
\forestapplylibrarydefaults{linguistics}
\begin{document}

\begin{exe}
\ex \label{saktree1}
\begin{forest}, fairly nice empty nodes,
[CP-phase, phantom, l sep=19pt,
[\ldots, for descendants={l=0}, name=dots, tikz={\node [draw,inner sep=20pt, fit=(V)(dots)(book)(Erel)(v)(T)] {};}
[\textit{v}P
[DP
[Erel, fit=band, roof, name=Erel ] ]
[{}, calign angle=60
[VP, name=VP, tikz={\node [draw, inner sep=1pt, fit=(VP)(V)(book)] {};}
[DP
[ kinige, name=book, roof ] ]
[V\\atyylas-ta, name=V] ]
[\textit{v}, name=v, fit=band ] ] ]
[T, name=T, fit=band ] ] ]
\node at (dots)[above=6ex]{\bfseries{CP-phase}}; baseline
\node at (VP)[below=78pt]{\bfseries{VP-phase}}; name=VPnod
\end{forest}
\end{exe}
\end{document}


The code yields the following output:

• The problem has something to do with how the phantom node is drawn; if you remove that, it aligns again. (Not a solution, just an observation.) The code for this was changed in the most recent version, so possibly this is a bug. – Alan Munn Aug 8 '16 at 22:34
• Yes, removing the phantom makes part of the problem go away, but the example number shows up at the same height as the three dots node and not att the CP-phase node. – David Kroik Aug 8 '16 at 22:49
• If I remove phantom from your code and make the \node... command that contains CP phase empty, the number lines up with the CP phase node. – Alan Munn Aug 8 '16 at 22:52
• I can reproduce your result. The only problem that remains is the line between the node containing CP-phase and the node with the dots. – David Kroik Aug 8 '16 at 23:18

In the linguistics library, the root node is automatically set as baseline. However (since forest v2.0.3), baseline on phantom nodes is ignored --- as it should be, as they are not drawn.

To set the CP-phase (non-forest) node as baseline, one needs to use tikz's key baseline. One way to do this, by appending to forest's style begin draw and thus providing arguments to the entire tikzpicture that forest produces, is shown below.

\documentclass{minimal}
\usepackage{forest, gb4e}

\forestset{
fairly nice empty nodes/.style={
delay={where content={}{shape=coordinate,for parent={
for children={anchor=north}}}{}}
}}
\useforestlibrary{linguistics}
\forestapplylibrarydefaults{linguistics}
\begin{document}

\begin{exe}
\ex \label{saktree1}
\begin{forest}, fairly nice empty nodes,
begin draw/.append code={[baseline=(CP-phase.base)]},
[CP-phase, phantom, l sep=19pt,
[\ldots, for descendants={l=0}, name=dots, tikz={\node [draw,inner sep=20pt, fit=(V)(dots)(book)(Erel)(v)(T)] {};}
[\textit{v}P
[DP
[Erel, fit=band, roof, name=Erel ] ]
[{}, calign angle=60
[VP, name=VP, tikz={\node [draw, inner sep=1pt, fit=(VP)(V)(book)] {};}
[DP
[ kinige, name=book, roof ] ]
[V\\atyylas-ta, name=V] ]
[\textit{v}, name=v, fit=band ] ] ]
[T, name=T, fit=band ] ] ]
\node at (dots)[above=6ex,name=CP-phase]{\bfseries{CP-phase}}; baseline
\node at (VP)[below=78pt]{\bfseries{VP-phase}}; name=VPnod
\end{forest}
\end{exe}
\end{document}


A "historical" note. The interaction between baseline and phantom was actually buggy pre-2.0.3. OP's example only works because the root, which is placed at (0,0), is the intended baseline.

Also note that the above code nicely aligns the (TeX) baselines of (1) and CP-phase, while versions prior to 2.0.3 aligned the baseline of (1) and the center of CP-phase.