Phrase structure rules

Phrase structure rules for use with LFG for example, can be created by defining the new commands given below, as originally given in an introduction to LaTeX for computational linguistics students.

\documentclass[a4paper,12pt]{article}

% LFG
\newcommand{\symb}[2]{%
\begin{tabular}{c}
\normalsize{#1} \\
\footnotesize{#2}
\end{tabular}
}

% Optional-rule support
\newcommand{\opt}[1]{\ensuremath{\left(#1\right)}}
% Macros
\renewcommand{\to}{\ensuremath{\rightarrow}}
\newcommand{\ua}{\ensuremath{\uparrow}}
\newcommand{\da}{\ensuremath{\downarrow}}

\begin{document}

\symb{VP}{}       \blank
\symb{\to}{}      \blank
\symb{V}{\ua=\da} \blank
\opt{\symb{NP}{(\ua OBJ)=\da}}

\end{document}

Use the commands as shown in the main document to produce this output:

I’ve only used these commands for LFG, but I’m sure you could use them without the arrows and whatnot to get the functionality to replace that in covington, once you drop that in favour of gb4e. The mark-up might look like a nightmare at first, but it’s not really any worse than similar LaTeX stuff.

The \blanks seem to be present only to act as spacers; it’s possible to remove them if you prefer:

\documentclass[a4paper,12pt]{article}

% LFG
\newcommand{\symb}[2]{%
\begin{tabular}{c}
\normalsize{#1} \\
\footnotesize{#2}
\end{tabular}
}

% Optional-rule support
\newcommand{\opt}[1]{\ensuremath{\left(#1\right)}}
% Macros
\renewcommand{\to}{\ensuremath{\rightarrow}}
\newcommand{\ua}{\ensuremath{\uparrow}}
\newcommand{\da}{\ensuremath{\downarrow}}

\begin{document}

\symb{VP}{}
\symb{\to}{}
\symb{V}{\ua=\da}
\opt{\symb{NP}{(\ua OBJ)=\da}}

\end{document}

This site uses Akismet to reduce spam. Learn how your comment data is processed.