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

  • Introduction
  • Denotation/Evaluation Function
  • The stmaryrd package
  • Rolling your own definition
  • Discourse Representation Structures
  • References
  • Footnotes

  • Introduction

    TeX and LaTeX are very good at typesetting logic -- so typesetting most bits of semantics is very easy, just using the things you see described in the LaTeX book. (Actually, the point to note is not just that they are good, but that they are almost certainly better than you -- take what you are given unless you have a real problem).

    One small problem is that logical symbols and formulae generally require maths mode, where every letter is treated as a separate mathematical symbol. This is not a problem for logicians, who mostly use single letters for predicate names, e.g. P(x) but linguistics often need words, as in (1), and this can look clumsy unless special care is taken.

    For example, giving (2) as the characteristic function of the set of things that are different from Sam does not look very good, because the spacing (or rather, lack of ligature) between the fs. The solution is to use one of the maths type styles, e.g. \mathit. Compare (3):

    If this looks like a lot of typing, the obvious thing is to define commands:

     \newcommand{\Sam}      {\mathit{Sam}}

    Other than this, there are very few problems. However, two `problems' I do know about are:

    Before I go through these, here are a two other commands I find generally useful: \setof for putting curly brackets round elements of a set, and \tuple for putting angle brackets around a tuple:

    They are defined simply enough to work both inside and outside maths mode, by:

    \newcommand{\setof}[1]{\ensuremath{\left \{ #1 \right \}}}
    \newcommand{\tuple}[1]{\ensuremath{\left \langle #1 \right \rangle }}

    Here for reference are most the symbols that are generally needed:

    The Greek letters mostly go by their usual names, e.g.

    To get the following, you need to load the latexsym package:

    Denotation/Evaluation Function

    Basic LaTeX does not provide a command for the `semantic evaluation/denotation' function:

    However, it is provided by the stmaryrd package; alternatively, it is easy to `roll your own'

    The stmaryrd package

    James A. Crippen points out that the `semantic evaluation' brackets are part of the stmaryrd "St. Mary's Road" symbol font. To get them, put


    in the preamble:

    In this package, the brackets are known as \llbracket and \rrbracket. For example:

     \llbracket (MN)\rrbracket^{\mathcal{M}}


    For the evaluation function itself, one can define an appropriate macro:

    \newcommand{\evaluation}[2][]{\ensuremath{\llbracket #2\rrbracket^{#1}}}
    This takes two arguments, the first optional, puts the second inside the evaluation function, and superscripts the other outside. This makes typing the above much simpler, just put:

    Rolling your own definition

    It is easy enough to roll your own definition.

      \newcommand{\sem}[2][M\!,g]{\mbox{ $[\![ #2 ]\!]^{#1}$}}

    Some examples:

    The purpose of the \! in the definition is to bring the square brackets close together so they look like one character.

    This looks good with small objects, if you want larger ones it is probably better to make them using something like:

      \left [\!\!\left [
      \right ]\!\!\right ]^{M,g}

    Discourse Representation Structures

    Discourse Representation Structures (DRSs) are extremely easy to produce, but they provide a not uninteresting exercise. (They are also provided by Covington's package).

    Formally, a DRS is a pair <U,C>, with U a `universe' (set of discourse variables), and C as set of conditions. So it is naturally to think a command \Drs should have two arguments.

    \newcommand{\Drs}[2]{ ... #1 ... #2 ... }

    Graphically/pictorially, DRSs are boxes, with a line separating the `universe' from the conditions. One of the easiest ways to draw a box in LaTeX is as a tabular or array environment. Since DRSs are may often contain logical symbols, and for typographical consistency with other logical expressions (which will be set in maths mode), we may as well use an array and maths mode:1

      Universe  \\

    There can be a lot of discourse variables, and conditions, and you probably want them centered, one simple way of doing this is to put them in array (or tabular) environments.

    \(                   % begin maths mode
     \begin{array}{|c|}  %
     \hline              % top line
       \begin{array}{c}  %
        #1                % `Universe'
        \end{array} \\   %  end the `universe' part
     \hline              % line between Universe and Conditions
        \begin{array}{c} %
        #2                % the conditions
        \end{array} \\   % end the conditions part
     \hline              % bottom line
    \end{array}          %
    \)                   % end maths mode

    Now, we can say:

        \mathit{man}(u) \\ 
        \mathit{unicorn}(u) \\
        \mathit{seeks}(u,v) \\

    to produce:

    In their book [Kamp and Reyle(1993)], Kamp and Reyle draw DRSs like the following:

    There is no easy way to make the `diamond' shape containing `every' in ordinary LaTeX. However, it is easy using the pstricks package. The \psframebox command draws a frame around its argument, the \psdiabox draws a diamond round its argument. The contents on the DRSs can be set in tabular environments (or arrays, but Kamp and Reyle's are set in ordinary Roman text). Here is one way to obtain the previous picture:

                x y\\ farmer(x)\\ donkey(y)\\ x owns y
                 u\\ u = y\\ x beats u

    The size of the diamond can be reduced by giving an optional argument:

           \psdiabox[framesep=-3pt]{ .... }

    See [Goossens et al.(1997)] (Ch4, circa page 107) for more information.


    [Goossens et al.(1997)]
    Goossens, Michel, Rahtz, Sebastian and Mittelbach, Frank. 1997. The LaTeXGraphics Companion. Addison Wesley, new york edition.
    [Kamp and Reyle(1993)]
    Kamp, H. and Reyle, U. 1993. From Discourse to Logic. Dordrecht: Kluwer Academic Publishers.

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