Aligning siblings with complex content in forest

I have the following code and I want the AVMs to be aligned at the top. The two PHON values should be at the same height. I have the option base=top set for all nodes, but this does not work.

\documentclass{article}
\usepackage{forest}

\forestset{.style={for tree={parent anchor=south, child anchor=north,align=center,base=top}}}

\usepackage{array}

\makeatletter

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

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

\newcommand{\liste}[1]{%
\mbox{%
$% \left\langle\begin{tabular}{@{}>{\upshape\scshape}l@{}}#1\end{tabular}\right\rangle%$%
%\\[-1.5mm]
}%
}

\newcommand{\phonliste}[1]{%
\mbox{%
$% % \left\langle \mbox{\normalfont\itshape#1} \right\rangle%$%
%\\[-1.5mm]
}%
}

\setlength{\extrarowheight}{1pt}

\def\ms{\futurelet\msLook\msdecide}
\def\msdecide{\ifx\msLook[\let\next=\xxtms%
\else\let\next=\xxms\fi\next}
%
\def\xxtms[#1]#2{%
\mbox{%
\tabcolsep0pt\arraycolsep0pt%
$% \left[% \begin{tabular}{>{\upshape\scshape}l@{\hspace{5pt}}>{\normalfont\itshape}l}% #2% \multicolumn{2}{>{\normalfont\itshape}l}{#1}% \end{tabular}% \right]%$%
}%
\vspace{1mm}%
}

\def\xxms#1{%
\mbox{%
\tabcolsep0pt\arraycolsep0pt%
$% \left[% \begin{tabular}{>{\upshape\scshape}l@{\hspace{5pt}}>{\normalfont\itshape}l}% #1% \end{tabular}% \rule{0mm}{5mm}% \right]%$%
}%
\vspace{1mm}%
}

\def\onems{\tabcolsep0pt\arraycolsep0pt\futurelet\onemsLook\onemsdecide}
\def\onemsdecide{\ifx\onemsLook[\let\next=\xxtonems%
\else\let\next=\xxonems\fi\next}
%
\def\xxtonems[#1]#2{%
$\left[% \begin{tabular}{>{\upshape\scshape}l}% #2% {\normalfont\itshape #1}% \end{tabular}% \right]$%
\vspace{1mm}%
}

\def\xxonems#1{%
\mbox{%
$% \left[% \begin{tabular}{>{\upshape\scshape}l}% #1% \end{tabular}% \rule{0mm}{5mm}% \right]%$%
}%
\vspace{1mm}%
}

\makeatother

\begin{document}

\begin{forest}
%    anchor=base,base=top
baseline
[
mother node
[ \onems{
phon \phonliste{ nach Brüssel zum Demonstrieren }\\
cont|rels  \ibox{8}  \\
}, base=top ]
[   \onems{
phon \phonliste{ ist Gerd Knecht nicht gefahren }\\
cat|head|dt \sliste{ \ibox{1} }\\[1mm]
cont \ms{ ltop & \ibox{4}\\
rels & \ibox{7} $\oplus$ \ibox{2} $\oplus$ \liste{ \ibox{3} \ms[nicht-rel]{
arg & \ibox{5} \\
} } $\oplus$ \ibox{6}  \\
}\\
} ]]
\end{forest}

\end{document}


base=top is only effective if the node is a multi-lined node anchored on the baseline. But this isn't the case here. Although there are multiple lines within the node, by the time forest sees the content, it is just a box. So you could adjust the alignment probably within the box. Better would probably be not to treat the content this way at all and make use of forest's tabular alignment. That is, you could use forest and tikz styles to do what your current \defs are doing. Or much of what they are doing, anyway. However, a quick solution based on your current code is just to specify anchor=north:

\documentclass{article}
\usepackage{forest}
\usepackage{array}
\makeatletter
\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}}
\newcommand{\sliste}[1]{%
\mbox{%
$\left\langle\mbox{\upshape\scshape #1}\right\rangle$}%
}
\newcommand{\liste}[1]{%
\mbox{%
$% \left\langle\begin{tabular}{@{}>{\upshape\scshape}l@{}}#1\end{tabular}\right\rangle%$%
%\\[-1.5mm]
}%
}
\newcommand{\phonliste}[1]{%
\mbox{%
$% % \left\langle \mbox{\normalfont\itshape#1} \right\rangle%$%
%\\[-1.5mm]
}%
}
\setlength{\extrarowheight}{1pt}
\def\ms{\futurelet\msLook\msdecide}
\def\msdecide{\ifx\msLook[\let\next=\xxtms%
\else\let\next=\xxms\fi\next}
%
\def\xxtms[#1]#2{%
\mbox{%
\tabcolsep0pt\arraycolsep0pt%
$% \left[% \begin{tabular}{>{\upshape\scshape}l@{\hspace{5pt}}>{\normalfont\itshape}l}% #2% \multicolumn{2}{>{\normalfont\itshape}l}{#1}% \end{tabular}% \right]%$%
}%
\vspace{1mm}%
}
\def\xxms#1{%
\mbox{%
\tabcolsep0pt\arraycolsep0pt%
$% \left[% \begin{tabular}{>{\upshape\scshape}l@{\hspace{5pt}}>{\normalfont\itshape}l}% #1% \end{tabular}% \rule{0mm}{5mm}% \right]%$%
}%
\vspace{1mm}%
}
\def\onems{\tabcolsep0pt\arraycolsep0pt\futurelet\onemsLook\onemsdecide}
\def\onemsdecide{\ifx\onemsLook[\let\next=\xxtonems%
\else\let\next=\xxonems\fi\next}
%
\def\xxtonems[#1]#2{%
$\left[% \begin{tabular}{>{\upshape\scshape}l}% #2% {\normalfont\itshape #1}% \end{tabular}% \right]$%
\vspace{1mm}%
}
\def\xxonems#1{%
\mbox{%
$% \left[% \begin{tabular}{>{\upshape\scshape}l}% #1% \end{tabular}% \rule{0mm}{5mm}% \right]%$%
}%
\vspace{1mm}%
}
\makeatother
\forestset{.style={for tree={parent anchor=south, child anchor=north, anchor=north, align=center}}}

\begin{document}
\begin{forest}
%    anchor=base,base=top
baseline
[
mother node
[ \onems{
phon \phonliste{ nach Brüssel zum Demonstrieren }\\
cont|rels  \ibox{8}  \\
}, base=top ]
[   \onems{
phon \phonliste{ ist Gerd Knecht nicht gefahren }\\
cat|head|dt \sliste{ \ibox{1} }\\[1mm]
cont \ms{ ltop & \ibox{4}\\
rels & \ibox{7} $\oplus$ \ibox{2} $\oplus$ \liste{ \ibox{3} \ms[nicht-rel]{
arg & \ibox{5} \\
} } $\oplus$ \ibox{6}  \\
}\\
} ]]
\end{forest}
\end{document}


Note that \newcommand and friends are preferable to \def and friends in LaTeX documents. Alternatively, xparse may be used for more flexible definitions. (\def etc. are still necessary sometimes unless you use the expl3 syntax, but it is better to use them only when really necessary.)

• Sorry for this old-style AVM code. A colleague wrote it in 1993 and I am not able to modify it. Jul 13 '15 at 17:44