linguex.sty Documentation

Wolfgang Sternefeld Version 2.0 — October 1997

linguex.sty is a L^{A}TEX-tool written for lazy linguists (like myself). By automatically taking care of example numbering, indentations, indexed brackets, and grammaticality judgments, it reduces the effort of formatting linguistic examples to a minimum. Together with linguho.sty it also allows for automatic extraction of a handout from a file generated with linguex.sty.

The macro requires two additional style files: xspace.sty from the base of L^{A}TEX2e, and cgloss4e.sty (a modification of the midnight gloss macro) for glosses.

To run linguex.sty with L^{A}TEX2.09 (rather than L^{A}TEX2e), delete line 4 containing \RequirePackage{xspace,cgloss4e} and replace it by lines 5–26,

from \input{cgloss4e.sty} up to \long\def\@firstoftwo#1#2{#1}.

Basic Commands

The three basic commands are \ex., \a., and \b.. The first two generate list environments. The third functions basically like an \item. Here is an example. Writing

\ex. This is the first level of embedding
       \a. This is the second level
       \b. This is still the second level, but:
             \a. This is the third level
             \b. This is not the end.
             \b. This is the end

will generate:

(1) This is the first level of embedding a. This is the second level b. This is still the second level, but: (i) This is the third level (ii) This is not the end. (iii) This is the end

Each list environment created by \ex. must be closed by a single blank line (or a \par). The text following the example will not be indented. To generate the indentation of a paragraph, the \ex.-environment must be closed by two consecutive blank lines.

Instead of \b. one can also use \c., \d., \e., and \f.. These are equivalent copies of \b. and are defined to produce a WYSIWYG-effect; they too basically work like the \item-command.

As implied by the above, the blank line at the end of the example closes all lists simultaneously. To close just one list instead of all, place a \z. at the point of transition from the level n of the embedding to level n − 1. This is exemplified by the following example:

(2) a. Government:

A governs B iff

(i) A is a governor; (ii) A m-commands B; (iii) no barrier intervenes between A and B

b. Governors are lexical nodes and tensed I.

(from Haegeman 1991)

This is exemplified by the following example:
\ex.\a. {\it Government:}\\
        A governs B iff
         \a. A is a governor;
         \b. A m-commands B;
         \c. no barrier intervenes between A and B
             \z.
    \b.  Governors are lexical nodes and tensed I.
         \z.
    (from Haegeman 1991)

Example numbering

is created by the counters ExNo, SubExNo, and SubSubExNo for the three levels of embedding respectively; FnExNo is used for the first level inside footnotes. These counters serve as labels of list items and can be changed as usual anywhere in the text.

Cross References

are provided by \label{...} and \ref{...} in the usual manner. For example, a label between \ex. and \a. stores the main example number for further reference; the same command following \a. or \b. stores the label of a (sub- )subexample.

As a convenient shorthand, use \Next to refer to the following example number, and \NNext to refer to one following the next. Reference to the previous example is provided by \Last; the penultimate one is referred to with \LLast.

These shorthands always refer to the first level of embedding. Reference to subexamples requires specification by an optional argument in [square brackets]. For example, saying \NNext[g-ii] right now yields (4-g-ii).

Footnotes

As the example numbering style changes inside a footnote, it is crucial for a \Next-command inside a footnote to know whether the next example is in the main body of text or still inside the footnote. However, since \Next cannot really look ahead, only one option is available, and the latter one (= next example still inside the footnote) is assumed as the default. Say \TextNext to refer to the next example within the text.

Should an \ex.-environment contain a footnote that contains a blank line or a \par (which will always be the case as soon as the footnote itself should contain

an \ex.), the command \footnote{...} must be split up into \footnotemark

and \footnotetext{...} (see L^{A}TEX manual). The footnotetext must be placed outside the \ex.-environment of the main text. This is to prevent the first blank line inside the footnote from being mistaken as the end of the main text example.

Grammaticality Judgments

if composed out of *, ?, and %, are automatically prefixed at the very beginning of a new list. (This implies that labels must follow the grammaticality judgment!) In some contexts (in particular in the context of automatic indexing, cf. below) it is crucial to leave at least one blank between a list command and a grammaticality judgment. On the other hand, if there is an empty group like {} between the grammaticality judgment and the list command, prefixing will be suppressed. See also the example in (5-c) below. If other material should be prefixed, use \makebox[0pt][r]{other material}.

Glosses

are accounted for by cgloss4e.sty. For reasons of compatibility with automatic indexing (described further below), however, some commands had to be modified, but in general the macro still works as usual. As a further shorthand, instead of writing \gll (as would be required by the gloss macro), one can also append a ‘g’ to the last letter of an example command:

\ex.\a. No gloss
       \bg. This is a first gloss\\
        Dies ist eine erste Glosse\\
\exg.   *Dies ist keine ersten Glossen\\
         This is   no    first  gloss\\

(3) a. No gloss

b. This Dies {is \atop ist} {a \atop eine} first erste gloss Glosse
(4) *Dies This {ist \atop is} {keine \atop no} ersten first Glossen gloss

Labelled Brackets

are accounted for automatically by saying \exi. instead of \ex.. Consider the following example and the effect of

a. additional blanks in (5-b); b. protecting material from being prefixed by putting it inside a group, as

in (5-c); c. protecting material from being indexed, as in (5-d) d. wrong indexing [_{+N,–V]} and missing indexing after \hfill. in (5-e); e. enforcing indexing by empty groups {} as in (5-f):

\exi.\a.   *?[[NP Fritz ][ snores ]]S
    \b.   *?[ [NP Fritz ] [ snores ] ] S
    \c. {*?}[ [NP Fritz ] [ snores ] ]S
    \d.   *{[[}+N,--V] Fritz {]NP} [VP snores ]
    \e.   [[+N,--V] Fritz ][VP snores ] \hfill [NP Structure]
    \f.   [{}[+N,--V] Fritz ][VP snores ] \hfill{} [NP Structure]

(5) a. *?[[_{NP} Fritz ][ snores ]]_{S} b. *?[ [_{NP} Fritz ] [ snores ] ] S c. *?[ [_{NP} Fritz ] [ snores ] ]_{S} d. *[[+N,–V] Fritz ]NP [_{VP} snores ] e. [[_{+N,–V]} Fritz ][_{VP} snores ] [NP Structure] f. [_{[+N,–V]} Fritz ][_{VP} snores ] [_{NP} Structure]

Here is some explanation: \exi. identifies “words” by looking for blanks between them and then checks whether the next word starts with one of the brackets “[” or “]”. A group such as {[[} in (5-d) is overlooked so that the following material is protected from automatic indexing. Likewise, material inside a group – cf. {]NP} in (5-d) – will not be indexed. Thus, grouping works much the same way as in the gloss macro where it is empoyed to create words that are to be protected from glossing.

Note that commands that look ahead and extend over more than one word might not work properly unless they are put into a group. An example will be given at the end of the next section.

For combining glosses with automatically labelled brackets, say \exig. or

\exgi..

In contexts where indexing cannot be accounted for automatically, the command \I can be used to index the immediately following character. For example,

\I($\alpha$␣Text is printed as “(_{α} Text” and \I{$\alpha$}NP␣Text gener-

ates “α_{NP} Text”.

Although the two list-generating commands \ex. and \a. can be combined in any order, commands that introduce automatic indexing (ie. \exi., \ai., \agi., or \aig.) can only be used at the top level of embedding!!! Recall also that each embedded \ex.-command needs its own (additional) blank line to properly identify the end of the environment.

Changing Labels

To generate labels that differ from the defaults, specify an optional argument as in the following examples: (But don’t leave space between “ex.” and “[” !!!)

Principle C (cf. Chomsky[81]): An R-expression is free only

α) with respect to potential binders in A-

positions, β) within the domain of its chain.

\ex.[{\it Principle C\/} (cf. Chomsky{[81]}): ]
      An R-expression is free only
      \a.[$\alpha$)] with respect to potential binders
             in A-positions,
      \b.[$\beta$)] within the domain of its chain.

As illustrated above, the \ex.-command adjusts the indentation of the following text to the label. By contrast, using the \a.-command instead will have the effect of picking up the labelwidth of the preceding example number. Thus, the effect of saying \a.[{\it Principle C} ...] instead of

\ex.[{\it Principle C} ...] is this:

Principle C (cf. Chomsky[81]): An R-expression is free only α) with respect to potential binders in A-positions, β) within the domain of its chain.

Suppose we are inside an \exi.-environment and we want to say something like \b.[Principle C]. What will happen? The blank between “e” and “C” forces the indexing device to read \b.[Principle as a “word.” This, however, prevents the argument of \b. from being interpreted properly. Solutions would

be to say \b.[Principle~C], \b.[{Principle C}], or {\b.[Principle C]}

etc.

Changing Margins

requires a change of values for any of the five lengths shown below. The displayed values are the defaults:

(6) \Extopsep ↕ 0.66\baselineskip

\Exindent

0pt

\currentlabel ^{\Exlabelsep}_{1em}

Text...

a.  Text …

\SubExleftmargin

2.4em

(i) Text …

\SubSubExleftmargin

2em

… text.

\Extopsep ↕ 0.66\baselineskip

For example, saying

\setlength{\Extopsep}{\parskip}
\setlength{\Exindent}{\parindent}
\setlength{\Exlabelsep}{0pt}
\setlength{\SubExleftmargin}{\parindent}
\setlength{\SubSubExleftmargin}{4em}

will reprint (1) as:

(7) This is the first level of embedding.

a. This is the second level.

b. This is still the second level, but: (i) This is the third level. (ii) This is not the end. (iii) This is the end.

To restore all initial values, say \resetExdefaults.

\currentlabel is a length which varies according to the width of the current label. If \theExNo is between (1) and (9), its length is that of (11); it is that of (111) for \theExNo’s between (10) and (99); and (1111) for (100) to (999). For even wider labels (usually specified by an optional argument), \currentlabel has the width of that label and \Exlabelsep is 0pt. Recall from the last section that this holds only for the \ex.-command. For the \a.-command, the width of \currentlabel is determined by the last example number generated by \ex. as explained above.

If both \currentlabel and \Exlabelsep should be zero (which happens quite often, e.g., when trees or tables are becoming too large, as in the last

example), say \setlength{\Exlabelsep}{-\currentlabel}.

Changing Counters

Changing the style of numerations requires some work. The following, for example, introduces the analogue of an enumerate environment by defining optional arguments of example.sty commands:

\newcounter{privat}
\def\A.{\setcounter{privat}{1}\a.[\theprivat.]}
\def\B.{\refstepcounter{privat}\b.[\theprivat.]}
Now, saying
\A.  Text 1
\B.  Text 2
\B.  Text 3
will yield

1. Text 1

2. Text 2

3. Text 3

In case you want to generate capital alphabetic counters instead, simply

\renewcommand{\theprivat}{\Alph{privat}} which yields:

A. Text 1 B. Text 2 C. Text 3

Handouts

Those who are familiar with xcomment.sty will immediately recognize that this device is useless in combination with linguex.sty, because the surface implementation of the list environment does not use the begin-end-format. This deficiency is compensated for by using linguho.sty, which removes all examples and headings (of sections and subsections) from the tex-document and stores them in a file filename.han. Putting \makehandout at the end of your text (or before the bibliography) will print out this file at the position of \makehandout. If \section*{...} and \subsection*{...} should also go into the handout, say

\usepackage[*]{linguho}. Use \maketitle to get the title into the handout.

As the main body of text without the examples is considered irrelevant, all of L^{A}TEX’s “setlength” instructions are executed in the handout only. For changes to be executed also in the remaining text, use plain TEX-commands to set lengths.

If you have defined your own counter as demonstrated above (but with different commands) and if these should also go into the handout, your definitions must be stated before loading linguho.sty. The new commands must then be redefined in linguho.sty exactly as has been done already for \A. in the present version of linguho.sty.

You must also make sure that ad hoc changes of counters like ExNo are written or copied into filename.han. (For example, you may write a \setcountercommand into an example or into a section-command.)

Within handouts the change from example (9) to example (10) is often felt somewhat awkward. Saying \smoothtrue will enlarge the label of examples (1)-(9) to the effect that its \currentlabel will have the same width as that of (10) - (99).

Endnotes

Depending on your version of the endnote(s) style, you have to redefine endnote commands in such a way that at the beginning of each endnote \@noftnote is set false (by saying \@noftnotefalse); otherwise you might get the arabic style of example numberings (as being used in the main text) rather than the roman numbers.