| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 1993-2025 |
| 4 |
% The LaTeX Project and any individual authors listed elsewhere |
| 5 |
% in this file. |
| 6 |
% |
| 7 |
% This file is part of the LaTeX base system. |
| 8 |
% ------------------------------------------- |
| 9 |
% |
| 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 |
% https://www.latex-project.org/lppl.txt |
| 15 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 16 |
% version 2008 or later. |
| 17 |
% |
| 18 |
% This file has the LPPL maintenance status "maintained". |
| 19 |
% |
| 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 |
| 22 |
% information. |
| 23 |
% |
| 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. |
| 27 |
% |
| 28 |
% \fi |
| 29 |
% \iffalse |
| 30 |
%%% From File: ltfssbas.dtx |
| 31 |
%% Copyright (C) 1989-2002 Frank Mittelbach and Rainer Sch\"opf |
| 32 |
% |
| 33 |
%<*driver> |
| 34 |
% \fi |
| 35 |
% |
| 36 |
% |
| 37 |
\ProvidesFile{ltfssbas.dtx} |
| 38 |
[2025/09/22 v3.2r LaTeX Kernel (NFSS Basic Macros)] |
| 39 |
% \iffalse |
| 40 |
\documentclass{ltxdoc} |
| 41 |
\begin{document} |
| 42 |
\DocInput{ltfssbas.dtx} |
| 43 |
\end{document} |
| 44 |
%</driver> |
| 45 |
% \fi |
| 46 |
% |
| 47 |
% \iffalse |
| 48 |
%<+checkmem>\def\CHECKMEM{\tracingstats=2 |
| 49 |
%<+checkmem> \newlinechar=`\^^J |
| 50 |
%<+checkmem> \message{^^JMemory usage: \filename}\shipout\hbox{}} |
| 51 |
%<+checkmem>\CHECKMEM |
| 52 |
% \fi |
| 53 |
% |
| 54 |
% |
| 55 |
% |
| 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}} |
| 61 |
% |
| 62 |
% \author{Frank Mittelbach \and Rainer Sch\"opf} |
| 63 |
% |
| 64 |
% \MaintainedByLaTeXTeam{latex} |
| 65 |
% \maketitle |
| 66 |
% |
| 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. |
| 71 |
% |
| 72 |
% \begin{quote} |
| 73 |
% \textbf{Warning:} |
| 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. |
| 77 |
% \end{quote} |
| 78 |
% |
| 79 |
% \MaybeStop{} |
| 80 |
% |
| 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} |
| 94 |
% |
| 95 |
% |
| 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.} |
| 116 |
% |
| 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 |
| 134 |
% (wasn't bugfree)} |
| 135 |
% \changes{v1.0h}{1989/04/29}{Documented problem with \cs{halign}, and |
| 136 |
% \cs{noalign}} |
| 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}{\cs{@tempa} to \cs{reserved@a}} |
| 149 |
% \changes{v3.0z}{2015/02/21}{Removed autoload code} |
| 150 |
% \changes{v3.2d}{2019/08/27}{Make various commands robust} |
| 151 |
% |
| 152 |
% |
| 153 |
% |
| 154 |
% |
| 155 |
% \section{Preliminary macros} |
| 156 |
% |
| 157 |
% We define a number |
| 158 |
% of macros that will be used later. |
| 159 |
% |
| 160 |
% \begin{macrocode} |
| 161 |
%<*2ekernel> |
| 162 |
\message{NFSS base,} |
| 163 |
% \end{macrocode} |
| 164 |
% |
| 165 |
% |
| 166 |
% \begin{macro}{\@nomath} |
| 167 |
% |\@nomath| is used by most macros that will have no effect |
| 168 |
% in math mode. It issues a warning message. |
| 169 |
% \begin{macrocode} |
| 170 |
\def\@nomath#1{\relax\ifmmode |
| 171 |
\@font@warning{Command \noexpand#1invalid in math mode}\fi} |
| 172 |
% \end{macrocode} |
| 173 |
% \end{macro} |
| 174 |
% |
| 175 |
% \changes{v1.2c}{1990/01/23}{Macro \cs{no@alphabet@help} added} |
| 176 |
% \changes{v2.1i}{1994/04/18}{Macro \cs{no@alphabet@help} |
| 177 |
% removed again} |
| 178 |
% |
| 179 |
% \begin{macro}{\no@alphabet@error} |
| 180 |
% \changes{v1.2c}{1990/01/23}{Changed to error call} |
| 181 |
% \changes{v2.1i}{1994/04/18}{Use std LaTeX error macro} |
| 182 |
% The macro |\no@alphabet@error| is called whenever |
| 183 |
% the user requests a math \emph{alphabet} that is not |
| 184 |
% available in the current \emph{version}. |
| 185 |
% In math mode an error message is produced otherwise the command |
| 186 |
% keeps silent. |
| 187 |
% The argument is the name of the control sequence that identifies |
| 188 |
% the math \emph{alphabet}. |
| 189 |
% The |\relax| at the beginning is necessary to prevent |
| 190 |
% \TeX{} from scanning too far in certain situations. |
| 191 |
% \begin{macrocode} |
| 192 |
\gdef\no@alphabet@error#1{\relax \ifmmode |
| 193 |
\@latex@error{Math\space alphabet\space identifier\space |
| 194 |
\noexpand#1is\space undefined\space in\space math\space |
| 195 |
version\space `\math@version'}% |
| 196 |
{Your\space requested\space math\space alphabet\space |
| 197 |
is\space undefined\space in\space the\space current\space |
| 198 |
math\space version.^^JCheck\space the\space spelling\space |
| 199 |
or\space use\space the\space \noexpand\SetMathAlphabet\space |
| 200 |
command.} |
| 201 |
\fi} |
| 202 |
% \end{macrocode} |
| 203 |
% \end{macro} |
| 204 |
% |
| 205 |
% |
| 206 |
% \begin{macro}{\new@mathgroup} |
| 207 |
% \begin{macro}{\mathgroup} |
| 208 |
% We also give a new name to |\newfam| and |\fam| |
| 209 |
% to avoid verbal confusion |
| 210 |
% (see the introduction).\footnote{For the same reason |
| 211 |
% it seems advisable to |
| 212 |
% {\ttfamily\bslash let\bslash fam} and |
| 213 |
% {\ttfamily\bslash newfam} |
| 214 |
% equal to {\ttfamily\bslash relax}, |
| 215 |
% but this is commented out to retain |
| 216 |
% compatibility to existing style files.} |
| 217 |
% \changes{v1.2e}{1990/01/28}{\cs{newfam} let to \cs{new@mathgroup}.} |
| 218 |
% \changes{v3.0a}{1995/05/24} |
| 219 |
% {(DPC) No need to redefine \cs{newfam} as not outer} |
| 220 |
% \changes{v3.0b}{1995/05/27} |
| 221 |
% {(FMi) But a need to define \cs{new@mathgroup}} |
| 222 |
% \changes{v3.0y}{2014/12/30} |
| 223 |
% {move allocation to ltplain.} |
| 224 |
% \begin{macrocode} |
| 225 |
%\def\new@mathgroup{\alloc@8\mathgroup\chardef\sixt@@n} |
| 226 |
\let\mathgroup\fam |
| 227 |
%\let\newfam\new@mathgroup |
| 228 |
\@onlypreamble\new@mathgroup |
| 229 |
% \end{macrocode} |
| 230 |
% \end{macro} |
| 231 |
% \end{macro} |
| 232 |
% |
| 233 |
% |
| 234 |
% \section{Macros for setting up the tables} |
| 235 |
% |
| 236 |
% \begin{macro}{\DeclareFontShape} |
| 237 |
% |
| 238 |
% \changes{v1.9a}{1992/07/26}{Introduced \cs{DeclareFontShape}} |
| 239 |
% The macro |\DeclareFontShape| takes $6$ arguments: |
| 240 |
% \begin{macrocode} |
| 241 |
\def\DeclareFontShape{\begingroup |
| 242 |
% \end{macrocode} |
| 243 |
% First we restore the catcodes of all characters used in the syntax. |
| 244 |
% \changes{v2.1e}{1994/02/24} |
| 245 |
% {Separate restoration of catcodes for fd cmds} |
| 246 |
% \begin{macrocode} |
| 247 |
\nfss@catcodes |
| 248 |
% \end{macrocode} |
| 249 |
% We use |\expandafter| |\endgroup| to restore catcode in case |
| 250 |
% something goes wrong with the argument parsing (suggested by Tim |
| 251 |
% Van Zandt) |
| 252 |
% \begin{macrocode} |
| 253 |
\expandafter\endgroup |
| 254 |
\DeclareFontShape@} |
| 255 |
% \end{macrocode} |
| 256 |
% \end{macro} |
| 257 |
% |
| 258 |
% |
| 259 |
% |
| 260 |
% \begin{macro}{\DeclareFontShape@} |
| 261 |
% \changes{v2.1c}{1994/02/07}{revert catcode settings earlier} |
| 262 |
% \changes{v3.0m}{1995/11/01} |
| 263 |
% {(DPC) Test for \cs{relax} not \cs{undefined}, internal/1933} |
| 264 |
% \begin{macrocode} |
| 265 |
%</2ekernel> |
| 266 |
%<*2ekernel|latexrelease> |
| 267 |
%<latexrelease>\IncludeInRelease{2020/02/02}% |
| 268 |
%<latexrelease> {\DeclareFontShape@}{Maybe drop one m}% |
| 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 |
| 272 |
\else |
| 273 |
% \end{macrocode} |
| 274 |
% If the series value is incorrectly specified with an extra ``m'', |
| 275 |
% e.g., ``mc'' instead of just ``c'', drop the surplus ``m'' but |
| 276 |
% keep the ``m'' if it is by its own. In that case also issue a |
| 277 |
% warning that the declaration needs correction. |
| 278 |
% \changes{v3.2f}{2020/02/24}{Drop surplus ``m'' in series when |
| 279 |
% defining fontshape (gh/289)} |
| 280 |
% \changes{v3.2g}{2020/02/27}{Only ``m'' if the series value is a member |
| 281 |
% of a fixed list and issue warning if doing it (gh/293)} |
| 282 |
% |
| 283 |
% For this we compare the given value \verb=#3= with one where we |
| 284 |
% may have dropped an ``m''. If nothing has changes, |
| 285 |
% fine. Otherwise there was a wrong value which is now corrected in |
| 286 |
% \cs{reserved@b} so we use that and also issue a warning. |
| 287 |
% \changes{v3.2j}{2021/06/09}{Improve information message} |
| 288 |
% \begin{macrocode} |
| 289 |
\edef\reserved@a{#3}% |
| 290 |
\series@maybe@drop@one@m\reserved@a\reserved@b |
| 291 |
\ifx\reserved@a\reserved@b\else |
| 292 |
\@latex@note{Font shape #1/#2/#3/#4 has incorrect series |
| 293 |
value `#3'.\MessageBreak It should not contain an `m'! |
| 294 |
Please correct it.\MessageBreak Found}% |
| 295 |
\fi |
| 296 |
\expandafter |
| 297 |
\xdef\csname#1/#2/\reserved@b/#4\endcsname |
| 298 |
{\expandafter\noexpand\csname #5\endcsname}% |
| 299 |
% |
| 300 |
% \end{macrocode} |
| 301 |
% Most of the time \verb=#6= is empty so using \cs{let} to |
| 302 |
% \cs{@empty} saves on space compared to using \cs{def}. That's |
| 303 |
% really one of the old space saving techniques and probably not |
| 304 |
% necessary these days. |
| 305 |
% \begin{macrocode} |
| 306 |
\def\reserved@a{#6}% |
| 307 |
\global |
| 308 |
\expandafter\let\csname#5\expandafter\endcsname |
| 309 |
\ifx\reserved@a\@empty |
| 310 |
\@empty |
| 311 |
\else |
| 312 |
\reserved@a |
| 313 |
\fi |
| 314 |
\fi |
| 315 |
} |
| 316 |
% \end{macrocode} |
| 317 |
% |
| 318 |
% \begin{macrocode} |
| 319 |
%</2ekernel|latexrelease> |
| 320 |
%<latexrelease>\EndIncludeInRelease |
| 321 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 322 |
%<latexrelease> {\DeclareFontShape@}{Maybe drop one m}% |
| 323 |
%<latexrelease> |
| 324 |
%<latexrelease>\def\DeclareFontShape@#1#2#3#4#5#6{% |
| 325 |
%<latexrelease> \expandafter\ifx\csname #1+#2\endcsname\relax |
| 326 |
%<latexrelease> \@latex@error{Font family `#1+#2' unknown}\@eha |
| 327 |
%<latexrelease> \else |
| 328 |
%<latexrelease> \expandafter |
| 329 |
%<latexrelease> \xdef\csname#1/#2/#3/#4\endcsname{\expandafter\noexpand |
| 330 |
%<latexrelease> \csname #5\endcsname}% |
| 331 |
%<latexrelease> \def\reserved@a{#6}% |
| 332 |
%<latexrelease> \global |
| 333 |
%<latexrelease> \expandafter\let\csname#5\expandafter\endcsname |
| 334 |
%<latexrelease> \ifx\reserved@a\@empty |
| 335 |
%<latexrelease> \@empty |
| 336 |
%<latexrelease> \else |
| 337 |
%<latexrelease> \reserved@a |
| 338 |
%<latexrelease> \fi |
| 339 |
%<latexrelease> \fi |
| 340 |
%<latexrelease> } |
| 341 |
%<latexrelease>\EndIncludeInRelease |
| 342 |
%<*2ekernel> |
| 343 |
% \end{macrocode} |
| 344 |
% \end{macro} |
| 345 |
% |
| 346 |
% |
| 347 |
% \begin{macro}{\DeclareFixedFont} |
| 348 |
% Define a direct font switch that avoids all overhead. |
| 349 |
% \changes{v2.1u}{1994/11/06}{Renamed |
| 350 |
% \cs{every@size} to \cs{every@math@size}.} |
| 351 |
% \begin{macrocode} |
| 352 |
\def\DeclareFixedFont#1#2#3#4#5#6{% |
| 353 |
\begingroup |
| 354 |
\math@fontsfalse |
| 355 |
\every@math@size{}% |
| 356 |
\fontsize{#6}\z@ |
| 357 |
\usefont{#2}{#3}{#4}{#5}% |
| 358 |
\global\expandafter\let\expandafter#1\the\font |
| 359 |
\endgroup |
| 360 |
} |
| 361 |
% \end{macrocode} |
| 362 |
% \end{macro} |
| 363 |
% |
| 364 |
% |
| 365 |
% |
| 366 |
% |
| 367 |
% \begin{macro}{\do@subst@correction} |
| 368 |
% |
| 369 |
% \begin{macrocode} |
| 370 |
\def\do@subst@correction{% |
| 371 |
\xdef\subst@correction{% |
| 372 |
\font@name |
| 373 |
\global\expandafter\font |
| 374 |
\csname \curr@fontshape/\f@size\endcsname |
| 375 |
\noexpand\fontname\font |
| 376 |
\relax}% |
| 377 |
% \end{macrocode} |
| 378 |
% Calling |\subst@correction| after the current group means calling |
| 379 |
% it after we have loaded the substitution font which is done |
| 380 |
% inside a group. |
| 381 |
% \begin{macrocode} |
| 382 |
\aftergroup\subst@correction |
| 383 |
} |
| 384 |
% \end{macrocode} |
| 385 |
% \end{macro} |
| 386 |
% |
| 387 |
% \begin{macro}{\DeclareFontFamily} |
| 388 |
% \begin{macrocode} |
| 389 |
\def\DeclareFontFamily#1#2#3{% |
| 390 |
% \end{macrocode} |
| 391 |
% If we want fast checking for the encoding scheme we can just |
| 392 |
% check for |\T@..| being defined. |
| 393 |
% \begin{macrocode} |
| 394 |
% \@tempswafalse |
| 395 |
% \def\reserved@b{#1}% |
| 396 |
% \def\cdp@elt##1##2##3##4{\def\reserved@c{##1}% |
| 397 |
% \ifx\reserved@b\reserved@c \@tempswatrue\fi}% |
| 398 |
% \cdp@list |
| 399 |
% \if@tempswa |
| 400 |
\@ifundefined{T@#1}% |
| 401 |
{% |
| 402 |
\@latex@error{Encoding scheme `#1' unknown}\@eha |
| 403 |
}% |
| 404 |
{% |
| 405 |
% \end{macrocode} |
| 406 |
% Now we have to define the macro |\|\meta{\#1}|+|\meta{\#2} |
| 407 |
% to contain |#3|. But since most of the time |#3| will be empty |
| 408 |
% we use |\let| in a tricky way rather than a simple |\def| since |
| 409 |
% this will save internal memory. |
| 410 |
% We store the argument |#3| in a temporary macro |
| 411 |
% |\reserved@a|. |
| 412 |
% \begin{macrocode} |
| 413 |
\def\reserved@a{#3}% |
| 414 |
% \end{macrocode} |
| 415 |
% We compare |\reserved@a| with |\@empty| |
| 416 |
% If these two are the same we |\let| the `extra' |
| 417 |
% macro equal to |\@empty| which is not the same a doing a |\let| |
| 418 |
% to |\reserved@a| --- the latter would blow one extra memory |
| 419 |
% location rather then reusing the one from |\@empty|. |
| 420 |
% \begin{macrocode} |
| 421 |
\global |
| 422 |
\expandafter\let\csname #1+#2\expandafter\endcsname |
| 423 |
\ifx \reserved@a\@empty |
| 424 |
\@empty |
| 425 |
\else \reserved@a |
| 426 |
\fi |
| 427 |
}% |
| 428 |
} |
| 429 |
% \end{macrocode} |
| 430 |
% \end{macro} |
| 431 |
% |
| 432 |
% |
| 433 |
% \begin{macro}{\cdp@list} |
| 434 |
% We initialize the code page list to be empty. |
| 435 |
% \begin{macrocode} |
| 436 |
\let\cdp@list\@empty |
| 437 |
\@onlypreamble\cdp@list |
| 438 |
% \end{macrocode} |
| 439 |
% \end{macro} |
| 440 |
% |
| 441 |
% \begin{macro}{\cdp@elt} |
| 442 |
% \begin{macrocode} |
| 443 |
\let\cdp@elt\relax |
| 444 |
\@onlypreamble\cdp@elt |
| 445 |
% \end{macrocode} |
| 446 |
% \end{macro} |
| 447 |
% |
| 448 |
% |
| 449 |
% |
| 450 |
% |
| 451 |
% \begin{macro}{\DeclareFontEncoding} |
| 452 |
% \begin{macrocode} |
| 453 |
\def\DeclareFontEncoding{% |
| 454 |
% \end{macrocode} |
| 455 |
% First we start with ignoring all blanks and newlines since every |
| 456 |
% surplus space in the second or third argument will come out in |
| 457 |
% a weird place in the document. |
| 458 |
% \changes{v2.1c}{1994/02/07}{revert catcode settings earlier} |
| 459 |
% \changes{v2.1t}{1994/10/19}{Add missing \cs{relax}.} |
| 460 |
% \changes{v2.1z}{1994/12/06}{use \cs{nfss@catcodes}} |
| 461 |
% \begin{macrocode} |
| 462 |
\begingroup |
| 463 |
\nfss@catcodes |
| 464 |
\expandafter\endgroup |
| 465 |
\DeclareFontEncoding@} |
| 466 |
\@onlypreamble\DeclareFontEncoding |
| 467 |
% \end{macrocode} |
| 468 |
% \changes{v2.0g}{1993/09/15} |
| 469 |
% {Corrected: \cs{default@T} to \cs{default@M}.} |
| 470 |
% \begin{macrocode} |
| 471 |
\def\DeclareFontEncoding@#1#2#3{% |
| 472 |
\expandafter |
| 473 |
\ifx\csname T@#1\endcsname\relax |
| 474 |
\def\cdp@elt{\noexpand\cdp@elt}% |
| 475 |
\xdef\cdp@list{\cdp@list\cdp@elt{#1}% |
| 476 |
{\default@family}{\default@series}% |
| 477 |
{\default@shape}}% |
| 478 |
% \end{macrocode} |
| 479 |
% To support encoding dependent commands (like accents) we |
| 480 |
% initialise the command |
| 481 |
% |\|\meta{encoding}|-cmd| to be |\@changed@cmd|. |
| 482 |
% (See \texttt{ltoutenc.dtx} for details.) |
| 483 |
% \changes{v2.1l}{1994/05/13}{Init encoding change command} |
| 484 |
% \changes{v2.1n}{1994/05/14}{Only init enc change cmd when |
| 485 |
% new encoding} |
| 486 |
% \changes{v2.1n}{1994/05/14}{Log if encoding is redeclared} |
| 487 |
% \begin{macrocode} |
| 488 |
\expandafter\let\csname#1-cmd\endcsname\@changed@cmd |
| 489 |
\else |
| 490 |
\@font@info{Redeclaring font encoding #1}% |
| 491 |
\fi |
| 492 |
% \end{macrocode} |
| 493 |
% |
| 494 |
% \begin{macrocode} |
| 495 |
\global\@namedef{T@#1}{#2}% |
| 496 |
\global\@namedef{M@#1}{\default@M#3}% |
| 497 |
% \end{macrocode} |
| 498 |
% Keep a record of the last encoding being declared: |
| 499 |
% \changes{v3.0w}{1999/01/06}{Added \cs{LastDeclaredEncoding} to |
| 500 |
% support cyrillic integration (pr/2988)} |
| 501 |
% \begin{macrocode} |
| 502 |
\xdef\LastDeclaredEncoding{#1}% |
| 503 |
} |
| 504 |
\@onlypreamble\DeclareFontEncoding@ |
| 505 |
% \end{macrocode} |
| 506 |
% \end{macro} |
| 507 |
% |
| 508 |
% |
| 509 |
% \begin{macro}{\LastDeclaredEncoding} |
| 510 |
% \changes{v3.0w}{1999/01/06}{Added \cs{LastDeclaredEncoding} to |
| 511 |
% support cyrillic integration (pr/2988)} |
| 512 |
% The last encoding being declared by |\DeclareFontEncoding|. |
| 513 |
% \begin{macrocode} |
| 514 |
\def\LastDeclaredEncoding{} |
| 515 |
% \end{macrocode} |
| 516 |
% \end{macro} |
| 517 |
% |
| 518 |
% \begin{macro}{\DeclareFontSubstitution} |
| 519 |
% \begin{macrocode} |
| 520 |
\def\DeclareFontSubstitution#1#2#3#4{% |
| 521 |
\expandafter |
| 522 |
\ifx\csname T@#1\endcsname\relax |
| 523 |
\@latex@error{Encoding scheme `#1' unknown}\@eha |
| 524 |
\else |
| 525 |
\begingroup |
| 526 |
% \end{macrocode} |
| 527 |
% \changes{v3.0x}{2002/10/02}{Adding \cs{LastDeclaredEncoding} |
| 528 |
% introduced a bug as on some occasions that macro name was stored |
| 529 |
% in the internal lists instead of the actual encoding. (pr/3459)} |
| 530 |
% We loop through the |\cdp@list| and rebuild it anew in |\toks@| |
| 531 |
% thereby replacing the defaults for the encoding in question with |
| 532 |
% the new defaults. It is important to store the encoding to test |
| 533 |
% against expanded in |\reserved@a| since it might just be |
| 534 |
% |\LastDeclaredEncoding| that is passed as |#1|. |
| 535 |
% \begin{macrocode} |
| 536 |
\edef\reserved@a{#1}% |
| 537 |
\toks@{}% |
| 538 |
\def\cdp@elt##1##2##3##4{% |
| 539 |
\def\reserved@b{##1}% |
| 540 |
\ifx\reserved@a\reserved@b |
| 541 |
% \end{macrocode} |
| 542 |
% Here we use the new defaults but we use |##1| (i.e., the encoding |
| 543 |
% name already stored previously) since we know that it is expanded. |
| 544 |
% \begin{macrocode} |
| 545 |
\addto@hook\toks@{\cdp@elt{##1}{#2}{#3}{#4}}% |
| 546 |
\else |
| 547 |
% \end{macrocode} |
| 548 |
% If |\reserved@a| and |\reserved@b| differ then we simply copy |
| 549 |
% from the old list to the new. |
| 550 |
% \begin{macrocode} |
| 551 |
\addto@hook\toks@{\cdp@elt{##1}{##2}{##3}{##4}}% |
| 552 |
\fi}% |
| 553 |
\cdp@list |
| 554 |
\xdef\cdp@list{\the\toks@}% |
| 555 |
\endgroup |
| 556 |
\global |
| 557 |
\@namedef{D@#1}{% |
| 558 |
\def\default@family{#2}% |
| 559 |
\def\default@series{#3}% |
| 560 |
\def\default@shape{#4}% |
| 561 |
}% |
| 562 |
\fi |
| 563 |
} |
| 564 |
\@onlypreamble\DeclareFontSubstitution |
| 565 |
% \end{macrocode} |
| 566 |
% \end{macro} |
| 567 |
% |
| 568 |
% |
| 569 |
% \begin{macro}{\DeclareFontEncodingDefaults} |
| 570 |
% \begin{macrocode} |
| 571 |
\def\DeclareFontEncodingDefaults#1#2{% |
| 572 |
\ifx\relax#1\else |
| 573 |
\ifx\default@T\@empty\else |
| 574 |
\@font@info{Overwriting encoding scheme text defaults}% |
| 575 |
\fi |
| 576 |
\gdef\default@T{#1}% |
| 577 |
\fi |
| 578 |
\ifx\relax#2\else |
| 579 |
\ifx\default@M\@empty\else |
| 580 |
\@font@info{Overwriting encoding scheme math defaults}% |
| 581 |
\fi |
| 582 |
\gdef\default@M{#2}% |
| 583 |
\fi |
| 584 |
} |
| 585 |
\@onlypreamble\DeclareFontEncodingDefaults |
| 586 |
% \end{macrocode} |
| 587 |
% \end{macro} |
| 588 |
% |
| 589 |
% |
| 590 |
% \begin{macro}{\default@T} |
| 591 |
% \begin{macro}{\default@M} |
| 592 |
% \begin{macrocode} |
| 593 |
\let\default@T\@empty |
| 594 |
\let\default@M\@empty |
| 595 |
% \end{macrocode} |
| 596 |
% \end{macro} |
| 597 |
% \end{macro} |
| 598 |
% |
| 599 |
% |
| 600 |
% |
| 601 |
% |
| 602 |
% \begin{macro}{\DeclareEncodingSubset} |
| 603 |
% |
| 604 |
% The declaration takes 3 mandatory arguments: an \emph{encoding} |
| 605 |
% for which a subsetting is wanted (currently always \texttt{TS1}, |
| 606 |
% and most likely forever), the \emph{font family} for which we |
| 607 |
% declare the subset and finally the \emph{subset} number, with a value between |
| 608 |
% \texttt{0} (all of the encoding is supported) and \texttt{9} (many |
| 609 |
% glyphs are missing). |
| 610 |
% |
| 611 |
% For \texttt{TS1} the numbers have been chosen in a way that most |
| 612 |
% fonts can be fairly correctly categorized, but the default |
| 613 |
% settings are always conservative, that is they may claim that |
| 614 |
% fewer glyphs are supported than there actually are. |
| 615 |
% |
| 616 |
% As these days many font families are set up to end in \texttt{-LF} |
| 617 |
% (lining figures), \texttt{-OsF} (oldstyle figures), etc.\ the |
| 618 |
% declaration supports a shortcut: if the \emph{font family} name |
| 619 |
% ends in \texttt{-*} then the star gets replaced by these common |
| 620 |
% ending, e.g., |
| 621 |
%\begin{verbatim} |
| 622 |
% \DeclareEncodingSubset{TS1}{Alegreya-*}{2} |
| 623 |
%\end{verbatim} |
| 624 |
% is the same as writing |
| 625 |
%\begin{verbatim} |
| 626 |
% \DeclareEncodingSubset{TS1}{Alegreya-LF}{2} |
| 627 |
% \DeclareEncodingSubset{TS1}{Alegreya-OsF}{2} |
| 628 |
% \DeclareEncodingSubset{TS1}{Alegreya-TLF}{2} |
| 629 |
% \DeclareEncodingSubset{TS1}{Alegreya-TOsF}{2} |
| 630 |
%\end{verbatim} |
| 631 |
% If only some are needed then one can define them individually but |
| 632 |
% in many cases all four are wanted, hence the shortcut. |
| 633 |
% |
| 634 |
% |
| 635 |
% The coding of the declaration has no error checking as it is |
| 636 |
% mostly for internal use. |
| 637 |
% \begin{macrocode} |
| 638 |
\def\DeclareEncodingSubset#1#2{% |
| 639 |
\DeclareEncodingSubset@aux{#1}#2*\DeclareEncodingSubset@aux |
| 640 |
} |
| 641 |
% \end{macrocode} |
| 642 |
% |
| 643 |
% \begin{macrocode} |
| 644 |
\def\DeclareEncodingSubset@aux#1#2*#3\DeclareEncodingSubset@aux#4{% |
| 645 |
% \end{macrocode} |
| 646 |
% if \verb=#3= is empty then there was no star, otherwise we |
| 647 |
% define all four variants. |
| 648 |
% \begin{macrocode} |
| 649 |
\expandafter\ifx\expandafter X\detokenize{#3}X% |
| 650 |
\@DeclareEncodingSubset{#1}{#2}{#4}% |
| 651 |
\else |
| 652 |
\@DeclareEncodingSubset{#1}{#2LF}{#4}% |
| 653 |
\@DeclareEncodingSubset{#1}{#2TLF}{#4}% |
| 654 |
\@DeclareEncodingSubset{#1}{#2OsF}{#4}% |
| 655 |
\@DeclareEncodingSubset{#1}{#2TOsF}{#4}% |
| 656 |
\fi |
| 657 |
} |
| 658 |
% \end{macrocode} |
| 659 |
% |
| 660 |
% The subset info is stored in a command with the name |
| 661 |
% \texttt{\bslash}\emph{family}\texttt{:}\emph{subset} so if that |
| 662 |
% already exists we change otherwise declare a subset. |
| 663 |
% \begin{macrocode} |
| 664 |
\def\@DeclareEncodingSubset#1#2#3{% |
| 665 |
\@ifundefined{#1:#2}% |
| 666 |
{\@font@info{Setting #2 sub-encoding to #1/#3}}% |
| 667 |
{\@font@info{Changing #2 sub-encoding to #1/#3}}% |
| 668 |
% \end{macrocode} |
| 669 |
% This declaration should be usable in \texttt{.fd} files and |
| 670 |
% therefore has to make its definition globally, because such files |
| 671 |
% can get loaded in random places. |
| 672 |
% \changes{v1.0g}{2022/08/07}{Make global declaration (gh/905)} |
| 673 |
% \begin{macrocode} |
| 674 |
\global\@namedef{#1:#2}{#3}} |
| 675 |
% \end{macrocode} |
| 676 |
% \end{macro} |
| 677 |
% |
| 678 |
% |
| 679 |
% |
| 680 |
% |
| 681 |
% \begin{macro}{\CheckEncodingSubset} |
| 682 |
% The command |\CheckEncodingSubset| will check if the current font |
| 683 |
% family has the right encoding subset to typeset a certain |
| 684 |
% command. It takes five arguments as follows: |
| 685 |
% first argument is either |\UseTextSymbol|, |\UseTextAccent| |
| 686 |
% depending on whether or not the symbol is a text symbol or a text |
| 687 |
% accent. |
| 688 |
|
| 689 |
% The second argument is the encoding from which this symbol should |
| 690 |
% be fetched. |
| 691 |
% |
| 692 |
% The third argument is either a fake accessor command or an error |
| 693 |
% message. the code in that argument (if ever executed) receives |
| 694 |
% two arguments: |#2| and |#5| of |\CheckEncodingSubset|. |
| 695 |
% |
| 696 |
% Argument four is the subset encoding id to test against: if this |
| 697 |
% value is higher than the subset id of the current font family |
| 698 |
% then we typeset the symbol, i.e., execute |#1{#2}#5| otherwise |
| 699 |
% it runs |#3#5|, e.g., to produce an error message or fake the |
| 700 |
% glyph somehow. |
| 701 |
% |
| 702 |
% Argument five is the symbol or accent command that is being |
| 703 |
% checked. |
| 704 |
% |
| 705 |
% For usage examples see definitions in \texttt{lttextcomp.dtx}. |
| 706 |
% |
| 707 |
% \begin{macrocode} |
| 708 |
%</2ekernel> |
| 709 |
%<*2ekernel|latexrelease> |
| 710 |
%<latexrelease>\IncludeInRelease{2025/06/01}% |
| 711 |
%<latexrelease> {\CheckEncodingSubset}{preload .fd file}% |
| 712 |
% \end{macrocode} |
| 713 |
% |
| 714 |
% \begin{macrocode} |
| 715 |
\def\CheckEncodingSubset#1#2#3#4#5{% |
| 716 |
% \end{macrocode} |
| 717 |
% If the \texttt{.fd} is not yet loaded we make an attempt to load |
| 718 |
% it now because it may contain a \cs{DeclareEncodingSubset} |
| 719 |
% declaration for the font. |
| 720 |
% \changes{v3.2p}{2025/02/20}{If necessary, load the \texttt{.fd} |
| 721 |
% before checking the encoding subset (gh/1669)} |
| 722 |
% \begin{macrocode} |
| 723 |
\expandafter\ifx\csname #2:\f@family\endcsname\relax |
| 724 |
\LoadFontDefinitionFile{#2}\f@family |
| 725 |
\fi |
| 726 |
\ifnum #4>% |
| 727 |
\expandafter\ifx\csname #2:\f@family\endcsname\relax |
| 728 |
0\csname #2:?\endcsname |
| 729 |
\else |
| 730 |
\csname #2:\f@family\endcsname |
| 731 |
\fi |
| 732 |
\relax |
| 733 |
\expandafter\@firstoftwo |
| 734 |
\else |
| 735 |
\expandafter\@secondoftwo |
| 736 |
\fi |
| 737 |
{#1{#2}}{#3}% |
| 738 |
#5% |
| 739 |
} |
| 740 |
%</2ekernel|latexrelease> |
| 741 |
%<latexrelease>\EndIncludeInRelease |
| 742 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 743 |
%<latexrelease> {\CheckEncodingSubset}{preload .fd file}% |
| 744 |
%<latexrelease> |
| 745 |
%<latexrelease>\def\CheckEncodingSubset#1#2#3#4#5{% |
| 746 |
%<latexrelease> \ifnum #4>% |
| 747 |
%<latexrelease> \expandafter\ifx\csname #2:\f@family\endcsname\relax |
| 748 |
%<latexrelease> 0\csname #2:?\endcsname |
| 749 |
%<latexrelease> \else |
| 750 |
%<latexrelease> \csname #2:\f@family\endcsname |
| 751 |
%<latexrelease> \fi |
| 752 |
%<latexrelease> \relax |
| 753 |
%<latexrelease> \expandafter\@firstoftwo |
| 754 |
%<latexrelease> \else |
| 755 |
%<latexrelease> \expandafter\@secondoftwo |
| 756 |
%<latexrelease> \fi |
| 757 |
%<latexrelease> {#1{#2}}{#3}% |
| 758 |
%<latexrelease> #5% |
| 759 |
%<latexrelease>} |
| 760 |
%<latexrelease>\EndIncludeInRelease |
| 761 |
%<*2ekernel> |
| 762 |
% \end{macrocode} |
| 763 |
% \end{macro} |
| 764 |
% |
| 765 |
% |
| 766 |
% |
| 767 |
% |
| 768 |
% \begin{macro}{\DeclarePreloadSizes} |
| 769 |
% \begin{macrocode} |
| 770 |
\def\DeclarePreloadSizes#1#2#3#4#5{% |
| 771 |
\@ifundefined{T@#1}% |
| 772 |
{\@latex@error{Encoding scheme `#1' unknown}\@eha}% |
| 773 |
{% |
| 774 |
% \end{macrocode} |
| 775 |
% Don't know at the moment what this group here does! |
| 776 |
% \begin{macrocode} |
| 777 |
\begingroup |
| 778 |
% \end{macrocode} |
| 779 |
% We define a macro |\reserved@f|\footnote{We cannot use |
| 780 |
% {\ttfamily\bslash @tempa} |
| 781 |
% since it is needed in |
| 782 |
% {\ttfamily\bslash pickup@font}.} |
| 783 |
% that grabs the next \emph{size} and loads the corresponding |
| 784 |
% font. |
| 785 |
% This is done by delimiting |\reserved@f|'s only argument by the |
| 786 |
% \textsf{token} |,| (comma). |
| 787 |
% \begin{macrocode} |
| 788 |
\def\reserved@f##1,{% |
| 789 |
% \end{macrocode} |
| 790 |
% The end of the list will be detected when there are no more |
| 791 |
% elements, i.e.\ when |\reserved@f|'s argument is empty. |
| 792 |
% The trick used here is explained in Appendix~D of the |
| 793 |
% \TeX{}book: if the argument is empty the |\if| |
| 794 |
% will select the first clause and |\let| |\reserved@f| |
| 795 |
% equal to |\relax|. |
| 796 |
% (We use the |>| character here since it cannot appear |
| 797 |
% in font file names.) |
| 798 |
% \changes{v1.2j}{1990/06/24}{Missing percent added.} |
| 799 |
% \begin{macrocode} |
| 800 |
\if>##1>% |
| 801 |
\let\reserved@f\relax |
| 802 |
\else |
| 803 |
% \end{macrocode} |
| 804 |
% Otherwise, we define |\font@name| appropriately and |
| 805 |
% call |\pickup@font| to do the work. |
| 806 |
% Note that the requested |\curr@fontshape| |
| 807 |
% combination must have been defined, or you will get an error. |
| 808 |
% The definition of |\font@name| is carried out globally |
| 809 |
% to be consistent with the rest of the code in this file. |
| 810 |
% \begin{macrocode} |
| 811 |
\xdef\font@name{\csname#1/#2/#3/#4/##1\endcsname}% |
| 812 |
\pickup@font |
| 813 |
% \end{macrocode} |
| 814 |
% Now we forget the name of the font just loaded. |
| 815 |
% More precisely, we set the corresponding control sequence |
| 816 |
% to |\relax|. This means that later on, when the font |
| 817 |
% is first used, the macro |\define@newfont| is called |
| 818 |
% again to execute the `extra' macro for this font. |
| 819 |
% \changes{v1.2d}{1990/01/27}{Font identifier set to \cs{relax}.} |
| 820 |
% \begin{macrocode} |
| 821 |
\global\expandafter\let\font@name\relax |
| 822 |
\fi |
| 823 |
% \end{macrocode} |
| 824 |
% Finally we call |\reserved@f| again to process the next |
| 825 |
% \emph{size}. If |\reserved@f| was |\let| equal to |\relax| |
| 826 |
% this will end the macro. |
| 827 |
% \begin{macrocode} |
| 828 |
\reserved@f}% |
| 829 |
% \end{macrocode} |
| 830 |
% We finish with reinserting the list of sizes after the |
| 831 |
% |\reserved@f| |
| 832 |
% macro and appending an empty element so that the end of the list |
| 833 |
% is recognized properly. |
| 834 |
% \begin{macrocode} |
| 835 |
\reserved@f#5,,% |
| 836 |
\endgroup |
| 837 |
}% |
| 838 |
} |
| 839 |
\@onlypreamble\DeclarePreloadSizes |
| 840 |
% \end{macrocode} |
| 841 |
% \end{macro} |
| 842 |
% |
| 843 |
% |
| 844 |
% |
| 845 |
% \begin{macro}{\ifmath@fonts} |
| 846 |
% We need a switch to decide if we have to switch math fonts. |
| 847 |
% For this purpose we provide |\ifmath@fonts| |
| 848 |
% that can be set to true or false by the |\S@...| macros |
| 849 |
% depending on if math fonts |
| 850 |
% are provided for this size or not. |
| 851 |
% The default is of course to switch all fonts. |
| 852 |
% \begin{macrocode} |
| 853 |
\newif\ifmath@fonts \math@fontstrue |
| 854 |
% \end{macrocode} |
| 855 |
% \end{macro} |
| 856 |
% |
| 857 |
% |
| 858 |
% |
| 859 |
% \begin{macro}{\DeclareMathSizes} |
| 860 |
% \begin{macro}{\DeclareMathSizes*} |
| 861 |
% |\DeclareMathSizes| takes the text size, math text size, math |
| 862 |
% script size, and math scriptscript size as arguments and defines |
| 863 |
% the right |\S@|\dots{} macro. |
| 864 |
% |
| 865 |
% \begin{macrocode} |
| 866 |
\def\DeclareMathSizes{% |
| 867 |
\@ifstar{\@DeclareMathSizes\math@fontsfalse}% |
| 868 |
{\@DeclareMathSizes{}}} |
| 869 |
\@onlypreamble\DeclareMathSizes |
| 870 |
% \end{macrocode} |
| 871 |
% \end{macro} |
| 872 |
% \end{macro} |
| 873 |
% |
| 874 |
% \begin{macro}{\@DeclareMathSizes} |
| 875 |
% \changes{v3.0p}{1996/07/26}{use faster \cs{if} test} |
| 876 |
% This modification by Michael J. Downes on comp.text.tex on 2002/10/17 |
| 877 |
% allows the user to have settings such as\\ |
| 878 |
% |\DeclareMathSizes{9.5dd}{9.5dd}{7.4dd}{6.6dd}|. |
| 879 |
% \changes{v3.0y}{2015/01/11}{Allow arbitrary units (latexrelease)} |
| 880 |
% \begin{macrocode} |
| 881 |
%</2ekernel> |
| 882 |
%<latexrelease>\IncludeInRelease{2015/01/01}{\@DeclareMathSizes}% |
| 883 |
%<latexrelease> {Arbitrary units in \DeclareMathSizes}% |
| 884 |
%<*2ekernel|latexrelease> |
| 885 |
\def\@DeclareMathSizes #1#2#3#4#5{% |
| 886 |
\@defaultunits\dimen@ #2pt\relax\@nnil |
| 887 |
\if $#3$% |
| 888 |
\expandafter\let\csname S@\strip@pt\dimen@\endcsname\math@fontsfalse |
| 889 |
\else |
| 890 |
\@defaultunits\dimen@ii #3pt\relax\@nnil |
| 891 |
\@defaultunits\@tempdima #4pt\relax\@nnil |
| 892 |
\@defaultunits\@tempdimb #5pt\relax\@nnil |
| 893 |
\toks@{#1}% |
| 894 |
\expandafter\xdef\csname S@\strip@pt\dimen@\endcsname{% |
| 895 |
\gdef\noexpand\tf@size{\strip@pt\dimen@ii}% |
| 896 |
\gdef\noexpand\sf@size{\strip@pt\@tempdima}% |
| 897 |
\gdef\noexpand\ssf@size{\strip@pt\@tempdimb}% |
| 898 |
\the\toks@ |
| 899 |
}% |
| 900 |
\fi |
| 901 |
}% |
| 902 |
%</2ekernel|latexrelease> |
| 903 |
%<latexrelease>\EndIncludeInRelease |
| 904 |
%<latexrelease>\IncludeInRelease{0000/00/00}{\@DeclareMathSizes}% |
| 905 |
%<latexrelease> {Arbitrary units in \DeclareMathSizes}% |
| 906 |
%<latexrelease>\def\@DeclareMathSizes#1#2#3#4#5{% |
| 907 |
%<latexrelease> \@defaultunits\dimen@#2pt\relax\@nnil |
| 908 |
%<latexrelease> \if$#3$% |
| 909 |
%<latexrelease> \expandafter \let |
| 910 |
%<latexrelease> \csname S@\strip@pt\dimen@\endcsname |
| 911 |
%<latexrelease> \math@fontsfalse |
| 912 |
%<latexrelease> \else |
| 913 |
%<latexrelease> \expandafter \gdef |
| 914 |
%<latexrelease> \csname S@\strip@pt\dimen@\endcsname |
| 915 |
%<latexrelease> {\gdef\tf@size{#3}\gdef\sf@size{#4}% |
| 916 |
%<latexrelease> \gdef\ssf@size{#5}% |
| 917 |
%<latexrelease> #1% |
| 918 |
%<latexrelease> }% |
| 919 |
%<latexrelease> \fi}% |
| 920 |
%<latexrelease>\EndIncludeInRelease |
| 921 |
%<*2ekernel> |
| 922 |
% \end{macrocode} |
| 923 |
% |
| 924 |
% \begin{macrocode} |
| 925 |
\@onlypreamble\@DeclareMathSizes |
| 926 |
% \end{macrocode} |
| 927 |
% \end{macro} |
| 928 |
% |
| 929 |
% |
| 930 |
% |
| 931 |
% \section{Selecting a new font} |
| 932 |
% |
| 933 |
% \subsection{Macros for the user} |
| 934 |
% |
| 935 |
% |
| 936 |
% \begin{macro}{\fontencoding} |
| 937 |
% \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.} |
| 938 |
% \begin{macro}{\f@encoding} |
| 939 |
% As we said in the introduction a font is described by four parameters. |
| 940 |
% We first define macros to specify the wanted \emph{family}, |
| 941 |
% \emph{series}, or \emph{shape}. |
| 942 |
% These are simply recorded in internal macros |
| 943 |
% |\f@family|, |\f@series|, and |\f@shape|, resp. |
| 944 |
% We use |\edef|'s so that the arguments can also be macros. |
| 945 |
% \begin{macrocode} |
| 946 |
\DeclareRobustCommand\fontencoding[1]{% |
| 947 |
\expandafter\ifx\csname T@#1\endcsname\relax |
| 948 |
\@latex@error{Encoding scheme `#1' unknown}\@eha |
| 949 |
\else |
| 950 |
\edef\f@encoding{#1}% |
| 951 |
\ifx\cf@encoding\f@encoding |
| 952 |
% \end{macrocode} |
| 953 |
% If the new encoding is the same as the old |
| 954 |
% encoding we have nothing to do. |
| 955 |
% However, in case we had a sequence of several encoding changes |
| 956 |
% without a |\selectfont| in-between we can save processing by |
| 957 |
% making sure that |\enc@update| is |\relax|. |
| 958 |
% \begin{macrocode} |
| 959 |
\let\enc@update\relax |
| 960 |
\else |
| 961 |
% \end{macrocode} |
| 962 |
% If current and new encoding differ we define the macro |
| 963 |
% |\enc@update| |
| 964 |
% to contain all updates necessary at |\selectfont| time. |
| 965 |
% \begin{macrocode} |
| 966 |
\let\enc@update\@@enc@update |
| 967 |
\fi |
| 968 |
\fi |
| 969 |
} |
| 970 |
% \end{macrocode} |
| 971 |
% \end{macro} |
| 972 |
% \end{macro} |
| 973 |
% |
| 974 |
% \begin{macro}{\@@enc@update} |
| 975 |
% \begin{macrocode} |
| 976 |
\def\@@enc@update{% |
| 977 |
% \end{macrocode} |
| 978 |
% When |\@@enc@update| is executed |\f@encoding| holds the encoding |
| 979 |
% name |
| 980 |
% for the new encoding and |\cf@encoding| the name of the last active |
| 981 |
% encoding. |
| 982 |
% |
| 983 |
% We start by setting the init command for encoding dependent |
| 984 |
% macros to |\@changed@cmd|. |
| 985 |
% \begin{macrocode} |
| 986 |
\expandafter |
| 987 |
\let |
| 988 |
\csname\cf@encoding -cmd\endcsname |
| 989 |
\@changed@cmd |
| 990 |
% \end{macrocode} |
| 991 |
% Then we turn the one for the new encoding to |\@current@cmd| (see |
| 992 |
% \texttt{ltoutenc.dtx} for further explanations). |
| 993 |
% \begin{macrocode} |
| 994 |
\expandafter |
| 995 |
\let |
| 996 |
\csname\f@encoding-cmd\endcsname |
| 997 |
\@current@cmd |
| 998 |
% \end{macrocode} |
| 999 |
% We execute the default settings |\default@T|, followed by the one |
| 1000 |
% for the new encoding. |
| 1001 |
% \begin{macrocode} |
| 1002 |
\default@T |
| 1003 |
\csname T@\f@encoding\endcsname |
| 1004 |
% \end{macrocode} |
| 1005 |
% Finally we change the default substitution values, disable |
| 1006 |
% |\enc@update| and make |\f@encoding| officially the current |
| 1007 |
% encoding. |
| 1008 |
% \begin{macrocode} |
| 1009 |
\csname D@\f@encoding\endcsname |
| 1010 |
\let\enc@update\relax |
| 1011 |
\let\cf@encoding\f@encoding |
| 1012 |
} |
| 1013 |
% \end{macrocode} |
| 1014 |
% \end{macro} |
| 1015 |
% |
| 1016 |
% |
| 1017 |
% \begin{macro}{\enc@update} |
| 1018 |
% \changes{v2.1m}{1994/05/14}{Macro added} |
| 1019 |
% The default action in |\selectfont| is to do nothing. |
| 1020 |
% \begin{macrocode} |
| 1021 |
\let\enc@update\relax |
| 1022 |
% \end{macrocode} |
| 1023 |
% \end{macro} |
| 1024 |
% |
| 1025 |
% \begin{macro}{\fontfamily} |
| 1026 |
% \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.} |
| 1027 |
% \begin{macro}{\f@family} |
| 1028 |
% \begin{macro}{\fontseries} |
| 1029 |
% \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.} |
| 1030 |
% \begin{macro}{\f@series} |
| 1031 |
% \begin{macro}{\fontshape} |
| 1032 |
% \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.} |
| 1033 |
% \changes{v2.1y}{1994/11/30}{Use \cs{@current@cmd} in |
| 1034 |
% \cs{@@enc@update}. ASAJ.} |
| 1035 |
% \begin{macro}{\f@shape} |
| 1036 |
% They are now all defined later (and differently). |
| 1037 |
% \begin{macrocode} |
| 1038 |
%\DeclareRobustCommand\fontfamily[1]{\edef\f@family{#1}} |
| 1039 |
%\DeclareRobustCommand\fontseries[1]{\edef\f@series{#1}} |
| 1040 |
%\DeclareRobustCommand\fontshape [1]{\edef\f@shape{#1}} |
| 1041 |
% \end{macrocode} |
| 1042 |
% \end{macro} |
| 1043 |
% \end{macro} |
| 1044 |
% \end{macro} |
| 1045 |
% \end{macro} |
| 1046 |
% \end{macro} |
| 1047 |
% \end{macro} |
| 1048 |
% |
| 1049 |
% |
| 1050 |
% |
| 1051 |
% \begin{macro}{\usefont} |
| 1052 |
% Some handy abbreviation if you want to get some particular font |
| 1053 |
% in the current size. If also the size should change one has to |
| 1054 |
% issue a |\fontsize| command first. |
| 1055 |
% |
| 1056 |
% \cs{fontencoding} needs to do some setup work so we call that, |
| 1057 |
% but instead of calling \cs{fontfamily}, \cs{fontseries} and |
| 1058 |
% \cs{fontshape} it earlier versions of this code did, we now set |
| 1059 |
% \cs{f@family}, etc.\ directly. If we would call \cs{fontseries} |
| 1060 |
% or \cs{fontshape} as it |
| 1061 |
% was done in the past, they would now interact with the existing |
| 1062 |
% series and shape which is not desired if we intend to use an |
| 1063 |
% explicit font shape! |
| 1064 |
% \changes{v3.2e}{2019/12/17}{Don't call \cs{fontseries} or \cs{fontshape}} |
| 1065 |
% \changes{v3.2h}{2020/12/10}{Drop ``m'' if the series value is a member |
| 1066 |
% of a fixed list and issue warning if doing it (gh/453)} |
| 1067 |
% \begin{macrocode} |
| 1068 |
%</2ekernel> |
| 1069 |
%<*2ekernel|latexrelease> |
| 1070 |
%<latexrelease>\IncludeInRelease{2021/06/01}% |
| 1071 |
%<latexrelease> {\usefont}{Force font face}% |
| 1072 |
\DeclareRobustCommand\usefont[4]{\fontencoding{#1}% |
| 1073 |
\edef\f@family{#2}% |
| 1074 |
\set@target@series{#3}% |
| 1075 |
\edef\f@shape{#4}% |
| 1076 |
% \end{macrocode} |
| 1077 |
% Any earlier \cs{fontseries}, etc.\ should be canceled and we |
| 1078 |
% should switch unconditionally to the requested font face so we |
| 1079 |
% drop any code that may have been stored in |
| 1080 |
% \cs{delayed@f@adjustment}. |
| 1081 |
% \changes{v3.2i}{2021/04/26}{Unconditionally switch to the requested |
| 1082 |
% font face (gh/444)} |
| 1083 |
% \begin{macrocode} |
| 1084 |
\let\delayed@f@adjustment\@empty |
| 1085 |
\selectfont |
| 1086 |
\ignorespaces} |
| 1087 |
%</2ekernel|latexrelease> |
| 1088 |
%<latexrelease>\EndIncludeInRelease |
| 1089 |
%<latexrelease>\IncludeInRelease{2020/02/02}% |
| 1090 |
%<latexrelease> {\usefont}{Drop m in usefont}% |
| 1091 |
%<latexrelease> |
| 1092 |
%<latexrelease>\DeclareRobustCommand\usefont[4]{\fontencoding{#1}% |
| 1093 |
%<latexrelease> \edef\f@family{#2}% |
| 1094 |
%<latexrelease> \set@target@series{#3}% |
| 1095 |
%<latexrelease> \edef\f@shape{#4}\selectfont |
| 1096 |
%<latexrelease> \ignorespaces} |
| 1097 |
%<latexrelease> |
| 1098 |
%<latexrelease>\EndIncludeInRelease |
| 1099 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1100 |
%<latexrelease> {\usefont}{Drop m in usefont}% |
| 1101 |
%<latexrelease> |
| 1102 |
%<latexrelease>\DeclareRobustCommand\usefont[4]{\fontencoding{#1}% |
| 1103 |
%<latexrelease> \edef\f@family{#2}% |
| 1104 |
%<latexrelease> \edef\f@series{#3}% |
| 1105 |
%<latexrelease> \edef\f@shape{#4}\selectfont |
| 1106 |
%<latexrelease> \ignorespaces} |
| 1107 |
%<latexrelease> |
| 1108 |
%<latexrelease>\EndIncludeInRelease |
| 1109 |
%<*2ekernel> |
| 1110 |
% \end{macrocode} |
| 1111 |
% \end{macro} |
| 1112 |
% |
| 1113 |
% |
| 1114 |
% \begin{macro}{\linespread} |
| 1115 |
% \changes{v2.1j}{1994/05/12}{New macro} |
| 1116 |
% \changes{v2.1p}{1994/05/16}{Remove surplus braces} |
| 1117 |
% The command |\linespread| changes the current |\baselinestretch| |
| 1118 |
% by calling |\set@fontsize|. The values for |\f@size| and |
| 1119 |
% |\f@baselineskip| will be left unchanged. |
| 1120 |
% \begin{macrocode} |
| 1121 |
\DeclareRobustCommand\linespread[1] |
| 1122 |
{\set@fontsize{#1}\f@size\f@baselineskip} |
| 1123 |
% \end{macrocode} |
| 1124 |
% \end{macro} |
| 1125 |
% |
| 1126 |
% |
| 1127 |
% \begin{macro}{\fontsize} |
| 1128 |
% \changes{v2.1j}{1994/05/12}{Redefined to use \cs{set@fontsize}} |
| 1129 |
% \changes{v2.1p}{1994/05/16}{Pass \cs{baselinstretch} not |
| 1130 |
% \cs{f@linespread}} |
| 1131 |
% We also define a macro that allows to specify a size. In this |
| 1132 |
% case, however, we also need the value of |\baselineskip|. As the |
| 1133 |
% first argument to |\set@fontsize| we pass the current value of |
| 1134 |
% |\baselinestretch|. This will either match the internal value (in |
| 1135 |
% which case nothing changes) or it will be an updated value due to |
| 1136 |
% a user change of that macro using |\renewcommand|. If we would |
| 1137 |
% pass the internal |\f@linespread| such a change would be |
| 1138 |
% effectively overwritten by a size change. |
| 1139 |
% \begin{macrocode} |
| 1140 |
\DeclareRobustCommand\fontsize[2] |
| 1141 |
{\set@fontsize\baselinestretch{#1}{#2}} |
| 1142 |
% \end{macrocode} |
| 1143 |
% \end{macro} |
| 1144 |
% |
| 1145 |
% |
| 1146 |
% \changes{v2.1n}{1994/05/14}{Set defaults for all \cs{f@...}} |
| 1147 |
% |
| 1148 |
% \begin{macro}{\f@linespread} |
| 1149 |
% \changes{v2.1j}{1994/05/12}{New macro} |
| 1150 |
% This macro holds the current internal value for |
| 1151 |
% |\baselinestretch|. |
| 1152 |
% \begin{macrocode} |
| 1153 |
\let\f@family\@empty |
| 1154 |
\let\f@series\@empty |
| 1155 |
\let\f@shape\@empty |
| 1156 |
\let\f@size\@empty |
| 1157 |
\let\f@baselineskip\@empty |
| 1158 |
\let\f@linespread\@empty |
| 1159 |
% \end{macrocode} |
| 1160 |
% \end{macro} |
| 1161 |
% |
| 1162 |
% \begin{macro}{\cf@encoding} |
| 1163 |
% \changes{v2.1u}{1994/11/06}{New macro} |
| 1164 |
% \begin{macrocode} |
| 1165 |
\let\f@encoding\@empty |
| 1166 |
\let\cf@encoding\@empty |
| 1167 |
% \end{macrocode} |
| 1168 |
% \end{macro} |
| 1169 |
% |
| 1170 |
% |
| 1171 |
% |
| 1172 |
% \begin{macro}{\@defaultunits} |
| 1173 |
% |
| 1174 |
% The function |\@defaultunits| when wrapped around a dimen or skip |
| 1175 |
% assignment supplies default units. Usage: |
| 1176 |
% |
| 1177 |
% |\@defaultunits\dimen@=#1pt\relax\@nnil| |
| 1178 |
% |
| 1179 |
% Note: the |\relax| is *important*. Other units can be substituted |
| 1180 |
% for the `pt' if desired. |
| 1181 |
% |
| 1182 |
% We use |\remove@to@nnil| as an auxiliary macros for |
| 1183 |
% |\@defaultunits|. It just has to gobble the supplied default unit |
| 1184 |
% `pt' or whatever, if it wasn't used in the assignment. |
| 1185 |
% \begin{macrocode} |
| 1186 |
\def\@defaultunits{\afterassignment\remove@to@nnil} |
| 1187 |
% \end{macrocode} |
| 1188 |
% \end{macro} |
| 1189 |
% |
| 1190 |
% \begin{macro}{\strip@pt} |
| 1191 |
% \begin{macro}{\rem@pt} |
| 1192 |
% This macro strips the characters |pt| produced by using |\the| |
| 1193 |
% on a dimen register. |
| 1194 |
% \begin{macrocode} |
| 1195 |
\begingroup |
| 1196 |
\catcode`P=12 |
| 1197 |
\catcode`T=12 |
| 1198 |
\lowercase{ |
| 1199 |
\def\x{\def\rem@pt##1.##2PT{##1\ifnum##2>\z@.##2\fi}}} |
| 1200 |
\expandafter\endgroup\x |
| 1201 |
\def\strip@pt{\expandafter\rem@pt\the} |
| 1202 |
% \end{macrocode} |
| 1203 |
% \end{macro} |
| 1204 |
% \end{macro} |
| 1205 |
% |
| 1206 |
% |
| 1207 |
% \begin{macro}{\mathversion} |
| 1208 |
% \changes{v1.0h}{1989/04/29}{Test if version defined added.} |
| 1209 |
% \changes{v1.0m}{1989/09/14} |
| 1210 |
% {Corrected typo: \cs{endscname} to \cs{endcsname}.} |
| 1211 |
% \changes{v2.1j}{1994/05/12}{Use \cs{DeclareRobustCommand}.} |
| 1212 |
% \begin{macro}{\math@version} |
| 1213 |
% |\mathversion| takes the math \emph{version} name as |
| 1214 |
% argument, defines |\math@version| appropriately and switches |
| 1215 |
% to the font selected |
| 1216 |
% forcing a call to |\glb@settings| if the \emph{version} is |
| 1217 |
% known to the system. |
| 1218 |
% \changes{v1.0p}{1989/11/14}{Math version prefix `mv@' added.} |
| 1219 |
% \changes{v1.0r}{1989/11/22} |
| 1220 |
% {\cs{def} $\to$ \cs{edef} for \cs{math@version}.} |
| 1221 |
% \changes{v1.2g}{1990/02/16}{\cs{@nomath} added.} |
| 1222 |
% \changes{v2.1a}{1994/01/17}{New math font setup} |
| 1223 |
% \changes{v3.2l}{2023/04/01}{Reset frozen mathversion gh/1028} |
| 1224 |
% \changes{v3.2o}{2024/11/30}{New appoach to |
| 1225 |
% \texttt{localmathalphabets} (gh/1101)} |
| 1226 |
% \begin{macrocode} |
| 1227 |
\DeclareRobustCommand\mathversion[1] |
| 1228 |
{\@nomath\mathversion |
| 1229 |
\expandafter\ifx\csname mv@#1\endcsname\relax |
| 1230 |
\@latex@error{Math version `#1' is not defined}\@eha\else |
| 1231 |
% \end{macrocode} |
| 1232 |
% If there has been a frozen math version reset unconditionally to |
| 1233 |
% it if we are at \cs{@math@level} one, so that in the typical case |
| 1234 |
% of one bold symbol within the normal version this doesn't |
| 1235 |
% allocate an additional math alphabet. |
| 1236 |
% If the nesting is deeper we do nothing, which means |
| 1237 |
% alphabet allocations accumulate until the end of the formula. One |
| 1238 |
% could do slightly better but that would mean keeping track of the |
| 1239 |
% allocations on all levels severately and this is likely to be |
| 1240 |
% overkill in nearly all situations. |
| 1241 |
% \begin{macrocode} |
| 1242 |
\ifcsname mv@#1@frozen\endcsname |
| 1243 |
\ifnum \@math@level = \@ne |
| 1244 |
\unconditionally@reset@math@version {#1}% |
| 1245 |
\fi |
| 1246 |
\fi |
| 1247 |
% \end{macrocode} |
| 1248 |
% \begin{macrocode} |
| 1249 |
\edef\math@version{#1}% |
| 1250 |
% \end{macrocode} |
| 1251 |
% We need to force a math font setup both now and at the point |
| 1252 |
% where we return to the previous math version. |
| 1253 |
% Forcing a math font setup can simply be done by setting |
| 1254 |
% |\glb@currsize| to an invalid value since this will trigger the |
| 1255 |
% setup when the formula starts. |
| 1256 |
% \begin{macrocode} |
| 1257 |
\gdef\glb@currsize{}% |
| 1258 |
% \end{macrocode} |
| 1259 |
% When the scope of the current |\mathversion| ends we need to |
| 1260 |
% restore the old setup. However this time we need to force it |
| 1261 |
% directly at least if we are inside math, otherwise we could wait. |
| 1262 |
% Another way to enhance this code here is todo the setting only if |
| 1263 |
% the version really has changed after all. This might be |
| 1264 |
% interesting in case of \texttt{amstext} and \texttt{boldsymbol}. |
| 1265 |
% \changes{v2.1b}{1994/01/25}{Corrections for math setup} |
| 1266 |
% \begin{macrocode} |
| 1267 |
\aftergroup\glb@settings |
| 1268 |
\fi} |
| 1269 |
% \end{macrocode} |
| 1270 |
% |
| 1271 |
% Reseting the math version unconditionally means that we have to |
| 1272 |
% copy the frozen version to \verb=\mv@#1= and also reset the |
| 1273 |
% counter \verb=\c@mv@#1= to the number of math alphabets allocated |
| 1274 |
% in the frozen version. |
| 1275 |
% \changes{v3.2o}{2024/11/30}{New appoach to |
| 1276 |
% \texttt{localmathalphabets} (gh/1101)} |
| 1277 |
% \begin{macrocode} |
| 1278 |
\ExplSyntaxOn |
| 1279 |
\cs_new_protected:Npn \unconditionally@reset@math@version #1 { |
| 1280 |
\cs_gset_eq:cc { mv@#1 }{ mv@#1@frozen } |
| 1281 |
\int_gset:cn { c@mv@#1 }{ \tl_use:c {g__nfss_frozen_mv_ #1 _tl} } |
| 1282 |
} |
| 1283 |
\ExplSyntaxOff |
| 1284 |
% \end{macrocode} |
| 1285 |
% \end{macro} |
| 1286 |
% \end{macro} |
| 1287 |
% |
| 1288 |
% |
| 1289 |
% If \TeX{} would support a hook just before the end of a formula |
| 1290 |
% (opposite of |\everymath| so to speak) the implementation of the |
| 1291 |
% algorithm would be much simpler because in that case we would set up |
| 1292 |
% the correct math fonts at this point without having to worry about |
| 1293 |
% incorrect settings due to nesting. The same would be true if in |
| 1294 |
% \LaTeX{} the use of |$| (as the primitive \TeX{} command) would be |
| 1295 |
% impossible and instead only a higher-level interface would be |
| 1296 |
% available. Note that this does not mean that a |$| couldn't be the |
| 1297 |
% short-hand for starting and stopping that higher-level interface, it |
| 1298 |
% only means that the direct \TeX{} function must be hidden. |
| 1299 |
% |
| 1300 |
% Anyway, since we don't have this and won't have it in \LaTeXe{} we |
| 1301 |
% need to implement it in a somewhat slower way. |
| 1302 |
% |
| 1303 |
% |
| 1304 |
% We test for the current math font setup on entry of a formula, |
| 1305 |
% i.e., on the |
| 1306 |
% hooks |\everymath| and |\everydisplay|. But since these hooks may |
| 1307 |
% contain user data we provide ourselves with an internal version of |
| 1308 |
% these hooks which stays frozen. |
| 1309 |
% |
| 1310 |
% |
| 1311 |
% \begin{macro}{\frozen@everymath} |
| 1312 |
% \changes{v2.1a}{1994/01/17}{New math font setup} |
| 1313 |
% \begin{macro}{\frozen@everydisplay} |
| 1314 |
% New internal names for |\everymath| and |\everydisplay|. |
| 1315 |
% \begin{macrocode} |
| 1316 |
\let\frozen@everymath\everymath |
| 1317 |
\let\frozen@everydisplay\everydisplay |
| 1318 |
% \end{macrocode} |
| 1319 |
% \end{macro} |
| 1320 |
% \end{macro} |
| 1321 |
% |
| 1322 |
% \begin{macro}{\everymath} |
| 1323 |
% \changes{v2.1a}{1994/01/17}{New math font setup} |
| 1324 |
% \begin{macro}{\everydisplay} |
| 1325 |
% \changes{v2.1a}{1994/01/17}{New math font setup} |
| 1326 |
% Now we provide now user hooks that will be called in the |
| 1327 |
% frozen internals. |
| 1328 |
% \begin{macrocode} |
| 1329 |
\newtoks\everymath |
| 1330 |
\newtoks\everydisplay |
| 1331 |
% \end{macrocode} |
| 1332 |
% \end{macro} |
| 1333 |
% \end{macro} |
| 1334 |
% |
| 1335 |
% |
| 1336 |
% |
| 1337 |
|
| 1338 |
% \begin{macro}{\@math@level} |
| 1339 |
% This counter records the nesting level of math within math. |
| 1340 |
% \changes{v3.2o}{2024/11/30}{New appoach to |
| 1341 |
% \texttt{localmathalphabets} (gh/1101)} |
| 1342 |
% \begin{macrocode} |
| 1343 |
\newcount\@math@level |
| 1344 |
% \end{macrocode} |
| 1345 |
% \end{macro} |
| 1346 |
% |
| 1347 |
% \begin{macro}{\frozen@everydisplay} |
| 1348 |
% \changes{v2.1a}{1994/01/17}{New math font setup} |
| 1349 |
% Now we define the behaviour of the frozen hooks: first |
| 1350 |
% check the math setup then call the user hook. |
| 1351 |
% |
| 1352 |
% The check code may push tokens after the math formula with |
| 1353 |
% \cs{aftergroup} and they would prevent a \verb=$$= from dropping |
| 1354 |
% following spaces. We therefore use a switch to be set as the |
| 1355 |
% first thing after the group so that following code can determine |
| 1356 |
% if there was a display or some inline math (in the latter case |
| 1357 |
% we better not drop spaces). |
| 1358 |
% After setting the switch we also have to place \cs{ignorespaces} |
| 1359 |
% because setting the switch may be the only thing that happens |
| 1360 |
% after the display. |
| 1361 |
% \changes{v3.2k}{2022/07/04}{Ignore spaces if necessary (gh/886)} |
| 1362 |
% The issue with handling of spaces was found in 2022, but it is |
| 1363 |
% really a bug fix for the code added in 2021/11. |
| 1364 |
% \changes{v3.2o}{2024/11/30}{New appoach to |
| 1365 |
% \texttt{localmathalphabets} (gh/1101)} |
| 1366 |
% \begin{macrocode} |
| 1367 |
%</2ekernel> |
| 1368 |
%<latexrelease>\IncludeInRelease{2021/11/15} |
| 1369 |
%<latexrelease> {\frozen@everydisplay}{Handle spaces after math}% |
| 1370 |
%<*2ekernel|latexrelease> |
| 1371 |
\frozen@everydisplay = {% |
| 1372 |
\aftergroup\@ignoretrue \aftergroup\ignorespaces |
| 1373 |
% \end{macrocode} |
| 1374 |
% Record that we entered another math level. |
| 1375 |
% \changes{v3.2o}{2024/11/30}{New appoach to |
| 1376 |
% \texttt{localmathalphabets} (gh/1101)} |
| 1377 |
% \begin{macrocode} |
| 1378 |
\advance\@math@level\@ne |
| 1379 |
\check@mathfonts |
| 1380 |
\the\everydisplay} |
| 1381 |
% \end{macrocode} |
| 1382 |
% \end{macro} |
| 1383 |
% |
| 1384 |
|
| 1385 |
|
| 1386 |
% \begin{macro}{\frozen@everymath} |
| 1387 |
% \changes{v2.1a}{1994/01/17}{New math font setup} |
| 1388 |
% \changes{v3.2k}{2022/07/04}{Ignore spaces if necessary (gh/886)} |
| 1389 |
% The frozen code for inline math is similar, except that here we |
| 1390 |
% do not want to drop following spaces. |
| 1391 |
% \begin{macrocode} |
| 1392 |
\frozen@everymath = {% |
| 1393 |
\aftergroup\@ignorefalse |
| 1394 |
% \end{macrocode} |
| 1395 |
% Record that we entered another math level. |
| 1396 |
% \changes{v3.2o}{2024/11/30}{New appoach to |
| 1397 |
% \texttt{localmathalphabets} (gh/1101)} |
| 1398 |
% \begin{macrocode} |
| 1399 |
\advance\@math@level\@ne |
| 1400 |
\check@mathfonts |
| 1401 |
\the\everymath} |
| 1402 |
% \end{macrocode} |
| 1403 |
% \end{macro} |
| 1404 |
% |
| 1405 |
% \begin{macrocode} |
| 1406 |
%</2ekernel|latexrelease> |
| 1407 |
%<latexrelease>\EndIncludeInRelease |
| 1408 |
%<latexrelease>\IncludeInRelease{2020/10/01} |
| 1409 |
%<latexrelease> {\frozen@everydisplay}{Handle spaces after math}% |
| 1410 |
%<latexrelease> |
| 1411 |
%<latexrelease>\frozen@everydisplay = {\check@mathfonts |
| 1412 |
%<latexrelease> \the\everydisplay} |
| 1413 |
%<latexrelease>\frozen@everymath = {\check@mathfonts |
| 1414 |
%<latexrelease> \the\everymath} |
| 1415 |
%<latexrelease> |
| 1416 |
%<latexrelease>\EndIncludeInRelease |
| 1417 |
%<*2ekernel> |
| 1418 |
% \end{macrocode} |
| 1419 |
% |
| 1420 |
% |
| 1421 |
% |
| 1422 |
% |
| 1423 |
% |
| 1424 |
% |
| 1425 |
% \changes{v3.0q}{1996/07/27}{\cs{if@inmath} switch removed} |
| 1426 |
% |
| 1427 |
% \begin{macro}{\curr@math@size} |
| 1428 |
% \changes{v2.1a}{1994/01/17}{New math font setup} |
| 1429 |
% This holds locally the current math size. |
| 1430 |
% \begin{macrocode} |
| 1431 |
\let\curr@math@size\@empty |
| 1432 |
% \end{macrocode} |
| 1433 |
% \end{macro} |
| 1434 |
% |
| 1435 |
% |
| 1436 |
% |
| 1437 |
% |
| 1438 |
% \subsection{Macros for loading fonts} |
| 1439 |
% |
| 1440 |
% \begin{macro}{\pickup@font} |
| 1441 |
% The macro |\pickup@font| which is used in |
| 1442 |
% |\selectfont| is very simple: |
| 1443 |
% if the font name is undefined (i.e.\ not known yet) it calls |
| 1444 |
% |\define@newfont| to load it. |
| 1445 |
% \begin{macrocode} |
| 1446 |
\def\pickup@font{% |
| 1447 |
\expandafter \ifx \font@name \relax |
| 1448 |
\define@newfont |
| 1449 |
\fi} |
| 1450 |
% \end{macrocode} |
| 1451 |
% \end{macro} |
| 1452 |
% |
| 1453 |
% \begin{macro}{\split@name} |
| 1454 |
% |\pickup@font| assumes that |\font@name| is set |
| 1455 |
% but it is sometimes called when |\f@family|, |\f@series|, |
| 1456 |
% |\f@shape|, or |\f@size| may have the wrong settings |
| 1457 |
% (see, e.g., the definition of |\getanddefine@fonts|). |
| 1458 |
% Therefore we need a macro to extract font \emph{family}, |
| 1459 |
% \emph{series}, \emph{shape}, and \emph{size} from the font name. |
| 1460 |
% To this end we define |\split@name| which takes the font |
| 1461 |
% name as a list of characters of |\catcode| 12 (without the |
| 1462 |
% backslash at the beginning) delimited by the |
| 1463 |
% special control sequence |\@nil|. |
| 1464 |
% This is not very complicated: we first ensure that |/| has |
| 1465 |
% the right |\catcode| |
| 1466 |
% \begin{macrocode} |
| 1467 |
{\catcode`\/=12 |
| 1468 |
% \end{macrocode} |
| 1469 |
% and define |\split@name| so that it will define our |
| 1470 |
% private |\f@encoding|, |\f@family|, |\f@series|, |\f@shape|, |
| 1471 |
% and |\f@size| macros. |
| 1472 |
% \changes{v1.9a}{1992/07/26}{Added splitting into \cs{f@encoding}.} |
| 1473 |
% \begin{macrocode} |
| 1474 |
\gdef\split@name#1/#2/#3/#4/#5\@nil{\def\f@encoding{#1}% |
| 1475 |
\def\f@family{#2}% |
| 1476 |
\def\f@series{#3}% |
| 1477 |
\def\f@shape{#4}% |
| 1478 |
\def\f@size{#5}}} |
| 1479 |
% \end{macrocode} |
| 1480 |
% \end{macro} |
| 1481 |
% |
| 1482 |
% |
| 1483 |
% \begin{macro}{\curr@fontshape} |
| 1484 |
% Abbreviation which may get removed again for speed. |
| 1485 |
% \changes{v1.9a}{1992/07/26}{} |
| 1486 |
% \begin{macrocode} |
| 1487 |
\def\curr@fontshape{\f@encoding/\f@family/\f@series/\f@shape} |
| 1488 |
% \end{macrocode} |
| 1489 |
% \end{macro} |
| 1490 |
% |
| 1491 |
% \begin{macro}{\define@newfont} |
| 1492 |
% Now we can tackle the problem of defining a new font. |
| 1493 |
% \changes{v1.9a}{1992/07/26}{} |
| 1494 |
% \begin{macrocode} |
| 1495 |
\def\define@newfont{% |
| 1496 |
% \end{macrocode} |
| 1497 |
% We have already mentioned that the \textsf{token} list that |
| 1498 |
% |\split@name| will get as argument must not start with |
| 1499 |
% a backslash. |
| 1500 |
% To reach this goal we will set the |\escapechar| to $-1$ so |
| 1501 |
% that the |\string| primitive will not generate an |
| 1502 |
% escape character. |
| 1503 |
% To keep this change local we open a group. We use |
| 1504 |
% |\begingroup| for this purpose since |\define@newfont| |
| 1505 |
% might be called in math mode, and an empty |
| 1506 |
% |\bgroup|\ldots|\egroup| would add an empty Ord atom |
| 1507 |
% to the math list and thus affect the spacing. |
| 1508 |
% |
| 1509 |
% Also locally redefine |\typeout| so that `No file ...fd' |
| 1510 |
% Warnings become Font Info message just sent to the log file. |
| 1511 |
% \changes{v1.0q}{1989/11/19}{Group added.} |
| 1512 |
% \changes{v3.0m}{1995/11/17}{Redefine \cs{typeout} latex/1676} |
| 1513 |
% \begin{macrocode} |
| 1514 |
\begingroup |
| 1515 |
\let\typeout\@font@info |
| 1516 |
\escapechar\m@ne |
| 1517 |
% \end{macrocode} |
| 1518 |
% Then we extract \emph{encoding scheme}, \emph{family}, |
| 1519 |
% \emph{series}, \emph{shape}, |
| 1520 |
% and \emph{size} from the font name. |
| 1521 |
% Note the four |\expandafter|'s so that |\font@name| is |
| 1522 |
% expanded first, then |\string|, and finally |
| 1523 |
% |\split@name|. |
| 1524 |
% \begin{macrocode} |
| 1525 |
\expandafter\expandafter\expandafter |
| 1526 |
\split@name\expandafter\string\font@name\@nil |
| 1527 |
% \end{macrocode} |
| 1528 |
% If the |\curr@fontshape| combination is not available, |
| 1529 |
% (i.e.\ undefined) we call the macro |\wrong@fontshape| to take |
| 1530 |
% care of this case. Otherwise |\extract@font| |
| 1531 |
% will load the external font for us. |
| 1532 |
% \changes{v1.2f}{1990/01/28}{Added call to \cs{curr@fontshape} macro |
| 1533 |
% to allow substitution.} |
| 1534 |
% \begin{macrocode} |
| 1535 |
% \expandafter\ifx |
| 1536 |
% \csname\curr@fontshape\endcsname \relax |
| 1537 |
\try@load@fontshape % try always |
| 1538 |
% \fi |
| 1539 |
\expandafter\ifx |
| 1540 |
\csname\curr@fontshape\endcsname \relax |
| 1541 |
\wrong@fontshape\else |
| 1542 |
% \end{macrocode} |
| 1543 |
% To allow substitution we call the |curr@fontshape| macro |
| 1544 |
% which usually will expand to |\relax| but may hold code for |
| 1545 |
% substitution (see |\subst@fontshape| definition). |
| 1546 |
% \begin{macrocode} |
| 1547 |
% \csname\curr@fontshape\endcsname |
| 1548 |
\extract@font\fi |
| 1549 |
% \end{macrocode} |
| 1550 |
% We are nearly finished and must only restore the |
| 1551 |
% |\escapechar| by closing the group. |
| 1552 |
% \begin{macrocode} |
| 1553 |
\endgroup} |
| 1554 |
% \end{macrocode} |
| 1555 |
% |
| 1556 |
% |
| 1557 |
% \changes{v3.2b}{2019/02/07}{Changed wording of warning (github/107)} |
| 1558 |
% \begin{macrocode} |
| 1559 |
\def\try@load@fontshape{% |
| 1560 |
\expandafter |
| 1561 |
\ifx\csname \f@encoding+\f@family\endcsname\relax |
| 1562 |
\@font@info{Trying to load font information for |
| 1563 |
\f@encoding+\f@family}% |
| 1564 |
% \end{macrocode} |
| 1565 |
% We predefine this combination to be |\@empty| which means that |
| 1566 |
% next time we don't try again unnecessary in case we don't find a |
| 1567 |
% |.fd| file. If the file contains a |\DeclareFontFamily| command |
| 1568 |
% than this setting will be overwritten. |
| 1569 |
% \changes{v2.1e}{1994/02/24} |
| 1570 |
% {Separate restoration of catcodes for fd cmds} |
| 1571 |
% \changes{v2.1l}{1994/05/13}{Use \cs{@input@} for fd files} |
| 1572 |
% \begin{macrocode} |
| 1573 |
\global\expandafter\let |
| 1574 |
\csname\f@encoding+\f@family\endcsname\@empty |
| 1575 |
% \end{macrocode} |
| 1576 |
% Set the catcodes used in the syntax, but do it only once (this |
| 1577 |
% will be restored at the end of the font loading group). |
| 1578 |
% \changes{v3.0t}{1997/10/21}{Move \cs{makeatletter} to |
| 1579 |
% \cs{nfss@catcodes}.} |
| 1580 |
% \begin{macrocode} |
| 1581 |
\nfss@catcodes |
| 1582 |
\let\nfss@catcodes\relax |
| 1583 |
% \end{macrocode} |
| 1584 |
% |
| 1585 |
% \changes{v3.0s}{1996/11/18} |
| 1586 |
% {(DPC) lowercase fd file names. internal/1044} |
| 1587 |
% For increased portability make the external filename |
| 1588 |
% monocase, but look for the (old style) mixed case |
| 1589 |
% filename if the first attempt fails. |
| 1590 |
% |
| 1591 |
% On any monocase system this means that the file is looked for twice |
| 1592 |
% which takes up time and string space, but at least for this release |
| 1593 |
% Check for both names to give people time to re-install their private |
| 1594 |
% fd files with lowercase names. |
| 1595 |
% \begin{macrocode} |
| 1596 |
\edef\reserved@a{% |
| 1597 |
\lowercase{% |
| 1598 |
\noexpand\InputIfFileExists{\f@encoding\[email protected]}}}% |
| 1599 |
\reserved@a\relax |
| 1600 |
{\@input@{\f@encoding\[email protected]}}% |
| 1601 |
\fi} |
| 1602 |
% \end{macrocode} |
| 1603 |
% \end{macro} |
| 1604 |
% |
| 1605 |
% |
| 1606 |
% \begin{macro}{\nfss@catcodes} |
| 1607 |
% \changes{v2.1e}{1994/02/24} |
| 1608 |
% {Separate restoration of catcodes for fd cmds} |
| 1609 |
% This macro should contain the standard |\catcode| assignments to |
| 1610 |
% all characters which are used in the commands found in an |
| 1611 |
% \texttt{.fd} file and which might have special |\catcode|s in the |
| 1612 |
% middle of a document. If necessary, this list can be extended in |
| 1613 |
% a package file using a suitable number of |\expandafter|, i.e., |
| 1614 |
%\begin{verbatim} |
| 1615 |
% \expandafter\def\expandafter\nfss@catcodes |
| 1616 |
% \expandafter{\nfss@catcodes <additional settings>} |
| 1617 |
%\end{verbatim} |
| 1618 |
% Note, that this macro might get executed several times since it |
| 1619 |
% is also called by |\DeclareFontShape|, thus it probably should |
| 1620 |
% not be misused as a general purpose hook. |
| 1621 |
% \begin{macrocode} |
| 1622 |
\def\nfss@catcodes{% |
| 1623 |
% \end{macrocode} |
| 1624 |
% We start by making |@| a letter and ignoring all blanks and newlines. |
| 1625 |
% \changes{v2.1z}{1994/12/06}{Added tab char as well} |
| 1626 |
% \changes{v3.0p}{1996/07/26}{omit \cs{relax} as not needed} |
| 1627 |
% \changes{v3.0t}{1997/10/21}{Moved \cs{makeatletter} from |
| 1628 |
% \cs{try@load@font@shape}.} |
| 1629 |
% \begin{macrocode} |
| 1630 |
\makeatletter |
| 1631 |
\catcode`\ 9% |
| 1632 |
\catcode`\^^I9% |
| 1633 |
\catcode`\^^M9% |
| 1634 |
% \end{macrocode} |
| 1635 |
% Then we set up |\|, |{|, |}|, |#| and |%| in case an \texttt{.fd} |
| 1636 |
% file is loaded during a verbatim environment. |
| 1637 |
% \changes{v3.0n}{1995/11/27}{Reset hash, for definitions in fd files} |
| 1638 |
% \changes{v3.00}{1995/12/06}{Reset hat, for typeouts etc in fd files} |
| 1639 |
% \begin{macrocode} |
| 1640 |
\catcode`\\\z@ |
| 1641 |
\catcode`\{\@ne |
| 1642 |
\catcode`\}\tw@ |
| 1643 |
\catcode`\#6% |
| 1644 |
\catcode`\^7% |
| 1645 |
\catcode`\%14% |
| 1646 |
% \end{macrocode} |
| 1647 |
% The we make sure that the important syntax parts have the right |
| 1648 |
% |\catcode|. |
| 1649 |
% \changes{v2.1s}{1994/09/16}{Reset [ and ] as well, just in case} |
| 1650 |
% \changes{v3.0r}{1996/08/25}{Reset the acute, grave and double quote |
| 1651 |
% chars as well} |
| 1652 |
% \begin{macrocode} |
| 1653 |
\@makeother\<% |
| 1654 |
\@makeother\>% |
| 1655 |
\@makeother\*% |
| 1656 |
\@makeother\.% |
| 1657 |
\@makeother\-% |
| 1658 |
\@makeother\/% |
| 1659 |
\@makeother\[% |
| 1660 |
\@makeother\]% |
| 1661 |
\@makeother\`% |
| 1662 |
\@makeother\'% |
| 1663 |
\@makeother\"% |
| 1664 |
} |
| 1665 |
% \end{macrocode} |
| 1666 |
% \end{macro} |
| 1667 |
% |
| 1668 |
% |
| 1669 |
% |
| 1670 |
% \begin{macro}{\LoadFontDefinitionFile} |
| 1671 |
% Load and \texttt{.fd} files for some encoding and family (if it exists). |
| 1672 |
% \begin{macrocode} |
| 1673 |
%</2ekernel> |
| 1674 |
%<*2ekernel|latexrelease> |
| 1675 |
%<latexrelease>\IncludeInRelease{2020/02/02}% |
| 1676 |
%<latexrelease> {\LoadFontDefinitionFile}{Loading .fd files}% |
| 1677 |
\def\LoadFontDefinitionFile#1#2{% |
| 1678 |
\begingroup |
| 1679 |
\edef\f@encoding{#1}% |
| 1680 |
\edef\f@family{#2}% |
| 1681 |
\try@load@fontshape |
| 1682 |
\endgroup |
| 1683 |
} |
| 1684 |
%</2ekernel|latexrelease> |
| 1685 |
%<latexrelease>\EndIncludeInRelease |
| 1686 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1687 |
%<latexrelease> {\LoadFontDefinitionFile}{Loading .fd files}% |
| 1688 |
%<latexrelease> |
| 1689 |
%<latexrelease>\let\LoadFontDefinitionFile\@undefined |
| 1690 |
%<latexrelease>\EndIncludeInRelease |
| 1691 |
%<*2ekernel> |
| 1692 |
% \end{macrocode} |
| 1693 |
% \end{macro} |
| 1694 |
% |
| 1695 |
% |
| 1696 |
% |
| 1697 |
|
| 1698 |
% \begin{macro}{\DeclareFontFamilySubstitution} |
| 1699 |
% The idea for this macro is stolen from the \texttt{substitutefont} |
| 1700 |
% package by Günter Milde, with some modifications and a new name. |
| 1701 |
% |
| 1702 |
% Its purpose is to provide characters in a special encoding that |
| 1703 |
% are not available in the current font family to be taken from a |
| 1704 |
% different family that is visually compatible (or not if you |
| 1705 |
% choose badly). For example, you can match the GFS Didot Greek |
| 1706 |
% characters with \TeX{} Gyre Pagella (Palatino) by specifying |
| 1707 |
%\begin{verbatim} |
| 1708 |
% \DeclareFontFamilySubstitution{LGR}{qpl}{udidot} |
| 1709 |
%\end{verbatim} |
| 1710 |
% This way if you ask for the \texttt{LGR} encoding in for the |
| 1711 |
% \texttt{qpl} family you get the characters from the |
| 1712 |
% \texttt{udidot} family substituted. |
| 1713 |
% |
| 1714 |
% We need to ensure that the macro is defined with |
| 1715 |
% \cs{nfss@catcodes} in force (not quite sure why at the moment to |
| 1716 |
% be honest). |
| 1717 |
% \begin{macrocode} |
| 1718 |
%</2ekernel> |
| 1719 |
%<*2ekernel|latexrelease> |
| 1720 |
%<latexrelease>\IncludeInRelease{2020/02/02}% |
| 1721 |
%<latexrelease> {\DeclareFontFamilySubstitution}{Provide family substitution}% |
| 1722 |
\begingroup |
| 1723 |
\nfss@catcodes |
| 1724 |
\gdef\DeclareFontFamilySubstitution#1#2#3{% |
| 1725 |
% \end{macrocode} |
| 1726 |
% We only provide a set of silent substitutions. The package also |
| 1727 |
% (re)declared the family, but this is incorrect in my eyes and it |
| 1728 |
% is better to handle that differently. |
| 1729 |
% |
| 1730 |
% Of course the families may still need loading at |
| 1731 |
% this point and so we arrange for this. Otherwise we might run into |
| 1732 |
% trouble because the necessary \cs{DeclareFontFamily} has not been |
| 1733 |
% seen. |
| 1734 |
% \begin{macrocode} |
| 1735 |
\LoadFontDefinitionFile{#1}{#2}% |
| 1736 |
\LoadFontDefinitionFile{#1}{#3}% |
| 1737 |
% \end{macrocode} |
| 1738 |
% |
| 1739 |
% \begin{macrocode} |
| 1740 |
\DeclareFontShape{#1}{#2}{m}{it}{<->ssub * #3/m/it}{}% |
| 1741 |
\DeclareFontShape{#1}{#2}{m}{n}{<->ssub * #3/m/n}{}% |
| 1742 |
\DeclareFontShape{#1}{#2}{m}{sc}{<->ssub * #3/m/sc}{}% |
| 1743 |
\DeclareFontShape{#1}{#2}{m}{sl}{<->ssub * #3/m/sl}{}% |
| 1744 |
% \end{macrocode} |
| 1745 |
% These days a few more shapes might be around, so we declare those |
| 1746 |
% too. If they don't exist then after the first substitution normal |
| 1747 |
% fallbacks will happen. |
| 1748 |
% \begin{macrocode} |
| 1749 |
\DeclareFontShape{#1}{#2}{m}{sw}{<->ssub * #3/m/sw}{}% |
| 1750 |
\DeclareFontShape{#1}{#2}{m}{scit}{<->ssub * #3/m/scit}{}% |
| 1751 |
\DeclareFontShape{#1}{#2}{m}{scsl}{<->ssub * #3/m/scsl}{}% |
| 1752 |
% \end{macrocode} |
| 1753 |
% Same game with \texttt{b} and \texttt{bx}, for other weights you |
| 1754 |
% are on your own: |
| 1755 |
% \begin{macrocode} |
| 1756 |
\DeclareFontShape{#1}{#2}{b}{it}{<->ssub * #3/b/it}{}% |
| 1757 |
\DeclareFontShape{#1}{#2}{b}{n}{<->ssub * #3/b/n}{}% |
| 1758 |
\DeclareFontShape{#1}{#2}{b}{scit}{<->ssub * #3/b/scit}{}% |
| 1759 |
\DeclareFontShape{#1}{#2}{b}{scsl}{<->ssub * #3/b/scsl}{}% |
| 1760 |
\DeclareFontShape{#1}{#2}{b}{sc}{<->ssub * #3/b/sc}{}% |
| 1761 |
\DeclareFontShape{#1}{#2}{b}{sl}{<->ssub * #3/b/sl}{}% |
| 1762 |
\DeclareFontShape{#1}{#2}{b}{sw}{<->ssub * #3/b/sw}{}% |
| 1763 |
\DeclareFontShape{#1}{#2}{bx}{it}{<->ssub * #3/bx/it}{}% |
| 1764 |
\DeclareFontShape{#1}{#2}{bx}{n}{<->ssub * #3/bx/n}{}% |
| 1765 |
\DeclareFontShape{#1}{#2}{bx}{scit}{<->ssub * #3/bx/scit}{}% |
| 1766 |
\DeclareFontShape{#1}{#2}{bx}{scsl}{<->ssub * #3/bx/scsl}{}% |
| 1767 |
\DeclareFontShape{#1}{#2}{bx}{sc}{<->ssub * #3/bx/sc}{}% |
| 1768 |
\DeclareFontShape{#1}{#2}{bx}{sl}{<->ssub * #3/bx/sl}{}% |
| 1769 |
\DeclareFontShape{#1}{#2}{bx}{sw}{<->ssub * #3/bx/sw}{}% |
| 1770 |
} |
| 1771 |
\endgroup |
| 1772 |
%</2ekernel|latexrelease> |
| 1773 |
%<latexrelease>\EndIncludeInRelease |
| 1774 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1775 |
%<latexrelease> {\DeclareFontFamilySubstitution}{Provide family substitution}% |
| 1776 |
%<latexrelease> |
| 1777 |
%<latexrelease>\let\DeclareFontFamilySubstitution\@undefined |
| 1778 |
%<latexrelease>\EndIncludeInRelease |
| 1779 |
%<*2ekernel> |
| 1780 |
% \end{macrocode} |
| 1781 |
% \end{macro} |
| 1782 |
% |
| 1783 |
% |
| 1784 |
% |
| 1785 |
% \begin{macro}{\DeclareErrorFont} |
| 1786 |
% Declare the last resort shape! We assume that in this fontshape |
| 1787 |
% there is a 10pt font but it doesn't really matter. We only loose |
| 1788 |
% one macro name if the assumption is false. But at least the font |
| 1789 |
% should be there! |
| 1790 |
% \begin{macrocode} |
| 1791 |
%</2ekernel> |
| 1792 |
%<*2ekernel|latexrelease> |
| 1793 |
%<latexrelease>\IncludeInRelease{2019/10/01}% |
| 1794 |
%<latexrelease> {\DeclareErrorFont}{No side effects please}% |
| 1795 |
\def\DeclareErrorFont#1#2#3#4#5{% |
| 1796 |
\xdef\error@fontshape{% |
| 1797 |
\noexpand\expandafter\noexpand\split@name\noexpand\string |
| 1798 |
\expandafter\noexpand\csname#1/#2/#3/#4/#5\endcsname |
| 1799 |
\noexpand\@nil}% |
| 1800 |
% \end{macrocode} |
| 1801 |
% Initialize all those internal variables which may or may not have |
| 1802 |
% values in the first seconds of NFSS' bootstrapping process. Later |
| 1803 |
% on such values will be updated when an encoding is selected, etc. |
| 1804 |
% |
| 1805 |
% We definitely don't want to set |\f@encoding|; we can set all the |
| 1806 |
% others since if they are left ``blank'' any selection would grab |
| 1807 |
% ``error default values'' as well. However, this probably should |
| 1808 |
% go also---and now it did. |
| 1809 |
% \changes{v2.1n}{1994/05/14}{Don't set \cs{f@encoding}} |
| 1810 |
% \changes{v3.2c}{2019/07/09}{Don't set any \cs{f@...} macros} |
| 1811 |
% \begin{macrocode} |
| 1812 |
% \gdef\f@encoding{#1}% |
| 1813 |
\gdef\default@family{#2}% |
| 1814 |
\gdef\default@series{#3}% |
| 1815 |
\gdef\default@shape{#4}% |
| 1816 |
} |
| 1817 |
%</2ekernel|latexrelease> |
| 1818 |
%<latexrelease>\EndIncludeInRelease |
| 1819 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1820 |
%<latexrelease> {\DeclareErrorFont}{No side effects please}% |
| 1821 |
%<latexrelease> |
| 1822 |
%<latexrelease>\def\DeclareErrorFont#1#2#3#4#5{% |
| 1823 |
%<latexrelease> \xdef\error@fontshape{% |
| 1824 |
%<latexrelease> \noexpand\expandafter\noexpand\split@name\noexpand\string |
| 1825 |
%<latexrelease> \expandafter\noexpand\csname#1/#2/#3/#4/#5\endcsname |
| 1826 |
%<latexrelease> \noexpand\@nil}% |
| 1827 |
%<latexrelease> \gdef\default@family{#2}% |
| 1828 |
%<latexrelease> \gdef\default@series{#3}% |
| 1829 |
%<latexrelease> \gdef\default@shape{#4}% |
| 1830 |
%<latexrelease> \global\let\f@family\default@family |
| 1831 |
%<latexrelease> \global\let\f@series\default@series |
| 1832 |
%<latexrelease> \global\let\f@shape\default@shape |
| 1833 |
%<latexrelease> \gdef\f@size{#5}% |
| 1834 |
%<latexrelease> \gdef\f@baselineskip{#5pt}% |
| 1835 |
%<latexrelease>} |
| 1836 |
%<latexrelease>\EndIncludeInRelease |
| 1837 |
%<*2ekernel> |
| 1838 |
% \end{macrocode} |
| 1839 |
% |
| 1840 |
% \begin{macrocode} |
| 1841 |
\@onlypreamble\DeclareErrorFont |
| 1842 |
% \end{macrocode} |
| 1843 |
% \end{macro} |
| 1844 |
% |
| 1845 |
% |
| 1846 |
% \begin{macro}{\wrong@fontshape} |
| 1847 |
% Before we come to the macro |\extract@font| we have to take |
| 1848 |
% care of unknown |\curr@fontshape| combinations. |
| 1849 |
% The general strategy is to issue a warning and to try a default |
| 1850 |
% \emph{shape}, then a default \emph{series}, |
| 1851 |
% and finally a default \emph{family}. |
| 1852 |
% If this last one also fails \TeX{} will go into an infinite loop. |
| 1853 |
% But if the defaults are set incorrectly one deserves nothing else! |
| 1854 |
% \changes{v1.9a}{1992/07/26}{} |
| 1855 |
% \begin{macrocode} |
| 1856 |
%</2ekernel> |
| 1857 |
%<latexrelease>\IncludeInRelease{2015/01/01}{\wrong@fontshape}% |
| 1858 |
%<latexrelease> {Font substitution in preamble}% |
| 1859 |
%<*2ekernel|latexrelease> |
| 1860 |
\def\wrong@fontshape{% |
| 1861 |
\csname D@\f@encoding\endcsname % install defaults if in math |
| 1862 |
% \end{macrocode} |
| 1863 |
% We remember the wanted |\curr@fontshape| combination |
| 1864 |
% which we will need in a moment. |
| 1865 |
% \begin{macrocode} |
| 1866 |
\edef\reserved@a{\csname\curr@fontshape\endcsname}% |
| 1867 |
\ifx\last@fontshape\reserved@a |
| 1868 |
\errmessage{Corrupted NFSS tables}% |
| 1869 |
\error@fontshape |
| 1870 |
\else |
| 1871 |
% \end{macrocode} |
| 1872 |
% Then we warn the user about the mess and set the shape to its |
| 1873 |
% default. |
| 1874 |
% \changes{v1.0q}{1989/11/19} |
| 1875 |
% {Instead of calling \cs{family}\cs{default@family}, |
| 1876 |
% etc. we directly set \cs{f@family}, etc.} |
| 1877 |
% \changes{v1.2f}{1990/01/28}{Warning message slightly changed.} |
| 1878 |
% \begin{macrocode} |
| 1879 |
\let\f@shape\default@shape |
| 1880 |
% \end{macrocode} |
| 1881 |
% If the combination is not known, try the default \emph{series}. |
| 1882 |
% \begin{macrocode} |
| 1883 |
\expandafter\ifx\csname\curr@fontshape\endcsname\relax |
| 1884 |
\let\f@series\default@series |
| 1885 |
% \end{macrocode} |
| 1886 |
% If this is still undefined, try the default \emph{family}. |
| 1887 |
% Otherwise give up. We never try to change the encoding scheme! |
| 1888 |
% \changes{v1.9a}{1992/07/26}{} |
| 1889 |
% \changes{v3.1a}{2015/04/07}{Try loading fd file if family has changed} |
| 1890 |
% \begin{macrocode} |
| 1891 |
\expandafter |
| 1892 |
\ifx\csname\curr@fontshape\endcsname\relax |
| 1893 |
\let\f@family\default@family |
| 1894 |
% \end{macrocode} |
| 1895 |
% If we change the font family and we are in the preamble then the |
| 1896 |
% corresponding \texttt{.fd} file may not been loaded |
| 1897 |
% yet. Therefore we try this now. Otherwise equating the requested |
| 1898 |
% font shape with the finally selected fontshape below will fail |
| 1899 |
% and can result in ``NFSS tables corrupted''. After begin document |
| 1900 |
% that will not happen as all \texttt{.fd} files involved in |
| 1901 |
% substitution are loaded at |\begin{document}|. |
| 1902 |
% \begin{macrocode} |
| 1903 |
\begingroup |
| 1904 |
\try@load@fontshape |
| 1905 |
\endgroup |
| 1906 |
\fi \fi |
| 1907 |
\fi |
| 1908 |
% \end{macrocode} |
| 1909 |
% At this point a valid |\curr@fontshape| combination must |
| 1910 |
% have been found. |
| 1911 |
% We inform the user about this fact. |
| 1912 |
%\changes{v3.0n}{1995/11/02} |
| 1913 |
% {(DPC) Remove extra space with \cs{string} for latex/1676} |
| 1914 |
% \changes{v3.0m}{1995/11/17} |
| 1915 |
% {Support \cs{@wrong@font@char} latex/1676} |
| 1916 |
% |
| 1917 |
% The |\expandafter\string| here stops \TeX\ adding the space |
| 1918 |
% that it usually puts after command names in messages. The similar |
| 1919 |
% construction with |\@undefined| just produces `undefined', but saves |
| 1920 |
% a few tokens. |
| 1921 |
% |
| 1922 |
% |\@wrong@font@char| is locally redefined in |\UseTextSymbol| from |
| 1923 |
% its normal (empty) definition, to report the symbol generating the |
| 1924 |
% font switch. |
| 1925 |
% \begin{macrocode} |
| 1926 |
\@font@warning{Font shape `\expandafter\string\reserved@a' |
| 1927 |
\expandafter\@gobble\string\@undefined\MessageBreak |
| 1928 |
using `\curr@fontshape' instead\@wrong@font@char}% |
| 1929 |
\global\let\last@fontshape\reserved@a |
| 1930 |
% \end{macrocode} |
| 1931 |
% We change |\@defaultsubs| to produce a warning at the end of |
| 1932 |
% the document. |
| 1933 |
% \changes{v3.0d}{1995/07/13}{Change a macro not a switch to flag |
| 1934 |
% default font substitutions} |
| 1935 |
% \changes{v3.0k}{1995/10/24}{Make this code inline since it |
| 1936 |
% happens only here} |
| 1937 |
% The macro |\@defaultsubs| is initially |\relax| but gets changed |
| 1938 |
% here if some default font substitution happens. |
| 1939 |
% It is then executed in |\enddocument|. |
| 1940 |
% \begin{macrocode} |
| 1941 |
\gdef\@defaultsubs{% |
| 1942 |
\@font@warning{Some font shapes were not available, defaults |
| 1943 |
substituted.\@gobbletwo}}% |
| 1944 |
% \end{macrocode} |
| 1945 |
% If we substitute a |\curr@fontshape| combination |
| 1946 |
% by the default one we don't want the warning to be printed out |
| 1947 |
% whenever this (unknown) combination is used. |
| 1948 |
% Therefore we globally |\let| the macro corresponding to |
| 1949 |
% the wanted combination equal to its substitution. |
| 1950 |
% This requires the use of four |\expandafter|'s |
| 1951 |
% since |\csname|\dots|\endcsname| has to be |
| 1952 |
% expanded before |\reserved@a| (i.e.\ the requested |
| 1953 |
% combination), |
| 1954 |
% and this must happen before the |\let| is executed. |
| 1955 |
% \begin{macrocode} |
| 1956 |
\global\expandafter\expandafter\expandafter\let |
| 1957 |
\expandafter\reserved@a |
| 1958 |
\csname\curr@fontshape\endcsname |
| 1959 |
% \end{macrocode} |
| 1960 |
% Now we can redefine |\font@name| accordingly. |
| 1961 |
% This \emph{must} be done globally since it might occur in the |
| 1962 |
% group opened by |\define@newfont|. If we would this |
| 1963 |
% definition were local the closing |\endgroup| there |
| 1964 |
% would restore the old meaning of |\font@name| and then |
| 1965 |
% switch to the wrong font at the end of |\selectfont| |
| 1966 |
% although the correct font was loaded. |
| 1967 |
% \begin{macrocode} |
| 1968 |
\xdef\font@name{% |
| 1969 |
\csname\curr@fontshape/\f@size\endcsname}% |
| 1970 |
% \end{macrocode} |
| 1971 |
% The last thing this macro does is to call |\pickup@font| |
| 1972 |
% again to load the font if it is not defined yet. |
| 1973 |
% At this point this code will loop endlessly if |
| 1974 |
% the defaults are not well defined. |
| 1975 |
% \begin{macrocode} |
| 1976 |
\pickup@font} |
| 1977 |
%</2ekernel|latexrelease> |
| 1978 |
%<latexrelease>\EndIncludeInRelease |
| 1979 |
%<latexrelease>\IncludeInRelease{0000/00/00}{\wrong@fontshape}% |
| 1980 |
%<latexrelease> {Font substitution in preamble}% |
| 1981 |
%<latexrelease>\def\wrong@fontshape{% |
| 1982 |
%<latexrelease> \csname D@\f@encoding\endcsname |
| 1983 |
%<latexrelease> \edef\reserved@a{\csname\curr@fontshape\endcsname}% |
| 1984 |
%<latexrelease> \ifx\last@fontshape\reserved@a |
| 1985 |
%<latexrelease> \errmessage{Corrupted NFSS tables}% |
| 1986 |
%<latexrelease> \error@fontshape |
| 1987 |
%<latexrelease> \else |
| 1988 |
%<latexrelease> \let\f@shape\default@shape |
| 1989 |
%<latexrelease> \expandafter\ifx\csname\curr@fontshape\endcsname\relax |
| 1990 |
%<latexrelease> \let\f@series\default@series |
| 1991 |
%<latexrelease> \expandafter |
| 1992 |
%<latexrelease> \ifx\csname\curr@fontshape\endcsname\relax |
| 1993 |
%<latexrelease> \let\f@family\default@family |
| 1994 |
%<latexrelease> \fi \fi |
| 1995 |
%<latexrelease> \fi |
| 1996 |
%<latexrelease> \@font@warning{Font shape |
| 1997 |
%<latexrelease> `\expandafter\string\reserved@a' |
| 1998 |
%<latexrelease> \expandafter\@gobble\string\@undefined |
| 1999 |
%<latexrelease> \MessageBreak |
| 2000 |
%<latexrelease> using `\curr@fontshape' instead\@wrong@font@char}% |
| 2001 |
%<latexrelease> \global\let\last@fontshape\reserved@a |
| 2002 |
%<latexrelease> \gdef\@defaultsubs{% |
| 2003 |
%<latexrelease> \@font@warning{Some font shapes were not available, |
| 2004 |
%<latexrelease> defaults substituted.\@gobbletwo}}% |
| 2005 |
%<latexrelease> \global\expandafter\expandafter\expandafter\let |
| 2006 |
%<latexrelease> \expandafter\reserved@a |
| 2007 |
%<latexrelease> \csname\curr@fontshape\endcsname |
| 2008 |
%<latexrelease> \xdef\font@name{% |
| 2009 |
%<latexrelease> \csname\curr@fontshape/\f@size\endcsname}% |
| 2010 |
%<latexrelease> \pickup@font} |
| 2011 |
%<latexrelease>\EndIncludeInRelease |
| 2012 |
%<*2ekernel> |
| 2013 |
% \end{macrocode} |
| 2014 |
% \end{macro} |
| 2015 |
% |
| 2016 |
% \begin{macro}{\@wrong@font@char} |
| 2017 |
% \changes{v3.0m}{1995/11/17}{(DPC) Macro added. latex/1676} |
| 2018 |
% Normally empty but redefined in |\UseTextSymbol| so that the |
| 2019 |
% Font shape undefined message can refer to the symbol causing the |
| 2020 |
% problem. |
| 2021 |
% \begin{macrocode} |
| 2022 |
\let\@wrong@font@char\@empty |
| 2023 |
% \end{macrocode} |
| 2024 |
% \end{macro} |
| 2025 |
% |
| 2026 |
% \begin{macro}{\@@defaultsubs} |
| 2027 |
% \changes{v3.0d}{1995/07/13}{macro added} |
| 2028 |
% \changes{v3.0k}{1995/10/24}{macro removed} |
| 2029 |
% \begin{macro}{\@defaultsubs} |
| 2030 |
% \changes{v3.0d}{1995/07/13}{macro added} |
| 2031 |
% See above. |
| 2032 |
% \begin{macrocode} |
| 2033 |
\let\@defaultsubs\relax |
| 2034 |
% \end{macrocode} |
| 2035 |
% \end{macro} |
| 2036 |
% \end{macro} |
| 2037 |
% |
| 2038 |
% |
| 2039 |
% \begin{macro}{\strip@prefix} |
| 2040 |
% In |\extract@font| we will need a way to recover the |
| 2041 |
% replacement text of a macro. |
| 2042 |
% This is done by the primitive |\meaning| together |
| 2043 |
% with the macro |\strip@prefix| (for the details |
| 2044 |
% see appendix~D of the \TeX{}book, p.\ 382). |
| 2045 |
% \begin{macrocode} |
| 2046 |
\def\strip@prefix#1>{} |
| 2047 |
% \end{macrocode} |
| 2048 |
% \end{macro} |
| 2049 |
% |
| 2050 |
% ^^A \extract@font |
| 2051 |
% |
| 2052 |
% |
| 2053 |
% |
| 2054 |
% \section{Assigning math fonts to \emph{versions}} |
| 2055 |
% |
| 2056 |
% |
| 2057 |
% \begin{macro}{\install@mathalphabet} |
| 2058 |
% This is just another name for |\gdef| but we can redefine it if |
| 2059 |
% necessary later on. |
| 2060 |
% \begin{macrocode} |
| 2061 |
\let\install@mathalphabet\gdef |
| 2062 |
% \end{macrocode} |
| 2063 |
% \end{macro} |
| 2064 |
% |
| 2065 |
% |
| 2066 |
% |
| 2067 |
% \begin{macro}{\math@fonts} |
| 2068 |
% |
| 2069 |
% \changes{v1.9a}{1992/07/26}{} |
| 2070 |
% \begin{macrocode} |
| 2071 |
\let\math@fonts\@empty |
| 2072 |
% \end{macrocode} |
| 2073 |
% \end{macro} |
| 2074 |
% |
| 2075 |
% |
| 2076 |
% |
| 2077 |
% \begin{macro}{\select@group} |
| 2078 |
% \changes{v1.0t}{1989/11/26}{\cs{bgroup}/\cs{egroup} changed to |
| 2079 |
% \cs{begingroup}/\cs{endgroup} to avoid empty Ord atom on math list.} |
| 2080 |
% |\select@group| has four arguments: the new |
| 2081 |
% \meta{math alphabet identifier} (a control sequence), the |
| 2082 |
% \meta{math group number}, the extra macro for math mode |
| 2083 |
% and the |\curr@fontshape| definition macro name. |
| 2084 |
% We first check if we are in math mode. |
| 2085 |
% \changes{v1.1a}{1989/12/16}{\cs{relax} in front added.} |
| 2086 |
% \changes{v1.1a}{1989/12/16}{Now four arguments.} |
| 2087 |
% \begin{macrocode} |
| 2088 |
%\def\select@group#1#2#3{\relax\ifmmode |
| 2089 |
% \end{macrocode} |
| 2090 |
% We do these things locally using |\begingroup| instead |
| 2091 |
% of |\bgroup| to avoid the appearance of an empty Ord |
| 2092 |
% atom on the math list. |
| 2093 |
% \begin{macrocode} |
| 2094 |
% \begingroup |
| 2095 |
% \end{macrocode} |
| 2096 |
% We set the math fonts for the \emph{family} in question by calling |
| 2097 |
% |\getanddefine@fonts| in the correct environment. |
| 2098 |
% \changes{v1.9a}{1992/07/26}{} |
| 2099 |
% \begin{macrocode} |
| 2100 |
% \escapechar\m@ne |
| 2101 |
% \getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3% |
| 2102 |
% \end{macrocode} |
| 2103 |
% We globally select the math fonts\dots |
| 2104 |
% \begin{macrocode} |
| 2105 |
% \globaldefs\@ne \math@fonts |
| 2106 |
% \end{macrocode} |
| 2107 |
% \dots{} and close the group to |
| 2108 |
% restore |\globaldefs| and |\escapechar|. |
| 2109 |
% \begin{macrocode} |
| 2110 |
% \endgroup |
| 2111 |
% \end{macrocode} |
| 2112 |
% As long as no \emph{size} or \emph{version} change occurs |
| 2113 |
% the \meta{math alphabet identifier} should simply switch to the |
| 2114 |
% installed \emph{math group} instead of calling |
| 2115 |
% |\select@group| |
| 2116 |
% unnecessarily. So we globally redefine the first argument |
| 2117 |
% (the new \meta{math alphabet identifier}) |
| 2118 |
% to expand into a |\mathgroup| switch |
| 2119 |
% and then select this \emph{alphabet}. Note that this redefinition |
| 2120 |
% will be overwritten by the next call to a \emph{version} macro. |
| 2121 |
% \changes{v1.1a}{1989/12/16}{Usage of `\quotechar=' macro added.} |
| 2122 |
% \changes{v1.1a}{1989/12/16}{Redefinition of alphabet now simpler.} |
| 2123 |
% \changes{v1.2a}{1990/01/20}{Def for alph id changed.} |
| 2124 |
% The original code for the end of |\select@group| was |
| 2125 |
% \begin{verbatim} |
| 2126 |
% \gdef#1{#3\mathgroup #2}#1\fi} |
| 2127 |
%\end{verbatim} |
| 2128 |
% i.e.\ first redefining the \meta{math alphabet identifier} and |
| 2129 |
% then calling the new definition to switch to the wanted |
| 2130 |
% \meta{math group}. Now we define the \meta{math alphabet |
| 2131 |
% identifier} as a call to the |\use@mathgroup| command. |
| 2132 |
% \changes{v1.2b}{1990/01/21}{Code moved to \cs{use@mathgroup}.} |
| 2133 |
% \begin{macrocode} |
| 2134 |
% \xdef#1{\noexpand\use@mathgroup\noexpand#2% |
| 2135 |
% {\number\csname c@mv@\math@version\endcsname}}% |
| 2136 |
% \end{macrocode} |
| 2137 |
% \changes{v1.3c}{1992/05/12}{Added call to |
| 2138 |
% \cs{extract@alph@from@version}.} |
| 2139 |
% But this is not sufficient, as we learned the hard way. |
| 2140 |
% The problem here is that the loading of the fonts that comprise |
| 2141 |
% the alphabet identifier |#1|, as well as the necessary math font |
| 2142 |
% assignments is deferred until it is used. This is OK so far, but |
| 2143 |
% if the fonts are switched within the current formula (which may |
| 2144 |
% happen if a sub-formula is a box that contains a math version |
| 2145 |
% switch) the font assignments for |#1| are not restored unless |
| 2146 |
% |#1| is used again. This is disastrous since TeX sees the wrong |
| 2147 |
% fonts at the end of the math formula, when it converts the math |
| 2148 |
% list into a horizontal list. |
| 2149 |
% |
| 2150 |
% This is taken into account as follows: When a math alphabet |
| 2151 |
% identifier is used for the first time in a certain version |
| 2152 |
% it modifies the corresponding macro |\mv@|\meta{version} |
| 2153 |
% so that it calls |\getanddefine@fonts| directly in future as well. |
| 2154 |
% We use the macro |\extract@alph@from@version| to do this. |
| 2155 |
% It takes the math alphabet identifier |#1| and the math version |
| 2156 |
% macro as arguments. |
| 2157 |
% \changes{v1.9a}{1992/07/26}{} |
| 2158 |
% \begin{macrocode} |
| 2159 |
% \expandafter\extract@alph@from@version |
| 2160 |
% \csname mv@\math@version\expandafter\endcsname |
| 2161 |
% \expandafter{\number\csname c@mv@\math@version\endcsname}% |
| 2162 |
% #1% |
| 2163 |
% \stepcounter{mv@\math@version}% |
| 2164 |
% \end{macrocode} |
| 2165 |
% Finally, it is not possible to simply call the new definition |
| 2166 |
% since we |
| 2167 |
% have an argument (the third argument of |\use@mathgroup| |
| 2168 |
% or more exactly the argument of |\math@egroup| if the {\ttfamily |
| 2169 |
% margid} option is in force) |
| 2170 |
% which would swallow our closing |\fi|. So |
| 2171 |
% we use the |\expandafter| technique to remove the |\fi| |
| 2172 |
% before the |\use@mathgroup| is expanded. |
| 2173 |
% \begin{macrocode} |
| 2174 |
%\expandafter #1\fi} |
| 2175 |
% \end{macrocode} |
| 2176 |
% \end{macro} |
| 2177 |
% |
| 2178 |
% |
| 2179 |
% \begin{macro}{\extract@alph@from@version} |
| 2180 |
% \changes{v1.3c}{1992/05/12}{Macro added.} |
| 2181 |
% We proceed to the definition of the |
| 2182 |
% macro |\extract@alph@from@version|. As stated above, it takes |
| 2183 |
% a math alphabet identifier and a math version macro |
| 2184 |
% (e.g.\ |\mv@normal|) as its arguments. |
| 2185 |
% \begin{macrocode} |
| 2186 |
\def\extract@alph@from@version#1#2#3{% |
| 2187 |
% \end{macrocode} |
| 2188 |
% To extract and replace the definition of math alphabet identifier |
| 2189 |
% |#3| in macro |#1| we have to recall how this definition looks |
| 2190 |
% like: Somewhere in the replacement text of |#1| there is |
| 2191 |
% the sequence\\[2pt] |
| 2192 |
% |\install@mathalphabet|\meta{math alphabet identifier} |#3||{%| \\ |
| 2193 |
% \hspace*{\MacroIndent}\hspace*{5mm} |
| 2194 |
% \meta{Definitions for }|#3}| \\[2pt] |
| 2195 |
% Hence, the first thing we do is to extract the tokens preceding |
| 2196 |
% this definitions, the definition itself, and the tokens following |
| 2197 |
% it. To this end we define one auxiliary macro |\reserved@a|. |
| 2198 |
% \begin{macrocode} |
| 2199 |
\def\reserved@a##1\install@mathalphabet#3##2##3\@nil{% |
| 2200 |
% \end{macrocode} |
| 2201 |
% When |\reserved@a| is expanded, it will have the tokens preceding |
| 2202 |
% the definition in question in its first argument (|##1|), the |
| 2203 |
% following tokens in its third argument (|##3|), and the replacement |
| 2204 |
% text for the math alphabet identifier |#3| in its second argument. |
| 2205 |
% (|##2|). This is then recorded for later use in a temporary macro |
| 2206 |
% |\reserved@b|. |
| 2207 |
% \begin{macrocode} |
| 2208 |
\def\reserved@b{##2}% |
| 2209 |
% \end{macrocode} |
| 2210 |
% Additionally, we define a macro |\reserved@c| to reconstruct the |
| 2211 |
% definitions for the math version in question from the tokens that |
| 2212 |
% will remain unchanged (|##1| and |##3|) and the yet to build new |
| 2213 |
% definitions for the math alphabet identifier |#3|. |
| 2214 |
% \begin{macrocode} |
| 2215 |
\def\reserved@c####1{\gdef#1{##1####1##3}}}% |
| 2216 |
% \end{macrocode} |
| 2217 |
% Then we execute our auxiliary macro. |
| 2218 |
% \begin{macrocode} |
| 2219 |
\expandafter\reserved@a#1\@nil |
| 2220 |
% \end{macrocode} |
| 2221 |
% OK, so now we have to build the new definition for |#3|. To do so, |
| 2222 |
% we first extract the interesting parts out of the old one. |
| 2223 |
% The old definition looks like:\\[2pt] |
| 2224 |
% |\select@group|\meta{math alphabet identifier} \\ |
| 2225 |
% \hspace*{\MacroIndent}\hspace*{5mm} |
| 2226 |
% \meta{math group number}\meta{math extra part}\\ |
| 2227 |
% \meta{|curr@fontshape| definition} \\[2pt] |
| 2228 |
% So we define a new temporary macro |\reserved@a| that |
| 2229 |
% extracts these parts. |
| 2230 |
% \begin{macrocode} |
| 2231 |
\def\reserved@a\select@group#3##1##2\@nil{% |
| 2232 |
% \end{macrocode} |
| 2233 |
% This macro can now directly rebuild the math version definition |
| 2234 |
% by calling |\reserved@c|: |
| 2235 |
% \begin{macrocode} |
| 2236 |
\reserved@c{% |
| 2237 |
\getanddefine@fonts{#2}##2% |
| 2238 |
\install@mathalphabet#3{% |
| 2239 |
\relax\ifmmode \else \non@alpherr#3\fi |
| 2240 |
\use@mathgroup##1{#2}}}% |
| 2241 |
% \end{macrocode} |
| 2242 |
% \changes{v2.1t}{1994/10/15}{Warn if math alpha is used outside math} |
| 2243 |
% In addition it defines the alphabet the way it should be used from |
| 2244 |
% now on. |
| 2245 |
% \begin{macrocode} |
| 2246 |
\gdef#3{\relax\ifmmode \else \non@alpherr#3\fi |
| 2247 |
\use@mathgroup##1{#2}}}% |
| 2248 |
% \end{macrocode} |
| 2249 |
% Finally, we only have to call this macro |\reserved@a| on the old |
| 2250 |
% definitions recorded in |\reserved@b|: |
| 2251 |
% \begin{macrocode} |
| 2252 |
\expandafter\reserved@a\reserved@b\@nil |
| 2253 |
} |
| 2254 |
% \end{macrocode} |
| 2255 |
% \end{macro} |
| 2256 |
% |
| 2257 |
% |
| 2258 |
% |
| 2259 |
% \begin{macro}{\math@bgroup} |
| 2260 |
% \changes{v1.2a}{1990/01/20}{Def. placed in this file.} |
| 2261 |
% \begin{macro}{\math@egroup} |
| 2262 |
% \changes{v1.2a}{1990/01/20}{Def. placed in this file.} |
| 2263 |
% \changes{v1.2h}{1990/03/30}{Changed to have one arg.} |
| 2264 |
% \changes{v2.2f}{1994/03/10}{Changed \cs{begingroup}/\cs{endgroup} to |
| 2265 |
% \cs{bgroup}/\cs{egroup}.} |
| 2266 |
% Here are the default definitions for |\math@bgroup| and |
| 2267 |
% |\math@egroup|. We use |\bgroup| instead of |\begingroup| |
| 2268 |
% to avoid `leaking out' of style changes. This has the side |
| 2269 |
% effect of always producing mathord atoms. |
| 2270 |
% \begin{macrocode} |
| 2271 |
\let\math@bgroup\bgroup |
| 2272 |
\def\math@egroup#1{#1\egroup} |
| 2273 |
% \end{macrocode} |
| 2274 |
% \end{macro} |
| 2275 |
% \end{macro} |
| 2276 |
% |
| 2277 |
% |
| 2278 |
% \begin{macro}{\calculate@math@sizes} |
| 2279 |
% \changes{v2.1i}{1994/04/18}{Changed message to log only} |
| 2280 |
% Here is the default definition for |\calculate@math@sizes| |
| 2281 |
% a more elaborate interface |
| 2282 |
% is under testing in mthscale.sty. |
| 2283 |
% \begin{macrocode} |
| 2284 |
\gdef\calculate@math@sizes{% |
| 2285 |
\@font@info{Calculating\space math\space sizes\space for\space |
| 2286 |
size\space <\f@size>}% |
| 2287 |
\dimen@\f@size \p@ |
| 2288 |
\@tempdimb \defaultscriptratio \dimen@ |
| 2289 |
\dimen@ \defaultscriptscriptratio \dimen@ |
| 2290 |
\expandafter\xdef\csname S@\f@size\endcsname{% |
| 2291 |
\gdef\noexpand\tf@size{\f@size}% |
| 2292 |
\gdef\noexpand\sf@size{\strip@pt\@tempdimb}% |
| 2293 |
\gdef\noexpand\ssf@size{\strip@pt\dimen@}% |
| 2294 |
\noexpand\math@fontstrue}} |
| 2295 |
% \end{macrocode} |
| 2296 |
% \end{macro} |
| 2297 |
% |
| 2298 |
% \begin{macro}{\defaultscriptratio} |
| 2299 |
% \changes{v2.1h}{1994/04/11}{Macro added} |
| 2300 |
% \begin{macro}{\defaultscriptscriptratio} |
| 2301 |
% \changes{v2.1h}{1994/04/11}{Macro added} |
| 2302 |
% The default ratio for math |
| 2303 |
% sizes is:\\ |
| 2304 |
% 1 to |\defaultscriptratio| to |\defaultscriptscriptratio|.\\ |
| 2305 |
% By default this is 1 to .7 to .5. |
| 2306 |
% \begin{macrocode} |
| 2307 |
\def\defaultscriptratio{.7} |
| 2308 |
\def\defaultscriptscriptratio{.5} |
| 2309 |
% \end{macrocode} |
| 2310 |
% \end{macro} |
| 2311 |
% \end{macro} |
| 2312 |
% |
| 2313 |
% \begin{macro}{\noaccents@} |
| 2314 |
% If we don't have a definition for |\noaccents@| we provide a |
| 2315 |
% dummy. |
| 2316 |
% \begin{macrocode} |
| 2317 |
\ifx\noaccents@\@undefined |
| 2318 |
\let\noaccents@\@empty |
| 2319 |
\fi |
| 2320 |
% \end{macrocode} |
| 2321 |
% \end{macro} |
| 2322 |
% |
| 2323 |
% \begin{macro}{\showhyphens} |
| 2324 |
% \changes{v1.2l}{1990/06/30}{Macro added.} |
| 2325 |
% \changes{v2.0e}{1993/05/16}{Use \cs{reset@font}} |
| 2326 |
% \changes{v3.0h}{1995/10/10} |
| 2327 |
% {Use \cs{normalfont} and make colour safe, and autoloadable} |
| 2328 |
% \changes{v3.0u}{1998/03/25} |
| 2329 |
% {Suppress unnecessary error when used in preamble} |
| 2330 |
% \changes{v3.2a}{2017/01/10} |
| 2331 |
% {Add version of \cs{showhyphens} that works with Xe\TeX.} |
| 2332 |
% \changes{v3.2m}{2024/06/17} |
| 2333 |
% {set \cs{tracinglostchars} to 0 in \cs{showhyphens}} |
| 2334 |
% \changes{v3.2q}{2025/03/05} |
| 2335 |
% {set \cs{tracinglostchars} to 0 in \cs{showhyphens} for all engines} |
| 2336 |
% The |\showhyphens| command must be redefined since the version in |
| 2337 |
% \texttt{plain.tex} uses |\tenrm|. We have also made some further |
| 2338 |
% adjustments for its use in \LaTeX. |
| 2339 |
% \begin{macrocode} |
| 2340 |
%</2ekernel> |
| 2341 |
%<latexrelease>\IncludeInRelease{2017/01/01}{\showhyphens}% |
| 2342 |
%<latexrelease> {XeTeX support for \showhyphens}% |
| 2343 |
%<*2ekernel|latexrelease> |
| 2344 |
\ifx\XeTeXcharclass\@undefined |
| 2345 |
% \end{macrocode} |
| 2346 |
% Version for engines other than Xe\TeX. |
| 2347 |
% \begin{macrocode} |
| 2348 |
\DeclareRobustCommand\showhyphens[1]{% |
| 2349 |
\setbox0\vbox{% |
| 2350 |
\color@begingroup |
| 2351 |
\tracinglostchars\z@ |
| 2352 |
\everypar{}% |
| 2353 |
\parfillskip\z@skip\hsize\maxdimen |
| 2354 |
\normalfont |
| 2355 |
\pretolerance\m@ne\tolerance\m@ne\hbadness\z@\showboxdepth\z@\ #1% |
| 2356 |
\color@endgroup}} |
| 2357 |
% \end{macrocode} |
| 2358 |
% \begin{macrocode} |
| 2359 |
\else |
| 2360 |
% \end{macrocode} |
| 2361 |
% Xe\TeX\ version. When using system fonts Xe\TeX\ reports consecutive |
| 2362 |
% runs of characters as a single item in box logging, which means the |
| 2363 |
% standard |\showhyphens| does not work. This version typesets the |
| 2364 |
% text into a narrow box to force hyphenation and then reconstructs a |
| 2365 |
% horizontal list with explicit hyphens to generate the display. Note |
| 2366 |
% that the |lmr| OpenType font is forced, this works even if the |
| 2367 |
% characters are not in the font as hyphenation is attempted due to |
| 2368 |
% the width of the space and hyphen character. It would generate |
| 2369 |
% spurious Missing Character warnings in the log, these are however |
| 2370 |
% suppressed from the terminal and log output by ensuring that |
| 2371 |
% |\tracinglostchars| is locally zero. |
| 2372 |
% \begin{macrocode} |
| 2373 |
\DeclareRobustCommand\showhyphens[1]{% |
| 2374 |
\setbox0\vbox{% |
| 2375 |
\usefont{TU}{lmr}{m}{n}% |
| 2376 |
\hsize 1sp % |
| 2377 |
\hbadness\@M |
| 2378 |
\hfuzz\maxdimen |
| 2379 |
\tracingonline\z@ |
| 2380 |
\tracinglostchars\z@ |
| 2381 |
\everypar={}% |
| 2382 |
\leftskip\z@skip |
| 2383 |
\rightskip\z@skip |
| 2384 |
\parfillskip\z@skip |
| 2385 |
\hyphenpenalty=-\@M |
| 2386 |
\pretolerance\m@ne |
| 2387 |
\interlinepenalty\z@ |
| 2388 |
\clubpenalty\z@ |
| 2389 |
\widowpenalty\z@ |
| 2390 |
\brokenpenalty1127 % |
| 2391 |
\setbox\z@\hbox{}% |
| 2392 |
\noindent |
| 2393 |
\hskip\z@skip |
| 2394 |
#1% |
| 2395 |
\par |
| 2396 |
% \end{macrocode} |
| 2397 |
% Note here we stop the loop if made no progress, non-removable items |
| 2398 |
% may mean that we can not process the whole list (which would be |
| 2399 |
% testable as |\lastnodetype=-1|). |
| 2400 |
% \begin{macrocode} |
| 2401 |
\loop |
| 2402 |
\@tempswafalse |
| 2403 |
\ifnum\lastnodetype=11\unskip\@tempswatrue\fi |
| 2404 |
\ifnum\lastnodetype=12\unkern\@tempswatrue\fi |
| 2405 |
\ifnum\lastnodetype=13 % |
| 2406 |
\count@\lastpenalty |
| 2407 |
\unpenalty\@tempswatrue |
| 2408 |
\fi |
| 2409 |
\ifnum\lastnodetype=\@ne |
| 2410 |
\setbox\tw@\lastbox\@tempswatrue |
| 2411 |
\setbox0\hbox{\unhbox\tw@\unskip\unskip\unpenalty |
| 2412 |
\ifnum\count@=1127 \else\ \fi |
| 2413 |
\unhbox0}% |
| 2414 |
\count@\z@ |
| 2415 |
\fi |
| 2416 |
\if@tempswa |
| 2417 |
\repeat |
| 2418 |
\hbadness\z@ |
| 2419 |
\hsize\maxdimen |
| 2420 |
\showboxdepth\z@ |
| 2421 |
\tolerance\m@ne |
| 2422 |
\hyphenpenalty\z@ |
| 2423 |
\noindent\unhbox\z@ |
| 2424 |
}} |
| 2425 |
% \end{macrocode} |
| 2426 |
% |
| 2427 |
% \begin{macrocode} |
| 2428 |
\fi |
| 2429 |
% \end{macrocode} |
| 2430 |
% |
| 2431 |
% \begin{macrocode} |
| 2432 |
%</2ekernel|latexrelease> |
| 2433 |
%<latexrelease>\EndIncludeInRelease |
| 2434 |
%<latexrelease>\IncludeInRelease{0000/00/00}{\showhyphens}% |
| 2435 |
%<latexrelease> {XeTeX support for \showhyphens}% |
| 2436 |
%<latexrelease>\gdef\showhyphens#1{% |
| 2437 |
%<latexrelease> \setbox0\vbox{% |
| 2438 |
%<latexrelease> \color@begingroup |
| 2439 |
%<latexrelease> \everypar{}% |
| 2440 |
%<latexrelease> \parfillskip\z@skip\hsize\maxdimen |
| 2441 |
%<latexrelease> \normalfont |
| 2442 |
%<latexrelease> \pretolerance\m@ne\tolerance\m@ne |
| 2443 |
%<latexrelease> \hbadness\z@\showboxdepth\z@\ #1% |
| 2444 |
%<latexrelease> \color@endgroup}} |
| 2445 |
%<latexrelease>\EndIncludeInRelease |
| 2446 |
%<*2ekernel> |
| 2447 |
% \end{macrocode} |
| 2448 |
% \end{macro} |
| 2449 |
% |
| 2450 |
% |
| 2451 |
% \begin{macro}{\addto@hook} |
| 2452 |
% \changes{v1.0u}{1989/12/05}{\cs{addto@hook} added.} |
| 2453 |
% \changes{v2.1d}{1994/02/10}{Made \cs{addto@hook} long.} |
| 2454 |
% We need a macro to add tokens to a hook. |
| 2455 |
% \begin{macrocode} |
| 2456 |
\long\def\addto@hook#1#2{#1\expandafter{\the#1#2}} |
| 2457 |
% \end{macrocode} |
| 2458 |
% \end{macro} |
| 2459 |
% |
| 2460 |
% |
| 2461 |
% \begin{macro}{\@vpt} |
| 2462 |
% \changes{v2.1v}{1994/11/09}{(DPC) macros added, from setsize.dtx} |
| 2463 |
% \changes{v2.1v}{1994/11/09}{(DPC) reduce save stack usage latex/1742} |
| 2464 |
% \begin{macrocode} |
| 2465 |
\def\@vpt{5} |
| 2466 |
% \end{macrocode} |
| 2467 |
% \end{macro} |
| 2468 |
% |
| 2469 |
% \begin{macro}{\@vipt} |
| 2470 |
% \begin{macrocode} |
| 2471 |
\def\@vipt{6} |
| 2472 |
% \end{macrocode} |
| 2473 |
% \end{macro} |
| 2474 |
% |
| 2475 |
% \begin{macro}{\@viipt} |
| 2476 |
% \begin{macrocode} |
| 2477 |
\def\@viipt{7} |
| 2478 |
% \end{macrocode} |
| 2479 |
% \end{macro} |
| 2480 |
% |
| 2481 |
% \begin{macro}{\@viiipt} |
| 2482 |
% \begin{macrocode} |
| 2483 |
\def\@viiipt{8} |
| 2484 |
% \end{macrocode} |
| 2485 |
% \end{macro} |
| 2486 |
% |
| 2487 |
% \begin{macro}{\@ixpt} |
| 2488 |
% \begin{macrocode} |
| 2489 |
\def\@ixpt{9} |
| 2490 |
% \end{macrocode} |
| 2491 |
% \end{macro} |
| 2492 |
% |
| 2493 |
% \begin{macro}{\@xpt} |
| 2494 |
% \begin{macrocode} |
| 2495 |
\def\@xpt{10} |
| 2496 |
% \end{macrocode} |
| 2497 |
% \end{macro} |
| 2498 |
% |
| 2499 |
% \begin{macro}{\@xipt} |
| 2500 |
% \begin{macrocode} |
| 2501 |
\def\@xipt{10.95} |
| 2502 |
% \end{macrocode} |
| 2503 |
% \end{macro} |
| 2504 |
% |
| 2505 |
% \begin{macro}{\@xiipt} |
| 2506 |
% \begin{macrocode} |
| 2507 |
\def\@xiipt{12} |
| 2508 |
% \end{macrocode} |
| 2509 |
% \end{macro} |
| 2510 |
% |
| 2511 |
% \begin{macro}{\@xivpt} |
| 2512 |
% \begin{macrocode} |
| 2513 |
\def\@xivpt{14.4} |
| 2514 |
% \end{macrocode} |
| 2515 |
% \end{macro} |
| 2516 |
% |
| 2517 |
% \begin{macro}{\@xviipt} |
| 2518 |
% \begin{macrocode} |
| 2519 |
\def\@xviipt{17.28} |
| 2520 |
% \end{macrocode} |
| 2521 |
% \end{macro} |
| 2522 |
% |
| 2523 |
% \begin{macro}{\@xxpt} |
| 2524 |
% \begin{macrocode} |
| 2525 |
\def\@xxpt{20.74} |
| 2526 |
% \end{macrocode} |
| 2527 |
% \end{macro} |
| 2528 |
% |
| 2529 |
% \begin{macro}{\@xxvpt} |
| 2530 |
% \begin{macrocode} |
| 2531 |
\def\@xxvpt{24.88} |
| 2532 |
% \end{macrocode} |
| 2533 |
% \end{macro} |
| 2534 |
% |
| 2535 |
% \begin{macrocode} |
| 2536 |
%</2ekernel> |
| 2537 |
% \end{macrocode} |
| 2538 |
% |
| 2539 |
% \Finale |
| 2540 |
% |
| 2541 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2542 |
\endinput |
| 2543 |
|
| 2544 |
^^A Needed for emacs |
| 2545 |
^^A |
| 2546 |
^^A Local Variables: |
| 2547 |
^^A mode: latex |
| 2548 |
^^A coding: utf-8-unix |
| 2549 |
^^A End: |
| 2550 |
|