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: ltfntcmd.dtx
34 \ProvidesFile{ltfntcmd.dtx}
35 [2015/03/11 v3.4b LaTeX Kernel (Font commands)]
37 \documentclass{ltxdoc}
38 \GetFileInfo{ltfntcmd.dtx}
41 \author{Frank Mittelbach, Chris Rowley}
43 \MaintainedByLaTeXTeam{latex}
53 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
54 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
55 % Digits \0\1\2\3\4\5\6\7\8\9
56 % Exclamation \! Double quote \" Hash (number) \#
57 % Dollar \$ Percent \% Ampersand \&
58 % Acute accent \' Left paren \( Right paren \)
59 % Asterisk \* Plus \+ Comma \,
60 % Minus \- Point \. Solidus \/
61 % Colon \: Semicolon \; Less than \<
62 % Equals \= Greater than \> Question mark \?
63 % Commercial at \@ Left bracket \[ Backslash \\
64 % Right bracket \] Circumflex \^ Underscore \_
65 % Grave accent \` Left brace \{ Vertical bar \|
66 % Right brace \} Tilde \~}
69 % Copyright (C) 1994-1995 Frank Mittelbach and Chris Rowley
70 % all rights reserved.
73 % \changes{v2.0b}{1993/05/05}{Removed all LaTeX related cmds}
74 % \changes{v3.0a}{1993/12/11}{Complete reworking of all text commands,
75 % using just one creator function}
76 % \changes{v3.0a}{1993/12/11}{newfontswitch command corrected and
78 % \changes{v3.0a}{1993/12/11}{newcommands replaced by defs}
79 % \changes{v3.0a}{1993/12/11}{italic correction now put in front of
80 % penalty before glue}
81 % \changes{v3.0b}{1993/12/19}{\cs{@pdef} command added}
82 % \changes{v3.0b}{1993/12/19}{Other tidying}
83 % \changes{v3.0b}{1993/12/19}{Made \cs{@newfontswitch} produce an
84 % error if command already exists, and added \cs{@renewfontswitch},
86 % \changes{v3.0b}{1993/12/19}{Untidying added, so this is now a
88 % \changes{v3.0b}{1993/12/19}{Some more tidying done}
89 % \changes{v3.1b}{1994/01/31}{\cs{@normalsize} no longer defined}
90 % \changes{v3.2a}{1994/03/15}{Adapted to mass formatting}
91 % \changes{v3.2a}{1994/03/15}{Removed defs of short-forms and all
92 % sizes except \cs{normalize}}
93 % \changes{v3.2a}{1994/03/15}{Removed \cs{@renewfontswitch}}
94 % \changes{v3.2a}{1994/03/15}{Changed \cs{/} to \cs{@@italiccorr}}
95 % \changes{v3.2b}{1994/04/14}{Macros renamed to non-private forms, JB}
96 % \changes{v3.3a}{1994/04/20}{New implementation of \cs{nocorr}}
97 % \changes{v3.3a}{1994/04/20}{Documentation up-dated}
98 % \changes{v3.3b}{1994/04/30}{Documentation up-dated and tidied}
99 % \changes{v3.3b}{1994/04/30}{Title changed}
100 % \changes{v3.3b}{1994/04/30}{Prefix frag@ changed to frag in
101 % \cs{@protecteddef}}
102 % \changes{v3.3b}{1994/04/30}{Warning changed to info message in
103 % \cs{@protecteddef}}
104 % \changes{v3.3c}{1994/05/05}{Corrected \cs{@fontswitch}}
105 % \changes{v3.3d}{1994/05/08}{Removed \cs{@undefinedfonterror}}
106 % \changes{v3.3f}{1994/05/09}{Replaced all \cs{next} by
107 % \cs{@let@token} and undo change 3.3e,
108 % whatever that was.}
109 % \changes{v3.3g}{1994/05/13}{Replaced \cs{@protecteddef} by
110 % \cs{DeclareRobustCommand}}
111 % \changes{v3.3h}{1994/05/20}{Use new error commands}
112 % \changes{v3.3i}{1994/05/24}{Tidying and typos fixed}
113 % \changes{v3.3j}{1994/05/25}{Insertion of \cs{aftergroup}s to
114 % implement \cs{nocorr} moved to the end of the group}
115 % \changes{v3.3k}{1994/06/09}{Tidying and typos fixed in documentation}
116 % \changes{v3.3l}{1994/06/18}{Added check for empty text}
117 % \changes{v3.3m}{1994/06/22}{Removed space from \cs{nfss@text}}
118 % \changes{v3.3m}{1994/06/22}{Renamed \cs{check@nocorr}}
119 % \changes{v3.3p}{1994/11/17}
120 % {\cs{@tempa} to \cs{reserved@a}}
121 % \changes{v3.3v}{1997/06/16}{Fix typo in documentation.}
122 % \changes{v3.3x}{1998/08/17}{(RmS) Minor documentation fixes.}
127 % \def \dst {{\normalfont\scshape docstrip}}
128 % \def \NFSS {\textsf{NFSS}}
132 % The commands defined in this file \texttt{ltfntcmd} are
133 % part of the kernel code for \LaTeXe/NFSS2.
135 % It is also meant to serve as documentation for package writers since
136 % it demonstrates how to define high-level font changing commands
137 % using a small number of creator functions.
140 % \section{Introduction}
142 % Font changes such as |\bfseries|, |\sffamily|, etc.\ are
143 % declarations; this means that their scope is delimited by the
144 % grouping structure, either by the next |\end| of some environment or
145 % by explicitly using a group, e.g., writing something like
146 % |{\bfseries...}| in the source. If you make the mistake of writing
147 % |\bfseries{...}| (thinking of |\bfseries| as a command with one
148 % argument) then the result is rather striking.
150 % Font declarations are an artifact of the \TeX{} system and for
151 % several reasons it is better to avoid them on the user level
152 % whenever possible. In \LaTeX3 they will probably all be
153 % replaced by environments and by font commands taking one argument.
155 % This file defines a creator function for such declarative font
156 % switches. This function creates commands which can be used in
157 % both math and text.
159 % This file also defines a number of high-level commands (all
160 % starting with |\text..|) that have one argument and typeset this
161 % argument in the requested way. Thus these commands are for
162 % typesetting short pieces of text in a specific family, series or
163 % shape. These are all produced as examples of the use of a creator
164 % function which is itself also defined in this file.
166 % Table~\ref{tab:fontcmds} shows all these high-level commands in
167 % action. A further advantage of using these commands is that they
168 % automatically take care of any necessary italic correction on either
169 % side of their argument.
172 % \begin{tabular}{lll}
173 % \textit{Command} & \textit{Corresponds to }& \textit{Action} \\[4pt]
174 % |\textrm{..}| & |\rmfamily| &
175 % Typeset argument in roman family \\
176 % |\textsf{..}| & |\sffamily| &
177 % Typeset argument in \textsf{sans serif} family \\
178 % |\texttt{..}| & |\ttfamily| &
179 % Typeset argument in \texttt{typewriter} family
181 % |\textmd{..}| & |\mdseries| &
182 % Typeset argument in medium series \\
183 % |\textbf{..}| & |\bfseries| &
184 % Typeset argument in \textbf{bold} series \\[2pt]
185 % |\textup{..}| & |\upshape| &
186 % Typeset argument in normal shape \\
187 % |\textit{..}| & |\itshape| &
188 % Typeset argument in \textit{italic} shape \\
189 % |\textsl{..}| & |\slshape| &
190 % Typeset argument in \textsl{slanted} shape \\
191 % |\textsc{..}| & |\scshape| &
192 % Typeset argument in \textsc{small caps} shape
194 % |\emph{..}| & |\em| &
195 % Typeset argument \emph{emphasized}
198 % \caption{Font-change commands with arguments}
199 % \label{tab:fontcmds}
201 % The font change commands provided here
202 % all start with |\text..| to emphasize that they
203 % are for use in normal text and to be easily memorable. They
204 % automatically take care of any necessary italic correction on either
205 % side of the argument.
209 % Thus, when using such commands, one does not have to worry about
210 % forgetting the italic correction when changing fonts. Only in very
211 % few situations is this additional space wrong but, for example, most
212 % typographers recommend omitting the italic correction if a small
213 % punctuation character, like a comma, directly follows the font
214 % change. Since the amount of correction required is partly a matter
215 % of taste, you can define in what situations the italic correction
216 % should be suppressed. This is done by putting the characters that
217 % should cancel a preceding italic correction in the list
218 % |\nocorrlist|.\footnote{Any package that changes the
219 % \texttt{\string\catcode} of a character inside
220 % \texttt{\string\nocorrlist} must then explicitly reset the list.
221 % Otherwise the changed character will no longer be recognized
222 % by the suppression algorithm.}
223 % The default definition for this list is produced by the following.
225 % \newcommand \nocorrlist {,.}
227 % It is best to declare the most often used characters first, because
228 % this will make the processing slightly faster. For example,
230 % \emph{When using the \NFSS{} high-level commands,
231 % the \emph{proper} use of italic corrections is
232 % automatically taken care of}. Only
233 % \emph{sometimes} one has to help \LaTeX{} by
234 % adding a \verb=\nocorr= command.
238 % \emph{When using the \NFSS{} high-level commands,
239 % the \emph{proper} use of italic corrections is
240 % automatically taken care of}. Only
241 % \emph{sometimes} one has to help \LaTeX{} by
242 % adding a \verb=\nocorr= command.
245 % In contrast, the use of the declaration forms is often more
246 % appropriate when you define your own commands or environments.
248 % \newenvironment{bfitemize}{\begin{itemize}\normalfont\bfseries}
251 % \item This environment produces boldface items.
252 % \item It is defined in terms of \LaTeX's
253 % \texttt{itemize} environment and NFSS
259 % \newenvironment{bfitemize}
260 % {\begin{itemize}\normalfont\bfseries}
263 % \item This environment produces boldface items.
264 % \item It is defined in terms of \LaTeX's
265 % \texttt{itemize} environment and NFSS
270 % In addition to global customization of when to insert the italic
271 % correction, it is of course sometimes necessary to explicitly insert
274 % It is also possible to suppress the italic correction
275 % in individual instances. For this, the command |\nocorr| is provided.
277 % The |\nocorr| must appear as the first or last token inside the
278 % braces of the argument of the |\text...| commands, at that end of
279 % the text where you wish to suppress the italic correction.
282 % It is worth pointing out here that inserting a |\/| in places where
283 % it can have no function (\ie anywhere except immediately after a
284 % slanted letter) is not an error---it will just be silently ignored.
285 % Unfortunately this is not true if the redefinition of |\/| in {\tt
286 % amstex.sty} is used as this version can cause space to be removed
287 % immediately before the |\/|.
292 % \section{The implementation}
294 % \changes{v3.3z}{2003/01/01}{Code checked and documentation extended
297 % \begin{macro}{\DeclareTextFontCommand}
298 % \changes{v3.0a}{1993/12/11}{Macro changed}
299 % \changes{v3.0a}{1993/12/11}{Macro changed}
300 % This is the creator function for |\text..| commands.
301 % It gives a warning if |\foo| or |\fragfoo| is already defined.
302 % \changes{v3.0b}{1993/12/19}{Corrected and tidied}
304 % In math mode it simply puts the font declaration and text into a
305 % box (possibly an automagically sized one).
307 % Otherwise it first scans the text to see where |\nocorr| occurs
308 % within it. This sets the |\check@ic| commands to do what is
309 % necessary concerning the italic correction at both ends.
311 % The algorithm for deciding whether to put in an italic correction
312 % is not very subtle: one is added whenever the newly current font
313 % is not itself positively sloped, unless the next token is a
314 % character in the `nocorr' list. At the end of the text this
315 % is done after closing the group so as to check the `outer font'.
317 % will often result in adding an italic correction token after a
318 % character in an unsloped font; we believe (in early 2003) that
319 % this is perhaps inefficient but not dangerous.
321 % It also now checks for empty contents of the text command and optimises
322 % this case. Some care is also taken to check that doing dangerous
323 % things in vertical mode is avoided.
325 % The italic correction token is added to the horizontal list
326 % before (in the list) an immediately preceding non-zero glob of
327 % glue (skip) and any non-zero penalty preceding that since, in
328 % the typical case, this puts it immediately
329 % after the last character in the preceding word.
332 % \changes{v3.3j}{1994/05/25}{Insertion of \cs{aftergroup}s moved}
333 % \changes{v3.3j}{1994/05/25}{\cs{expandafter} inserted}
334 % \changes{v3.3m}{1994/06/22}{Removed space from \cs{nfss@text}}
335 % \changes{v3.3u}{1996/10/08}{Removed \cs{check@icr} when in vmode
336 % since it causes various errors (see pr/2157)}
337 % \changes{v3.3w}{1997/10/17}{Reinstalled \cs{check@icr} as check is
338 % now done in \cs{check@nocorr@} (see PR/2646).}
339 % \changes{v3.3y}{2000/01/30}{Use \cs{hmode@bgroup} now (pr/3160)}
341 % Note that it is necessary to put in the |\aftergroup\maybe@ic| at
342 % the end of the group so that it comes after any other aftergroup
343 % tokens and immediately before the following tokens.
344 % It is also necessary to remove the |\fi| from the token list before
345 % the group ends; this is done by adding an |\expandafter| just
346 % before the closing brace.
350 \def \DeclareTextFontCommand #1#2{%
351 \DeclareRobustCommand#1[1]{%
357 #2\check@icl ##1\check@icr
366 % \begin{macro}{\textrm}
367 % \begin{macro}{\textsf}
368 % \begin{macro}{\texttt}
369 % \begin{macro}{\textnormal}
370 % Now we define the |\text|\meta{family} commands in terms of the
371 % above; |\texttt| does not look very nice!
373 \DeclareTextFontCommand{\textrm}{\rmfamily}
374 \DeclareTextFontCommand{\textsf}{\sffamily}
375 \DeclareTextFontCommand{\texttt}{\ttfamily}
376 \DeclareTextFontCommand{\textnormal}{\normalfont}
383 % \begin{macro}{\textbf}
384 % \begin{macro}{\textmd}
385 % For the series attribute:
387 \DeclareTextFontCommand{\textbf}{\bfseries}
388 \DeclareTextFontCommand{\textmd}{\mdseries}
393 % \begin{macro}{\textit}
394 % \begin{macro}{\textsl}
395 % \begin{macro}{\textsc}
396 % \begin{macro}{\textup}
397 % \changes{v3.0a}{1993/12/11}{Macros changed}
398 % And for the shapes:
400 \DeclareTextFontCommand{\textit}{\itshape}
401 \DeclareTextFontCommand{\textsl}{\slshape}
402 \DeclareTextFontCommand{\textsc}{\scshape}
403 \DeclareTextFontCommand{\textup}{\upshape}
410 % \begin{macro}{\emph}
411 % \changes{v3.0a}{1993/12/11}{Macro changed}
412 % Finally we have the |\em| font change declaration of \LaTeX. The
413 % corresponding definition with argument is
415 \DeclareTextFontCommand{\emph}{\em}
419 % \begin{macro}{\nocorr}
420 % This is just a label, so it does nothing; it should also be
427 % \begin{macro}{\check@icl}
428 % \begin{macro}{\check@icr}
429 % \changes{v3.3j}{1994/05/25}{Macros added}
430 % \changes{v3.3t}{1996/05/09}{Default definitions added}
431 % We define these defaults in case some error causes them to be
432 % expanded at the wrong time.
434 \let \check@icl \@empty
435 \let \check@icr \@empty
440 % \begin{macro}{\text@command}
441 % \begin{macro}{\check@nocorr@}
442 % \changes{v3.3a}{1994/04/20}{Macros added}
443 % \changes{v3.3m}{1994/06/22}{Renamed \cs{check@nocorr} to
444 % \cs{text@command} to improve \cs{long} error message}
445 % \changes{v3.3j}{1994/05/25}{Insertion of \cs{aftergroup}s moved
446 % and defaults set up for efficiency}
447 % This checks for a |\nocorr| as the first token in its argument
448 % and also for one in any other position not protected within
449 % braces (the latter is treated as if it were at the end of the
452 % Is this the correct action in the `empty' case? It is efficient but
453 % typographically it is, strictly, incorrect!
454 % \changes{v3.3l}{1994/06/18}{Added check for empty text}
456 \def \text@command #1{%
457 \def \reserved@a {#1}%
458 \ifx \reserved@a \@empty
459 \let \check@icl \@empty
460 \let \check@icr \@empty
463 % |\space| is a reserved word in \LaTeX{} or actually already in
464 % plain \TeX. If somebody really redefines it so many things will
465 % break that I don't see any reason to make this routine here
466 % slower than necessary.
467 % \changes{v3.3q}{1994/12/10}{Use \cs{space} command for comparison}
469 % \def \reserved@b { }%
470 % \ifx \reserved@a \reserved@b
471 \ifx \reserved@a \space
472 \let \check@icl \@empty
473 \let \check@icr \@empty
475 \check@nocorr@ #1\nocorr\@nil
479 \def \check@nocorr@ #1#2\nocorr#3\@nil {%
481 % The two checks are initialised here to their values in
483 % \changes{v3.3w}{1997/10/17}{Check for vertical mode moved here, from
484 % \cs{DeclareTextFontCommand} (see PR/2646).}
486 \let \check@icl \maybe@ic
487 \def \check@icr {\ifvmode \else \aftergroup \maybe@ic \fi}%
488 \def \reserved@a {\nocorr}%
489 \def \reserved@b {#1}%
490 \def \reserved@c {#3}%
491 \ifx \reserved@a \reserved@b
492 \ifx \reserved@c \@empty
494 % In this case there is a |\nocorr| at the start but not at the
495 % end, so |\check@icl| should be empty.
497 \let \check@icl \@empty
500 % Otherwise there is a |\nocorr| both at the start and
501 % elsewhere, so no italic corrections should be added.
503 \let \check@icl \@empty
504 \let \check@icr \@empty
507 \ifx \reserved@c \@empty
509 % In this case there is no |\nocorr| anywhere, so we need to check
510 % for an italic correction at both the beginning and the end. This
511 % has been set up as the default so no code is needed here.
515 % In this case there is no |\nocorr| at the start but there is one
516 % elsewhere, so no |\aftergroup| is needed.
518 \let \check@icr \@empty
526 % \begin{macro}{\ifmaybe@ic}
527 % \changes{v3.4a}{2009/12/14}{Macro added}
528 % Switch used soley within |\maybe@ic| not interfering with other
535 % \begin{macro}{\maybe@ic}
536 % \changes{v3.0a}{1993/12/11}{Macro name changed}
537 % \begin{macro}{\maybe@ic@}
538 % \changes{v3.0a}{1993/12/11}{Macro and name changed}
539 % \changes{v3.4a}{2009/12/14}{Use switch \cs{ifmaybe@ic} instead of
541 % \task{CAR}{Make this more efficient by checking for non-characters
542 % first and using \cs{if} test?}
543 % These macros implement the italic correction.
545 \def \maybe@ic {\futurelet\@let@token\maybe@ic@}
548 % We first check to see if the current font is positively sloped.
549 % (But do not forget the message Rainer sent about an upright font
550 % with non-zero slope! Or is this an urban myth?) It has been
551 % suggested that this should test against a small positive value,
554 \ifdim \fontdimen\@ne\font>\z@
558 % It would be possible, but probably not worthwhile, to continue the
559 % forward scan beyond any closing braces.
561 % \changes{v3.3a}{1994/04/20}{\cs{nocorr} etc removed from list of
562 % tokens to check, leaving only punctuation characters}
564 \expandafter\@tfor\expandafter\reserved@a\expandafter:\expandafter=%
567 % We have to hide the |\@let@token| in the macro |\t@st@ic| rather
568 % than testing it directly in the loop since it might be |\let|
569 % to a |\fi| or |\else|, which would result in chaos.
570 % \changes{v2.1a}{1993/11/24}{Use \cs{t@st@ic}}
574 % Frank thinks that the next bit it is inefficient if done after
575 % the second change. Chris thinks that most all of this is
576 % inefficient for the commonest cases: but that is the price of a
577 % cleverer algorithm. It is certainly needed to deal with the use
581 \ifmaybe@ic \sw@slant \fi
588 % \begin{macro}{\t@st@ic}
589 % \changes{v2.1a}{1993/11/24}{Macro added}
590 % \changes{v3.3s}{1995/07/05}{Renamed from \cs{test@next}}
591 % The next token in the input stream is stored in |\@let@token| via a
592 % |\let|, the current token from |\nocorrlist| is stored via |\def|
593 % in |\reserved@a|. To compare them we have to fiddle around a bit.
595 % If the only things to check were characters then this could be
596 % done via an |\if| thus their catcodes would not matter; but this
597 % will not work whilst |\futurelet| is used above.
598 % \changes{v3.4a}{2009/12/14}{Use switch \cs{ifmaybe@ic} instead of
602 \expandafter\let\expandafter\reserved@b\expandafter=\reserved@a\relax
603 \ifx\reserved@b\@let@token
605 % If they are the same we record the fact and jump out of the loop.
606 % \changes{v3.3s}{1995/07/03}{Use clean interface for jump}
615 % \begin{macro}{\sw@slant}
616 % \changes{v3.0a}{1993/12/11}{Macro changed}
617 % \begin{macro}{\fix@penalty}
618 % \changes{v3.0a}{1993/12/11}{Macro added}
619 % The definition of the mysterious |\sw@slant| command is as follows.
623 % It is surely correct to put in an italic correction when there
624 % is no skip. If the last thing on the list is actually a zero
625 % skip (including things whose dimension part is zero, such as
626 % |\hfill|), or anything other than a character, then the
627 % italic correction will have no effect.
629 % In order to work correctly with unbreakable spaces from |~|
630 % (and other common forms of line-breaking control) we also move
631 % back across a penalty before the glue.
643 % The above code means: ``If there is a non-zero space just before
644 % the current position (|\ifdim...|) save the amount of that space
645 % (|\skip@\lastskip|), remove it (|\unskip|), then do a similar
646 % thing if there is a penalty just before the skip,
647 % and finally put the space back in.''
649 % Since zero glue cannot be distinguished in this context from no
650 % glue, we dare not put in an |\hskip| in this case as this may
651 % produce an unwanted breakpoint. This is not satisfactory.
653 % The penalty before the glue is handled similarly, with the same
654 % caveats concerning the zero case. Is this the first recorded
655 % use of |\unpenalty| in standard \LaTeX{} code?
658 \ifnum \lastpenalty=\z@
671 % \begin{macro}{\nocorrlist}
672 % This holds the list of characters that should prevent italic
673 % correction. They should be ordered by decreasing frequency of
674 % use. If any such character is made active later on one needs
675 % to redefine the list so that the active character becomes part
677 % \changes{v3.1a}{1994/01/27}{Only ., used as default for cm fonts}
679 \def \nocorrlist {,.}
684 % \begin{macro}{\nfss@text}
685 % This command will by default behave like a \LaTeX{} |\mbox| but
686 % may be redefined by packages such as |amstext.sty| to be a bit
689 \ifx \nfss@text\@undefined
690 \def \nfss@text {\leavevmode\hbox}
696 % \begin{macro}{\DeclareOldFontCommand}
697 % \changes{v3.2b}{1994/04/14}{Renamed from \cs{@newfontswitch}}
698 % This is the function used to create declarative font-changing
699 % commands that can also be used to change alphabets in math-mode.
701 % Usage: |\DeclareOldFontCommand \fn{|\meta{font-change decls}|}|
702 % \meta{math-alphabet}
704 % Here |\fn| is the font-declaration command being defined,
705 % \meta{font-change decls} is the declaration it will expand to in
706 % text-mode, and \meta{math-alphabet} is the (single) math alphabet
707 % specifier which is to be used in math-mode.
709 % It does not care whether the command being defined already
710 % exists but it does give a warning if it redefines anything.
712 % Here are some typical examples of its use in conjunction with
713 % more basic NFSS2 font commands.
715 % \DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
716 % \DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
717 % \DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
720 % \changes{v3.0b}{1993/12/19}{Corrected and tidied}
722 \def \DeclareOldFontCommand #1#2#3{%
723 \DeclareRobustCommand #1{\@fontswitch {#2}{#3}}%
728 % \begin{macro}{\@fontswitch}
729 % \begin{macro}{\@@math@egroup}
730 % \begin{macro}{\@@math@egroup}
731 % These two commands actually do the necessary tests and
732 % declarative \mbox{font-} or alphabet-changing.
734 % \changes{v3.3c}{1994/05/05}{Corrected \cs{@fontswitch} and added
736 % \changes{v3.3q}{1994/12/10}{Don't read arguments}
737 % \changes{v3.3r}{1995/04/02}{Read them again to be able to add \cs{relax}.}
739 \def \@fontswitch #1#2{%
741 \let \math@bgroup \relax
742 \def \math@egroup {\let \math@bgroup \@@math@bgroup
743 \let \math@egroup \@@math@egroup}%
745 % We need to have a |\relax| in the following line in case the |#2|
746 % is something like |\mathsf| grabbing the next token as an
747 % argument. For this reason the code also uses explicit arguments
748 % again (see pr/1275).
755 \let \@@math@bgroup \math@bgroup
756 \let \@@math@egroup \math@egroup
762 % \changes{v2.1b}{1993/12/08}{Macros \cs{rm}, \cs{bf} and \cs{sf}
763 % moved to classes.dtx}
765 % These commands are available only in the preamble.
767 \@onlypreamble \DeclareTextFontCommand
768 \@onlypreamble \DeclareOldFontCommand
771 % \section{Initialization}
772 % \changes{v3.0b}{1993/12/19}{Added by ASAJ.}
773 % \changes{v3.0b}{1993/12/19}{Wording changes by CAR.}
775 % \begin{macro}{\normalsize}
776 % \changes{v3.3d}{1994/05/08}{Removed \cs{@undefinedfonterror}}
777 % \changes{v3.3o}{1994/11/12}{Added \cs{MessageBreak}}
778 % This is defined to produce an error.
781 \@latex@error {The font size command \protect\normalsize\space
782 is not defined:\MessageBreak
783 there is probably something wrong with