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: ltfssini.dtx
31 %% Copyright (C) 1989-2001 Frank Mittelbach and Rainer Sch\"opf,
32 %% all rights reserved.
38 \ProvidesFile{ltfssini.dtx}
39 [2016/10/15 v3.1b LaTeX Kernel (NFSS Initialisation)]
41 \documentclass{ltxdoc}
43 \DocInput{ltfssini.dtx}
49 %<+checkmem>\def\CHECKMEM{\tracingstats=2
50 %<+checkmem> \newlinechar=`\^^J
51 %<+checkmem> \message{^^JMemory usage: \filename}\shipout\hbox{}}
57 % \GetFileInfo{ltfssini.dtx}
58 % \title{A new font selection scheme for \TeX{} macro packages\\
59 % (Initialisation)\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 top level \LaTeX\ interface to the font
69 % selection scheme commands. See other parts of the \LaTeX\
70 % distribution, or \emph{The \LaTeX\ Companion} for higher level
71 % documentation of these commands.
76 % \changes{v3.0i}{1998/08/17}{(RmS) Minor documentation fixes.}
77 % \changes{v3.0b}{1995/06/28}
78 % {(DPC) Fix documentation typos}
79 % \changes{v3.0a}{1995/05/24}
80 % {(DPC) Make file from previous file, lfonts.dtx 1995/05/23 v2.2e}
81 % \changes{v3.1b}{2016/10/15}
85 % \section{NFSS Initialisation}
92 % \changes{v2.2a}{1994/10/14}{New coding for cfg files}
93 % \changes{v2.1a}{1993/12/03}{update for LaTeX2e}
94 % \changes{v1.2c}{1992/01/06}{added slitex code}
95 % \changes{v1.2d}{1992/03/21}{Renamed \cs{text} to \cs{nfss@text}
96 % to make it internal.}
97 % \changes{v1.2a}{1991/11/27}{All \cs{family}, \cs{shape} etc. renamed
98 % to \cs{fontfamily} etc.}
99 % \changes{v1.1i}{1990/04/02}{\cs{input} of files now handled
101 % \changes{v1.1g}{1990/02/08}{Protected the commands
102 % \cs{family}, \cs{series},
103 % \cs{shape}, \cs{size}, \cs{selectfont}, and \cs{mathversion}.}
104 % \changes{v1.1c}{1989/12/03}{Some internal macros renamed to make them
106 % \changes{v1.1b}{1989/12/02}{\cs{rmmath} renamed to \cs{mathrm}}
108 % \changes{v1.0i}{1989/11/07}{All family, series, and shape names
110 % \changes{v1.0g}{1989/05/22}{Lines shortened to 72 characters}
111 % \changes{v1.0f}{1989/04/29}{Corrections to \LaTeX\ tabular env.
113 % \changes{v1.0e}{1989/04/27}{Definitions of \LaTeX\ symbols corrected.}
114 % \changes{v1.0d}{1989/04/26}{\cs{xpt} added.}
115 % \changes{v1.0c}{1989/04/21}{Changed to conform to fam.tex.}
116 % \changes{v1.0b}{1989/04/15}{\cs{mathfontset} renamed to
118 % \changes{v1.0a}{1989/04/10}{Starting with version numbers!
119 % \cs{newif} for \cs{@tempswa} added since this switch is
120 % unknown at the time when this file is read in.
121 % (latex.tex is loaded later.)
122 % \cs{math@famname} changed to \cs{math@version.}}
125 % \changes{v2.1j}{1994/05/13}{Removed file identification typeout}
127 % Finally, there are six commands that are to be used in \LaTeX{}
128 % and that we will therefore protect against expansion at the
130 % |\fontfamily|, |\fontseries|, |\fontshape|, |\fontsize|,
131 % |\selectfont|, and |\mathversion|.
133 % \changes{v2.1i}{1994/05/12}{Moved \cs{fontfamily} to fam.dtx}
134 % \changes{v2.1i}{1994/05/12}{Moved \cs{fontencoding} to fam.dtx}
135 % \changes{v2.1i}{1994/05/12}{Moved \cs{fontseries} to fam.dtx}
136 % \changes{v2.1i}{1994/05/12}{Moved \cs{fontshape} to fam.dtx}
137 % \changes{v2.1i}{1994/05/12}{Moved \cs{fontsize} to fam.dtx}
138 % \changes{v2.1i}{1994/05/12}{Moved \cs{mathversion} to fam.dtx}
139 % \changes{v2.1i}{1994/05/12}{Moved \cs{selectfont} to tracefnt.dtx}
146 % \subsection{Providing math \emph{versions}}
148 % \LaTeX{} provides two \emph{versions}. We call them
149 % \textsf{normal} and \textsf{bold}, respectively.
151 \DeclareMathVersion{normal}
152 \DeclareMathVersion{bold}
156 % Now we define the standard font change commands.
157 % We don't allow the use of |\rmfamily| etc.\ in math mode.
159 % First the changes to another \emph{family}:
161 \DeclareRobustCommand\rmfamily
162 {\not@math@alphabet\rmfamily\mathrm
163 \fontfamily\rmdefault\selectfont}
164 \DeclareRobustCommand\sffamily
165 {\not@math@alphabet\sffamily\mathsf
166 \fontfamily\sfdefault\selectfont}
167 \DeclareRobustCommand\ttfamily
168 {\not@math@alphabet\ttfamily\mathtt
169 \fontfamily\ttdefault\selectfont}
171 % Then the commands changing the \emph{series}:
173 \DeclareRobustCommand\bfseries
174 {\not@math@alphabet\bfseries\mathbf
175 \fontseries\bfdefault\selectfont}
176 \DeclareRobustCommand\mdseries
177 {\not@math@alphabet\mdseries\relax
178 \fontseries\mddefault\selectfont}
179 \DeclareRobustCommand\upshape
180 {\not@math@alphabet\upshape\relax
181 \fontshape\updefault\selectfont}
183 % Then the commands changing the \emph{shape}:
185 \DeclareRobustCommand\slshape
186 {\not@math@alphabet\slshape\relax
187 \fontshape\sldefault\selectfont}
188 \DeclareRobustCommand\scshape
189 {\not@math@alphabet\scshape\relax
190 \fontshape\scdefault\selectfont}
191 \DeclareRobustCommand\itshape
192 {\not@math@alphabet\itshape\mathit
193 \fontshape\itdefault\selectfont}
199 % \changes{v1.2b}{1990/01/28}{Call to \cs{@nomath} added.}
200 % \changes{v3.1a}{2015/01/09}{Allow \cs{emph} to produce small caps (latexrelease)}
201 % \begin{macro}{\eminnershape}
202 % \changes{v3.1a}{2015/01/09}{macro added (latexrelease)}
203 % We also have to define the {\em emphasize\/} font change command
204 % (i.e.\ |\em|). This command will look is the current font is
205 % sloped (i.e.\ has a positive |\fontdimen1|) and will then
206 % select either |\upshape| or |\itshape|.
209 %<latexrelease>\IncludeInRelease{2015/01/01}{\eminnershape}{\eminnershape}%
210 %<*2ekernel|latexrelease>
211 \DeclareRobustCommand\em
212 {\@nomath\em \ifdim \fontdimen\@ne\font >\z@
213 \eminnershape \else \itshape \fi}%
217 \def\eminnershape{\upshape}%
218 %</2ekernel|latexrelease>
219 %<latexrelease>\EndIncludeInRelease
220 %<latexrelease>\IncludeInRelease{0000/00/00}{\eminnershape}{\eminnershape}%
221 %<latexrelease>\DeclareRobustCommand\em
222 %<latexrelease> {\@nomath\em \ifdim \fontdimen\@ne\font >\z@
223 %<latexrelease> \upshape \else \itshape \fi}%
224 %<latexrelease>\let\eminnershape\@undefined
225 %<latexrelease>\EndIncludeInRelease
232 % \begin{macro}{\not@math@alphabet}
233 % This function generates an error message when it is called in
234 % math mode. The same function should be defined in
235 % \texttt{newlfont.sty}.
236 % \changes{v1.4d}{1992/09/21}{Macro defined.}
237 % \changes{v2.1e}{1994/01/17}{Message changed}
238 % \changes{v2.1f}{1994/01/18}{Message corrected}
239 % \changes{v2.1g}{1994/04/22}{Message changed again}
240 % \changes{v2.2d}{1995/04/02}{add \cs{noexpand} to second part of message}
242 \def\not@math@alphabet#1#2{%
245 \@latex@error{Command \noexpand#1invalid in math mode}%
249 define a new math alphabet^^J%
250 if you want to use a special font in math mode%
253 % We have to a |\noexpand| below to prevent expansion of |#2|. In
254 % case of |#1| we can omit this (due to the current definition of
255 % robust commands since they do come out right there :-).
257 use the math alphabet \noexpand#2instead of
268 % Finally we provide two abbreviations to switch to the \LaTeX{}
271 \def\boldmath{\@nomath\boldmath
273 \def\unboldmath{\@nomath\unboldmath
274 \mathversion{normal}}
276 % Here we switch to the default math version by defining the internal
277 % macro |\math@version|. We dare not to call |\mathversion|
278 % at this place because this would call |\glb@settings|.
280 \def\math@version{normal}
283 % \subsection{Miscellaneous}
285 % \begin{macro}{\newfont}
286 % \changes{v1.2g}{1991/03/30}{Definition added.}
287 % \changes{v2.2e}{1995/05/23}{Font assignment made local again.}
288 % \begin{macro}{\symbol}
289 % \changes{v1.2g}{1991/03/30}{Definition added.}
290 % We start by defining a few macros that are part of
291 % standard \LaTeX's user interface. The use of these functions is
292 % not encouraged, but they will allow to process older documents
293 % without changes to the source.
295 \def\newfont#1#2{\@ifdefinable#1{\font#1=#2\relax}}
296 \def\symbol#1{\char #1\relax}
301 % \begin{macro}{\@setfontsize}
302 % \begin{macro}{\@setsize}
303 % This abbreviation is used by \LaTeX's user level size changing
304 % commands, such as |\large|.
306 \def\@setfontsize#1#2#3{\@nomath#1%
308 % For the benefit of people relying on keeping the name of the
309 % current font command saved in |\@currsize| we define it. To ensure
310 % that |\@setfontsize| keeps being robust we omit this assignment
311 % during times where |\protect| differs from |\@typeset@protect|.
312 % \changes{v1.4b}{1992/08/20}{Added \cs{@currsize}.}
313 % \changes{v2.2b}{1994/11/06}{Use \cs{@typeset@protect}}
315 \ifx\protect\@typeset@protect
318 \fontsize{#2}{#3}\selectfont}
320 % For compatibility we also define |\@setsize| the 209 command
323 \def\@setsize#1#2#3#4{\@setfontsize#1{#4}{#2}}
330 % \begin{macro}{\oldstylenums}
331 % This macro implements old style numerals but only works if we
332 % assume that the standard math fonts are used. Thus it needs
333 % changing in case other math encodings are used.
335 \def\oldstylenums#1{%
338 % Provide spacing using the interword space of the current font.
340 \spaceskip\fontdimen\tw@\font
342 % Then switch to the math italic font. We don't change the current
343 % value of |\f@series| which means that you can use bold numerals
344 % if |\bfseries| is in force. As family we use |\rmdefault| which
345 % means that this only works if there exist an |OML| encoded
346 % version of that font or rather a corresponding |.fd| file (which
347 % is the case for standard \LaTeX{} fonts even though they only
348 % contain substitutions).
349 % \changes{v3.0j}{1999/02/12}{Use \cs{rmdefault} instead of \texttt{cmm}
352 \usefont{OML}{\rmdefault}{\f@series}{it}%
353 \mathgroup\symletters #1%
359 % \begin{macro}{\hexnumber@}
360 % To set up \LaTeX's special math character
361 % definitions we first provide a macro to generate hexadecimal
362 % numbers. It is a rather simple |\ifcase|.
363 % \changes{v?}{1992/11/13}{Made expandable.}
364 % \changes{v?}{1992/12/03}{Make it accept counters.}
366 \def\hexnumber@#1{\ifcase\number#1
367 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or 8\or
368 9\or A\or B\or C\or D\or E\or F\fi}
374 % \begin{macro}{\nfss@text}
375 % \changes{v1.1e}{1990/01/25}{Macro added.}
376 % In it simplest form |\nfss@text| is an |\mbox|. This will
377 % produce unbreakable text outside math and inside math you will
378 % get text with the same fonts as outside. The only drawback is
379 % that such item won't change sizes in subscripts. But this
380 % behavior can be easily changed. With the \texttt{amstex} style
381 % option one will get a sub style called \texttt{amstext} which will
382 % redefine the |\nfss@text| macro to produce correct text in all
385 % We have to use |\def| instead of the shorter |\let| since
386 % |\mbox| is undefined when we reach this point.
387 % \changes{v1.1k}{1990/06/23}{Changed to \cs{mbox}.}
388 % \changes{v2.1n}{1994/05/17}{Added braces to allow use in subscripts}
390 \def\nfss@text#1{{\mbox{#1}}}
394 % \begin{macro}{\copyright}
395 % The definition of |\copyright| was changed so
396 % that it works in other type styles,
397 % and to make it robust. We leave the family untouched so that
398 % the copyright notice will come out differently if a different
399 % font family is in use.
400 % This command is commented out, since it is now defined in
402 % \changes{v1.1m}{1991/03/28}{Extra braces added.}
403 % \changes{v2.1n}{1994/05/17}{Really add extra braces}
404 % \changes{v2.2c}{1994/12/02}{\cs{copyright} is now in ltoutenc.
407 %\DeclareRobustCommand\copyright
409 % \raise.07ex\hbox{\mdseries\upshape c}\hfil\crcr
414 % \changes{v2.1a}{1993/11/24}{Removed \cs{xpt} stuff}
417 % \begin{macro}{\normalfont}
418 % \changes{v2.1a}{1993/11/11}{Macro added}
419 % \begin{macro}{\reset@font}
420 % \begin{macro}{\p@reset@font}
421 % \changes{v1.1n}{1991/08/26}{Macro introduced}
422 % The macro |\reset@font| is used in \LaTeX{} to switch to a standard
423 % font, in order to initialize the current font in situations where
424 % typesetting is done in a new visual context (e.g.\ in a
425 % footnote). We define it here to allow the test for the new
426 % \LaTeX{} version above but nevertheless are able to run all kind
428 % \changes{v1.1o}{1991/11/21}{Changed to protected version of macro.}
429 % \changes{v1.1o}{1991/11/21}{Added extra braces for robustness.}
431 % The user interface name for |\reset@font| is |\normalfont|:
432 % \changes{v2.1k}{1994/05/14}{Remove surplus braces}
433 % \changes{v3.0f}{1995/10/16}{Added \cs{relax} after \cs{usefont},
434 % as the latter eats up spaces.}
436 \DeclareRobustCommand\normalfont
437 {\usefont\encodingdefault
442 \let\reset@font\normalfont
450 % We left out the special \LaTeX{} fonts which are not automatically
451 % included in the base version of the font selection since these fonts
452 % contain only a few characters which are also included in the AMS
453 % fonts so anybody who is using these fonts doesn't need them.
454 % But for compatibility reasons we will define these symbols.
456 % \changes{v2.1g}{1994/02/22}{Correct error message}
458 \def\not@base#1{\@latex@error
459 {Command \noexpand#1not provided in base LaTeX2e}%
460 {Load the latexsym or the amsfonts package to
462 \def\mho{\not@base\mho}
463 \def\Join{\not@base\Join}
464 \def\Box{\not@base\Box}
465 \def\Diamond{\not@base\Diamond}
466 \def\leadsto{\not@base\leadsto}
467 \def\sqsubset{\not@base\sqsubset}
468 \def\sqsupset{\not@base\sqsupset}
469 \def\lhd{\not@base\lhd}
470 \def\unlhd{\not@base\unlhd}
471 \def\rhd{\not@base\rhd}
472 \def\unrhd{\not@base\unrhd}
477 % We now initialize all variables set by |\DeclareErrorFont|. These
478 % values are not really important since they will be overwritten
479 % later on by the definition in |fontdef.ltx|.
481 % However, if \texttt{fontdef.cfg} is corrupted then at least a
482 % hopefully suitable error font is present.
484 % \changes{v2.1k}{1994/05/14}{Init error font just before checking for
487 \DeclareErrorFont{OT1}{cmr}{m}{n}{10} %% don't modify this setting
488 %% overwrite it in fontdef.cfg
495 % We now load the customizable parts of NFSS.
496 % \changes{v3.0d}{1995/07/19}
497 % {(DPC) TeX2 support}
498 % \changes{v3.0e}{1995/09/15}
499 % {(DPC) Modify TeX2 message}
500 % \changes{v3.0g}{1995/11/01}
501 % {(DPC) Switch meaning of \cs{@addtofilelist} for cfg files}
502 % \changes{v3.0h}{1996/12/06}
503 % {(DPC) Remove *** from messages internal/2338}
505 \InputIfFileExists{fonttext.cfg}
506 {\typeout{====================================^^J%
508 Local config file fonttext.cfg used^^J%
510 ====================================}%
511 \def\@addtofilelist##1{\xdef\@filelist{\@filelist,##1}}%
513 {\input{fonttext.ltx}}
514 \let\@addtofilelist\@gobble
517 % Ditto for math although I don't think that we will get a lot of
520 \InputIfFileExists{fontmath.cfg}
521 {\typeout{====================================^^J%
523 Local config file fontmath.cfg used^^J%
525 ====================================}%
526 \def\@addtofilelist##1{\xdef\@filelist{\@filelist,##1}}%
528 {\input{fontmath.ltx}}
529 \let\@addtofilelist\@gobble
532 % Then we preload several fonts. This file might be customized
533 % \emph{without} changing the behavior of the format (i.e.\ necessary
534 % font definitions will be loaded at runtime if they are not
535 % preloaded). This is done in the file \texttt{preload.ltx}.
537 \InputIfFileExists{preload.cfg}
538 {\typeout{====================================^^J%
540 Local config file preload.cfg used^^J%
542 =====================================}%
543 \def\@addtofilelist##1{\xdef\@filelist{\@filelist,##1}}%
545 {\input{preload.ltx}}
546 \let\@addtofilelist\@gobble
550 % \begin{macro}{\@acci}
551 % \begin{macro}{\@accii}
552 % \begin{macro}{\@acciii}
553 % \changes{v2.1m}{1994/05/16}{Define saved versions of accents}
554 % We also save the values of some accents in |\@acci|, |\@accii|
555 % and |\@acciii| so they can be restored by a |minipage| inside a
556 % |tabbing| environment.
558 \let\@acci\' \let\@accii\` \let\@acciii\=
565 % \begin{macro}{\cal}
566 % \changes{v3.0a}{1995/05/24}
567 % {(DPC) Remove definition}
568 % \begin{macro}{\mit}
569 % \changes{v3.0a}{1995/05/24}
570 % {(DPC) Remove definition}
571 % Here were the two old \meta{alphabet identifiers}.
577 %<+checkmem>\CHECKMEM