summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/expex/source/05_MultiPart-Basics.tex
blob: 089d3d34b9e787638cabb4d38a1613ae9fa94077 (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

\section Examples with labeled parts: Basics

\begininventory
\counter \idx{|\pexcnt|}\endmc
\macros \idx{|\pex~[]|}, \idx{|\a[]|}\endmc
\parameters
\idx{|labeltype|}& name of a key-value list& |alpha|\cr
\idx{|labeloffset|\user} & \inc dimension& \textdim{1 em}\cr
\idx{|labelwidth|\user} & \inc dimension& \textdim{.72 em}\cr
\idx{|preambleoffset|\user} & \inc dimension& \textdim{1 em}\cr
\idx{|interpartskip|\user} & \inc skip&
   1\dimskip ex plus .2\dimskip ex minus .2\dimskip ex\cr
\idx{|belowgpreambleskip|\user} & \inc skip&
   1\dimskip ex plus .2\dimskip ex minus .2\dimskip ex\cr
\idx{|samplelabel|}& token list& (pseudo-parameter)\cr
\endinventory
%
Typical examples are given below, with the initial parameter
settings.\medskip

\framedisplay
\pex
\a This is the first example.
\a This is the second example.
\xe

\pex~<Pre> Multipart examples often have a title or preamble of some
kind.
\a This is the first example.
\a This is the second example.
\xe
\endframedisplay

\codedisplay~
\pex
\a This is the first example.
\a This is the second example.
\xe

\pex~ Multipart examples often have a title or preamble of some kind.
\a This is the first example.
\a This is the second example.
\xe |endcodedisplay

\noindent
Just like |\ex|, |\pex| must be closed by |\xe|, can be
modified by a tilde diacritic to suppress adding vertical space
above the example, and accepts parameters. The macro \idx{|\a|},
which introduces each labeled part, is defined only
within \hbox{|\pex| \dots|\xe|}.  It accepts certain parameters.
Extra vertical skip (set by |interpartskip|) is inserted
between the parts; and extra vertical skip (determined by
|belowpreambleskip|) is inserted between
the {\it preamble\/} and the first part.  The preamble is the
visible material, if any, that appears after the example number
and before the first part.

The horizontal dimensions are parameterized as pictured below,
provided that the anchoring parameters have their initial values.
The parameters |numoffset| and |textoffset| are used in both
|\ex| and |\pex| constructions.
The effects of changing the settings of the
anchoring parameters (|labelanchor| and |textanchor|) will be
considered in Section \getref{anchors}.

\exdisplay
\makeatletter
\vrule height1.6em depth3.5em width0pt
\psscalebox{1.5}{%
\parindent=0pt
\leavevmode
\lingset{numoffset=4.5em,preambleoffset=4em,labeloffset=3em,
   textoffset=4em,labelwidth=.8em}
\pnode(0,0){A}
\lower5ex\vbox{\hsize=3.8in
\psset{arrows=<->}
\pex[exno=24]
\a \pnode{E6}%
This is an example.%
\SpecialCoor
\rput(A|E6){\pnode{E1}}
\rput(E1){\pnode(\lingnumoffset,0){E2}}
\rput(E6){\pnode(-\lingtextoffset,0){E5}}
\rput(E5){\pnode(-\linglabelwidth,0){E4}}
\rput(E4){\pnode(-\linglabeloffset,0){E3}}
\psset{nodesep=0,labelsep=0}
\pcline[offset=2.5ex](E1)(E2)
\Aput{\strut\eighttt numoffset}
\pcline[offset=2.5ex](E3)(E4)
\Aput{\strut\eighttt labeloffset}
\pcline[offset=2.5ex](E5)(E6)
\Aput{\strut\eighttt textoffset}
%\pcline[offset=-1.5ex,arrows=>-<,nodesep=-.65ex](E4)(E5)
\pcline[offset=-1.5ex](E4)(E5)
\Bput{\strut\eighttt labelwidth}
\psset{offset=0,angle=90,linestyle=dotted,arrows=-}
\XKV@for@n{1,2,3,4,5,6}\which{%
   \pcline(E\which)([nodesep=3ex]E\which)}
\pcline([nodesep=1.5ex]E4)([nodesep=-2ex]E4)
\pcline([nodesep=1.5ex]E5)([nodesep=-2ex]E5)
\xe}}%
\xe
Adjustment for the width of the example number is automatic, but
the width of the label slot is a parameter setting, not adjusted
to the width of the particular label which appears in the label
slot.  The initial setting of |labelwidth| is the width of ``a.''
at the point that the default setting is established.  This does
not automatically change if the font is changed, in a footnote
for example.  It can be set by the user explicitly by setting
|labelwidth| to the desired dimension, or as an incremental
change to its previous value (|labelwidth=!3pt|, for example,
increases the width of the label slot by 3pt).  It can also be
set indirectly by giving a sample label.  |labelwidth| is then
set to the current width of that sample.  \ExPex\ sets the
default label width by |samplelabel=a.|.

\ExPex\ comes with three label types predefined: |alpha|,
|caps|, and |numeric|.

\beginss
\pex[labeltype=alpha]
\a First part.
\a Second part.
\xe |midss
\pex[labeltype=alpha]
\a First part.
\a Second part.
\xe
\endss

\beginss
\pex[labeltype=caps]
\a First part.
\a Second part.
\xe |midss
\pex[labeltype=caps]
\a First part.
\a Second part.
\xe
\endss

\beginss
\pex[labeltype=numeric]
\a First part.
\a Second part.
\xe |midss
\pex[labeltype=numeric]
\a First part.
\a Second part.
\xe
\endss

Section \getref{advanced} will detail all the parameters relevant
to the label types and how additional label types can be defined
by the user.

%--------------------------------------
\subsection {\tt nopreamble}

\begininventory
\parametersdef*
\idx{|nopreamble|}& boolean& (not relevant)& \hfil true\cr
\endinventory
%
In order to properly format examples with parts, there are
various reasons that |\pex| must be able to figure out whether
or not there is a preamble.  One reason is fairly obvious.  If
there is a preamble, every part introduced by |\a| must start on
a new line, otherwise only parts after the first part start a new
line.  |\pex| tries to figure it out without help.  If |\a|
directly follows |\pex|(|~|)(|[|\dots|]|) and perhaps a following
space, |\pex| knows there is no preamble and acts accordingly.
There are a few other following tokens, considered later in this
manual, that |\pex| also knows are not signals that there is a
preamble.  But |\pex|'s preamble detection abilities are
primitive.  The following, for example, will confuse |\pex|.

\beginss
\pex \it
\a first
\a second
\xe|midss
\pex \it
\a first
\a second
\xe
\endss
The |\it| command is interpreted as a preamble.

|\pex| needs some guidance in this case.  It is provided by the
parameter |nopreamble|.

\beginss
\pex[nopreamble=true] \it
\a first
\a second
\xe|midss
\pex[nopreamble=true] \it
\a first
\a second
\xe
\endss

In fact, it is a little simpler than this.  XKV parametrization
allows one to stipulate a default value for each key that is
defined.  If the key is given to the parameter setting machinery
with no value, then the key is set to the default value.
|nopreamble| has the default value |true|.  So the following is
sufficient.

\beginss
\pex[nopreamble] \it
\a first
\a second
\xe|midss
\pex[nopreamble] \it
\a first
\a second
\xe
\endss

The global setting of |nopreamble| is irrelevant to |\pex|, which
always assumes there is a preamble unless it sees an immediately
following |\a| or |\pex| or is told directly that there is no
preamble. In the following, for example, the setting of
|nopreamble| outside |\pex| has no effect.

\beginss
\lingset{nopreamble=true}
\pex \it
\a first
\a second
\xe|midss
\lingset{nopreamble=true}
\pex \it
\a first
\a second
\xe
\endss

%\font\titlett=txtt at 13.3pt

\subsection Stipulated labels

\begininventory
\parameters*
|label|& token list& |{}|\cr
\endinventory
%
|label| is recognized as a key only by the |\a| macro.    % =«value»
If |label=«value»| is passed to |\a|,  that value is inserted as the
label, ignoring automatic label generation.

\beginss
\pex[exno=47]
\a[label=b]
\a[label=d]
\a[label=g]
\xe|midss
\pex[exno=47]
\a[label=b]
\a[label=d]
\a[label=g]
\xe
\endss

\noindent Besides |label|, the only other key that |\a|
recognizes is |tag|.  See Section \getref{named-reference}.