AVMs in LaTeX
[ LaTeX for Linguists, .dvi, .ps, .pdf]

Andrew Bredenkamp

  • Loading avm.sty
  • Using avm.sty
  • Large avms
  • Advanced topics
  • Other packages
  • The package

  • Most people use Chris Manning's avm.sty for producing sorted and unsorted attribute-value matrices.

    (If you just want to make a single avm, you could just use a LaTeX array environment (see below), but avm.sty is very simple, and much easier).

    Loading avm.sty

    As with other packages, you can load avm.sty with the following line in the preamble (before the \begin{document}):


    There are a number of options for avm.sty which can be set in the preamble, these define the type of avm you want and the fonts for values, sorts, etc. All examples given below assume that the following options are set:


    Using avm.sty

    Using avm.sty in `active/sorted' mode allows avms for `typed feature structures' to be constructed quickly and clearly.

    Here is an example:

            synsem|local|cat|head  @{1} \\
            dtrs  [{hd-str}
                    head-dtr|\ldots|head @{1}]]

    The position of the sort label can be changed (see the full documentation).

    It is very easy to get other sorts of bracket (again, see the full documentation).

    Untyped avms of the kind used in LFG functional descriptions can be created in the same way (just give an empty sort):

    [{}  pred  & `likes< \_ , \_ >'     \\
         tense &  pres                \\
         subj  &  [{} pred & `Fido']  \\
         obj   &  [{} pred & `bones']]
    If you only ever produce avms without the sort, you can turn off the `sorted' option, and so not write the empty `{}' that was used above (again, see the full documentation).

    The advantage of using the `active' option is that the commands for doing things like drawing the square brackets do not need a `backslash' in front of them. The disadvantage is that this means you cannot define a command to draw an avm (e.g. to draw the same avm twice). If you want to do this (and it is a very useful thing to do, especially when making large avms (a) because they can be difficult for LaTeX, and (b) because they can be difficult for you -- it is easier to avoid mistakes if you make your avms in small pieces separately, and then just combine the pieces together), you need the `inactive' option. We look at this in the next section.

    Large avms

    Due to a limitation on LaTeX, large avms can cause problems (you might get errors referring to semantic nest size. To get round this, you have to build complex avms by nesting smaller ones (it is also easier to avoid mistakes if you do things like this). The best way to do this is by defining and using `boxes':

    \newbox\matrixsynsem \newbox\headdtr 
    \newbox\compdtrone   \newbox\compdtrtwo
    \osort{synsem}{\[local & \[cat & \[ \] \\
                        content & \[ \]\]\]}
    \osort{word}{\[ phon\;\<\rm likes\>\\
                synsem\;\[local\[ cat\;\[ head  \; \@{5}\\
                                          arg-s\;\< \@{1},\@{2}\>\] \\
                                  content\;\@{6} \]\]\]} \end{avm}}
    \sort{phrase}{\[ phon\;\<\rm fido\>\\
                synsem\;\@{1}\;\[local\[ cat\;\[ head\;noun\\
                                          arg-s\;\< \>\] \\
                                  content\;\@{3} \]\]\]} \end{avm}}
    \sort{phrase}{\[ phon\;\<\rm bones\>\\
                synsem\;\@{2}\;\[local\[ cat\;\[ head\;noun\\
                                          arg-s\;\< \>\] \\
                                  content\;\@{4} \]\]\]} \end{avm}}
    \begin{avm} \hspace{-1in}
    [{phrase} phon\;\<\rm fido likes bones\> \\
           synsem\;[{synsem} local [{} cat & [{} head & @{5}\\
                                                 arg-s & \< \; \>] \\
                                       content & @{6}[{psoa} reln\;like \\
                                                         arg1\;@{3} \\
                                                         arg2\;@{4} ]]]\\
           dtrs\;\sort{head-struc}{[{} head-dtr\;\box\headdtr \\
                      comp-dtrs\;< \box\compdtrone , \\ \hspace{.5in}


    Advanced topics

    It is possible to draw curves between points inside an avm by using tree-dvips.sty:

    [{} pred & liet<($\uparrow$ subj)($\uparrow$ obj)($\uparrow$ xcomp)>' \\
            subj & `Marie' \\
        obj  & \node{uobj}{`Jan'} \\
            xcomp & [{} pred & `bouwen' \\
                        subj & \node{dsubj}{`  '}  \\
                        obj  & `een huis' \\
                        obl_{voor} & [{} pred &`voor' \\
                                       obj  & `zich' ]]]

    will produce:

    You can combine trees with avms using features from tree-dvips.sty:

    This was generated by the following code:

    & \node{s}{S} \\[.3in]
    \node{np1}{NP} && \node{vp}{VP} \\[.2in]
    \node{n}{N} & \node{v}{V} && \node{np2}{NP} \\[.3in]
    \node{fido}{Fido} & \node{likes}{likes} && \node{bones}{bones}
    \node{f1}{[{}  pred  & `likes< \_ , \_ >'     \\
         tense &  pres                \\
         obj   &  [{} pred & `bones']    \\
         subj  &  \node{f2}{[{} pred & `Fido']} ]}

    Other packages

    There is an up-dated version, avm3e.sty, available. It seems to be backwards compatible with avm.sty. It is available from "the usual places". If you have only one avm to make, you could always just use a LaTeX array:

    \[      % we go into display maths mode
    \left [ % draw the opening left bracket
    \begin{array}{ll}   % begin a two column array
       TENSE & pres\\
       PRED & 'like<\_,\_>' \\
       SUBJ &  \left  [ \begin{array}{ll}
                                 PRED & 'Fido\\
               \right  ]  \\
       OBJ   & \left [ \begin{array}{ll}
                              PRED & 'bones'
               \right ]
    \end{array} % end the outer array
    \right ]    % closing right bracket
    \]          % out of math mode

    The package

    The package is available here in the following bundles:

    Last real modification: July 10, 1997
    Last Modified (trivially) September 25, 2007.

    LaTeX for Linguists,
    Doug Arnold,
    September 25, 2007.