summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/expex/source/12_Tables.tex
blob: 7aa389e5bca1cbc82f53638a9ec0f58fb9834275 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446

\section Tables in examples

\begininventory
\macros* \idx{|\hwit|}\endmc
\endinventory
Most of the difficulty of formatting example displays which
contain tables comes from formatting the table itself. This
manual will not teach the reader how to use \Tex\ to format
tables. It will be assumed that the reader knows how to use the
\Tex\ primitive |\halign| or the \LaTex\ macros based on
|\halign|.  But this section might contribute something to
understanding how to use the table making tools in linguistics
examples.

Many tabular examples have the form

\def\goop{\enspace\dots\enspace}
\codedisplay
\ex \vtop{\halign{|goop}}\xe
|endcodedisplay

For example:

\framedisplay
\ex
\vtop{\halign{#\hfil&& \qquad #\hfil\cr
baudh& bu-baudh& know, wake\cr
smai& si-smai& smile\cr
suap& su-suap& sleep\cr
miaks& mi-miaks& glitter\cr
auc& u-auc& please\cr
}}
\xe
\endframedisplay

\codedisplay
\ex \vtop{\halign{%
#\hfil&& \qquad #\hfil\cr
baudh& bu-baudh& know, wake\cr
smai& si-smai& smile\cr
suap& su-suap& sleep\cr
miaks& mi-miaks& glitter\cr
auc& u-auc& please\cr
}}\xe|endcodedisplay

A more elaborate version of (\lastx), with a title and labeled
columns, is given below. |\hwit| is described below.

\framedisplay
\ex  The perfect stems of some roots with a
high vowel in their nucleus\par\nobreak\medskip
\quad\vbox{\halign{%
#\hfil&& \hskip3em #\hfil\cr
\hfil\hwit{root}& \hfil\hwit{perfect stem}&
   \hfil\hwit{gloss}\cr
\noalign{\smallskip}
baudh& bu-baudh& `know, wake'\cr
smai& si-smai& `smile'\cr
suap& su-suap& `sleep'\cr
miaks& mi-miaks& `glitter'\cr
auc& u-auc& `please'\cr
}}\xe
\endframedisplay

\codedisplay~
\ex  The perfect stems of some roots with a
high vowel in their nucleus\par\nobreak\medskip
\quad\vbox{\halign{%
#\hfil&& \hskip3em #\hfil\cr
\hfil\hwit{root}& \hfil\hwit{perfect stem}&
   \hfil\hwit{gloss}\cr
\noalign{\smallskip}
baudh& bu-baudh& `know, wake'\cr
smai& si-smai& `smile'\cr
suap& su-suap& `sleep'\cr
miaks& mi-miaks& `glitter'\cr
auc& u-auc& `please'\cr
}}\xe |endcodedisplay
%
|\hwit| (hidewidth italics) inserts the italicized
label into the alignment in such a way that it is centered over
the nonwhite portion of the column it heads.  It hangs over
equally on both sides if necessary. Hiding the width of column
labels is often important so that the column labels do not affect
the column widths.

|\par\nobreak| appears after the title so that page breaking does
not detach the title from the table that follows.

\subsection Tables with labeled lines

\begininventory
\macros \idx{|\labels[]|}, \idx{|\tl|}, \idx{|\nl|}\endmc
\endinventory
If reference must be made to particular lines in (\lastx), the
lines need labels of some sort.  One approach is to explicitly
enter the line labels a--e:

\framedisplay
\ex  The perfect stems of some roots with a
high vowel in their nucleus\par\nobreak\medskip
\quad\vbox{\halign{%
#\hfil& \quad #\hfil&& \hskip3em #\hfil\cr
& \hfil\hwit{root}& \hfil\hwit{perfect stem}&
   \hfil\hwit{gloss}\cr
\noalign{\smallskip}
a.& baudh& bu-baudh& `know, wake\cr
b.& smai& si-smai& `smile'\cr
c.& suap& su-suap& `sleep'\cr
d.& miaks& mi-miaks& `glitter'\cr
e.& auc& u-auc& `please'\cr
}}\xe
\endframedisplay

\codedisplay
\ex  The perfect stems of some roots with a
high vowel in their nucleus\par\nobreak\medskip
\quad\vbox{\halign{%
#\hfil& \quad #\hfil&& \hskip3em #\hfil\cr
& \hfil\hwit{root}& \hfil\hwit{perfect stem}&
   \hfil\hwit{gloss}\cr
\noalign{\smallskip}
a.& baudh& bu-baudh& `know, wake'\cr
b.& smai& si-smai& `smile'\cr
c.& suap& su-suap& `sleep'\cr
d.& miaks& mi-miaks& `glitter'\cr
e.& auc& u-auc& `please'\cr
}}\xe |endcodedisplay

\noindent If a line is deleted or added, or if lines are
interchanged for some reason, considerable relabeling may be
required.

\ExPex\  provides some macros which simplify this code and make
it easier to manipulate.  They are used in the alternate code for
(\lastx) below and described below. |\labels| initializes
the counter |\pexcnt|, which is then used to generate the labels.
It also activates the macros |\tl| (table label) and
|\nl| (no label). |\tl| inserts the appropriate label, with
following period, and increments the counter. |\nl| abbreviates
|\omit\hfil|, so that it can be used to prevent the appearance of
a label in a cell. |\labels| takes parameters, so you can say
things like |\labels[labeltype=caps,everylabel=\it]|.  Of course,
these parameters can also be set at the |\ex| level, if desired, or
even globally.

\codedisplay
\ex  The perfect stems of some roots with a
high vowel in their nucleus\par\nobreak\medskip
\quad\vbox{\labels\halign{%
\tl #\hfil& #\hfil& \quad #\hfil&& \hskip3em #\hfil\cr
\nl & \hfil\hwit{root}& \hfil\hwit{perfect stem}&
   \hfil\hwit{gloss}\cr
\noalign{\smallskip}
& baudh& bu-baudh& `know, wake'\cr
& smai& si-smai& `smile'\cr
& suap& su-suap& `sleep'\cr
& miaks& mi-miaks& `glitter'\cr
& auc& u-auc& `please'\cr
}}\xe |endcodedisplay

The advantages of implicit line label insertion should be
obvious.  One often decides to insert another entry, or to delete
an entry.  If the labels are inserted explicitly, this usually
requires changing multiple labels.  If the table has many lines,
this is particularly onerous.  References in the text to
particular lines also need to changed to match the new labeling.
We will see below that lines in tables can be named and reference
made by name, using implicit line numbering.

\subsection Tagging implicit labels in tables

\sidx{|\deftaglabel|, in tables}
|\deftaglabel| can be used to associate a tag with a label that is
introduced into a table by |\tl|~(``table label'').  |\tl| can
also read an optional tag using the |<|\dots|>| mechanism.

\codedisplay
\ex<Washo>
\vtop{\labels\halign{\tl #\hfil&& \quad #\hfil\cr
\nl & \hwit{Root}& \hwit{Plural}& \hwit{Gloss}\cr
& baloxat& baloxaxat& bows\cr
& moya& moyaya& shoulder\cr
<A>& nent'us& net'unt'us& old women\cr
<B>& mokgo& mogokgo& shoes\cr
}}
\xe
Examples (\getfullref{Washo.A}) and (\getfullref{Washo.B}) are the most
complex, and therefore the most revealing. Examples
(\getref{Washo}\getref{Washo.A},\getref{Washo.B}) are the most complex,
and therefore the most revealing.
|endcodedisplay

\framedisplay~[fdcorrect=top]
\ex<Washo>
\vtop{\labels\halign{\tl #\hfil&& \quad #\hfil\cr
\nl & \hwit{Root}& \hwit{Plural}& \hwit{Gloss}\cr
& baloxat& baloxaxat& bows\cr
& moya& moyaya& shoulder\cr
\deftaglabel{A}& nent'us& net'unt'us& old women\cr
\deftaglabel{B}& mokgo& mogokgo& shoes\cr
}}\xe
Examples (\getfullref{Washo.A}) and (\getfullref{Washo.B}) are
the most complex, and therefore the most revealing.
Examples (\getref{Washo}\getref{Washo.A},\getref{Washo.B}) are
the most complex, and therefore the most revealing.
\endframedisplay
\medskip
\noindent

\subsection Some useful table making tools

\begininventory
\macros* % \idx{|\lingdima|}, \idx{|\lingdimb|}, \idx{|\lingdimc|},
   \idx{|\tspace|}|[]|, \idx{|\crs|}\endmc
\parameters
\idx{|dima|\user}& dimension& \textdim{2.4 em}\cr
\idx{|dimb|\user}& dimension& (not set)\cr
\idx{|dimc|\user}& dimension& (not set)\cr
\idx{|crskip|}& skip& \textdim{1.2 ex}\cr
\endinventory
%
Tables often need considerable adjustment in order to
balance the needs of readability, space limitations, and matching
the typographic structure to the conceptual structure.
Sometimes this requires a delicate balancing act. \ExPex\
provides three parameters (scratch dimensions) |dima|, |dimb|,
and |dimc|, and corresponding macros which expand to their
settings, which can be used for this.  Additionally,
|\tspace[«key»]| expands to |\hskip\ling«tag»|, so that
horizontal skip like |\tspace[dima]| or |\tspace[textoffset]| can
be easily used in table construction.  The code for (\lastx)
could be written:

\codedisplay
\ex[textoffset=1em,dima=1em,dimb=3em]
The perfect stems of some roots with a high vowel in their
nucleus\par\nobreak\medskip
\tspace[dima]\vbox{\labels\halign{%
\tl #\hfil& \tspace[textoffset]#\hfil&& \tspace[dimb]#\hfil\cr
\nl & \hfil\hwit{root}& \hfil\hwit{perfect stem}&
   \hfil\hwit{gloss}\cr |endcodedisplay
\removelastskip\vskip-1ex
$\vdots$
\bigskip

\noindent Localizing all the parameters which might need
adjustment in the optional argument of |\ex| helps organize the
adjustment process.

If no optional argument is supplied to |\tspace|, it expands to
|\hskip\lingdima|.

The macro |\crs| and command key |crskip| are
provided to assist in fine tuning the vertical spacing inside an
alignment. |\ling@crskip| expands to the setting of |crskip|, and

\exfrag |\crs|\quad $\to$\quad |\cr \noalign{\vskip\ling@crskip}|
\xe

\subsection Tables that can break between pages

\begininventory
\macros \idx{|\exdisplay[]|}, \idx{|\noexno|}, \idx{|\exnoprint|},
   \idx{|\crnb|}\endmc
\endinventory
Up to this point, only tables that are typeset in a vbox have
been considered.  The \Tex\ page breaking algorithm does not
split a box between pages.  Sometimes, an especially tall table
is needed and one has the choice of floating the table to the top
of the next page (using \Tex's |\topinsert|) or constructing a
breakable table.  The latter choice is often preferable and can
be implemented using \Tex's primitive |\halign|.

The example number must be part of the |\halign|, not inserted by
|\ex|.  |\exdisplay| is designed to accommodate an unboxed
|\halign|. Like |\ex|, |\exdisplay| must be closed by |\xe|.
|\exdisplay| \dots|\xe| is just like |\ex| \dots|\xe| except that
an example number is not printed and the horizontal dimensions
|\numoffset| and |\textoffset| are irrelevant. |aboveexskip| and
|belowexskip| play the same role, paragraph indentation is
cancelled, |\lingeveryex| and |\lingEveryex| are executed, and
|\excnt| is advanced.

|\noexno| is provided in case the user wants to use |\exdisplay|
for something other than a numbered example.  It cancels the
automatic advancement of |\excnt|.  You can say
|\exdisplay|\idx{|\noexno|}\ or |\exdisplay[« \dots»]\noexno| to
cancel |\excnt| advancement.

Now consider the `tall display' (\nextx).  It is sufficiently
tall that it either must be put in an insertion or typeset so
that it can be split by a page break.

\exdisplay[labeloffset=2em,dima=2em,dimb=1em,dimc=-.8em]
\def\\#1-{{\bf #1}-}%
\labels
\openup1pt
\halign{%
   #\tspace[labeloffset]\hfil&    % example number
   #\tl\tspace[textoffset]\hfil&  % line label
   #\tspace \hfil&                % root
   #\tspace \hfil&                % perfect stem
   `#'\hfil\cr                    % gloss
(\the\excnt)& \omit\tspace[dimc] High vowel in the nucleus of the
   root\hidewidth\crnb
& \nl & \hwit{root}& \hwit{perfect stem}&
   \omit\tspace\hwit{gloss}\crnb
&& baudh& \\bu-baudh& know, wake\cr
&& stau& \\tu-stau& praise\cr
&& smai& \\si-smai& smile\cr
\noalign{\exbreak}
&& suap& \\su-suap& sleep\cr
&& miaks& \\mi-miaks& glitter\cr
&& auc& \\u-auc& please\cr
\noalign{\exbreak\smallskip}
& \omit\tspace[dimc] No high vowel in the nucleus of the
   root\hidewidth\crnb
&& suaj& \\sa-suaj& embrace\cr
&& krand& \\ka-krand& cry out\cr
\noalign{\exbreak}
&& skand& \\ka-skand& leap\cr
&& mard& \\ma-mard& rub, crush\cr
&& mnaa& \\ma-mnaa& note\cr
}\xe

The example number in the code below is inserted by
|\exnoprint|, which is how |\ex| inserts example numbers.
If, by the way, you don't like the way example numbers are
inserted (surrounded by parentheses), you can redefine
|\exnoprint|. The code uses |\crnb|, which expands to
|\cr\noalign{\par\nobreak}|, to prevent a page
break between a heading and the remainder of the table which
follows. Page breaks are encouraged by |\exbreak| at a few points
where it is judged that the logic of the table can tolerate it.
|\exbreak| encourages a page break at the cost of allowing a
certain amount of white space at the bottom of the broken
page.\footnote{See page \getref{exbreakpage} for a more complete
discussion of |\exbreak|.  The amount of encouragement and the amount of
whitespace are parametrized.}
A
negative horizontal skip |\tspace[dimc]| is used to highlight the
subheadings (and to show the reader that it is a possibility, if
you need it).

\vbox{\codedisplay
\exdisplay[labeloffset=2em,dima=2em,dimb=1em,dimc=-.8em]
\def\\#1-{{\bf #1}-}%
\labels
\openup1pt
\halign{%
   #\tspace[labeloffset]\hfil&    % example number
   #\tl\tspace[textoffset]\hfil&  % line label
   #\tspace \hfil&                % root
   #\tspace \hfil&                % perfect stem
   `#'\hfil\cr                    % gloss
(\the\excnt)& \omit\tspace[dimc] High vowel in the nucleus of the
   root\hidewidth\crnb
& \nl & \hwit{root}& \hwit{perfect stem}&
   \omit\tspace\hwit{gloss}\crnb
&& baudh& \\bu-baudh& know, wake\cr
&& stau& \\tu-stau& praise\cr
&& smai& \\si-smai& smile\cr
\noalign{\exbreak}
&& suap& \\su-suap& sleep\cr
&& miaks& \\mi-miaks& glitter\cr
&& auc& \\u-auc& please\cr
\noalign{\exbreak\smallskip}
& \omit\tspace[dimc] No high vowel in the nucleus of the
   root\hidewidth\crnb
&& suaj& \\sa-suaj& embrace\cr
&& krand& \\ka-krand& cry out\cr|par|nobreak
\noalign{\exbreak}|par|nobreak
&& skand& \\ka-skand& leap\cr|par|nobreak
&& mard& \\ma-mard& rub, crush\cr|par|nobreak
&& mnaa& \\ma-mnaa& note\cr|par|nobreak
}\xe |endcodedisplay
\vskip-2ex}

\subsection Squeezing tables into tight places

Foregoing |\ex| and directly using |\halign| inside |\exdisplay|
\dots|\xe| has other uses besides constructing tables in numbered
examples which can be broken between pages.  The technique is
also sometimes useful in fitting a table in a numbered example
into a narrow page width. The table below was constructed to fit
on a page of width $4.3\,\rm in$, with no room to spare. It gives
the present indicative conjunction of the Sanskrit verb root {\sl
dve\.s\kern.6pt/dvi\.s\/} `hate'.

\framedisplay
\hsize=4.3in
\exdisplay[dima=.5em,dimb=.4em,textoffset=.5em]
\def\\#1{$\acute{\hbox{\=#1}}$}%
\tabskip=0pt
\openup.4ex
\halign to \hsize{\tspace[dima]#\tspace[textoffset]\hfil&
   #\hfil\tabskip=0pt plus 1fil&
   #\hfil& #\hfil& \tspace[dimb]#\hfil&
   #\hfil &  #\hfil\tabskip=0pt\cr
\omit\exnoprint\hidewidth&
   \multispan6 \hwit{Present Indicative}\crnb
&\multispan3 \hwit{active}& \multispan3 \hwit{middle}\cr
& \hwit{sg}& \hwit{du}& \hwit{pl}&
   \hwit{sg}& \hwit{du}& \hwit{pl}\cr
\it 1& {\bf dv\'e\.s}-mi& dvi\.s-v\'as& dvi\.s-m\'as&
   dvi\.s-\'e& dvi\.s-v\'ahe& dvi\.s-m\'ahe\cr
\it 2& {\bf dv\'ek}-\.si& dvi\.s-\.th\'as& dvi\.s-\.th\'a&
   dvik\.s-\'e& dvi\.s-\\athe& dvi\.d-\.dhv\'e\cr
\it 3& {\bf dv\'e\.s}-\.ti& dvi\.s-\.t\'as& dvi\.s-\'anti&
   dvi\.s-\.t\'e& dvi\.s-\\ate& dvi\.s-\'ate\cr
}
\xe
\endframedisplay

Assuming that the page width has been set to $4.3\,\rm in$
(|\hsize=4.3in|), the following code produces (\lastx), which is
precisely $4.3\,\rm in$ wide.

\codedisplay
\exdisplay[dima=.5em,dimb=.4em,textoffset=.5em]
\def\\#1{$\acute{\hbox{\=#1}}$}%
\tabskip=0pt
\openup.4ex
\halign to \hsize{\tspace[dima]#\tspace[textoffset]\hfil&
   #\hfil\tabskip=0pt plus 1fil&
   #\hfil& #\hfil& \tspace[dimb]#\hfil&
   #\hfil &  #\hfil\tabskip=0pt\cr
\omit\exnoprint\hidewidth&
   \multispan6 \hwit{Present Indicative}\crnb
&\multispan3 \hwit{active}& \multispan3 \hwit{middle}\cr
& \hwit{sg}& \hwit{du}& \hwit{pl}&
   \hwit{sg}& \hwit{du}& \hwit{pl}\cr
\it 1& {\bf dv\'e\.s}-mi& dvi\.s-v\'as& dvi\.s-m\'as&
   dvi\.s-\'e& dvi\.s-v\'ahe& dvi\.s-m\'ahe\cr
\it 2& {\bf dv\'ek}-\.si& dvi\.s-\.th\'as& dvi\.s-\.th\'a&
   dvik\.s-\'e& dvi\.s-\\athe& dvi\.d-\.dhv\'e\cr
\it 3& {\bf dv\'e\.s}-\.ti& dvi\.s-\.t\'as& dvi\.s-\'anti&
   dvi\.s-\.t\'e& dvi\.s-\\ate& dvi\.s-\'ate\cr
}
\xe
|endcodedisplay