Numbered Examples in LaTeX
[ LaTeX for Linguists, .dvi, .ps, .pdf, TestFile]

There are several packages that allow numbered examples something like the following to be produced:

They typically also provide for glosses' like the following:

We describe two such packages here:

• Numbered examples using covington.sty
• Numbered examples using gb4e.sty
• Both packages are available from "the usual places".

But we really should also mention Wolfgang Sternefeld's linguex.sty package, which many people like. It is also available from "the usual places".

There is not much to choose between them as regards example numbering:

• They all use the same approach to making glosses (the gb4e commands are based on Covington's. which are a LaTeX adaptation of M. deGroot's Midnight gloss TeX-macros. You could use these by themselves by loading cgloss4e.sty).
• They all provide other things as well. The best way to find out is to read their full documentation:
• Full documentation of covington.sty: HTML ; PostScript
• Full documentation of gb4e.sty: HTML ; PostScript
• gb4e has a bug (or perhaps a couple of bugs):
• it redefines ^ and_, but the redefinition gives the wrong spacing if you use both at once. This becomes really visible if the first one is long, as in $e^{\mathrm{ref}}_2$.
• it redefines ^ and_ so that they work outside maths mode. This sounds like a neat idea, because it means you can put sub- and super-scripts anywhere you like without needing to shift into maths mode. But it is a terrible idea. This is because it involves changing the catcode of these characters (it makes them "active"). But lots of other packages depend on these characters having their normal catcodes. The effect is that gb4e has to be loaded last - after every other package.

There are several solutions. The simplest is just to comment out the two lines that look like this in gb4e.sty (around line 98)

 \catcode_=\active
\catcode^=\active

you won't have superscripts and subscripts in normal text, but you also won't have to worry about loading gb4e last. If you really want sub- and super-scripts in normal text without the hassle of going into maths mode, do something like this (you can't use \sup, because TeX already uses that for something else):
\newcommand{\sub}[1]  {\ensuremath{_{\mathit{#1}}}}% e.g. NP\sub{i}
\newcommand{\super}[1]{\ensuremath{^{\mathit{#1}}}}% e.g. N\super{2}
`

LaTeX for Linguists,
Doug Arnold,
doug@essex.ac.uk,
October 19, 2009.