Numbered Examples in LaTeX using gb4e.sty

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


  • Introduction
  • Example Numbers using gb4e
  • Word-by-word Glosses using gb4e

  • Introduction

    Here we only cover the basic usage. For full discussion, in particular, the ways in which the behaviour or the package can be fine-tuned and parameterized, and for the other things it can do, see the full documentation of the package.

    In the preamble, put:

            \usepackage{gb4e}
    

    Beware To be on the safe side, this should be the last package you load.
    This is due to a `feature' of gb4e: it makes _ (the underline character) and ^ (the caret) `active'. This means you can get sub- and super-scripting outside maths mode (writing foo_i instead of having to write foo$_i$ to get fooi). This can seriously mess up other packages.

    Here is an example of what you can do:

    \begin{exe}
    \ex   I invited Fred for dinner.
    \ex[?]{I invited for dinner Fred.}
    \ex[*]{I for invited Fred dinner.}
    \ex \gll Den Fritz$_1$ habe ich $e_1$ zum       Essen  eingeladen.\\
             the Fred      have I   {}    {to the}  eating invited.\\
        \glt I invited Fred for dinner.
    \end{exe}
    

    Read on for more details. [You can also get PostScript or DVI versions of this page].

    Example Numbers using gb4e

    Examples are introduced by \begin{exe} which sets up the top level example environment. This has to be closed after the example(s) by \end{exe}. Sub- and subsubexamples can be created by embedding xlist-environments (up to three levels deep).

            \begin{exe}
            \ex This is the first example.
            \ex This is the second example
            \end{exe}
    

    \ex is a synonym for item, it allows an optional argument, which can contain a judgement:

            \begin{exe}
            \ex[*]{This ungrammatical in English is.}
            \ex[?]{This be grammatical in some dialects.}
            \end{exe}
    

    Embedded examples use the xlist environment, inside \begin{exe}...\end{exe}:

    \begin{exe}
    \ex \begin{xlist}
            \ex This is the first sub-example.
            \ex This is the second sub-example.
            \ex \begin{xlist}
                    \ex This is a first sub-sub-example.
                    \ex This is a second sub-sub-example.
                \end{xlist}
        \end{xlist}
    \end{exe}
    

    Labels and cross references work as they should, witness the following:

    \begin{exe}
    \ex\label{ex1} \begin{xlist}
            \ex\label{ex1a} This is an English example.
            \ex\label{ex1b} This is a longer English example.
        \end{xlist}
    \end{exe}
    Example (\ref{ex1}) contains two sub-examples: (\ref{ex1a}) and
    (\ref{ex1b}).
    

    See the full documentation for more details.

    Word-by-word Glosses using gb4e

    \begin{exe}
    \ex
    \gll Wenn jemand in die W\"uste zieht ... \\
    If someone in the desert draws and lives ... \\
    \trans `if one retreats to the desert and ... '
    \end{exe}
    

    This works by counting words, so to get one word to match several, you either have to put the words in braces or use hyphens. For example, German zum should be glossed as either {to the} or to-the. If there is a word that is not glossed, like WH-trace ei or a proper name, you have to tell the gloss line that there's something there, e.g. with { }.

    \begin{exe}
    \ex
    \gll Den Fritz$_1$ habe ich $e_1$ zum       Essen  eingeladen.\\
         the fred      have I   {}    {to the}  eating invited.\\
    \glt I invited Fred for dinner.
    \end{exe}
    

    See the full documentation for more details.


    LaTeX for Linguists,
    Doug Arnold,
    doug@essex.ac.uk,
    January 25, 2005.