updated
[latex2e.git] / base / ltfssbas.dtx
blob60007825c480374786bbfc395567c44db174eb6b
1 % \iffalse meta-comment
3 % Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009
4 % The LaTeX3 Project and any individual authors listed elsewhere
5 % in this file. 
6
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
9
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 %    http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX 
16 % version 2005/12/01 or later.
17
18 % This file has the LPPL maintenance status "maintained".
19
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
22 % information.
23
24 % The list of derived (unpacked) files belonging to the distribution 
25 % and covered by LPPL is defined by the unpacking scripts (with 
26 % extension .ins) which are part of the distribution.
27
28 % \fi
29 % \iffalse
30 %%% From File: ltfssbas.dtx
31 %% Copyright (C) 1989-2002 Frank Mittelbach and Rainer Sch\"opf
33 %<def1>\ProvidesFile{autofss1.sty}
34 %<def1>         [2002/10/02 v3.0x NFSS autoload file 1]
35 %<def2>\ProvidesFile{autofss2.sty}
36 %<def2>         [2002/10/02 v3.0x NFSS autoload file 2]
38 %<*driver>
39 % \fi
40
42 \ProvidesFile{ltfssbas.dtx}
43              [2002/10/02 v3.0x LaTeX Kernel (NFSS Basic Macros)]
44 % \iffalse
45 \documentclass{ltxdoc}
46 \begin{document}
47 \DocInput{ltfssbas.dtx}
48 \end{document}
49 %</driver>
50 % \fi
52 % \iffalse
53 %<+checkmem>\def\CHECKMEM{\tracingstats=2
54 %<+checkmem>  \newlinechar=`\^^J
55 %<+checkmem>  \message{^^JMemory usage: \filename}\shipout\hbox{}}
56 %<+checkmem>\CHECKMEM
57 % \fi
59 % \CheckSum{1089}
62 % \GetFileInfo{ltfssbas.dtx}
63 % \title{A new font selection scheme for \TeX{} macro packages\\
64 %        (Basic Macros)\thanks
65 %       {This file has version number
66 %       \fileversion\ dated \filedate}}
68 % \author{Frank Mittelbach \and Rainer Sch\"opf}
70 % \maketitle
72 % This file contains the main implementation of the `low level' font
73 % selection commands. See other parts of the \LaTeX\
74 % distribution, or  \emph{The \LaTeX\ Companion} for higher level
75 % documentation of the \LaTeX\ `New' Font Selection Scheme.
77 % \begin{quote}
78 %   \textbf{Warning:} 
79 %  The macro documentation is still basically the documentation from the
80 %  first NFSS release and therefore in some cases probably not
81 %  completely accurate.
82 % \end{quote}
84 % \StopEventually{}
86 % \changes{v3.0v}{1998/08/17}{(RmS) Documentation fixes.}
87 % \changes{v3.0j}{1995/10/22}{(RmS) New size function macro
88 %    \cs{genb@sfcnt} needs to be disabled at \cs{document}.}
89 % \changes{v3.0i}{1995/10/20}
90 %         {(DPC) Modify autoload code, change \cs{undefined}}
91 % \changes{v3.0g}{1995/10/04}{Modify autoload code}
92 % \changes{v3.0f}{1995/08/24}{Added autoload code}
93 % \changes{v3.0d}{1995/07/13}
94 %         {minor documentation changes}
95 % \changes{v3.0c}{1995/06/15}
96 %         {(DPC) minor documentation changes}
97 % \changes{v3.0a}{1995/05/24}
98 %         {(DPC) Make file from previous file, fam.dtx 1995/05/20 v2.2d}
101 % \changes{v2.1x}{1994/11/18}{(DPC) use \cs{reserved@f} not \cs{next}}
102 % \changes{v2.1q}{1994/05/20}{Use new error commands}
103 % \changes{v2.1o}{1994/05/15}{encoding cmds changed to {enc}-cmd}
104 % \changes{v2.1k}{1994/05/13}{Remove File identification `typeout'}
105 % \changes{v2.1j}{1994/05/12}{New baselinestretch concept}
106 % \changes{v2.1j}{1994/05/12}{Replaced hand-protected commands by
107 %                             \cs{DeclareRobustCommand} defs}
108 % \changes{v2.1h}{1994/04/11}{Added \cs{defaultscriptratio} and
109 %    \cs{defaultscriptscriptratio}.  ASAJ.}
110 % \changes{v2.1g}{1994/03/13}{add 2ekernel module to omit repeated code}
111 % \changes{v2.1a}{1994/01/17}{New math font setup}
112 % \changes{v2.0c}{1993/03/18}{Changed all \cs{@tempdima} in
113 %               \cs{@tempdimb} to avoid killing \cs{numberline}}
114 % \changes{v1.91a}{1992/09/22}{Introduced \cs{tf@size} for math size.}
115 % \changes{v1.3a}{1991/11/27}{All \cs{family}, \cs{shape} etc.
116 %                           renamed to \cs{fontfamily} etc.}
117 % \changes{v1.2i}{1990/04/01}{Code added from tracefnt.dtx.}
118 % \changes{v1.2i}{1990/04/01}{Support for TeX3.}
119 % \changes{v1.2g}{1990/02/16}{Support for changes of \cs{baselineskip}
120 %          without changing the size.}
121 %    
122 % \changes{v1.2c}{1990/01/23}{\cs{no@version@warning} renamed to
123 %                           \cs{no@alphabet@error}.}
124 % \changes{v1.0s}{1989/11/25}{All \cs{edef}\cs{font@name} changed to
125 %                           \cs{xdef}\cs{font@name}.
126 %                           Necessary after introduction of 
127 %                           \cs{begingroup}/\cs{endgroup} in v1.0q.}
128 % \changes{v1.0s}{1989/11/25}{extra// $\to$ + in \cs{extra@def}.}
129 % \changes{v1.0o}{1989/11/08}{First parameter of 
130 %                           \cs{define@mathalphabet}
131 %                           and \cs{define@mathgroup} changed
132 %                           from string to control sequence.}
133 % \changes{v1.0m}{1989/09/14}
134 %      {Global replacement: \cs{group} to \cs{mathgroup}}
135 % \changes{v1.0k}{1989/05/22}{Lines longer than 72 characters folded.}
136 % \changes{v1.0j}{1989/05/01}{Default for \cs{baselinestretch} added.}
137 % \changes{v1.0i}{1989/04/29}
138 %      {Removed the \cs{halign} \cs{noalign} correction
139 %                           (wasn't bugfree)}
140 % \changes{v1.0h}{1989/04/29}{Documented problem with \cs{halign}, and
141 %                           \cs{noalign}}
142 % \changes{v1.0g}{1989/04/27}{Documentation revised.}
143 % \changes{v1.0f}{1989/04/23}{\% in \cs{getanddefinefonts} added.}
144 % \changes{v1.0e}{1989/04/21}{Documentation is fun!!
145 %                       Parameters of \cs{define@mathalphabet} changed.}
146 % \changes{v1.0d}{1989/04/19}{Even more doc.}
147 % \changes{v1.0c}{1989/04/14}{More documentation added.}
148 % \changes{v1.0b}{1989/04/10}{\cs{preload@sizes} added.}
149 % \changes{v1.0b}{1989/04/10}{\cs{wrong@fontshape} changed to define
150 %                            substitution font/shape macro.}
151 % \changes{v1.0a}{1989/04/10}{Starting with version numbers!!
152 %                           \cs{ifmmode} added in \cs{math@group}}
153 % \changes{v2.1w}{1994/11/17}
154 %         {\cs{@tempa} to \cs{reserved@a}}
157 % \section{Autoloading parts of NFSS}
159 % This code is set up in a way that some parts of it can be kept
160 % separate and will only be loaded if needed.
162 % If we are producing an autoload version of \LaTeXe{} then all those
163 % parts with \textsf{def1} or \textsf{def2} docstrip guards will be 
164 % placed into the autoloadable files \texttt{autofss1.sty} and
165 % \texttt{autofss2.sty}.
167 % The `2ekernel' code ensures that a |\usepackage{autofss1}| is
168 % essentially ignored if a `full' format is being used that has
169 % picture mode already in the format.
171 % Note the |autofss2| loading is currently disabled.
173 %    \begin{macrocode}
174 %<2ekernel>\expandafter\let\csname ver@autofss1.sty\endcsname\fmtversion
175 %    \end{macrocode}
177 % The autoload file \texttt{autofss2} is a specialty because it
178 % contains
179 % code which will be completely local, ie loaded every time again.
181 % \section{Preliminary macros}
183 % We define a number
184 % of macros that will be used later.
187 % \begin{macro}{\@nomath}
188 %    |\@nomath| is used by most macros that will have no effect
189 %    in math mode. It issues a warning message.
190 %    \begin{macrocode}
191 %<*2ekernel|autoload>
192 \def\@nomath#1{\relax\ifmmode 
193    \@font@warning{Command \noexpand#1invalid in math mode}\fi}
194 %</2ekernel|autoload>
195 %    \end{macrocode}
196 % \end{macro}
198 % \changes{v1.2c}{1990/01/23}{Macro \cs{no@alphabet@help} added}
199 % \changes{v2.1i}{1994/04/18}{Macro \cs{no@alphabet@help}
200 %                             removed again}
202 % \begin{macro}{\no@alphabet@error}
203 % \changes{v1.2c}{1990/01/23}{Changed to error call}
204 % \changes{v2.1i}{1994/04/18}{Use std LaTeX error macro}
205 %    The macro |\no@alphabet@error| is called whenever
206 %    the user requests a math \emph{alphabet} that is not
207 %    available in the current \emph{version}.
208 %    In math mode an error message is produced otherwise the command
209 %    keeps silent.
210 %    The argument is the name of the control sequence that identifies
211 %    the math \emph{alphabet}.
212 %    The |\relax| at the beginning is necessary to prevent
213 %    \TeX{} from scanning too far in certain situations.
214 %    \begin{macrocode}
215 %<*2ekernel|def1>
216 \gdef\no@alphabet@error#1{\relax \ifmmode
217     \@latex@error{Math\space alphabet\space identifier\space
218           \noexpand#1is\space undefined\space in\space math\space
219            version\space `\math@version'}%
220         {Your\space requested\space math\space alphabet\space 
221          is\space undefined\space in\space the\space current\space
222           math\space version.^^JCheck\space the\space spelling\space
223           or\space use\space the\space \noexpand\SetMathAlphabet\space
224           command.}
225      \fi}
226 %</2ekernel|def1>
227 %<*autoload>
228 \gdef\no@alphabet@error{\relax \ifmmode
229     \expandafter\try@sizes\expandafter\no@alphabet@error \fi}
230 %</autoload>
231 %    \end{macrocode}
232 % \end{macro}
235 % \begin{macro}{\new@mathgroup}
236 % \begin{macro}{\mathgroup}
237 %    We also give a new name to |\newfam| and |\fam|
238 %    to avoid verbal confusion
239 %    (see the introduction).\footnote{For the same reason
240 %                           it seems advisable to
241 %                           {\ttfamily\bslash let\bslash fam} and
242 %                           {\ttfamily\bslash newfam}
243 %                           equal to {\ttfamily\bslash relax},
244 %                           but this is commented out to retain
245 %                           compatibility to existing style files.}
246 % \changes{v1.2e}{1990/01/28}{\cs{newfam} let to \cs{new@mathgroup}.}
247 % \changes{v3.0a}{1995/05/24}
248 %         {(DPC) No need to redefine \cs{newfam} as not outer}
249 % \changes{v3.0b}{1995/05/27}
250 %         {(FMi) But a need to define \cs{new@mathgroup}}
251 %    \begin{macrocode}
252 %<*2ekernel|autoload>
253 \def\new@mathgroup{\alloc@8\mathgroup\chardef\sixt@@n}
254 \let\mathgroup\fam
255 \let\newfam\new@mathgroup
256 \@onlypreamble\new@mathgroup
257 %    \end{macrocode}
258 % \end{macro}
259 % \end{macro}
262 % \section{Macros for setting up the tables}
264 %  \begin{macro}{\DeclareFontShape}
265 %    
266 % \changes{v1.9a}{1992/07/26}{Introduced \cs{DeclareFontShape}}
267 %    The macro |\DeclareFontShape| takes $6$ arguments:
268 %    \begin{macrocode}
269 \def\DeclareFontShape{\begingroup
270 %    \end{macrocode}
271 %    First we restore the catcodes of all characters used in the syntax.
272 % \changes{v2.1e}{1994/02/24}
273 %     {Separate restoration of catcodes for fd cmds}
274 %    \begin{macrocode}
275    \nfss@catcodes
276 %    \end{macrocode}
277 %    We use |\expandafter| |\endgroup| to restore catcode in case
278 %    something goes wrong with the argument parsing (suggested by Tim
279 %    Van Zandt)
280 %  \end{macro}
284 %  \begin{macro}{\DeclareFontShape}
285 % \changes{v2.1c}{1994/02/07}{revert catcode settings earlier}
286 % \changes{v3.0m}{1995/11/01}
287 %      {(DPC) Test for \cs{relax} not \cs{undefined}, internal/1933} 
288 %    \begin{macrocode}
289    \expandafter\endgroup
290    \DeclareFontShape@}
291 \def\DeclareFontShape@#1#2#3#4#5#6{%
292    \expandafter\ifx\csname #1+#2\endcsname\relax
293      \@latex@error{Font family `#1+#2' unknown}\@eha
294    \else
295      \expandafter
296        \xdef\csname#1/#2/#3/#4\endcsname{\expandafter\noexpand
297                                    \csname #5\endcsname}%
298      \def\reserved@a{#6}%
299      \global
300      \expandafter\let\csname#5\expandafter\endcsname
301         \ifx\reserved@a\@empty
302           \@empty
303         \else
304           \reserved@a
305         \fi
306    \fi
307   }
308 %    \end{macrocode}
309 %  \end{macro}
312 %  \begin{macro}{\DeclareFixedFont}
313 %    Define a direct font switch that avoids all overhead.
314 % \changes{v2.1u}{1994/11/06}{Renamed 
315 %                        \cs{every@size} to \cs{every@math@size}.}
316 %    \begin{macrocode}
317 \def\DeclareFixedFont#1#2#3#4#5#6{%
318    \begingroup
319       \math@fontsfalse
320       \every@math@size{}%
321       \fontsize{#6}\z@
322       \usefont{#2}{#3}{#4}{#5}%
323       \global\expandafter\let\expandafter#1\the\font
324    \endgroup
325   }
326 %</2ekernel|autoload>
327 %    \end{macrocode}
328 %  \end{macro}
333 %  \begin{macro}{\do@subst@correction}
334 %    
335 %    \begin{macrocode}
336 %<*2ekernel|autoload>
337 \def\do@subst@correction{%
338        \xdef\subst@correction{%
339           \font@name 
340           \global\expandafter\font
341             \csname \curr@fontshape/\f@size\endcsname
342             \noexpand\fontname\font
343            \relax}%
344 %    \end{macrocode}
345 %    Calling |\subst@correction| after the current group means calling
346 %    it after we have loaded the substitution font which is done
347 %    inside a group.
348 %    \begin{macrocode}
349        \aftergroup\subst@correction
351 %    \end{macrocode}
352 %  \end{macro}
354 % \begin{macro}{\DeclareFontFamily}
355 %    \begin{macrocode}
356 \def\DeclareFontFamily#1#2#3{%
357 %    \end{macrocode}
358 %    If we want fast checking for the encoding scheme we can just
359 %    check for |\T@..| being defined.
360 %    \begin{macrocode}
361 % \@tempswafalse
362 % \def\reserved@b{#1}%
363 % \def\cdp@elt##1##2##3##4{\def\reserved@c{##1}%
364 %      \ifx\reserved@b\reserved@c \@tempswatrue\fi}%
365 % \cdp@list
366 % \if@tempswa
367  \@ifundefined{T@#1}%
368     {%
369      \@latex@error{Encoding scheme  `#1' unknown}\@eha
370     }%
371     {%
372 %    \end{macrocode}
373 %    Now we have to define the macro |\|\meta{\#1}|+|\meta{\#2}
374 %    to contain |#3|. But since most of the time |#3| will be empty
375 %    we use |\let| in a tricky way rather than a simple |\def| since
376 %    this will save internal memory.
377 %    We store the argument |#3| in a temporary macro
378 %    |\reserved@a|.
379 %    \begin{macrocode}
380      \def\reserved@a{#3}%
381 %    \end{macrocode}
382 %    We compare |\reserved@a| with |\@empty|
383 %    If these two are the same we |\let| the `extra'
384 %    macro equal to |\@empty| which is not the same a doing a |\let|
385 %    to |\reserved@a| --- the latter would blow one extra memory 
386 %    location rather  then reusing the one from |\@empty|.
387 %    \begin{macrocode}
388      \global
389      \expandafter\let\csname #1+#2\expandafter\endcsname
390             \ifx \reserved@a\@empty
391               \@empty
392             \else \reserved@a
393             \fi
394     }%
396 %    \end{macrocode}
397 % \end{macro}
400 % \begin{macro}{\cdp@list}
401 %    We initialize the code page list to be empty.
402 %    \begin{macrocode}
403 \let\cdp@list\@empty
404 \@onlypreamble\cdp@list
405 %    \end{macrocode}
406 % \end{macro}
408 % \begin{macro}{\cdp@elt}
409 %    \begin{macrocode}
410 \let\cdp@elt\relax
411 \@onlypreamble\cdp@elt
412 %    \end{macrocode}
413 % \end{macro}
418 % \begin{macro}{\DeclareFontEncoding}
419 %    \begin{macrocode}
420 \def\DeclareFontEncoding{%
421 %    \end{macrocode}
422 %    First we start with ignoring all blanks and newlines since every
423 %    surplus space in the second or third argument will come out in
424 %    a weird place in the document.  
425 % \changes{v2.1c}{1994/02/07}{revert catcode settings earlier}
426 % \changes{v2.1t}{1994/10/19}{Add missing \cs{relax}.}
427 % \changes{v2.1z}{1994/12/06}{use \cs{nfss@catcodes}}
428 %    \begin{macrocode}
429    \begingroup
430    \nfss@catcodes
431    \expandafter\endgroup
432    \DeclareFontEncoding@}
433 \@onlypreamble\DeclareFontEncoding
434 %    \end{macrocode}
435 % \changes{v2.0g}{1993/09/15}
436 %      {Corrected: \cs{default@T} to \cs{default@M}.}
437 %    \begin{macrocode}
438 \def\DeclareFontEncoding@#1#2#3{%
439   \expandafter
440   \ifx\csname T@#1\endcsname\relax
441      \def\cdp@elt{\noexpand\cdp@elt}%
442      \xdef\cdp@list{\cdp@list\cdp@elt{#1}%
443                     {\default@family}{\default@series}%
444                     {\default@shape}}%
445 %    \end{macrocode}
446 %    To support encoding dependent commands (like accents) we
447 %    initialise the command
448 % |\|\meta{encoding}|-cmd| to be |\@changed@cmd|.
449 %    (See \texttt{ltoutenc.dtx} for details.)
450 % \changes{v2.1l}{1994/05/13}{Init encoding change command}
451 % \changes{v2.1n}{1994/05/14}{Only init enc change cmd when
452 %                             new encoding}
453 % \changes{v2.1n}{1994/05/14}{Log if encoding is redeclared}
454 %    \begin{macrocode}
455      \expandafter\let\csname#1-cmd\endcsname\@changed@cmd
456   \else
457      \@font@info{Redeclaring font encoding #1}%
458   \fi
459 %    \end{macrocode}
460 %    
461 %    \begin{macrocode}
462   \global\@namedef{T@#1}{#2}%
463   \global\@namedef{M@#1}{\default@M#3}%
464 %    \end{macrocode}
465 %    Keep a record of the last encoding being declared:
466 % \changes{v3.0w}{1999/01/06}{Added \cs{LastDeclaredEncoding} to
467 %   support cyrillic integration (pr/2988)}
468 %    \begin{macrocode}
469   \xdef\LastDeclaredEncoding{#1}%
470   }
471 \@onlypreamble\DeclareFontEncoding@
472 %    \end{macrocode}
473 % \end{macro}
475 %    
476 % \begin{macro}{\LastDeclaredEncoding}
477 % \changes{v3.0w}{1999/01/06}{Added \cs{LastDeclaredEncoding} to
478 %   support cyrillic integration (pr/2988)}
479 %    The last encoding being declared by |\DeclareFontEncoding|.
480 %    \begin{macrocode}
481 \def\LastDeclaredEncoding{}
482 %    \end{macrocode}
483 % \end{macro}
484 %    
485 % \begin{macro}{\DeclareFontSubstitution}
486 %    \begin{macrocode}
487 \def\DeclareFontSubstitution#1#2#3#4{%
488   \expandafter
489   \ifx\csname T@#1\endcsname\relax
490     \@latex@error{Encoding scheme  `#1' unknown}\@eha
491   \else
492     \begingroup
493 %    \end{macrocode}
494 % \changes{v3.0x}{2002/10/02}{Adding \cs{LastDeclaredEncoding}
495 %   introduced a bug as on some occasions that macro name was stored 
496 %   in the internal lists instead of the actual encoding. (pr/3459)}
497 %    We loop through the |\cdp@list| and rebuild it anew in |\toks@|
498 %    thereby replacing the defaults for the encoding in question with
499 %    the new defaults. It is important to store the encoding to test
500 %    against expanded in |\reserved@a| since it might just be
501 %    |\LastDeclaredEncoding| that is passed as |#1|.
502 %    \begin{macrocode}
503        \edef\reserved@a{#1}%
504        \toks@{}%
505        \def\cdp@elt##1##2##3##4{%
506           \def\reserved@b{##1}%
507           \ifx\reserved@a\reserved@b
508 %    \end{macrocode}
509 %    Here we use the new defaults but we use |##1| (i.e., the encoding
510 %    name already stored previously) since we know that it is expanded.
511 %    \begin{macrocode}
512              \addto@hook\toks@{\cdp@elt{##1}{#2}{#3}{#4}}%
513           \else
514 %    \end{macrocode}
515 %    If |\reserved@a| and |\reserved@b| differ then we simply copy
516 %    from the old list to the new.
517 %    \begin{macrocode}
518              \addto@hook\toks@{\cdp@elt{##1}{##2}{##3}{##4}}%
519           \fi}%
520         \cdp@list
521         \xdef\cdp@list{\the\toks@}%
522     \endgroup
523     \global
524     \@namedef{D@#1}{%
525            \def\default@family{#2}%
526            \def\default@series{#3}%
527            \def\default@shape{#4}%
528            }%
529   \fi
531 \@onlypreamble\DeclareFontSubstitution
532 %    \end{macrocode}
533 % \end{macro}
536 % \begin{macro}{\DeclareFontEncodingDefaults}
537 %    \begin{macrocode}
538 \def\DeclareFontEncodingDefaults#1#2{%
539   \ifx\relax#1\else
540     \ifx\default@T\@empty\else
541       \@font@info{Overwriting encoding scheme text defaults}%
542     \fi
543     \gdef\default@T{#1}%
544   \fi
545   \ifx\relax#2\else
546     \ifx\default@M\@empty\else
547       \@font@info{Overwriting encoding scheme math defaults}%
548     \fi
549     \gdef\default@M{#2}%
550   \fi
552 \@onlypreamble\DeclareFontEncodingDefaults
553 %    \end{macrocode}
554 %  \end{macro}
557 % \begin{macro}{\default@T}
558 % \begin{macro}{\default@M}
559 %    \begin{macrocode}
560 \let\default@T\@empty
561 \let\default@M\@empty
562 %    \end{macrocode}
563 % \end{macro}
564 % \end{macro}
567 % \begin{macro}{\DeclarePreloadSizes}
568 %    \begin{macrocode}
569 \def\DeclarePreloadSizes#1#2#3#4#5{%
570  \@ifundefined{T@#1}%
571    {\@latex@error{Encoding scheme  `#1' unknown}\@eha}%
572    {%
573 %    \end{macrocode}
574 %    Don't know at the moment what this group here does!
575 %    \begin{macrocode}
576    \begingroup
577 %    \end{macrocode}
578 %    We define a macro |\reserved@f|\footnote{We cannot use
579 %                                      {\ttfamily\bslash @tempa}
580 %                                      since it is needed in
581 %                                     {\ttfamily\bslash pickup@font}.}
582 %    that grabs the next \emph{size} and loads the corresponding
583 %    font.
584 %    This is done by delimiting |\reserved@f|'s only argument by the
585 %    \textsf{token} |,| (comma).
586 %    \begin{macrocode}
587     \def\reserved@f##1,{%
588 %    \end{macrocode}
589 %    The end of the list will be detected when there are no more
590 %    elements, i.e.\ when |\reserved@f|'s argument is empty.
591 %    The trick used here is explained in Appendix~D of the
592 %    \TeX{}book: if the argument is empty the |\if|
593 %    will select the first clause and |\let| |\reserved@f|
594 %    equal to |\relax|.
595 %    (We use the |>| character here since it cannot appear
596 %    in font file names.)
597 % \changes{v1.2j}{1990/06/24}{Missing percent added.}
598 %    \begin{macrocode}
599         \if>##1>%
600           \let\reserved@f\relax
601         \else
602 %    \end{macrocode}
603 %    Otherwise, we define |\font@name| appropriately and
604 %    call |\pickup@font| to do the work.
605 %    Note that the requested |\curr@fontshape|
606 %    combination must have been defined, or you will get an error.
607 %    The definition of |\font@name| is carried out globally
608 %    to be consistent with the rest of the code in this file.
609 %    \begin{macrocode}
610           \xdef\font@name{\csname#1/#2/#3/#4/##1\endcsname}%
611           \pickup@font
612 %    \end{macrocode}
613 %    Now we forget the name of the font just loaded.
614 %    More precisely, we set the corresponding control sequence
615 %    to |\relax|.  This means that later on, when the font
616 %    is first used, the macro |\define@newfont| is called
617 %    again to execute the `extra' macro for this font.
618 % \changes{v1.2d}{1990/01/27}{Font identifier set to \cs{relax}.}
619 %    \begin{macrocode}
620           \global\expandafter\let\font@name\relax
621         \fi
622 %    \end{macrocode}
623 %    Finally we call |\reserved@f| again to process the next
624 %    \emph{size}. If |\reserved@f| was |\let| equal to |\relax|
625 %    this will end the macro.
626 %    \begin{macrocode}
627         \reserved@f}%
628 %    \end{macrocode}
629 %    We finish with reinserting the list of sizes after the 
630 %    |\reserved@f|
631 %    macro and appending an empty element so that the end of the list
632 %    is recognized properly.
633 %    \begin{macrocode}
634      \reserved@f#5,,%
635    \endgroup
636    }%
638 \@onlypreamble\DeclarePreloadSizes
639 %    \end{macrocode}
640 % \end{macro}
644 % \begin{macro}{\ifmath@fonts}
645 %    We need a switch to decide if we have to switch math fonts.
646 %    For this purpose we provide |\ifmath@fonts|
647 %    that can be set to true or false by the |\S@...| macros
648 %    depending on if math fonts
649 %    are provided for this size or not.
650 %    The default is of course to switch all fonts.
651 %    \begin{macrocode}
652 \newif\ifmath@fonts \math@fontstrue
653 %    \end{macrocode}
654 % \end{macro}
658 % \begin{macro}{\DeclareMathSizes}
659 % \begin{macro}{\DeclareMathSizes*}
660 %    |\DeclareMathSizes| takes the text size, math text size, math
661 %    script size, and math scriptscript size as arguments and defines
662 %    the right |\S@|\dots{} macro.
664 %    \begin{macrocode}
665 \def\DeclareMathSizes{%
666   \@ifstar{\@DeclareMathSizes\math@fontsfalse}%
667           {\@DeclareMathSizes{}}}
668 \@onlypreamble\DeclareMathSizes
669 %    \end{macrocode}
670 % \end{macro}
671 % \end{macro}
673 % \begin{macro}{\@DeclareMathSizes}
674 % \changes{v3.0p}{1996/07/26}{use faster \cs{if} test}
675 %    \begin{macrocode}
676 \def\@DeclareMathSizes#1#2#3#4#5{%
677     \@defaultunits\dimen@#2pt\relax\@nnil
678     \if$#3$%
679       \expandafter \let
680         \csname S@\strip@pt\dimen@\endcsname
681         \math@fontsfalse
682     \else
683       \expandafter \gdef
684       \csname S@\strip@pt\dimen@\endcsname
685             {\gdef\tf@size{#3}\gdef\sf@size{#4}%
686                              \gdef\ssf@size{#5}%
687              #1%
688                              }%
689     \fi}
690 \@onlypreamble\@DeclareMathSizes
691 %    \end{macrocode}
692 % \end{macro}
696 % \section{Selecting a new font}
698 % \subsection{Macros for the user}
701 % \begin{macro}{\fontencoding}
702 % \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
703 % \begin{macro}{\f@encoding}
704 % As we said in the introduction a font is described by four parameters.
705 % We first define macros to specify the wanted \emph{family},
706 % \emph{series}, or \emph{shape}.
707 % These are simply recorded in internal macros
708 % |\f@family|, |\f@series|, and |\f@shape|, resp.
709 % We use |\edef|'s so that the arguments can also be macros.
710 %    \begin{macrocode}
711 \DeclareRobustCommand\fontencoding[1]{%
712     \expandafter\ifx\csname T@#1\endcsname\relax
713       \@latex@error{Encoding scheme `#1' unknown}\@eha
714     \else
715       \edef\f@encoding{#1}%
716       \ifx\cf@encoding\f@encoding
717 %    \end{macrocode}
718 %    If the new encoding is the same as the old 
719 %    encoding we have nothing to do.
720 %    However, in case we had a sequence of several encoding changes
721 %    without a |\selectfont| inbetween we can save processing by
722 %    making sure that |\enc@update| is |\relax|.
723 %    \begin{macrocode}
724         \let\enc@update\relax
725       \else
726 %    \end{macrocode}
727 %    If current and new encoding differ we define the macro 
728 %    |\enc@update|
729 %    to contain all updates necessary at |\selectfont| time.
730 %    \begin{macrocode}
731         \let\enc@update\@@enc@update
732       \fi
733     \fi
735 %    \end{macrocode}
736 % \end{macro}
737 % \end{macro}
739 % \begin{macro}{\@@enc@update}
740 %    \begin{macrocode}
741 \def\@@enc@update{%
742 %    \end{macrocode}
743 %    When |\@@enc@update| is executed |\f@encoding| holds the encoding
744 %    name
745 %    for the new encoding and |\cf@encoding| the name of the last active
746 %    encoding.
748 %    We start by setting the init command for encoding dependent
749 %    macros to |\@changed@cmd|.
750 %    \begin{macrocode}
751           \expandafter
752           \let
753             \csname\cf@encoding -cmd\endcsname
754             \@changed@cmd
755 %    \end{macrocode}
756 %    Then we turn the one for the new encoding to |\@current@cmd| (see
757 %    \texttt{ltoutenc.dtx} for further explanations).
758 %    \begin{macrocode}
759           \expandafter
760           \let
761             \csname\f@encoding-cmd\endcsname
762             \@current@cmd
763 %    \end{macrocode}
764 %    We execute the default settings |\default@T|, followed by the one
765 %    for the new encoding.
766 %    \begin{macrocode}
767         \default@T
768         \csname T@\f@encoding\endcsname
769 %    \end{macrocode}
770 %    Finally we change the default substitution values, disable
771 %    |\enc@update| and make |\f@encoding| officially the current
772 %    encoding.
773 %    \begin{macrocode}
774         \csname D@\f@encoding\endcsname
775         \let\enc@update\relax
776         \let\cf@encoding\f@encoding
778 %    \end{macrocode}
779 % \end{macro}
782 %  \begin{macro}{\enc@update}
783 % \changes{v2.1m}{1994/05/14}{Macro added}
784 %    The default action in |\selectfont| is to do nothing.
785 %    \begin{macrocode}
786 \let\enc@update\relax
787 %    \end{macrocode}
788 %  \end{macro}
790 % \begin{macro}{\fontfamily}
791 % \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
792 % \begin{macro}{\f@family}
793 % \begin{macro}{\fontseries}
794 % \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
795 % \begin{macro}{\f@series}
796 % \begin{macro}{\fontshape}
797 % \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
798 % \changes{v2.1y}{1994/11/30}{Use \cs{@current@cmd} in
799 %    \cs{@@enc@update}.  ASAJ.} 
800 % \begin{macro}{\f@shape}
801 %    \begin{macrocode}
802 \DeclareRobustCommand\fontfamily[1]{\edef\f@family{#1}}
803 \DeclareRobustCommand\fontseries[1]{\edef\f@series{#1}}
804 \DeclareRobustCommand\fontshape [1]{\edef\f@shape{#1}}
805 %    \end{macrocode}
806 %    Some handy abbreviation if you want to get some particular font
807 %    in the current size. If also the size should change one has to
808 %    issue a |\fontsize| comand first.
809 %    \begin{macrocode}
810 \def\usefont#1#2#3#4{\fontencoding{#1}\fontfamily{#2}%
811              \fontseries{#3}\fontshape{#4}\selectfont
812              \ignorespaces}
813 %    \end{macrocode}
814 % \end{macro}
815 % \end{macro}
816 % \end{macro}
817 % \end{macro}
818 % \end{macro}
819 % \end{macro}
822 %  \begin{macro}{\linespread}
823 % \changes{v2.1j}{1994/05/12}{New macro}
824 % \changes{v2.1p}{1994/05/16}{Remove surplus braces}
825 %    The comand |\linespread| changes the current |\baselinestretch|
826 %    by calling |\set@fontsize|. The values for |\f@size| and
827 %    |\f@baselineskip| will be left unchanged.
828 %    \begin{macrocode}
829 \DeclareRobustCommand\linespread[1]
830    {\set@fontsize{#1}\f@size\f@baselineskip}
831 %    \end{macrocode}
832 %  \end{macro}
835 %  \begin{macro}{\fontsize}
836 % \changes{v2.1j}{1994/05/12}{Redefined to use \cs{set@fontsize}}
837 % \changes{v2.1p}{1994/05/16}{Pass \cs{baselinstretch} not
838 %    \cs{f@linespread}} 
839 %    We also define a macro that allows to specify a size.  In this
840 %    case, however, we also need the value of |\baselineskip|. As the
841 %    first argument to |\set@fontsize| we pass the current value of
842 %    |\baselinestretch|. This will either match the internal value (in
843 %    which case nothing changes, or it will be an updated value due to
844 %    a user change of that macro using |\renewcommand|. If we would
845 %    pass the internal |\f@linespread| such a change would be
846 %    efectively overwritten by a size change.
847 %    \begin{macrocode}
848 \DeclareRobustCommand\fontsize[2]
849    {\set@fontsize\baselinestretch{#1}{#2}}
850 %    \end{macrocode}
851 %  \end{macro}
854 % \changes{v2.1n}{1994/05/14}{Set defaults for all \cs{f@...}}
856 %  \begin{macro}{\f@linespread}
857 % \changes{v2.1j}{1994/05/12}{New macro}
858 %    This macro holds the current internal value for
859 %    |\baselinestretch|.
860 %    \begin{macrocode}
861 \let\f@family\@empty
862 \let\f@series\@empty
863 \let\f@shape\@empty
864 \let\f@size\@empty
865 \let\f@baselineskip\@empty
866 \let\f@linespread\@empty
867 %    \end{macrocode}
868 %  \end{macro}
870 %  \begin{macro}{\cf@encoding}
871 % \changes{v2.1u}{1994/11/06}{New macro}
872 %    \begin{macrocode}
873 \let\f@encoding\@empty
874 \let\cf@encoding\@empty
875 %    \end{macrocode}
876 %  \end{macro}
880 %  \begin{macro}{\@defaultunits}
881 %    
882 %    The function |\@defaultunits| when wrapped around a dimen or skip
883 %    assignment supplies default units. Usage:
885 %      |\@defaultunits\dimen@=#1pt\relax\@nnil|
887 %    Note: the |\relax| is *important*.  Other units can be substituted
888 %    for the `pt' if desired.
890 %    We use |\remove@to@nnil| as an auxiliary macros for
891 %    |\@defaultunits|. It just has to gobble the supplied default unit
892 %    `pt' or whatever, if it wasn't used in the assignment.
893 %    \begin{macrocode}
894 \def\@defaultunits{\afterassignment\remove@to@nnil}
895 %    \end{macrocode}
896 %  \end{macro}
898 %  \begin{macro}{\strip@pt}
899 %  \begin{macro}{\rem@pt}
900 %  This macro strips the characters |pt| produced by using |\the|
901 %  on a dimen register.
902 %    \begin{macrocode}
903 \begingroup
904   \catcode`P=12
905   \catcode`T=12
906   \lowercase{
907     \def\x{\def\rem@pt##1.##2PT{##1\ifnum##2>\z@.##2\fi}}}
908   \expandafter\endgroup\x
909 \def\strip@pt{\expandafter\rem@pt\the}
910 %    \end{macrocode}
911 %  \end{macro}
912 %  \end{macro}
915 % \begin{macro}{\mathversion}
916 % \changes{v1.0h}{1989/04/29}{Test if version defined added.}
917 % \changes{v1.0m}{1989/09/14}
918 %     {Corrected typo: \cs{endscname} to \cs{endcsname}.}
919 % \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
920 % \begin{macro}{\math@version}
921 %    |\mathversion| takes the math \emph{version} name as
922 %    argument, defines |\math@version| appropriately and switches
923 %    to the font selected
924 %    forcing a call to |\glb@settings| if the \emph{version} is
925 %    known to the system.
926 % \changes{v1.0p}{1989/11/14}{Math version prefix `mv@' added.}
927 % \changes{v1.0r}{1989/11/22}
928 %      {\cs{def} $\to$ \cs{edef} for \cs{math@version}.}
929 % \changes{v1.2g}{1990/02/16}{\cs{@nomath} added.}
930 % \changes{v2.1a}{1994/01/17}{New math font setup}
931 %    \begin{macrocode}
932 \DeclareRobustCommand\mathversion[1]
933          {\@nomath\mathversion
934           \expandafter\ifx\csname mv@#1\endcsname\relax 
935           \@latex@error{Math version `#1' is not defined}\@eha\else
936           \edef\math@version{#1}%
937 %    \end{macrocode}
938 %    We need to force a math font setup both now and at the point
939 %    where we return to the previous math version.
940 %    Forcing a math font setup can simply be done by setting
941 %    |\glb@currsize| to an invalid value since this will trigger the
942 %    setup when the formula starts.
943 %    \begin{macrocode}
944           \gdef\glb@currsize{}%
945 %    \end{macrocode}
946 %    When the scope of the current |\mathversion| ends we need to
947 %    restore the old setup. However this time we need to force it
948 %    directly at least if we are inside math, otherwise we could wait.
949 %    Another way to enhance this code here is todo the setting only if
950 %    the version really has changed after all. This might be
951 %    interesting in case of \texttt{amstext} and \texttt{boldsymbol}.
952 % \changes{v2.1b}{1994/01/25}{Corrections for math setup} 
953 %    \begin{macrocode}
954           \aftergroup\glb@settings
955           \fi}
956 %    \end{macrocode}
957 % \end{macro}
958 % \end{macro}
961 % If \TeX{} would support a hook just before the end of a formula
962 % (opposite of |\everymath| so to speak) the implementation of the
963 % algorithm would be much simpler because in that case we would set up
964 % the correct math fonts at this point without having to worry about
965 % incorrect settings due to nesting. The same would be true if in
966 % \LaTeX{} the use of |$| (as the primitive \TeX{} command) would be
967 % impossible and instead only a higher-level interface would be
968 % available. Note that this does not mean that a |$| couldn't be the
969 % short-hand for starting and stopping that higher-level interface, it
970 % only means that the direct \TeX{} function must be hidden.
972 % Anyway, since we don't have this and won't have it in \LaTeXe{} we
973 % need to implement it in a somewhat slower way.
976 % We test for the current math font setup on entry of a formula, 
977 % i.e., on the
978 % hooks |\everymath| and |\everydisplay|. But since these hooks may
979 % contain user data we provide ourselves with an internal version of
980 % these hooks which stays frozen.
983 % \begin{macro}{\frozen@everymath}
984 % \changes{v2.1a}{1994/01/17}{New math font setup}
985 % \begin{macro}{\frozen@everydisplay}
986 %    New internal names for |\everymath| and |\everydisplay|.
987 %    \begin{macrocode}
988 \let\frozen@everymath\everymath
989 \let\frozen@everydisplay\everydisplay
990 %    \end{macrocode}
991 % \end{macro}
992 % \end{macro}
994 % \begin{macro}{\everymath}
995 % \changes{v2.1a}{1994/01/17}{New math font setup}
996 % \begin{macro}{\everydisplay}
997 % \changes{v2.1a}{1994/01/17}{New math font setup}
998 %    Now we provide now user hooks that will be called in the
999 %    frozen internals.
1000 %    \begin{macrocode}
1001 \newtoks\everymath
1002 \newtoks\everydisplay
1003 %    \end{macrocode}
1004 % \end{macro}
1005 % \end{macro}
1008 % \begin{macro}{\frozen@everymath}
1009 % \changes{v2.1a}{1994/01/17}{New math font setup}
1010 %    Now we define the behaviour of the frozen hooks: first
1011 %    check the math setup then call the user hook.
1012 %    \begin{macrocode}
1013 \frozen@everymath = {\check@mathfonts
1014                      \the\everymath}
1015 %    \end{macrocode}
1016 % \end{macro}
1019 % \begin{macro}{\frozen@everydisplay}
1020 % \changes{v2.1a}{1994/01/17}{New math font setup}
1021 %    Ditto for the display hook.
1022 %    \begin{macrocode}
1023 \frozen@everydisplay = {\check@mathfonts
1024                         \the\everydisplay}
1025 %    \end{macrocode}
1026 % \end{macro}
1028 % \changes{v3.0q}{1996/07/27}{\cs{if@inmath} switch removed}
1030 %  \begin{macro}{\curr@math@size}
1031 % \changes{v2.1a}{1994/01/17}{New math font setup}
1032 %    This holds locally the current math size.
1033 %    \begin{macrocode}
1034 \let\curr@math@size\@empty
1035 %    \end{macrocode}
1036 %  \end{macro}
1041 % \subsection{Macros for loading fonts}
1043 % \begin{macro}{\pickup@font}
1044 %    The macro |\pickup@font| which is used in
1045 %    |\selectfont| is very simple:
1046 %    if the font name is undefined (i.e.\ not known yet) it calls
1047 %    |\define@newfont| to load it.
1048 %    \begin{macrocode}
1049 \def\pickup@font{%
1050     \expandafter \ifx \font@name \relax
1051        \define@newfont
1052     \fi}
1053 %    \end{macrocode}
1054 % \end{macro}
1056 % \begin{macro}{\split@name}
1057 %    |\pickup@font| assumes that |\font@name| is set
1058 %    but it is sometimes called when |\f@family|, |\f@series|,
1059 %    |\f@shape|, or |\f@size| may have the wrong settings
1060 %    (see, e.g., the definition of |\getanddefine@fonts|).
1061 %    Therefore we need a macro to extract font \emph{family},
1062 %    \emph{series}, \emph{shape}, and \emph{size} from the font name.
1063 %    To this end we define |\split@name| which takes the font
1064 %    name as a list of characters of |\catcode| 12 (without the
1065 %    backslash at the beginning) delimited by the
1066 %    special control sequence |\@nil|.
1067 %    This is not very complicated: we first ensure that |/| has
1068 %    the right |\catcode|
1069 %    \begin{macrocode}
1070 {\catcode`\/=12
1071 %    \end{macrocode}
1072 %    and define |\split@name| so that it will define our
1073 %    private |\f@encoding|, |\f@family|, |\f@series|, |\f@shape|,
1074 %    and |\f@size| macros.
1075 % \changes{v1.9a}{1992/07/26}{Added splitting into \cs{f@encoding}.}
1076 %    \begin{macrocode}
1077 \gdef\split@name#1/#2/#3/#4/#5\@nil{\def\f@encoding{#1}%
1078                                     \def\f@family{#2}%
1079                                     \def\f@series{#3}%
1080                                     \def\f@shape{#4}%
1081                                     \def\f@size{#5}}}
1082 %    \end{macrocode}
1083 % \end{macro}
1086 %  \begin{macro}{\curr@fontshape}
1087 %    Abbreviation which may get removed again for speed.
1088 % \changes{v1.9a}{1992/07/26}{}
1089 %    \begin{macrocode}
1090 \def\curr@fontshape{\f@encoding/\f@family/\f@series/\f@shape}
1091 %</2ekernel|autoload>
1092 %    \end{macrocode}
1093 %  \end{macro}
1095 % \begin{macro}{\define@newfont}
1096 %    Now we can tackle the problem of defining a new font.
1097 % \changes{v1.9a}{1992/07/26}{}
1098 %    \begin{macrocode}
1099 %<*2ekernel|def2|autoload>
1100 \def\define@newfont{%
1101 %    \end{macrocode}
1102 %    We have already mentioned that the \textsf{token} list that
1103 %    |\split@name| will get as argument must not start with
1104 %    a backslash.
1105 %    To reach this goal we will set the |\escapechar| to $-1$ so
1106 %    that the |\string| primitive will not generate an
1107 %    escape character.
1108 %    To keep this change local we open a group.  We use
1109 %    |\begingroup| for this purpose since |\define@newfont|
1110 %    might be called in math mode, and an empty
1111 %    |\bgroup|\ldots|\egroup| would add an empty Ord atom
1112 %    to the math list and thus affect the spacing.
1114 %    Also locally redefine |\typeout| so that `No file ...fd'
1115 %    Warnings become Font Info message just sent to the log file.
1116 % \changes{v1.0q}{1989/11/19}{Group added.}
1117 % \changes{v3.0m}{1995/11/17}{Redefine \cs{typeout} latex/1676}
1118 %    \begin{macrocode}
1119   \begingroup
1120     \let\typeout\@font@info
1121     \escapechar\m@ne
1122 %    \end{macrocode}
1123 %    Then we extract \emph{encoding scheme}, \emph{family},
1124 %    \emph{series}, \emph{shape},
1125 %    and \emph{size} from the font name.
1126 %    Note the four |\expandafter|'s so that |\font@name| is
1127 %    expanded first, then |\string|, and finally
1128 %    |\split@name|.
1129 %    \begin{macrocode}
1130     \expandafter\expandafter\expandafter
1131        \split@name\expandafter\string\font@name\@nil
1132 %    \end{macrocode}
1133 %    If the |\curr@fontshape| combination is not available,
1134 %    (i.e.\ undefined) we call the macro |\wrong@fontshape| to take
1135 %    care of this case.  Otherwise |\extract@font|
1136 %    will load the external font for us.
1137 % \changes{v1.2f}{1990/01/28}{Added call to \cs{curr@fontshape} macro
1138 %      to allow substitution.}
1139 %    \begin{macrocode}
1140 %    \expandafter\ifx
1141 %        \csname\curr@fontshape\endcsname \relax
1142       \try@load@fontshape % try always
1143 %    \fi
1144     \expandafter\ifx
1145        \csname\curr@fontshape\endcsname \relax
1146       \wrong@fontshape\else
1147 %    \end{macrocode}
1148 %    To allow substitution we call the  |curr@fontshape| macro
1149 %    which usually will expand to |\relax| but may hold code for
1150 %    substitution (see |\subst@fontshape| definition).
1151 %    \begin{macrocode}
1152 %      \csname\curr@fontshape\endcsname
1153       \extract@font\fi
1154 %    \end{macrocode}
1155 %    We are nearly finished and must only restore the
1156 %    |\escapechar| by closing the group.
1157 %    \begin{macrocode}
1158   \endgroup}
1159 %</2ekernel|def2|autoload>
1160 %    \end{macrocode}
1163 % As |autofss2.sty| only makes local definitions it is re-loaded
1164 % for each font, to save some string memory in the kernel, and to
1165 % speed up the loading of some packages which may load fonts
1166 % The code is actually pre-loaded into the kernel and removed
1167 % at |\begin{document}|. The |\ifx| test below ensures that 
1168 % if |\usepackage{autofss2}| apears in the preamble, then  the code
1169 % is not removed at this time. Can not use |\AtBeginDocument| here
1170 % as it is not defined yet! Listing all the commands like this
1171 % is not ideal as any changes to the |autofss2.sty| need to be
1172 % reflected here, but this seems the most memory efficient mechanism
1173 % as it avoids the use of an extra csname to store the list.
1175 % This is currently disabled, so the `autofss2' code remains
1176 % in the kernel, and |autofss2.sty| is not generated in the current
1177 % public release.
1178 % \changes{v3.0l}{1995/10/26}
1179 %         {(DPC) disable autofss2 for now}
1180 %    \begin{macrocode}
1181 %<*autoloadxxx>
1182 \expandafter\def\expandafter\@begindocumenthook\expandafter{%
1183   \expandafter\ifx\csname ver@autofss2.sty\endcsname\relax
1184   \gdef\define@newfont{%
1185     \begingroup
1186       \makeatletter\nfss@catcodes
1187       \catcode`\#6\relax
1188       \@@input autofss2.sty\relax\define@newfont
1189     \endgroup}%
1190   \begingroup
1191     \def\do##1{\global\let##1\@undefined}%
1192     \do\extract@sizefn
1193     \do\try@simple@size
1194     \do\set@simple@size@args
1195     \do\extract@rangefontinfo
1196     \do\is@range
1197     \do\check@range
1198     \do\check@single
1199     \do\set@size@funct@args
1200     \do\set@size@funct@args@
1201     \do\try@size@range
1202     \do\empty@sfcnt
1203     \do\gen@sfcnt
1204     \do\genb@sfcnt
1205     \do\sub@sfcnt
1206     \do\subf@sfcnt
1207     \do\fixed@sfcnt
1208   \endgroup
1209   \fi}
1210 %</autoloadxxx>
1211 %    \end{macrocode}
1213 %    \begin{macrocode}
1214 %<*2ekernel|autoload>
1215 \def\try@load@fontshape{%
1216    \expandafter
1217    \ifx\csname \f@encoding+\f@family\endcsname\relax
1218      \@font@info{Try loading font information for
1219                    \f@encoding+\f@family}%
1220 %    \end{macrocode}
1221 %    We predefine this combination to be |\@empty| which means that
1222 %    next time we don't try again unnecessary in case we don't find a
1223 %    |.fd| file. If the file contains a |\DeclareFontFamily| command
1224 %    than this setting will be overwritten.
1225 % \changes{v2.1e}{1994/02/24}
1226 %     {Separate restoration of catcodes for fd cmds}
1227 % \changes{v2.1l}{1994/05/13}{Use \cs{@input@} for fd files}
1228 %    \begin{macrocode}
1229     \global\expandafter\let
1230        \csname\f@encoding+\f@family\endcsname\@empty
1231 %    \end{macrocode}
1232 %    Set the catcodes used in the syntax, but do it only once (this
1233 %    will be restored at the end of the font loading group).
1234 % \changes{v3.0t}{1997/10/21}{Move \cs{makeatletter} to
1235 %    \cs{nfss@catcodes}.}
1236 %    \begin{macrocode}
1237      \nfss@catcodes
1238      \let\nfss@catcodes\relax
1239 %    \end{macrocode}
1241 % \changes{v3.0s}{1996/11/18}
1242 %     {(DPC) lowercase fd file names. internal/1044}
1243 %    For increased portability make the external filename
1244 %    monocase, but look for the (old style) mixed case
1245 %    filename if the first attempt fails.
1247 %   On any monocase system this means that the file is looked for twice
1248 %   which takes up time and string space, but at least for this release
1249 %   Check for both names to give people time to re-install their private
1250 %   fd files with lowercase names.
1251 %    \begin{macrocode}
1252      \edef\reserved@a{%
1253        \lowercase{%
1254          \noexpand\InputIfFileExists{\f@encoding\f@family.fd}}}%
1255      \reserved@a\relax
1256           {\@input@{\f@encoding\f@family.fd}}%
1257    \fi}
1258 %    \end{macrocode}
1259 % \end{macro}
1262 %  \begin{macro}{\nfss@catcodes}
1263 % \changes{v2.1e}{1994/02/24}
1264 %     {Separate restoration of catcodes for fd cmds}
1265 %    This macro should contain the standard |\catcode| assignments to
1266 %    all characters which are used in the commands found in an
1267 %    \texttt{.fd} file and which might have special |\catcode|s in the
1268 %    middle of a document. If necessary, this list can be extended in
1269 %    a package file using a suitable number of |\expandafter|, i.e.,
1270 %\begin{verbatim}
1271 %  \expandafter\def\expandafter\nfss@catcodes
1272 %        \expandafter{\nfss@catcodes <additional settings>}
1273 %\end{verbatim}
1274 %    Note, that this macro might get executed several times since it
1275 %    is also called by |\DeclareFontShape|, thus it probably should
1276 %    not be misused as a general purpose hook.
1277 %    \begin{macrocode}
1278 \def\nfss@catcodes{%
1279 %    \end{macrocode}
1280 %    We start by making |@| a letter and ignoring all blanks and newlines.
1281 % \changes{v2.1z}{1994/12/06}{Added tab char as well}
1282 % \changes{v3.0p}{1996/07/26}{omit \cs{relax} as not needed}
1283 % \changes{v3.0t}{1997/10/21}{Moved \cs{makeatletter} from
1284 %    \cs{try@load@font@shape}.}
1285 %    \begin{macrocode}
1286      \makeatletter
1287      \catcode`\ 9%
1288      \catcode`\^^I9%
1289      \catcode`\^^M9%
1290 %    \end{macrocode}
1291 %    Then we set up |\|, |{|, |}|, |#| and |%| in case an \texttt{.fd}
1292 %    file is loaded during a verbatim environment.
1293 % \changes{v3.0n}{1995/11/27}{Reset hash, for definitions in fd files}
1294 % \changes{v3.00}{1995/12/06}{Reset hat, for typeouts etc in fd files}
1295 %    \begin{macrocode}
1296      \catcode`\\\z@
1297      \catcode`\{\@ne
1298      \catcode`\}\tw@
1299      \catcode`\#6%
1300      \catcode`\^7%
1301      \catcode`\%14%
1302 %    \end{macrocode}
1303 %    The we make sure that the important syntax parts have the right
1304 %    |\catcode|.
1305 % \changes{v2.1s}{1994/09/16}{Reset [ and ] as well, just in case}
1306 % \changes{v3.0r}{1996/08/25}{Reset the acute, grave and double quote
1307 %    chars as well} 
1308 %    \begin{macrocode}
1309    \@makeother\<%
1310    \@makeother\>%
1311    \@makeother\*%
1312    \@makeother\.%
1313    \@makeother\-%
1314    \@makeother\/%
1315    \@makeother\[%
1316    \@makeother\]%
1317    \@makeother\`%
1318    \@makeother\'%
1319    \@makeother\"%
1321 %    \end{macrocode}
1322 %  \end{macro}
1325 %  \begin{macro}{\DeclareErrorFont}
1326 %    Declare the last resort shape! We assume that in this fontshape
1327 %    there is a 10pt font but it doesn't really matter. We only loose
1328 %    one macro name if the assumption is false. But at least the font
1329 %    should be there!
1330 %    \begin{macrocode}
1331 \def\DeclareErrorFont#1#2#3#4#5{%
1332       \xdef\error@fontshape{%
1333           \noexpand\expandafter\noexpand\split@name\noexpand\string
1334           \expandafter\noexpand\csname#1/#2/#3/#4/#5\endcsname
1335           \noexpand\@nil}%
1336 %    \end{macrocode}
1337 %    Initialize all those internal variables which may or may not have
1338 %    values in the first seconds of NFSS' bootstraping process. Later
1339 %    on such values will be updated when an encoding is selected, etc.
1340 %    
1341 %    We definitely don't want to set |\f@encoding|; we can set all the
1342 %    others since if they are left ``blank'' any selection would grap
1343 %    ``error default values'' as well. However, this probably should
1344 %    go also.
1345 % \changes{v2.1n}{1994/05/14}{Don't set \cs{f@encoding}}
1346 %    \begin{macrocode}
1347 %      \gdef\f@encoding{#1}%
1348       \gdef\default@family{#2}%
1349       \gdef\default@series{#3}%
1350       \gdef\default@shape{#4}%
1351       \global\let\f@family\default@family
1352       \global\let\f@series\default@series
1353       \global\let\f@shape\default@shape
1354       \gdef\f@size{#5}%
1355       \gdef\f@baselineskip{#5pt}%
1357 \@onlypreamble\DeclareErrorFont
1358 %    \end{macrocode}
1359 %  \end{macro}
1362 % \begin{macro}{\wrong@fontshape}
1363 %    Before we come to the macro |\extract@font| we have to take
1364 %    care of unknown |\curr@fontshape| combinations.
1365 %    The general strategy is to issue a warning and to try a default
1366 %    \emph{shape}, then a default \emph{series},
1367 %    and finally a default \emph{family}.
1368 %    If this last one also fails \TeX{} will go into an infinite loop.
1369 %    But if the defaults are set incorrectly one deserves nothing else!
1370 % \changes{v1.9a}{1992/07/26}{}
1371 %    \begin{macrocode}
1372 \def\wrong@fontshape{%
1373     \csname D@\f@encoding\endcsname      % install defaults if in math
1374 %    \end{macrocode}
1375 %    We remember the wanted |\curr@fontshape| combination
1376 %    which we will need in a moment.
1377 %    \begin{macrocode}
1378     \edef\reserved@a{\csname\curr@fontshape\endcsname}%
1379   \ifx\last@fontshape\reserved@a
1380      \errmessage{Corrupted NFSS tables}%
1381      \error@fontshape
1382   \else
1383 %    \end{macrocode}
1384 %    Then we warn the user about the mess and set the shape to its
1385 %    default.
1386 % \changes{v1.0q}{1989/11/19}
1387 %     {Instead of calling \cs{family}\cs{default@family},
1388 %                           etc. we directly set \cs{f@family}, etc.}
1389 % \changes{v1.2f}{1990/01/28}{Warning message slightly changed.}
1390 %    \begin{macrocode}
1391     \let\f@shape\default@shape
1392 %    \end{macrocode}
1393 %    If the combination is not known, try the default \emph{series}.
1394 %    \begin{macrocode}
1395     \expandafter\ifx\csname\curr@fontshape\endcsname\relax
1396        \let\f@series\default@series
1397 %    \end{macrocode}
1398 %    If this is still undefined, try the default \emph{family}.
1399 %    Otherwise give up. We never try to change the encoding scheme!
1400 % \changes{v1.9a}{1992/07/26}{}
1401 %    \begin{macrocode}
1402         \expandafter
1403           \ifx\csname\curr@fontshape\endcsname\relax
1404            \let\f@family\default@family
1405         \fi \fi
1406   \fi
1407 %    \end{macrocode}
1408 %    At this point a valid |\curr@fontshape| combination must
1409 %    have been found.
1410 %    We inform the user about this fact.
1411 %\changes{v3.0n}{1995/11/02}
1412 %    {(DPC) Remove extra space with \cs{string} for latex/1676}
1413 % \changes{v3.0m}{1995/11/17}
1414 %    {Support \cs{@wrong@font@char} latex/1676}
1416 % The |\expandafter\string| here stops \TeX\ adding the space
1417 % that it usually puts after command names in messages. The similar
1418 % construction with |\@undefined| just produces `undefined', but saves
1419 % a few tokens.
1421 % |\@wrong@font@char|  is locally redefined in |\UseTextSymbol| from
1422 % its normal (empty) definition, to report the symbol generating the
1423 % font switch.
1424 %    \begin{macrocode}
1425      \@font@warning{Font shape `\expandafter\string\reserved@a' 
1426                      \expandafter\@gobble\string\@undefined\MessageBreak
1427                    using `\curr@fontshape' instead\@wrong@font@char}%
1428     \global\let\last@fontshape\reserved@a
1429 %    \end{macrocode}
1430 %    We change |\@defaultsubs| to produce a warning at the end of
1431 %    the document.
1432 % \changes{v3.0d}{1995/07/13}{Change a macro not a switch to flag
1433 %         default font substitutions}
1434 % \changes{v3.0k}{1995/10/24}{Make this code inline since it 
1435 %         happens only here}
1436 %    The macro |\@defaultsubs| is initially |\relax| but gets changed
1437 %    here if some default font substitution happens.
1438 %    It is then executed in |\enddocument|.
1439 %    \begin{macrocode}
1440     \gdef\@defaultsubs{%
1441       \@font@warning{Some font shapes were not available, defaults
1442                       substituted.\@gobbletwo}}%
1443 %    \end{macrocode}
1444 %    If we substitute a |\curr@fontshape| combination
1445 %    by the default one we don't want the warning to be printed out
1446 %    whenever this (unknown) combination is used.
1447 %    Therefore we globally |\let| the macro corresponding to
1448 %    the wanted combination equal to its substitution.
1449 %    This requires the use of four |\expandafter|'s
1450 %    since |\csname|\dots|\endcsname| has to be
1451 %    expanded before |\reserved@a| (i.e.\  the requested 
1452 %    combination),
1453 %    and this must happen before the |\let| is executed.
1454 %    \begin{macrocode}
1455     \global\expandafter\expandafter\expandafter\let
1456        \expandafter\reserved@a
1457            \csname\curr@fontshape\endcsname
1458 %    \end{macrocode}
1459 %    Now we can redefine |\font@name| accordingly.
1460 %    This \emph{must} be done globally since it might occur in the
1461 %    group opened by |\define@newfont|.  If we would this
1462 %    definition were local the closing |\endgroup| there
1463 %    would restore the old meaning of |\font@name| and then
1464 %    switch to the wrong font at the end of |\selectfont|
1465 %    although the correct font was loaded.
1466 %    \begin{macrocode}
1467     \xdef\font@name{%
1468       \csname\curr@fontshape/\f@size\endcsname}%
1469 %    \end{macrocode}
1470 %    The last thing this macro does is to call |\pickup@font|
1471 %    again to load the font if it is not defined yet.
1472 %    At this point this code will loop endlessly if
1473 %    the defaults are not well defined.
1474 %    \begin{macrocode}
1475     \pickup@font}
1476 %    \end{macrocode}
1477 % \end{macro}
1479 %  \begin{macro}{\@wrong@font@char}
1480 % \changes{v3.0m}{1995/11/17}{(DPC) Macro added. latex/1676}
1481 %    Normally empty but redefined in |\UseTextSymbol| so that the
1482 %    Font shape undefined message can refer to the symbol causing the
1483 %    problem.
1484 %    \begin{macrocode}
1485 \let\@wrong@font@char\@empty
1486 %    \end{macrocode}
1487 %  \end{macro}
1489 %  \begin{macro}{\@@defaultsubs}
1490 % \changes{v3.0d}{1995/07/13}{macro added}
1491 % \changes{v3.0k}{1995/10/24}{macro removed}
1492 %  \begin{macro}{\@defaultsubs}
1493 % \changes{v3.0d}{1995/07/13}{macro added}
1494 %    See above.
1495 %    \begin{macrocode}
1496 \let\@defaultsubs\relax
1497 %    \end{macrocode}
1498 %  \end{macro}
1499 %  \end{macro}
1502 % \begin{macro}{\strip@prefix}
1503 %    In |\extract@font| we will need a way to recover the
1504 %    replacement text of a macro.
1505 %    This is done by the primitive |\meaning| together
1506 %    with the macro |\strip@prefix| (for the details
1507 %    see appendix~D of the \TeX{}book, p.\ 382).
1508 %    \begin{macrocode}
1509 \def\strip@prefix#1>{}
1510 %    \end{macrocode}
1511 % \end{macro}
1513 % ^^A \extract@font
1517 % \section{Assigning math fonts to \emph{versions}}
1520 %  \begin{macro}{\install@mathalphabet}
1521 %    This is just another name for |\gdef| but we can redefine it if
1522 %    necessary later on.
1523 %    \begin{macrocode}
1524 \let\install@mathalphabet\gdef
1525 %    \end{macrocode}
1526 %  \end{macro}
1530 %  \begin{macro}{\math@fonts}
1531 %    
1532 % \changes{v1.9a}{1992/07/26}{}
1533 %    \begin{macrocode}
1534 \let\math@fonts\@empty
1535 %    \end{macrocode}
1536 %  \end{macro}
1540 % \begin{macro}{\select@group}
1541 % \changes{v1.0t}{1989/11/26}{\cs{bgroup}/\cs{egroup} changed to
1542 %   \cs{begingroup}/\cs{endgroup} to avoid empty Ord atom on math list.}
1543 %    |\select@group| has four arguments: the new
1544 %    \meta{math alphabet identifier} (a control sequence), the
1545 %    \meta{math group number}, the extra macro for math mode
1546 %    and the |\curr@fontshape| definition macro name.
1547 %    We first check if we are in math mode.
1548 % \changes{v1.1a}{1989/12/16}{\cs{relax} in front added.}
1549 % \changes{v1.1a}{1989/12/16}{Now four arguments.}
1550 %    \begin{macrocode}
1551 %\def\select@group#1#2#3{\relax\ifmmode
1552 %    \end{macrocode}
1553 %    We do these things locally using |\begingroup| instead
1554 %    of |\bgroup| to avoid the appearance of an empty Ord
1555 %    atom on the math list.
1556 %    \begin{macrocode}
1557 %  \begingroup
1558 %    \end{macrocode}
1559 %    We set the math fonts for the \emph{family} in question by calling
1560 %    |\getanddefine@fonts| in the correct environment.
1561 % \changes{v1.9a}{1992/07/26}{}
1562 %    \begin{macrocode}
1563 %     \escapechar\m@ne
1564 %    \getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3%
1565 %    \end{macrocode}
1566 %    We globally select the math fonts\dots
1567 %    \begin{macrocode}
1568 %    \globaldefs\@ne  \math@fonts
1569 %    \end{macrocode}
1570 %    \dots{} and close the group to
1571 %    restore |\globaldefs| and |\escapechar|.
1572 %    \begin{macrocode}
1573 %  \endgroup
1574 %    \end{macrocode}
1575 %    As long as no \emph{size} or \emph{version} change occurs
1576 %    the \meta{math alphabet identifier} should simply switch to the
1577 %    installed \emph{math group} instead of calling
1578 %    |\select@group|
1579 %    unnecessarily. So we globally redefine the first argument
1580 %    (the new \meta{math alphabet identifier})
1581 %    to expand into a |\mathgroup| switch
1582 %    and then select this \emph{alphabet}. Note that this redefinition
1583 %    will be overwritten by the next call to a \emph{version} macro.
1584 % \changes{v1.1a}{1989/12/16}{Usage of `\quotechar=' macro added.}
1585 % \changes{v1.1a}{1989/12/16}{Redefinition of alphabet now simpler.}
1586 % \changes{v1.2a}{1990/01/20}{Def for alph id changed.}
1587 %    The original code for the end of |\select@group| was
1588 %    \begin{verbatim}
1589 %  \gdef#1{#3\mathgroup #2}#1\fi}
1590 %\end{verbatim}
1591 %    i.e.\ first redefining the \meta{math alphabet identifier} and
1592 %    then calling the new definition to switch to the wanted
1593 %    \meta{math group}. Now we define the \meta{math alphabet
1594 %    identifier} as a call to the |\use@mathgroup| command.
1595 % \changes{v1.2b}{1990/01/21}{Code moved to \cs{use@mathgroup}.}
1596 %    \begin{macrocode}
1597 %  \xdef#1{\noexpand\use@mathgroup\noexpand#2%
1598 %          {\number\csname c@mv@\math@version\endcsname}}%
1599 %    \end{macrocode}
1600 %    \changes{v1.3c}{1992/05/12}{Added call to 
1601 %             \cs{extract@alph@from@version}.}
1602 %    But this is not sufficient, as we learned the hard way.
1603 %    The problem here is that the loading of the fonts that comprise
1604 %    the alphabet identifier |#1|, as well as the necessary math font
1605 %    assignments is deferred until it is used. This is OK so far, but
1606 %    if the fonts are switched within the current formula (which may
1607 %    happen if a sub-formula is a box that contains a math version
1608 %    switch) the font assignments for |#1| are not restored unless
1609 %    |#1| is used again. This is disastrous since TeX sees the wrong
1610 %    fonts at the end of the math formula, when it converts the math
1611 %    list into a horizontal list.
1613 %    This is taken into account as follows: When a math alphabet
1614 %    identifier is used for the first time in a certain version
1615 %    it modifies the corresponding macro |\mv@|\meta{version}
1616 %    so that it calls |\getanddefine@fonts| directly in future as well.
1617 %    We use the macro |\extract@alph@from@version| to do this.
1618 %    It takes the math alphabet identifer |#1| and the math version
1619 %    macro as arguments.    
1620 % \changes{v1.9a}{1992/07/26}{}
1621 %    \begin{macrocode}
1622 %     \expandafter\extract@alph@from@version
1623 %        \csname mv@\math@version\expandafter\endcsname
1624 %       \expandafter{\number\csname c@mv@\math@version\endcsname}%
1625 %       #1%
1626 %     \stepcounter{mv@\math@version}%
1627 %    \end{macrocode}
1628 %    Finally, it is not possible to simply call the new definition
1629 %    since we
1630 %    have an argument (the third argument of |\use@mathgroup|
1631 %    or more exactly the argument od |\math@egroup| if the {\ttfamily
1632 %    margid} option is in force)
1633 %    which would swallow our closing |\fi|.  So 
1634 %    we use the |\expandafter| technique to remove the |\fi|
1635 %    before the |\use@mathgroup| is expanded.
1636 %    \begin{macrocode}
1637 %\expandafter #1\fi}
1638 %    \end{macrocode}
1639 % \end{macro}
1642 % \begin{macro}{\extract@alph@from@version}
1643 %    \changes{v1.3c}{1992/05/12}{Macro added.}
1644 %    We proceed to the definition of the
1645 %    macro |\extract@alph@from@version|. As stated above, it takes
1646 %    a math alphabet identifier and a math version macro
1647 %    (e.g.\ |\mv@normal|) as its arguments.
1648 %    \begin{macrocode}
1649 \def\extract@alph@from@version#1#2#3{%
1650 %    \end{macrocode}
1651 %    To extract and replace the definition of math alphabet identifier
1652 %    |#3| in macro |#1| we have to recall how this definition looks
1653 %    like: Somewhere in the replacement text of |#1| there is
1654 %    the sequence\\[2pt]
1655 %    |\install@mathalphabet|\meta{math alphabet identifier} |#3||{%| \\
1656 %      \hspace*{\MacroIndent}\hspace*{5mm}
1657 %     \meta{Definitions for }|#3}| \\[2pt]
1658 %    Hence, the first thing we do is to extract the tokens preceding
1659 %    this definitions, the definition itself, and the tokens following
1660 %    it. To this end we define one auxiliary macro |\reserved@a|.
1661 %    \begin{macrocode}
1662      \def\reserved@a##1\install@mathalphabet#3##2##3\@nil{%
1663 %    \end{macrocode}
1664 %    When |\reserved@a| is expanded, it will have the tokens preceding
1665 %    the definition in question in its first argument (|##1|), the
1666 %    following tokens in its third argument (|##3|), and the replacement
1667 %    text for the math alphabet identifier |#3| in its second argument.
1668 %    (|##2|). This is then recorded for later use in a temporary macro
1669 %    |\reserved@b|.
1670 %    \begin{macrocode}
1671          \def\reserved@b{##2}%
1672 %    \end{macrocode}
1673 %    Additionally, we define a macro |\reserved@c| to reconstruct the
1674 %    definitions for the math version in question from the tokens that
1675 %    will remain unchanged (|##1| and |##3|) and the yet to build new
1676 %    definitions for the math alphabet identifier |#3|.
1677 %    \begin{macrocode}
1678          \def\reserved@c####1{\gdef#1{##1####1##3}}}%
1679 %    \end{macrocode}
1680 %    Then we execute our auxiliary macro.
1681 %    \begin{macrocode}
1682      \expandafter\reserved@a#1\@nil
1683 %    \end{macrocode}
1684 %    OK, so now we have to build the new definition for |#3|. To do so,
1685 %    we first extract the interesting parts out of the old one.
1686 %    The old definition looks like:\\[2pt]
1687 %    |\select@group|\meta{math alphabet identifier} \\
1688 %      \hspace*{\MacroIndent}\hspace*{5mm}
1689 %      \meta{math group number}\meta{math extra part}\\
1690 %      \meta{|curr@fontshape| definition} \\[2pt]
1691 %    So we define a new temporary macro |\reserved@a| that
1692 %     extracts these parts.
1693 %    \begin{macrocode}
1694      \def\reserved@a\select@group#3##1##2\@nil{%
1695 %    \end{macrocode}
1696 %    This macro can now directly rebuild the math version definition
1697 %    by calling |\reserved@c|:
1698 %    \begin{macrocode}
1699         \reserved@c{%
1700            \getanddefine@fonts{#2}##2%
1701            \install@mathalphabet#3{%
1702               \relax\ifmmode \else \non@alpherr#3\fi
1703               \use@mathgroup##1{#2}}}%
1704 %    \end{macrocode}
1705 % \changes{v2.1t}{1994/10/15}{Warn if math alpha is used outside math}
1706 %    In addtion it defines the alphabet the way it should be used from
1707 %    now on.
1708 %    \begin{macrocode}
1709        \gdef#3{\relax\ifmmode \else \non@alpherr#3\fi
1710                \use@mathgroup##1{#2}}}%
1711 %    \end{macrocode}
1712 %    Finally, we only have to call this macro |\reserved@a| on the old
1713 %    definitions recorded in |\reserved@b|:
1714 %    \begin{macrocode}
1715      \expandafter\reserved@a\reserved@b\@nil
1716      }
1717 %    \end{macrocode}
1718 % \end{macro}
1722 % \begin{macro}{\math@bgroup}
1723 % \changes{v1.2a}{1990/01/20}{Def. placed in this file.}
1724 % \begin{macro}{\math@egroup}
1725 % \changes{v1.2a}{1990/01/20}{Def. placed in this file.}
1726 % \changes{v1.2h}{1990/03/30}{Changed to have one arg.}
1727 % \changes{v2.2f}{1994/03/10}{Changed \cs{begingroup}/\cs{endgroup} to
1728 %                             \cs{bgroup}/\cs{egroup}.}
1729 %   Here are the default definitions for |\math@bgroup| and
1730 %   |\math@egroup|. We use |\bgroup| instead of |\begingroup|
1731 %   to avoid `leaking out' of style changes. This has the side
1732 %   effect of always producing mathord atoms.
1733 %    \begin{macrocode}
1734 \let\math@bgroup\bgroup
1735 \def\math@egroup#1{#1\egroup}
1736 %</2ekernel|autoload>
1737 %    \end{macrocode}
1738 % \end{macro}
1739 % \end{macro}
1742 % \begin{macro}{\calculate@math@sizes}
1743 % \changes{v2.1i}{1994/04/18}{Changed message to log only}
1744 %    Here is the default definition for |\calculate@math@sizes|
1745 %    a more elaborate interface
1746 %    is under testing in mthscale.sty. 
1747 %    \begin{macrocode}
1748 %<*2ekernel|def1>
1749 \gdef\calculate@math@sizes{%
1750   \@font@info{Calculating\space math\space sizes\space for\space
1751               size\space <\f@size>}%
1752   \dimen@\f@size \p@
1753   \@tempdimb \defaultscriptratio \dimen@
1754   \dimen@ \defaultscriptscriptratio \dimen@
1755   \expandafter\xdef\csname S@\f@size\endcsname{%
1756     \gdef\noexpand\tf@size{\f@size}%
1757     \gdef\noexpand\sf@size{\strip@pt\@tempdimb}%
1758     \gdef\noexpand\ssf@size{\strip@pt\dimen@}%
1759     \noexpand\math@fontstrue}}
1760 %</2ekernel|def1>
1761 %<*autoload>
1762 \def\calculate@math@sizes{\try@sizes\calculate@math@sizes}
1763 %</autoload>
1764 %    \end{macrocode}
1765 %  \end{macro}
1767 % \begin{macro}{\defaultscriptratio}
1768 % \changes{v2.1h}{1994/04/11}{Macro added}
1769 % \begin{macro}{\defaultscriptscriptratio}
1770 % \changes{v2.1h}{1994/04/11}{Macro added}
1771 %    The default ratio for math
1772 %    sizes is:\\
1773 % 1 to |\defaultscriptratio| to |\defaultscriptscriptratio|.\\
1774 %  By default this is 1 to .7 to .5.
1775 %    \begin{macrocode}
1776 %<*2ekernel|autoload>
1777 \def\defaultscriptratio{.7}
1778 \def\defaultscriptscriptratio{.5}
1779 %    \end{macrocode}
1780 %  \end{macro}
1781 %  \end{macro}
1783 %  \begin{macro}{\noaccents@}
1784 %    If we don't have a definition for |\noaccents@| we provide a
1785 %    dummy.
1786 %    \begin{macrocode}
1787 \ifx\noaccents@\@undefined
1788   \let\noaccents@\@empty
1790 %    \end{macrocode}
1791 % \end{macro}
1793 % \begin{macro}{\showhyphens}
1794 % \changes{v1.2l}{1990/06/30}{Macro added.}
1795 % \changes{v2.0e}{1993/05/16}{Use \cs{reset@font}}
1796 % \changes{v3.0h}{1995/10/10}
1797 %    {Use \cs{normalfont} and make colour safe, and autoloadable}
1798 % \changes{v3.0u}{1998/03/25}
1799 %    {Suppress unnecessary error when used in preamble}
1800 %    The |\showhyphens| command must be redefined since the version in
1801 %    \texttt{plain.tex} uses |\tenrm|.  We have also made some further
1802 %    adjustments for its use in \LaTeX.
1803 %    \begin{macrocode}
1804 %</2ekernel|autoload>
1805 %<*2ekernel|autoerr>
1806 \gdef\showhyphens#1{%
1807   \setbox0\vbox{%
1808     \color@begingroup
1809     \everypar{}%
1810     \parfillskip\z@skip\hsize\maxdimen
1811     \normalfont
1812     \pretolerance\m@ne\tolerance\m@ne\hbadness\z@\showboxdepth\z@\ #1%
1813     \color@endgroup}}
1814 %</2ekernel|autoerr>
1815 %<autoload>\def\showhyphens{\@autoerr\showhyphens}
1816 %<*2ekernel|autoload>
1817 %    \end{macrocode}
1818 % \end{macro}
1821 % \begin{macro}{\addto@hook}
1822 % \changes{v1.0u}{1989/12/05}{\cs{addto@hook} added.}
1823 % \changes{v2.1d}{1994/02/10}{Made \cs{addto@hook} long.}
1824 %    We need a macro to add tokens to a hook.
1825 %    \begin{macrocode}
1826 \long\def\addto@hook#1#2{#1\expandafter{\the#1#2}}
1827 %    \end{macrocode}
1828 % \end{macro}
1831 % \begin{macro}{\@vpt}
1832 % \changes{v2.1v}{1994/11/09}{(DPC) macros added, from setsize.dtx}
1833 % \changes{v2.1v}{1994/11/09}{(DPC) reduce save stack usage latex/1742}
1834 %    \begin{macrocode}
1835  \def\@vpt{5}
1836 %    \end{macrocode}
1837 % \end{macro}
1839 % \begin{macro}{\@vipt}
1840 %    \begin{macrocode}
1841  \def\@vipt{6}
1842 %    \end{macrocode}
1843 % \end{macro}
1845 % \begin{macro}{\@viipt}
1846 %    \begin{macrocode}
1847  \def\@viipt{7}
1848 %    \end{macrocode}
1849 % \end{macro}
1851 % \begin{macro}{\@viiipt}
1852 %    \begin{macrocode}
1853  \def\@viiipt{8}
1854 %    \end{macrocode}
1855 % \end{macro}
1857 % \begin{macro}{\@ixpt}
1858 %    \begin{macrocode}
1859  \def\@ixpt{9}
1860 %    \end{macrocode}
1861 % \end{macro}
1863 % \begin{macro}{\@xpt}
1864 %    \begin{macrocode}
1865  \def\@xpt{10}
1866 %    \end{macrocode}
1867 % \end{macro}
1869 % \begin{macro}{\@xipt}
1870 %    \begin{macrocode}
1871  \def\@xipt{10.95}
1872 %    \end{macrocode}
1873 % \end{macro}
1875 % \begin{macro}{\@xiipt}
1876 %    \begin{macrocode}
1877  \def\@xiipt{12}
1878 %    \end{macrocode}
1879 % \end{macro}
1881 % \begin{macro}{\@xivpt}
1882 %    \begin{macrocode}
1883  \def\@xivpt{14.4}
1884 %    \end{macrocode}
1885 % \end{macro}
1887 % \begin{macro}{\@xviipt}
1888 %    \begin{macrocode}
1889  \def\@xviipt{17.28}
1890 %    \end{macrocode}
1891 % \end{macro}
1893 % \begin{macro}{\@xxpt}
1894 %    \begin{macrocode}
1895  \def\@xxpt{20.74}
1896 %    \end{macrocode}
1897 % \end{macro}
1899 % \begin{macro}{\@xxvpt}
1900 %    \begin{macrocode}
1901  \def\@xxvpt{24.88}
1902 %    \end{macrocode}
1903 % \end{macro}
1905 %    \begin{macrocode}
1906 %</2ekernel|autoload>
1907 %    \end{macrocode}
1909 % \Finale