diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/expex/source/04_Ex.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/expex/source/04_Ex.tex | 290 |
1 files changed, 290 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/expex/source/04_Ex.tex b/Master/texmf-dist/doc/generic/expex/source/04_Ex.tex new file mode 100644 index 00000000000..f2270cc1653 --- /dev/null +++ b/Master/texmf-dist/doc/generic/expex/source/04_Ex.tex @@ -0,0 +1,290 @@ + +\section Examples without parts + +\lingset{dima=1.3em} +\noindent +\begininventory +\macros \idx{|\ex|}|~[]|, \idx{|\xe|}\endmc +\counter \idx{|\excnt|}\endmc +\parameters +\idx{|numoffset|\user} & \inc dimension& \textdim{0 pt}\cr +\idx{|textoffset|\user}& \inc dimension& \textdim{1 em}\cr +\idx{|aboveexskip|\user}& \inc skip& + 2.7\dimskip ex plus .4\dimskip ex minus .4\dimskip ex\cr +\idx{|belowexskip|\user}& \inc skip& + 2.7\dimskip ex plus .4\dimskip ex minus .4\dimskip ex\cr +\idx{|exskip|}& skip& (pseudo-parameter)\cr +\endinventory +% +Sections will usually begin with an inventory of the parameters and +user friendly macros and registers that are introduced in the section, +The initial settings of parameters will be given if they are relevant. +Pseudo parameters are set for their immediate effect, not to store a +setting associated with the parameter, so the initial setting of +pseudo parameters is not relevant. +|\ex~[]| above should be taken to mean that the macro +|\ex| will be described, that it is optionally modified by a +following diacritical tilde |~| (as described below), and that it +optionally takes an argument. The text will describe what +arguments are permitted. A $\dag$ supersript on a parameter in these +inventories indicates a parameter whose value is +accessible by the macro |\ling«key»|. A \inc\ prefix on ``dimension'' +or ``skip'' indicates that the parameter is incrementable, by a +dimension or a skip as the case may be. + +|\ex| constructions are terminated by |\xe|. The following +sample paragraph illustrates the use of |\ex| \dots|\xe|. The +convention in this manual is that text, {\it as it would appear in +a document}, is displayed in a framed box, usually with the code +immediately following or preceding. The code assumes that the +initial parameter settings are in effect at the point that the +code is executed. + +\framedisplay +\exdisplay +The following example is well-known from the literature on +parasitic gaps. Here we are concerned with example formatting, +not with the interesting syntax. +\ex +I wonder which article John filed {\sl t\/} without reading {\sl e}. +\xe +Various aspects of the format are controlled by parameters, which +can be set either globally or via an optional argument. +\xe +\endframedisplay +\codedisplay~ +The following example is well-known from the literature on +parasitic gaps. Here we are concerned with example formatting, +not with the interesting syntax. + +\ex +I wonder which article John filed {\sl t\/} without reading {\sl e}. +\xe + +\noindent Various aspects of the format are controlled by +parameters, which can be set either globally or via an optional +argument.|endcodedisplay + +Those users who try to save virtual paper can equally +use: + +\codedisplay +The following example is well-known from the literature on +parasitic gaps. Here we are concerned with example formatting, +not with the interesting syntax.\ex I wonder which article John +filed {\sl t\/} without reading {\sl e}.\xe Various aspects of +the format are controlled by parameters, which can be set either +globally or via an optional argument.|endcodedisplay + +With different parameter settings, we get: + +\framedisplay +\exdisplay +The following example is well-known from the literature on +parasitic gaps. Here we are concerned with example formatting, +not with the interesting syntax. + +\ex[numoffset=2em,textoffset=.5em,aboveexskip=1ex,belowexskip=1ex] +I wonder which article John filed {\sl t\/} without reading {\sl e}. +\xe + +\noindent Various aspects of the format are controlled by +parameters, which can be set either globally or via an optional +argument. +\xe +\endframedisplay + +\codedisplay~ +The following example is well-known from the literature on +parasitic gaps. Here we are concerned with example formatting, +not with the interesting syntax. + +\ex[numoffset=2em,textoffset=.5em,aboveexskip=1ex,belowexskip=1ex] +I wonder which article John filed {\sl t\/} without reading {\sl e}. +\xe + +\noindent Various aspects of the format are controlled by +parameters, which can be set either globally or via an optional +argument.|endcodedisplay + +The horizontal dimensions are illustrated below. |numoffset| is +measured from the left margin. + +\bigskip +\noindent +\pspicture(0,-.9em)(4.9in,3em) +\psscalebox{1.5}{% +\psset{linewidth=.5pt,yunit=.2in} +\def\vline#1{\psline[linestyle=dashed](#1,1)(#1,-.4)\ignorespaces}% +\vline0 +\dimpuba=.35in +\vline\dimpuba +\pcline{<->}(0,1)(\dimpuba,1) +\Aput{\eightrm numoffset} +\setbox0=\hbox{(23)}% +\rput[l](\dimpuba,0){\copy0} +\dimpubb=\dimpuba \advance\dimpubb by\wd0 +\vline\dimpubb +\dimpuba=\dimpubb \advance\dimpubb by .5in +\vline\dimpubb +\pcline{<->}(\dimpuba,1)(\dimpubb,1) +\Aput{\eightrm textoffset} +\rput[l](\dimpubb,0){This is the example text.} +}\endpspicture +\bigskip + +\noindent Example numbering is automatic. The count is kept in +|\excnt|. It is incremented when |\ex| is expanded, before the +number is typeset. Outside examples, |\excnt| gives the count +of the next example. Inside examples, it also gives the count of the +next example, not the current one. Vertical skip is inserted +before and after examples, of amounts determined by the values of +|aboveexskip| and |belowexskip|. + +Inside |\ex| constructions, the example text is wrapped as +ordinary text, with |\leftskip| set by |\ex|. Since |\ex| +sets |\leftskip| and relies on this setting, changes in |\leftskip| +inside \hbox{|\ex| \dots|\xe|} must be made with care, but can be made +after the first paragraph (i.e. after the first explicit or +implicit |\par|). + +\makeatletter +\framedisplay +\ex +Und hier k\"onnen wir sehen was f\"ur Unfug wird gemacht +wenn er einen ganz langen Satz binnen kriegt.\par\nobreak +\xe + +\ex~ +$\alpha$ {\it governs\/} $\beta$ if $\alpha=X^0$ (in the +sense of X-bar theory), $\alpha$ c-commands $\beta$, and $\beta$ +is not protected by a maximal projection. +\xe +\endframedisplay +\resetatcatcode + +The code which was used to typeset the pair of examples above has +two useful features which are worth highlighting. + +\codedisplay +\ex +Und hier k\"onnen wir sehen was f\"ur Unfug wird gemacht +wenn er einen ganz langen Satz binnen kriegt.\par\nobreak +\xe +|exbreak +\ex[aboveexskip=0pt] +$\alpha$ {\it governs\/} $\beta$ if $\alpha=X^0$ (in the +sense of X-bar theory), $\alpha$ c-commands $\beta$, and $\beta$ +is not protected by a maximal projection. +\xe|endcodedisplay + +\noindent |\par\nobreak| is used to illustrate how a page break +between two consecutive examples can be suppressed. This is +sometimes desirable. |\par| puts \Tex\ in the mode of adding +lines to the page, and |\nobreak| tells \Tex\ to avoid a break +(which is a page break when \Tex\ is in the mode of adding +lines), essentially until after more text is added to the page. +|aboveexskip=0pt| is used in the second example to avoid double +spacing between the examples. Otherwise vertical skip would be +added both below the first example and above the second example. + +Since the need to suppress vertical skip above examples arises +with some frequency, a shortcut is made available to accomplish +this. Simply say |\ex~|. \sidx{|~|, tilde modification}Tilde +modification of |\ex| can be used with parameters; |\ex~[|\dots|]| will be interpreted correctly. + +|exskip| is a pseudo parameter which can be used to +simultaneously set both |aboveexskip| and |belowexskip|. The +effect of |\lingset{exskip=«value»}| is + +\exfrag +|\lingset{aboveexskip=«value»,belowexskip=«value»}| +\xe + +\subsection Explicit example numbers + +\begininventory +\parameters +\idx{|exno|}& token list& (pseudo parameter)\cr +\idx{|exnoformat|}& token list of the form $\;\ldots\,|X|\,\ldots$& |(X)|\cr +\endinventory +% +Suppose that you want to repeat an example that was given earlier +in your document. Something like. + +\framedisplay +\excnt=94 +\ex This is a crucial example.\xe +It is clear that this example is related to the earlier +example (14), which is repeated below. +\ex[exno=14] +This is an example that was given many pages earlier.\xe +If we are on the right track, as the saying goes, +we expect the next example to be grammatical. But it is not. +\ex * \dots\xe +\endframedisplay + +\codedisplay~ +\ex This is a crucial example.\xe +It is clear that this example is related to the earlier +example (14), which is repeated below. +\ex[exno=14] +This is an example that was given many pages earlier.\xe +If we are on the right track, as the saying goes, +we expect the next example to be grammatical. But it is not. +\ex * \dots\xe +|endcodedisplay + +|\excnt| is not incremented if the example number is +supplied by |exno|. + +|exno| does not have to be set to an integer, as shown below. + +\framedisplay +\ex[exno=$\Delta$] Earlier example.\xe +\endframedisplay + +\codedisplay~ +\ex[exno=$\Delta$] Earlier example.\xe |endcodedisplay + + +\framedisplay +\ex[exno={[14, repeated]},exnoformat=X] Earlier example.\xe +\endframedisplay +\codedisplay~ +\ex[exno={[14, repeated]},exnoformat=X] Earlier example.\xe|endcodedisplay + +\noindent Note the use of braces to hide the comma in the setting +of |exno|. Otherwise, the key-value parser would get +confused, interpreting |[14| as the setting of |exno| and +reporting that |repeated| is an undefined key. The initial setting of +|exnoformat| is |(X)|, so this parameter must be reset to prevent +putting parentheses around the special exno. The label formatting mechanism is primitive. +|labelformat| must +be of the form\medskip +\centerline{$\rm \langle balanced\ +text\rangle\thinspace|X|\thinspace \langle balanced\ text\rangle$} +\medskip +\noindent The pre-X text is inserted before the label (including +the material specified by |everypar|) and the post-X text is +inserted after the label. The balanced text cannot contain the +character |X|. {\it Balanced text\/} is a string of tokens with +properly nested (explicit) braces. No error checking is done to +ensure that the format specification has the required form, so be +careful. An error might lead to very obscure error messages. + +Note that +\exfrag +|\ex[exno={14, repeated},exnoformat={[X]}] Earlier example.\xe| +\xe +and +\exfrag +|\ex[exno={[14, repeated]},exnoformat=X] Earlier example.\xe| +\xe +give the same result. + +Section (\getref{named-reference}) will show how to name example +numbers, so that |exno| can be set by giving the name of +an example number. + + |