summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/base/ltfssbas.dtx
blob: 60007825c480374786bbfc395567c44db174eb6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
% \iffalse meta-comment
%
% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009
% 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
%    http://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: ltfssbas.dtx
%% Copyright (C) 1989-2002 Frank Mittelbach and Rainer Sch\"opf
%
%<def1>\ProvidesFile{autofss1.sty}
%<def1>         [2002/10/02 v3.0x NFSS autoload file 1]
%<def2>\ProvidesFile{autofss2.sty}
%<def2>         [2002/10/02 v3.0x NFSS autoload file 2]
%
%<*driver>
% \fi
% 
%
\ProvidesFile{ltfssbas.dtx}
             [2002/10/02 v3.0x LaTeX Kernel (NFSS Basic Macros)]
% \iffalse
\documentclass{ltxdoc}
\begin{document}
\DocInput{ltfssbas.dtx}
\end{document}
%</driver>
% \fi
%
% \iffalse
%<+checkmem>\def\CHECKMEM{\tracingstats=2
%<+checkmem>  \newlinechar=`\^^J
%<+checkmem>  \message{^^JMemory usage: \filename}\shipout\hbox{}}
%<+checkmem>\CHECKMEM
% \fi
%
% \CheckSum{1089}
%
%
% \GetFileInfo{ltfssbas.dtx}
% \title{A new font selection scheme for \TeX{} macro packages\\
%        (Basic Macros)\thanks
%       {This file has version number
%       \fileversion\ dated \filedate}}
%
% \author{Frank Mittelbach \and Rainer Sch\"opf}
%
% \maketitle
%
% This file contains the main implementation of the `low level' font
% selection commands. See other parts of the \LaTeX\
% distribution, or  \emph{The \LaTeX\ Companion} for higher level
% documentation of the \LaTeX\ `New' Font Selection Scheme.
%
% \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{}
%
% \changes{v3.0v}{1998/08/17}{(RmS) Documentation fixes.}
% \changes{v3.0j}{1995/10/22}{(RmS) New size function macro
%    \cs{genb@sfcnt} needs to be disabled at \cs{document}.}
% \changes{v3.0i}{1995/10/20}
%         {(DPC) Modify autoload code, change \cs{undefined}}
% \changes{v3.0g}{1995/10/04}{Modify autoload code}
% \changes{v3.0f}{1995/08/24}{Added autoload code}
% \changes{v3.0d}{1995/07/13}
%         {minor documentation changes}
% \changes{v3.0c}{1995/06/15}
%         {(DPC) minor documentation changes}
% \changes{v3.0a}{1995/05/24}
%         {(DPC) Make file from previous file, fam.dtx 1995/05/20 v2.2d}
%
%
% \changes{v2.1x}{1994/11/18}{(DPC) use \cs{reserved@f} not \cs{next}}
% \changes{v2.1q}{1994/05/20}{Use new error commands}
% \changes{v2.1o}{1994/05/15}{encoding cmds changed to {enc}-cmd}
% \changes{v2.1k}{1994/05/13}{Remove File identification `typeout'}
% \changes{v2.1j}{1994/05/12}{New baselinestretch concept}
% \changes{v2.1j}{1994/05/12}{Replaced hand-protected commands by
%                             \cs{DeclareRobustCommand} defs}
% \changes{v2.1h}{1994/04/11}{Added \cs{defaultscriptratio} and
%    \cs{defaultscriptscriptratio}.  ASAJ.}
% \changes{v2.1g}{1994/03/13}{add 2ekernel module to omit repeated code}
% \changes{v2.1a}{1994/01/17}{New math font setup}
% \changes{v2.0c}{1993/03/18}{Changed all \cs{@tempdima} in
%               \cs{@tempdimb} to avoid killing \cs{numberline}}
% \changes{v1.91a}{1992/09/22}{Introduced \cs{tf@size} for math size.}
% \changes{v1.3a}{1991/11/27}{All \cs{family}, \cs{shape} etc.
%                           renamed to \cs{fontfamily} etc.}
% \changes{v1.2i}{1990/04/01}{Code added from tracefnt.dtx.}
% \changes{v1.2i}{1990/04/01}{Support for TeX3.}
% \changes{v1.2g}{1990/02/16}{Support for changes of \cs{baselineskip}
%          without changing the size.}
%    
% \changes{v1.2c}{1990/01/23}{\cs{no@version@warning} renamed to
%                           \cs{no@alphabet@error}.}
% \changes{v1.0s}{1989/11/25}{All \cs{edef}\cs{font@name} changed to
%                           \cs{xdef}\cs{font@name}.
%                           Necessary after introduction of 
%                           \cs{begingroup}/\cs{endgroup} in v1.0q.}
% \changes{v1.0s}{1989/11/25}{extra// $\to$ + in \cs{extra@def}.}
% \changes{v1.0o}{1989/11/08}{First parameter of 
%                           \cs{define@mathalphabet}
%                           and \cs{define@mathgroup} changed
%                           from string to control sequence.}
% \changes{v1.0m}{1989/09/14}
%      {Global replacement: \cs{group} to \cs{mathgroup}}
% \changes{v1.0k}{1989/05/22}{Lines longer than 72 characters folded.}
% \changes{v1.0j}{1989/05/01}{Default for \cs{baselinestretch} added.}
% \changes{v1.0i}{1989/04/29}
%      {Removed the \cs{halign} \cs{noalign} correction
%                           (wasn't bugfree)}
% \changes{v1.0h}{1989/04/29}{Documented problem with \cs{halign}, and
%                           \cs{noalign}}
% \changes{v1.0g}{1989/04/27}{Documentation revised.}
% \changes{v1.0f}{1989/04/23}{\% in \cs{getanddefinefonts} added.}
% \changes{v1.0e}{1989/04/21}{Documentation is fun!!
%                       Parameters of \cs{define@mathalphabet} changed.}
% \changes{v1.0d}{1989/04/19}{Even more doc.}
% \changes{v1.0c}{1989/04/14}{More documentation added.}
% \changes{v1.0b}{1989/04/10}{\cs{preload@sizes} added.}
% \changes{v1.0b}{1989/04/10}{\cs{wrong@fontshape} changed to define
%                            substitution font/shape macro.}
% \changes{v1.0a}{1989/04/10}{Starting with version numbers!!
%                           \cs{ifmmode} added in \cs{math@group}}
% \changes{v2.1w}{1994/11/17}
%         {\cs{@tempa} to \cs{reserved@a}}
%
%
% \section{Autoloading parts of NFSS}
%
% This code is set up in a way that some parts of it can be kept
% separate and will only be loaded if needed.
%
% If we are producing an autoload version of \LaTeXe{} then all those
% parts with \textsf{def1} or \textsf{def2} docstrip guards will be 
% placed into the autoloadable files \texttt{autofss1.sty} and
% \texttt{autofss2.sty}.
%
% The `2ekernel' code ensures that a |\usepackage{autofss1}| is
% essentially ignored if a `full' format is being used that has
% picture mode already in the format.
%
% Note the |autofss2| loading is currently disabled.
%
%    \begin{macrocode}
%<2ekernel>\expandafter\let\csname ver@autofss1.sty\endcsname\fmtversion
%    \end{macrocode}
%
% The autoload file \texttt{autofss2} is a specialty because it
% contains
% code which will be completely local, ie loaded every time again.
%
% \section{Preliminary macros}
%
% We define a number
% of macros that will be used later.
%
%
% \begin{macro}{\@nomath}
%    |\@nomath| is used by most macros that will have no effect
%    in math mode. It issues a warning message.
%    \begin{macrocode}
%<*2ekernel|autoload>
\def\@nomath#1{\relax\ifmmode 
   \@font@warning{Command \noexpand#1invalid in math mode}\fi}
%</2ekernel|autoload>
%    \end{macrocode}
% \end{macro}
%
% \changes{v1.2c}{1990/01/23}{Macro \cs{no@alphabet@help} added}
% \changes{v2.1i}{1994/04/18}{Macro \cs{no@alphabet@help}
%                             removed again}
%
% \begin{macro}{\no@alphabet@error}
% \changes{v1.2c}{1990/01/23}{Changed to error call}
% \changes{v2.1i}{1994/04/18}{Use std LaTeX error macro}
%    The macro |\no@alphabet@error| is called whenever
%    the user requests a math \emph{alphabet} that is not
%    available in the current \emph{version}.
%    In math mode an error message is produced otherwise the command
%    keeps silent.
%    The argument is the name of the control sequence that identifies
%    the math \emph{alphabet}.
%    The |\relax| at the beginning is necessary to prevent
%    \TeX{} from scanning too far in certain situations.
%    \begin{macrocode}
%<*2ekernel|def1>
\gdef\no@alphabet@error#1{\relax \ifmmode
    \@latex@error{Math\space alphabet\space identifier\space
          \noexpand#1is\space undefined\space in\space math\space
           version\space `\math@version'}%
        {Your\space requested\space math\space alphabet\space 
         is\space undefined\space in\space the\space current\space
          math\space version.^^JCheck\space the\space spelling\space
          or\space use\space the\space \noexpand\SetMathAlphabet\space
          command.}
     \fi}
%</2ekernel|def1>
%<*autoload>
\gdef\no@alphabet@error{\relax \ifmmode
    \expandafter\try@sizes\expandafter\no@alphabet@error \fi}
%</autoload>
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\new@mathgroup}
% \begin{macro}{\mathgroup}
%    We also give a new name to |\newfam| and |\fam|
%    to avoid verbal confusion
%    (see the introduction).\footnote{For the same reason
%                           it seems advisable to
%                           {\ttfamily\bslash let\bslash fam} and
%                           {\ttfamily\bslash newfam}
%                           equal to {\ttfamily\bslash relax},
%                           but this is commented out to retain
%                           compatibility to existing style files.}
% \changes{v1.2e}{1990/01/28}{\cs{newfam} let to \cs{new@mathgroup}.}
% \changes{v3.0a}{1995/05/24}
%         {(DPC) No need to redefine \cs{newfam} as not outer}
% \changes{v3.0b}{1995/05/27}
%         {(FMi) But a need to define \cs{new@mathgroup}}
%    \begin{macrocode}
%<*2ekernel|autoload>
\def\new@mathgroup{\alloc@8\mathgroup\chardef\sixt@@n}
\let\mathgroup\fam
\let\newfam\new@mathgroup
\@onlypreamble\new@mathgroup
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \section{Macros for setting up the tables}
%
%  \begin{macro}{\DeclareFontShape}
%    
% \changes{v1.9a}{1992/07/26}{Introduced \cs{DeclareFontShape}}
%    The macro |\DeclareFontShape| takes $6$ arguments:
%    \begin{macrocode}
\def\DeclareFontShape{\begingroup
%    \end{macrocode}
%    First we restore the catcodes of all characters used in the syntax.
% \changes{v2.1e}{1994/02/24}
%     {Separate restoration of catcodes for fd cmds}
%    \begin{macrocode}
   \nfss@catcodes
%    \end{macrocode}
%    We use |\expandafter| |\endgroup| to restore catcode in case
%    something goes wrong with the argument parsing (suggested by Tim
%    Van Zandt)
%  \end{macro}
%
%
%
%  \begin{macro}{\DeclareFontShape}
% \changes{v2.1c}{1994/02/07}{revert catcode settings earlier}
% \changes{v3.0m}{1995/11/01}
%      {(DPC) Test for \cs{relax} not \cs{undefined}, internal/1933} 
%    \begin{macrocode}
   \expandafter\endgroup
   \DeclareFontShape@}
\def\DeclareFontShape@#1#2#3#4#5#6{%
   \expandafter\ifx\csname #1+#2\endcsname\relax
     \@latex@error{Font family `#1+#2' unknown}\@eha
   \else
     \expandafter
       \xdef\csname#1/#2/#3/#4\endcsname{\expandafter\noexpand
                                   \csname #5\endcsname}%
     \def\reserved@a{#6}%
     \global
     \expandafter\let\csname#5\expandafter\endcsname
        \ifx\reserved@a\@empty
          \@empty
        \else
          \reserved@a
        \fi
   \fi
  }
%    \end{macrocode}
%  \end{macro}
%
%
%  \begin{macro}{\DeclareFixedFont}
%    Define a direct font switch that avoids all overhead.
% \changes{v2.1u}{1994/11/06}{Renamed 
%                        \cs{every@size} to \cs{every@math@size}.}
%    \begin{macrocode}
\def\DeclareFixedFont#1#2#3#4#5#6{%
   \begingroup
      \math@fontsfalse
      \every@math@size{}%
      \fontsize{#6}\z@
      \usefont{#2}{#3}{#4}{#5}%
      \global\expandafter\let\expandafter#1\the\font
   \endgroup
  }
%</2ekernel|autoload>
%    \end{macrocode}
%  \end{macro}
%
%
%
%
%  \begin{macro}{\do@subst@correction}
%    
%    \begin{macrocode}
%<*2ekernel|autoload>
\def\do@subst@correction{%
       \xdef\subst@correction{%
          \font@name 
          \global\expandafter\font
            \csname \curr@fontshape/\f@size\endcsname
            \noexpand\fontname\font
           \relax}%
%    \end{macrocode}
%    Calling |\subst@correction| after the current group means calling
%    it after we have loaded the substitution font which is done
%    inside a group.
%    \begin{macrocode}
       \aftergroup\subst@correction
}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\DeclareFontFamily}
%    \begin{macrocode}
\def\DeclareFontFamily#1#2#3{%
%    \end{macrocode}
%    If we want fast checking for the encoding scheme we can just
%    check for |\T@..| being defined.
%    \begin{macrocode}
% \@tempswafalse
% \def\reserved@b{#1}%
% \def\cdp@elt##1##2##3##4{\def\reserved@c{##1}%
%      \ifx\reserved@b\reserved@c \@tempswatrue\fi}%
% \cdp@list
% \if@tempswa
 \@ifundefined{T@#1}%
    {%
     \@latex@error{Encoding scheme  `#1' unknown}\@eha
    }%
    {%
%    \end{macrocode}
%    Now we have to define the macro |\|\meta{\#1}|+|\meta{\#2}
%    to contain |#3|. But since most of the time |#3| will be empty
%    we use |\let| in a tricky way rather than a simple |\def| since
%    this will save internal memory.
%    We store the argument |#3| in a temporary macro
%    |\reserved@a|.
%    \begin{macrocode}
     \def\reserved@a{#3}%
%    \end{macrocode}
%    We compare |\reserved@a| with |\@empty|
%    If these two are the same we |\let| the `extra'
%    macro equal to |\@empty| which is not the same a doing a |\let|
%    to |\reserved@a| --- the latter would blow one extra memory 
%    location rather  then reusing the one from |\@empty|.
%    \begin{macrocode}
     \global
     \expandafter\let\csname #1+#2\expandafter\endcsname
            \ifx \reserved@a\@empty
              \@empty
            \else \reserved@a
            \fi
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\cdp@list}
%    We initialize the code page list to be empty.
%    \begin{macrocode}
\let\cdp@list\@empty
\@onlypreamble\cdp@list
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cdp@elt}
%    \begin{macrocode}
\let\cdp@elt\relax
\@onlypreamble\cdp@elt
%    \end{macrocode}
% \end{macro}
%
%
%
%
% \begin{macro}{\DeclareFontEncoding}
%    \begin{macrocode}
\def\DeclareFontEncoding{%
%    \end{macrocode}
%    First we start with ignoring all blanks and newlines since every
%    surplus space in the second or third argument will come out in
%    a weird place in the document.  
% \changes{v2.1c}{1994/02/07}{revert catcode settings earlier}
% \changes{v2.1t}{1994/10/19}{Add missing \cs{relax}.}
% \changes{v2.1z}{1994/12/06}{use \cs{nfss@catcodes}}
%    \begin{macrocode}
   \begingroup
   \nfss@catcodes
   \expandafter\endgroup
   \DeclareFontEncoding@}
\@onlypreamble\DeclareFontEncoding
%    \end{macrocode}
% \changes{v2.0g}{1993/09/15}
%      {Corrected: \cs{default@T} to \cs{default@M}.}
%    \begin{macrocode}
\def\DeclareFontEncoding@#1#2#3{%
  \expandafter
  \ifx\csname T@#1\endcsname\relax
     \def\cdp@elt{\noexpand\cdp@elt}%
     \xdef\cdp@list{\cdp@list\cdp@elt{#1}%
                    {\default@family}{\default@series}%
                    {\default@shape}}%
%    \end{macrocode}
%    To support encoding dependent commands (like accents) we
%    initialise the command
% |\|\meta{encoding}|-cmd| to be |\@changed@cmd|.
%    (See \texttt{ltoutenc.dtx} for details.)
% \changes{v2.1l}{1994/05/13}{Init encoding change command}
% \changes{v2.1n}{1994/05/14}{Only init enc change cmd when
%                             new encoding}
% \changes{v2.1n}{1994/05/14}{Log if encoding is redeclared}
%    \begin{macrocode}
     \expandafter\let\csname#1-cmd\endcsname\@changed@cmd
  \else
     \@font@info{Redeclaring font encoding #1}%
  \fi
%    \end{macrocode}
%    
%    \begin{macrocode}
  \global\@namedef{T@#1}{#2}%
  \global\@namedef{M@#1}{\default@M#3}%
%    \end{macrocode}
%    Keep a record of the last encoding being declared:
% \changes{v3.0w}{1999/01/06}{Added \cs{LastDeclaredEncoding} to
%   support cyrillic integration (pr/2988)}
%    \begin{macrocode}
  \xdef\LastDeclaredEncoding{#1}%
  }
\@onlypreamble\DeclareFontEncoding@
%    \end{macrocode}
% \end{macro}
%
%    
% \begin{macro}{\LastDeclaredEncoding}
% \changes{v3.0w}{1999/01/06}{Added \cs{LastDeclaredEncoding} to
%   support cyrillic integration (pr/2988)}
%    The last encoding being declared by |\DeclareFontEncoding|.
%    \begin{macrocode}
\def\LastDeclaredEncoding{}
%    \end{macrocode}
% \end{macro}
%    
% \begin{macro}{\DeclareFontSubstitution}
%    \begin{macrocode}
\def\DeclareFontSubstitution#1#2#3#4{%
  \expandafter
  \ifx\csname T@#1\endcsname\relax
    \@latex@error{Encoding scheme  `#1' unknown}\@eha
  \else
    \begingroup
%    \end{macrocode}
% \changes{v3.0x}{2002/10/02}{Adding \cs{LastDeclaredEncoding}
%   introduced a bug as on some occasions that macro name was stored 
%   in the internal lists instead of the actual encoding. (pr/3459)}
%    We loop through the |\cdp@list| and rebuild it anew in |\toks@|
%    thereby replacing the defaults for the encoding in question with
%    the new defaults. It is important to store the encoding to test
%    against expanded in |\reserved@a| since it might just be
%    |\LastDeclaredEncoding| that is passed as |#1|.
%    \begin{macrocode}
       \edef\reserved@a{#1}%
       \toks@{}%
       \def\cdp@elt##1##2##3##4{%
          \def\reserved@b{##1}%
          \ifx\reserved@a\reserved@b
%    \end{macrocode}
%    Here we use the new defaults but we use |##1| (i.e., the encoding
%    name already stored previously) since we know that it is expanded.
%    \begin{macrocode}
             \addto@hook\toks@{\cdp@elt{##1}{#2}{#3}{#4}}%
          \else
%    \end{macrocode}
%    If |\reserved@a| and |\reserved@b| differ then we simply copy
%    from the old list to the new.
%    \begin{macrocode}
             \addto@hook\toks@{\cdp@elt{##1}{##2}{##3}{##4}}%
          \fi}%
        \cdp@list
        \xdef\cdp@list{\the\toks@}%
    \endgroup
    \global
    \@namedef{D@#1}{%
           \def\default@family{#2}%
           \def\default@series{#3}%
           \def\default@shape{#4}%
           }%
  \fi
 }
\@onlypreamble\DeclareFontSubstitution
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\DeclareFontEncodingDefaults}
%    \begin{macrocode}
\def\DeclareFontEncodingDefaults#1#2{%
  \ifx\relax#1\else
    \ifx\default@T\@empty\else
      \@font@info{Overwriting encoding scheme text defaults}%
    \fi
    \gdef\default@T{#1}%
  \fi
  \ifx\relax#2\else
    \ifx\default@M\@empty\else
      \@font@info{Overwriting encoding scheme math defaults}%
    \fi
    \gdef\default@M{#2}%
  \fi
}
\@onlypreamble\DeclareFontEncodingDefaults
%    \end{macrocode}
%  \end{macro}
%
%
% \begin{macro}{\default@T}
% \begin{macro}{\default@M}
%    \begin{macrocode}
\let\default@T\@empty
\let\default@M\@empty
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\DeclarePreloadSizes}
%    \begin{macrocode}
\def\DeclarePreloadSizes#1#2#3#4#5{%
 \@ifundefined{T@#1}%
   {\@latex@error{Encoding scheme  `#1' unknown}\@eha}%
   {%
%    \end{macrocode}
%    Don't know at the moment what this group here does!
%    \begin{macrocode}
   \begingroup
%    \end{macrocode}
%    We define a macro |\reserved@f|\footnote{We cannot use
%                                      {\ttfamily\bslash @tempa}
%                                      since it is needed in
%                                     {\ttfamily\bslash pickup@font}.}
%    that grabs the next \emph{size} and loads the corresponding
%    font.
%    This is done by delimiting |\reserved@f|'s only argument by the
%    \textsf{token} |,| (comma).
%    \begin{macrocode}
    \def\reserved@f##1,{%
%    \end{macrocode}
%    The end of the list will be detected when there are no more
%    elements, i.e.\ when |\reserved@f|'s argument is empty.
%    The trick used here is explained in Appendix~D of the
%    \TeX{}book: if the argument is empty the |\if|
%    will select the first clause and |\let| |\reserved@f|
%    equal to |\relax|.
%    (We use the |>| character here since it cannot appear
%    in font file names.)
% \changes{v1.2j}{1990/06/24}{Missing percent added.}
%    \begin{macrocode}
        \if>##1>%
          \let\reserved@f\relax
        \else
%    \end{macrocode}
%    Otherwise, we define |\font@name| appropriately and
%    call |\pickup@font| to do the work.
%    Note that the requested |\curr@fontshape|
%    combination must have been defined, or you will get an error.
%    The definition of |\font@name| is carried out globally
%    to be consistent with the rest of the code in this file.
%    \begin{macrocode}
          \xdef\font@name{\csname#1/#2/#3/#4/##1\endcsname}%
          \pickup@font
%    \end{macrocode}
%    Now we forget the name of the font just loaded.
%    More precisely, we set the corresponding control sequence
%    to |\relax|.  This means that later on, when the font
%    is first used, the macro |\define@newfont| is called
%    again to execute the `extra' macro for this font.
% \changes{v1.2d}{1990/01/27}{Font identifier set to \cs{relax}.}
%    \begin{macrocode}
          \global\expandafter\let\font@name\relax
        \fi
%    \end{macrocode}
%    Finally we call |\reserved@f| again to process the next
%    \emph{size}. If |\reserved@f| was |\let| equal to |\relax|
%    this will end the macro.
%    \begin{macrocode}
        \reserved@f}%
%    \end{macrocode}
%    We finish with reinserting the list of sizes after the 
%    |\reserved@f|
%    macro and appending an empty element so that the end of the list
%    is recognized properly.
%    \begin{macrocode}
     \reserved@f#5,,%
   \endgroup
   }%
}
\@onlypreamble\DeclarePreloadSizes
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\ifmath@fonts}
%    We need a switch to decide if we have to switch math fonts.
%    For this purpose we provide |\ifmath@fonts|
%    that can be set to true or false by the |\S@...| macros
%    depending on if math fonts
%    are provided for this size or not.
%    The default is of course to switch all fonts.
%    \begin{macrocode}
\newif\ifmath@fonts \math@fontstrue
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\DeclareMathSizes}
% \begin{macro}{\DeclareMathSizes*}
%    |\DeclareMathSizes| takes the text size, math text size, math
%    script size, and math scriptscript size as arguments and defines
%    the right |\S@|\dots{} macro.
%
%    \begin{macrocode}
\def\DeclareMathSizes{%
  \@ifstar{\@DeclareMathSizes\math@fontsfalse}%
          {\@DeclareMathSizes{}}}
\@onlypreamble\DeclareMathSizes
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@DeclareMathSizes}
% \changes{v3.0p}{1996/07/26}{use faster \cs{if} test}
%    \begin{macrocode}
\def\@DeclareMathSizes#1#2#3#4#5{%
    \@defaultunits\dimen@#2pt\relax\@nnil
    \if$#3$%
      \expandafter \let
        \csname S@\strip@pt\dimen@\endcsname
        \math@fontsfalse
    \else
      \expandafter \gdef
      \csname S@\strip@pt\dimen@\endcsname
            {\gdef\tf@size{#3}\gdef\sf@size{#4}%
                             \gdef\ssf@size{#5}%
             #1%
                             }%
    \fi}
\@onlypreamble\@DeclareMathSizes
%    \end{macrocode}
% \end{macro}
%
%
%
% \section{Selecting a new font}
%
% \subsection{Macros for the user}
%
%
% \begin{macro}{\fontencoding}
% \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
% \begin{macro}{\f@encoding}
% As we said in the introduction a font is described by four parameters.
% We first define macros to specify the wanted \emph{family},
% \emph{series}, or \emph{shape}.
% These are simply recorded in internal macros
% |\f@family|, |\f@series|, and |\f@shape|, resp.
% We use |\edef|'s so that the arguments can also be macros.
%    \begin{macrocode}
\DeclareRobustCommand\fontencoding[1]{%
    \expandafter\ifx\csname T@#1\endcsname\relax
      \@latex@error{Encoding scheme `#1' unknown}\@eha
    \else
      \edef\f@encoding{#1}%
      \ifx\cf@encoding\f@encoding
%    \end{macrocode}
%    If the new encoding is the same as the old 
%    encoding we have nothing to do.
%    However, in case we had a sequence of several encoding changes
%    without a |\selectfont| inbetween we can save processing by
%    making sure that |\enc@update| is |\relax|.
%    \begin{macrocode}
        \let\enc@update\relax
      \else
%    \end{macrocode}
%    If current and new encoding differ we define the macro 
%    |\enc@update|
%    to contain all updates necessary at |\selectfont| time.
%    \begin{macrocode}
        \let\enc@update\@@enc@update
      \fi
    \fi
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@@enc@update}
%    \begin{macrocode}
\def\@@enc@update{%
%    \end{macrocode}
%    When |\@@enc@update| is executed |\f@encoding| holds the encoding
%    name
%    for the new encoding and |\cf@encoding| the name of the last active
%    encoding.
%
%    We start by setting the init command for encoding dependent
%    macros to |\@changed@cmd|.
%    \begin{macrocode}
          \expandafter
          \let
            \csname\cf@encoding -cmd\endcsname
            \@changed@cmd
%    \end{macrocode}
%    Then we turn the one for the new encoding to |\@current@cmd| (see
%    \texttt{ltoutenc.dtx} for further explanations).
%    \begin{macrocode}
          \expandafter
          \let
            \csname\f@encoding-cmd\endcsname
            \@current@cmd
%    \end{macrocode}
%    We execute the default settings |\default@T|, followed by the one
%    for the new encoding.
%    \begin{macrocode}
        \default@T
        \csname T@\f@encoding\endcsname
%    \end{macrocode}
%    Finally we change the default substitution values, disable
%    |\enc@update| and make |\f@encoding| officially the current
%    encoding.
%    \begin{macrocode}
        \csname D@\f@encoding\endcsname
        \let\enc@update\relax
        \let\cf@encoding\f@encoding
}
%    \end{macrocode}
% \end{macro}
%
%
%  \begin{macro}{\enc@update}
% \changes{v2.1m}{1994/05/14}{Macro added}
%    The default action in |\selectfont| is to do nothing.
%    \begin{macrocode}
\let\enc@update\relax
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\fontfamily}
% \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
% \begin{macro}{\f@family}
% \begin{macro}{\fontseries}
% \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
% \begin{macro}{\f@series}
% \begin{macro}{\fontshape}
% \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
% \changes{v2.1y}{1994/11/30}{Use \cs{@current@cmd} in
%    \cs{@@enc@update}.  ASAJ.} 
% \begin{macro}{\f@shape}
%    \begin{macrocode}
\DeclareRobustCommand\fontfamily[1]{\edef\f@family{#1}}
\DeclareRobustCommand\fontseries[1]{\edef\f@series{#1}}
\DeclareRobustCommand\fontshape [1]{\edef\f@shape{#1}}
%    \end{macrocode}
%    Some handy abbreviation if you want to get some particular font
%    in the current size. If also the size should change one has to
%    issue a |\fontsize| comand first.
%    \begin{macrocode}
\def\usefont#1#2#3#4{\fontencoding{#1}\fontfamily{#2}%
             \fontseries{#3}\fontshape{#4}\selectfont
             \ignorespaces}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
%  \begin{macro}{\linespread}
% \changes{v2.1j}{1994/05/12}{New macro}
% \changes{v2.1p}{1994/05/16}{Remove surplus braces}
%    The comand |\linespread| changes the current |\baselinestretch|
%    by calling |\set@fontsize|. The values for |\f@size| and
%    |\f@baselineskip| will be left unchanged.
%    \begin{macrocode}
\DeclareRobustCommand\linespread[1]
   {\set@fontsize{#1}\f@size\f@baselineskip}
%    \end{macrocode}
%  \end{macro}
%
%
%  \begin{macro}{\fontsize}
% \changes{v2.1j}{1994/05/12}{Redefined to use \cs{set@fontsize}}
% \changes{v2.1p}{1994/05/16}{Pass \cs{baselinstretch} not
%    \cs{f@linespread}} 
%    We also define a macro that allows to specify a size.  In this
%    case, however, we also need the value of |\baselineskip|. As the
%    first argument to |\set@fontsize| we pass the current value of
%    |\baselinestretch|. This will either match the internal value (in
%    which case nothing changes, or it will be an updated value due to
%    a user change of that macro using |\renewcommand|. If we would
%    pass the internal |\f@linespread| such a change would be
%    efectively overwritten by a size change.
%    \begin{macrocode}
\DeclareRobustCommand\fontsize[2]
   {\set@fontsize\baselinestretch{#1}{#2}}
%    \end{macrocode}
%  \end{macro}
%
%
% \changes{v2.1n}{1994/05/14}{Set defaults for all \cs{f@...}}
%
%  \begin{macro}{\f@linespread}
% \changes{v2.1j}{1994/05/12}{New macro}
%    This macro holds the current internal value for
%    |\baselinestretch|.
%    \begin{macrocode}
\let\f@family\@empty
\let\f@series\@empty
\let\f@shape\@empty
\let\f@size\@empty
\let\f@baselineskip\@empty
\let\f@linespread\@empty
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\cf@encoding}
% \changes{v2.1u}{1994/11/06}{New macro}
%    \begin{macrocode}
\let\f@encoding\@empty
\let\cf@encoding\@empty
%    \end{macrocode}
%  \end{macro}
%
%
%
%  \begin{macro}{\@defaultunits}
%    
%    The function |\@defaultunits| when wrapped around a dimen or skip
%    assignment supplies default units. Usage:
%
%      |\@defaultunits\dimen@=#1pt\relax\@nnil|
%
%    Note: the |\relax| is *important*.  Other units can be substituted
%    for the `pt' if desired.
%
%    We use |\remove@to@nnil| as an auxiliary macros for
%    |\@defaultunits|. It just has to gobble the supplied default unit
%    `pt' or whatever, if it wasn't used in the assignment.
%    \begin{macrocode}
\def\@defaultunits{\afterassignment\remove@to@nnil}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\strip@pt}
%  \begin{macro}{\rem@pt}
%  This macro strips the characters |pt| produced by using |\the|
%  on a dimen register.
%    \begin{macrocode}
\begingroup
  \catcode`P=12
  \catcode`T=12
  \lowercase{
    \def\x{\def\rem@pt##1.##2PT{##1\ifnum##2>\z@.##2\fi}}}
  \expandafter\endgroup\x
\def\strip@pt{\expandafter\rem@pt\the}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%
% \begin{macro}{\mathversion}
% \changes{v1.0h}{1989/04/29}{Test if version defined added.}
% \changes{v1.0m}{1989/09/14}
%     {Corrected typo: \cs{endscname} to \cs{endcsname}.}
% \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
% \begin{macro}{\math@version}
%    |\mathversion| takes the math \emph{version} name as
%    argument, defines |\math@version| appropriately and switches
%    to the font selected
%    forcing a call to |\glb@settings| if the \emph{version} is
%    known to the system.
% \changes{v1.0p}{1989/11/14}{Math version prefix `mv@' added.}
% \changes{v1.0r}{1989/11/22}
%      {\cs{def} $\to$ \cs{edef} for \cs{math@version}.}
% \changes{v1.2g}{1990/02/16}{\cs{@nomath} added.}
% \changes{v2.1a}{1994/01/17}{New math font setup}
%    \begin{macrocode}
\DeclareRobustCommand\mathversion[1]
         {\@nomath\mathversion
          \expandafter\ifx\csname mv@#1\endcsname\relax 
          \@latex@error{Math version `#1' is not defined}\@eha\else
          \edef\math@version{#1}%
%    \end{macrocode}
%    We need to force a math font setup both now and at the point
%    where we return to the previous math version.
%    Forcing a math font setup can simply be done by setting
%    |\glb@currsize| to an invalid value since this will trigger the
%    setup when the formula starts.
%    \begin{macrocode}
          \gdef\glb@currsize{}%
%    \end{macrocode}
%    When the scope of the current |\mathversion| ends we need to
%    restore the old setup. However this time we need to force it
%    directly at least if we are inside math, otherwise we could wait.
%    Another way to enhance this code here is todo the setting only if
%    the version really has changed after all. This might be
%    interesting in case of \texttt{amstext} and \texttt{boldsymbol}.
% \changes{v2.1b}{1994/01/25}{Corrections for math setup} 
%    \begin{macrocode}
          \aftergroup\glb@settings
          \fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% 
% If \TeX{} would support a hook just before the end of a formula
% (opposite of |\everymath| so to speak) the implementation of the
% algorithm would be much simpler because in that case we would set up
% the correct math fonts at this point without having to worry about
% incorrect settings due to nesting. The same would be true if in
% \LaTeX{} the use of |$| (as the primitive \TeX{} command) would be
% impossible and instead only a higher-level interface would be
% available. Note that this does not mean that a |$| couldn't be the
% short-hand for starting and stopping that higher-level interface, it
% only means that the direct \TeX{} function must be hidden.
% 
% Anyway, since we don't have this and won't have it in \LaTeXe{} we
% need to implement it in a somewhat slower way.
% 
% 
% We test for the current math font setup on entry of a formula, 
% i.e., on the
% hooks |\everymath| and |\everydisplay|. But since these hooks may
% contain user data we provide ourselves with an internal version of
% these hooks which stays frozen.
% 
%
% \begin{macro}{\frozen@everymath}
% \changes{v2.1a}{1994/01/17}{New math font setup}
% \begin{macro}{\frozen@everydisplay}
%    New internal names for |\everymath| and |\everydisplay|.
%    \begin{macrocode}
\let\frozen@everymath\everymath
\let\frozen@everydisplay\everydisplay
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\everymath}
% \changes{v2.1a}{1994/01/17}{New math font setup}
% \begin{macro}{\everydisplay}
% \changes{v2.1a}{1994/01/17}{New math font setup}
%    Now we provide now user hooks that will be called in the
%    frozen internals.
%    \begin{macrocode}
\newtoks\everymath
\newtoks\everydisplay
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\frozen@everymath}
% \changes{v2.1a}{1994/01/17}{New math font setup}
%    Now we define the behaviour of the frozen hooks: first
%    check the math setup then call the user hook.
%    \begin{macrocode}
\frozen@everymath = {\check@mathfonts
                     \the\everymath}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\frozen@everydisplay}
% \changes{v2.1a}{1994/01/17}{New math font setup}
%    Ditto for the display hook.
%    \begin{macrocode}
\frozen@everydisplay = {\check@mathfonts
                        \the\everydisplay}
%    \end{macrocode}
% \end{macro}
%
% \changes{v3.0q}{1996/07/27}{\cs{if@inmath} switch removed}
%
%  \begin{macro}{\curr@math@size}
% \changes{v2.1a}{1994/01/17}{New math font setup}
%    This holds locally the current math size.
%    \begin{macrocode}
\let\curr@math@size\@empty
%    \end{macrocode}
%  \end{macro}
%
%
%
%
% \subsection{Macros for loading fonts}
%
% \begin{macro}{\pickup@font}
%    The macro |\pickup@font| which is used in
%    |\selectfont| is very simple:
%    if the font name is undefined (i.e.\ not known yet) it calls
%    |\define@newfont| to load it.
%    \begin{macrocode}
\def\pickup@font{%
    \expandafter \ifx \font@name \relax
       \define@newfont
    \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\split@name}
%    |\pickup@font| assumes that |\font@name| is set
%    but it is sometimes called when |\f@family|, |\f@series|,
%    |\f@shape|, or |\f@size| may have the wrong settings
%    (see, e.g., the definition of |\getanddefine@fonts|).
%    Therefore we need a macro to extract font \emph{family},
%    \emph{series}, \emph{shape}, and \emph{size} from the font name.
%    To this end we define |\split@name| which takes the font
%    name as a list of characters of |\catcode| 12 (without the
%    backslash at the beginning) delimited by the
%    special control sequence |\@nil|.
%    This is not very complicated: we first ensure that |/| has
%    the right |\catcode|
%    \begin{macrocode}
{\catcode`\/=12
%    \end{macrocode}
%    and define |\split@name| so that it will define our
%    private |\f@encoding|, |\f@family|, |\f@series|, |\f@shape|,
%    and |\f@size| macros.
% \changes{v1.9a}{1992/07/26}{Added splitting into \cs{f@encoding}.}
%    \begin{macrocode}
\gdef\split@name#1/#2/#3/#4/#5\@nil{\def\f@encoding{#1}%
                                    \def\f@family{#2}%
                                    \def\f@series{#3}%
                                    \def\f@shape{#4}%
                                    \def\f@size{#5}}}
%    \end{macrocode}
% \end{macro}
%
%
%  \begin{macro}{\curr@fontshape}
%    Abbreviation which may get removed again for speed.
% \changes{v1.9a}{1992/07/26}{}
%    \begin{macrocode}
\def\curr@fontshape{\f@encoding/\f@family/\f@series/\f@shape}
%</2ekernel|autoload>
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\define@newfont}
%    Now we can tackle the problem of defining a new font.
% \changes{v1.9a}{1992/07/26}{}
%    \begin{macrocode}
%<*2ekernel|def2|autoload>
\def\define@newfont{%
%    \end{macrocode}
%    We have already mentioned that the \textsf{token} list that
%    |\split@name| will get as argument must not start with
%    a backslash.
%    To reach this goal we will set the |\escapechar| to $-1$ so
%    that the |\string| primitive will not generate an
%    escape character.
%    To keep this change local we open a group.  We use
%    |\begingroup| for this purpose since |\define@newfont|
%    might be called in math mode, and an empty
%    |\bgroup|\ldots|\egroup| would add an empty Ord atom
%    to the math list and thus affect the spacing.
%
%    Also locally redefine |\typeout| so that `No file ...fd'
%    Warnings become Font Info message just sent to the log file.
% \changes{v1.0q}{1989/11/19}{Group added.}
% \changes{v3.0m}{1995/11/17}{Redefine \cs{typeout} latex/1676}
%    \begin{macrocode}
  \begingroup
    \let\typeout\@font@info
    \escapechar\m@ne
%    \end{macrocode}
%    Then we extract \emph{encoding scheme}, \emph{family},
%    \emph{series}, \emph{shape},
%    and \emph{size} from the font name.
%    Note the four |\expandafter|'s so that |\font@name| is
%    expanded first, then |\string|, and finally
%    |\split@name|.
%    \begin{macrocode}
    \expandafter\expandafter\expandafter
       \split@name\expandafter\string\font@name\@nil
%    \end{macrocode}
%    If the |\curr@fontshape| combination is not available,
%    (i.e.\ undefined) we call the macro |\wrong@fontshape| to take
%    care of this case.  Otherwise |\extract@font|
%    will load the external font for us.
% \changes{v1.2f}{1990/01/28}{Added call to \cs{curr@fontshape} macro
%      to allow substitution.}
%    \begin{macrocode}
%    \expandafter\ifx
%        \csname\curr@fontshape\endcsname \relax
      \try@load@fontshape % try always
%    \fi
    \expandafter\ifx
       \csname\curr@fontshape\endcsname \relax
      \wrong@fontshape\else
%    \end{macrocode}
%    To allow substitution we call the  |curr@fontshape| macro
%    which usually will expand to |\relax| but may hold code for
%    substitution (see |\subst@fontshape| definition).
%    \begin{macrocode}
%      \csname\curr@fontshape\endcsname
      \extract@font\fi
%    \end{macrocode}
%    We are nearly finished and must only restore the
%    |\escapechar| by closing the group.
%    \begin{macrocode}
  \endgroup}
%</2ekernel|def2|autoload>
%    \end{macrocode}
%
%
% As |autofss2.sty| only makes local definitions it is re-loaded
% for each font, to save some string memory in the kernel, and to
% speed up the loading of some packages which may load fonts
% The code is actually pre-loaded into the kernel and removed
% at |\begin{document}|. The |\ifx| test below ensures that 
% if |\usepackage{autofss2}| apears in the preamble, then  the code
% is not removed at this time. Can not use |\AtBeginDocument| here
% as it is not defined yet! Listing all the commands like this
% is not ideal as any changes to the |autofss2.sty| need to be
% reflected here, but this seems the most memory efficient mechanism
% as it avoids the use of an extra csname to store the list.
%
% This is currently disabled, so the `autofss2' code remains
% in the kernel, and |autofss2.sty| is not generated in the current
% public release.
% \changes{v3.0l}{1995/10/26}
%         {(DPC) disable autofss2 for now}
%    \begin{macrocode}
%<*autoloadxxx>
\expandafter\def\expandafter\@begindocumenthook\expandafter{%
  \expandafter\ifx\csname ver@autofss2.sty\endcsname\relax
  \gdef\define@newfont{%
    \begingroup
      \makeatletter\nfss@catcodes
      \catcode`\#6\relax
      \@@input autofss2.sty\relax\define@newfont
    \endgroup}%
  \begingroup
    \def\do##1{\global\let##1\@undefined}%
    \do\extract@sizefn
    \do\try@simple@size
    \do\set@simple@size@args
    \do\extract@rangefontinfo
    \do\is@range
    \do\check@range
    \do\check@single
    \do\set@size@funct@args
    \do\set@size@funct@args@
    \do\try@size@range
    \do\empty@sfcnt
    \do\gen@sfcnt
    \do\genb@sfcnt
    \do\sub@sfcnt
    \do\subf@sfcnt
    \do\fixed@sfcnt
  \endgroup
  \fi}
%</autoloadxxx>
%    \end{macrocode}
%
%    \begin{macrocode}
%<*2ekernel|autoload>
\def\try@load@fontshape{%
   \expandafter
   \ifx\csname \f@encoding+\f@family\endcsname\relax
     \@font@info{Try loading font information for
                   \f@encoding+\f@family}%
%    \end{macrocode}
%    We predefine this combination to be |\@empty| which means that
%    next time we don't try again unnecessary in case we don't find a
%    |.fd| file. If the file contains a |\DeclareFontFamily| command
%    than this setting will be overwritten.
% \changes{v2.1e}{1994/02/24}
%     {Separate restoration of catcodes for fd cmds}
% \changes{v2.1l}{1994/05/13}{Use \cs{@input@} for fd files}
%    \begin{macrocode}
    \global\expandafter\let
       \csname\f@encoding+\f@family\endcsname\@empty
%    \end{macrocode}
%    Set the catcodes used in the syntax, but do it only once (this
%    will be restored at the end of the font loading group).
% \changes{v3.0t}{1997/10/21}{Move \cs{makeatletter} to
%    \cs{nfss@catcodes}.}
%    \begin{macrocode}
     \nfss@catcodes
     \let\nfss@catcodes\relax
%    \end{macrocode}
%
% \changes{v3.0s}{1996/11/18}
%     {(DPC) lowercase fd file names. internal/1044}
%    For increased portability make the external filename
%    monocase, but look for the (old style) mixed case
%    filename if the first attempt fails.
%
%   On any monocase system this means that the file is looked for twice
%   which takes up time and string space, but at least for this release
%   Check for both names to give people time to re-install their private
%   fd files with lowercase names.
%    \begin{macrocode}
     \edef\reserved@a{%
       \lowercase{%
         \noexpand\InputIfFileExists{\f@encoding\f@family.fd}}}%
     \reserved@a\relax
          {\@input@{\f@encoding\f@family.fd}}%
   \fi}
%    \end{macrocode}
% \end{macro}
%
%
%  \begin{macro}{\nfss@catcodes}
% \changes{v2.1e}{1994/02/24}
%     {Separate restoration of catcodes for fd cmds}
%    This macro should contain the standard |\catcode| assignments to
%    all characters which are used in the commands found in an
%    \texttt{.fd} file and which might have special |\catcode|s in the
%    middle of a document. If necessary, this list can be extended in
%    a package file using a suitable number of |\expandafter|, i.e.,
%\begin{verbatim}
%  \expandafter\def\expandafter\nfss@catcodes
%        \expandafter{\nfss@catcodes <additional settings>}
%\end{verbatim}
%    Note, that this macro might get executed several times since it
%    is also called by |\DeclareFontShape|, thus it probably should
%    not be misused as a general purpose hook.
%    \begin{macrocode}
\def\nfss@catcodes{%
%    \end{macrocode}
%    We start by making |@| a letter and ignoring all blanks and newlines.
% \changes{v2.1z}{1994/12/06}{Added tab char as well}
% \changes{v3.0p}{1996/07/26}{omit \cs{relax} as not needed}
% \changes{v3.0t}{1997/10/21}{Moved \cs{makeatletter} from
%    \cs{try@load@font@shape}.}
%    \begin{macrocode}
     \makeatletter
     \catcode`\ 9%
     \catcode`\^^I9%
     \catcode`\^^M9%
%    \end{macrocode}
%    Then we set up |\|, |{|, |}|, |#| and |%| in case an \texttt{.fd}
%    file is loaded during a verbatim environment.
% \changes{v3.0n}{1995/11/27}{Reset hash, for definitions in fd files}
% \changes{v3.00}{1995/12/06}{Reset hat, for typeouts etc in fd files}
%    \begin{macrocode}
     \catcode`\\\z@
     \catcode`\{\@ne
     \catcode`\}\tw@
     \catcode`\#6%
     \catcode`\^7%
     \catcode`\%14%
%    \end{macrocode}
%    The we make sure that the important syntax parts have the right
%    |\catcode|.
% \changes{v2.1s}{1994/09/16}{Reset [ and ] as well, just in case}
% \changes{v3.0r}{1996/08/25}{Reset the acute, grave and double quote
%    chars as well} 
%    \begin{macrocode}
   \@makeother\<%
   \@makeother\>%
   \@makeother\*%
   \@makeother\.%
   \@makeother\-%
   \@makeother\/%
   \@makeother\[%
   \@makeother\]%
   \@makeother\`%
   \@makeother\'%
   \@makeother\"%
}
%    \end{macrocode}
%  \end{macro}
%
%
%  \begin{macro}{\DeclareErrorFont}
%    Declare the last resort shape! We assume that in this fontshape
%    there is a 10pt font but it doesn't really matter. We only loose
%    one macro name if the assumption is false. But at least the font
%    should be there!
%    \begin{macrocode}
\def\DeclareErrorFont#1#2#3#4#5{%
      \xdef\error@fontshape{%
          \noexpand\expandafter\noexpand\split@name\noexpand\string
          \expandafter\noexpand\csname#1/#2/#3/#4/#5\endcsname
          \noexpand\@nil}%
%    \end{macrocode}
%    Initialize all those internal variables which may or may not have
%    values in the first seconds of NFSS' bootstraping process. Later
%    on such values will be updated when an encoding is selected, etc.
%    
%    We definitely don't want to set |\f@encoding|; we can set all the
%    others since if they are left ``blank'' any selection would grap
%    ``error default values'' as well. However, this probably should
%    go also.
% \changes{v2.1n}{1994/05/14}{Don't set \cs{f@encoding}}
%    \begin{macrocode}
%      \gdef\f@encoding{#1}%
      \gdef\default@family{#2}%
      \gdef\default@series{#3}%
      \gdef\default@shape{#4}%
      \global\let\f@family\default@family
      \global\let\f@series\default@series
      \global\let\f@shape\default@shape
      \gdef\f@size{#5}%
      \gdef\f@baselineskip{#5pt}%
}
\@onlypreamble\DeclareErrorFont
%    \end{macrocode}
%  \end{macro}
%
%
% \begin{macro}{\wrong@fontshape}
%    Before we come to the macro |\extract@font| we have to take
%    care of unknown |\curr@fontshape| combinations.
%    The general strategy is to issue a warning and to try a default
%    \emph{shape}, then a default \emph{series},
%    and finally a default \emph{family}.
%    If this last one also fails \TeX{} will go into an infinite loop.
%    But if the defaults are set incorrectly one deserves nothing else!
% \changes{v1.9a}{1992/07/26}{}
%    \begin{macrocode}
\def\wrong@fontshape{%
    \csname D@\f@encoding\endcsname      % install defaults if in math
%    \end{macrocode}
%    We remember the wanted |\curr@fontshape| combination
%    which we will need in a moment.
%    \begin{macrocode}
    \edef\reserved@a{\csname\curr@fontshape\endcsname}%
  \ifx\last@fontshape\reserved@a
     \errmessage{Corrupted NFSS tables}%
     \error@fontshape
  \else
%    \end{macrocode}
%    Then we warn the user about the mess and set the shape to its
%    default.
% \changes{v1.0q}{1989/11/19}
%     {Instead of calling \cs{family}\cs{default@family},
%                           etc. we directly set \cs{f@family}, etc.}
% \changes{v1.2f}{1990/01/28}{Warning message slightly changed.}
%    \begin{macrocode}
    \let\f@shape\default@shape
%    \end{macrocode}
%    If the combination is not known, try the default \emph{series}.
%    \begin{macrocode}
    \expandafter\ifx\csname\curr@fontshape\endcsname\relax
       \let\f@series\default@series
%    \end{macrocode}
%    If this is still undefined, try the default \emph{family}.
%    Otherwise give up. We never try to change the encoding scheme!
% \changes{v1.9a}{1992/07/26}{}
%    \begin{macrocode}
        \expandafter
          \ifx\csname\curr@fontshape\endcsname\relax
           \let\f@family\default@family
        \fi \fi
  \fi
%    \end{macrocode}
%    At this point a valid |\curr@fontshape| combination must
%    have been found.
%    We inform the user about this fact.
%\changes{v3.0n}{1995/11/02}
%    {(DPC) Remove extra space with \cs{string} for latex/1676}
% \changes{v3.0m}{1995/11/17}
%    {Support \cs{@wrong@font@char} latex/1676}
%
% The |\expandafter\string| here stops \TeX\ adding the space
% that it usually puts after command names in messages. The similar
% construction with |\@undefined| just produces `undefined', but saves
% a few tokens.
%
% |\@wrong@font@char|  is locally redefined in |\UseTextSymbol| from
% its normal (empty) definition, to report the symbol generating the
% font switch.
%    \begin{macrocode}
     \@font@warning{Font shape `\expandafter\string\reserved@a' 
                     \expandafter\@gobble\string\@undefined\MessageBreak
                   using `\curr@fontshape' instead\@wrong@font@char}%
    \global\let\last@fontshape\reserved@a
%    \end{macrocode}
%    We change |\@defaultsubs| to produce a warning at the end of
%    the document.
% \changes{v3.0d}{1995/07/13}{Change a macro not a switch to flag
%         default font substitutions}
% \changes{v3.0k}{1995/10/24}{Make this code inline since it 
%         happens only here}
%    The macro |\@defaultsubs| is initially |\relax| but gets changed
%    here if some default font substitution happens.
%    It is then executed in |\enddocument|.
%    \begin{macrocode}
    \gdef\@defaultsubs{%
      \@font@warning{Some font shapes were not available, defaults
                      substituted.\@gobbletwo}}%
%    \end{macrocode}
%    If we substitute a |\curr@fontshape| combination
%    by the default one we don't want the warning to be printed out
%    whenever this (unknown) combination is used.
%    Therefore we globally |\let| the macro corresponding to
%    the wanted combination equal to its substitution.
%    This requires the use of four |\expandafter|'s
%    since |\csname|\dots|\endcsname| has to be
%    expanded before |\reserved@a| (i.e.\  the requested 
%    combination),
%    and this must happen before the |\let| is executed.
%    \begin{macrocode}
    \global\expandafter\expandafter\expandafter\let
       \expandafter\reserved@a
           \csname\curr@fontshape\endcsname
%    \end{macrocode}
%    Now we can redefine |\font@name| accordingly.
%    This \emph{must} be done globally since it might occur in the
%    group opened by |\define@newfont|.  If we would this
%    definition were local the closing |\endgroup| there
%    would restore the old meaning of |\font@name| and then
%    switch to the wrong font at the end of |\selectfont|
%    although the correct font was loaded.
%    \begin{macrocode}
    \xdef\font@name{%
      \csname\curr@fontshape/\f@size\endcsname}%
%    \end{macrocode}
%    The last thing this macro does is to call |\pickup@font|
%    again to load the font if it is not defined yet.
%    At this point this code will loop endlessly if
%    the defaults are not well defined.
%    \begin{macrocode}
    \pickup@font}
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\@wrong@font@char}
% \changes{v3.0m}{1995/11/17}{(DPC) Macro added. latex/1676}
%    Normally empty but redefined in |\UseTextSymbol| so that the
%    Font shape undefined message can refer to the symbol causing the
%    problem.
%    \begin{macrocode}
\let\@wrong@font@char\@empty
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\@@defaultsubs}
% \changes{v3.0d}{1995/07/13}{macro added}
% \changes{v3.0k}{1995/10/24}{macro removed}
%  \begin{macro}{\@defaultsubs}
% \changes{v3.0d}{1995/07/13}{macro added}
%    See above.
%    \begin{macrocode}
\let\@defaultsubs\relax
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%
% \begin{macro}{\strip@prefix}
%    In |\extract@font| we will need a way to recover the
%    replacement text of a macro.
%    This is done by the primitive |\meaning| together
%    with the macro |\strip@prefix| (for the details
%    see appendix~D of the \TeX{}book, p.\ 382).
%    \begin{macrocode}
\def\strip@prefix#1>{}
%    \end{macrocode}
% \end{macro}
%
% ^^A \extract@font
%
%
%
% \section{Assigning math fonts to \emph{versions}}
%
%
%  \begin{macro}{\install@mathalphabet}
%    This is just another name for |\gdef| but we can redefine it if
%    necessary later on.
%    \begin{macrocode}
\let\install@mathalphabet\gdef
%    \end{macrocode}
%  \end{macro}
%
%
%
%  \begin{macro}{\math@fonts}
%    
% \changes{v1.9a}{1992/07/26}{}
%    \begin{macrocode}
\let\math@fonts\@empty
%    \end{macrocode}
%  \end{macro}
%
%
%
% \begin{macro}{\select@group}
% \changes{v1.0t}{1989/11/26}{\cs{bgroup}/\cs{egroup} changed to
%   \cs{begingroup}/\cs{endgroup} to avoid empty Ord atom on math list.}
%    |\select@group| has four arguments: the new
%    \meta{math alphabet identifier} (a control sequence), the
%    \meta{math group number}, the extra macro for math mode
%    and the |\curr@fontshape| definition macro name.
%    We first check if we are in math mode.
% \changes{v1.1a}{1989/12/16}{\cs{relax} in front added.}
% \changes{v1.1a}{1989/12/16}{Now four arguments.}
%    \begin{macrocode}
%\def\select@group#1#2#3{\relax\ifmmode
%    \end{macrocode}
%    We do these things locally using |\begingroup| instead
%    of |\bgroup| to avoid the appearance of an empty Ord
%    atom on the math list.
%    \begin{macrocode}
%  \begingroup
%    \end{macrocode}
%    We set the math fonts for the \emph{family} in question by calling
%    |\getanddefine@fonts| in the correct environment.
% \changes{v1.9a}{1992/07/26}{}
%    \begin{macrocode}
%     \escapechar\m@ne
%    \getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3%
%    \end{macrocode}
%    We globally select the math fonts\dots
%    \begin{macrocode}
%    \globaldefs\@ne  \math@fonts
%    \end{macrocode}
%    \dots{} and close the group to
%    restore |\globaldefs| and |\escapechar|.
%    \begin{macrocode}
%  \endgroup
%    \end{macrocode}
%    As long as no \emph{size} or \emph{version} change occurs
%    the \meta{math alphabet identifier} should simply switch to the
%    installed \emph{math group} instead of calling
%    |\select@group|
%    unnecessarily. So we globally redefine the first argument
%    (the new \meta{math alphabet identifier})
%    to expand into a |\mathgroup| switch
%    and then select this \emph{alphabet}. Note that this redefinition
%    will be overwritten by the next call to a \emph{version} macro.
% \changes{v1.1a}{1989/12/16}{Usage of `\quotechar=' macro added.}
% \changes{v1.1a}{1989/12/16}{Redefinition of alphabet now simpler.}
% \changes{v1.2a}{1990/01/20}{Def for alph id changed.}
%    The original code for the end of |\select@group| was
%    \begin{verbatim}
%  \gdef#1{#3\mathgroup #2}#1\fi}
%\end{verbatim}
%    i.e.\ first redefining the \meta{math alphabet identifier} and
%    then calling the new definition to switch to the wanted
%    \meta{math group}. Now we define the \meta{math alphabet
%    identifier} as a call to the |\use@mathgroup| command.
% \changes{v1.2b}{1990/01/21}{Code moved to \cs{use@mathgroup}.}
%    \begin{macrocode}
%  \xdef#1{\noexpand\use@mathgroup\noexpand#2%
%          {\number\csname c@mv@\math@version\endcsname}}%
%    \end{macrocode}
%    \changes{v1.3c}{1992/05/12}{Added call to 
%             \cs{extract@alph@from@version}.}
%    But this is not sufficient, as we learned the hard way.
%    The problem here is that the loading of the fonts that comprise
%    the alphabet identifier |#1|, as well as the necessary math font
%    assignments is deferred until it is used. This is OK so far, but
%    if the fonts are switched within the current formula (which may
%    happen if a sub-formula is a box that contains a math version
%    switch) the font assignments for |#1| are not restored unless
%    |#1| is used again. This is disastrous since TeX sees the wrong
%    fonts at the end of the math formula, when it converts the math
%    list into a horizontal list.
%
%    This is taken into account as follows: When a math alphabet
%    identifier is used for the first time in a certain version
%    it modifies the corresponding macro |\mv@|\meta{version}
%    so that it calls |\getanddefine@fonts| directly in future as well.
%    We use the macro |\extract@alph@from@version| to do this.
%    It takes the math alphabet identifer |#1| and the math version
%    macro as arguments.    
% \changes{v1.9a}{1992/07/26}{}
%    \begin{macrocode}
%     \expandafter\extract@alph@from@version
%        \csname mv@\math@version\expandafter\endcsname
%       \expandafter{\number\csname c@mv@\math@version\endcsname}%
%       #1%
%     \stepcounter{mv@\math@version}%
%    \end{macrocode}
%    Finally, it is not possible to simply call the new definition
%    since we
%    have an argument (the third argument of |\use@mathgroup|
%    or more exactly the argument od |\math@egroup| if the {\ttfamily
%    margid} option is in force)
%    which would swallow our closing |\fi|.  So 
%    we use the |\expandafter| technique to remove the |\fi|
%    before the |\use@mathgroup| is expanded.
%    \begin{macrocode}
%\expandafter #1\fi}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\extract@alph@from@version}
%    \changes{v1.3c}{1992/05/12}{Macro added.}
%    We proceed to the definition of the
%    macro |\extract@alph@from@version|. As stated above, it takes
%    a math alphabet identifier and a math version macro
%    (e.g.\ |\mv@normal|) as its arguments.
%    \begin{macrocode}
\def\extract@alph@from@version#1#2#3{%
%    \end{macrocode}
%    To extract and replace the definition of math alphabet identifier
%    |#3| in macro |#1| we have to recall how this definition looks
%    like: Somewhere in the replacement text of |#1| there is
%    the sequence\\[2pt]
%    |\install@mathalphabet|\meta{math alphabet identifier} |#3||{%| \\
%      \hspace*{\MacroIndent}\hspace*{5mm}
%     \meta{Definitions for }|#3}| \\[2pt]
%    Hence, the first thing we do is to extract the tokens preceding
%    this definitions, the definition itself, and the tokens following
%    it. To this end we define one auxiliary macro |\reserved@a|.
%    \begin{macrocode}
     \def\reserved@a##1\install@mathalphabet#3##2##3\@nil{%
%    \end{macrocode}
%    When |\reserved@a| is expanded, it will have the tokens preceding
%    the definition in question in its first argument (|##1|), the
%    following tokens in its third argument (|##3|), and the replacement
%    text for the math alphabet identifier |#3| in its second argument.
%    (|##2|). This is then recorded for later use in a temporary macro
%    |\reserved@b|.
%    \begin{macrocode}
         \def\reserved@b{##2}%
%    \end{macrocode}
%    Additionally, we define a macro |\reserved@c| to reconstruct the
%    definitions for the math version in question from the tokens that
%    will remain unchanged (|##1| and |##3|) and the yet to build new
%    definitions for the math alphabet identifier |#3|.
%    \begin{macrocode}
         \def\reserved@c####1{\gdef#1{##1####1##3}}}%
%    \end{macrocode}
%    Then we execute our auxiliary macro.
%    \begin{macrocode}
     \expandafter\reserved@a#1\@nil
%    \end{macrocode}
%    OK, so now we have to build the new definition for |#3|. To do so,
%    we first extract the interesting parts out of the old one.
%    The old definition looks like:\\[2pt]
%    |\select@group|\meta{math alphabet identifier} \\
%      \hspace*{\MacroIndent}\hspace*{5mm}
%      \meta{math group number}\meta{math extra part}\\
%      \meta{|curr@fontshape| definition} \\[2pt]
%    So we define a new temporary macro |\reserved@a| that
%     extracts these parts.
%    \begin{macrocode}
     \def\reserved@a\select@group#3##1##2\@nil{%
%    \end{macrocode}
%    This macro can now directly rebuild the math version definition
%    by calling |\reserved@c|:
%    \begin{macrocode}
        \reserved@c{%
           \getanddefine@fonts{#2}##2%
           \install@mathalphabet#3{%
              \relax\ifmmode \else \non@alpherr#3\fi
              \use@mathgroup##1{#2}}}%
%    \end{macrocode}
% \changes{v2.1t}{1994/10/15}{Warn if math alpha is used outside math}
%    In addtion it defines the alphabet the way it should be used from
%    now on.
%    \begin{macrocode}
       \gdef#3{\relax\ifmmode \else \non@alpherr#3\fi
               \use@mathgroup##1{#2}}}%
%    \end{macrocode}
%    Finally, we only have to call this macro |\reserved@a| on the old
%    definitions recorded in |\reserved@b|:
%    \begin{macrocode}
     \expandafter\reserved@a\reserved@b\@nil
     }
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\math@bgroup}
% \changes{v1.2a}{1990/01/20}{Def. placed in this file.}
% \begin{macro}{\math@egroup}
% \changes{v1.2a}{1990/01/20}{Def. placed in this file.}
% \changes{v1.2h}{1990/03/30}{Changed to have one arg.}
% \changes{v2.2f}{1994/03/10}{Changed \cs{begingroup}/\cs{endgroup} to
%                             \cs{bgroup}/\cs{egroup}.}
%   Here are the default definitions for |\math@bgroup| and
%   |\math@egroup|. We use |\bgroup| instead of |\begingroup|
%   to avoid `leaking out' of style changes. This has the side
%   effect of always producing mathord atoms.
%    \begin{macrocode}
\let\math@bgroup\bgroup
\def\math@egroup#1{#1\egroup}
%</2ekernel|autoload>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\calculate@math@sizes}
% \changes{v2.1i}{1994/04/18}{Changed message to log only}
%    Here is the default definition for |\calculate@math@sizes|
%    a more elaborate interface
%    is under testing in mthscale.sty. 
%    \begin{macrocode}
%<*2ekernel|def1>
\gdef\calculate@math@sizes{%
  \@font@info{Calculating\space math\space sizes\space for\space
              size\space <\f@size>}%
  \dimen@\f@size \p@
  \@tempdimb \defaultscriptratio \dimen@
  \dimen@ \defaultscriptscriptratio \dimen@
  \expandafter\xdef\csname S@\f@size\endcsname{%
    \gdef\noexpand\tf@size{\f@size}%
    \gdef\noexpand\sf@size{\strip@pt\@tempdimb}%
    \gdef\noexpand\ssf@size{\strip@pt\dimen@}%
    \noexpand\math@fontstrue}}
%</2ekernel|def1>
%<*autoload>
\def\calculate@math@sizes{\try@sizes\calculate@math@sizes}
%</autoload>
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\defaultscriptratio}
% \changes{v2.1h}{1994/04/11}{Macro added}
% \begin{macro}{\defaultscriptscriptratio}
% \changes{v2.1h}{1994/04/11}{Macro added}
%    The default ratio for math
%    sizes is:\\
% 1 to |\defaultscriptratio| to |\defaultscriptscriptratio|.\\
%  By default this is 1 to .7 to .5.
%    \begin{macrocode}
%<*2ekernel|autoload>
\def\defaultscriptratio{.7}
\def\defaultscriptscriptratio{.5}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\noaccents@}
%    If we don't have a definition for |\noaccents@| we provide a
%    dummy.
%    \begin{macrocode}
\ifx\noaccents@\@undefined
  \let\noaccents@\@empty
\fi
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\showhyphens}
% \changes{v1.2l}{1990/06/30}{Macro added.}
% \changes{v2.0e}{1993/05/16}{Use \cs{reset@font}}
% \changes{v3.0h}{1995/10/10}
%    {Use \cs{normalfont} and make colour safe, and autoloadable}
% \changes{v3.0u}{1998/03/25}
%    {Suppress unnecessary error when used in preamble}
%    The |\showhyphens| command must be redefined since the version in
%    \texttt{plain.tex} uses |\tenrm|.  We have also made some further
%    adjustments for its use in \LaTeX.
%    \begin{macrocode}
%</2ekernel|autoload>
%<*2ekernel|autoerr>
\gdef\showhyphens#1{%
  \setbox0\vbox{%
    \color@begingroup
    \everypar{}%
    \parfillskip\z@skip\hsize\maxdimen
    \normalfont
    \pretolerance\m@ne\tolerance\m@ne\hbadness\z@\showboxdepth\z@\ #1%
    \color@endgroup}}
%</2ekernel|autoerr>
%<autoload>\def\showhyphens{\@autoerr\showhyphens}
%<*2ekernel|autoload>
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\addto@hook}
% \changes{v1.0u}{1989/12/05}{\cs{addto@hook} added.}
% \changes{v2.1d}{1994/02/10}{Made \cs{addto@hook} long.}
%    We need a macro to add tokens to a hook.
%    \begin{macrocode}
\long\def\addto@hook#1#2{#1\expandafter{\the#1#2}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@vpt}
% \changes{v2.1v}{1994/11/09}{(DPC) macros added, from setsize.dtx}
% \changes{v2.1v}{1994/11/09}{(DPC) reduce save stack usage latex/1742}
%    \begin{macrocode}
 \def\@vpt{5}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@vipt}
%    \begin{macrocode}
 \def\@vipt{6}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@viipt}
%    \begin{macrocode}
 \def\@viipt{7}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@viiipt}
%    \begin{macrocode}
 \def\@viiipt{8}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@ixpt}
%    \begin{macrocode}
 \def\@ixpt{9}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@xpt}
%    \begin{macrocode}
 \def\@xpt{10}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@xipt}
%    \begin{macrocode}
 \def\@xipt{10.95}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@xiipt}
%    \begin{macrocode}
 \def\@xiipt{12}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@xivpt}
%    \begin{macrocode}
 \def\@xivpt{14.4}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@xviipt}
%    \begin{macrocode}
 \def\@xviipt{17.28}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@xxpt}
%    \begin{macrocode}
 \def\@xxpt{20.74}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@xxvpt}
%    \begin{macrocode}
 \def\@xxvpt{24.88}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
%</2ekernel|autoload>
%    \end{macrocode}
%
% \Finale
%