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
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
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.
18 % This file has the LPPL maintenance status "maintained".
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
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.
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]
42 \ProvidesFile{ltfssbas.dtx}
43 [2002/10/02 v3.0x LaTeX Kernel (NFSS Basic Macros)]
45 \documentclass{ltxdoc}
47 \DocInput{ltfssbas.dtx}
53 %<+checkmem>\def\CHECKMEM{\tracingstats=2
54 %<+checkmem> \newlinechar=`\^^J
55 %<+checkmem> \message{^^JMemory usage: \filename}\shipout\hbox{}}
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}
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.
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.
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.}
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
140 % \changes{v1.0h}{1989/04/29}{Documented problem with \cs{halign}, and
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.
174 %<2ekernel>\expandafter\let\csname ver@autofss1.sty\endcsname\fmtversion
177 % The autoload file \texttt{autofss2} is a specialty because it
179 % code which will be completely local, ie loaded every time again.
181 % \section{Preliminary macros}
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.
191 %<*2ekernel|autoload>
192 \def\@nomath#1{\relax\ifmmode
193 \@font@warning{Command \noexpand#1invalid in math mode}\fi}
194 %</2ekernel|autoload>
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}
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
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.
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
228 \gdef\no@alphabet@error{\relax \ifmmode
229 \expandafter\try@sizes\expandafter\no@alphabet@error \fi}
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}}
252 %<*2ekernel|autoload>
253 \def\new@mathgroup{\alloc@8\mathgroup\chardef\sixt@@n}
255 \let\newfam\new@mathgroup
256 \@onlypreamble\new@mathgroup
262 % \section{Macros for setting up the tables}
264 % \begin{macro}{\DeclareFontShape}
266 % \changes{v1.9a}{1992/07/26}{Introduced \cs{DeclareFontShape}}
267 % The macro |\DeclareFontShape| takes $6$ arguments:
269 \def\DeclareFontShape{\begingroup
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}
277 % We use |\expandafter| |\endgroup| to restore catcode in case
278 % something goes wrong with the argument parsing (suggested by Tim
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}
289 \expandafter\endgroup
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
296 \xdef\csname#1/#2/#3/#4\endcsname{\expandafter\noexpand
297 \csname #5\endcsname}%
300 \expandafter\let\csname#5\expandafter\endcsname
301 \ifx\reserved@a\@empty
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}.}
317 \def\DeclareFixedFont#1#2#3#4#5#6{%
322 \usefont{#2}{#3}{#4}{#5}%
323 \global\expandafter\let\expandafter#1\the\font
326 %</2ekernel|autoload>
333 % \begin{macro}{\do@subst@correction}
336 %<*2ekernel|autoload>
337 \def\do@subst@correction{%
338 \xdef\subst@correction{%
340 \global\expandafter\font
341 \csname \curr@fontshape/\f@size\endcsname
342 \noexpand\fontname\font
345 % Calling |\subst@correction| after the current group means calling
346 % it after we have loaded the substitution font which is done
349 \aftergroup\subst@correction
354 % \begin{macro}{\DeclareFontFamily}
356 \def\DeclareFontFamily#1#2#3{%
358 % If we want fast checking for the encoding scheme we can just
359 % check for |\T@..| being defined.
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}%
369 \@latex@error{Encoding scheme `#1' unknown}\@eha
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
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|.
389 \expandafter\let\csname #1+#2\expandafter\endcsname
390 \ifx \reserved@a\@empty
400 % \begin{macro}{\cdp@list}
401 % We initialize the code page list to be empty.
404 \@onlypreamble\cdp@list
408 % \begin{macro}{\cdp@elt}
411 \@onlypreamble\cdp@elt
418 % \begin{macro}{\DeclareFontEncoding}
420 \def\DeclareFontEncoding{%
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}}
431 \expandafter\endgroup
432 \DeclareFontEncoding@}
433 \@onlypreamble\DeclareFontEncoding
435 % \changes{v2.0g}{1993/09/15}
436 % {Corrected: \cs{default@T} to \cs{default@M}.}
438 \def\DeclareFontEncoding@#1#2#3{%
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}%
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
453 % \changes{v2.1n}{1994/05/14}{Log if encoding is redeclared}
455 \expandafter\let\csname#1-cmd\endcsname\@changed@cmd
457 \@font@info{Redeclaring font encoding #1}%
462 \global\@namedef{T@#1}{#2}%
463 \global\@namedef{M@#1}{\default@M#3}%
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)}
469 \xdef\LastDeclaredEncoding{#1}%
471 \@onlypreamble\DeclareFontEncoding@
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|.
481 \def\LastDeclaredEncoding{}
485 % \begin{macro}{\DeclareFontSubstitution}
487 \def\DeclareFontSubstitution#1#2#3#4{%
489 \ifx\csname T@#1\endcsname\relax
490 \@latex@error{Encoding scheme `#1' unknown}\@eha
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|.
503 \edef\reserved@a{#1}%
505 \def\cdp@elt##1##2##3##4{%
506 \def\reserved@b{##1}%
507 \ifx\reserved@a\reserved@b
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.
512 \addto@hook\toks@{\cdp@elt{##1}{#2}{#3}{#4}}%
515 % If |\reserved@a| and |\reserved@b| differ then we simply copy
516 % from the old list to the new.
518 \addto@hook\toks@{\cdp@elt{##1}{##2}{##3}{##4}}%
521 \xdef\cdp@list{\the\toks@}%
525 \def\default@family{#2}%
526 \def\default@series{#3}%
527 \def\default@shape{#4}%
531 \@onlypreamble\DeclareFontSubstitution
536 % \begin{macro}{\DeclareFontEncodingDefaults}
538 \def\DeclareFontEncodingDefaults#1#2{%
540 \ifx\default@T\@empty\else
541 \@font@info{Overwriting encoding scheme text defaults}%
546 \ifx\default@M\@empty\else
547 \@font@info{Overwriting encoding scheme math defaults}%
552 \@onlypreamble\DeclareFontEncodingDefaults
557 % \begin{macro}{\default@T}
558 % \begin{macro}{\default@M}
560 \let\default@T\@empty
561 \let\default@M\@empty
567 % \begin{macro}{\DeclarePreloadSizes}
569 \def\DeclarePreloadSizes#1#2#3#4#5{%
571 {\@latex@error{Encoding scheme `#1' unknown}\@eha}%
574 % Don't know at the moment what this group here does!
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
584 % This is done by delimiting |\reserved@f|'s only argument by the
585 % \textsf{token} |,| (comma).
587 \def\reserved@f##1,{%
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|
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.}
600 \let\reserved@f\relax
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.
610 \xdef\font@name{\csname#1/#2/#3/#4/##1\endcsname}%
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}.}
620 \global\expandafter\let\font@name\relax
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.
629 % We finish with reinserting the list of sizes after the
631 % macro and appending an empty element so that the end of the list
632 % is recognized properly.
638 \@onlypreamble\DeclarePreloadSizes
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.
652 \newif\ifmath@fonts \math@fontstrue
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.
665 \def\DeclareMathSizes{%
666 \@ifstar{\@DeclareMathSizes\math@fontsfalse}%
667 {\@DeclareMathSizes{}}}
668 \@onlypreamble\DeclareMathSizes
673 % \begin{macro}{\@DeclareMathSizes}
674 % \changes{v3.0p}{1996/07/26}{use faster \cs{if} test}
676 \def\@DeclareMathSizes#1#2#3#4#5{%
677 \@defaultunits\dimen@#2pt\relax\@nnil
680 \csname S@\strip@pt\dimen@\endcsname
684 \csname S@\strip@pt\dimen@\endcsname
685 {\gdef\tf@size{#3}\gdef\sf@size{#4}%
690 \@onlypreamble\@DeclareMathSizes
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.
711 \DeclareRobustCommand\fontencoding[1]{%
712 \expandafter\ifx\csname T@#1\endcsname\relax
713 \@latex@error{Encoding scheme `#1' unknown}\@eha
715 \edef\f@encoding{#1}%
716 \ifx\cf@encoding\f@encoding
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|.
724 \let\enc@update\relax
727 % If current and new encoding differ we define the macro
729 % to contain all updates necessary at |\selectfont| time.
731 \let\enc@update\@@enc@update
739 % \begin{macro}{\@@enc@update}
743 % When |\@@enc@update| is executed |\f@encoding| holds the encoding
745 % for the new encoding and |\cf@encoding| the name of the last active
748 % We start by setting the init command for encoding dependent
749 % macros to |\@changed@cmd|.
753 \csname\cf@encoding -cmd\endcsname
756 % Then we turn the one for the new encoding to |\@current@cmd| (see
757 % \texttt{ltoutenc.dtx} for further explanations).
761 \csname\f@encoding-cmd\endcsname
764 % We execute the default settings |\default@T|, followed by the one
765 % for the new encoding.
768 \csname T@\f@encoding\endcsname
770 % Finally we change the default substitution values, disable
771 % |\enc@update| and make |\f@encoding| officially the current
774 \csname D@\f@encoding\endcsname
775 \let\enc@update\relax
776 \let\cf@encoding\f@encoding
782 % \begin{macro}{\enc@update}
783 % \changes{v2.1m}{1994/05/14}{Macro added}
784 % The default action in |\selectfont| is to do nothing.
786 \let\enc@update\relax
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}
802 \DeclareRobustCommand\fontfamily[1]{\edef\f@family{#1}}
803 \DeclareRobustCommand\fontseries[1]{\edef\f@series{#1}}
804 \DeclareRobustCommand\fontshape [1]{\edef\f@shape{#1}}
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.
810 \def\usefont#1#2#3#4{\fontencoding{#1}\fontfamily{#2}%
811 \fontseries{#3}\fontshape{#4}\selectfont
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.
829 \DeclareRobustCommand\linespread[1]
830 {\set@fontsize{#1}\f@size\f@baselineskip}
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
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.
848 \DeclareRobustCommand\fontsize[2]
849 {\set@fontsize\baselinestretch{#1}{#2}}
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|.
865 \let\f@baselineskip\@empty
866 \let\f@linespread\@empty
870 % \begin{macro}{\cf@encoding}
871 % \changes{v2.1u}{1994/11/06}{New macro}
873 \let\f@encoding\@empty
874 \let\cf@encoding\@empty
880 % \begin{macro}{\@defaultunits}
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.
894 \def\@defaultunits{\afterassignment\remove@to@nnil}
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.
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}
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}
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}%
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.
944 \gdef\glb@currsize{}%
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}
954 \aftergroup\glb@settings
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,
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|.
988 \let\frozen@everymath\everymath
989 \let\frozen@everydisplay\everydisplay
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
1002 \newtoks\everydisplay
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.
1013 \frozen@everymath = {\check@mathfonts
1019 % \begin{macro}{\frozen@everydisplay}
1020 % \changes{v2.1a}{1994/01/17}{New math font setup}
1021 % Ditto for the display hook.
1023 \frozen@everydisplay = {\check@mathfonts
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.
1034 \let\curr@math@size\@empty
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.
1050 \expandafter \ifx \font@name \relax
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|
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}.}
1077 \gdef\split@name#1/#2/#3/#4/#5\@nil{\def\f@encoding{#1}%
1086 % \begin{macro}{\curr@fontshape}
1087 % Abbreviation which may get removed again for speed.
1088 % \changes{v1.9a}{1992/07/26}{}
1090 \def\curr@fontshape{\f@encoding/\f@family/\f@series/\f@shape}
1091 %</2ekernel|autoload>
1095 % \begin{macro}{\define@newfont}
1096 % Now we can tackle the problem of defining a new font.
1097 % \changes{v1.9a}{1992/07/26}{}
1099 %<*2ekernel|def2|autoload>
1100 \def\define@newfont{%
1102 % We have already mentioned that the \textsf{token} list that
1103 % |\split@name| will get as argument must not start with
1105 % To reach this goal we will set the |\escapechar| to $-1$ so
1106 % that the |\string| primitive will not generate an
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}
1120 \let\typeout\@font@info
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
1130 \expandafter\expandafter\expandafter
1131 \split@name\expandafter\string\font@name\@nil
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.}
1141 % \csname\curr@fontshape\endcsname \relax
1142 \try@load@fontshape % try always
1145 \csname\curr@fontshape\endcsname \relax
1146 \wrong@fontshape\else
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).
1152 % \csname\curr@fontshape\endcsname
1155 % We are nearly finished and must only restore the
1156 % |\escapechar| by closing the group.
1159 %</2ekernel|def2|autoload>
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
1178 % \changes{v3.0l}{1995/10/26}
1179 % {(DPC) disable autofss2 for now}
1182 \expandafter\def\expandafter\@begindocumenthook\expandafter{%
1183 \expandafter\ifx\csname ver@autofss2.sty\endcsname\relax
1184 \gdef\define@newfont{%
1186 \makeatletter\nfss@catcodes
1188 \@@input autofss2.sty\relax\define@newfont
1191 \def\do##1{\global\let##1\@undefined}%
1194 \do\set@simple@size@args
1195 \do\extract@rangefontinfo
1199 \do\set@size@funct@args
1200 \do\set@size@funct@args@
1214 %<*2ekernel|autoload>
1215 \def\try@load@fontshape{%
1217 \ifx\csname \f@encoding+\f@family\endcsname\relax
1218 \@font@info{Try loading font information for
1219 \f@encoding+\f@family}%
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}
1229 \global\expandafter\let
1230 \csname\f@encoding+\f@family\endcsname\@empty
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}.}
1238 \let\nfss@catcodes\relax
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.
1254 \noexpand\InputIfFileExists{\f@encoding\f@family.fd}}}%
1256 {\@input@{\f@encoding\f@family.fd}}%
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.,
1271 % \expandafter\def\expandafter\nfss@catcodes
1272 % \expandafter{\nfss@catcodes <additional settings>}
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.
1278 \def\nfss@catcodes{%
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}.}
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}
1303 % The we make sure that the important syntax parts have the right
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
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
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
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.
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
1345 % \changes{v2.1n}{1994/05/14}{Don't set \cs{f@encoding}}
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
1355 \gdef\f@baselineskip{#5pt}%
1357 \@onlypreamble\DeclareErrorFont
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}{}
1372 \def\wrong@fontshape{%
1373 \csname D@\f@encoding\endcsname % install defaults if in math
1375 % We remember the wanted |\curr@fontshape| combination
1376 % which we will need in a moment.
1378 \edef\reserved@a{\csname\curr@fontshape\endcsname}%
1379 \ifx\last@fontshape\reserved@a
1380 \errmessage{Corrupted NFSS tables}%
1384 % Then we warn the user about the mess and set the shape to its
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.}
1391 \let\f@shape\default@shape
1393 % If the combination is not known, try the default \emph{series}.
1395 \expandafter\ifx\csname\curr@fontshape\endcsname\relax
1396 \let\f@series\default@series
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}{}
1403 \ifx\csname\curr@fontshape\endcsname\relax
1404 \let\f@family\default@family
1408 % At this point a valid |\curr@fontshape| combination must
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
1421 % |\@wrong@font@char| is locally redefined in |\UseTextSymbol| from
1422 % its normal (empty) definition, to report the symbol generating the
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
1430 % We change |\@defaultsubs| to produce a warning at the end of
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|.
1440 \gdef\@defaultsubs{%
1441 \@font@warning{Some font shapes were not available, defaults
1442 substituted.\@gobbletwo}}%
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
1453 % and this must happen before the |\let| is executed.
1455 \global\expandafter\expandafter\expandafter\let
1456 \expandafter\reserved@a
1457 \csname\curr@fontshape\endcsname
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.
1468 \csname\curr@fontshape/\f@size\endcsname}%
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.
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
1485 \let\@wrong@font@char\@empty
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}
1496 \let\@defaultsubs\relax
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).
1509 \def\strip@prefix#1>{}
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.
1524 \let\install@mathalphabet\gdef
1530 % \begin{macro}{\math@fonts}
1532 % \changes{v1.9a}{1992/07/26}{}
1534 \let\math@fonts\@empty
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.}
1551 %\def\select@group#1#2#3{\relax\ifmmode
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.
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}{}
1564 % \getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3%
1566 % We globally select the math fonts\dots
1568 % \globaldefs\@ne \math@fonts
1570 % \dots{} and close the group to
1571 % restore |\globaldefs| and |\escapechar|.
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
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
1589 % \gdef#1{#3\mathgroup #2}#1\fi}
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}.}
1597 % \xdef#1{\noexpand\use@mathgroup\noexpand#2%
1598 % {\number\csname c@mv@\math@version\endcsname}}%
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}{}
1622 % \expandafter\extract@alph@from@version
1623 % \csname mv@\math@version\expandafter\endcsname
1624 % \expandafter{\number\csname c@mv@\math@version\endcsname}%
1626 % \stepcounter{mv@\math@version}%
1628 % Finally, it is not possible to simply call the new definition
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.
1637 %\expandafter #1\fi}
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.
1649 \def\extract@alph@from@version#1#2#3{%
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|.
1662 \def\reserved@a##1\install@mathalphabet#3##2##3\@nil{%
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
1671 \def\reserved@b{##2}%
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|.
1678 \def\reserved@c####1{\gdef#1{##1####1##3}}}%
1680 % Then we execute our auxiliary macro.
1682 \expandafter\reserved@a#1\@nil
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.
1694 \def\reserved@a\select@group#3##1##2\@nil{%
1696 % This macro can now directly rebuild the math version definition
1697 % by calling |\reserved@c|:
1700 \getanddefine@fonts{#2}##2%
1701 \install@mathalphabet#3{%
1702 \relax\ifmmode \else \non@alpherr#3\fi
1703 \use@mathgroup##1{#2}}}%
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
1709 \gdef#3{\relax\ifmmode \else \non@alpherr#3\fi
1710 \use@mathgroup##1{#2}}}%
1712 % Finally, we only have to call this macro |\reserved@a| on the old
1713 % definitions recorded in |\reserved@b|:
1715 \expandafter\reserved@a\reserved@b\@nil
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.
1734 \let\math@bgroup\bgroup
1735 \def\math@egroup#1{#1\egroup}
1736 %</2ekernel|autoload>
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.
1749 \gdef\calculate@math@sizes{%
1750 \@font@info{Calculating\space math\space sizes\space for\space
1751 size\space <\f@size>}%
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}}
1762 \def\calculate@math@sizes{\try@sizes\calculate@math@sizes}
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
1773 % 1 to |\defaultscriptratio| to |\defaultscriptscriptratio|.\\
1774 % By default this is 1 to .7 to .5.
1776 %<*2ekernel|autoload>
1777 \def\defaultscriptratio{.7}
1778 \def\defaultscriptscriptratio{.5}
1783 % \begin{macro}{\noaccents@}
1784 % If we don't have a definition for |\noaccents@| we provide a
1787 \ifx\noaccents@\@undefined
1788 \let\noaccents@\@empty
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.
1804 %</2ekernel|autoload>
1805 %<*2ekernel|autoerr>
1806 \gdef\showhyphens#1{%
1810 \parfillskip\z@skip\hsize\maxdimen
1812 \pretolerance\m@ne\tolerance\m@ne\hbadness\z@\showboxdepth\z@\ #1%
1814 %</2ekernel|autoerr>
1815 %<autoload>\def\showhyphens{\@autoerr\showhyphens}
1816 %<*2ekernel|autoload>
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.
1826 \long\def\addto@hook#1#2{#1\expandafter{\the#1#2}}
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}
1839 % \begin{macro}{\@vipt}
1845 % \begin{macro}{\@viipt}
1851 % \begin{macro}{\@viiipt}
1857 % \begin{macro}{\@ixpt}
1863 % \begin{macro}{\@xpt}
1869 % \begin{macro}{\@xipt}
1875 % \begin{macro}{\@xiipt}
1881 % \begin{macro}{\@xivpt}
1887 % \begin{macro}{\@xviipt}
1893 % \begin{macro}{\@xxpt}
1899 % \begin{macro}{\@xxvpt}
1906 %</2ekernel|autoload>