I want to typeset AVMs. A colleague wrote the following code and it works quite well. However there is a little problem with the brackets. Some of them are not aligned properly. For example the second closing bracket is too low:
This is the code. \ms checks whether a type (set in italics) is provided as optional argument or not.
\documentclass{article}
\usepackage{array}
\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}%
}
\begin{document}
\ms[word]{
syntax-semantics & \ldots \ms[local]{ category & \ms[category]{ head & \ms[noun]{ case & 1\\
}\\[6mm]
subcat & Det[\textsc{case}~1] \\
} \\[6mm]
content & \ldots \ms[grammatik]{ inst & X \\
}\\
}\\
}
\end{document}
Edit:
There seems to be a problem with cases like this:
\ms{
synsem$|$loc$|$cat \ms{ head & \ms[verb]{vform & fin
}\\
subcat & \ldots\\
}
}
The output looks like this:
The problem is that there is too much space between the two right-most brackets.
;-)
@{\hspace{5pt}}
which has nothing to do with the size of brackets. If you want to open a new question for this you're welcome. Changing questions so that they invalidate already given and working answers is against the site's guidelines.\begin{tabular}{>{\upshape\scshape}l@{}>{\hspace*{5pt}\normalfont\itshape}l}