lang-mis.mkxl /size: 18 Kb    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=lang-mis,
3
%D version=1997.03.20, % used to be supp-lan.tex
4
%D title=\CONTEXT\ Language Macros,
5
%D subtitle=Compounds,
6
%D author=Hans Hagen,
7
%D date=\currentdate,
8
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9
%C
10
%C This module is part of the \CONTEXT\ macro||package and is
11
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12
%C details.
13 14
%D This one will be updated stepwise to \LMTX. See lang-mis.mkiv for previous
15
%D implementations and removed code.
16 17
\writestatus
{
loading
}{
ConTeXt
Language
Macros
/
Compounds
}
18 19
%D More or less replaced.
20 21
%D \gdef\starttest#1\stoptest{\starttabulate[|l|l|p|]#1\stoptabulate}
22
%D \gdef\test #1{\NC\detokenize{#1}\NC\hyphenatedword{#1}\NC#1\NC\NR}
23 24
\unprotect
25 26
%D One of \TEX's strong points in building paragraphs is the way hyphenations are
27
%D handled. Although for real good hyphenation of non||english languages some
28
%D extensions to the program are needed, fairly good results can be reached with the
29
%D standard mechanisms and an additional macro, at least in Dutch.
30
%D
31
%D \CONTEXT\ originates in the wish to typeset educational materials, especially in
32
%D a technical environment. In production oriented environments, a lot of compound
33
%D words are used. Because the Dutch language poses no limits on combining words, we
34
%D often favor putting dashes between those words, because it facilitates reading,
35
%D at least for those who are not that accustomed to it.
36
%D
37
%D In \TEX\ compound words, separated by a hyphen, are not hyphenated at all. In
38
%D spite of the multiple pass paragraph typesetting this can lead to parts of words
39
%D sticking into the margin. The solution lays in saying \type
40
%D {spoelwater||terugwinunit} instead of \type {spoelwater-terugwinunit}. By using a
41
%D one character command like \type {|}, delimited by the same character \type {|},
42
%D we get ourselves both a decent visualization (in \TEXEDIT\ and colored verbatim
43
%D we color these commands yellow) and an efficient way of combining words.
44
%D
45
%D The sequence \type{||} simply leads to two words connected by a hyphen. Because
46
%D we want to distinguish such a hyphen from the one inserted when \TEX\ hyphenates
47
%D a word, we use a bit longer one.
48
%D
49
%D \hyphenation {spoel-wa-ter te-rug-win-unit}
50
%D
51
%D \starttest
52
%D \test {spoelwater||terugwinunit}
53
%D \stoptest
54
%D
55
%D As we already said, the \type{|} is a command. This commands accepts an optional
56
%D argument before it's delimiter, which is also a \type{|}.
57
%D
58
%D \hyphenation {po-ly-meer che-mie}
59
%D
60
%D \starttest
61
%D \test {polymeer|*|chemie}
62
%D \stoptest
63
%D
64
%D Arguments like \type{*} are not interpreted and inserted directly, in contrary to
65
%D arguments like:
66
%D
67
%D \starttest
68
%D \test {polymeer|~|chemie}
69
%D \test {|(|polymeer|)|chemie}
70
%D \test {polymeer|(|chemie|)| }
71
%D \stoptest
72
%D
73
%D Although such situations seldom occur |<|we typeset thousands of pages before we
74
%D encountered one that forced us to enhance this mechanism|>| we also have to take
75
%D care of comma's.
76
%D
77
%D \hyphenation {uit-stel-len}
78
%D
79
%D \starttest
80
%D \test {op||, in|| en uitstellen}
81
%D \stoptest
82
%D
83
%D The next special case (concerning quotes) was brought to my attention by Piet
84
%D Tutelaers, one of the driving forces behind rebuilding hyphenation patterns for
85
%D the dutch language.\footnote{In 1996 the spelling of the dutch language has been
86
%D slightly reformed which made this topic actual again.} We'll also take care of
87
%D this case.
88
%D
89
%D \starttest
90
%D \test {AOW|'|er}
91
%D \test {cd|'|tje}
92
%D \test {ex|-|PTT|'|er}
93
%D \test {rock|-|'n|-|roller}
94
%D \stoptest
95
%D
96
%D Tobias Burnus pointed out that I should also support something like
97
%D
98
%D \starttest
99
%D \test {well|_|known}
100
%D \stoptest
101
%D
102
%D to stress the compoundness of hyphenated words.
103
%D
104
%D Of course we also have to take care of the special case:
105
%D
106
%D \starttest
107
%D \test {text||color and ||font}
108
%D \stoptest
109 110
%D \macros
111
%D {installdiscretionaries}
112
%D
113
%D The mechanism described here is one of the older inner parts of \CONTEXT. The
114
%D most recent extensions concerns some special cases as well as the possibility to
115
%D install other characters as delimiters. The prefered way of specifying compound
116
%D words is using \type{||}, which is installed by:
117
%D
118
%D \starttyping
119
%D \installdiscretionary | -
120
%D \stoptyping
121
%D
122
%D Some alternative definitions are:
123
%D
124
%D \startbuffer
125
%D \installdiscretionary * -
126
%D \installdiscretionary + -
127
%D \installdiscretionary / -
128
%D \installdiscretionary ~ -
129
%D \stopbuffer
130
%D
131
%D \typebuffer
132
%D
133
%D after which we can say:
134
%D
135
%D \start \getbuffer
136
%D \starttest
137
%D \test {test**test**test}
138
%D \test {test++test++test}
139
%D \test {test//test//test}
140
%D \test {test~~test~~test}
141
%D \stoptest
142
%D \stop
143 144
%D \macros
145
%D {compoundhyphen}
146
%D
147
%D Now let's go to the macros. First we define some variables. In the main \CONTEXT\
148
%D modules these can be tuned by a setup command. Watch the (maybe) better looking
149
%D compound hyphen.
150 151
% hm why ex
152 153
\ifx
\compoundhyphen
\undefined
154
\unexpanded
\def
\compoundhyphen
{
\hbox
{
-
\kern
-
.
1
0
7
7
5
\emwidth
-
}}
% .25\exheight
155
\fi
156 157
%D The last two variables are needed for subsentences |<|like this one|>| which we
158
%D did not yet mention. We want to enable breaking but at the same time don't want
159
%D compound characters like |-| or || to be separated from the words. \TEX\ hackers
160
%D will recognise the next two macro's:
161 162
\ifx
\prewordbreak
\undefined
\unexpanded
\def
\prewordbreak
{
\penalty
\plustenthousand
\hskip
\zeropoint
\relax
}
\fi
163
\ifx
\postwordbreak
\undefined
\unexpanded
\def
\postwordbreak
{
\penalty
\zerocount
\hskip
\zeropoint
\relax
}
\fi
164
\ifx
\hspaceamount
\undefined
\def
\hspaceamount
#
1
#
2
{
.
1
6
6
6
7
\emwidth
}
\fi
% language specific
165 166
%unexpanded\def\permithyphenation{\ifhmode\prewordbreak\fi} % doesn't remove spaces
167
\unexpanded
\def
\permithyphenation
{
\ifhmode
\wordboundary\fi
}
% doesn't remove spaces
168 169
%D \macros
170
%D {beginofsubsentence,endofsubsentence,
171
%D beginofsubsentencespacing,endofsubsentencespacing}
172
%D
173
%D In the previous macros we provided two hooks which can be used to support nested
174
%D sub||sentences. In \CONTEXT\ these hooks are used to insert a small space when
175
%D needed.
176 177
%D The following piece of code is a torture test compound handling. The \type
178
%D {\relax} before the \type {\ifmmode} is needed because of the alignment scanner
179
%D (in \ETEX\ this problem is not present because there a protected macro is not
180
%D expanded. Thanks to Tobias Burnus for providing this example.
181
%D
182
%D \startformula
183
%D \left|f(x_n)-{1\over2}\right| =
184
%D {\cases{|{1\over2}-x_n| &for $0\le x_n < {1\over2}$\cr
185
%D |x_n-{1\over2}| &for ${1\over2}<x_n\le1$ \cr}}
186
%D \stopformula
187 188
\installcorenamespace
{
discretionaryaction
}
189
\installcorenamespace
{
discretionarytext
}
190
\installcorenamespace
{
discretionarymath
}
191
\installcorenamespace
{
discretionaryboth
}
192
\installcorenamespace
{
discretionarymode
}
193 194
\unexpanded
\def
\installdiscretionary
#
1
#
2
%
195
{
\setevalue
{
\??discretionarymath
\detokenize
{
#
1
}}{
\detokenize
{
#
1
}}
% ?
196
\setvalue
{
\??discretionarytext
\detokenize
{
#
1
}}{
#
2
}
%
197
\setvalue
{
\??discretionaryboth
\detokenize
{
#
1
}}{
\lang_discretionaries_command
#
1
}
%
198
\scratchcounter
\expandafter
`
\detokenize
{
#
1
}
%
199
\expandafter
\uedcatcodecommand
\expandafter
\ctxcatcodes
\expandafter
\scratchcounter
\csname
\??discretionaryboth
\detokenize
{
#
1
}
\endcsname
}
200 201
\unexpanded
\def
\handlemathmodediscretionary
#
1
{
\ifcsname
\??discretionarymath
\detokenize
{
#
1
}
\endcsname\lastnamedcs
}
202
\unexpanded
\def
\handletextmodediscretionary
#
1
{
\ifcsname
\??discretionarytext
\detokenize
{
#
1
}
\endcsname\lastnamedcs
}
203 204
\unexpanded
\def
\installdiscretionaries
#
1
#
2
{
\writestatus
\m!system
{
use
\string
\installdiscretionary
}}
% obsolete
205 206
\setnewconstant
\discretionarymode
\plusone
207 208
\unexpanded
\def
\ignorediscretionaries
{
\discretionarymode
\zerocount
}
209
\unexpanded
\def
\obeydiscretionaries
{
\discretionarymode
\plusone
}
210 211
\def
\lang_discretionaries_command
212
{
% if direct if, we need \relax for lookahead in math mode
213
\csname
\??discretionarymode
214
\ifcase
\discretionarymode
215
n
%
216
\else\ifmmode
217
m
%
218
\else
219
t
%
220
\fi\fi
221
\endcsname
}
222 223
\setvalue
{
\??discretionarymode
n
}
#
1
%
224
{
\detokenize
{
#
1
}}
225 226
%D The macro \type{\lang_discretionaries_check_before} takes care of loners like
227
%D \type{||word}, while it counterpart \type {\lang_discretionaries_check_after} is
228
%D responsible for handling the comma.
229 230
\newsignal
\compoundbreakpoint
231 232
\newconditional
\punctafterdiscretionary
233
\newconditional
\spaceafterdiscretionary
234 235
\def
\lang_discretionaries_check_before
%i sused grouped
236
{
\ifvmode
237
\dontleavehmode
238
\fi
239
\ifhmode
240
%\begingroup
241
%\setbox\scratchbox\lastbox
242
%\ifzeropt\wd\scratchbox
243
% \box\scratchbox\relax
244
% \endgroup
245
% \let\postwordbreak\prewordbreak
246
%\else
247
% \box\scratchbox\relax
248
% \endgroup
249
%\fi
250
\fi
}
251 252
\def
\lang_discretionaries_check_after
253
{
\setfalse
\punctafterdiscretionary
254
\setfalse
\spaceafterdiscretionary
255
\ifx
\blankspace
\nextnext
\settrue
\spaceafterdiscretionary
\orelse
256
\ifx
\space
\nextnext
\settrue
\spaceafterdiscretionary
\orelse
257
\ifx
.
\nextnext
\settrue
\punctafterdiscretionary
\orelse
258
\ifx
,
\nextnext
\settrue
\punctafterdiscretionary
\orelse
259
\ifx
:
\nextnext
\settrue
\punctafterdiscretionary
\orelse
260
\ifx
;
\nextnext
\settrue
\punctafterdiscretionary
\fi
}
261 262
\letvalue
{
\??discretionarymode
m
}
\handlemathmodediscretionary
263 264
\setvalue
{
\??discretionarymode
t
}
#
1
%
265
{
\bgroup
266
\let
\nextnextnext
\egroup
267
\def
\next
##
1
#
1
%
268
{
\def
\next
{
\activedododotextmodediscretionary
#
1
{
##
1
}}
%
269
\futurelet
\nextnext
\next
}
%
270
\next
}
271 272
\let
\discretionarytoken
\relax
273
\let
\textmodediscretionary
\relax
274 275
\unexpanded
\def
\activedododotextmodediscretionary
#
1
#
2
%
276
{
\edef
\discretionarytoken
{
\detokenize
{
#
2
}}
%
277
\def
\textmodediscretionary
{
\handletextmodediscretionary
{
#
1
}}
%
278
\lang_discretionaries_check_after
279
\ifx
\discretionarytoken
\empty
280
\ifx
#
1
\nextnext
% takes care of ||| and +++ and ......
281
\ifcsname
\??discretionaryaction
\string
#
1
\endcsname
282
\lastnamedcs
283
\orelse
\ifconditional
\spaceafterdiscretionary
284
%\prewordbreak\hbox{\string#1}\relax
285
\wordboundary\hbox
{
\string
#
1
}
\relax
286
\orelse
\ifconditional
\punctafterdiscretionary
287
%\prewordbreak\hbox{\string#1}\relax
288
\wordboundary\hbox
{
\string
#
1
}
\wordboundary
289
\else
290
%\prewordbreak\hbox{\string#1}\prewordbreak
291
\wordboundary\hbox
{
\string
#
1
}
\wordboundary
292
\fi
293
\def
\nextnextnext
{
\afterassignment
\egroup
\let
\next
=
}
%
294
\else
295
\lang_discretionaries_check_before
296
% the next line has been changed (20050203)
297
% \prewordbreak\hbox{\textmodediscretionary\nextnext}\postwordbreak
298
% but an hbox blocks a possible \discretionary
299
\ifcsname
\??discretionaryaction
\endcsname
300
\lastnamedcs
301
\orelse
\ifconditional
\spaceafterdiscretionary
302
%\prewordbreak\textmodediscretionary\relax
303
\wordboundary
\textmodediscretionary
\relax
304
\orelse
\ifconditional
\punctafterdiscretionary
305
%\prewordbreak\textmodediscretionary\relax
306
\wordboundary
\textmodediscretionary
\relax
307
\else
308
%\prewordbreak\textmodediscretionary\prewordbreak
309
\wordboundary
\textmodediscretionary
\wordboundary
310
\fi
311
\fi
312
\orelse\ifcsname
\??discretionaryaction
\discretionarytoken
\endcsname
313
\lastnamedcs
314
\else
315
\lang_discretionaries_check_before
316
\ifconditional
\spaceafterdiscretionary
317
%\prewordbreak\hbox{#2}\relax
318
\wordboundary\hbox
{
#
2
}
\relax
319
\orelse
\ifconditional
\punctafterdiscretionary
320
%\prewordbreak\hbox{#2}\relax
321
\wordboundary\hbox
{
#
2
}
\relax
322
\else
323
%\prewordbreak\discretionary{\hbox{#2}}{}{\hbox{#2}}\postwordbreak
324
\wordboundary\discretionary
{
\hbox
{
#
2
}}{}{
\hbox
{
#
2
}}
\wordboundary
325
\fi
326
\fi
327
\nextnextnext
}
328 329
%D \macros
330
%D {directdiscretionary}
331
%D
332
%D In those situations where the nature of characters is less predictable, we can
333
%D use the more direct approach:
334 335
\unexpanded
\def
\directdiscretionary
336
{
\csname
\??discretionarymode
337
\ifcase
\discretionarymode
338
n
%
339
\else
340
d
%
341
\fi
342
\endcsname
}
343 344
\unexpanded
\def
\indirectdiscretionary
345
{
\csname
\??discretionarymode
346
\ifcase
\discretionarymode
347
n
%
348
\else
349
i
%
350
\fi
351
\endcsname
}
352 353
\setuvalue
{
\??discretionarymode
d
}
#
1
%
354
{
\edef
\discretionarytoken
{
\detokenize
{
#
1
}}
%
355
\let
\textmodediscretionary
\compoundhyphen
356
\ifcsname
\??discretionaryaction
\discretionarytoken
\endcsname
357
\expandafter\lastnamedcs
358
\else
359
\expandafter
\indirectdiscretionary
360
\fi
{
#
1
}}
361 362
\setuvalue
{
\??discretionarymode
i
}
#
1
%
363
%{\prewordbreak\discretionary{\hbox{#1}}{}{\hbox{#1}}\postwordbreak}
364
{
\wordboundary\discretionary
{
\hbox
{
#
1
}}{}{
\hbox
{
#
1
}}
\wordboundary
}
365 366
\unexpanded
\def
\definetextmodediscretionary
#
1
367
{
\setvalue
{
\??discretionaryaction
\detokenize
{
#
1
}}}
368 369
% \start \hsize 1mm
370
% test |||test test|||, test\blank
371
% test test|-|, test|-| and test|-|test\blank
372
% test test|_|, test|_| and test|_|test\blank
373
% test cd|'|tje\blank
374
% test |(|test test|)|, test\blank
375
% test test test|x|, test\blank
376
% test|~|test
377
% test|^|test
378
% \stop
379 380
% x\discretionary{1}{2}{3}xxxxxxx
381
% xxxxxxx\discretionary{1}{2}{3}x
382
%
383
% xxx3xxx
384
% xxx1<newline>2xxx
385 386
\def
\lang_discretionaries_hyphen_like
#
1
#
2
%
387
{
\ifconditional
\spaceafterdiscretionary
388
%prewordbreak\hbox{#1}\relax
389
\wordboundary\hbox
{
#
1
}
\relax
390
\else
\ifconditional
\punctafterdiscretionary
391
%prewordbreak\hbox{#1}\relax
392
\wordboundary\hbox
{
#
1
}
\relax
393
\else
394
%\prewordbreak#2\postwordbreak % was prewordbreak
395
\wordboundary
#
2
\wordboundary
396
\fi\fi
}
397 398
\definetextmodediscretionary
{}
399
{
\lang_discretionaries_hyphen_like
\textmodehyphen
\textmodehyphendiscretionary
}
400 401
\definetextmodediscretionary
-
402
{
\lang_discretionaries_hyphen_like
\normalhyphen
\normalhyphendiscretionary
}
403 404
\definetextmodediscretionary
_
405
{
\lang_discretionaries_hyphen_like
\composedhyphen
\composedhyphendiscretionary
}
406 407
\definetextmodediscretionary
)
408
{
\lang_discretionaries_hyphen_like
{
)
}{
\discretionary
{
-
)
}{}{
)
}}}
409 410
\definetextmodediscretionary
(
411
{
\ifdim
\lastskip
>
\zeropoint
412
%(\prewordbreak
413
(
\wordboundary
414
\else
415
%\prewordbreak\discretionary{}{(-}{(}\prewordbreak
416
\wordboundary\discretionary
{}{
(
-
}{
(
}
\wordboundary
417
\fi
}
418 419
\definetextmodediscretionary
~
420
%{\prewordbreak\discretionary{-}{}{\thinspace}\postwordbreak}
421
{
\wordboundary\discretionary
{
-
}{}{
\thinspace
}
\wordboundary
}
422 423
\definetextmodediscretionary
'
424
%{\prewordbreak\discretionary{-}{}{'}\postwordbreak}
425
{
\wordboundary\discretionary
{
-
}{}{
'
}
\wordboundary
}
426 427
\definetextmodediscretionary
^
428
%{\prewordbreak\discretionary{\hbox{\normalstartimath|\normalstopimath}}{}{\hbox{\normalstartimath|\normalstopimath}}%
429
% \postwordbreak} % bugged
430
{
\wordboundary\discretionary
{
\hbox
{
\normalstartimath
|
\normalstopimath
}}{}{
\hbox
{
\normalstartimath
|
\normalstopimath
}}
%
431
\wordboundary
}
% bugged
432 433
\definetextmodediscretionary
<
434
%{\beginofsubsentence\prewordbreak\beginofsubsentencespacing
435
{
\beginofsubsentence
\wordboundary
\beginofsubsentencespacing
436
\aftergroup\ignorespaces
}
% tricky, we need to go over the \nextnextnext
437 438
\definetextmodediscretionary
>
439
{
\removeunwantedspaces
440
%\endofsubsentencespacing\prewordbreak\endofsubsentence}
441
\endofsubsentencespacing
\wordboundary
\endofsubsentence
}
442 443
\definetextmodediscretionary
=
444
{
\removeunwantedspaces
445
%\prewordbreak\midsentence\prewordbreak
446
\wordboundary
\midsentence
\wordboundary
447
\aftergroup\ignorespaces
}
448 449
% french
450 451
%definetextmodediscretionary : {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{:}:}
452
%definetextmodediscretionary ; {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{;};}
453
%definetextmodediscretionary ? {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{?}?}
454
%definetextmodediscretionary ! {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{!}!}
455 456
\definetextmodediscretionary
:
{
\removeunwantedspaces
\wordboundary\kern
\hspaceamount
\empty
{
:
}
:
}
457
\definetextmodediscretionary
;
{
\removeunwantedspaces
\wordboundary\kern
\hspaceamount
\empty
{
;
}
;
}
458
\definetextmodediscretionary
?
{
\removeunwantedspaces
\wordboundary\kern
\hspaceamount
\empty
{
?
}
?
}
459
\definetextmodediscretionary
!
{
\removeunwantedspaces
\wordboundary\kern
\hspaceamount
\empty
{
!
}
!
}
460 461
%definetextmodediscretionary * {\prewordbreak\discretionary{-}{}{\kern.05\emwidth}\prewordbreak}
462
\definetextmodediscretionary
*
{
\wordboundary\discretionary
{
-
}{}{
\kern
.
0
5
\emwidth
}
\wordboundary
}
463 464
% spanish
465 466
%definetextmodediscretionary ?? {\prewordbreak\questiondown}
467
%definetextmodediscretionary !! {\prewordbreak\exclamdown}
468 469
\definetextmodediscretionary
?
?
{
\wordboundary
\questiondown
}
470
\definetextmodediscretionary
!
!
{
\wordboundary
\exclamdown
}
471 472
%D \installdiscretionary | +
473
%D \installdiscretionary + =
474 475
\def
\defaultdiscretionaryhyphen
{
\compoundhyphen
}
476 477
\installdiscretionary
|
\defaultdiscretionaryhyphen
% installs in ctx and prt will fall back on it
478 479
%D \macros
480
%D {fakecompoundhyphen}
481
%D
482
%D In headers and footers as well as in active pieces of text we need a dirty hack.
483
%D Try to imagine what is needed to savely break the next text across a line and at
484
%D the same time make the words interactive.
485
%D
486
%D \starttyping
487
%D \goto{Some||Long||Word}
488
%D \stoptyping
489 490
\unexpanded
\def
\fakecompoundhyphen
491
{
\def
\|
{
\mathortext
\vert
\lang_compounds_fake_hyphen
}}
492 493
\def
\lang_compounds_fake_hyphen
494
{
\def
##
1
|%
495
{
\doifelsenothing
{
##
1
}
\compoundhyphen
{
##
1
}
%
496
\kern
\compoundbreakpoint
\allowbreak
}}
497 498
%D \macros
499
%D {midworddiscretionary}
500
%D
501
%D If needed, one can add a discretionary hyphen using \type
502
%D {\midworddiscretionary}. This macro does the same as \PLAIN\ \TEX's \type {\-},
503
%D but, like the ones implemented earlier, this one also looks ahead for spaces and
504
%D grouping tokens.
505 506
\unexpanded
\def
\midworddiscretionary
507
{
\futurelet
\nexttoken
\lang_discretionaries_mid_word
}
508 509
\def
\lang_discretionaries_mid_word
510
{
\ifx
\nexttoken
\blankspace
\orelse
511
\ifx
\nexttoken
\bgroup
\orelse
512
\ifx
\nexttoken
\egroup
\orelse
513
\discretionary
{
-
}{}{}
%
514
\fi
}
515 516
\let
\ignorecompoundcharacter
\relax
517 518
%D \macros
519
%D {disablediscretionaries,disablecompoundcharacter}
520
%D
521
%D Occasionally we need to disable this mechanism. For the moment we assume that
522
%D \type {|} is used.
523 524
\let
\disablediscretionaries
\ignorediscretionaries
525
\let
\disablecompoundcharacters
\ignorecompoundcharacter
526 527
%D \macros
528
%D {normalcompound}
529
%D
530
%D Handy in for instance XML. (Kind of obsolete)
531 532
\ifdefined
\normalcompound
\else
\let
\normalcompound
=
|
\fi
533 534
%D \macros
535
%D {compound}
536
%D
537
%D We will overload the already active \type {|} so we have to save its meaning in
538
%D order to be able to use this handy macro.
539
%D
540
%D \starttyping
541
%D so test\compound{}test can be used instead of test||test
542
%D \stoptyping
543 544
\bgroup
545 546
\catcode
\barasciicode\activecatcode
547 548
\unexpanded
\gdef
\compound
#
1
{
|
#
1
|
}
549 550
\doglobal
\appendtoks
551
\def
|
#
1
|
{
\ifx
#
1
\empty\empty
-
\else
#
1
\fi
}
%
552
\to
\everysimplifycommands
553 554
\egroup
555 556
%D Here we hook some code into the clean up mechanism needed for verbatim data.
557 558
\appendtoks
559
%\disablecompoundcharacters
560
\disablediscretionaries
561
\to
\everycleanupfeatures
562 563
\protect
\endinput
564