-
-
Notifications
You must be signed in to change notification settings - Fork 249
/
ltoutenc.dtx
4239 lines (4231 loc) · 164 KB
/
ltoutenc.dtx
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
% \iffalse meta-comment
%
% Copyright 1993-2018
% The LaTeX3 Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
% -------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
% https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This file has the LPPL maintenance status "maintained".
%
% The list of all files belonging to the LaTeX base distribution is
% given in the file `manifest.txt'. See also `legal.txt' for additional
% information.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
%
% \fi
% \iffalse
%%% From File: ltoutenc.dtx
%\NeedsTeXFormat{LaTeX2e}[2000/06/01]
%<OT1>\ProvidesFile{ot1enc.def}
%<T1>\ProvidesFile{t1enc.def}
%<OMS>\ProvidesFile{omsenc.def}
%<OML>\ProvidesFile{omlenc.def}
%<OT4>\ProvidesFile{ot4enc.def}
%<TS1>\ProvidesFile{ts1enc.def}[2001/06/05 v3.0e (jk/car/fm)
%<TU>\ProvidesFile{tuenc.def}
%<package>\ProvidesPackage{fontenc}
%<TS1sty>\ProvidesPackage{textcomp}
%<OT1|T1|OMS|OML|OT4|TU|package|TS1sty> [2018/08/11 v2.0j
%<OT1|T1|OMS|OML|OT4|TS1|TU> Standard LaTeX file]
%<package|TS1sty> Standard LaTeX package]
%
%<*driver>
% \fi
\ProvidesFile{ltoutenc.dtx}
[2018/11/18 v2.0k LaTeX Kernel (font encodings)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltoutenc.dtx}
\title{\filename}
\date{\filedate}
\author{%
Johannes Braams\and
David Carlisle\and
Alan Jeffrey\and
Frank Mittelbach\and
Chris Rowley\and
Rainer Sch\"opf}
\usepackage{textcomp}
\begin{document}
\MaintainedByLaTeXTeam{latex}
\maketitle
\DocInput{\filename}
\end{document}
%</driver>
% \fi
%
%
%
% \changes{v1.99e}{2004/02/13}{Documentation fixes: typos}
% \changes{v1.9k}{1998/01/12}{Added \cs{ProvidesPackage}
% for textcomp.sty}
% \changes{v1.9i}{1997/12/19}{Documentation corrections.}
% \changes{v1.9h}{1997/12/17}{Documentation changes and additions.}
% \changes{v1.9h}{1997/12/17}{Added textcomp.sty.}
% \changes{v1.9f}{1997/08/29}{Added OT4 encoding,
% provided by Marcin Woli\'nski.}
% \changes{v1.7r}{1995/11/28}{doc fixes}
% \changes{v1.7h}{1995/04/21}{Added \cs{null} \cs{k} latex/1274}
% \changes{v1.7f}{1994/12/14}{Added braces to \cs{copyright} so it
% works unbraced in subscripts.}
% \changes{v1.7f}{1994/12/14}{Added check for math mode in
% \cs{@changed@cmd}.}
% \changes{v1.7f}{1994/12/14}{Commented out \cs{textasciicircum},
% \cs{textasciitilde}, \cs{textbackslash}, \cs{textbar},
% \cs{textgreater}, \cs{texthyphenchar}, \cs{texthyphen} and
% \cs{textless} to save memory.}
% \changes{v1.7e}{1994/12/10}{Added documentation for the OML encoding.}
% \changes{v1.7e}{1994/12/10}{Replaced width with \cs{@width} and
% ditto height in vrules.}
% \changes{v1.7d}{1994/12/08}{Added \cs{null} and \cs{sh@ft} to \cs{b}
% and \cs{d}.}
% \changes{v1.7c}{1994/12/05}{Added braces to \cs{textcircled}.}
% \changes{v1.7b}{1994/12/02}{Fixed a bug with \cs{a}.}
% \changes{v1.7a}{1994/11/30}{Added new code for encoding-specific
% commands. These now expand in the mouth, which means that
% ligaturing and kerning can happen.}
% \changes{v1.6i}{1994/11/22}{Fixed empty accents. Again.}
% \changes{v1.6i}{1994/11/22}{Corrected \cs{dots} so that there's no
% kerning in monowidth fonts.}
% \changes{v1.6i}{1994/11/22}{Corrected typo with
% \cs{mathunderscore}.}
% \changes{v1.6h}{1994/11/17}{(DPC) \cs{@tempa} to \cs{reserved@a}}
% \changes{v1.6d}{1994/11/02}{Wrapped lines longer than 70 characters.}
% \changes{v1.6d}{1994/10/30}{Added math commands.}
% \changes{v1.6d}{1994/10/30}{Added OML encoding.}
% \changes{v1.6d}{1994/10/30}{Added \cs{textcircled}.}
% \changes{v1.6d}{1994/10/30}{Added \cs{DeclareTextCompositeCommand}.}
% \changes{v1.6c}{1994/10/29}{Renamed \cs{P}, \cs{S}, \cs{dag} and
% \cs{ddag} to \cs{textparagraph}, \cs{textsection},
% \cs{textdagger} and \cs{textdaggerdbl}.}
% \changes{v1.6b}{1994/10/27}{Removed the enc.def files}
% \changes{v1.6a}{1994/10/25}{Added \cs{ProvideTextCommand},
% \cs{UseTextSymbol},
% \cs{UseTextAccent},
% \cs{DeclareTextSymbolDefault},
% \cs{DeclareTextAccentDefault},
% \cs{DeclareTextCommandDefault}, and
% \cs{ProvideTextCommandDefault}.}
% \changes{v1.5m}{1994/10/18}{Added new definitions of \cs{patterns}
% and \cs{hyphenation}.}
% \changes{v1.5l}{1994/10/07}{Moved the ogonek accent.}
% \changes{v1.5k}{1994/05/18}{Removed braces from \cs{pounds} and
% \cs{dollar}.}
% \changes{v1.5k}{1994/05/18}{Replaced \cs{defaultencoding} with
% \cs{encodingdefault}.}
% \changes{v1.5k}{1994/05/18}{Made dotted-i produce `i'.}
% \changes{v1.5j}{1994/05/17}{Added braces to \cs{pounds} so it works
% as a subscript.}
% \changes{v1.5i}{1994/05/16}{Fixed a bug with \cs{d}.}
% \changes{v1.5h}{1994/05/16}{Added \cs{NG}, \cs{ng}, \cs{TH},
% \cs{th}, \cs{DH}, \cs{dh}, \cs{DJ} and \cs{dj}.}
% \changes{v1.5h}{1994/05/16}{Added \cs{r} (ring accent) and \cs{k}
% (ogonek) accents.}
% \changes{v1.5h}{1994/05/16}{Removed \cs{P} from the OT1 definitions
% file.}
% \changes{v1.5h}{1994/05/16}{Fixed a bug with \cs{pounds}.}
% \changes{v1.5g}{1994/05/16}{Made fontenc.sty use the new mixed-case
% encoding files.}
% \changes{v1.5f}{1994/05/16}{Revert code so that the encoding
% given is used in \cs{DeclareTextCommand} (FMi)}
% \changes{v1.5f}{1994/05/16}{enc files now have uc encoding name
% parts (FMi)}
% \changes{v1.5e}{1994/05/14}{Replaced \cs{ENC@cmd} by \cs{ENC-cmd}.}
% \changes{v1.5d}{1994/05/14}{Rewrote \cs{DeclareTextCommand} to define
% its argument to use the current encoding by default, rather than
% the encoding provided to \cs{DeclareTextCommand}.}
% \changes{v1.5d}{1994/05/14}{Tidied up the documentation.}
% \changes{v1.5c}{1994/05/14}{Added the fontenc package.}
% \changes{v1.5c}{1994/05/14}{Fixed a bug which caused an infinite loop
% if \cs{f@encoding} was incorrectly set.}
% \changes{v1.5c}{1994/05/14}{Moved fontsmpl to its own dtx file.}
% \changes{v1.5b}{1994/05/13}{Added \cmd\{, \cmd\} and \cmd\$.}
% \changes{v1.5b}{1994/05/13}
% {Replaces \cs{space} by `~' in \cs{csname}.}
% \changes{v1.5b}{1994/05/13}{Renamed \cs{DeclareProtectedCommand} to
% \cs{DeclareRobustCommand}.}
% \changes{v1.5a}{1994/05/11}{Renamed the commands again. Made the
% encoding part of the command syntax. Added the
% \cs{DeclareTextCommand} interface. Used
% \cs{DeclareProtectedCommand}.}
% \changes{v1.4a}{1994/05/01}{Renamed the commands, removed the
% \cs{EncodingSpecific} command. Turned all slots into decimal.
% Added \cs{a}.}
% \changes{v1.4a}{1994/05/01}{Removed Rokicki's encoding.}
% \changes{v1.3d}{1993/12/18}{Some T1 stuff had drifted into the OT1
% file.}
% \changes{v1.3c}{1993/12/18}{A new syntax, separating
% accent-definitions from encoding-specific definitions, and
% allowing encoding-specific \cs{chardef}, \cs{let}, etc.}
% \changes{v1.3c}{1993/12/18}{Rewrote for the new syntax of
% \cs{EncodingSpecific}.}
% \changes{v1.3b}{1993/12/18}{Corrected typos.}
% \changes{v1.3b}{1993/12/18}{Replaced the missing last argument to
% \cs{DeclareFontEncoding}.}
% \changes{v1.3a}{1993/12/18}{Replaced OT3 by XXX}
% \changes{v1.3}{1993/12/17}{Added \cs{EncodingSpecificAccent},
% \cs{EncodingSpecificAccentedLetter} and
% \cs{EncodingSpecificCommand}.}
% \changes{v1.3}{1993/12/17}{Made Rokicki's encoding a proper encoding
% scheme rather than a variant of OT1.}
% \changes{v1.2b}{1993/12/13}{Corrected file name in driver code.}
% \changes{v1.2a}{1993/12/11}{Corrected for t1enc, math.}
% \changes{v1.2}{1993/12/10}{Added source code for t1enc.sty.}
% \changes{v1.1}{1993/12/07}{Made all character numbers decimal.}
% \changes{v1.1}{1993/12/07}{Removed a lot of equal signs and the
% like.}
% \changes{v1.99m}{2015/02/21}
% {Removed autoload code}
%
%
% \section{Font encodings}
%
% This section of the kernel contains commands for declaring
% encoding-specific
% commands, such as accents. It also contains the code for some of
% the encoding files, including |omlenc.def|,
% |omsenc.def|, |t1enc.def| and |ot1enc.def| files, which define
% the |OLM|,
% |OMS|, |T1| and |OT1| encodings, and the |fontenc| package
% for selecting encodings.
%
% The |fontenc| package has options for encodings, of which the
% last option is the default encoding. For example, to use the
% |OT2|, |OT3| and |T1| encodings, with |T1| as the default, you
% say:
%\begin{verbatim}
% \usepackage[OT2,OT3,T1]{fontenc}
%\end{verbatim}
% The standard kernel set-up loads font encoding files and selects
% an encoding as follows.
%\begin{verbatim}
% \input {omlenc.def}
% \input {t1enc.def}
% \input {ot1enc.def}
% \input {omsenc.def}
% \fontencoding{OT1}
%\end{verbatim}
% Note that the files in the standard |inputenc| package depend on
% this behaviour of the kernel.
%
% The syntax for declaring encoding-specific commands is:
% \begin{quote}
% |\DeclareTextCommand{|^^A
% \meta{command}|}{|^^A
% \meta{encoding}|}|\\\hspace*{\fill}|[|^^A
% \meta{number}|][|^^A
% \meta{default}|]{|^^A
% \meta{commands}|}|
% \end{quote}
% This command is like |\newcommand|, except that it defines a
% command which is specific to one encoding. The resulting command
% is always robust, even if its definition is fragile. For example,
% the definition of |\l| in the |OT1| encoding is:
%\begin{verbatim}
% \DeclareTextCommand{\l}{OT1}{{\@xxxii l}}
%\end{verbatim}
% |\DeclareTextCommand| takes the same optional arguments as
% |\newcommand|.
% \begin{quote}
% |\ProvideTextCommand{|^^A
% \meta{command}|}{|^^A
% \meta{encoding}|}|\\\hspace*{\fill}|[|^^A
% \meta{number}|][|^^A
% \meta{default}|]{|^^A
% \meta{commands}|}|
% \end{quote}
% This acts like |\DeclareTextCommand|, but does nothing if the
% command is already defined.
% \begin{quote}
% |\DeclareTextSymbol{|^^A
% \meta{command}|}{|^^A
% \meta{encoding}|}{|^^A
% \meta{slot}|}|
% \end{quote}
% This command defines a text symbol, with a particular slot in that
% encoding. The commands:
% \changes{v1.9h}{1997/12/17}{Example corrected, braces removed.}
%\begin{verbatim}
% \DeclareTextSymbol{\ss}{OT1}{25}
% \DeclareTextCommand{\ss}{OT1}{\char25 }
%\end{verbatim}
% have the same effect, but the |\DeclareTextSymbol| is faster.
% \begin{quote}
% |\DeclareTextAccent{|^^A
% \meta{command}|}{|^^A
% \meta{encoding}|}{|^^A
% \meta{slot}|}|
% \end{quote}
% \changes{v1.8e}{1996/11/23}{Corrected description}
% \changes{v1.9k}{1997/12/31}{Further correction}
% This command declares a text accent. The commands:
%\begin{verbatim}
% \DeclareTextAccent{\"}{OT1}{127}
% \DeclareTextCommand{\"}{OT1}{\add@accent {127}}
%\end{verbatim}
% have the same effect.
% \changes{v1.8c}{1996/10/27}
% {Corrected syntax descriptions}
% \begin{quote}
% |\DeclareTextComposite{|^^A
% \meta{command}|}|\\\hspace*{\fill}|{|^^A
% \meta{encoding}|}{|^^A
% \meta{argument}|}{|^^A
% \meta{slot}|}|
% \end{quote}
% This command declares a composite letter, for example in the |T1|
% encoding |\'{a}| is slot 225, which is declared by:
%\begin{verbatim}
% \DeclareTextComposite{\'}{T1}{a}{225}
%\end{verbatim}
% \changes{v1.8e}{1996/11/23}
% {Corrected description}
% The \emph{command} will normally have been declared with
% |\DeclareTextAccent|, or as a one-argument |\DeclareTextCommand|.
%
% |\DeclareTextComposite| is the most common example of using
% the more general declaration
% |\DeclareTextCompositeCommand|, which can define a composite
% to be an arbitrary piece of text.
% \begin{quote}
% |\DeclareTextCompositeCommand{|^^A
% \meta{command}|}|\\\hspace*{\fill}|{|^^A
% \meta{encoding}|}{|^^A
% \meta{argument}|}{|^^A
% \meta{text}|}|
% \end{quote}
% For example, in the OT1 encoding \r A has a hand-crafted
% definition this is declared as follows
%\begin{verbatim}
% \DeclareTextCompositeCommand{\r}{OT1}{A}
% {\leavevmode\setbox\z@\hbox{!}\dimen@\ht\z@\advance\dimen@-1ex%
% \rlap{\raise.67\dimen@\hbox{\char23}}A}
%\end{verbatim}
% \changes{v1.8e}{1996/11/23}
% {Corrected description}
% The \emph{command} will normally have been declared with
% |\DeclareTextAccent|, or as a one-argument |\DeclareTextCommand|.
%
% The commands defined using the above declarations can be used in
% two ways.
% Normally they are used by just calling the command in the
% appropriate encoding, for example |\ss|. However, sometimes you
% may wish to use a command in an encoding where it is not defined.
% If the command has no arguments, then you can use it in another
% encoding by calling |\UseTextSymbol|:
% \begin{quote}
% |\UseTextSymbol{|^^A
% \meta{encoding}|}{|^^A
% \meta{command}|}|
% \end{quote}
%
% \task{?}{Document the problems of these commands, see pr/3160}
% \changes{v1.9e}{1997/08/05}{Corrected order of arguments in
% \cs{UseTextSymbol} example.}
% For example, |\UseTextSymbol{OT1}{\ss}| has the same effect as:
%\begin{verbatim}
% {\fontencoding{OT1}\selectfont\ss}
%\end{verbatim}
% If the command has one argument then you can use it in another
% encoding by calling
% |\UseTextAccent|:
% \begin{quote}
% |\UseTextAccent{|^^A
% \meta{encoding}|}{|^^A
% \meta{command}|}{|^^A
% \meta{text}|}|
% \end{quote}
% For example, if the current encoding is |OT2| then
% |\UseTextAccent{OT1}{\'}{a}| has the same effect as:
%\begin{verbatim}
% {\fontencoding{OT1}\selectfont\'{\fontencoding{OT2}\selectfont a}}
%\end{verbatim}
% \changes{v1.8e}{1996/11/23}
% {Extended description}
% You can also declare a default definition for a text command, which
% will be used if the current encoding has no appropriate definition.
% Such use will also set the definition for this command in the
% current encoding to equal this default definition; this makes
% subsequent uses of the command much faster.
% \begin{quote}
% |\DeclareTextCommandDefault{|^^A
% \meta{command}|}{|^^A
% \meta{definition}|}|
% \end{quote}
% For example, the default definition of the command
% |\textonequarter| (which produces the fraction $\frac14$) could be
% built using math mode:
%\begin{verbatim}
% \DeclareTextCommandDefault{\textonequarter}{\ensuremath {\frac14}}
%\end{verbatim}
% There is a matching |\Provide| command which will not override an
% existing default definition:
% \begin{quote}
% |\ProvideTextCommandDefault{|^^A
% \meta{command}|}{|^^A
% \meta{definition}|}|
% \end{quote}
% The most common use for these commands is to use symbols from
% other encodings, so there are some optimizations provided:
% \begin{quote}
% |\DeclareTextSymbolDefault{|^^A
% \meta{command}|}|^^A
% \meta{encoding}|}|\\
% |\DeclareTextAccentDefault{|^^A
% \meta{command}|}|^^A
% \meta{encoding}|}|
% \end{quote}
% are short for:
% \begin{quote}
% |\DeclareTextCommandDefault{|^^A
% \meta{command}|}|\\\hspace*{\fill}^^A
% |{\UseTextSymbol{|^^A
% \meta{encoding}|}{|\meta{command}|}}| \\
% |\DeclareTextCommandDefault[1]{|^^A
% \meta{command}|}|\\\hspace*{\fill}^^A
% |{\UseTextAccent{|^^A
% \meta{encoding}|}{|\meta{command}|}{#1}}|
% \end{quote}
% For example, to make |OT1| the default encoding for |\ss| and
% |\'| you say:
%\begin{verbatim}
% \DeclareTextSymbolDefault{\ss}{OT1}
% \DeclareTextAccentDefault{\'}{OT1}
%\end{verbatim}
% Note that you can use these commands on any zero- or one-argument
% commands declared with |\DeclareText*| or |\ProvideText*|, not
% just those defined using |\DeclareTextSymbol| or
% |\DeclareTextAccent|.
%
% \subsection{Removing encoding-specific commands}
% \label{sec:removeencspec}
%
% \changes{v1.9o}{1998/03/20}{Documentation added for pr/2783}
%
% In some cases encoding definitions are given to provide some limited
% support since nothing better is available, for example, the definition
% for |\textdollar| in \texttt{OT1} is a hack since \$ and \pounds{}
% actually share the same slot in this encoding. Thus if such a glyph
% becomes available in a different encoding (e.g., \texttt{TS1}) one
% would like to get rid of the flacky one and make the default
% definition point to the new encoding. In such a case defining
%\begin{verbatim}
% \DeclareTextSymbol{\textdollar}{TS1}{36}
% \DeclareTextSymbolDefault{\textdollar}{TS1}
%\end{verbatim}
% is not enough since if typesetting in \texttt{OT1} \LaTeX{} will
% still find the encoding specific-definition for \texttt{OT1} and
% therefore ignore the new default.
% Therefore to ensure that in this case the \texttt{TS1} version is
% used we have to remove the \texttt{OT1} declaration:
%\begin{verbatim}
% \UndeclareTextCommand{\textdollar}{OT1}
%\end{verbatim}
%
% Since the \$ sign is a proper glyph in the \texttt{T1} encoding there
% is no point removing its definition and forcing \LaTeX{} to pick up
% the \texttt{TS1} version if typesetting in this encoding.
% However, assume you want to use the variant dollar sign,
% i.e., \textdollaroldstyle{}
% for your dollars. In that case you have to get rid of the \texttt{T1}
% declaration as well, e.g., the following would do that for you:
%\begin{verbatim}
% \UndeclareTextCommand{\textdollar}{OT1}
% \UndeclareTextCommand{\textdollar} {T1}
% \DeclareTextCommandDefault{\textdollar}
% {\UseTextSymbol{TS1}\textdollaroldstyle}
%\end{verbatim}
%
% \subsection{The order of declarations}\label{sec:orderofdecls}
%
% \changes{v1.9o}{1998/03/20}{Documentation added about order of decls}
%
% If an encoding-specific command is defined for more than one encoding,
% then it will execute fastest in the encoding in which it was defined
% last since its top-level definition will be set up to execute in that
% encoding without any overhead.
%
% For this reason the file \texttt{fonttext.ltx} currently first loads
% the definitions for the \texttt{T1} encoding and then those for the
% \texttt{OT1} encoding so that typesetting in \texttt{OT1} is optimized
% since that is (still) the default. However, when \texttt{T1} is
% explicitly requested (via |\usepackage[T1]{fontenc}|) the
% top-level definitions are automatically changed to favour
% \texttt{T1} since its declarations are reloaded in the process.
%
% For the same reason default declarations should never come last since
% they are implemented as a special encoding themselves (with the
% name |?|).
% Specifying them last would simply mean to make those encoding-specific
% commands equally inefficient in all encodings. Therefore the
% \texttt{textcomp} package, for example, first sets up all defaults
% to point to \texttt{TS1} and then declares the commands in the
% \texttt{TS1} encoding.
%
%
% \StopEventually{}
%
% \subsection{Docstrip modules}
%
% This |.dtx| file is be used to generate several related files
% containing font encoding definitions. The mutually exclusive
% docstrip options are listed here.
% \begin{center}
% \begin{tabular}{lp{10cm}}
% |T1| & generates |t1enc.def| for the Cork encoding. \\
% |TS1| & generates |ts1enc.def| for the Text Companion
% encoding. \\
% |TS1sty| & generates |textcomp.sty|, package that sets up use
% of the Text Companion encoding. \\
% |OT1| & generates |ot1enc.def| for Knuth's CM encoding. \\
% |OMS| & generates |omsenc.def| for Knuth's
% math symbol encoding. \\
% |OML| & generates |omlenc.def| for Knuth's
% math letters encoding. \\
% |OT4| & generates |ot4enc.def| for the Polish extension to
% the OT1 encoding, created by B.~Jackowski and
% M.~Ry\'cko for use with the Polish version of
% Computer Modern and Computer Concrete.\\
% |TU| & generates |tuenc.def| for Unicode font
% encoding. \\
% |package| & generates |fontenc.sty| for
% selecting encodings. \\
% |2ekernel| & for the kernel commands.\\
% \end{tabular}
% \end{center}
% \changes{1.0d}{1993/07/17}{changed \cs{catcoding} @}
% \changes{1.0f}{1993/08/13}{Protected against active @ sign.}
% \changes{1.0g}{1993/08/16}{Needs space after \cs{string}}
% \changes{1.1}{1993/12/07}{Protected all special characters with
% \cs{string}.}
% \changes{1.3}{1993/12/17}{Removed the catcode hackery, since the file
% is only read as a package in the preamble, and removed all the
% messages on the screen, which just confuse users. Replaced them
% by the appropriate \cs{ProvidesPackage} commands. Added XXXenc.}
% \changes{1.3b}{1993/12/18}
% {Fixed typos with \cs{ProvidesPackage} lines.
% Added the \cs{NeedsTeXFormat} line. Added the last argument to
% \cs{DeclareEncoding}. Moved the use of the encodings to after their
% declaration. }
% \changes{1.4a}{1994/04/29}{Removed Rokicki's OT1 variant encoding.
% Moved the driver to the top.}
% \changes{1.5a}{1994/05/11}{Made T1 and OT1 generate packages rather
% than def files. Renamed the `package' module to `teststy'.}
% \changes{1.5d}{1994/05/14}{Moved the driver to the top.}
%
% \subsection{Definitions for the kernel}
%
% \subsubsection{Declaration commands}
%
% \changes{1.3}{1993/12/17}{Added this section}
% \changes{1.3c}{1993/12/18}{Split \cs{EncodingSpecificAccent} up into
% \cs{EncodingSpecific} and \cs{DeclareAccent}.}
% \changes{1.4a}{1994/04/29}{Removed \cs{EncodingSpecific}. Renamed
% all the commands. Added \cs{DeclareTextGlyph} and
% \cs{UndeclareTextCommand}.}
% \changes{v1.5a}{1994/05/11}{Reimplemented \cs{DeclareTextCommand}
% using \cs{@changed@cmd} and \cs{DeclareProtectedCommand}.}
% \changes{v1.5c}{1994/05/14}{Fixed a bug which caused an infinite loop
% if \cs{f@encoding} was incorrectly set.}
% \changes{v1.5d}{1994/05/14}{Rewrote \cs{DeclareTextCommand} to define
% its argument to use the current encoding by default, rather than
% the encoding provided to \cs{DeclareTextCommand}.}
% \changes{v1.6a}{1994/10/25}{Added the \cs{Provide} commands,
% and the default definitions.}
%
% This section contains definitions for commands such as accents which
% depend on the current encoding. These commands will usually be kept
% in |.def| files, for example |ot1enc.def| contains the definitions
% for the |OT1| encoding.
% \begin{macrocode}
%<*2ekernel>
\message{font encodings,}
% \end{macrocode}
%
% \changes{v1.5d}{1994/10/27}{Rewrote \cs{DeclareTextSymbol} to define
% its argument to use the current encoding by default, to fit with
% \cs{DeclareTextCommand}.}
%
% \changes{v1.7a}{1994/11/30}{Redefined \cs{@changed@cmd} to expand in
% the mouth.}
% \changes{v1.7a}{1994/11/30}{Removed \cs{@changed@x@mouth} since
% \cs{@changed@x} now expands in the mouth.}
%
% \changes{v1.7r}{1995/11/28}{Renamed \cs{@changed@x@err} to
% \cs{TextSymbolUnavailable}.}
% \changes{v1.7r}{1995/11/28}{Added math mode checks to text commands.}
% Far too many macros in one block here!
% \begin{macro}{\DeclareTextCommand}
% \begin{macro}{\ProvideTextCommand}
% \begin{macro}{\DeclareTextSymbol}
% \begin{macro}{\@dec@text@cmd}
% \begin{macro}{\chardef@text@cmd}
% \begin{macro}{\@changed@cmd}
% \begin{macro}{\@changed@x}
% \begin{macro}{\TextSymbolUnavailable}
% \begin{macro}{\@inmathwarn}
% If you say:
%\begin{verbatim}
% \DeclareTextCommand{\foo}{T1}...
%\end{verbatim}
% then |\foo| is defined to be |\T1-cmd \foo \T1\foo|,
% where |\T1\foo| is \emph{one} control sequence, not two!
% We then call |\newcommand| to define |\T1\foo|.
% \begin{macrocode}
\def\DeclareTextCommand{%
\@dec@text@cmd\newcommand}
% \end{macrocode}
%
% \begin{macrocode}
\def\ProvideTextCommand{%
\@dec@text@cmd\providecommand}
% \end{macrocode}
%
% \begin{macrocode}
\def\@dec@text@cmd#1#2#3{%
\expandafter\def\expandafter#2%
\expandafter{%
\csname#3-cmd\expandafter\endcsname
\expandafter#2%
\csname#3\string#2\endcsname
}%
\let\@ifdefinable\@rc@ifdefinable
\expandafter#1\csname#3\string#2\endcsname}
% \end{macrocode}
% \changes{v1.99d}{2004/02/06}{New command added to fix
% severe bug: pr/3563}
% This command was introduced to fix a major bug
% in |\@dec@text@cmd| without changing that command itself.
% This was thought to be necessary because it is defined
% in more than one package. (Perhaps the more serious bug is to put
% complex low-level commands like this in packages?)
%
% The problem it solves is that whereas both |\newcommand| and
% |\providecommand| (used just above) both handle the
% resetting of |\@ifdefinable| (following its disabling in
% |\@dec@text@cmd|), the primitive |\chardef| neither needs the
% disabling, nor does the resetting.
%
% \begin{macrocode}
\def\chardef@text@cmd{%
\let\@ifdefinable\@@ifdefinable
\chardef
}
\def\DeclareTextSymbol#1#2#3{%
\@dec@text@cmd\chardef@text@cmd#1{#2}#3\relax
}
% \end{macrocode}
%
% The declarations are only available before |\begin{document}|.
% \changes{v1.7h}{1995/05/21}{Added several \cs{@onlypreamble}}
% \changes{v1.7k}{1995/06/05}{Removed \cs{protected@cmd} and replaced
% with explicit \cs{noexpand}.}
% \begin{macrocode}
\@onlypreamble\DeclareTextCommand
\@onlypreamble\DeclareTextSymbol
% \end{macrocode}
% The sneaky bit in all this is what |\T1-cmd \foo \T1\foo| does.
% There are five possibilities, depending on the current values of
% |\protect|, |\cf@encoding| and |\ifmmode|:
% \begin{itemize}
% \item If |\protect| is |\@typeset@protect| and |\cf@encoding| is
% |T1|, then we execute |\T1\foo|. This should be the normal
% behaviour, and is optimized for speed.
% \item If |\protect| is |\@typeset@protect|, |\cf@encoding| is
% (say) |OT1|, and |\OT1\foo| is defined, then we execute
% |\OT1\foo|.
% \item If |\protect| is |\@typeset@protect|, |\cf@encoding| is
% (say) |OT1|, we're in text mode,
% and |\OT1\foo| is undefined, then we define
% |\OT1\foo| to be the default value of |\foo|, and execute
% |\OT1\foo|.
% \item If |\protect| is |\@typeset@protect|, |\cf@encoding| is
% (say) |OT1|, we're in math mode,
% and |\OT1\foo| is undefined, then we execute the default value
% of |\foo|. (This is necessary so that things like
% |$X_\copyright$| work properly.)
% \item If |\protect| is not |\@typeset@protect| then we execute
% |\noexpand\foo|. For example, if we are writing to a file,
% then this results in |\foo| being written. If we are in a
% |\mark|, then |\foo| will be put in the mark---since |\foo| is
% robust, it will then survive all the things which may happen
% to it whilst it's a |\mark|.
% \end{itemize}
% So after all that, we will either execute the appropriate
% definition of |\foo| for the current encoding, or we will execute
% |\noexpand\foo|.
%
% The default value of |\foo| is |\?\foo| if it is defined, and an
% error message otherwise.
%
% When the encoding is changed from |T1| to |OT1|, |\T1-cmd| is
% defined to be |\@changed@cmd| and |\OT1-cmd| is defined to be
% |\@current@cmd|. This means that the test for what the current
% encoding is can be performed quickly.
% \begin{macrocode}
\def\@current@cmd#1{%
\ifx\protect\@typeset@protect
\@inmathwarn#1%
\else
\noexpand#1\expandafter\@gobble
\fi}
% \end{macrocode}
%
% \begin{macrocode}
\def\@changed@cmd#1#2{%
\ifx\protect\@typeset@protect
\@inmathwarn#1%
\expandafter\ifx\csname\cf@encoding\string#1\endcsname\relax
\expandafter\ifx\csname ?\string#1\endcsname\relax
\expandafter\def\csname ?\string#1\endcsname{%
\TextSymbolUnavailable#1%
}%
\fi
\global\expandafter\let
\csname\cf@encoding \string#1\expandafter\endcsname
\csname ?\string#1\endcsname
\fi
\csname\cf@encoding\string#1%
\expandafter\endcsname
\else
\noexpand#1%
\fi}
% \end{macrocode}
% \changes{v1.7m}{1995/10/09}{Autoload error}
% \changes{v1.7v}{1995/12/05}{Changed \cs{TextSymbolUnavailable} text}
% \begin{macrocode}
\gdef\TextSymbolUnavailable#1{%
\@latex@error{%
Command \protect#1 unavailable in encoding \cf@encoding%
}\@eha}
% \end{macrocode}
% The command |\@inmathwarn| produces a warning message if we are
% currently in math mode. Note that since this command is used
% inside text commands, it can't call |\relax| before the
% |\ifmmode|. This means that it is possible for the warning to
% fail to be issued at the beginning of a row of an halign whose
% template enters math mode. This is probably a bad feature, but
% there's not much that can be done about it, since adding a |\relax|
% would break ligatures and kerning between text symbols.
%
% A more efficient solution would be to make |\@inmathwarn| and
% |\@inmatherr| equal to |\@empty| and |\relax| by default, and
% to have
% |\everymath| reset them to their usual definitions. This is left
% for future investigation (for example it may break some third
% party code).
% \begin{macrocode}
\def\@inmathwarn#1{%
\ifmmode
\@latex@warning{Command \protect#1 invalid in math mode}%
\fi}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \changes{v1.7k}{1995/06/05}{Allowed \cs{ProvideTextCommandDefault}
% after the preamble.}
%
% \begin{macro}{\DeclareTextCommandDefault}
% \begin{macro}{\ProvideTextCommandDefault}
% These define commands with encoding |?|.
%
% Note that |\DeclareTextCommandDefault| can only be used in the
% preamble, but that the |\Provide| version is allowed in inputenc
% |.def| files, so is allowed anywhere.
% \begin{macrocode}
\def\DeclareTextCommandDefault#1{%
\DeclareTextCommand#1?}
% \end{macrocode}
%
% \begin{macrocode}
\def\ProvideTextCommandDefault#1{%
\ProvideTextCommand#1?}
% \end{macrocode}
%
% \begin{macrocode}
\@onlypreamble\DeclareTextCommandDefault
%\@onlypreamble\ProvideTextCommandDefault
% \end{macrocode}
% They require |\?-cmd| to be initialized as |\@changed@cmd|.
% \begin{macrocode}
\expandafter\let\csname?-cmd\endcsname\@changed@cmd
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DeclareTextAccent}
% \changes{v1.5a}{1994/05/11}
% {Reimplemented using \cs{DeclareTextCommand}.}
% \changes{v1.7z}{1996/05/23}
% {Reimplemented using \cs{add@accent} to save space latex/2133}
% This is just a disguise for defining a \TeX~|\accent| command.
% \begin{macrocode}
\def\DeclareTextAccent#1#2#3{%
\DeclareTextCommand#1{#2}{\add@accent{#3}}}
% \end{macrocode}
%
% \begin{macrocode}
\@onlypreamble\DeclareTextAccent
% \end{macrocode}
% \end{macro}
%
% \changes{v1.7a}{1994/11/30}{Rewrote \cs{@text@composite} so it
% allows an empty argument, or an argument containing lots of
% commands.}
%
% \begin{macro}{\add@accent}
% \changes{v1.7z}{1996/05/23}{macro added. latex/2133}
% \changes{v1.91}{2000/08/30}{Rearranged but no change to final code,
% CAR (pr/3160)}
% To save space this code is shared between all text accents that are
% set using the |\accent| primitive.
% The argument is pre-set in a box so that any
% font loading that is needed is already done within the box.
% This is needed because font-loading involves grouping and that would
% prevent the accent mechanism from working so that the accent would
% not be positioned over the argument.
% Declarations that change the font should be allowed (only low-level
% ones are at present) inside the argument of an accent command,
% but not size changes, as they involve |\setbox| operations which
% also inhibit the mechanism of the |\accent| primitive.
%
% Note that the whole process is within a group.
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
% (pr/3160)}
% For a detailed discussion of this reimplementation and its
% deficiencies, see pr/3160.
% \task{?}{Improve this and document its problems, see pr/3160}
% \changes{v1.9z}{2000/01/30}{Macro reimplemented (pr/3160)}
% \begin{macrocode}
\def\add@accent#1#2{\hmode@bgroup
% \end{macrocode}
% Turn off the group in |\UseTextSymbol| in case this is used
% inside the argument of |\add@accent|.
% \begin{macrocode}
\let\hmode@start@before@group\@firstofone
\setbox\@tempboxa\hbox{#2%
% \end{macrocode}
% When presetting the argument in a box we record its |\spacefactor|
% for later use after the accent got typeset. This way something like
% |\`A| gets the spacefactor of |A| (i.e., 999) rather than the
% default value of 1000.
% \changes{v1.9q}{1998/06/12}
% {Explicitly set \cs{spacefactor} after \cs{accent} (pr/2877)}
% \begin{macrocode}
\global\mathchardef\accent@spacefactor\spacefactor}%
\accent#1 #2\egroup\spacefactor\accent@spacefactor}
% \end{macrocode}
% Default definition for |\accent@spacefactor| prevents a horrible
% death of the above macro inside an unprotected |\edef|.
% \changes{v1.9w}{1999/10/28}{Give \cs{accent@spacefactor} a default
% definition (pr/3084)}
% \begin{macrocode}
\let\accent@spacefactor\relax
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\hmode@bgroup}
% \changes{v1.9y}{2000/01/30}{Macro added}
% \begin{macrocode}
\def\hmode@bgroup{\leavevmode\bgroup}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\DeclareTextCompositeCommand}
% \changes{v1.7z}{1996/05/23}
% {Modified to cope with new \cs{add@accent} command: required
% removal of check for one argument-command}
% \changes{v2.0h}{2017/02/24}{%
% add check whether the accent command is defined for this encoding}
% \changes{v2.0i}{2017/04/05}{%
% Declare accent command if not already declared when declaring a composite.}
% \begin{macro}{\DeclareTextComposite}
% \changes{v1.7l}{1995/06/09}{Rewrote \cs{DeclareTextComposite} to
% define the composite as a no-argument command rather than a
% two-argument command.}
% \begin{macro}{\@text@composite}
% \begin{macro}{\@text@composite@x}
% \begin{macro}{\@strip@args}
% \changes{v1.8c}{1996/10/27}
% {Removed macro}
% Another amusing game to play with |\expandafter|, |\csname|, and
% |\string|. When you say
% |\DeclareTextCompositeCommand{\foo}{T1}{a}{bar}|, we look to see
% if the expansion of |\T1\foo| begins with |\@text@composite|, and
% if it doesn't, we redefine |\T1\foo| to be:
%\begin{verbatim}
% #1 -> \@text@composite \T1\foo #1\@empty \@text@composite {...}
%\end{verbatim}
% where |...| is the
% previous definition of |\T1\foo|. Finally, we define |\\T1\foo-a|
% to expand to |bar|.
% \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2017/04/15}{\DeclareTextCompositeCommand}
%<latexrelease> {test for undeclared accent}%
%<*2ekernel|latexrelease>
\def\DeclareTextCompositeCommand#1#2#3#4{%
\expandafter\let\expandafter\reserved@a\csname#2\string#1\endcsname
\ifx\reserved@a\relax
\DeclareTextCommand#1{#2}{%
\@latex@error{\string#1 undeclared in encoding #2}\@eha}%
\@latex@info{Composite with undeclared \string#1 in encoding #2}%
\expandafter\let\expandafter\reserved@a\csname#2\string#1\endcsname
\fi
\expandafter\expandafter\expandafter\ifx
\expandafter\@car\reserved@a\relax\relax\@nil \@text@composite \else
\edef\reserved@b##1{%
\def\expandafter\noexpand
\csname#2\string#1\endcsname####1{%
\noexpand\@text@composite
\expandafter\noexpand\csname#2\string#1\endcsname
####1\noexpand\@empty\noexpand\@text@composite
{##1}}}%
\expandafter\reserved@b\expandafter{\reserved@a{##1}}%
\fi
\expandafter\def\csname\expandafter\string\csname
#2\endcsname\string#1-\string#3\@empty\endcsname{#4}%
}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}{\DeclareTextCompositeCommand}
%<latexrelease> {test for undeclared accent}%
%<latexrelease>\def\DeclareTextCompositeCommand#1#2#3#4{%
%<latexrelease> \expandafter\let\expandafter\reserved@a
%<latexrelease> \csname#2\string#1\endcsname
%<latexrelease> \expandafter\expandafter\expandafter\ifx
%<latexrelease> \expandafter\@car\reserved@a\relax\relax\@nil
%<latexrelease> \@text@composite \else
%<latexrelease> \edef\reserved@b##1{%
%<latexrelease> \def\expandafter\noexpand
%<latexrelease> \csname#2\string#1\endcsname####1{%
%<latexrelease> \noexpand\@text@composite
%<latexrelease> \expandafter\noexpand\csname#2\string#1\endcsname
%<latexrelease> ####1\noexpand\@empty\noexpand\@text@composite
%<latexrelease> {##1}}}%
%<latexrelease> \expandafter\reserved@b\expandafter{\reserved@a{##1}}%
%<latexrelease> \fi
%<latexrelease> \expandafter\def\csname\expandafter\string\csname
%<latexrelease> #2\endcsname\string#1-\string#3\@empty\endcsname{#4}}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
%
% \begin{macrocode}
\@onlypreamble\DeclareTextCompositeCommand
% \end{macrocode}
% This all works because:
%\begin{verbatim}
% \@text@composite \T1\foo A\@empty \@text@composite {...}
%\end{verbatim}
% expands to
% |\\T1\foo-A| if |\\T1\foo-A| has been defined, and |{...}|
% otherwise.
%
% Note that |\@text@composite| grabs the first token of the
% argument and puts just that in the
% csname. This is so that |\'{\textit{e}}| will work---it checks
% whether |\\T1\'-\textit| is defined (which presumably it isn't)
% and so expands to |{\accent 1 \textit{e}}|.
%
% This trick won't always work, for example |\'{{\itshape e}}| will
% expand to (with spaces added for clarity):
%\begin{verbatim}
% \csname \string \T1\' - \string {\itshape e} \@empty \endcsname
%\end{verbatim}
% which will die pretty horribly. Unfortunately there's not much
% can be done about this if we're going to use |\csname| lookups as a
% fast way of accessing composites.
%
% This has an unfortunate `misfeature' though, which is that in
% the T1 encoding, |\'{aa}| produces \'a. This is not the expected
% behaviour, and should perhaps be fixed if the fix doesn't affect
% performance too badly.
%
% Finally, it's worth noting that the |\@empty| is used in
% |\@text@composite| so that accents will work even when the
% argument is empty. If you say |\'{}| then this looks up
% |\\T1\'-\@empty|, which ought to be |\relax|, and so all is well.
% If we didn't include the |\@empty|, then |\'{}| would expand to:
%\begin{verbatim}
% \csname \string \T1\' - \string \endcsname
%\end{verbatim}
% so the |\endcsname| would be |\string|'ed and the whole of the
% rest of the document would be put inside the |\csname|. This
% would not be good.
% \begin{macrocode}
\def\@text@composite#1#2#3\@text@composite{%
\expandafter\@text@composite@x
\csname\string#1-\string#2\endcsname}
% \end{macrocode}
%
% \changes{v1.7z}{1996/05/23}
% {\cs{expandafter} added to match other changes for latex/2133}
% \changes{v1.9r}{1999/01/06}{New impl for latex/2930}
% \changes{v1.9s}{1999/01/13}{Simplified solution for latex/2930}
% Originally the |\@text@composite@x| macro had two arguments and if
% |#1| was not |\relax| it was executed, otherwise |#2| was executed.
% All this happened within the |\ifx| code so that neither |#1|
% nor |#2| could have picked up any additional arguments form
% the input stream.
% This has now being changed using the typical |\@firstoftwo| /
% |\@secondoftwo| coding. This way the
% final expansion will happen without any |\else| or |\fi|
% intervening in the case that we need to get a further token
% from the input stream.
% \begin{macrocode}
\def\@text@composite@x#1{%
\ifx#1\relax