summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/expex/source/06_MoreExamples.tex
blob: 49ff970782d7c8857c0a98662ce1c5448df7e579 (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
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021

%\makeatletter
%\def\showpex{%
%   \edef\resetexcnt{\noexpand\global\noexpand\excnt=\the\excnt}%
%   \quad
%   \psscalebox{1.5}{%
%   \vrule height.5em depth4.6em width0pt
%   \parindent=0pt
%   \leavevmode
%   \Lingset{numoffset=4.5em,preambleoffset=4em,labeloffset=3em,
%      textoffset=4em,labelwidth=.8em,arrows=<->}
%   \pnode(0,0){A}
%   \lower10ex\vbox{\hsize=3.8in
%   \excnt=23
%   \pex
%   \pnode(-\lingpreambleoffset,0){B3}\pnode{B4}
%   This is the preamble.
%   \a \pnode{E4}%
%   This is an example.%
%   \SpecialCoor
%   \rput(A|B3){\pnode{B1}}
%   \rput(B1){\pnode(\lingnumoffset,0){B2}}
%   \rput(E4){\pnode(-\lingtextoffset,0){E3}}
%   \rput(E3){\pnode(-\linglabelwidth,0){E2}}
%   \rput(E2){\pnode(-\linglabeloffset,0){E1}}
%   \psset{nodesep=0,labelsep=0}
%   \pcline[offset=2.5ex](B1)(B2)
%   \Aput{\strut\eighttt numoffset}
%   \pcline[offset=2.5ex](B3)(B4)
%   \Aput{\strut\eighttt preambleoffset}
%   \pcline[offset=-1.5ex](E1)(E2)
%   \Bput{\strut\eighttt labeloffset}
%   \pcline[offset=-1.5ex](E3)(E4)
%   \Bput{\strut\eighttt textoffset}
%   \psset{offset=0,angle=90,linestyle=dotted,arrows=-}
%   \XKV@for@n{1,2,3,4}\which{%
%      \pcline(B\which)([nodesep=3ex]B\which)}%
%   \XKV@for@n{1,2,3,4}\which{%
%      \pcline([nodesep=1.5ex]E\which)([nodesep=-2ex]E\which)}%
%   \xe}}%
%   \resetexcnt
%}
%\resetatcatcode
%--------------------------------------
\section More on examples, with and without labeled parts

\deftagsec{advanced}
In this section, we take up complications and fine points.  Users
should ignore it until they face a problem that the earlier
sections do not deal with.

\subsection Relative versus fixed dimensions

{\it Tex\/} has two kinds of dimensional units.  Dimensions
specified in term of ``pts'', ``inches'', ``cm'', etc. are fixed.
Dimensions specified in terms of the units ``em'' or ``ex'' are
relative to the particular text font that is current.
Historically, an em is the width of a capital M and an ex is the
height of a lowercase x.  This is still more or less true, but
each font is free to specify the equivalents in any way that it
sees fit.  The difference has important implications for
parameter setting.  A value specified in terms of em or ex units
can be used without change in both the main text and footnotes,
for example.  If we set |textoffset=1em| at the beginning of a
document, the proportions will stay the same whether we used 10pt
or 12pt type, or 8 or 9 pt type in footnotes.
If the document is set in 12pt type, and 1em is specified to be
12pt in that main text font, it makes no difference for
typesetting in the main text font whether we set |textoffset=1em|
or |textoffset=12pt|.  But it does make a difference in sections
of the document where a font with a different em dimension is
used.  If we switch to a font with a 10pt em unit, then the first
specification will give a physical offset of 10pt, but the second
will give a physical offset of 12pt.

When a dimension or skip parameter is reset by incrementing the old
value, the new value is specified as a fixed dimension, which will
not scale with font changes.  The same is true of setting lengths
indirectly by setting |labelwidth| or |exnowidth|.  Adjusting a
parameter by incrementing the old value, or using |samplelabel|
or |exnowidth| to set the width of the label slot or the
effective width of the example number, should only be used to
make local adjustments, not at a level which has font size
changes in its scope.  For this reason, {\sl expex.tex\/}
specifies the label width in the label type |alpha| by
|labelwidth=.72em|, not by |samplelabel=a.|.\footnote{%
In the font
that I happen to be using to write this section, the alphabetical
labels (including the period) a--d have widths varying from
\textdim{.694 em} to \textdim{.75 em}; the capital labels A--D
have widths varying from \textdim{.917 em} to \textdim{.972 em};
and the integer labels for 1 to 9 all have width \textdim{.75
em}. The label width settings for the label types |alpha|
(\textdim{.72 em}) and |caps| (\textdim{.94 em}) are good
compromises.}
Setting |labelwidth| via the second method would only be
satisfactory if the fonts in force at the points that |\pex| is
used is the same as the font in force when {\sl expex.tex\/} is
input and the |alpha| style defined.

\subsection Anchoring

\deftagsec{anchors}%
\begininventory
\parameters
\idx{|labelanchor|}& |numright|, |numleft|, or |margin|&
   |numright|\cr
\idx{|preambleanchor|}& |numright|, |labelleft|, or |text|&
   |numright|\cr
\idx{|textanchor|}& |numleft| or |normal|& |normal|\cr
\endinventory
%\sidx{|numleft| (|textanchor| value)}%
%\sidx{|normal| (|textanchor| value)}%
%
Initially, the left edge of the label slot is determined by its
offset from the right edge of the number, the left edge of the
preamble is also determined by its offset from the left edge of
the number, and the left edge of the text is determined by its
offset from the right edge of the label slot.  But the ``anchor''
for an offset is parametrized.  In the example below, it is
useful to anchor the labeloffset at the left edge of the example
number.

\begingroup
\setss .55 .38
\beginss
\pex[exno={[47, partially repeated from
   p. 32]},labelanchor=numleft,
   exnoformat=X,labeloffset=1.5em]
\par
\a[label=b] first
\a[label=d] second
\a[label=g] third
\xe|midss
%\pex[exno={47, partially repeated from
%   p. 32},labelanchor=numleft,exnoformat={[X]},
%   labeloffset=1.5em]
\pex[exno={[47, partially repeated from
   p. 32]},labelanchor=numleft,exnoformat=X,
   labeloffset=1.5em]
\par
\a[label=b] first
\a[label=d] second
\a[label=g] third
\xe
\endss
\endgroup
\noindent Braces are needed in the specification of the
value of |exno|, otherwise |\pex| would think that the key |exno|
was set to the value |[47| and try to set the key |partially
repeated from p. 32| to its default value. |exnoformat| is set to |X|
so that parentheses are not put around the special exno.

The following would work equally well:

\def\stuff{$\vdots$}
\codedisplay
\pex[exno={47, partially repeated from
   p. 32},labelanchor=numleft,exnoformat={[X]},
   labeloffset=1.5em]
          |stuff
|endcodedisplay
Braces are needed around |[X]| so that the mechanism that reads the
optional argument of |\pex| does not interpret the right bracket as
the right delimiter of the optional argument.

The |normal| setting of |textanchor| anchors the text at the
right edge of the number for |\ex| constructions and the right edge
of the label slot for |\pex| constructions.

Here is another example:
\beginss
\lingset{textanchor=numleft,
   labelanchor=numleft,
   labeloffset=.35in,
   textoffset=.7in}
\pex[exno=9]
\a first
\a second
\xe
\bigskip
\pex[exno=10]
\a first
\a[label=aa] second
\xe|midss
\lingset{textanchor=numleft,
   labelanchor=numleft,
   labeloffset=.35in,
   textoffset=.7in}
\pex[exno=9]
\a first
\a second
\xe
\bigskip
\pex[exno=10]
\a first
\a[label=aa] second
\xe
\endss
\noindent Some publications demand this style, in which both the
label and text offsets are measured from the left edge of the
number, or from the margin. It is a relic of typewriter days with
mechanical tabs.

\subsection Formatting the labels

\begininventory
\parameters
\idx{|everylabel|}& token list\qquad& |{}|\cr
\idx{|labelformat|}& \dots\ |A| \dots & |A.|\cr
\endinventory
\deftagpage{labelformatpage}
%
\noindent The token list |everylabel| is inserted just before labels
are typeset.  It is grouped so that it affects only the label.  The
main use is to set the font used for the labels if it differs from the
font in the running text.  For example:

\beginss
\pex[everylabel=\it]
\a one
\a two
\xe|midss
\pex[everylabel=\it]<everylabel1>
\a one
\a two
\xe
\endss

There are other uses aside from setting the label font.

\beginss
\pex[everylabel=A,labeltype=numeric,
   samplelabel=A1.]
\a An example
\a An example
\a An example
\xe|midss
\pex[everylabel=A,labeltype=numeric,
   samplelabel=A1.]
\a An example
\a An example
\a An example
\xe
\endss

The effect of the value of |labelformat| is illustrated in
(\nextx).

\setss .6 .35

\beginss
\pex[labelformat=$\langle$A$\rangle$,
   samplelabel=$\langle$a$\rangle$]
\a first
\a second
\xe|midss
\pex[labelformat=$\langle A\rangle$,
   samplelabel=$\langle A\rangle$]
\a first
\a second
\xe
\endss

The example above is fanciful, but one sometimes sees examples in the
format below.

\beginss
\pex[exnoformat=X.,labeltype=roman,
   labelformat=(A),samplelabel=(iii)]
\a first
\a second
\a third
\a fourth
\xe|midss
\pex[exnoformat=X.,labeltype=roman,
   labelformat=(A),samplelabel=(iii)]<sometimes>
\a first
\a second
\a third
\a fourth
\xe
\endss

The label formatting mechanism is primitive.
|labelformat| must
be of the form\medskip
\centerline{$\rm \langle balanced\
text\rangle\thinspace|A|\thinspace \langle balanced\ text\rangle$}
\medskip
\noindent The pre-A text is inserted before the label (including
the material specified by |everylabel|) and the post-A text is
inserted after the label. The balanced text cannot contain the
character |A|.  {\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.

There is some redundancy.  The following is an alternate way to get
the effect in (\getref{everylabel1}) using |labelformat| instead of
|everylabel|.

\beginss
\pex[labelformat=\it A.]
\a one
\a two
\xe|midss
\pex[labelformat=\it A.]
\a one
\a two
\xe
\endss

Another style sometimes found in footnotes is like the one in
(\getref{sometimes}), except that the labels are right aligned in the
label slot.

\subsection Aligning the labels

\begininventory
\parameters
\idx{|labelalign|}& |left|, |right|, or |margin|&
   \hfil |left|\cr
\endinventory

\noindent There is a choice of left, right, or center alignment of the
labels in the label slot.  This is chosen by the parameter
\idx{|labelalign|}, which can be set to |left|, |center|, or |right|.
For example,

\beginss
\pex[exno=43,labeltype=roman,
   labelformat=(A),labelalign=right,
   samplelabel=(iii)]
\a first
\a second
\a third
\a fourth
\xe|midss
\pex[exno=43,labeltype=roman,
   labelformat=(A),labelalign=right,
   samplelabel=(iii)]
\a first
\a second
\a third
\a fourth
\xe
\endss
This style looks odd to me, but this is the style for multipart examples
{\it in the main text\/} in Chomsky's {\it Lectures on Government
and Binding}.  In footnotes, the style is:

\beginss
\pex[exno=i,labeltype=alpha,
   samplelabel=(a),labelformat=(A)]
\a first
\a second
\a third
\a fourth
\xe|midss
\pex[exno=i,labeltype=alpha,
   samplelabel=(a),labelformat=(A)]
\a first
\a second
\a third
\a fourth
\xe
\endss

If you look carefully, the vertical column of parts labels in the last
example looks somewhat ragged because the width of ``(b)'' is
slightly larger than the width of ``(c)''.  Center alignment of the
labels gives a neater appearance.

\beginss
\pex[exno=i,labeltype=alpha,
   samplelabel=(a),labelformat=(A),
   labelalign=center]
\a first
\a second
\a third
\a fourth
\xe|midss
\pex[exno=i,labeltype=alpha,
   samplelabel=(a),labelformat=(A),
   labelalign=center]
\a first
\a second
\a third
\a fourth
\xe
\endss

For more ordinary |\pex| constructions which use the letters or
numbers which have roughly the same width, label alignment is not
a significant concern.  But if labels include, for example, the
narrow letter ``i'' and the wide letter ``m'', as below, label
alignment has a noticeable effect on the appearance.  Individual
tastes (and publisher's demands) may differ, but I prefer center
alignment in these cases.

\line{%
\lingset{belowpreambleskip=.4ex,interpartskip=.3ex,
   everyex=\advance\pexcnt by 8,samplelabel=m.}%
\hsize=.33\hsize
\vbox{%
\pex[labelalign=left]<triplea1>
{\it left aligned labels}
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\xe}%
\vbox{%
\pex[labelalign=center]
{\it center aligned labels}
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\xe}
\vbox{%
\pex[labelalign=right]<triplea3>
{\it right aligned labels}
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\xe}}

If the labels are numeric, label alignment can have an even bigger
effect.  Again, individual tastes and publishers' demands may
differ.  My preference is right alignment in this case.

\line{%
\lingset{interpartskip=.3ex,labeltype=numeric,
   everyex=\advance\pexcnt by 6,samplelabel=10.}%
\hsize=.33\hsize
\vbox{%
\pex[labelalign=left]<tripleb1>
{\it left aligned labels}
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\xe}\hfil
\vbox{%
\pex[labelalign=center]
{\it center aligned labels}
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\xe}\hfil
\vbox{%
\pex[labelalign=right]<tripleb3>
{\it right aligned labels}
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\a A typical example.
\xe}}

The initial setting is left alignment for letters (either
uppercase or lowercase) and right alignment for numbers. Unless
numbers or letters of significantly different widths appear as
labels, most users will not notice the difference and can safely
ignore the issue.

It is a side issue, but the reader may have wondered how
(\getref{triplea1}--\getref{triplea3}) and
(\getref{tripleb1}--\getref{tripleb3}) were typeset. The idea is
simple.  You say:

\codedisplay
\line{\divide\hsize by 3
   \vbox{\pex|verbdots \xe}\hss
   \vbox{\pex|verbdots\xe}\hss
   \vbox{\pex|verbdots \xe}}
|endcodedisplay
|\hss| is used to give a little stretch or shrink so that
dimensional rounding does not lead to an under or overfull
|\line{| \dots|}|.  It is important in examples like this that
|\pexcnt| is incremented globally, so that the latter vboxes see
the |\excnt| which results from an operation inside a previous
vbox.  We will see later that in some situations this behaviour
is not desirable and how it can be altered.

Variations are useful.  One can easily imagine a situation in
which something like the following is appropriate for two side by
side examples.

\codedisplay
\line{%
   \vbox{\hsize=.55\hsize \pex|verbdots \xe}\hss
   \vbox{\hsize=.45\hsize \pex|verbdots \xe}}
|endcodedisplay


\subsection User designed labeling

\begininventory
\macros* \idx{|\definelabeltype|}\endmc
\counter \idx{|\pexcnt|}\endmc
\parameters
\idx{|labelgen|}& |char|, |number|, or |list|&
   |char|\cr
|pexcnt|\sidx{|pexcnt|, parameter}& integer& |97|\cr
\idx{|labellist|}& comma separated list& |{}|\cr
\endinventory
%
If |labeltype| is set to |alpha|, the counter |\pexcnt| is set to
97, the character code of lowercase a in standard roman font
sets, and |labelgen| is set to |char|.  The successive labels are
generated by taking the character corresponding to |\pexcnt| and
stepping the counter by 1.  This relies on the fact that the
alphabetical sequence of characters corresponds to the numerical
order of the character codes of the characters.  Setting
|labeltype| to |caps| is almost the same, except that |\pexcnt|
is initialized to 65, the character code of uppercase A.  If
|labeltype| is set to |numeric|, |labelgen| is set to |number|
and |\pexcnt| is initialized to 1.  The labels are generated by
taking the number corresponding to the value of |\pexcnt|.

\let\mit=\twelvei
Something like the following might be useful.  In the format I am
using, |\mit| selects a math italics font which has the lowercase
greek letters starting with the position 11.

\beginss
\pex[labelgen=char,pexcnt=11,
   everylabel=\mit]
\a
\a
\a
\a
\xe|midss
\pex[labelgen=char,pexcnt=11,
   everylabel=\mit]
\a
\a
\a
\a
\xe
\endss
\noindent This scheme has a quirk if labels above $\xi$ are
needed because the correspondence between numerical order and
alphabetical order breaks down at this point.  {\it o} will be
missing, with $\pi$ following $\xi$.

This labeling scheme can be defined by:
\codedisplay
\definelabeltype{greekmath}{labelgen=char,pexcnt=11,everylabel=\mit,
   labelformat=A.}
|endcodedisplay
%
Then |\pex[labeltype=greekmath]| is sufficient to
invoke this labeling style.

If a sequence of character labels is needed which does not appear
in sequence in a font, it is necessary to generate the labels
from a list.  Documents in Greek, for example, face the following
problem.  Roman letters were largely borrowed from the Greek
alphabet, but Greek alphabetical order was not.  Common greek
fonts place letters in the position of the borrowing, not in
their natural order in the Greek alphabet.  Documents written in
Greek, therefore, will have to generate the labels in multipart
examples from a list. The solution is to set |labelgen| to
|list|, and |labellist| to the desired list of labels.

For example, suppose the label type |greek| is defined by
\codedisplay
\definelabeltype{greek}{labelgen=list,
   labellist={a,b,g,d,e,z,h,j,i,k,l,m,n,x,o,p,r,sv,t,u,f,q,y,w}}
|endcodedisplay
%
and that |\gr| selects one of the grmn series of fonts
in the cb family of Greek fonts.

\begingroup
%\let\gr=\twelverm
\font\gr=grmn1200
\gr

\definelabeltype{greek}{labelgen=list,
   labellist={a,b,g,d,e,z,h,j,i,k,l,m,n,x,o,p,r,sv,t,u,f,q,y,w}}
\lingset{labeltype=greek}

\beginss
\gr
\pex[labeltype=greek]
\a {\rm a,b,g,d,e,z}
\a a,b,g,d,e,z
\a {\rm a,b,c,d,e,f}
\a a,b,c,d,e,f
\a {\rm A,B,G,D,E,Z}
\a A,B,G,D,E,Z
\xe|midss
\pex[labeltype=greek]
\a {\rm a,b,g,d,e,z}
\a a,b,g,d,e,z
\a {\rm a,b,c,d,e,f}
\a a,b,c,d,e,f
\a {\rm A,B,G,D,E,Z}
\a A,B,G,D,E,Z
\xe
\endss
\endgroup

\noindent ``sv'' appears in the list rather than ``v'' so that a
nonfinal sigma is produced rather than a final sigma.  They
differ.  ``v'' produces what amounts to a vertical strut of zero
width, making the sigma nonfinal, but contributing no visible
material. (Thanks to Christos Vlachos for this idea.)

Of course, if the entire document is written in Greek, then
\exfrag
|\lingset{labeltype=greek}|
\xe
should have global scope, so that parameter
setting is not necessary in each |\pex| construction.

The computation is more efficient if the label list is shorter,
so the label list should not be much longer than the longest list
you anticipate using.  If more labels are called for than the
list provides, labeling starts over again at the beginning and a
warning is issued.

\subsection The parameter {\tt sampleexno}

\begininventory
\parameters*
\idx{|sampleexno|}& token list& \hfil |{}|\cr
\endinventory
%
In some publications, if two examples are close together in the
running text and the widths of the typeset example numbers are
different, the offsets are modified so that the texts in the two
examples are aligned.  The following is considered, under this
stringent aesthetic, to be less than ideal.

\framedisplay
\keepexcntlocal \excnt=9
\pex
\a I consider firemen available. (generic only)
\a I consider firemen intelligent. (generic only)
\xe
Exceptional case marking (ECM) verbs seem more or less to allow both
existential and generic interpretations of complement subjects:
\pex
\a I believe firemen to be available. (both generic and existential)
\a I believe violists to be intelligent. (generic only)
\xe
\endframedisplay

\ExPex\ provides the parameter |sampleexno| to handle this formatting
problem.  If the parameter is set to the empty token list, it has no
effect of the formatting.  If it is set to a nonempty token list, that
token list is put in an hbox and its width is taken to be the
effective typeset width of the example number.

\framedisplay
\keepexcntlocal \excnt=9
\pex[sampleexno=(10)]
\a I consider firemen available. (generic only)
\a I consider firemen intelligent. (generic only)
\xe
Exceptional case marking (ECM) verbs seem more or less to allow both
existential and generic interpretations of complement subjects:
\pex
\a I believe firemen to be available. (both generic and existential)
\a I believe violists to be intelligent. (generic only)
\xe
\endframedisplay
\codedisplay~
\pex[sampleexno=(10)]
\a I consider firemen available. (generic only)
\a I consider firemen intelligent. (generic only)
\xe
Exceptional case marking (ECM) verbs seem more or less to allow both
existential and generic interpretations of complement subjects:
\pex
\a I believe firemen to be available. (both generic and existential)
\a I believe violists to be intelligent. (generic only)
\xe
|endcodedisplay

This kind of fine tuning should only be done at the immediately
pre-publication point because it depends upon the final
assignment of example numbers and an aesthetic judgement of when
two multipart examples are ``visually close'' in the finished
product.

It seems to be common for publishers to do fine tuning of this
sort in footnotes. There are two reasons for this. First,
lowercase roman numerals are commonly used and their widths vary
noticeably. Second, only a few examples are involved, assuming
that examples numbers in a footnote start at (i), so the final
assignments of example numbers is relatively easy to determine.
The role of |sampleexno| in footnotes is taken up in Section
\getref{fns}.

\subsection IJAL style format of multiline examples

\begininventory
\macros* \idx{|\actualexno|}\endmc
\parametersdef
\idx{|avoidnumlabelclash|}& boolean& |false|& |true|\cr
\idx{|appendtopexarg|}& token list& |{}|\cr
\endinventory
The formatting demands of the International Journal of
American Linguistics (IJAL) require some additional
parametrization.  Multipart examples look like this:

\definelingstyle{IJAL}{%
   avoidnumlabelclash=true,
   labelanchor=numleft,labeloffset=0pt,
   textanchor=normal,textoffset=1em,
   preambleanchor=text,preambleoffset=0pt,
   labelformat=(A),
   everylabel=\actualexno,
   appendtopexarg={samplelabel=(\actualexno a)}
   }%
\begingroup

\lingset{lingstyle=IJAL}
\pex[exno=4]<nonum>
\a first
\a second
\xe

\pex~[exno=64]
Preamble
\a first
\a second
\xe

\pex~[exno=1025]
Preamble
\a first
\a second
\xe
\endgroup

A first approximation is

\codedisplay
\lingset{labelanchor=numleft,labeloffset=0pt,
   textanchor=normal,textoffset=1.8em,
   preambleanchor=text,preambleoffset=0pt,
   labelformat=(A),everylabel=\actualexno}
|endcodedisplay
|\actualexno| expands to the numerical value in |\excnt|, provided
no special example number is set by |exno|, otherwise to the
special example number. But the results (below) have some
major problems.

\begingroup
\lingset{labelanchor=numleft,labeloffset=0pt,
   textanchor=normal,textoffset=1.8em,
   preambleanchor=text,preambleoffset=0pt,
   labelformat=(A),everylabel=\actualexno}
\pex[exno=5]
\a first
\a second
\deftag{5}{IJAL1}
\xe

\pex~[exno=65]
Preamble
\a first
\a second
\xe

\pex~[exno=102]
Preamble
\a first
\a second
\xe

There are two things that need to be done.  First, in order to
avoid printing both the example number and the label of the first
part in examples with no preamble, as is the case in
(\getref{IJAL1}), printing the example number must be suppressed
if there is no preamble. Second, in order to avoid the shrinking
gap between the label and the text as more digits appear in the
example number and it gets wider, the label width must be made
dependent on the example number.

\ExPex\ provides the boolean parameter |avoidnumlabelclash|
which, if set to |true|, suppresses printing the example number
in |\pex| constructions {\it if there is no preamble}.  It has
the XKV default value |true|, so that it can be set by giving the
key with no label.  Although it has the default value |true|, it
has the initial value |false|.  So, with the parameters set as
above, we get:

\beginss
\pex[exno=5,avoidnumlabelclash]
\a first
\a second
\xe|midss
\lingset{labelanchor=numleft,labeloffset=0pt,
   textanchor=normal,textoffset=1.8em,
   preambleanchor=text,preambleoffset=0pt,
   labelformat=(A),everylabel=\actualexno}
\pex[exno=5,avoidnumlabelclash]
\a first
\a second
\xe
\endss

In order to solve the problem of the shrinking gap between the
label and text, we could try something like
|samplelabel=(\actualexno a)|. But it is considerably less than
elegant to have to write this in every |\pex| example.  It will
not produce the desired result to put
|\lingset{samplelabel=(\actualexno a)}| at the beginning of the
document.  |labelwidth| will be set to whatever the current width
of |(\actualexno a)| is, which is not likely to be what you want
for the entire document even if |\actualexno| happens to be
defined at the point that the |\lingset| is
executed.  To circumvent the global/local problem, \ExPex\
provides the parameter |appendtopexarg|.  Its value (unexpanded)
is appended to whatever other arguments are given to
|\pex| and evaluated locally.

\exfrag
|\lingset{appendtopexarg={samplelabel=(\actualexno a)}|
\xe
accomplishes what we want.

We can summarize the discussion by defining the IJAL style.

\codedisplay
\definelingstyle{IJAL}{labelwidth=2em,labelanchor=numleft,
   labeloffset=0pt,labelformat=(A),everylabel=\actualexno,
   textanchor=normal,textoffset=1em,preambleanchor=text,
   preambleoffset=0pt,avoidnumlabelclash,
   appendtopexarg={samplelabel=(\actualexno a)}}
|endcodedisplay
Then

\definelingstyle{IJAL}{labelwidth=2em,labelanchor=numleft,
   labeloffset=0pt,labelformat=(A),everylabel=\actualexno,
   textanchor=normal,textoffset=1em,preambleanchor=text,
   preambleoffset=0pt,avoidnumlabelclash,
   appendtopexarg={samplelabel=(\actualexno a)}}%
\edef\\{\noexpand\vskip\lingbelowexskip}%
\beginss
\lingset{lingstyle=IJAL}
\pex[exno=5]
\a first
\a second
\xe

\pex~[exno=65]
Preamble
\a first
\a second
\xe

\pex~[exno=1026]
Preamble
\a first
\a second
\xe|midss
\lingset{lingstyle=IJAL}
\pex~[exno=5]
\a first
\a second
\xe
\\
\pex[exno=65]
Preamble
\a first
\a second
\xe
\\
\pex~[exno=1026]
Preamble
\a first
\a second
\xe
\endss

\endgroup

%\excnt=34

\subsection Footnotes and endnotes

\deftagsec{fns}
\begininventory
\macros* \idx{|\keepexcntlocal|}\endmc
\endinventory
%
Footnotes and endnotes pose a somewhat thorny problem since many different
\Tex\ and \LaTex\ macros are used to typeset footnotes and endnotes.
Further, there are different ways of assigning example numbers and
labels in multipart examples in footnotes. The footnote
referenced at the end of this sentence is representative.
\footnote{%
\lingset{sampleexno=(ii)}
The existential reading does not seem to be available for subjects of
small clause complements of {\it consider\/}:
\pex
\a I consider firemen available. (generic only)
\a I consider firemen intelligent. (generic only)
\xe
Exceptional case marking (ECM) verbs seem more or less to allow both
existential and generic interpretations of complement subjects:
\pex
\a I believe firemen to be available. (both generic and existential)
\a I believe violists to be intelligent. (generic only)
%\a \ljudge{??}I believe opera singers to know Hittite.
\xe
}
It is an abbreviated version of footnote 17 in Chapter 2 of
Diesing's {\sl Indefinites}, MIT Press.%
This footnote style is fairly common.

The \ExPex\ distribution contains two files, {\it eptexfn.tex\/} and
{\it exltxfn.sty\/} which may be helpful in producing footnotes in
this style.  They do two things.  First, they each define a macro
(|\everyfootnote|) which, if evaluated at the start of processing a
footnote, ensures that examples are correctly formatted.  Second, they
each perform surgery on a standard |\footnote| macro so that
(among other things) |\everyfootnote| is inserted in the
appropriate place.

I intend these macro files both to be used directly or to serve as
models for the creation of variations which satisfy user needs. To the
latter end, I will go through {\it expex.sty\/} and explain how it
works.  The file listing is:

\CLnum
\makeatletter
\def\everyfootnote{%
   \keepexcntlocal
   \excnt=1
   \lingset{exskip=1ex,exnotype=roman,sampleexno=,
      labeltype=alpha,labelanchor=numright,labeloffset=.6em,
      textoffset=.6em}
}
\renewcommand{\@makefntext}[1]{%
   \everyfootnote
   \parindent=1em
   \noindent
   \@thefnmark.\enspace #1%
}
\resetatcatcode|endCLnum

Lines 2--8 define the macro |\everyfootnote| which will be
inserted into the footnote macro. It first ensures that changes
in |excnt| that are made in the footnote are kept local to the
footnote.  |\keepexcntlocal| is an \ExPex\ macro whose execution
causes changes in |\exnt| to be kept local to the group in which
|\keepexntlocalo| is executed.  Without |\keepexcntlocal|,
changes in |excnt| inside a footnote would be visible outside the footnote group in
which the changes occur. |excnt| is then initialized.  Finally,
parameters are set which control the formatting of examples in
the footnote. The LaTex |\footnote| command uses |\@makefntext| to
typeset the footnote.  It is defined in the cls file
which is used. The redefinition in lines 9--14 is a modification
of the |\@makefntext| macro defined in {\it article.cls}. It
first executes |\everyfootnote|, then prints the footnote number
flush left at full footnote size, not as a superscript.

Assuming that |\usepackage{epltxfn}| has been executed, the
following code produces fn.~\the\fnno.
\codedisplay
\footnote{%
\lingset{sampleexno=(ii)}
The existential reading does not seem to be available for subjects of
small clause complements of {\it consider\/}:
\pex
\a I consider firemen available. (generic only)
\a I consider firemen intelligent. (generic only)
\xe
Exceptional case marking (ECM) verbs seem more or less to allow both
existential and generic interpretations of complement subjects:
\pex
\a I believe firemen to be available. (both generic and existential)
\a I believe violists to be intelligent. (generic only)
\xe
}
|endcodedisplay

The code in {\sl eptexfn.tex\/} is somewhat more complicated
because {\it Plain Tex\/} does not number footnotes and uses the
same font for running text and footnotes.  |\everyfootnote| is
identical.  If it is compared with the footnote macros in the
{\sl TexBook\/} (p. 363), on which it is modeled, it is easy to
see the significance of the various modifications.

I anticipate that although the footnote macros in {\sl epltxfn.sty\/}
and {\sl eptexfn.tex\/} will be useful to some readers without
modification, other users will need to modify them for one reason or
the other.  Endnotes, in particular, will require work.  I hope that
these two files will serve as useful models.  Of course, trivial
modifications of the various dimensions can be done easily.  More
extensive modification require appropriate levels of expertise.  Users
should feel free to write to me directly ({\sl j.frampton@neu.edu\/}) or
post questions to the {\sl Ling-Tex\/} discussion group, or to send me
modifications that might prove useful to others.  A file {\it
epltxfn-endnotes.sty}, for example, would be useful.