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
|
% lollipop-text.tex copyright 1992 Victor Eijkhout
% copyright 2014 Vafa Khalighi
%
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% Text Blocks
\@GenericConstruct{TextBlock}
% commands can be before and after text
% store in two token lists
% switch from one to other by option 'text'
% this may also be used by ParagraphShape
%
\add@TextBlock@default{
\def\@current@options@list{before@coms}
\def\switch@lists{\at@breakpointyes
\def\@current@options@list{after@coms}}
}
\@TextBlockOption{text}{\switch@lists}
\def\@DefineTextBlock{
\csarg\edef{\@name}{\@gen@open
\the\before@coms
}
\@DefineStopCommand{\the\after@coms \@gen@close}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% A L I N E A V O R M E N
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% via \everypar:
% \everypar={\@everyeverypar { ...locaal spul...
% \def\par{... \@par\egroup}
\@GenericConstruct{ParagraphShape}
%%%%!!!!!!!!!!!!!!!!
% not functioning.
% note: \@defaulteverypar is installed now
% as a start@command!
%% anonieme namen
% \iftempa : moet dit inspringen
% \iftempb : speciale behandeling staart?
\def\@ParagraphShapeverstekwaardes{
\tempano \tempbno
\temptoksb={} \temptoksc={}
\def\cs@d{b}\def\@current@options@list{temptoks\cs@d}
}
\def\@DefineParagraphShape{
\csarg{\edef}{\@name}{%
\CSname{AltijdInspringen\iftempa yes\else no\fi}%
\nxp\everypar={\nxp\@everyeverypar
\iftempb \bgroup \fi
\the\temptoksb
\iftempb \parfillskip\z@
\else \if@erislinkswit \parfillskip\z@ \fi\fi
\relax
\iftempb \def\nxp\par{\nxp\unskip\nxp\nobreak\the\temptoksc
\hbox{}\nxp\@par\egroup}\fi
}} }
\@ParagraphShapeNOOP{verticaal}
%-- inspringen
\@ParagraphShapeOption{inspringen}{
\if\EqualString{#1}{no}\else\tempayes\fi}
%-- tekst
\@ParagraphShapeOption{tekst}{\tempbyes\def\cs@d{c}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%% U T I L I T I E S
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%% Space, white space
%
% unit space \@@space is set by switching font style
%
\newdimen\@@space \@@space=.5em
\def\Spaces:#1 {\hskip#1\@@space}
% handig voor bibliografieen
\def\lax{\tolerance\@m \hfuzz\p@}
%%%%%%%%%%%%%%%%%%%%%%%
% White space
%
\NewTrace:skip
\def\hwhite:#1 {\@hwhite{#1}}
\def\@hwhite#1{\ifhmode\unskip\fi\relax
\if\EqualString{#1}{fillup}\hfill\else\hskip\@ww{#1}\relax\fi}
% Vertical
% subtle: argument should be placed even if
% size is equal: stretch may be different,
% probably more. (cf \par\vwit{0pt plus 1fil} )
%
\def\vwhite:#1 {\@vwhite{#1}}
\@GenericOption{vwhite}{\protect@breakpoint
\@add@toks{\@vwhite{#1}}\at@breakpointno}
\def\@vwhite#1{\tempskipa=\@ww{#1}\relax \tempskipb\lastskip
\Tmessage[skip]{Considering vskip \the\tempskipa}%
\ifvmode \ifdim\tempskipb>\tempskipa
\Tmessage[skip]{Ignored. (lastskip=\the\tempskipb)}%
\else \Tmessage[skip]{Backvspacing \the\tempskipb}%
\vskip-\tempskipb
\Tmessage[skip]{Vskip \the\tempskipa}%
\vskip\tempskipa \fi
\else \if\EqualString{#1}{fillup}\hfill
\else\vskip\tempskipa \fi
\fi}
% advance skip by literal or name of control sequence
\def\advance@skip#1#2{\advance#1\@ww{#2}\relax}
% only backspace the previous;
% in this case prevent creating a breakpoint
% if there was no glue
%
\def\v@buffer#1{\tempskipa=\@ww{#1}\relax \tempskipb\lastskip
\Tmessage[skip]{Clearing for vskip \the\tempskipa}%
\ifvmode \ifdim\tempskipb>\tempskipa
\else \ifdim\tempskipb=\z@
\else \vskip-\tempskipb\relax
\Tmessage[skip]{Backspaced}\fi
\fi \fi}
\def\unhskip{\ifhmode\unskip\fi}
\def\leavehmode{\unvbox\voidb@x}
\def\novbreak{\leavehmode\nobreak}
\def\white:#1 {\@white{#1}}
\@GenericOption{white}{\protect@breakpoint
\@add@toks{\@white{#1}}\at@breakpointyes}
\def\@white#1{\ifhmode\@hwhite{#1}\else
\ifvmode\@vwhite{#1}\fi\fi}
\def\fillup{\@white{0pt plus1fill}}
\def\@@distance#1{\csarg\newskip{#1}}
\def\Distance:#1=#2
{\if\UndefinedCS{#1}\@@distance{#1}\fi
\edef\cs@e{\global\noexpand\set@value{#1}%
\if\UndefinedCS{#2}{#2}%
\else \CSname{#2}\fi}
\cs@e}
\def\AdaptiveDistance:#1=#2 {\Distance:#1=#2
\adds@stop@command
{\ifWriteExtern\immediate\write\aux@file
{\string\Distance:#1={\xp\the\csn#1\ecs}}\fi
}}
\Distance:filler={0pt plus 1fil}
\parindent=30pt
\parskip=0pt
\parfillskip=0cm plus 1 fil
\baselineskip=12pt
%%%%%%%%%%%%%%%% Rules
\@GenericOption{rule}{
\if\EqualString{#1}{h}\protect@breakpoint
\@add@toks{\hrule#2\relax}
\at@breakpointyes
\else\if\EqualString{#1}{v}\@add@toks{\vrule#2\relax}
\else\Wmessage{Strange option: <rule:#1=#2>}
\fi \fi}
\@GenericOption{hrule}{\protect@breakpoint
\@add@toks{\hrule}\at@breakpointyes}
\@GenericOption{vrule}{\@add@toks{\vrule}}
%%%%%%%%%%%%%%%% Indentation Control
% default value for all paragraphs set by AlwaysIndent
% this one is set by by the user,
% or by 'indentinside' option of paragraph shapes
%
\DefineTest:AlwaysIndent
\AlwaysIndent:yes
% override by Indent
% can be set by the user,
% or by start/end of text constructs
%
\DefineTest:Indent %forceer/onderdruk inspringen
% Remove indentation
% this is executed by \every@everypar
%
\def\controlled@indentation
{\ifAlwaysIndent
\ifIndent \else \remove@indent \Indent:yes \fi
\else \ifIndent \Indent:no \else \remove@indent \fi
\fi}
\def\remove@indent{{\setbox0=\lastbox}}
\def\noindentation{\AlwaysIndentno \Indentno}
% Indentation control in Universal Block
% control sequences \first@indent \inside@indent \after@indent
% are called (in \edef context) in general open/close macros
% for universal environments
% Indent after this block
% \global because the block may be in a further group
%
\add@generic@default{\def\after@indent{\global\nxp\Indent:no }}
\@GenericOption{indentafter}{
\def\after@indent{\global\nxp\Indent:#1 }}
% Indent in this block
\add@generic@default{\def\inside@indent{}}
\@GenericOption{indentinside}{
\def\inside@indent{\nxp\AlwaysIndent:#1 }}
% Indent first in this block
\add@generic@default{\def\first@indent{\nxp\Indent:no }}
\@GenericOption{indentfirst}{
\def\first@indent{\nxp\Indent:#1 }}
%%%% Level dependent indentation
%
\NewTrace:indent
% Lots of commands and parameters
%
% \levelindent is the indentation that will be taken
% on the current level, jumping to the next
%
\newdimen\levelindent
% \previousindent is the indentation that got us to this level
% list item labels have to outdent over this amount
%
\newdimen\previousindent \previousindent\z@
% indentlevel counter: used to generate automatic indentation,
% for instance \levelindentvi for level vi
%
\new@@counter{indentlevel}
\set@counter{indentlevel}1
% \set@level@indent : set \levelindent to automatically
% generated indentation; if \levelindentiii is defined take it,
% otherwise use \@@level@indent{3}, which uses fraction
% of a \basicindent
%
\def\set@level@indent{\levelindent=
\level@indent{\cs@counter@name{indentlevel}}}
\def\level@indent
#1{\if\UndefinedCS{\@level@indent{#1}}\@@level@indent{#1}%
\else \csname \@level@indent{#1}\endcsname \fi}
\def\@level@indent#1{levelindent\romannumeral#1}
\def\@@level@indent#1{\ifcase#1\z@\or
\basicindent \or .75\basicindent \else .5\basicindent \fi}
\DefineTest:BasicIndentIsSet
% the following lines appear as the last command in \Start,
% so that the user can tinker with \parindent
% through adaptive distances or in the style
%\ifBasicIndentIsSet\else\Distance:basicindent=parindent\fi
%\set@level@indent
% \SetLevelIndent : set exact amount of indentation for
% specific level
%
\def\LevelIndent:#1=#2 {\csarg\edef{\@level@indent{#1}}{\@ww{#2}}}
% Push/Pop indentlevels
%
\def\PushIndentLevel
{\Tmessage[indent]{Old indent: \the\leftskip}%
\advance\leftskip\levelindent
\previousindent=\levelindent
\step@counter{indentlevel}\set@level@indent
\Tmessage[indent]{New indent: \the\leftskip,
at level \the\cs@counter@name{indentlevel}}%
}
% Popping an indent level requires two pops: one for the \levelindent
% and one for the \previousindent. This last one then has to be
% pushed again.
%
\def\PopIndentLevel
{\ifnum\cs@counter@name{indentlevel}=\@ne
\Emessage{Pop indent level attempted at outer level}
\else \back@step@counter{indentlevel}%
\back@step@counter{indentlevel}%
\set@level@indent \previousindent\levelindent
\step@counter{indentlevel}%
\set@level@indent\advance\leftskip-\levelindent
\fi}
%%%%%%%%%%%%%%%% Paragraph Skip control
% parskip is stored and set to zero at the start and end
% of environments
\newskip\@restoreparskip
% it is recorded if a parskip has been stored
%
\newif\if@parskipsaved \@parskipsavedno
% Do no parskip
% used at start of environment
%
\def\hold@parskip
{\@restoreparskip\parskip \parskip\z@ \@parskipsavedyes}
% Hold off parskip
% used at end of environment
%
\def\dono@parskip{\if@parskipsaved \else \hold@parskip \fi}
% Reestablish the parskip
% this is executed in \every@everypar
%
\def\controlled@parskip
{\if@parskipsaved \@parskipsavedno
\parskip\@restoreparskip
\fi}
\def\noparskip{\parskip\z@ \@restoreparskip\z@}
%%%%%%%%%%%%%%%% Every Paragraph
% \everypar is supposed to contain \every@everypar
% as its first element.
%
\newtoks\EveryParagraph
\def\every@everypar{\controlled@indentation \controlled@parskip
\one@shot@coms \@headedno}
\def\default@everypar{\everypar={\every@everypar\the\EveryParagraph}}
\add@start@command{\default@everypar}
\everypar{\Emessage{You forgot to give the \nxp\Start\@space command.}}
% Execute once
%
\newtoks\one@shot@toks
\def\one@shot@coms{\temptoksa\one@shot@toks
\global\one@shot@toks={}\the\temptoksa\temptoksa{}}
\def\next@paragraph#1{\append@to@list{one@shot@toks}{#1}}
%%%%%%%%%%%%%%%% Every Math
% just like \everypar.
%
\newtoks\EveryMath
\newtoks\EveryDisplay
\newtoks\every@everymath \newcount\high@fam
\every@everymath{\high@fam\count18\relax
%\MainFace
\xp\math@setsize\style@sizes}
\everymath{\the\every@everymath\the\EveryMath}
\everydisplay{\the\every@everymath\the\EveryDisplay}
% Flush margins
%
\Distance:rightmarginstretch={0pt plus 6cm}
\Distance:leftmarginstretch={0pt plus 6cm}
\def\FlushLeft:#1 {\switch {\if\EqualString{#1}}
{yes} {\leftskip=1\leftskip}
{default} {\leftskip=1\leftskip
\advance\leftskip\leftmarginstretch}
\endswitch \relax}
\FlushLeft:yes
\def\FlushRight:#1 {\switch {\if\EqualString{#1}}
{yes} {\rightskip=1\rightskip}
{default} {\rightskip=1\rightskip
\advance\rightskip\rightmarginstretch}
\endswitch \relax}
\FlushRight:yes
%%%%%%% lijn
% #1 : hoogte; #2 : lengte; #3 : elevatie
% parameters kunnen van achter af aan weggelaten worden;
% #4 is dummy, kan niet door de gebruiker gespecificeerd worden.
% NNNNNNNNNBBBBBBBBBBBBB: #2 werkt nog niet!!!!!!!!!!!!
\newtoks\@lijntoks
\@lijntoks={}
% Lijn. Hier moet ik nog eens naar kijken.
\@GenericOption{lijn}{
\edef\cs@e{\nxp\lijnanalyse:#1:\@restarg::::;}\cs@e
\edef\cs@e{\nxp\@add@toks{\nxp\leavevmode\the\@lijntoks}}
\cs@e}
\def\lijnanalyse:#1:#2:#3:#4;{\@lijntoks={}
\eqstring{#1}{}{}{\achteraanlijst{@lijntoks}{height #1 }}
\eqstring{#2}{}{\vooraanlijst{@lijntoks}{\leaders\hrule depth 0cm }
\achteraanlijst{@lijntoks}{\hfill}}%
{\eqstring{#2}{uitvullen}%
{\vooraanlijst{@lijntoks}{\leaders\hrule depth 0cm }
\achteraanlijst{@lijntoks}{\hfill}}%
{\achteraanlijst{@lijntoks}{width \w@w{#2} }%
\vooraanlijst{@lijntoks}{\vrule depth 0cm }}
% \eqstring{#3}{}{}{\vooraanlijst{@lijntoks}{\raise #3\hbox\bgroup}
% \achteraanlijst{@lijntoks}{\egroup}}
}
\achteraanlijst{@lijntoks}{\hbox{}} % \par doet \unskip!!!
}
%%%%%%%%%%%%%%%%%%%%%%%%%%% accenten
\gdef\allowhyphens{\penalty\@M \hskip\z@\relax}
%{\catcode`\"=12 \gdef\hex{"}}
%\catcode`\"=13
%\def "#1{\ifx#1i\discretionary{-}{i}{{\accent'177 \i}}%
\def\"#1{\ifx#1i\discretionary{-}{i}{{\accent'177 \i}}%
\else\ifx#1-\allowhyphens-\penalty\z@\allowhyphens
\else\ifx#1"\hskip\z@\relax
% \else\ifx#1!\hex
\else\ifx#1!"
\else\ifx#1|\allowhyphens
\else {\accent'177 #1}\fi\fi\fi\fi\fi}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%% C A S E
%%
\def\UpperCase#1{\edef\cs@a{\uppercase{#1}}\cs@a}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%% L E T T E R S P A C I N G
%%
\def\LetterSpace
{\ifnextchar[\@LetterSpace %] <- to fool emacs
{\@LetterSpace[0ptplus1fil]}}
\def\@LetterSpace[#1]#2{\def\@LS{\hskip#1\relax}%
\edef\cs@e{#2}\xp\@@LS\cs@e&}
\def\@@LS#1#2&{#1\if\IsEmptyList{#2}\xp\take@one\else\@LS\xp\@@LS\fi#2&}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%% Interdictions
%%
\def\NoHyphenation{\hyphenpenalty\@M \exhyphenpenalty\@M}
\def\NoWidows{\widowpenalty\@M}
\def\NoOrphans{\clubpenalty\@M}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%% V E R B A T I M
%%
\def\setupverbatim{\let\do=\makeother \dospecials}
%% inline verbatim
\def\ver{\leavevmode\begingroup \setupverbatim \obeyspaces\tt \@ver}
\def\@ver#1{\def\@@ver##1#1{##1\endgroup}\@@ver}
%% display verbatim
{\activecr %
\gdef\vVer>{\setupverbatim \obeyspaces %
\tt \parindent\z@ \noparskip \obeylines %
\ifnextchar
\@@Ver\@Ver}\noeol %
\gdef\@Ver#1<Rev{#1\VerStop}%
\gdef\@@Ver
#1<Rev{#1\VerStop}}
%% verbatim files
\def\verbatimfile#1{\begingroup
\setupverbatim \obeyspaces \parindent\z@ \noparskip \obeylines %
\tt \input#1\relax
\endgroup}
\endinput
% 2014/04/13 defined \EveryParagraph, \EveryMath, and \EveryDisplay
% 2014/04/12 changed "#1 cs to \"#1 cs to be compatible with plain;
% also we can not make " active since it is used by xetex for font selection
% 92/11/08 white options created;
% breakpoint protection in white options
% 92/11/18 AdaptiveDistance implemented
% 92/11/20 \set@counter calls updated for \w@w use
% 92/12/14 default flush right
|