%% linguex-doc.tex version 1.1
%% Author: Wolfgang.Sternefeld@uni-tuebingen.de
%% filedate 97/10/19
\documentclass{article}
\newcounter{privat}
\def\A.{\setcounter{privat}{1}\a.[\theprivat.]}
\def\B.{\refstepcounter{privat}\b.[\theprivat.]}
\usepackage{linguex}
%\usepackage{linguho}%
%\usepackage[*]{linguho}
%\documentstyle[linguex]{article}
\sloppy\raggedbottom
%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}           
\title{linguex.sty Documentation}
\author{Wolfgang Sternefeld\\
Version 2.0 --- October 1997}
\date{}
\maketitle

\noindent {\tt linguex.sty} is a \LaTeX-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 {\tt linguho.sty} it also allows for 
automatic extraction of a handout from a file generated with {\tt 
linguex.sty}.

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

To run {\tt linguex.sty} with \LaTeX2.09 (rather than \LaTeX2e), 
delete line 4 containing \verb-\RequirePackage{xspace,cgloss4e}- and 
replace it by lines 5--26, from \verb-\input{cgloss4e.sty}-  up to \verb.\long\def\@firstoftwo#1#2{#1}..

\subsection*{Basic Commands}   The three basic 
commands are \verb-\ex.-, \verb-\a.-, and \verb-\b.-.  The first two 
generate list environments.  The third functions basically like an 
\verb-\item-.  Here is an example.  Writing

\begin{samepage}
\begin{verbatim} 
\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
\end{verbatim}
will generate:

\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 

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

Instead of 
\verb-\b.- one can also use \verb-\c.-, \verb-\d.-, \verb-\e.-, and 
\verb-\f.-. These are equivalent copies of \verb-\b.- and are defined to
produce a  WYSIWYG-effect; they too basically work like the 
\verb-\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 \verb-\z.- at the point of transition from the level $n$ of 
the embedding to
level $n-1$. This is exemplified by the following example:

\begin{samepage}
\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.
   \c.    Governors are lexical nodes and tensed I.
       \z.
       (from Haegeman 1991)
       
%
\begin{verbatim}
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)
\end{verbatim}\end{samepage}
%

\subsection*{Example numbering} is created by the counters 
\verb-ExNo-, \verb-SubExNo-, and \verb-SubSubExNo- for the three 
levels of embedding respectively; \verb-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.

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

As a convenient shorthand, use \verb-\Next-  to refer to 
the following example number, and \verb-\NNext-  to refer to
one following the next.  Reference to the previous example is provided by 
\verb-\Last-; the penultimate one is referred to with \verb-\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 
\verb.\NNext[g-ii]. right now yields \NNext[g-ii].

\subsection*{Footnotes} As the example numbering style changes inside 
a footnote, it is crucial for a \verb-\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 \verb-\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 \verb-\TextNext- to refer to the next example within the text.

Should an \verb-\ex.--environment contain a footnote that contains a 
blank line or a \verb-\par- (which will always be the case as soon as 
the footnote itself should contain an \verb-\ex.-), the command 
\verb-\footnote{...}- must be split up into \verb-\footnotemark- and 
\verb-\footnotetext{...}- (see \LaTeX\ manual).  The footnotetext must 
be placed outside the \verb-\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.

\subsection*{Grammaticality Judgments} if composed out of *, ?, and \%,
are automatically prefixed at the very beginning of a new list.  (This 
implies that labels must {\it 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 \verb.{}. between the grammaticality judgment and the list 
command, prefixing will be suppressed. See also the example in 
\ref{ex6} below.  If  other material should be prefixed, use 
\verb.\makebox[0pt][r]{.{\it other material\/}\verb.}..


\subsection*{Glosses} are accounted for by {\tt 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 \verb.\gll.  (as would be required by the gloss macro), one 
can also append a `g' to the last letter of an example command:

\begin{samepage}\begin{verbatim}
\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\\
\end{verbatim}
%
\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\\

\end{samepage}

\subsection*{Labelled Brackets} 
are accounted for automatically by saying \verb-\exi.- instead of
\verb-\ex.-.  Consider the following example and the effect of 
\begin{samepage}
\a.  additional blanks in \Next[b]; 
\b. protecting material from being prefixed by putting it inside 
     a group, as in \Next[c];
\c.  protecting material from being indexed, as 
      in \Next[d] 
\d. wrong indexing \I[+N,--V]  and missing indexing after 
$\backslash${\tt hfill}.  in  \Next[e];
\e. enforcing indexing by empty groups $\{\}$ as in \Next[f]:

\begin{verbatim}
\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]
\end{verbatim}       

\exi. \a.   *?[[NP Fritz ][ snores ]]S 
      \b.  *?[ [NP Fritz ] [ snores ] ] S
     \c.   {*?}[ [NP Fritz ] [ snores ] ]S \label{ex6}
     \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]
 
\end{samepage}
Here is some explanation: \verb-\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 \verb.{[[}.  
in \Last[d] is overlooked so that the following material is protected 
from automatic indexing.  Likewise, material inside a group -- cf.\ 
\verb.{]NP}.  in \Last[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 \verb-\exig.- or \verb-\exgi.-.

In contexts where indexing cannot be accounted for automatically, the 
command \verb-\I- can be used to index the immediately following 
character.  For example, \verb*#\I($\alpha$ Text# is printed as 
\hbox{``\I({$\alpha$} Text''} and \verb*#\I{$\alpha$}NP Text# 
generates \hbox{``\I{$\alpha$}NP Text''}.

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


\subsection*{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 ``['' !!!)
 
\begin{samepage}
\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.
      
\begin{verbatim}
\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.
 \end{verbatim}\end{samepage}
%
As illustrated above, the \verb#\ex.#-command adjusts the indentation 
of the following text to the label.  By contrast, using the 
\verb#\a.#-command instead will have the effect of picking up the 
labelwidth of the preceding example number. Thus, the effect of saying 
\verb-\a.[{\it Principle C} ...]- instead of \verb-\ex.[{\it Principle C} ...]- 
is this:

\a.[{\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.

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

\subsection*{Changing Margins}
requires a change of values for any of the five 
lengths shown below. The displayed values are the defaults: 

\setlength{\currentlabel}{\lessthanten} 
\setlength{\Exlabelsep}{-\currentlabel}
\ex.\footnotesize
\arraycolsep2pt 
$
\begin{array}[t]{@{\hspace{-.5cm}}l|l|l|l|l}
	 \multicolumn{5}{c}{\backslash{\rm Extopsep} \updownarrow 0.66\backslash{\rm %
    baselineskip}}  
\\[1ex]
	\underbrace{\backslash\rm Exindent}_{{\rm 0pt}}& \fbox{$\backslash$\rm  currentlabel} 
	\underbrace{\backslash\rm Exlabelsep}_{{\rm 1em}} & {\rm Text ...} &&\\
 &&
 \rm a.  &\rm Text \ldots &   \\
	 && \underbrace{\backslash\rm SubExleftmargin}_{{\rm 2.4em}} &\rm (i) & 
	        \rm Text \ldots  \\
	 &&  & \underbrace{\backslash\rm SubSubExleftmargin}_{{\rm 2em}} &\rm 
	 \ldots text.  \\[2ex]
 \multicolumn{5}{c}{\backslash{\rm Extopsep} \updownarrow 0.66\backslash{\rm %
    baselineskip}}  \end{array}
$\\\strut
\normalsize

For example, saying
\begin{verbatim}
\setlength{\Extopsep}{\parskip}
\setlength{\Exindent}{\parindent}
\setlength{\Exlabelsep}{0pt}
\setlength{\SubExleftmargin}{\parindent}
\setlength{\SubSubExleftmargin}{4em}
\end{verbatim}
will reprint (1) as:
\setlength{\Extopsep}{\parskip}
\setlength{\Exindent}{\parindent}
\setlength{\Exlabelsep}{0pt}
\setlength{\SubExleftmargin}{\parindent}
\setlength{\SubSubExleftmargin}{4em}
\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.
             
To restore all initial values, say \verb-\resetExdefaults-.
\resetExdefaults

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

If both 
\verb-\currentlabel- and \verb!\Exlabelsep! should be zero
(which happens quite often, e.g., when trees or tables are becoming too 
large, as in the last example), say 
\verb!\setlength{\Exlabelsep}{-\currentlabel}!.


\subsection*{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:
\begin{verbatim}
\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
\end{verbatim}
\A.  Text 1 
\B.  Text 2
\B.  Text 3 

In case you want to generate capital alphabetic counters instead, simply
\verb-\renewcommand{\theprivat}{\Alph{privat}}- which yields:
\renewcommand{\theprivat}{\Alph{privat}} 

\A.  Text 1 
\B.  Text 2
\B.  Text 3

\subsection*{Handouts} 
Those who are familiar with {\tt 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 {\tt linguho.sty}, which removes all examples and 
headings (of sections and subsections) from the tex-document and stores 
them in a file {\it filename\/}.han.  Putting \verb.\makehandout.  at 
the end of your text (or before the bibliography) will print out this 
file at the position of \verb-\makehandout-.  If 
\verb-\section*{...}- and \verb-\subsection*{...}- should also go into 
the handout, say \verb-\usepackage[*]{linguho}-. Use \verb-\maketitle- 
to get the title into the handout.

As the main body of text without the examples is considered 
irrelevant, all of \LaTeX'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 {\tt linguho.sty}.  The new 
commands must then be redefined in {\tt linguho.sty} exactly as has 
been done already for \verb-\A.- in the present version of {\tt 
linguho.sty}.

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

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

\subsection*{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 \verb-\@noftnote- is set false (by saying 
\verb-\@noftnotefalse-); otherwise you might get the arabic style of 
example numberings (as being used in the main text) rather than the 
roman numbers.

%\makehandout 
\end{document}  



