The gb4e.sty
package is my preferred method of handling automatically numbered
examples. It can also be used for alignment in examples including glosses and translation. To
use this package, include the following in your document’s preamble:
\usepackage{gb4e}
Note that by default, this package modifies the _ and ^ characters to provide subscripts and superscripts
outside of math mode (e.g., it allows him_i
instead of him$_i$
). This is
convenient but can also cause conflicts with other packages. These can generally be avoided by loading
gb4e
last (i.e., make it your last \usepackage
command).
The exe
environment is the top-level environment for examples, which are introduced
by \ex
. Here is a simple example:
\begin{exe} \ex This is a numbered example. \end{exe}
Of course, the environment may contain multiple examples. If desired, you can (optionally) specify
a grammaticality judgement as the first argument to the \ex
command:
\begin{exe} \ex[*]{Example this ungrammatical is.} \ex[??]{This example questionable is.} \end{exe}
Note that this requires you to enclose the example text itself in curly braces, {}
. (Using
the argument instead of directly typing the grammaticality judgement as the first
character of the example is better because the argument will ensure that all examples--both with
and without judgements--properly align with each other.)
\ex
: \gll
(for the sentence-gloss pair)
and (optionally) \glt (for the translation)
. A simple example:
\begin{exe} \ex \gll la mujer\\ the woman\\ \glt `the woman' \end{exe}
This produces:
The package will automatically align the gloss with the original words, and you can use curly braces, {}
,
to group or skip words in the original or gloss as needed.
\xlist
environment is used to create embedded examples. For example:
\begin{exe} \ex \begin{xlist} \ex Example one \ex Example two \end{xlist} \end{exe}creates the following output:
\label
and \ref
commands to create labels in and references
to particular examples. This works for both top level and nested examples.
There are more options and uses for this package than I have described here, including more deeply nested examples; customizing or repeating the example's identifier; other shortcuts; and style customizations that may be required for certain journals, style sheets, or personal preferences.
See the gb4e-doc.pdf
documentation on the
gb4e CTAN page for more.
Additionally, there are a few other packages that provide similar functionality. One such package is ExPex by John Frampton. I have not used such packages extensively but may explore them in the future.