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 [2017/01/10 v3.2a 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{}}
56 % \GetFileInfo{ltfssbas.dtx}
57 % \title{A new font selection scheme for \TeX{} macro packages\\
58 % (Basic Macros)\thanks
59 % {This file has version number
60 % \fileversion\ dated \filedate}}
62 % \author{Frank Mittelbach \and Rainer Sch\"opf}
64 % \MaintainedByLaTeXTeam{latex}
67 % This file contains the main implementation of the `low level' font
68 % selection commands. See other parts of the \LaTeX\
69 % distribution, or \emph{The \LaTeX\ Companion} for higher level
70 % documentation of the \LaTeX\ `New' Font Selection Scheme.
74 % The macro documentation is still basically the documentation from the
75 % first NFSS release and therefore in some cases probably not
76 % completely accurate.
81 % \changes{v3.0v}{1998/08/17}{(RmS) Documentation fixes.}
82 % \changes{v3.0j}{1995/10/22}{(RmS) New size function macro
83 % \cs{genb@sfcnt} needs to be disabled at \cs{document}.}
84 % \changes{v3.0i}{1995/10/20}
85 % {(DPC) Modify autoload code, change \cs{undefined}}
86 % \changes{v3.0g}{1995/10/04}{Modify autoload code}
87 % \changes{v3.0f}{1995/08/24}{Added autoload code}
88 % \changes{v3.0d}{1995/07/13}
89 % {minor documentation changes}
90 % \changes{v3.0c}{1995/06/15}
91 % {(DPC) minor documentation changes}
92 % \changes{v3.0a}{1995/05/24}
93 % {(DPC) Make file from previous file, fam.dtx 1995/05/20 v2.2d}
96 % \changes{v2.1x}{1994/11/18}{(DPC) use \cs{reserved@f} not \cs{next}}
97 % \changes{v2.1q}{1994/05/20}{Use new error commands}
98 % \changes{v2.1o}{1994/05/15}{encoding cmds changed to {enc}-cmd}
99 % \changes{v2.1k}{1994/05/13}{Remove File identification `typeout'}
100 % \changes{v2.1j}{1994/05/12}{New baselinestretch concept}
101 % \changes{v2.1j}{1994/05/12}{Replaced hand-protected commands by
102 % \cs{DeclareRobustCommand} defs}
103 % \changes{v2.1h}{1994/04/11}{Added \cs{defaultscriptratio} and
104 % \cs{defaultscriptscriptratio}. ASAJ.}
105 % \changes{v2.1g}{1994/03/13}{add 2ekernel module to omit repeated code}
106 % \changes{v2.1a}{1994/01/17}{New math font setup}
107 % \changes{v2.0c}{1993/03/18}{Changed all \cs{@tempdima} in
108 % \cs{@tempdimb} to avoid killing \cs{numberline}}
109 % \changes{v1.91a}{1992/09/22}{Introduced \cs{tf@size} for math size.}
110 % \changes{v1.3a}{1991/11/27}{All \cs{family}, \cs{shape} etc.
111 % renamed to \cs{fontfamily} etc.}
112 % \changes{v1.2i}{1990/04/01}{Code added from tracefnt.dtx.}
113 % \changes{v1.2i}{1990/04/01}{Support for TeX3.}
114 % \changes{v1.2g}{1990/02/16}{Support for changes of \cs{baselineskip}
115 % without changing the size.}
117 % \changes{v1.2c}{1990/01/23}{\cs{no@version@warning} renamed to
118 % \cs{no@alphabet@error}.}
119 % \changes{v1.0s}{1989/11/25}{All \cs{edef}\cs{font@name} changed to
120 % \cs{xdef}\cs{font@name}.
121 % Necessary after introduction of
122 % \cs{begingroup}/\cs{endgroup} in v1.0q.}
123 % \changes{v1.0s}{1989/11/25}{extra// $\to$ + in \cs{extra@def}.}
124 % \changes{v1.0o}{1989/11/08}{First parameter of
125 % \cs{define@mathalphabet}
126 % and \cs{define@mathgroup} changed
127 % from string to control sequence.}
128 % \changes{v1.0m}{1989/09/14}
129 % {Global replacement: \cs{group} to \cs{mathgroup}}
130 % \changes{v1.0k}{1989/05/22}{Lines longer than 72 characters folded.}
131 % \changes{v1.0j}{1989/05/01}{Default for \cs{baselinestretch} added.}
132 % \changes{v1.0i}{1989/04/29}
133 % {Removed the \cs{halign} \cs{noalign} correction
135 % \changes{v1.0h}{1989/04/29}{Documented problem with \cs{halign}, and
137 % \changes{v1.0g}{1989/04/27}{Documentation revised.}
138 % \changes{v1.0f}{1989/04/23}{\% in \cs{getanddefinefonts} added.}
139 % \changes{v1.0e}{1989/04/21}{Documentation is fun!!
140 % Parameters of \cs{define@mathalphabet} changed.}
141 % \changes{v1.0d}{1989/04/19}{Even more doc.}
142 % \changes{v1.0c}{1989/04/14}{More documentation added.}
143 % \changes{v1.0b}{1989/04/10}{\cs{preload@sizes} added.}
144 % \changes{v1.0b}{1989/04/10}{\cs{wrong@fontshape} changed to define
145 % substitution font/shape macro.}
146 % \changes{v1.0a}{1989/04/10}{Starting with version numbers!!
147 % \cs{ifmmode} added in \cs{math@group}}
148 % \changes{v2.1w}{1994/11/17}
149 % {\cs{@tempa} to \cs{reserved@a}}
150 % \changes{v3.0z}{2015/02/21}
151 % {Removed autoload code}
154 % The `2ekernel' code ensures that a |\usepackage{autofss1}| is
155 % essentially ignored if a `full' format is being used that has
156 % picture mode already in the format.
158 % Note the |autofss2| loading is currently disabled.
161 %<2ekernel>\expandafter\let\csname ver@autofss1.sty\endcsname\fmtversion
165 % \section{Preliminary macros}
168 % of macros that will be used later.
171 % \begin{macro}{\@nomath}
172 % |\@nomath| is used by most macros that will have no effect
173 % in math mode. It issues a warning message.
176 \def\@nomath#1{\relax\ifmmode
177 \@font@warning{Command \noexpand#1invalid in math mode}\fi}
181 % \changes{v1.2c}{1990/01/23}{Macro \cs{no@alphabet@help} added}
182 % \changes{v2.1i}{1994/04/18}{Macro \cs{no@alphabet@help}
185 % \begin{macro}{\no@alphabet@error}
186 % \changes{v1.2c}{1990/01/23}{Changed to error call}
187 % \changes{v2.1i}{1994/04/18}{Use std LaTeX error macro}
188 % The macro |\no@alphabet@error| is called whenever
189 % the user requests a math \emph{alphabet} that is not
190 % available in the current \emph{version}.
191 % In math mode an error message is produced otherwise the command
193 % The argument is the name of the control sequence that identifies
194 % the math \emph{alphabet}.
195 % The |\relax| at the beginning is necessary to prevent
196 % \TeX{} from scanning too far in certain situations.
198 \gdef\no@alphabet@error#1{\relax \ifmmode
199 \@latex@error{Math\space alphabet\space identifier\space
200 \noexpand#1is\space undefined\space in\space math\space
201 version\space `\math@version'}%
202 {Your\space requested\space math\space alphabet\space
203 is\space undefined\space in\space the\space current\space
204 math\space version.^^JCheck\space the\space spelling\space
205 or\space use\space the\space \noexpand\SetMathAlphabet\space
212 % \begin{macro}{\new@mathgroup}
213 % \begin{macro}{\mathgroup}
214 % We also give a new name to |\newfam| and |\fam|
215 % to avoid verbal confusion
216 % (see the introduction).\footnote{For the same reason
217 % it seems advisable to
218 % {\ttfamily\bslash let\bslash fam} and
219 % {\ttfamily\bslash newfam}
220 % equal to {\ttfamily\bslash relax},
221 % but this is commented out to retain
222 % compatibility to existing style files.}
223 % \changes{v1.2e}{1990/01/28}{\cs{newfam} let to \cs{new@mathgroup}.}
224 % \changes{v3.0a}{1995/05/24}
225 % {(DPC) No need to redefine \cs{newfam} as not outer}
226 % \changes{v3.0b}{1995/05/27}
227 % {(FMi) But a need to define \cs{new@mathgroup}}
228 % \changes{v3.0y}{2014/12/30}
229 % {move allocation to ltplain.}
231 %\def\new@mathgroup{\alloc@8\mathgroup\chardef\sixt@@n}
233 %\let\newfam\new@mathgroup
234 \@onlypreamble\new@mathgroup
240 % \section{Macros for setting up the tables}
242 % \begin{macro}{\DeclareFontShape}
244 % \changes{v1.9a}{1992/07/26}{Introduced \cs{DeclareFontShape}}
245 % The macro |\DeclareFontShape| takes $6$ arguments:
247 \def\DeclareFontShape{\begingroup
249 % First we restore the catcodes of all characters used in the syntax.
250 % \changes{v2.1e}{1994/02/24}
251 % {Separate restoration of catcodes for fd cmds}
255 % We use |\expandafter| |\endgroup| to restore catcode in case
256 % something goes wrong with the argument parsing (suggested by Tim
262 % \begin{macro}{\DeclareFontShape}
263 % \changes{v2.1c}{1994/02/07}{revert catcode settings earlier}
264 % \changes{v3.0m}{1995/11/01}
265 % {(DPC) Test for \cs{relax} not \cs{undefined}, internal/1933}
267 \expandafter\endgroup
269 \def\DeclareFontShape@#1#2#3#4#5#6{%
270 \expandafter\ifx\csname #1+#2\endcsname\relax
271 \@latex@error{Font family `#1+#2' unknown}\@eha
274 \xdef\csname#1/#2/#3/#4\endcsname{\expandafter\noexpand
275 \csname #5\endcsname}%
278 \expandafter\let\csname#5\expandafter\endcsname
279 \ifx\reserved@a\@empty
290 % \begin{macro}{\DeclareFixedFont}
291 % Define a direct font switch that avoids all overhead.
292 % \changes{v2.1u}{1994/11/06}{Renamed
293 % \cs{every@size} to \cs{every@math@size}.}
295 \def\DeclareFixedFont#1#2#3#4#5#6{%
300 \usefont{#2}{#3}{#4}{#5}%
301 \global\expandafter\let\expandafter#1\the\font
310 % \begin{macro}{\do@subst@correction}
313 \def\do@subst@correction{%
314 \xdef\subst@correction{%
316 \global\expandafter\font
317 \csname \curr@fontshape/\f@size\endcsname
318 \noexpand\fontname\font
321 % Calling |\subst@correction| after the current group means calling
322 % it after we have loaded the substitution font which is done
325 \aftergroup\subst@correction
330 % \begin{macro}{\DeclareFontFamily}
332 \def\DeclareFontFamily#1#2#3{%
334 % If we want fast checking for the encoding scheme we can just
335 % check for |\T@..| being defined.
338 % \def\reserved@b{#1}%
339 % \def\cdp@elt##1##2##3##4{\def\reserved@c{##1}%
340 % \ifx\reserved@b\reserved@c \@tempswatrue\fi}%
345 \@latex@error{Encoding scheme `#1' unknown}\@eha
349 % Now we have to define the macro |\|\meta{\#1}|+|\meta{\#2}
350 % to contain |#3|. But since most of the time |#3| will be empty
351 % we use |\let| in a tricky way rather than a simple |\def| since
352 % this will save internal memory.
353 % We store the argument |#3| in a temporary macro
358 % We compare |\reserved@a| with |\@empty|
359 % If these two are the same we |\let| the `extra'
360 % macro equal to |\@empty| which is not the same a doing a |\let|
361 % to |\reserved@a| --- the latter would blow one extra memory
362 % location rather then reusing the one from |\@empty|.
365 \expandafter\let\csname #1+#2\expandafter\endcsname
366 \ifx \reserved@a\@empty
376 % \begin{macro}{\cdp@list}
377 % We initialize the code page list to be empty.
380 \@onlypreamble\cdp@list
384 % \begin{macro}{\cdp@elt}
387 \@onlypreamble\cdp@elt
394 % \begin{macro}{\DeclareFontEncoding}
396 \def\DeclareFontEncoding{%
398 % First we start with ignoring all blanks and newlines since every
399 % surplus space in the second or third argument will come out in
400 % a weird place in the document.
401 % \changes{v2.1c}{1994/02/07}{revert catcode settings earlier}
402 % \changes{v2.1t}{1994/10/19}{Add missing \cs{relax}.}
403 % \changes{v2.1z}{1994/12/06}{use \cs{nfss@catcodes}}
407 \expandafter\endgroup
408 \DeclareFontEncoding@}
409 \@onlypreamble\DeclareFontEncoding
411 % \changes{v2.0g}{1993/09/15}
412 % {Corrected: \cs{default@T} to \cs{default@M}.}
414 \def\DeclareFontEncoding@#1#2#3{%
416 \ifx\csname T@#1\endcsname\relax
417 \def\cdp@elt{\noexpand\cdp@elt}%
418 \xdef\cdp@list{\cdp@list\cdp@elt{#1}%
419 {\default@family}{\default@series}%
422 % To support encoding dependent commands (like accents) we
423 % initialise the command
424 % |\|\meta{encoding}|-cmd| to be |\@changed@cmd|.
425 % (See \texttt{ltoutenc.dtx} for details.)
426 % \changes{v2.1l}{1994/05/13}{Init encoding change command}
427 % \changes{v2.1n}{1994/05/14}{Only init enc change cmd when
429 % \changes{v2.1n}{1994/05/14}{Log if encoding is redeclared}
431 \expandafter\let\csname#1-cmd\endcsname\@changed@cmd
433 \@font@info{Redeclaring font encoding #1}%
438 \global\@namedef{T@#1}{#2}%
439 \global\@namedef{M@#1}{\default@M#3}%
441 % Keep a record of the last encoding being declared:
442 % \changes{v3.0w}{1999/01/06}{Added \cs{LastDeclaredEncoding} to
443 % support cyrillic integration (pr/2988)}
445 \xdef\LastDeclaredEncoding{#1}%
447 \@onlypreamble\DeclareFontEncoding@
452 % \begin{macro}{\LastDeclaredEncoding}
453 % \changes{v3.0w}{1999/01/06}{Added \cs{LastDeclaredEncoding} to
454 % support cyrillic integration (pr/2988)}
455 % The last encoding being declared by |\DeclareFontEncoding|.
457 \def\LastDeclaredEncoding{}
461 % \begin{macro}{\DeclareFontSubstitution}
463 \def\DeclareFontSubstitution#1#2#3#4{%
465 \ifx\csname T@#1\endcsname\relax
466 \@latex@error{Encoding scheme `#1' unknown}\@eha
470 % \changes{v3.0x}{2002/10/02}{Adding \cs{LastDeclaredEncoding}
471 % introduced a bug as on some occasions that macro name was stored
472 % in the internal lists instead of the actual encoding. (pr/3459)}
473 % We loop through the |\cdp@list| and rebuild it anew in |\toks@|
474 % thereby replacing the defaults for the encoding in question with
475 % the new defaults. It is important to store the encoding to test
476 % against expanded in |\reserved@a| since it might just be
477 % |\LastDeclaredEncoding| that is passed as |#1|.
479 \edef\reserved@a{#1}%
481 \def\cdp@elt##1##2##3##4{%
482 \def\reserved@b{##1}%
483 \ifx\reserved@a\reserved@b
485 % Here we use the new defaults but we use |##1| (i.e., the encoding
486 % name already stored previously) since we know that it is expanded.
488 \addto@hook\toks@{\cdp@elt{##1}{#2}{#3}{#4}}%
491 % If |\reserved@a| and |\reserved@b| differ then we simply copy
492 % from the old list to the new.
494 \addto@hook\toks@{\cdp@elt{##1}{##2}{##3}{##4}}%
497 \xdef\cdp@list{\the\toks@}%
501 \def\default@family{#2}%
502 \def\default@series{#3}%
503 \def\default@shape{#4}%
507 \@onlypreamble\DeclareFontSubstitution
512 % \begin{macro}{\DeclareFontEncodingDefaults}
514 \def\DeclareFontEncodingDefaults#1#2{%
516 \ifx\default@T\@empty\else
517 \@font@info{Overwriting encoding scheme text defaults}%
522 \ifx\default@M\@empty\else
523 \@font@info{Overwriting encoding scheme math defaults}%
528 \@onlypreamble\DeclareFontEncodingDefaults
533 % \begin{macro}{\default@T}
534 % \begin{macro}{\default@M}
536 \let\default@T\@empty
537 \let\default@M\@empty
543 % \begin{macro}{\DeclarePreloadSizes}
545 \def\DeclarePreloadSizes#1#2#3#4#5{%
547 {\@latex@error{Encoding scheme `#1' unknown}\@eha}%
550 % Don't know at the moment what this group here does!
554 % We define a macro |\reserved@f|\footnote{We cannot use
555 % {\ttfamily\bslash @tempa}
556 % since it is needed in
557 % {\ttfamily\bslash pickup@font}.}
558 % that grabs the next \emph{size} and loads the corresponding
560 % This is done by delimiting |\reserved@f|'s only argument by the
561 % \textsf{token} |,| (comma).
563 \def\reserved@f##1,{%
565 % The end of the list will be detected when there are no more
566 % elements, i.e.\ when |\reserved@f|'s argument is empty.
567 % The trick used here is explained in Appendix~D of the
568 % \TeX{}book: if the argument is empty the |\if|
569 % will select the first clause and |\let| |\reserved@f|
571 % (We use the |>| character here since it cannot appear
572 % in font file names.)
573 % \changes{v1.2j}{1990/06/24}{Missing percent added.}
576 \let\reserved@f\relax
579 % Otherwise, we define |\font@name| appropriately and
580 % call |\pickup@font| to do the work.
581 % Note that the requested |\curr@fontshape|
582 % combination must have been defined, or you will get an error.
583 % The definition of |\font@name| is carried out globally
584 % to be consistent with the rest of the code in this file.
586 \xdef\font@name{\csname#1/#2/#3/#4/##1\endcsname}%
589 % Now we forget the name of the font just loaded.
590 % More precisely, we set the corresponding control sequence
591 % to |\relax|. This means that later on, when the font
592 % is first used, the macro |\define@newfont| is called
593 % again to execute the `extra' macro for this font.
594 % \changes{v1.2d}{1990/01/27}{Font identifier set to \cs{relax}.}
596 \global\expandafter\let\font@name\relax
599 % Finally we call |\reserved@f| again to process the next
600 % \emph{size}. If |\reserved@f| was |\let| equal to |\relax|
601 % this will end the macro.
605 % We finish with reinserting the list of sizes after the
607 % macro and appending an empty element so that the end of the list
608 % is recognized properly.
614 \@onlypreamble\DeclarePreloadSizes
620 % \begin{macro}{\ifmath@fonts}
621 % We need a switch to decide if we have to switch math fonts.
622 % For this purpose we provide |\ifmath@fonts|
623 % that can be set to true or false by the |\S@...| macros
624 % depending on if math fonts
625 % are provided for this size or not.
626 % The default is of course to switch all fonts.
628 \newif\ifmath@fonts \math@fontstrue
634 % \begin{macro}{\DeclareMathSizes}
635 % \begin{macro}{\DeclareMathSizes*}
636 % |\DeclareMathSizes| takes the text size, math text size, math
637 % script size, and math scriptscript size as arguments and defines
638 % the right |\S@|\dots{} macro.
641 \def\DeclareMathSizes{%
642 \@ifstar{\@DeclareMathSizes\math@fontsfalse}%
643 {\@DeclareMathSizes{}}}
644 \@onlypreamble\DeclareMathSizes
649 % \begin{macro}{\@DeclareMathSizes}
650 % \changes{v3.0p}{1996/07/26}{use faster \cs{if} test}
651 % This modification by Michael J. Downes on comp.text.tex on 2002/10/17
652 % allows the user to have settings such as\\
653 % |\DeclareMathSizes{9.5dd}{9.5dd}{7.4dd}{6.6dd}|.
654 % \changes{v3.0y}{2015/01/11}{Allow arbitrary units (latexrelease)}
657 %<latexrelease>\IncludeInRelease{2015/01/01}{\@DeclareMathSizes}%
658 %<latexrelease> {Arbitrary units in \DeclareMathSizes}%
659 %<*2ekernel|latexrelease>
660 \def\@DeclareMathSizes #1#2#3#4#5{%
661 \@defaultunits\dimen@ #2pt\relax\@nnil
663 \expandafter\let\csname S@\strip@pt\dimen@\endcsname\math@fontsfalse
665 \@defaultunits\dimen@ii #3pt\relax\@nnil
666 \@defaultunits\@tempdima #4pt\relax\@nnil
667 \@defaultunits\@tempdimb #5pt\relax\@nnil
669 \expandafter\xdef\csname S@\strip@pt\dimen@\endcsname{%
670 \gdef\noexpand\tf@size{\strip@pt\dimen@ii}%
671 \gdef\noexpand\sf@size{\strip@pt\@tempdima}%
672 \gdef\noexpand\ssf@size{\strip@pt\@tempdimb}%
677 %</2ekernel|latexrelease>
678 %<latexrelease>\EndIncludeInRelease
679 %<latexrelease>\IncludeInRelease{0000/00/00}{\@DeclareMathSizes}%
680 %<latexrelease> {Arbitrary units in \DeclareMathSizes}%
681 %<latexrelease>\def\@DeclareMathSizes#1#2#3#4#5{%
682 %<latexrelease> \@defaultunits\dimen@#2pt\relax\@nnil
683 %<latexrelease> \if$#3$%
684 %<latexrelease> \expandafter \let
685 %<latexrelease> \csname S@\strip@pt\dimen@\endcsname
686 %<latexrelease> \math@fontsfalse
687 %<latexrelease> \else
688 %<latexrelease> \expandafter \gdef
689 %<latexrelease> \csname S@\strip@pt\dimen@\endcsname
690 %<latexrelease> {\gdef\tf@size{#3}\gdef\sf@size{#4}%
691 %<latexrelease> \gdef\ssf@size{#5}%
694 %<latexrelease> \fi}%
695 %<latexrelease>\EndIncludeInRelease
700 \@onlypreamble\@DeclareMathSizes
706 % \section{Selecting a new font}
708 % \subsection{Macros for the user}
711 % \begin{macro}{\fontencoding}
712 % \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
713 % \begin{macro}{\f@encoding}
714 % As we said in the introduction a font is described by four parameters.
715 % We first define macros to specify the wanted \emph{family},
716 % \emph{series}, or \emph{shape}.
717 % These are simply recorded in internal macros
718 % |\f@family|, |\f@series|, and |\f@shape|, resp.
719 % We use |\edef|'s so that the arguments can also be macros.
721 \DeclareRobustCommand\fontencoding[1]{%
722 \expandafter\ifx\csname T@#1\endcsname\relax
723 \@latex@error{Encoding scheme `#1' unknown}\@eha
725 \edef\f@encoding{#1}%
726 \ifx\cf@encoding\f@encoding
728 % If the new encoding is the same as the old
729 % encoding we have nothing to do.
730 % However, in case we had a sequence of several encoding changes
731 % without a |\selectfont| in-between we can save processing by
732 % making sure that |\enc@update| is |\relax|.
734 \let\enc@update\relax
737 % If current and new encoding differ we define the macro
739 % to contain all updates necessary at |\selectfont| time.
741 \let\enc@update\@@enc@update
749 % \begin{macro}{\@@enc@update}
753 % When |\@@enc@update| is executed |\f@encoding| holds the encoding
755 % for the new encoding and |\cf@encoding| the name of the last active
758 % We start by setting the init command for encoding dependent
759 % macros to |\@changed@cmd|.
763 \csname\cf@encoding -cmd\endcsname
766 % Then we turn the one for the new encoding to |\@current@cmd| (see
767 % \texttt{ltoutenc.dtx} for further explanations).
771 \csname\f@encoding-cmd\endcsname
774 % We execute the default settings |\default@T|, followed by the one
775 % for the new encoding.
778 \csname T@\f@encoding\endcsname
780 % Finally we change the default substitution values, disable
781 % |\enc@update| and make |\f@encoding| officially the current
784 \csname D@\f@encoding\endcsname
785 \let\enc@update\relax
786 \let\cf@encoding\f@encoding
792 % \begin{macro}{\enc@update}
793 % \changes{v2.1m}{1994/05/14}{Macro added}
794 % The default action in |\selectfont| is to do nothing.
796 \let\enc@update\relax
800 % \begin{macro}{\fontfamily}
801 % \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
802 % \begin{macro}{\f@family}
803 % \begin{macro}{\fontseries}
804 % \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
805 % \begin{macro}{\f@series}
806 % \begin{macro}{\fontshape}
807 % \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
808 % \changes{v2.1y}{1994/11/30}{Use \cs{@current@cmd} in
809 % \cs{@@enc@update}. ASAJ.}
810 % \begin{macro}{\f@shape}
812 \DeclareRobustCommand\fontfamily[1]{\edef\f@family{#1}}
813 \DeclareRobustCommand\fontseries[1]{\edef\f@series{#1}}
814 \DeclareRobustCommand\fontshape [1]{\edef\f@shape{#1}}
816 % Some handy abbreviation if you want to get some particular font
817 % in the current size. If also the size should change one has to
818 % issue a |\fontsize| command first.
820 \def\usefont#1#2#3#4{\fontencoding{#1}\fontfamily{#2}%
821 \fontseries{#3}\fontshape{#4}\selectfont
832 % \begin{macro}{\linespread}
833 % \changes{v2.1j}{1994/05/12}{New macro}
834 % \changes{v2.1p}{1994/05/16}{Remove surplus braces}
835 % The command |\linespread| changes the current |\baselinestretch|
836 % by calling |\set@fontsize|. The values for |\f@size| and
837 % |\f@baselineskip| will be left unchanged.
839 \DeclareRobustCommand\linespread[1]
840 {\set@fontsize{#1}\f@size\f@baselineskip}
845 % \begin{macro}{\fontsize}
846 % \changes{v2.1j}{1994/05/12}{Redefined to use \cs{set@fontsize}}
847 % \changes{v2.1p}{1994/05/16}{Pass \cs{baselinstretch} not
849 % We also define a macro that allows to specify a size. In this
850 % case, however, we also need the value of |\baselineskip|. As the
851 % first argument to |\set@fontsize| we pass the current value of
852 % |\baselinestretch|. This will either match the internal value (in
853 % which case nothing changes, or it will be an updated value due to
854 % a user change of that macro using |\renewcommand|. If we would
855 % pass the internal |\f@linespread| such a change would be
856 % effectively overwritten by a size change.
858 \DeclareRobustCommand\fontsize[2]
859 {\set@fontsize\baselinestretch{#1}{#2}}
864 % \changes{v2.1n}{1994/05/14}{Set defaults for all \cs{f@...}}
866 % \begin{macro}{\f@linespread}
867 % \changes{v2.1j}{1994/05/12}{New macro}
868 % This macro holds the current internal value for
869 % |\baselinestretch|.
875 \let\f@baselineskip\@empty
876 \let\f@linespread\@empty
880 % \begin{macro}{\cf@encoding}
881 % \changes{v2.1u}{1994/11/06}{New macro}
883 \let\f@encoding\@empty
884 \let\cf@encoding\@empty
890 % \begin{macro}{\@defaultunits}
892 % The function |\@defaultunits| when wrapped around a dimen or skip
893 % assignment supplies default units. Usage:
895 % |\@defaultunits\dimen@=#1pt\relax\@nnil|
897 % Note: the |\relax| is *important*. Other units can be substituted
898 % for the `pt' if desired.
900 % We use |\remove@to@nnil| as an auxiliary macros for
901 % |\@defaultunits|. It just has to gobble the supplied default unit
902 % `pt' or whatever, if it wasn't used in the assignment.
904 \def\@defaultunits{\afterassignment\remove@to@nnil}
908 % \begin{macro}{\strip@pt}
909 % \begin{macro}{\rem@pt}
910 % This macro strips the characters |pt| produced by using |\the|
911 % on a dimen register.
917 \def\x{\def\rem@pt##1.##2PT{##1\ifnum##2>\z@.##2\fi}}}
918 \expandafter\endgroup\x
919 \def\strip@pt{\expandafter\rem@pt\the}
925 % \begin{macro}{\mathversion}
926 % \changes{v1.0h}{1989/04/29}{Test if version defined added.}
927 % \changes{v1.0m}{1989/09/14}
928 % {Corrected typo: \cs{endscname} to \cs{endcsname}.}
929 % \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.}
930 % \begin{macro}{\math@version}
931 % |\mathversion| takes the math \emph{version} name as
932 % argument, defines |\math@version| appropriately and switches
933 % to the font selected
934 % forcing a call to |\glb@settings| if the \emph{version} is
935 % known to the system.
936 % \changes{v1.0p}{1989/11/14}{Math version prefix `mv@' added.}
937 % \changes{v1.0r}{1989/11/22}
938 % {\cs{def} $\to$ \cs{edef} for \cs{math@version}.}
939 % \changes{v1.2g}{1990/02/16}{\cs{@nomath} added.}
940 % \changes{v2.1a}{1994/01/17}{New math font setup}
942 \DeclareRobustCommand\mathversion[1]
943 {\@nomath\mathversion
944 \expandafter\ifx\csname mv@#1\endcsname\relax
945 \@latex@error{Math version `#1' is not defined}\@eha\else
946 \edef\math@version{#1}%
948 % We need to force a math font setup both now and at the point
949 % where we return to the previous math version.
950 % Forcing a math font setup can simply be done by setting
951 % |\glb@currsize| to an invalid value since this will trigger the
952 % setup when the formula starts.
954 \gdef\glb@currsize{}%
956 % When the scope of the current |\mathversion| ends we need to
957 % restore the old setup. However this time we need to force it
958 % directly at least if we are inside math, otherwise we could wait.
959 % Another way to enhance this code here is todo the setting only if
960 % the version really has changed after all. This might be
961 % interesting in case of \texttt{amstext} and \texttt{boldsymbol}.
962 % \changes{v2.1b}{1994/01/25}{Corrections for math setup}
964 \aftergroup\glb@settings
971 % If \TeX{} would support a hook just before the end of a formula
972 % (opposite of |\everymath| so to speak) the implementation of the
973 % algorithm would be much simpler because in that case we would set up
974 % the correct math fonts at this point without having to worry about
975 % incorrect settings due to nesting. The same would be true if in
976 % \LaTeX{} the use of |$| (as the primitive \TeX{} command) would be
977 % impossible and instead only a higher-level interface would be
978 % available. Note that this does not mean that a |$| couldn't be the
979 % short-hand for starting and stopping that higher-level interface, it
980 % only means that the direct \TeX{} function must be hidden.
982 % Anyway, since we don't have this and won't have it in \LaTeXe{} we
983 % need to implement it in a somewhat slower way.
986 % We test for the current math font setup on entry of a formula,
988 % hooks |\everymath| and |\everydisplay|. But since these hooks may
989 % contain user data we provide ourselves with an internal version of
990 % these hooks which stays frozen.
993 % \begin{macro}{\frozen@everymath}
994 % \changes{v2.1a}{1994/01/17}{New math font setup}
995 % \begin{macro}{\frozen@everydisplay}
996 % New internal names for |\everymath| and |\everydisplay|.
998 \let\frozen@everymath\everymath
999 \let\frozen@everydisplay\everydisplay
1004 % \begin{macro}{\everymath}
1005 % \changes{v2.1a}{1994/01/17}{New math font setup}
1006 % \begin{macro}{\everydisplay}
1007 % \changes{v2.1a}{1994/01/17}{New math font setup}
1008 % Now we provide now user hooks that will be called in the
1012 \newtoks\everydisplay
1018 % \begin{macro}{\frozen@everymath}
1019 % \changes{v2.1a}{1994/01/17}{New math font setup}
1020 % Now we define the behaviour of the frozen hooks: first
1021 % check the math setup then call the user hook.
1023 \frozen@everymath = {\check@mathfonts
1029 % \begin{macro}{\frozen@everydisplay}
1030 % \changes{v2.1a}{1994/01/17}{New math font setup}
1031 % Ditto for the display hook.
1033 \frozen@everydisplay = {\check@mathfonts
1038 % \changes{v3.0q}{1996/07/27}{\cs{if@inmath} switch removed}
1040 % \begin{macro}{\curr@math@size}
1041 % \changes{v2.1a}{1994/01/17}{New math font setup}
1042 % This holds locally the current math size.
1044 \let\curr@math@size\@empty
1051 % \subsection{Macros for loading fonts}
1053 % \begin{macro}{\pickup@font}
1054 % The macro |\pickup@font| which is used in
1055 % |\selectfont| is very simple:
1056 % if the font name is undefined (i.e.\ not known yet) it calls
1057 % |\define@newfont| to load it.
1060 \expandafter \ifx \font@name \relax
1066 % \begin{macro}{\split@name}
1067 % |\pickup@font| assumes that |\font@name| is set
1068 % but it is sometimes called when |\f@family|, |\f@series|,
1069 % |\f@shape|, or |\f@size| may have the wrong settings
1070 % (see, e.g., the definition of |\getanddefine@fonts|).
1071 % Therefore we need a macro to extract font \emph{family},
1072 % \emph{series}, \emph{shape}, and \emph{size} from the font name.
1073 % To this end we define |\split@name| which takes the font
1074 % name as a list of characters of |\catcode| 12 (without the
1075 % backslash at the beginning) delimited by the
1076 % special control sequence |\@nil|.
1077 % This is not very complicated: we first ensure that |/| has
1078 % the right |\catcode|
1082 % and define |\split@name| so that it will define our
1083 % private |\f@encoding|, |\f@family|, |\f@series|, |\f@shape|,
1084 % and |\f@size| macros.
1085 % \changes{v1.9a}{1992/07/26}{Added splitting into \cs{f@encoding}.}
1087 \gdef\split@name#1/#2/#3/#4/#5\@nil{\def\f@encoding{#1}%
1096 % \begin{macro}{\curr@fontshape}
1097 % Abbreviation which may get removed again for speed.
1098 % \changes{v1.9a}{1992/07/26}{}
1100 \def\curr@fontshape{\f@encoding/\f@family/\f@series/\f@shape}
1104 % \begin{macro}{\define@newfont}
1105 % Now we can tackle the problem of defining a new font.
1106 % \changes{v1.9a}{1992/07/26}{}
1108 \def\define@newfont{%
1110 % We have already mentioned that the \textsf{token} list that
1111 % |\split@name| will get as argument must not start with
1113 % To reach this goal we will set the |\escapechar| to $-1$ so
1114 % that the |\string| primitive will not generate an
1116 % To keep this change local we open a group. We use
1117 % |\begingroup| for this purpose since |\define@newfont|
1118 % might be called in math mode, and an empty
1119 % |\bgroup|\ldots|\egroup| would add an empty Ord atom
1120 % to the math list and thus affect the spacing.
1122 % Also locally redefine |\typeout| so that `No file ...fd'
1123 % Warnings become Font Info message just sent to the log file.
1124 % \changes{v1.0q}{1989/11/19}{Group added.}
1125 % \changes{v3.0m}{1995/11/17}{Redefine \cs{typeout} latex/1676}
1128 \let\typeout\@font@info
1131 % Then we extract \emph{encoding scheme}, \emph{family},
1132 % \emph{series}, \emph{shape},
1133 % and \emph{size} from the font name.
1134 % Note the four |\expandafter|'s so that |\font@name| is
1135 % expanded first, then |\string|, and finally
1138 \expandafter\expandafter\expandafter
1139 \split@name\expandafter\string\font@name\@nil
1141 % If the |\curr@fontshape| combination is not available,
1142 % (i.e.\ undefined) we call the macro |\wrong@fontshape| to take
1143 % care of this case. Otherwise |\extract@font|
1144 % will load the external font for us.
1145 % \changes{v1.2f}{1990/01/28}{Added call to \cs{curr@fontshape} macro
1146 % to allow substitution.}
1149 % \csname\curr@fontshape\endcsname \relax
1150 \try@load@fontshape % try always
1153 \csname\curr@fontshape\endcsname \relax
1154 \wrong@fontshape\else
1156 % To allow substitution we call the |curr@fontshape| macro
1157 % which usually will expand to |\relax| but may hold code for
1158 % substitution (see |\subst@fontshape| definition).
1160 % \csname\curr@fontshape\endcsname
1163 % We are nearly finished and must only restore the
1164 % |\escapechar| by closing the group.
1171 \def\try@load@fontshape{%
1173 \ifx\csname \f@encoding+\f@family\endcsname\relax
1174 \@font@info{Try loading font information for
1175 \f@encoding+\f@family}%
1177 % We predefine this combination to be |\@empty| which means that
1178 % next time we don't try again unnecessary in case we don't find a
1179 % |.fd| file. If the file contains a |\DeclareFontFamily| command
1180 % than this setting will be overwritten.
1181 % \changes{v2.1e}{1994/02/24}
1182 % {Separate restoration of catcodes for fd cmds}
1183 % \changes{v2.1l}{1994/05/13}{Use \cs{@input@} for fd files}
1185 \global\expandafter\let
1186 \csname\f@encoding+\f@family\endcsname\@empty
1188 % Set the catcodes used in the syntax, but do it only once (this
1189 % will be restored at the end of the font loading group).
1190 % \changes{v3.0t}{1997/10/21}{Move \cs{makeatletter} to
1191 % \cs{nfss@catcodes}.}
1194 \let\nfss@catcodes\relax
1197 % \changes{v3.0s}{1996/11/18}
1198 % {(DPC) lowercase fd file names. internal/1044}
1199 % For increased portability make the external filename
1200 % monocase, but look for the (old style) mixed case
1201 % filename if the first attempt fails.
1203 % On any monocase system this means that the file is looked for twice
1204 % which takes up time and string space, but at least for this release
1205 % Check for both names to give people time to re-install their private
1206 % fd files with lowercase names.
1210 \noexpand\InputIfFileExists{\f@encoding\f@family.fd}}}%
1212 {\@input@{\f@encoding\f@family.fd}}%
1218 % \begin{macro}{\nfss@catcodes}
1219 % \changes{v2.1e}{1994/02/24}
1220 % {Separate restoration of catcodes for fd cmds}
1221 % This macro should contain the standard |\catcode| assignments to
1222 % all characters which are used in the commands found in an
1223 % \texttt{.fd} file and which might have special |\catcode|s in the
1224 % middle of a document. If necessary, this list can be extended in
1225 % a package file using a suitable number of |\expandafter|, i.e.,
1227 % \expandafter\def\expandafter\nfss@catcodes
1228 % \expandafter{\nfss@catcodes <additional settings>}
1230 % Note, that this macro might get executed several times since it
1231 % is also called by |\DeclareFontShape|, thus it probably should
1232 % not be misused as a general purpose hook.
1234 \def\nfss@catcodes{%
1236 % We start by making |@| a letter and ignoring all blanks and newlines.
1237 % \changes{v2.1z}{1994/12/06}{Added tab char as well}
1238 % \changes{v3.0p}{1996/07/26}{omit \cs{relax} as not needed}
1239 % \changes{v3.0t}{1997/10/21}{Moved \cs{makeatletter} from
1240 % \cs{try@load@font@shape}.}
1247 % Then we set up |\|, |{|, |}|, |#| and |%| in case an \texttt{.fd}
1248 % file is loaded during a verbatim environment.
1249 % \changes{v3.0n}{1995/11/27}{Reset hash, for definitions in fd files}
1250 % \changes{v3.00}{1995/12/06}{Reset hat, for typeouts etc in fd files}
1259 % The we make sure that the important syntax parts have the right
1261 % \changes{v2.1s}{1994/09/16}{Reset [ and ] as well, just in case}
1262 % \changes{v3.0r}{1996/08/25}{Reset the acute, grave and double quote
1281 % \begin{macro}{\DeclareErrorFont}
1282 % Declare the last resort shape! We assume that in this fontshape
1283 % there is a 10pt font but it doesn't really matter. We only loose
1284 % one macro name if the assumption is false. But at least the font
1287 \def\DeclareErrorFont#1#2#3#4#5{%
1288 \xdef\error@fontshape{%
1289 \noexpand\expandafter\noexpand\split@name\noexpand\string
1290 \expandafter\noexpand\csname#1/#2/#3/#4/#5\endcsname
1293 % Initialize all those internal variables which may or may not have
1294 % values in the first seconds of NFSS' bootstraping process. Later
1295 % on such values will be updated when an encoding is selected, etc.
1297 % We definitely don't want to set |\f@encoding|; we can set all the
1298 % others since if they are left ``blank'' any selection would grap
1299 % ``error default values'' as well. However, this probably should
1301 % \changes{v2.1n}{1994/05/14}{Don't set \cs{f@encoding}}
1303 % \gdef\f@encoding{#1}%
1304 \gdef\default@family{#2}%
1305 \gdef\default@series{#3}%
1306 \gdef\default@shape{#4}%
1307 \global\let\f@family\default@family
1308 \global\let\f@series\default@series
1309 \global\let\f@shape\default@shape
1311 \gdef\f@baselineskip{#5pt}%
1313 \@onlypreamble\DeclareErrorFont
1318 % \begin{macro}{\wrong@fontshape}
1319 % Before we come to the macro |\extract@font| we have to take
1320 % care of unknown |\curr@fontshape| combinations.
1321 % The general strategy is to issue a warning and to try a default
1322 % \emph{shape}, then a default \emph{series},
1323 % and finally a default \emph{family}.
1324 % If this last one also fails \TeX{} will go into an infinite loop.
1325 % But if the defaults are set incorrectly one deserves nothing else!
1326 % \changes{v1.9a}{1992/07/26}{}
1329 %<latexrelease>\IncludeInRelease{2015/01/01}{\wrong@fontshape}%
1330 %<latexrelease> {Font substituation in preamble}%
1331 %<*2ekernel|latexrelease>
1332 \def\wrong@fontshape{%
1333 \csname D@\f@encoding\endcsname % install defaults if in math
1335 % We remember the wanted |\curr@fontshape| combination
1336 % which we will need in a moment.
1338 \edef\reserved@a{\csname\curr@fontshape\endcsname}%
1339 \ifx\last@fontshape\reserved@a
1340 \errmessage{Corrupted NFSS tables}%
1344 % Then we warn the user about the mess and set the shape to its
1346 % \changes{v1.0q}{1989/11/19}
1347 % {Instead of calling \cs{family}\cs{default@family},
1348 % etc. we directly set \cs{f@family}, etc.}
1349 % \changes{v1.2f}{1990/01/28}{Warning message slightly changed.}
1351 \let\f@shape\default@shape
1353 % If the combination is not known, try the default \emph{series}.
1355 \expandafter\ifx\csname\curr@fontshape\endcsname\relax
1356 \let\f@series\default@series
1358 % If this is still undefined, try the default \emph{family}.
1359 % Otherwise give up. We never try to change the encoding scheme!
1360 % \changes{v1.9a}{1992/07/26}{}
1361 % \changes{v3.1a}{2015/04/07}{Try loading fd file if family has changed}
1364 \ifx\csname\curr@fontshape\endcsname\relax
1365 \let\f@family\default@family
1367 % If we change the font family and we are in the preamble then the
1368 % corresponding \texttt{.fd} file may not been loaded
1369 % yet. Therefore we try this now. Otherwise equating the requested
1370 % font shape with the finally selected fontshape below will fail
1371 % and can result in ``NFSS tables corruped''. After begin document
1372 % that will not happen as all \texttt{.fd} files involved in
1373 % substituation are loaded at |\begin{document}|.
1381 % At this point a valid |\curr@fontshape| combination must
1383 % We inform the user about this fact.
1384 %\changes{v3.0n}{1995/11/02}
1385 % {(DPC) Remove extra space with \cs{string} for latex/1676}
1386 % \changes{v3.0m}{1995/11/17}
1387 % {Support \cs{@wrong@font@char} latex/1676}
1389 % The |\expandafter\string| here stops \TeX\ adding the space
1390 % that it usually puts after command names in messages. The similar
1391 % construction with |\@undefined| just produces `undefined', but saves
1394 % |\@wrong@font@char| is locally redefined in |\UseTextSymbol| from
1395 % its normal (empty) definition, to report the symbol generating the
1398 \@font@warning{Font shape `\expandafter\string\reserved@a'
1399 \expandafter\@gobble\string\@undefined\MessageBreak
1400 using `\curr@fontshape' instead\@wrong@font@char}%
1401 \global\let\last@fontshape\reserved@a
1403 % We change |\@defaultsubs| to produce a warning at the end of
1405 % \changes{v3.0d}{1995/07/13}{Change a macro not a switch to flag
1406 % default font substitutions}
1407 % \changes{v3.0k}{1995/10/24}{Make this code inline since it
1408 % happens only here}
1409 % The macro |\@defaultsubs| is initially |\relax| but gets changed
1410 % here if some default font substitution happens.
1411 % It is then executed in |\enddocument|.
1413 \gdef\@defaultsubs{%
1414 \@font@warning{Some font shapes were not available, defaults
1415 substituted.\@gobbletwo}}%
1417 % If we substitute a |\curr@fontshape| combination
1418 % by the default one we don't want the warning to be printed out
1419 % whenever this (unknown) combination is used.
1420 % Therefore we globally |\let| the macro corresponding to
1421 % the wanted combination equal to its substitution.
1422 % This requires the use of four |\expandafter|'s
1423 % since |\csname|\dots|\endcsname| has to be
1424 % expanded before |\reserved@a| (i.e.\ the requested
1426 % and this must happen before the |\let| is executed.
1428 \global\expandafter\expandafter\expandafter\let
1429 \expandafter\reserved@a
1430 \csname\curr@fontshape\endcsname
1432 % Now we can redefine |\font@name| accordingly.
1433 % This \emph{must} be done globally since it might occur in the
1434 % group opened by |\define@newfont|. If we would this
1435 % definition were local the closing |\endgroup| there
1436 % would restore the old meaning of |\font@name| and then
1437 % switch to the wrong font at the end of |\selectfont|
1438 % although the correct font was loaded.
1441 \csname\curr@fontshape/\f@size\endcsname}%
1443 % The last thing this macro does is to call |\pickup@font|
1444 % again to load the font if it is not defined yet.
1445 % At this point this code will loop endlessly if
1446 % the defaults are not well defined.
1449 %</2ekernel|latexrelease>
1450 %<latexrelease>\EndIncludeInRelease
1451 %<latexrelease>\IncludeInRelease{0000/00/00}{\wrong@fontshape}%
1452 %<latexrelease> {Font substituation in preamble}%
1453 %<latexrelease>\def\wrong@fontshape{%
1454 %<latexrelease> \csname D@\f@encoding\endcsname
1455 %<latexrelease> \edef\reserved@a{\csname\curr@fontshape\endcsname}%
1456 %<latexrelease> \ifx\last@fontshape\reserved@a
1457 %<latexrelease> \errmessage{Corrupted NFSS tables}%
1458 %<latexrelease> \error@fontshape
1459 %<latexrelease> \else
1460 %<latexrelease> \let\f@shape\default@shape
1461 %<latexrelease> \expandafter\ifx\csname\curr@fontshape\endcsname\relax
1462 %<latexrelease> \let\f@series\default@series
1463 %<latexrelease> \expandafter
1464 %<latexrelease> \ifx\csname\curr@fontshape\endcsname\relax
1465 %<latexrelease> \let\f@family\default@family
1466 %<latexrelease> \fi \fi
1468 %<latexrelease> \@font@warning{Font shape
1469 %<latexrelease> `\expandafter\string\reserved@a'
1470 %<latexrelease> \expandafter\@gobble\string\@undefined
1471 %<latexrelease> \MessageBreak
1472 %<latexrelease> using `\curr@fontshape' instead\@wrong@font@char}%
1473 %<latexrelease> \global\let\last@fontshape\reserved@a
1474 %<latexrelease> \gdef\@defaultsubs{%
1475 %<latexrelease> \@font@warning{Some font shapes were not available,
1476 %<latexrelease> defaults substituted.\@gobbletwo}}%
1477 %<latexrelease> \global\expandafter\expandafter\expandafter\let
1478 %<latexrelease> \expandafter\reserved@a
1479 %<latexrelease> \csname\curr@fontshape\endcsname
1480 %<latexrelease> \xdef\font@name{%
1481 %<latexrelease> \csname\curr@fontshape/\f@size\endcsname}%
1482 %<latexrelease> \pickup@font}
1483 %<latexrelease>\EndIncludeInRelease
1488 % \begin{macro}{\@wrong@font@char}
1489 % \changes{v3.0m}{1995/11/17}{(DPC) Macro added. latex/1676}
1490 % Normally empty but redefined in |\UseTextSymbol| so that the
1491 % Font shape undefined message can refer to the symbol causing the
1494 \let\@wrong@font@char\@empty
1498 % \begin{macro}{\@@defaultsubs}
1499 % \changes{v3.0d}{1995/07/13}{macro added}
1500 % \changes{v3.0k}{1995/10/24}{macro removed}
1501 % \begin{macro}{\@defaultsubs}
1502 % \changes{v3.0d}{1995/07/13}{macro added}
1505 \let\@defaultsubs\relax
1511 % \begin{macro}{\strip@prefix}
1512 % In |\extract@font| we will need a way to recover the
1513 % replacement text of a macro.
1514 % This is done by the primitive |\meaning| together
1515 % with the macro |\strip@prefix| (for the details
1516 % see appendix~D of the \TeX{}book, p.\ 382).
1518 \def\strip@prefix#1>{}
1526 % \section{Assigning math fonts to \emph{versions}}
1529 % \begin{macro}{\install@mathalphabet}
1530 % This is just another name for |\gdef| but we can redefine it if
1531 % necessary later on.
1533 \let\install@mathalphabet\gdef
1539 % \begin{macro}{\math@fonts}
1541 % \changes{v1.9a}{1992/07/26}{}
1543 \let\math@fonts\@empty
1549 % \begin{macro}{\select@group}
1550 % \changes{v1.0t}{1989/11/26}{\cs{bgroup}/\cs{egroup} changed to
1551 % \cs{begingroup}/\cs{endgroup} to avoid empty Ord atom on math list.}
1552 % |\select@group| has four arguments: the new
1553 % \meta{math alphabet identifier} (a control sequence), the
1554 % \meta{math group number}, the extra macro for math mode
1555 % and the |\curr@fontshape| definition macro name.
1556 % We first check if we are in math mode.
1557 % \changes{v1.1a}{1989/12/16}{\cs{relax} in front added.}
1558 % \changes{v1.1a}{1989/12/16}{Now four arguments.}
1560 %\def\select@group#1#2#3{\relax\ifmmode
1562 % We do these things locally using |\begingroup| instead
1563 % of |\bgroup| to avoid the appearance of an empty Ord
1564 % atom on the math list.
1568 % We set the math fonts for the \emph{family} in question by calling
1569 % |\getanddefine@fonts| in the correct environment.
1570 % \changes{v1.9a}{1992/07/26}{}
1573 % \getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3%
1575 % We globally select the math fonts\dots
1577 % \globaldefs\@ne \math@fonts
1579 % \dots{} and close the group to
1580 % restore |\globaldefs| and |\escapechar|.
1584 % As long as no \emph{size} or \emph{version} change occurs
1585 % the \meta{math alphabet identifier} should simply switch to the
1586 % installed \emph{math group} instead of calling
1588 % unnecessarily. So we globally redefine the first argument
1589 % (the new \meta{math alphabet identifier})
1590 % to expand into a |\mathgroup| switch
1591 % and then select this \emph{alphabet}. Note that this redefinition
1592 % will be overwritten by the next call to a \emph{version} macro.
1593 % \changes{v1.1a}{1989/12/16}{Usage of `\quotechar=' macro added.}
1594 % \changes{v1.1a}{1989/12/16}{Redefinition of alphabet now simpler.}
1595 % \changes{v1.2a}{1990/01/20}{Def for alph id changed.}
1596 % The original code for the end of |\select@group| was
1598 % \gdef#1{#3\mathgroup #2}#1\fi}
1600 % i.e.\ first redefining the \meta{math alphabet identifier} and
1601 % then calling the new definition to switch to the wanted
1602 % \meta{math group}. Now we define the \meta{math alphabet
1603 % identifier} as a call to the |\use@mathgroup| command.
1604 % \changes{v1.2b}{1990/01/21}{Code moved to \cs{use@mathgroup}.}
1606 % \xdef#1{\noexpand\use@mathgroup\noexpand#2%
1607 % {\number\csname c@mv@\math@version\endcsname}}%
1609 % \changes{v1.3c}{1992/05/12}{Added call to
1610 % \cs{extract@alph@from@version}.}
1611 % But this is not sufficient, as we learned the hard way.
1612 % The problem here is that the loading of the fonts that comprise
1613 % the alphabet identifier |#1|, as well as the necessary math font
1614 % assignments is deferred until it is used. This is OK so far, but
1615 % if the fonts are switched within the current formula (which may
1616 % happen if a sub-formula is a box that contains a math version
1617 % switch) the font assignments for |#1| are not restored unless
1618 % |#1| is used again. This is disastrous since TeX sees the wrong
1619 % fonts at the end of the math formula, when it converts the math
1620 % list into a horizontal list.
1622 % This is taken into account as follows: When a math alphabet
1623 % identifier is used for the first time in a certain version
1624 % it modifies the corresponding macro |\mv@|\meta{version}
1625 % so that it calls |\getanddefine@fonts| directly in future as well.
1626 % We use the macro |\extract@alph@from@version| to do this.
1627 % It takes the math alphabet identifer |#1| and the math version
1628 % macro as arguments.
1629 % \changes{v1.9a}{1992/07/26}{}
1631 % \expandafter\extract@alph@from@version
1632 % \csname mv@\math@version\expandafter\endcsname
1633 % \expandafter{\number\csname c@mv@\math@version\endcsname}%
1635 % \stepcounter{mv@\math@version}%
1637 % Finally, it is not possible to simply call the new definition
1639 % have an argument (the third argument of |\use@mathgroup|
1640 % or more exactly the argument od |\math@egroup| if the {\ttfamily
1641 % margid} option is in force)
1642 % which would swallow our closing |\fi|. So
1643 % we use the |\expandafter| technique to remove the |\fi|
1644 % before the |\use@mathgroup| is expanded.
1646 %\expandafter #1\fi}
1651 % \begin{macro}{\extract@alph@from@version}
1652 % \changes{v1.3c}{1992/05/12}{Macro added.}
1653 % We proceed to the definition of the
1654 % macro |\extract@alph@from@version|. As stated above, it takes
1655 % a math alphabet identifier and a math version macro
1656 % (e.g.\ |\mv@normal|) as its arguments.
1658 \def\extract@alph@from@version#1#2#3{%
1660 % To extract and replace the definition of math alphabet identifier
1661 % |#3| in macro |#1| we have to recall how this definition looks
1662 % like: Somewhere in the replacement text of |#1| there is
1663 % the sequence\\[2pt]
1664 % |\install@mathalphabet|\meta{math alphabet identifier} |#3||{%| \\
1665 % \hspace*{\MacroIndent}\hspace*{5mm}
1666 % \meta{Definitions for }|#3}| \\[2pt]
1667 % Hence, the first thing we do is to extract the tokens preceding
1668 % this definitions, the definition itself, and the tokens following
1669 % it. To this end we define one auxiliary macro |\reserved@a|.
1671 \def\reserved@a##1\install@mathalphabet#3##2##3\@nil{%
1673 % When |\reserved@a| is expanded, it will have the tokens preceding
1674 % the definition in question in its first argument (|##1|), the
1675 % following tokens in its third argument (|##3|), and the replacement
1676 % text for the math alphabet identifier |#3| in its second argument.
1677 % (|##2|). This is then recorded for later use in a temporary macro
1680 \def\reserved@b{##2}%
1682 % Additionally, we define a macro |\reserved@c| to reconstruct the
1683 % definitions for the math version in question from the tokens that
1684 % will remain unchanged (|##1| and |##3|) and the yet to build new
1685 % definitions for the math alphabet identifier |#3|.
1687 \def\reserved@c####1{\gdef#1{##1####1##3}}}%
1689 % Then we execute our auxiliary macro.
1691 \expandafter\reserved@a#1\@nil
1693 % OK, so now we have to build the new definition for |#3|. To do so,
1694 % we first extract the interesting parts out of the old one.
1695 % The old definition looks like:\\[2pt]
1696 % |\select@group|\meta{math alphabet identifier} \\
1697 % \hspace*{\MacroIndent}\hspace*{5mm}
1698 % \meta{math group number}\meta{math extra part}\\
1699 % \meta{|curr@fontshape| definition} \\[2pt]
1700 % So we define a new temporary macro |\reserved@a| that
1701 % extracts these parts.
1703 \def\reserved@a\select@group#3##1##2\@nil{%
1705 % This macro can now directly rebuild the math version definition
1706 % by calling |\reserved@c|:
1709 \getanddefine@fonts{#2}##2%
1710 \install@mathalphabet#3{%
1711 \relax\ifmmode \else \non@alpherr#3\fi
1712 \use@mathgroup##1{#2}}}%
1714 % \changes{v2.1t}{1994/10/15}{Warn if math alpha is used outside math}
1715 % In addtion it defines the alphabet the way it should be used from
1718 \gdef#3{\relax\ifmmode \else \non@alpherr#3\fi
1719 \use@mathgroup##1{#2}}}%
1721 % Finally, we only have to call this macro |\reserved@a| on the old
1722 % definitions recorded in |\reserved@b|:
1724 \expandafter\reserved@a\reserved@b\@nil
1731 % \begin{macro}{\math@bgroup}
1732 % \changes{v1.2a}{1990/01/20}{Def. placed in this file.}
1733 % \begin{macro}{\math@egroup}
1734 % \changes{v1.2a}{1990/01/20}{Def. placed in this file.}
1735 % \changes{v1.2h}{1990/03/30}{Changed to have one arg.}
1736 % \changes{v2.2f}{1994/03/10}{Changed \cs{begingroup}/\cs{endgroup} to
1737 % \cs{bgroup}/\cs{egroup}.}
1738 % Here are the default definitions for |\math@bgroup| and
1739 % |\math@egroup|. We use |\bgroup| instead of |\begingroup|
1740 % to avoid `leaking out' of style changes. This has the side
1741 % effect of always producing mathord atoms.
1743 \let\math@bgroup\bgroup
1744 \def\math@egroup#1{#1\egroup}
1750 % \begin{macro}{\calculate@math@sizes}
1751 % \changes{v2.1i}{1994/04/18}{Changed message to log only}
1752 % Here is the default definition for |\calculate@math@sizes|
1753 % a more elaborate interface
1754 % is under testing in mthscale.sty.
1756 \gdef\calculate@math@sizes{%
1757 \@font@info{Calculating\space math\space sizes\space for\space
1758 size\space <\f@size>}%
1760 \@tempdimb \defaultscriptratio \dimen@
1761 \dimen@ \defaultscriptscriptratio \dimen@
1762 \expandafter\xdef\csname S@\f@size\endcsname{%
1763 \gdef\noexpand\tf@size{\f@size}%
1764 \gdef\noexpand\sf@size{\strip@pt\@tempdimb}%
1765 \gdef\noexpand\ssf@size{\strip@pt\dimen@}%
1766 \noexpand\math@fontstrue}}
1770 % \begin{macro}{\defaultscriptratio}
1771 % \changes{v2.1h}{1994/04/11}{Macro added}
1772 % \begin{macro}{\defaultscriptscriptratio}
1773 % \changes{v2.1h}{1994/04/11}{Macro added}
1774 % The default ratio for math
1776 % 1 to |\defaultscriptratio| to |\defaultscriptscriptratio|.\\
1777 % By default this is 1 to .7 to .5.
1779 \def\defaultscriptratio{.7}
1780 \def\defaultscriptscriptratio{.5}
1785 % \begin{macro}{\noaccents@}
1786 % If we don't have a definition for |\noaccents@| we provide a
1789 \ifx\noaccents@\@undefined
1790 \let\noaccents@\@empty
1795 % \begin{macro}{\showhyphens}
1796 % \changes{v1.2l}{1990/06/30}{Macro added.}
1797 % \changes{v2.0e}{1993/05/16}{Use \cs{reset@font}}
1798 % \changes{v3.0h}{1995/10/10}
1799 % {Use \cs{normalfont} and make colour safe, and autoloadable}
1800 % \changes{v3.0u}{1998/03/25}
1801 % {Suppress unnecessary error when used in preamble}
1802 % \changes{v3.2a}{2017/01/10}
1803 % {Add version of \cs{showhyphens} that works with Xe\TeX.}
1804 % The |\showhyphens| command must be redefined since the version in
1805 % \texttt{plain.tex} uses |\tenrm|. We have also made some further
1806 % adjustments for its use in \LaTeX.
1809 %<latexrelease>\IncludeInRelease{2017/01/01}{\showhyphens}%
1810 %<latexrelease> {XeTeX support for \showhyphens}%
1811 %<*2ekernel|latexrelease>
1812 \ifx\XeTeXcharclass\@undefined
1814 % Version for engines other than Xe\TeX.
1816 \gdef\showhyphens#1{%
1820 \parfillskip\z@skip\hsize\maxdimen
1822 \pretolerance\m@ne\tolerance\m@ne\hbadness\z@\showboxdepth\z@\ #1%
1828 % Xe\TeX\ version. When using system fonts Xe\TeX\ reports consecutive
1829 % runs of characters as a single item in box logging, which means the
1830 % standard |\showhyphens| does not work. This version typesets the
1831 % text into a narrow box to force hyphenation and then reconstructs a
1832 % horizontal list with explicit hyphens to generate the display. Note
1833 % that the |lmr| OpenType font is forced, this works even if the
1834 % characters are not in the font as hyphenation is attempted due to
1835 % the width of the space and hyphen character. It may generate
1836 % spurious Missing Character warnings in the log, these are however
1837 % suppressed from the terminal output by ensuring that
1838 % |\tracingonline| is locally zero.
1840 \long\def\showhyphens#1{%
1842 \usefont{TU}{lmr}{m}{n}%
1853 \interlinepenalty\z@
1856 \brokenpenalty1127 %
1863 % Note here we stop the loop if made no progress, non-removable items
1864 % may mean that we can not process the whole list (which would be
1865 % testable as |\lastnodetype=-1|).
1869 \ifnum\lastnodetype=11\unskip\@tempswatrue\fi
1870 \ifnum\lastnodetype=12\unkern\@tempswatrue\fi
1871 \ifnum\lastnodetype=13 %
1873 \unpenalty\@tempswatrue
1875 \ifnum\lastnodetype=\@ne
1876 \setbox\tw@\lastbox\@tempswatrue
1877 \setbox0\hbox{\unhbox\tw@\unskip\unskip\unpenalty
1878 \ifnum\count@=1127 \else\ \fi
1898 %</2ekernel|latexrelease>
1899 %<latexrelease>\EndIncludeInRelease
1900 %<latexrelease>\IncludeInRelease{0000/00/00}{\showhyphens}%
1901 %<latexrelease> {XeTeX support for \showhyphens}%
1902 %<latexrelease>\gdef\showhyphens#1{%
1903 %<latexrelease> \setbox0\vbox{%
1904 %<latexrelease> \color@begingroup
1905 %<latexrelease> \everypar{}%
1906 %<latexrelease> \parfillskip\z@skip\hsize\maxdimen
1907 %<latexrelease> \normalfont
1908 %<latexrelease> \pretolerance\m@ne\tolerance\m@ne
1909 %<latexrelease> \hbadness\z@\showboxdepth\z@\ #1%
1910 %<latexrelease> \color@endgroup}}
1911 %<latexrelease>\EndIncludeInRelease
1917 % \begin{macro}{\addto@hook}
1918 % \changes{v1.0u}{1989/12/05}{\cs{addto@hook} added.}
1919 % \changes{v2.1d}{1994/02/10}{Made \cs{addto@hook} long.}
1920 % We need a macro to add tokens to a hook.
1922 \long\def\addto@hook#1#2{#1\expandafter{\the#1#2}}
1927 % \begin{macro}{\@vpt}
1928 % \changes{v2.1v}{1994/11/09}{(DPC) macros added, from setsize.dtx}
1929 % \changes{v2.1v}{1994/11/09}{(DPC) reduce save stack usage latex/1742}
1935 % \begin{macro}{\@vipt}
1941 % \begin{macro}{\@viipt}
1947 % \begin{macro}{\@viiipt}
1953 % \begin{macro}{\@ixpt}
1959 % \begin{macro}{\@xpt}
1965 % \begin{macro}{\@xipt}
1971 % \begin{macro}{\@xiipt}
1977 % \begin{macro}{\@xivpt}
1983 % \begin{macro}{\@xviipt}
1989 % \begin{macro}{\@xxpt}
1995 % \begin{macro}{\@xxvpt}