1 % \iffalse meta-comment
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
37 \ProvidesFile{ltfssbas.dtx}
38 [2015/04/07 v3.1a LaTeX Kernel (NFSS Basic Macros)]
40 \documentclass{ltxdoc}
42 \DocInput{ltfssbas.dtx}
48 %<+checkmem>\def\CHECKMEM{\tracingstats=2
49 %<+checkmem> \newlinechar=`\^^J
50 %<+checkmem> \message{^^JMemory usage: \filename}\shipout\hbox{}}
57 % \GetFileInfo{ltfssbas.dtx}
58 % \title{A new font selection scheme for \TeX{} macro packages\\
59 % (Basic Macros)\thanks
60 % {This file has version number
61 % \fileversion\ dated \filedate}}
63 % \author{Frank Mittelbach \and Rainer Sch\"opf}
65 % \MaintainedByLaTeXTeam{latex}
68 % This file contains the main implementation of the `low level' font
69 % selection commands. See other parts of the \LaTeX\
70 % distribution, or \emph{The \LaTeX\ Companion} for higher level
71 % documentation of the \LaTeX\ `New' Font Selection Scheme.
75 % The macro documentation is still basically the documentation from the
76 % first NFSS release and therefore in some cases probably not
77 % completely accurate.
82 % \changes{v3.0v}{1998/08/17}{(RmS) Documentation fixes.}
83 % \changes{v3.0j}{1995/10/22}{(RmS) New size function macro
84 % \cs{genb@sfcnt} needs to be disabled at \cs{document}.}
85 % \changes{v3.0i}{1995/10/20}
86 % {(DPC) Modify autoload code, change \cs{undefined}}
87 % \changes{v3.0g}{1995/10/04}{Modify autoload code}
88 % \changes{v3.0f}{1995/08/24}{Added autoload code}
89 % \changes{v3.0d}{1995/07/13}
90 % {minor documentation changes}
91 % \changes{v3.0c}{1995/06/15}
92 % {(DPC) minor documentation changes}
93 % \changes{v3.0a}{1995/05/24}
94 % {(DPC) Make file from previous file, fam.dtx 1995/05/20 v2.2d}
97 % \changes{v2.1x}{1994/11/18}{(DPC) use \cs{reserved@f} not \cs{next}}
98 % \changes{v2.1q}{1994/05/20}{Use new error commands}
99 % \changes{v2.1o}{1994/05/15}{encoding cmds changed to {enc}-cmd}
100 % \changes{v2.1k}{1994/05/13}{Remove File identification `typeout'}
101 % \changes{v2.1j}{1994/05/12}{New baselinestretch concept}
102 % \changes{v2.1j}{1994/05/12}{Replaced hand-protected commands by
103 % \cs{DeclareRobustCommand} defs}
104 % \changes{v2.1h}{1994/04/11}{Added \cs{defaultscriptratio} and
105 % \cs{defaultscriptscriptratio}. ASAJ.}
106 % \changes{v2.1g}{1994/03/13}{add 2ekernel module to omit repeated code}
107 % \changes{v2.1a}{1994/01/17}{New math font setup}
108 % \changes{v2.0c}{1993/03/18}{Changed all \cs{@tempdima} in
109 % \cs{@tempdimb} to avoid killing \cs{numberline}}
110 % \changes{v1.91a}{1992/09/22}{Introduced \cs{tf@size} for math size.}
111 % \changes{v1.3a}{1991/11/27}{All \cs{family}, \cs{shape} etc.
112 % renamed to \cs{fontfamily} etc.}
113 % \changes{v1.2i}{1990/04/01}{Code added from tracefnt.dtx.}
114 % \changes{v1.2i}{1990/04/01}{Support for TeX3.}
115 % \changes{v1.2g}{1990/02/16}{Support for changes of \cs{baselineskip}
116 % without changing the size.}
118 % \changes{v1.2c}{1990/01/23}{\cs{no@version@warning} renamed to
119 % \cs{no@alphabet@error}.}
120 % \changes{v1.0s}{1989/11/25}{All \cs{edef}\cs{font@name} changed to
121 % \cs{xdef}\cs{font@name}.
122 % Necessary after introduction of
123 % \cs{begingroup}/\cs{endgroup} in v1.0q.}
124 % \changes{v1.0s}{1989/11/25}{extra// $\to$ + in \cs{extra@def}.}
125 % \changes{v1.0o}{1989/11/08}{First parameter of
126 % \cs{define@mathalphabet}
127 % and \cs{define@mathgroup} changed
128 % from string to control sequence.}
129 % \changes{v1.0m}{1989/09/14}
130 % {Global replacement: \cs{group} to \cs{mathgroup}}
131 % \changes{v1.0k}{1989/05/22}{Lines longer than 72 characters folded.}
132 % \changes{v1.0j}{1989/05/01}{Default for \cs{baselinestretch} added.}
133 % \changes{v1.0i}{1989/04/29}
134 % {Removed the \cs{halign} \cs{noalign} correction
136 % \changes{v1.0h}{1989/04/29}{Documented problem with \cs{halign}, and
138 % \changes{v1.0g}{1989/04/27}{Documentation revised.}
139 % \changes{v1.0f}{1989/04/23}{\% in \cs{getanddefinefonts} added.}
140 % \changes{v1.0e}{1989/04/21}{Documentation is fun!!
141 % Parameters of \cs{define@mathalphabet} changed.}
142 % \changes{v1.0d}{1989/04/19}{Even more doc.}
143 % \changes{v1.0c}{1989/04/14}{More documentation added.}
144 % \changes{v1.0b}{1989/04/10}{\cs{preload@sizes} added.}
145 % \changes{v1.0b}{1989/04/10}{\cs{wrong@fontshape} changed to define
146 % substitution font/shape macro.}
147 % \changes{v1.0a}{1989/04/10}{Starting with version numbers!!
148 % \cs{ifmmode} added in \cs{math@group}}
149 % \changes{v2.1w}{1994/11/17}
150 % {\cs{@tempa} to \cs{reserved@a}}
151 % \changes{v3.0z}{2015/02/21}
152 % {Removed autoload code}
155 % The `2ekernel' code ensures that a |\usepackage{autofss1}| is
156 % essentially ignored if a `full' format is being used that has
157 % picture mode already in the format.
159 % Note the |autofss2| loading is currently disabled.
162 %<2ekernel>\expandafter\let\csname ver@autofss1.sty\endcsname\fmtversion
166 % \section{Preliminary macros}
169 % of macros that will be used later.
172 % \begin{macro}{\@nomath}
173 % |\@nomath| is used by most macros that will have no effect
174 % in math mode. It issues a warning message.
177 \def\@nomath#1{\relax\ifmmode
178 \@font@warning{Command \noexpand#1invalid in math mode}\fi}
182 % \changes{v1.2c}{1990/01/23}{Macro \cs{no@alphabet@help} added}
183 % \changes{v2.1i}{1994/04/18}{Macro \cs{no@alphabet@help}
186 % \begin{macro}{\no@alphabet@error}
187 % \changes{v1.2c}{1990/01/23}{Changed to error call}
188 % \changes{v2.1i}{1994/04/18}{Use std LaTeX error macro}
189 % The macro |\no@alphabet@error| is called whenever
190 % the user requests a math \emph{alphabet} that is not
191 % available in the current \emph{version}.
192 % In math mode an error message is produced otherwise the command
194 % The argument is the name of the control sequence that identifies
195 % the math \emph{alphabet}.
196 % The |\relax| at the beginning is necessary to prevent
197 % \TeX{} from scanning too far in certain situations.
199 \gdef\no@alphabet@error#1{\relax \ifmmode
200 \@latex@error{Math\space alphabet\space identifier\space
201 \noexpand#1is\space undefined\space in\space math\space
202 version\space `\math@version'}%
203 {Your\space requested\space math\space alphabet\space
204 is\space undefined\space in\space the\space current\space
205 math\space version.^^JCheck\space the\space spelling\space
206 or\space use\space the\space \noexpand\SetMathAlphabet\space
213 % \begin{macro}{\new@mathgroup}
214 % \begin{macro}{\mathgroup}
215 % We also give a new name to |\newfam| and |\fam|
216 % to avoid verbal confusion
217 % (see the introduction).\footnote{For the same reason
218 % it seems advisable to
219 % {\ttfamily\bslash let\bslash fam} and
220 % {\ttfamily\bslash newfam}
221 % equal to {\ttfamily\bslash relax},
222 % but this is commented out to retain
223 % compatibility to existing style files.}
224 % \changes{v1.2e}{1990/01/28}{\cs{newfam} let to \cs{new@mathgroup}.}
225 % \changes{v3.0a}{1995/05/24}
226 % {(DPC) No need to redefine \cs{newfam} as not outer}
227 % \changes{v3.0b}{1995/05/27}
228 % {(FMi) But a need to define \cs{new@mathgroup}}
229 % \changes{v3.0y}{2014/12/30}
230 % {move allocation to ltplain.}
232 %\def\new@mathgroup{\alloc@8\mathgroup\chardef\sixt@@n}
234 %\let\newfam\new@mathgroup
235 \@onlypreamble\new@mathgroup
241 % \section{Macros for setting up the tables}
243 % \begin{macro}{\DeclareFontShape}
245 % \changes{v1.9a}{1992/07/26}{Introduced \cs{DeclareFontShape}}
246 % The macro |\DeclareFontShape| takes $6$ arguments:
248 \def\DeclareFontShape{\begingroup
250 % First we restore the catcodes of all characters used in the syntax.
251 % \changes{v2.1e}{1994/02/24}
252 % {Separate restoration of catcodes for fd cmds}
256 % We use |\expandafter| |\endgroup| to restore catcode in case
257 % something goes wrong with the argument parsing (suggested by Tim
263 % \begin{macro}{\DeclareFontShape}
264 % \changes{v2.1c}{1994/02/07}{revert catcode settings earlier}
265 % \changes{v3.0m}{1995/11/01}
266 % {(DPC) Test for \cs{relax} not \cs{undefined}, internal/1933}
268 \expandafter\endgroup
270 \def\DeclareFontShape@#1#2#3#4#5#6{%
271 \expandafter\ifx\csname #1+#2\endcsname\relax
272 \@latex@error{Font family `#1+#2' unknown}\@eha
275 \xdef\csname#1/#2/#3/#4\endcsname{\expandafter\noexpand
276 \csname #5\endcsname}%
279 \expandafter\let\csname#5\expandafter\endcsname
280 \ifx\reserved@a\@empty
291 % \begin{macro}{\DeclareFixedFont}
292 % Define a direct font switch that avoids all overhead.
293 % \changes{v2.1u}{1994/11/06}{Renamed
294 % \cs{every@size} to \cs{every@math@size}.}
296 \def\DeclareFixedFont#1#2#3#4#5#6{%
301 \usefont{#2}{#3}{#4}{#5}%
302 \global\expandafter\let\expandafter#1\the\font
311 % \begin{macro}{\do@subst@correction}
314 \def\do@subst@correction{%
315 \xdef\subst@correction{%
317 \global\expandafter\font
318 \csname \curr@fontshape/\f@size\endcsname
319 \noexpand\fontname\font
322 % Calling |\subst@correction| after the current group means calling
323 % it after we have loaded the substitution font which is done
326 \aftergroup\subst@correction
331 % \begin{macro}{\DeclareFontFamily}
333 \def\DeclareFontFamily#1#2#3{%
335 % If we want fast checking for the encoding scheme we can just
336 % check for |\T@..| being defined.
339 % \def\reserved@b{#1}%
340 % \def\cdp@elt##1##2##3##4{\def\reserved@c{##1}%
341 % \ifx\reserved@b\reserved@c \@tempswatrue\fi}%
346 \@latex@error{Encoding scheme `#1' unknown}\@eha
350 % Now we have to define the macro |\|\meta{\#1}|+|\meta{\#2}
351 % to contain |#3|. But since most of the time |#3| will be empty
352 % we use |\let| in a tricky way rather than a simple |\def| since
353 % this will save internal memory.
354 % We store the argument |#3| in a temporary macro
359 % We compare |\reserved@a| with |\@empty|
360 % If these two are the same we |\let| the `extra'
361 % macro equal to |\@empty| which is not the same a doing a |\let|
362 % to |\reserved@a| --- the latter would blow one extra memory
363 % location rather then reusing the one from |\@empty|.
366 \expandafter\let\csname #1+#2\expandafter\endcsname
367 \ifx \reserved@a\@empty
377 % \begin{macro}{\cdp@list}
378 % We initialize the code page list to be empty.
381 \@onlypreamble\cdp@list
385 % \begin{macro}{\cdp@elt}
388 \@onlypreamble\cdp@elt
395 % \begin{macro}{\DeclareFontEncoding}
397 \def\DeclareFontEncoding{%
399 % First we start with ignoring all blanks and newlines since every
400 % surplus space in the second or third argument will come out in
401 % a weird place in the document.
402 % \changes{v2.1c}{1994/02/07}{revert catcode settings earlier}
403 % \changes{v2.1t}{1994/10/19}{Add missing \cs{relax}.}
404 % \changes{v2.1z}{1994/12/06}{use \cs{nfss@catcodes}}
408 \expandafter\endgroup
409 \DeclareFontEncoding@}
410 \@onlypreamble\DeclareFontEncoding
412 % \changes{v2.0g}{1993/09/15}
413 % {Corrected: \cs{default@T} to \cs{default@M}.}
415 \def\DeclareFontEncoding@#1#2#3{%
417 \ifx\csname T@#1\endcsname\relax
418 \def\cdp@elt{\noexpand\cdp@elt}%
419 \xdef\cdp@list{\cdp@list\cdp@elt{#1}%
420 {\default@family}{\default@series}%
423 % To support encoding dependent commands (like accents) we
424 % initialise the command
425 % |\|\meta{encoding}|-cmd| to be |\@changed@cmd|.
426 % (See \texttt{ltoutenc.dtx} for details.)
427 % \changes{v2.1l}{1994/05/13}{Init encoding change command}
428 % \changes{v2.1n}{1994/05/14}{Only init enc change cmd when
430 % \changes{v2.1n}{1994/05/14}{Log if encoding is redeclared}
432 \expandafter\let\csname#1-cmd\endcsname\@changed@cmd
434 \@font@info{Redeclaring font encoding #1}%
439 \global\@namedef{T@#1}{#2}%
440 \global\@namedef{M@#1}{\default@M#3}%
442 % Keep a record of the last encoding being declared:
443 % \changes{v3.0w}{1999/01/06}{Added \cs{LastDeclaredEncoding} to
444 % support cyrillic integration (pr/2988)}
446 \xdef\LastDeclaredEncoding{#1}%
448 \@onlypreamble\DeclareFontEncoding@
453 % \begin{macro}{\LastDeclaredEncoding}
454 % \changes{v3.0w}{1999/01/06}{Added \cs{LastDeclaredEncoding} to
455 % support cyrillic integration (pr/2988)}
456 % The last encoding being declared by |\DeclareFontEncoding|.
458 \def\LastDeclaredEncoding{}
462 % \begin{macro}{\DeclareFontSubstitution}
464 \def\DeclareFontSubstitution#1#2#3#4{%
466 \ifx\csname T@#1\endcsname\relax
467 \@latex@error{Encoding scheme `#1' unknown}\@eha
471 % \changes{v3.0x}{2002/10/02}{Adding \cs{LastDeclaredEncoding}
472 % introduced a bug as on some occasions that macro name was stored
473 % in the internal lists instead of the actual encoding. (pr/3459)}
474 % We loop through the |\cdp@list| and rebuild it anew in |\toks@|
475 % thereby replacing the defaults for the encoding in question with
476 % the new defaults. It is important to store the encoding to test
477 % against expanded in |\reserved@a| since it might just be
478 % |\LastDeclaredEncoding| that is passed as |#1|.
480 \edef\reserved@a{#1}%
482 \def\cdp@elt##1##2##3##4{%
483 \def\reserved@b{##1}%
484 \ifx\reserved@a\reserved@b
486 % Here we use the new defaults but we use |##1| (i.e., the encoding
487 % name already stored previously) since we know that it is expanded.
489 \addto@hook\toks@{\cdp@elt{##1}{#2}{#3}{#4}}%
492 % If |\reserved@a| and |\reserved@b| differ then we simply copy
493 % from the old list to the new.
495 \addto@hook\toks@{\cdp@elt{##1}{##2}{##3}{##4}}%
498 \xdef\cdp@list{\the\toks@}%
502 \def\default@family{#2}%
503 \def\default@series{#3}%
504 \def\default@shape{#4}%
508 \@onlypreamble\DeclareFontSubstitution
513 % \begin{macro}{\DeclareFontEncodingDefaults}
515 \def\DeclareFontEncodingDefaults#1#2{%
517 \ifx\default@T\@empty\else
518 \@font@info{Overwriting encoding scheme text defaults}%
523 \ifx\default@M\@empty\else
524 \@font@info{Overwriting encoding scheme math defaults}%
529 \@onlypreamble\DeclareFontEncodingDefaults
534 % \begin{macro}{\default@T}
535 % \begin{macro}{\default@M}
537 \let\default@T\@empty
538 \let\default@M\@empty
544 % \begin{macro}{\DeclarePreloadSizes}
546 \def\DeclarePreloadSizes#1#2#3#4#5{%
548 {\@latex@error{Encoding scheme `#1' unknown}\@eha}%
551 % Don't know at the moment what this group here does!
555 % We define a macro |\reserved@f|\footnote{We cannot use
556 % {\ttfamily\bslash @tempa}
557 % since it is needed in
558 % {\ttfamily\bslash pickup@font}.}
559 % that grabs the next \emph{size} and loads the corresponding
561 % This is done by delimiting |\reserved@f|'s only argument by the
562 % \textsf{token} |,| (comma).
564 \def\reserved@f##1,{%
566 % The end of the list will be detected when there are no more
567 % elements, i.e.\ when |\reserved@f|'s argument is empty.
568 % The trick used here is explained in Appendix~D of the
569 % \TeX{}book: if the argument is empty the |\if|
570 % will select the first clause and |\let| |\reserved@f|
572 % (We use the |>| character here since it cannot appear
573 % in font file names.)
574 % \changes{v1.2j}{1990/06/24}{Missing percent added.}
577 \let\reserved@f\relax
580 % Otherwise, we define |\font@name| appropriately and
581 % call |\pickup@font| to do the work.
582 % Note that the requested |\curr@fontshape|
583 % combination must have been defined, or you will get an error.
584 % The definition of |\font@name| is carried out globally
585 % to be consistent with the rest of the code in this file.
587 \xdef\font@name{\csname#1/#2/#3/#4/##1\endcsname}%
590 % Now we forget the name of the font just loaded.
591 % More precisely, we set the corresponding control sequence
592 % to |\relax|. This means that later on, when the font
593 % is first used, the macro |\define@newfont| is called
594 % again to execute the `extra' macro for this font.
595 % \changes{v1.2d}{1990/01/27}{Font identifier set to \cs{relax}.}
597 \global\expandafter\let\font@name\relax
600 % Finally we call |\reserved@f| again to process the next
601 % \emph{size}. If |\reserved@f| was |\let| equal to |\relax|
602 % this will end the macro.
606 % We finish with reinserting the list of sizes after the
608 % macro and appending an empty element so that the end of the list
609 % is recognized properly.
615 \@onlypreamble\DeclarePreloadSizes
621 % \begin{macro}{\ifmath@fonts}
622 % We need a switch to decide if we have to switch math fonts.
623 % For this purpose we provide |\ifmath@fonts|
624 % that can be set to true or false by the |\S@...| macros
625 % depending on if math fonts
626 % are provided for this size or not.
627 % The default is of course to switch all fonts.
629 \newif\ifmath@fonts \math@fontstrue
635 % \begin{macro}{\DeclareMathSizes}
636 % \begin{macro}{\DeclareMathSizes*}
637 % |\DeclareMathSizes| takes the text size, math text size, math
638 % script size, and math scriptscript size as arguments and defines
639 % the right |\S@|\dots{} macro.
642 \def\DeclareMathSizes{%
643 \@ifstar{\@DeclareMathSizes\math@fontsfalse}%
644 {\@DeclareMathSizes{}}}
645 \@onlypreamble\DeclareMathSizes
650 % \begin{macro}{\@DeclareMathSizes}
651 % \changes{v3.0p}{1996/07/26}{use faster \cs{if} test}
652 % This modification by Michael J. Downes on comp.text.tex on 2002/10/17
653 % allows the user to have settings such as\\
654 % |\DeclareMathSizes{9.5dd}{9.5dd}{7.4dd}{6.6dd}|.
655 % \changes{v3.0y}{2015/01/11}{Allow arbitrary units (latexrelease)}
658 %<latexrelease>\IncludeInRelease{2015/01/01}{\@DeclareMathSizes}%
659 %<latexrelease> {Arbitrary units in \DeclareMathSizes}%
660 %<*2ekernel|latexrelease>
661 \def\@DeclareMathSizes #1#2#3#4#5{%
662 \@defaultunits\dimen@ #2pt\relax\@nnil
664 \expandafter\let\csname S@\strip@pt\dimen@\endcsname\math@fontsfalse
666 \@defaultunits\dimen@ii #3pt\relax\@nnil
667 \@defaultunits\@tempdima #4pt\relax\@nnil
668 \@defaultunits\@tempdimb #5pt\relax\@nnil
670 \expandafter\xdef\csname S@\strip@pt\dimen@\endcsname{%
671 \gdef\noexpand\tf@size{\strip@pt\dimen@ii}%
672 \gdef\noexpand\sf@size{\strip@pt\@tempdima}%
673 \gdef\noexpand\ssf@size{\strip@pt\@tempdimb}%
678 %</2ekernel|latexrelease>
679 %<latexrelease>\EndIncludeInRelease
680 %<latexrelease>\IncludeInRelease{0000/00/00}{\@DeclareMathSizes}%
681 %<latexrelease> {Arbitrary units in \DeclareMathSizes}%
682 %<latexrelease>\def\@DeclareMathSizes#1#2#3#4#5{%
683 %<latexrelease> \@defaultunits\dimen@#2pt\relax\@nnil
684 %<latexrelease> \if$#3$%
685 %<latexrelease> \expandafter \let
686 %<latexrelease> \csname S@\strip@pt\dimen@\endcsname
687 %<latexrelease> \math@fontsfalse
688 %<latexrelease> \else
689 %<latexrelease> \expandafter \gdef
690 %<latexrelease> \csname S@\strip@pt\dimen@\endcsname
691 %<latexrelease> {\gdef\tf@size{#3}\gdef\sf@size{#4}%
692 %<latexrelease> \gdef\ssf@size{#5}%
695 %<latexrelease> \fi}%
696 %<latexrelease>\EndIncludeInRelease
701 \@onlypreamble\@DeclareMathSizes
707 % \section{Selecting a new font}
709 % \subsection{Macros for the user}
712 % \begin{macro}{\fontencoding}
713 % \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
714 % \begin{macro}{\f@encoding}
715 % As we said in the introduction a font is described by four parameters.
716 % We first define macros to specify the wanted \emph{family},
717 % \emph{series}, or \emph{shape}.
718 % These are simply recorded in internal macros
719 % |\f@family|, |\f@series|, and |\f@shape|, resp.
720 % We use |\edef|'s so that the arguments can also be macros.
722 \DeclareRobustCommand\fontencoding[1]{%
723 \expandafter\ifx\csname T@#1\endcsname\relax
724 \@latex@error{Encoding scheme `#1' unknown}\@eha
726 \edef\f@encoding{#1}%
727 \ifx\cf@encoding\f@encoding
729 % If the new encoding is the same as the old
730 % encoding we have nothing to do.
731 % However, in case we had a sequence of several encoding changes
732 % without a |\selectfont| in-between we can save processing by
733 % making sure that |\enc@update| is |\relax|.
735 \let\enc@update\relax
738 % If current and new encoding differ we define the macro
740 % to contain all updates necessary at |\selectfont| time.
742 \let\enc@update\@@enc@update
750 % \begin{macro}{\@@enc@update}
754 % When |\@@enc@update| is executed |\f@encoding| holds the encoding
756 % for the new encoding and |\cf@encoding| the name of the last active
759 % We start by setting the init command for encoding dependent
760 % macros to |\@changed@cmd|.
764 \csname\cf@encoding -cmd\endcsname
767 % Then we turn the one for the new encoding to |\@current@cmd| (see
768 % \texttt{ltoutenc.dtx} for further explanations).
772 \csname\f@encoding-cmd\endcsname
775 % We execute the default settings |\default@T|, followed by the one
776 % for the new encoding.
779 \csname T@\f@encoding\endcsname
781 % Finally we change the default substitution values, disable
782 % |\enc@update| and make |\f@encoding| officially the current
785 \csname D@\f@encoding\endcsname
786 \let\enc@update\relax
787 \let\cf@encoding\f@encoding
793 % \begin{macro}{\enc@update}
794 % \changes{v2.1m}{1994/05/14}{Macro added}
795 % The default action in |\selectfont| is to do nothing.
797 \let\enc@update\relax
801 % \begin{macro}{\fontfamily}
802 % \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
803 % \begin{macro}{\f@family}
804 % \begin{macro}{\fontseries}
805 % \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
806 % \begin{macro}{\f@series}
807 % \begin{macro}{\fontshape}
808 % \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
809 % \changes{v2.1y}{1994/11/30}{Use \cs{@current@cmd} in
810 % \cs{@@enc@update}. ASAJ.}
811 % \begin{macro}{\f@shape}
813 \DeclareRobustCommand\fontfamily[1]{\edef\f@family{#1}}
814 \DeclareRobustCommand\fontseries[1]{\edef\f@series{#1}}
815 \DeclareRobustCommand\fontshape [1]{\edef\f@shape{#1}}
817 % Some handy abbreviation if you want to get some particular font
818 % in the current size. If also the size should change one has to
819 % issue a |\fontsize| command first.
821 \def\usefont#1#2#3#4{\fontencoding{#1}\fontfamily{#2}%
822 \fontseries{#3}\fontshape{#4}\selectfont
833 % \begin{macro}{\linespread}
834 % \changes{v2.1j}{1994/05/12}{New macro}
835 % \changes{v2.1p}{1994/05/16}{Remove surplus braces}
836 % The command |\linespread| changes the current |\baselinestretch|
837 % by calling |\set@fontsize|. The values for |\f@size| and
838 % |\f@baselineskip| will be left unchanged.
840 \DeclareRobustCommand\linespread[1]
841 {\set@fontsize{#1}\f@size\f@baselineskip}
846 % \begin{macro}{\fontsize}
847 % \changes{v2.1j}{1994/05/12}{Redefined to use \cs{set@fontsize}}
848 % \changes{v2.1p}{1994/05/16}{Pass \cs{baselinstretch} not
850 % We also define a macro that allows to specify a size. In this
851 % case, however, we also need the value of |\baselineskip|. As the
852 % first argument to |\set@fontsize| we pass the current value of
853 % |\baselinestretch|. This will either match the internal value (in
854 % which case nothing changes, or it will be an updated value due to
855 % a user change of that macro using |\renewcommand|. If we would
856 % pass the internal |\f@linespread| such a change would be
857 % effectively overwritten by a size change.
859 \DeclareRobustCommand\fontsize[2]
860 {\set@fontsize\baselinestretch{#1}{#2}}
865 % \changes{v2.1n}{1994/05/14}{Set defaults for all \cs{f@...}}
867 % \begin{macro}{\f@linespread}
868 % \changes{v2.1j}{1994/05/12}{New macro}
869 % This macro holds the current internal value for
870 % |\baselinestretch|.
876 \let\f@baselineskip\@empty
877 \let\f@linespread\@empty
881 % \begin{macro}{\cf@encoding}
882 % \changes{v2.1u}{1994/11/06}{New macro}
884 \let\f@encoding\@empty
885 \let\cf@encoding\@empty
891 % \begin{macro}{\@defaultunits}
893 % The function |\@defaultunits| when wrapped around a dimen or skip
894 % assignment supplies default units. Usage:
896 % |\@defaultunits\dimen@=#1pt\relax\@nnil|
898 % Note: the |\relax| is *important*. Other units can be substituted
899 % for the `pt' if desired.
901 % We use |\remove@to@nnil| as an auxiliary macros for
902 % |\@defaultunits|. It just has to gobble the supplied default unit
903 % `pt' or whatever, if it wasn't used in the assignment.
905 \def\@defaultunits{\afterassignment\remove@to@nnil}
909 % \begin{macro}{\strip@pt}
910 % \begin{macro}{\rem@pt}
911 % This macro strips the characters |pt| produced by using |\the|
912 % on a dimen register.
918 \def\x{\def\rem@pt##1.##2PT{##1\ifnum##2>\z@.##2\fi}}}
919 \expandafter\endgroup\x
920 \def\strip@pt{\expandafter\rem@pt\the}
926 % \begin{macro}{\mathversion}
927 % \changes{v1.0h}{1989/04/29}{Test if version defined added.}
928 % \changes{v1.0m}{1989/09/14}
929 % {Corrected typo: \cs{endscname} to \cs{endcsname}.}
930 % \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
931 % \begin{macro}{\math@version}
932 % |\mathversion| takes the math \emph{version} name as
933 % argument, defines |\math@version| appropriately and switches
934 % to the font selected
935 % forcing a call to |\glb@settings| if the \emph{version} is
936 % known to the system.
937 % \changes{v1.0p}{1989/11/14}{Math version prefix `mv@' added.}
938 % \changes{v1.0r}{1989/11/22}
939 % {\cs{def} $\to$ \cs{edef} for \cs{math@version}.}
940 % \changes{v1.2g}{1990/02/16}{\cs{@nomath} added.}
941 % \changes{v2.1a}{1994/01/17}{New math font setup}
943 \DeclareRobustCommand\mathversion[1]
944 {\@nomath\mathversion
945 \expandafter\ifx\csname mv@#1\endcsname\relax
946 \@latex@error{Math version `#1' is not defined}\@eha\else
947 \edef\math@version{#1}%
949 % We need to force a math font setup both now and at the point
950 % where we return to the previous math version.
951 % Forcing a math font setup can simply be done by setting
952 % |\glb@currsize| to an invalid value since this will trigger the
953 % setup when the formula starts.
955 \gdef\glb@currsize{}%
957 % When the scope of the current |\mathversion| ends we need to
958 % restore the old setup. However this time we need to force it
959 % directly at least if we are inside math, otherwise we could wait.
960 % Another way to enhance this code here is todo the setting only if
961 % the version really has changed after all. This might be
962 % interesting in case of \texttt{amstext} and \texttt{boldsymbol}.
963 % \changes{v2.1b}{1994/01/25}{Corrections for math setup}
965 \aftergroup\glb@settings
972 % If \TeX{} would support a hook just before the end of a formula
973 % (opposite of |\everymath| so to speak) the implementation of the
974 % algorithm would be much simpler because in that case we would set up
975 % the correct math fonts at this point without having to worry about
976 % incorrect settings due to nesting. The same would be true if in
977 % \LaTeX{} the use of |$| (as the primitive \TeX{} command) would be
978 % impossible and instead only a higher-level interface would be
979 % available. Note that this does not mean that a |$| couldn't be the
980 % short-hand for starting and stopping that higher-level interface, it
981 % only means that the direct \TeX{} function must be hidden.
983 % Anyway, since we don't have this and won't have it in \LaTeXe{} we
984 % need to implement it in a somewhat slower way.
987 % We test for the current math font setup on entry of a formula,
989 % hooks |\everymath| and |\everydisplay|. But since these hooks may
990 % contain user data we provide ourselves with an internal version of
991 % these hooks which stays frozen.
994 % \begin{macro}{\frozen@everymath}
995 % \changes{v2.1a}{1994/01/17}{New math font setup}
996 % \begin{macro}{\frozen@everydisplay}
997 % New internal names for |\everymath| and |\everydisplay|.
999 \let\frozen@everymath\everymath
1000 \let\frozen@everydisplay\everydisplay
1005 % \begin{macro}{\everymath}
1006 % \changes{v2.1a}{1994/01/17}{New math font setup}
1007 % \begin{macro}{\everydisplay}
1008 % \changes{v2.1a}{1994/01/17}{New math font setup}
1009 % Now we provide now user hooks that will be called in the
1013 \newtoks\everydisplay
1019 % \begin{macro}{\frozen@everymath}
1020 % \changes{v2.1a}{1994/01/17}{New math font setup}
1021 % Now we define the behaviour of the frozen hooks: first
1022 % check the math setup then call the user hook.
1024 \frozen@everymath = {\check@mathfonts
1030 % \begin{macro}{\frozen@everydisplay}
1031 % \changes{v2.1a}{1994/01/17}{New math font setup}
1032 % Ditto for the display hook.
1034 \frozen@everydisplay = {\check@mathfonts
1039 % \changes{v3.0q}{1996/07/27}{\cs{if@inmath} switch removed}
1041 % \begin{macro}{\curr@math@size}
1042 % \changes{v2.1a}{1994/01/17}{New math font setup}
1043 % This holds locally the current math size.
1045 \let\curr@math@size\@empty
1052 % \subsection{Macros for loading fonts}
1054 % \begin{macro}{\pickup@font}
1055 % The macro |\pickup@font| which is used in
1056 % |\selectfont| is very simple:
1057 % if the font name is undefined (i.e.\ not known yet) it calls
1058 % |\define@newfont| to load it.
1061 \expandafter \ifx \font@name \relax
1067 % \begin{macro}{\split@name}
1068 % |\pickup@font| assumes that |\font@name| is set
1069 % but it is sometimes called when |\f@family|, |\f@series|,
1070 % |\f@shape|, or |\f@size| may have the wrong settings
1071 % (see, e.g., the definition of |\getanddefine@fonts|).
1072 % Therefore we need a macro to extract font \emph{family},
1073 % \emph{series}, \emph{shape}, and \emph{size} from the font name.
1074 % To this end we define |\split@name| which takes the font
1075 % name as a list of characters of |\catcode| 12 (without the
1076 % backslash at the beginning) delimited by the
1077 % special control sequence |\@nil|.
1078 % This is not very complicated: we first ensure that |/| has
1079 % the right |\catcode|
1083 % and define |\split@name| so that it will define our
1084 % private |\f@encoding|, |\f@family|, |\f@series|, |\f@shape|,
1085 % and |\f@size| macros.
1086 % \changes{v1.9a}{1992/07/26}{Added splitting into \cs{f@encoding}.}
1088 \gdef\split@name#1/#2/#3/#4/#5\@nil{\def\f@encoding{#1}%
1097 % \begin{macro}{\curr@fontshape}
1098 % Abbreviation which may get removed again for speed.
1099 % \changes{v1.9a}{1992/07/26}{}
1101 \def\curr@fontshape{\f@encoding/\f@family/\f@series/\f@shape}
1105 % \begin{macro}{\define@newfont}
1106 % Now we can tackle the problem of defining a new font.
1107 % \changes{v1.9a}{1992/07/26}{}
1109 \def\define@newfont{%
1111 % We have already mentioned that the \textsf{token} list that
1112 % |\split@name| will get as argument must not start with
1114 % To reach this goal we will set the |\escapechar| to $-1$ so
1115 % that the |\string| primitive will not generate an
1117 % To keep this change local we open a group. We use
1118 % |\begingroup| for this purpose since |\define@newfont|
1119 % might be called in math mode, and an empty
1120 % |\bgroup|\ldots|\egroup| would add an empty Ord atom
1121 % to the math list and thus affect the spacing.
1123 % Also locally redefine |\typeout| so that `No file ...fd'
1124 % Warnings become Font Info message just sent to the log file.
1125 % \changes{v1.0q}{1989/11/19}{Group added.}
1126 % \changes{v3.0m}{1995/11/17}{Redefine \cs{typeout} latex/1676}
1129 \let\typeout\@font@info
1132 % Then we extract \emph{encoding scheme}, \emph{family},
1133 % \emph{series}, \emph{shape},
1134 % and \emph{size} from the font name.
1135 % Note the four |\expandafter|'s so that |\font@name| is
1136 % expanded first, then |\string|, and finally
1139 \expandafter\expandafter\expandafter
1140 \split@name\expandafter\string\font@name\@nil
1142 % If the |\curr@fontshape| combination is not available,
1143 % (i.e.\ undefined) we call the macro |\wrong@fontshape| to take
1144 % care of this case. Otherwise |\extract@font|
1145 % will load the external font for us.
1146 % \changes{v1.2f}{1990/01/28}{Added call to \cs{curr@fontshape} macro
1147 % to allow substitution.}
1150 % \csname\curr@fontshape\endcsname \relax
1151 \try@load@fontshape % try always
1154 \csname\curr@fontshape\endcsname \relax
1155 \wrong@fontshape\else
1157 % To allow substitution we call the |curr@fontshape| macro
1158 % which usually will expand to |\relax| but may hold code for
1159 % substitution (see |\subst@fontshape| definition).
1161 % \csname\curr@fontshape\endcsname
1164 % We are nearly finished and must only restore the
1165 % |\escapechar| by closing the group.
1172 \def\try@load@fontshape{%
1174 \ifx\csname \f@encoding+\f@family\endcsname\relax
1175 \@font@info{Try loading font information for
1176 \f@encoding+\f@family}%
1178 % We predefine this combination to be |\@empty| which means that
1179 % next time we don't try again unnecessary in case we don't find a
1180 % |.fd| file. If the file contains a |\DeclareFontFamily| command
1181 % than this setting will be overwritten.
1182 % \changes{v2.1e}{1994/02/24}
1183 % {Separate restoration of catcodes for fd cmds}
1184 % \changes{v2.1l}{1994/05/13}{Use \cs{@input@} for fd files}
1186 \global\expandafter\let
1187 \csname\f@encoding+\f@family\endcsname\@empty
1189 % Set the catcodes used in the syntax, but do it only once (this
1190 % will be restored at the end of the font loading group).
1191 % \changes{v3.0t}{1997/10/21}{Move \cs{makeatletter} to
1192 % \cs{nfss@catcodes}.}
1195 \let\nfss@catcodes\relax
1198 % \changes{v3.0s}{1996/11/18}
1199 % {(DPC) lowercase fd file names. internal/1044}
1200 % For increased portability make the external filename
1201 % monocase, but look for the (old style) mixed case
1202 % filename if the first attempt fails.
1204 % On any monocase system this means that the file is looked for twice
1205 % which takes up time and string space, but at least for this release
1206 % Check for both names to give people time to re-install their private
1207 % fd files with lowercase names.
1211 \noexpand\InputIfFileExists{\f@encoding\f@family.fd}}}%
1213 {\@input@{\f@encoding\f@family.fd}}%
1219 % \begin{macro}{\nfss@catcodes}
1220 % \changes{v2.1e}{1994/02/24}
1221 % {Separate restoration of catcodes for fd cmds}
1222 % This macro should contain the standard |\catcode| assignments to
1223 % all characters which are used in the commands found in an
1224 % \texttt{.fd} file and which might have special |\catcode|s in the
1225 % middle of a document. If necessary, this list can be extended in
1226 % a package file using a suitable number of |\expandafter|, i.e.,
1228 % \expandafter\def\expandafter\nfss@catcodes
1229 % \expandafter{\nfss@catcodes <additional settings>}
1231 % Note, that this macro might get executed several times since it
1232 % is also called by |\DeclareFontShape|, thus it probably should
1233 % not be misused as a general purpose hook.
1235 \def\nfss@catcodes{%
1237 % We start by making |@| a letter and ignoring all blanks and newlines.
1238 % \changes{v2.1z}{1994/12/06}{Added tab char as well}
1239 % \changes{v3.0p}{1996/07/26}{omit \cs{relax} as not needed}
1240 % \changes{v3.0t}{1997/10/21}{Moved \cs{makeatletter} from
1241 % \cs{try@load@font@shape}.}
1248 % Then we set up |\|, |{|, |}|, |#| and |%| in case an \texttt{.fd}
1249 % file is loaded during a verbatim environment.
1250 % \changes{v3.0n}{1995/11/27}{Reset hash, for definitions in fd files}
1251 % \changes{v3.00}{1995/12/06}{Reset hat, for typeouts etc in fd files}
1260 % The we make sure that the important syntax parts have the right
1262 % \changes{v2.1s}{1994/09/16}{Reset [ and ] as well, just in case}
1263 % \changes{v3.0r}{1996/08/25}{Reset the acute, grave and double quote
1282 % \begin{macro}{\DeclareErrorFont}
1283 % Declare the last resort shape! We assume that in this fontshape
1284 % there is a 10pt font but it doesn't really matter. We only loose
1285 % one macro name if the assumption is false. But at least the font
1288 \def\DeclareErrorFont#1#2#3#4#5{%
1289 \xdef\error@fontshape{%
1290 \noexpand\expandafter\noexpand\split@name\noexpand\string
1291 \expandafter\noexpand\csname#1/#2/#3/#4/#5\endcsname
1294 % Initialize all those internal variables which may or may not have
1295 % values in the first seconds of NFSS' bootstraping process. Later
1296 % on such values will be updated when an encoding is selected, etc.
1298 % We definitely don't want to set |\f@encoding|; we can set all the
1299 % others since if they are left ``blank'' any selection would grap
1300 % ``error default values'' as well. However, this probably should
1302 % \changes{v2.1n}{1994/05/14}{Don't set \cs{f@encoding}}
1304 % \gdef\f@encoding{#1}%
1305 \gdef\default@family{#2}%
1306 \gdef\default@series{#3}%
1307 \gdef\default@shape{#4}%
1308 \global\let\f@family\default@family
1309 \global\let\f@series\default@series
1310 \global\let\f@shape\default@shape
1312 \gdef\f@baselineskip{#5pt}%
1314 \@onlypreamble\DeclareErrorFont
1319 % \begin{macro}{\wrong@fontshape}
1320 % Before we come to the macro |\extract@font| we have to take
1321 % care of unknown |\curr@fontshape| combinations.
1322 % The general strategy is to issue a warning and to try a default
1323 % \emph{shape}, then a default \emph{series},
1324 % and finally a default \emph{family}.
1325 % If this last one also fails \TeX{} will go into an infinite loop.
1326 % But if the defaults are set incorrectly one deserves nothing else!
1327 % \changes{v1.9a}{1992/07/26}{}
1330 %<latexrelease>\IncludeInRelease{2015/01/01}{\wrong@fontshape}%
1331 %<latexrelease> {Font substituation in preamble}%
1332 %<*2ekernel|latexrelease>
1333 \def\wrong@fontshape{%
1334 \csname D@\f@encoding\endcsname % install defaults if in math
1336 % We remember the wanted |\curr@fontshape| combination
1337 % which we will need in a moment.
1339 \edef\reserved@a{\csname\curr@fontshape\endcsname}%
1340 \ifx\last@fontshape\reserved@a
1341 \errmessage{Corrupted NFSS tables}%
1345 % Then we warn the user about the mess and set the shape to its
1347 % \changes{v1.0q}{1989/11/19}
1348 % {Instead of calling \cs{family}\cs{default@family},
1349 % etc. we directly set \cs{f@family}, etc.}
1350 % \changes{v1.2f}{1990/01/28}{Warning message slightly changed.}
1352 \let\f@shape\default@shape
1354 % If the combination is not known, try the default \emph{series}.
1356 \expandafter\ifx\csname\curr@fontshape\endcsname\relax
1357 \let\f@series\default@series
1359 % If this is still undefined, try the default \emph{family}.
1360 % Otherwise give up. We never try to change the encoding scheme!
1361 % \changes{v1.9a}{1992/07/26}{}
1362 % \changes{v3.1a}{2015/04/07}{Try loading fd file if family has changed}
1365 \ifx\csname\curr@fontshape\endcsname\relax
1366 \let\f@family\default@family
1368 % If we change the font family and we are in the preamble then the
1369 % corresponding \texttt{.fd} file may not been loaded
1370 % yet. Therefore we try this now. Otherwise equating the requested
1371 % font shape with the finally selected fontshape below will fail
1372 % and can result in ``NFSS tables corruped''. After begin document
1373 % that will not happen as all \texttt{.fd} files involved in
1374 % substituation are loaded at |\begin{document}|.
1382 % At this point a valid |\curr@fontshape| combination must
1384 % We inform the user about this fact.
1385 %\changes{v3.0n}{1995/11/02}
1386 % {(DPC) Remove extra space with \cs{string} for latex/1676}
1387 % \changes{v3.0m}{1995/11/17}
1388 % {Support \cs{@wrong@font@char} latex/1676}
1390 % The |\expandafter\string| here stops \TeX\ adding the space
1391 % that it usually puts after command names in messages. The similar
1392 % construction with |\@undefined| just produces `undefined', but saves
1395 % |\@wrong@font@char| is locally redefined in |\UseTextSymbol| from
1396 % its normal (empty) definition, to report the symbol generating the
1399 \@font@warning{Font shape `\expandafter\string\reserved@a'
1400 \expandafter\@gobble\string\@undefined\MessageBreak
1401 using `\curr@fontshape' instead\@wrong@font@char}%
1402 \global\let\last@fontshape\reserved@a
1404 % We change |\@defaultsubs| to produce a warning at the end of
1406 % \changes{v3.0d}{1995/07/13}{Change a macro not a switch to flag
1407 % default font substitutions}
1408 % \changes{v3.0k}{1995/10/24}{Make this code inline since it
1409 % happens only here}
1410 % The macro |\@defaultsubs| is initially |\relax| but gets changed
1411 % here if some default font substitution happens.
1412 % It is then executed in |\enddocument|.
1414 \gdef\@defaultsubs{%
1415 \@font@warning{Some font shapes were not available, defaults
1416 substituted.\@gobbletwo}}%
1418 % If we substitute a |\curr@fontshape| combination
1419 % by the default one we don't want the warning to be printed out
1420 % whenever this (unknown) combination is used.
1421 % Therefore we globally |\let| the macro corresponding to
1422 % the wanted combination equal to its substitution.
1423 % This requires the use of four |\expandafter|'s
1424 % since |\csname|\dots|\endcsname| has to be
1425 % expanded before |\reserved@a| (i.e.\ the requested
1427 % and this must happen before the |\let| is executed.
1429 \global\expandafter\expandafter\expandafter\let
1430 \expandafter\reserved@a
1431 \csname\curr@fontshape\endcsname
1433 % Now we can redefine |\font@name| accordingly.
1434 % This \emph{must} be done globally since it might occur in the
1435 % group opened by |\define@newfont|. If we would this
1436 % definition were local the closing |\endgroup| there
1437 % would restore the old meaning of |\font@name| and then
1438 % switch to the wrong font at the end of |\selectfont|
1439 % although the correct font was loaded.
1442 \csname\curr@fontshape/\f@size\endcsname}%
1444 % The last thing this macro does is to call |\pickup@font|
1445 % again to load the font if it is not defined yet.
1446 % At this point this code will loop endlessly if
1447 % the defaults are not well defined.
1450 %</2ekernel|latexrelease>
1451 %<latexrelease>\EndIncludeInRelease
1452 %<latexrelease>\IncludeInRelease{0000/00/00}{\wrong@fontshape}%
1453 %<latexrelease> {Font substituation in preamble}%
1454 %<latexrelease>\def\wrong@fontshape{%
1455 %<latexrelease> \csname D@\f@encoding\endcsname
1456 %<latexrelease> \edef\reserved@a{\csname\curr@fontshape\endcsname}%
1457 %<latexrelease> \ifx\last@fontshape\reserved@a
1458 %<latexrelease> \errmessage{Corrupted NFSS tables}%
1459 %<latexrelease> \error@fontshape
1460 %<latexrelease> \else
1461 %<latexrelease> \let\f@shape\default@shape
1462 %<latexrelease> \expandafter\ifx\csname\curr@fontshape\endcsname\relax
1463 %<latexrelease> \let\f@series\default@series
1464 %<latexrelease> \expandafter
1465 %<latexrelease> \ifx\csname\curr@fontshape\endcsname\relax
1466 %<latexrelease> \let\f@family\default@family
1467 %<latexrelease> \fi \fi
1469 %<latexrelease> \@font@warning{Font shape
1470 %<latexrelease> `\expandafter\string\reserved@a'
1471 %<latexrelease> \expandafter\@gobble\string\@undefined
1472 %<latexrelease> \MessageBreak
1473 %<latexrelease> using `\curr@fontshape' instead\@wrong@font@char}%
1474 %<latexrelease> \global\let\last@fontshape\reserved@a
1475 %<latexrelease> \gdef\@defaultsubs{%
1476 %<latexrelease> \@font@warning{Some font shapes were not available,
1477 %<latexrelease> defaults substituted.\@gobbletwo}}%
1478 %<latexrelease> \global\expandafter\expandafter\expandafter\let
1479 %<latexrelease> \expandafter\reserved@a
1480 %<latexrelease> \csname\curr@fontshape\endcsname
1481 %<latexrelease> \xdef\font@name{%
1482 %<latexrelease> \csname\curr@fontshape/\f@size\endcsname}%
1483 %<latexrelease> \pickup@font}
1484 %<latexrelease>\EndIncludeInRelease
1489 % \begin{macro}{\@wrong@font@char}
1490 % \changes{v3.0m}{1995/11/17}{(DPC) Macro added. latex/1676}
1491 % Normally empty but redefined in |\UseTextSymbol| so that the
1492 % Font shape undefined message can refer to the symbol causing the
1495 \let\@wrong@font@char\@empty
1499 % \begin{macro}{\@@defaultsubs}
1500 % \changes{v3.0d}{1995/07/13}{macro added}
1501 % \changes{v3.0k}{1995/10/24}{macro removed}
1502 % \begin{macro}{\@defaultsubs}
1503 % \changes{v3.0d}{1995/07/13}{macro added}
1506 \let\@defaultsubs\relax
1512 % \begin{macro}{\strip@prefix}
1513 % In |\extract@font| we will need a way to recover the
1514 % replacement text of a macro.
1515 % This is done by the primitive |\meaning| together
1516 % with the macro |\strip@prefix| (for the details
1517 % see appendix~D of the \TeX{}book, p.\ 382).
1519 \def\strip@prefix#1>{}
1527 % \section{Assigning math fonts to \emph{versions}}
1530 % \begin{macro}{\install@mathalphabet}
1531 % This is just another name for |\gdef| but we can redefine it if
1532 % necessary later on.
1534 \let\install@mathalphabet\gdef
1540 % \begin{macro}{\math@fonts}
1542 % \changes{v1.9a}{1992/07/26}{}
1544 \let\math@fonts\@empty
1550 % \begin{macro}{\select@group}
1551 % \changes{v1.0t}{1989/11/26}{\cs{bgroup}/\cs{egroup} changed to
1552 % \cs{begingroup}/\cs{endgroup} to avoid empty Ord atom on math list.}
1553 % |\select@group| has four arguments: the new
1554 % \meta{math alphabet identifier} (a control sequence), the
1555 % \meta{math group number}, the extra macro for math mode
1556 % and the |\curr@fontshape| definition macro name.
1557 % We first check if we are in math mode.
1558 % \changes{v1.1a}{1989/12/16}{\cs{relax} in front added.}
1559 % \changes{v1.1a}{1989/12/16}{Now four arguments.}
1561 %\def\select@group#1#2#3{\relax\ifmmode
1563 % We do these things locally using |\begingroup| instead
1564 % of |\bgroup| to avoid the appearance of an empty Ord
1565 % atom on the math list.
1569 % We set the math fonts for the \emph{family} in question by calling
1570 % |\getanddefine@fonts| in the correct environment.
1571 % \changes{v1.9a}{1992/07/26}{}
1574 % \getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3%
1576 % We globally select the math fonts\dots
1578 % \globaldefs\@ne \math@fonts
1580 % \dots{} and close the group to
1581 % restore |\globaldefs| and |\escapechar|.
1585 % As long as no \emph{size} or \emph{version} change occurs
1586 % the \meta{math alphabet identifier} should simply switch to the
1587 % installed \emph{math group} instead of calling
1589 % unnecessarily. So we globally redefine the first argument
1590 % (the new \meta{math alphabet identifier})
1591 % to expand into a |\mathgroup| switch
1592 % and then select this \emph{alphabet}. Note that this redefinition
1593 % will be overwritten by the next call to a \emph{version} macro.
1594 % \changes{v1.1a}{1989/12/16}{Usage of `\quotechar=' macro added.}
1595 % \changes{v1.1a}{1989/12/16}{Redefinition of alphabet now simpler.}
1596 % \changes{v1.2a}{1990/01/20}{Def for alph id changed.}
1597 % The original code for the end of |\select@group| was
1599 % \gdef#1{#3\mathgroup #2}#1\fi}
1601 % i.e.\ first redefining the \meta{math alphabet identifier} and
1602 % then calling the new definition to switch to the wanted
1603 % \meta{math group}. Now we define the \meta{math alphabet
1604 % identifier} as a call to the |\use@mathgroup| command.
1605 % \changes{v1.2b}{1990/01/21}{Code moved to \cs{use@mathgroup}.}
1607 % \xdef#1{\noexpand\use@mathgroup\noexpand#2%
1608 % {\number\csname c@mv@\math@version\endcsname}}%
1610 % \changes{v1.3c}{1992/05/12}{Added call to
1611 % \cs{extract@alph@from@version}.}
1612 % But this is not sufficient, as we learned the hard way.
1613 % The problem here is that the loading of the fonts that comprise
1614 % the alphabet identifier |#1|, as well as the necessary math font
1615 % assignments is deferred until it is used. This is OK so far, but
1616 % if the fonts are switched within the current formula (which may
1617 % happen if a sub-formula is a box that contains a math version
1618 % switch) the font assignments for |#1| are not restored unless
1619 % |#1| is used again. This is disastrous since TeX sees the wrong
1620 % fonts at the end of the math formula, when it converts the math
1621 % list into a horizontal list.
1623 % This is taken into account as follows: When a math alphabet
1624 % identifier is used for the first time in a certain version
1625 % it modifies the corresponding macro |\mv@|\meta{version}
1626 % so that it calls |\getanddefine@fonts| directly in future as well.
1627 % We use the macro |\extract@alph@from@version| to do this.
1628 % It takes the math alphabet identifer |#1| and the math version
1629 % macro as arguments.
1630 % \changes{v1.9a}{1992/07/26}{}
1632 % \expandafter\extract@alph@from@version
1633 % \csname mv@\math@version\expandafter\endcsname
1634 % \expandafter{\number\csname c@mv@\math@version\endcsname}%
1636 % \stepcounter{mv@\math@version}%
1638 % Finally, it is not possible to simply call the new definition
1640 % have an argument (the third argument of |\use@mathgroup|
1641 % or more exactly the argument od |\math@egroup| if the {\ttfamily
1642 % margid} option is in force)
1643 % which would swallow our closing |\fi|. So
1644 % we use the |\expandafter| technique to remove the |\fi|
1645 % before the |\use@mathgroup| is expanded.
1647 %\expandafter #1\fi}
1652 % \begin{macro}{\extract@alph@from@version}
1653 % \changes{v1.3c}{1992/05/12}{Macro added.}
1654 % We proceed to the definition of the
1655 % macro |\extract@alph@from@version|. As stated above, it takes
1656 % a math alphabet identifier and a math version macro
1657 % (e.g.\ |\mv@normal|) as its arguments.
1659 \def\extract@alph@from@version#1#2#3{%
1661 % To extract and replace the definition of math alphabet identifier
1662 % |#3| in macro |#1| we have to recall how this definition looks
1663 % like: Somewhere in the replacement text of |#1| there is
1664 % the sequence\\[2pt]
1665 % |\install@mathalphabet|\meta{math alphabet identifier} |#3||{%| \\
1666 % \hspace*{\MacroIndent}\hspace*{5mm}
1667 % \meta{Definitions for }|#3}| \\[2pt]
1668 % Hence, the first thing we do is to extract the tokens preceding
1669 % this definitions, the definition itself, and the tokens following
1670 % it. To this end we define one auxiliary macro |\reserved@a|.
1672 \def\reserved@a##1\install@mathalphabet#3##2##3\@nil{%
1674 % When |\reserved@a| is expanded, it will have the tokens preceding
1675 % the definition in question in its first argument (|##1|), the
1676 % following tokens in its third argument (|##3|), and the replacement
1677 % text for the math alphabet identifier |#3| in its second argument.
1678 % (|##2|). This is then recorded for later use in a temporary macro
1681 \def\reserved@b{##2}%
1683 % Additionally, we define a macro |\reserved@c| to reconstruct the
1684 % definitions for the math version in question from the tokens that
1685 % will remain unchanged (|##1| and |##3|) and the yet to build new
1686 % definitions for the math alphabet identifier |#3|.
1688 \def\reserved@c####1{\gdef#1{##1####1##3}}}%
1690 % Then we execute our auxiliary macro.
1692 \expandafter\reserved@a#1\@nil
1694 % OK, so now we have to build the new definition for |#3|. To do so,
1695 % we first extract the interesting parts out of the old one.
1696 % The old definition looks like:\\[2pt]
1697 % |\select@group|\meta{math alphabet identifier} \\
1698 % \hspace*{\MacroIndent}\hspace*{5mm}
1699 % \meta{math group number}\meta{math extra part}\\
1700 % \meta{|curr@fontshape| definition} \\[2pt]
1701 % So we define a new temporary macro |\reserved@a| that
1702 % extracts these parts.
1704 \def\reserved@a\select@group#3##1##2\@nil{%
1706 % This macro can now directly rebuild the math version definition
1707 % by calling |\reserved@c|:
1710 \getanddefine@fonts{#2}##2%
1711 \install@mathalphabet#3{%
1712 \relax\ifmmode \else \non@alpherr#3\fi
1713 \use@mathgroup##1{#2}}}%
1715 % \changes{v2.1t}{1994/10/15}{Warn if math alpha is used outside math}
1716 % In addtion it defines the alphabet the way it should be used from
1719 \gdef#3{\relax\ifmmode \else \non@alpherr#3\fi
1720 \use@mathgroup##1{#2}}}%
1722 % Finally, we only have to call this macro |\reserved@a| on the old
1723 % definitions recorded in |\reserved@b|:
1725 \expandafter\reserved@a\reserved@b\@nil
1732 % \begin{macro}{\math@bgroup}
1733 % \changes{v1.2a}{1990/01/20}{Def. placed in this file.}
1734 % \begin{macro}{\math@egroup}
1735 % \changes{v1.2a}{1990/01/20}{Def. placed in this file.}
1736 % \changes{v1.2h}{1990/03/30}{Changed to have one arg.}
1737 % \changes{v2.2f}{1994/03/10}{Changed \cs{begingroup}/\cs{endgroup} to
1738 % \cs{bgroup}/\cs{egroup}.}
1739 % Here are the default definitions for |\math@bgroup| and
1740 % |\math@egroup|. We use |\bgroup| instead of |\begingroup|
1741 % to avoid `leaking out' of style changes. This has the side
1742 % effect of always producing mathord atoms.
1744 \let\math@bgroup\bgroup
1745 \def\math@egroup#1{#1\egroup}
1751 % \begin{macro}{\calculate@math@sizes}
1752 % \changes{v2.1i}{1994/04/18}{Changed message to log only}
1753 % Here is the default definition for |\calculate@math@sizes|
1754 % a more elaborate interface
1755 % is under testing in mthscale.sty.
1757 \gdef\calculate@math@sizes{%
1758 \@font@info{Calculating\space math\space sizes\space for\space
1759 size\space <\f@size>}%
1761 \@tempdimb \defaultscriptratio \dimen@
1762 \dimen@ \defaultscriptscriptratio \dimen@
1763 \expandafter\xdef\csname S@\f@size\endcsname{%
1764 \gdef\noexpand\tf@size{\f@size}%
1765 \gdef\noexpand\sf@size{\strip@pt\@tempdimb}%
1766 \gdef\noexpand\ssf@size{\strip@pt\dimen@}%
1767 \noexpand\math@fontstrue}}
1771 % \begin{macro}{\defaultscriptratio}
1772 % \changes{v2.1h}{1994/04/11}{Macro added}
1773 % \begin{macro}{\defaultscriptscriptratio}
1774 % \changes{v2.1h}{1994/04/11}{Macro added}
1775 % The default ratio for math
1777 % 1 to |\defaultscriptratio| to |\defaultscriptscriptratio|.\\
1778 % By default this is 1 to .7 to .5.
1780 \def\defaultscriptratio{.7}
1781 \def\defaultscriptscriptratio{.5}
1786 % \begin{macro}{\noaccents@}
1787 % If we don't have a definition for |\noaccents@| we provide a
1790 \ifx\noaccents@\@undefined
1791 \let\noaccents@\@empty
1796 % \begin{macro}{\showhyphens}
1797 % \changes{v1.2l}{1990/06/30}{Macro added.}
1798 % \changes{v2.0e}{1993/05/16}{Use \cs{reset@font}}
1799 % \changes{v3.0h}{1995/10/10}
1800 % {Use \cs{normalfont} and make colour safe, and autoloadable}
1801 % \changes{v3.0u}{1998/03/25}
1802 % {Suppress unnecessary error when used in preamble}
1803 % The |\showhyphens| command must be redefined since the version in
1804 % \texttt{plain.tex} uses |\tenrm|. We have also made some further
1805 % adjustments for its use in \LaTeX.
1807 \gdef\showhyphens#1{%
1811 \parfillskip\z@skip\hsize\maxdimen
1813 \pretolerance\m@ne\tolerance\m@ne\hbadness\z@\showboxdepth\z@\ #1%
1819 % \begin{macro}{\addto@hook}
1820 % \changes{v1.0u}{1989/12/05}{\cs{addto@hook} added.}
1821 % \changes{v2.1d}{1994/02/10}{Made \cs{addto@hook} long.}
1822 % We need a macro to add tokens to a hook.
1824 \long\def\addto@hook#1#2{#1\expandafter{\the#1#2}}
1829 % \begin{macro}{\@vpt}
1830 % \changes{v2.1v}{1994/11/09}{(DPC) macros added, from setsize.dtx}
1831 % \changes{v2.1v}{1994/11/09}{(DPC) reduce save stack usage latex/1742}
1837 % \begin{macro}{\@vipt}
1843 % \begin{macro}{\@viipt}
1849 % \begin{macro}{\@viiipt}
1855 % \begin{macro}{\@ixpt}
1861 % \begin{macro}{\@xpt}
1867 % \begin{macro}{\@xipt}
1873 % \begin{macro}{\@xiipt}
1879 % \begin{macro}{\@xivpt}
1885 % \begin{macro}{\@xviipt}
1891 % \begin{macro}{\@xxpt}
1897 % \begin{macro}{\@xxvpt}