forked from latex3/latex2e
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathltfssdcl.dtx
1639 lines (1639 loc) · 53.2 KB
/
ltfssdcl.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-2016
% 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: ltfssdcl.dtx
%% Copyright (C) 1989-1998 Frank Mittelbach and Rainer Sch\"opf,
%% all rights reserved.
%
%<*driver>
% \fi
%
%
\ProvidesFile{ltfssdcl.dtx}
[2016/02/18 v3.0r LaTeX Kernel (NFSS Declarative Interface)]
% \iffalse
\documentclass{ltxdoc}
\begin{document}
\DocInput{ltfssdcl.dtx}
\end{document}
%</driver>
% \fi
%
% \iffalse
%<+checkmem>\def\CHECKMEM{\tracingstats=2
%<+checkmem> \newlinechar=`\^^J
%<+checkmem> \message{^^JMemory usage: \filename}\shipout\hbox{}}
%<+checkmem>\CHECKMEM
% \fi
%
%
%
% \GetFileInfo{ltfssdcl.dtx}
% \title{A new font selection scheme for \TeX{} macro packages\\
% (Declarative Interface)\thanks
% {This file has version number
% \fileversion\ dated \filedate}}
%
% \author{Frank Mittelbach \and Rainer Sch\"opf}
%
% \MaintainedByLaTeXTeam{latex}
% \maketitle
%
% This file contains the main implementation of the font selection
% scheme commands. See other parts of the \LaTeX\ distribution, or
% \emph{The \LaTeX\ Companion} for higher level documentation of these
% commands.
%
% \begin{quote}
% \textbf{Warning:}
% The macro documentation is still basically the documentation from the
% first NFSS release and therefore in some cases probably not
% completely accurate.
% \end{quote}
%
% \StopEventually{}
%
% \section{Interface Commands}
%
% \changes{v3.0i}{1998/08/17}
% {(RmS) Corrected minor glitches in changes entries.}
% \changes{v3.0b}{1995/06/15}
% {(DPC) minor documentation changes}
% \changes{v3.0a}{1995/05/24}
% {(DPC) Make file from previous file, latint.dtx 1995/05/21 v2.1t}
% \changes{v3.0p}{2015/02/21}
% {Removed autoload code}
%
%
% \changes{v2.1o}{1994/11/22}
% {wrap long lines}
% \changes{v2.1m}{1994/11/17}
% {\cs{@tempa} to \cs{reserved@a}}
% \changes{v2.1j}{1994/05/29}{Use new error commands}
% \changes{v2.1h}{1994/05/13}{Removed file identification typeout}
% \changes{v2.1g}{1994/05/12}{Allow \cs{relax}'ed cmds to be declared}
% \changes{v2.1g}{1994/05/12}{Allow \cs{relax} as undefined command}
% \changes{v2.1e}{1994/04/28}{Removed all \cs{uppercase} in hex num
% parsing macros}
% \changes{v2.1d}{1994/04/18}{Removed surplus \cs{no@alphabet@error}
% (see fam.dtx)}
%
%
%
% \changes{v2.1f}{1994/05/03}{Renamed \cs{@@DeclareMathDelimiter} to
% \cs{@DeclareMathDelimiter}}
% \changes{v2.1c}{1994/03/13}{add 2ekernel module to omit repeated code}
%
%
% \begin{macro}{\in@}
% \changes{v3.0m}{2009/10/20}{More robust thanks to Heiko.}
% \changes{v3.0n}{2011/05/08}{Simplified thanks to Bruno.}
% \begin{macro}{\ifin@}
% |\@in| is a utility macro with two arguments. It determines
% whether its first argument occurs in its second and sets the
% switch |\ifin@| accordingly. The first argument may not
% contain braces nor |#| (more precisely, tokens of category
% code 1,~2, or~6).
% \begin{macrocode}
%<*2ekernel>
\def\in@#1#2%
{%
\begingroup
\def\in@@##1#1{}%
\toks@\expandafter{\in@@#2{}{}#1}%
\edef\in@@{\the\toks@}%
\expandafter\endgroup
\ifx\in@@\@empty
\in@false
\else
\in@true
\fi
}
\newif\ifin@
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% Before the |\begin{document}| command several
% \meta{math versions} and \meta{math alphabet identifiers} may
% be declared.
% In principle, there should be exactly one family/series/shape
% combination be declared for each version/alphabet pair.
% But we want to allow for defaults as well for automagical
% filling of holes.
%
% While building the tables for math alphabet identifiers and math
% versions we keep several lists:
% \begin{itemize}
% \item the list of all math versions, |\version@list|,
% each entry prefixed by the control sequence |\version@elt|,
% i.e.\ this list has the following form
% \begin{quote}
% |\version@elt|\meta{version$_1$}^^A
% |\version@elt|\meta{version$_2$}\ldots\\\hspace*{\fill}^^A
% |\version@elt|\meta{version$_n$}
% \end{quote}
% \item the list of all math alphabet identifiers. Here every
% entry has the form:\\[2pt]
% \hspace*{\MacroIndent}
% |\group@elt|\meta{math group number}\\
% \hspace*{\MacroIndent}
% |{{|\meta{default family}^^A
% |}{|\meta{default series}^^A
% |}{|\meta{default shape}|}}|.
% \item Each defined math alphabet identifier holds a list containing
% Information about the {\em versions\/} for which it is
% defined. This list has a more complicated structure: it
% looks as follows:
% \begin{quote}
% |\set@alpha|\meta{the alphabet identifier itself}\\
% \hspace*{\MacroIndent}
% |\reserved@c|\meta{math version}\meta{font info}\\
% \hspace*{\MacroIndent}\ldots\\
% |\@nil|
% \end{quote}
% where \meta{font info} is either |\reserved@e|
% (if the combination is not defined yet) or
% \begin{quote}
% |{{|\meta{family}|}{|\meta{series}^^A
% |}{|\meta{shape}|}}|
% \end{quote}
% \end{itemize}
%
% \begin{macro}{\version@list}
% We initialize the version list to be empty.
% \begin{macrocode}
\let\version@list=\@empty
\@onlypreamble\version@list
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\version@elt}
% \begin{macrocode}
\let\version@elt\relax
\@onlypreamble\version@elt
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\new@mathversion}
% The macro |\new@mathversion| is called with the version control
% sequence as its argument.
% \begin{macrocode}
%\def\new@mathversion#1{%
% \end{macrocode}
% The first thing this macro does is to check if the version
% identifier is already present in |\version@list|.
% We enclose |\version@list| in braces since it might be empty
% (if no {\em version\/} is defined yet). But this means that
% we need a suitable number of |\expandafter| primitives.
% \begin{macrocode}
% \expandafter\in@\expandafter#1\expandafter{\version@list}%
% \ifin@
% \end{macrocode}
% If so it prints an error message.
% The |\next| macro is used to get rid of the four characters
% |\mv@| that would otherwise appear at the begin of the
% version name in the error message.
% \begin{macrocode}
% \@latex@error{Math version
% `\expandafter\@gobblefour\string#1'
% already defined}\@eha
% \end{macrocode}
% Otherwise we have a new version, and we can proceed with
% entering it into the tables.
% We add it to |\version@list|. This is very easy:
% we define |\version@elt| (which is the delimiter in
% |\version@list|) to protect itself and the following token
% from being expanded and simply redefine |\version@list|.
% \begin{macrocode}
% \else
% \global\expandafter\newcount\csname c@\expandafter
% \@gobble\string#1\endcsname
% \global\csname c@\expandafter
% \@gobble\string#1\endcsname\@ne
% \def\version@elt{\noexpand\version@elt\noexpand}%
% \edef\version@list{\version@list\version@elt#1}%
% \end{macrocode}
% Then we prepare to enter the new version into all math
% alphabet identifier lists. Remember that these lists
% use |\reserved@c| as delimiter, and that there appears the
% control sequence |\reserved@e| that must not be expanded.
% Therefore we take suitable precautions.
% \begin{macrocode}
% \def\reserved@c{\noexpand\reserved@c\noexpand}%
% \let\reserved@e\relax
% \end{macrocode}
% We will now go through the |\alpha@list| to process every
% \meta{math alphabet identifier} in turn.
% Since this list has |\group@elt| as a delimiter we define
% this control sequence. It has three arguments as every
% entry consists of three items (as explained above).
% \begin{macrocode}
% \def\group@elt##1##2##3{%
% \end{macrocode}
% The first of these arguments is the \meta{math alphabet
% identifier}. We redefine it by appending the information
% about the new version at the end of the list contained in
% it. However, there is one subtlety: the definitions for
% |\reserved@c| and |\reserved@e| made above prevent the
% main part of the list from being expanded. But we still have
% to take care of the header and the trailer. To do this we
% remove the trailer by means of the macro |\remove@nil|
% which also protect the header from being expanded. Its
% definition is given below. Now we can prepare to add the
% new version.
% \begin{macrocode}
% \edef##1{\expandafter\remove@nil##1%
% \reserved@c
% #1%
% \reserved@e
% \noexpand\@nil}}%
% \end{macrocode}
% Finally we call |\alpha@list| which will now execute
% the macro |\group@elt| once for every defined \meta{math
% alphabet identifier}. And that's all for now.
% \begin{macrocode}
% \alpha@list
% \fi}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\alpha@list}
% As we explained above every entry in |\alpha@list| has
% the form\\[2pt]
% |\alpha@elt|\\\meta{alphabet identifier}\meta{internal
% group number}\meta{default font assignments}\ldots\\[2pt]
% We initialize it to |\@empty|.
% \begin{macrocode}
\let\alpha@list\@empty
\@onlypreamble\alpha@list
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\alpha@elt}
% \begin{macrocode}
\let\alpha@elt\relax
\@onlypreamble\alpha@elt
% \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\newgroup}
% Start the group (fam) allocation at 0. (Doesn't belong here.)
% \begin{macrocode}
\count18=-1
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\stepcounter}
% \changes{v3.0f}{1997/11/13}
% {(DPC) Remove as never used. (Re)defined in ltcounts}
% \end{macro}
%
% \begin{macro}{\select@group}
% We surround |\select@group| with braces so that functions using it
% can be used directly after |_| or |^|.
% \changes{v2.1p}{1994/12/10}{Surround with braces (add fourth arg)}
% However, if we use oldstyle syntax where the math alphabet
% doesn't have arguments (ie if |\math@bgroup| is not |\bgroup|) we
% need to get rid of the extra group.
% \changes{v2.1q}{1995/04/02}{fix problem for pr/1275}
% \changes{v3.0g}{1997/11/20}
% {(DPC) inline use of \cs{stepcounter} (faster, and saves a csname
% per math version as no reset list)}
% \changes{v3.0q}{2015/03/18}{Introduce \cs{e@mathgroup@top}}
% \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2015/01/01}
%<latexrelease> {\select@group}{\select@group}%
%<*2ekernel|latexrelease>
\def\select@group#1#2#3#4{%
\ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi
{%
\ifmmode
\ifnum\csname c@mv@\math@version\endcsname<\e@mathgroup@top
\begingroup
\escapechar\m@ne
\getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3%
\globaldefs\@ne \math@fonts
\endgroup
\init@restore@version
\xdef#1{\noexpand\use@mathgroup\noexpand#2%
{\number\csname c@mv@\math@version\endcsname}}%
\global\advance\csname c@mv@\math@version\endcsname\@ne
\else
\let#1\relax
\@latex@error{Too many math alphabets used in
version \math@version}%
\@eha
\fi
\else \expandafter\non@alpherr\fi
#1{#4}%
}%
}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}
%<latexrelease> {\select@group}{\select@group}%
%<latexrelease>\def\select@group#1#2#3#4{%
%<latexrelease> \ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi
%<latexrelease> {%
%<latexrelease> \ifmmode
%<latexrelease> \ifnum\csname c@mv@\math@version\endcsname<\sixt@@n
%<latexrelease> \begingroup
%<latexrelease> \escapechar\m@ne
%<latexrelease> \getanddefine@fonts
%<latexrelease> {\csname c@mv@\math@version\endcsname}#3%
%<latexrelease> \globaldefs\@ne \math@fonts
%<latexrelease> \endgroup
%<latexrelease> \init@restore@version
%<latexrelease> \xdef#1{\noexpand\use@mathgroup\noexpand#2%
%<latexrelease> {\number\csname c@mv@\math@version\endcsname}}%
%<latexrelease> \global\advance\csname c@mv@\math@version\endcsname\@ne
%<latexrelease> \else
%<latexrelease> \let#1\relax
%<latexrelease> \@latex@error{Too many math alphabets used in
%<latexrelease> version \math@version}%
%<latexrelease> \@eha
%<latexrelease> \fi
%<latexrelease> \else \expandafter\non@alpherr\fi
%<latexrelease> #1{#4}%
%<latexrelease> }%
%<latexrelease>}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
%
% \begin{macrocode}
\@onlypreamble\restore@mathversion
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\init@restore@version}
% \changes{v3.0e}{1996/07/26}{Removed \cs{ifrestore@version} switch
% and replaced by \cs{init@restore@version}}
% \begin{macrocode}
\def\init@restore@version{%
\global\let\init@restore@version\relax
\xdef\restore@mathversion
{\expandafter\noexpand\csname mv@\math@version\endcsname
\global\csname c@mv@\math@version\endcsname
\number\csname c@mv@\math@version\endcsname\relax}%
\aftergroup\dorestore@version
}
\@onlypreamble\init@restore@version
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\non@alpherr}
% \changes{v3.0c}{1995/10/10}
% {(DPC) autoload error message}
% \changes{v3.0j}{2005/07/27}
% {(MH) Change because command is now properly robust}
% \begin{macrocode}
\gdef\non@alpherr#1{\@latex@error{%
% \end{macrocode}
% The command here will have a space at the end of its name, so we make
% sure not to insert an extra one.
% \begin{macrocode}
\string#1allowed only in math mode}\@ehd}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\dorestore@version}
% \begin{macrocode}
\def\dorestore@version
{\ifmmode
\aftergroup\dorestore@version
\else
\gdef\init@restore@version{%
\global\let\init@restore@version\relax
\xdef\restore@mathversion
{\expandafter\noexpand\csname mv@\math@version\endcsname
\global\csname c@mv@\math@version\endcsname
\number\csname c@mv@\math@version\endcsname\relax}%
\aftergroup\dorestore@version
}%
\begingroup
\let\getanddefine@fonts\@gobbletwo
\restore@mathversion
\endgroup
\fi}%
\@onlypreamble\dorestore@version
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\document@select@group}
% We surround |\select@group| with braces so that functions using it
% can be used directly after |_| or |^|.
% \changes{v2.1p}{1994/12/10}{Surround with braces (add fourth arg)}
% \changes{v2.1q}{1995/04/02}{fix problem for pr/1275}
% \changes{v3.0g}{1997/11/20}
% {(DPC) inline use of \cs{stepcounter} (faster, and saves a csname
% per math version as no reset list)}
% \changes{v3.0q}{2015/03/18}{Introduce \cs{e@mathgroup@top}}
% \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2015/01/01}
%<latexrelease> {\document@select@group}{\document@select@group}%
%<*2ekernel|latexrelease>
\def\document@select@group#1#2#3#4{%
\ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi
{%
\ifmmode
\ifnum\csname c@mv@\math@version\endcsname<\e@mathgroup@top
\begingroup
\escapechar\m@ne
\getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3%
\globaldefs\@ne \math@fonts
\endgroup
\expandafter\extract@alph@from@version
\csname mv@\math@version\expandafter\endcsname
\expandafter{\number\csname
c@mv@\math@version\endcsname}%
#1%
\global\advance\csname c@mv@\math@version\endcsname\@ne
\else
\let#1\relax
\@latex@error{Too many math alphabets used
in version \math@version}%
\@eha
\fi
\else \expandafter\non@alpherr\fi
#1{#4}%
}%
}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}
%<latexrelease> {\document@select@group}{\document@select@group}%
%<latexrelease>\def\document@select@group#1#2#3#4{%
%<latexrelease> \ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi
%<latexrelease> {%
%<latexrelease> \ifmmode
%<latexrelease> \ifnum\csname c@mv@\math@version\endcsname<\sixt@@n
%<latexrelease> \begingroup
%<latexrelease> \escapechar\m@ne
%<latexrelease> \getanddefine@fonts
%<latexrelease> {\csname c@mv@\math@version\endcsname}#3%
%<latexrelease> \globaldefs\@ne \math@fonts
%<latexrelease> \endgroup
%<latexrelease> \expandafter\extract@alph@from@version
%<latexrelease> \csname mv@\math@version\expandafter\endcsname
%<latexrelease> \expandafter{\number\csname
%<latexrelease> c@mv@\math@version\endcsname}%
%<latexrelease> #1%
%<latexrelease> \global\advance\csname c@mv@\math@version\endcsname\@ne
%<latexrelease> \else
%<latexrelease> \let#1\relax
%<latexrelease> \@latex@error{Too many math alphabets used
%<latexrelease> in version \math@version}%
%<latexrelease> \@eha
%<latexrelease> \fi
%<latexrelease> \else \expandafter\non@alpherr\fi
%<latexrelease> #1{#4}%
%<latexrelease> }%
%<latexrelease>}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\process@table}
% \begin{macrocode}
\def\process@table{%
\def\cdp@elt##1##2##3##4{%
\@font@info{Checking defaults for
##1/##2/##3/##4}%
\expandafter
\ifx\csname##1/##2/##3/##4\endcsname\relax
% \end{macrocode}
% Grouping is important for two reasons, first |\cdp@elt| will get
% redefined if |\Declare...| functions are executed within the
% external |.fd| file and secondly |\try@load@fontshape| changes a
% lot of catcodes without surrounding itself with a group.
% \begin{macrocode}
\begingroup
\def\f@encoding{##1}\def\f@family{##2}%
\try@load@fontshape
\endgroup
\fi
\expandafter
\ifx\csname##1/##2/##3/##4\endcsname\relax
\@latex@error{This NFSS system isn't set up properly}%
{For encoding scheme ##1 the defaults
##2/##3/##4 do not form a valid font shape}%
\else
\@font@info{... okay}%
\fi}%
\cdp@list
% \end{macrocode}
% Now we make sure that |\error@fontshape| is okay.
% \begin{macrocode}
\begingroup
\escapechar\m@ne
\error@fontshape
\expandafter\ifx\csname \curr@fontshape\endcsname\relax
\begingroup
\try@load@fontshape
\endgroup
\fi
\expandafter\ifx\csname \curr@fontshape\endcsname\relax
\@latex@error{This NFSS system isn't set up properly}%
{The system maintainer forgot to specify a suitable
substitution
font shape using the \noexpand\DeclareErrorFont
command}%
\fi
\endgroup
% \end{macrocode}
% Set |\select@group| to its meaning used within the document body.
% \begin{macrocode}
\let\select@group\document@select@group
% \end{macrocode}
% Install the default font attributes they are currently pointing
% to error font shape.
% Don't use |\reset@font| since that would trigger |\selectfont|.
% \begin{macrocode}
\fontencoding{\encodingdefault}%
\fontfamily{\familydefault}%
\fontseries{\seriesdefault}%
\fontshape{\shapedefault}%
% \end{macrocode}
% kill all macros not longer needed.
% we need to add many more!!!!!!
% \begin{macrocode}
\everyjob{}%
}
\@onlypreamble\process@table
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
%\@onlypreamble\set@mathradical
% \end{macrocode}
%
% \begin{macro}{\DeclareMathVersion}
% \begin{macrocode}
\def\DeclareMathVersion#1{%
\expandafter\new@mathversion\csname mv@#1\endcsname}
\@onlypreamble\DeclareMathVersion
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\new@mathversion}
% \changes{v3.0o}{2011/09/03}
% {(Will) Remove \cs{global} before \cs{newcount} (unnecessary and caused etex bug).}
% \begin{macrocode}
\def\new@mathversion#1{%
\expandafter\in@\expandafter#1\expandafter{\version@list}%
\ifin@
\@font@info{Redeclaring math version
`\expandafter\@gobblefour\string#1'}%
\else
\expandafter\newcount\csname c@\expandafter
\@gobble\string#1\endcsname
\def\version@elt{\noexpand\version@elt\noexpand}%
\edef\version@list{\version@list\version@elt#1}%
\fi
% \end{macrocode}
% |\toks@| is used to gather all tokens for the math version.
% |\count@| will be used to count the math groups we add to this
% version.
% \begin{macrocode}
\toks@{}%
\count@\z@
% \end{macrocode}
% Now we loop over |\group@list| to add all math groups defined so
% far to the version and at the same time to count them.
% \begin{macrocode}
\def\group@elt##1##2{%
\advance\count@\@ne
\addto@hook\toks@{\getanddefine@fonts##1##2}%
}%
\group@list
% \end{macrocode}
% We set the counter for this math version to the number of math
% groups found in |\group@list|.
% \begin{macrocode}
\global\csname c@\expandafter\@gobble\string#1\endcsname\count@
% \end{macrocode}
% Now we loop over |\alpha@list| to add all math alphabets known so
% far. We have to distinguish the case that an alphabet by default
% should produce an error in new versions.
% \begin{macrocode}
\def\alpha@elt##1##2##3{%
\ifx##2\no@alphabet@error
\toks@\expandafter{\the\toks@\install@mathalphabet##1%
{\no@alphabet@error##1}}%
\else
\toks@\expandafter{\the\toks@\install@mathalphabet##1%
{\select@group##1##2##3}}%
\fi
}%
\alpha@list
% \end{macrocode}
% Finally we define the math version to expand to the contents of
% |\toks@|.
% \changes{v2.0e}{1993/08/18}{Exchanged names of encodings in warning
% message of \cs{SetSymbolFont}.}
% \begin{macrocode}
\xdef#1{\the\toks@}%
}
\@onlypreamble\new@mathversion
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\DeclareSymbolFont}
% \begin{macrocode}
\def\DeclareSymbolFont#1#2#3#4#5{%
\@tempswafalse
\edef\reserved@b{#2}%
\def\cdp@elt##1##2##3##4{\def\reserved@c{##1}%
\ifx\reserved@b\reserved@c \@tempswatrue\fi}%
\cdp@list
\if@tempswa
\@ifundefined{sym#1}{%
% \end{macrocode}
%
% \changes{v3.0q}{2015/03/18}{Restrict Symbol fonts to 0-15}
% \begin{macrocode}
\ifnum\count18<15 %
\expandafter\new@mathgroup\csname sym#1\endcsname
\expandafter\new@symbolfont\csname sym#1\endcsname
{#2}{#3}{#4}{#5}%
\else
\@latex@error{Too many symbol fonts declared}\@eha
\fi
}%
{%
% \end{macrocode}
%
% \begin{macrocode}
\@font@info{Redeclaring symbol font `#1'}%
% \end{macrocode}
% \changes{v3.0f}{1997/11/13}
% {(DPC) Really update \cs{group@list} dont
% leave new version in \cs{toks@}. latex/2661}
% Update the group list.
% \begin{macrocode}
\def\group@elt##1##2{%
\noexpand\group@elt\noexpand##1%
\expandafter\ifx\csname sym#1\endcsname##1%
\expandafter\noexpand\csname#2/#3/#4/#5\endcsname
\else
\noexpand##2%
\fi}%
\xdef\group@list{\group@list}%
% \end{macrocode}
% Update the version list.
% \begin{macrocode}
\def\version@elt##1{%
\expandafter
\SetSymbolFont@\expandafter##1\csname#2/#3/#4/#5\expandafter
\endcsname \csname sym#1\endcsname
}%
\version@list
}%
\else
\@latex@error{Encoding scheme `#2' unknown}\@eha
\fi
}
\@onlypreamble\DeclareSymbolFont
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\group@list}
% \begin{macrocode}
\let\group@list\@empty
\@onlypreamble\group@list
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\group@elt}
% \begin{macrocode}
\let\group@elt\relax
\@onlypreamble\group@elt
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\new@symbolfont}
% \begin{macrocode}
\def\new@symbolfont#1#2#3#4#5{%
\toks@\expandafter{\group@list}%
\edef\group@list{\the\toks@\noexpand\group@elt\noexpand#1%
\expandafter\noexpand\csname#2/#3/#4/#5\endcsname}%
\def\version@elt##1{\toks@\expandafter{##1}%
\edef##1{\the\toks@\noexpand\getanddefine@fonts
#1\expandafter\noexpand\csname#2/#3/#4/#5\endcsname}%
\global\advance\csname c@\expandafter
\@gobble\string##1\endcsname\@ne
}%
\version@list
}
\@onlypreamble\new@symbolfont
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\SetSymbolFont}
% \begin{macrocode}
\def\SetSymbolFont#1#2#3#4#5#6{%
\@tempswafalse
\edef\reserved@b{#3}%
\def\cdp@elt##1##2##3##4{\def\reserved@c{##1}%
\ifx\reserved@b\reserved@c \@tempswatrue\fi}%
\cdp@list
\if@tempswa
\expandafter\SetSymbolFont@
\csname mv@#2\expandafter\endcsname\csname#3/#4/#5/#6\expandafter
\endcsname \csname sym#1\endcsname
\else
\@latex@error{Encoding scheme `#3' unknown}\@eha
\fi
}
\@onlypreamble\SetSymbolFont
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\SetSymbolFont@}
% \changes{v3.0l}{2007/08/31}{Font warning changed to info
% for encoding change (pr/3975)}
% \begin{macrocode}
\def\SetSymbolFont@#1#2#3{%
\expandafter\in@\expandafter#1\expandafter{\version@list}%
\ifin@
\expandafter\in@\expandafter#3\expandafter{\group@list}%
\ifin@
\begingroup
\expandafter\get@cdp\string#2\@nil\reserved@a
\toks@{}%
\def\install@mathalphabet##1##2{%
\addto@hook\toks@{\install@mathalphabet##1{##2}}%
}%
\def\getanddefine@fonts##1##2{%
\ifnum##1=#3%
\addto@hook\toks@{\getanddefine@fonts#3#2}%
\expandafter\get@cdp\string##2\@nil\reserved@b
\ifx\reserved@a\reserved@b\else
\@font@info{Encoding `\reserved@b' has changed
to `\reserved@a' for symbol font\MessageBreak
`\expandafter\@gobblefour\string#3' in the
math version `\expandafter
\@gobblefour\string#1'}%
\fi
\@font@info{%
Overwriting symbol font
`\expandafter\@gobblefour\string#3' in
version `\expandafter
\@gobblefour\string#1'\MessageBreak
\@spaces \expandafter\@gobble\string##2 -->
\expandafter\@gobble\string#2}%
\else
\addto@hook\toks@{\getanddefine@fonts##1##2}%
\fi}%
#1%
\xdef#1{\the\toks@}%
\endgroup
\else
\@latex@error{Symbol font `\expandafter\@gobblefour\string#3'
not defined}\@eha
\fi
\else
\@latex@error{Math version `\expandafter\@gobblefour\string#1'
is not
defined}{You probably misspelled the name of the math
version.^^JOr you have to specify an additional package.}%
\fi
}
\@onlypreamble\SetSymbolFont@
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\get@cdp}
% \begin{macrocode}
\def\get@cdp#1#2/#3\@nil#4{\def#4{#2}}
\@onlypreamble\get@cdp
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\DeclareMathAlphabet}
% \changes{v3.0j}{2005/07/27}
% {(MH) Make document commands robust}
% \begin{macrocode}
\def\DeclareMathAlphabet#1#2#3#4#5{%
\@tempswafalse
\edef\reserved@b{#2}%
\def\cdp@elt##1##2##3##4{\def\reserved@c{##1}%
\ifx\reserved@b\reserved@c \@tempswatrue\fi}%
\cdp@list
\if@tempswa
\expandafter\ifx
\csname\expandafter\@gobble\string#1\endcsname
\relax
\new@mathalphabet#1{#2}{#3}{#4}{#5}%
\else
% \end{macrocode}
% Check if it is already a math alphabet.
% \begin{macrocode}
\edef\reserved@a{\noexpand\in@{\string\select@group}%
{\expandafter\meaning\csname \expandafter
\@gobble\string#1\space\endcsname}}%
\reserved@a
\ifin@
\@font@info{Redeclaring math alphabet \string#1}%
\def\version@elt##1{%
\expandafter\SetMathAlphabet@\expandafter
##1\csname#2/#3/#4/#5\expandafter\endcsname
% \end{macrocode}
% \changes{???}{1994/04/18}{Pass correct arg (2 not 3)}
% \begin{macrocode}
\csname M@#2\expandafter\endcsname
\csname \expandafter\@gobble\string#1\space\endcsname#1}%
\version@list
\else
% \end{macrocode}
% Check if it is a math alphabet defined via
% |\DeclareSymbolFontAlphabet|.
% \begin{macrocode}
\edef\reserved@a{\noexpand\in@{\string\use@mathgroup}%
{\expandafter\meaning\csname \expandafter
\@gobble\string#1\space\endcsname}}%
\reserved@a
\ifin@
% \end{macrocode}
% In that case overwriting is simple since there is nothing
% inserted in the math version macros.
% \begin{macrocode}
\@font@info{Redeclaring math alphabet \string#1}%
\new@mathalphabet#1{#2}{#3}{#4}{#5}%
% \end{macrocode}
% Otherwise panic.
% \begin{macrocode}
\else
\@latex@error{Command `\string#1' already defined}\@eha
\fi
\fi
\fi
\else
\@latex@error{Encoding scheme `#2' unknown}\@eha
\fi
}
\@onlypreamble\DeclareMathAlphabet
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\new@mathalphabet}
% \changes{v3.0j}{2005/07/27}
% {(MH) Make document commands robust}
% \begin{macrocode}
\def\new@mathalphabet#1#2#3#4#5{%
\toks@\expandafter{\alpha@list}%
\edef#1{\expandafter\noexpand\csname \expandafter
\@gobble\string#1\space\endcsname
\if/#5/%
\noexpand\no@alphabet@error
\noexpand\no@alphabet@error
\else
\expandafter\noexpand\csname M@#2\endcsname
\expandafter\noexpand\csname#2/#3/#4/#5\endcsname
\fi
}%
\toks2\expandafter{#1}%
\edef\alpha@list{\the\toks@\noexpand\alpha@elt\the\toks2}%
\def\version@elt##1{\toks@\expandafter{##1}%
\edef##1{\the\toks@\install@mathalphabet
\expandafter\noexpand
\csname \expandafter\@gobble
\string#1\space\endcsname
{\if/#5/%
\noexpand\no@alphabet@error
\noexpand#1%
\else
\noexpand\select@group\the\toks2
\fi}}%
}%
\version@list
\expandafter\edef\csname \expandafter\@gobble
\string#1\space\endcsname{\if/#5/%
\noexpand\no@alphabet@error
\noexpand#1%
\else
\noexpand\select@group\the\toks2
\fi}%
\edef#1{\noexpand\protect
\expandafter\noexpand\csname \expandafter
\@gobble\string#1\space\endcsname}%
}
\@onlypreamble\new@mathalphabet
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\SetMathAlphabet}
% \changes{v3.0j}{2005/07/27}
% {(MH) Make document commands robust}
% \begin{macrocode}
\def\SetMathAlphabet#1#2#3#4#5#6{%
\@tempswafalse
\edef\reserved@b{#3}%
\def\cdp@elt##1##2##3##4{\def\reserved@c{##1}%
\ifx\reserved@b\reserved@c \@tempswatrue\fi}%
\cdp@list
\if@tempswa
\expandafter\SetMathAlphabet@
\csname mv@#2\expandafter\endcsname\csname#3/#4/#5/#6\expandafter
\endcsname \csname M@#3\expandafter\endcsname
\csname \expandafter\@gobble\string#1\space\endcsname#1%
\else
\@latex@error{Encoding scheme `#3' unknown}\@eha
\fi
}
\@onlypreamble\SetMathAlphabet
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\SetMathAlphabet@}
% \begin{macrocode}
\def\SetMathAlphabet@#1#2#3#4#5{%
\expandafter\in@\expandafter#1\expandafter{\version@list}%
\ifin@
\expandafter\in@\expandafter#4\expandafter{\alpha@list}%
\ifin@
\begingroup
\toks@{}%
\def\getanddefine@fonts##1##2{%
\addto@hook\toks@{\getanddefine@fonts##1##2}%
}%
\def\reserved@c##1##2##3##4{% % for message below
\expandafter\@gobble\string##4}%
\def\install@mathalphabet##1##2{%
\ifx##1#4%