Typos
[latex2e.git] / trunk / base / ltfssdcl.dtx
blobcfb3f4973523ebcfe60d809ce830d4f0d249b2cb
1 % \iffalse meta-comment
3 % Copyright 1993-2016
4 % The LaTeX3 Project and any individual authors listed elsewhere
5 % in this file.
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 %    http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2005/12/01 or later.
18 % This file has the LPPL maintenance status "maintained".
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
22 % information.
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.
28 % \fi
29 % \iffalse
30 %%% From File: ltfssdcl.dtx
31 %% Copyright (C) 1989-1998 Frank Mittelbach and Rainer Sch\"opf,
32 %% all rights reserved.
34 %<*driver>
35 % \fi
38 \ProvidesFile{ltfssdcl.dtx}
39             [2016/02/18 v3.0r LaTeX Kernel (NFSS Declarative Interface)]
40 % \iffalse
41 \documentclass{ltxdoc}
42 \begin{document}
43 \DocInput{ltfssdcl.dtx}
44 \end{document}
45 %</driver>
46 % \fi
48 % \iffalse
49 %<+checkmem>\def\CHECKMEM{\tracingstats=2
50 %<+checkmem>  \newlinechar=`\^^J
51 %<+checkmem>  \message{^^JMemory usage: \filename}\shipout\hbox{}}
52 %<+checkmem>\CHECKMEM
53 % \fi
57 % \GetFileInfo{ltfssdcl.dtx}
58 % \title{A new font selection scheme for \TeX{} macro packages\\
59 %        (Declarative Interface)\thanks
60 %       {This file has version number
61 %       \fileversion\ dated \filedate}}
63 % \author{Frank Mittelbach \and Rainer Sch\"opf}
65 % \MaintainedByLaTeXTeam{latex}
66 % \maketitle
68 % This file contains the main implementation of the font selection
69 % scheme commands. See other parts of the \LaTeX\ distribution, or
70 % \emph{The \LaTeX\ Companion} for higher level documentation of these
71 % commands.
73 % \begin{quote}
74 %   \textbf{Warning:}
75 %  The macro documentation is still basically the documentation from the
76 %  first NFSS release and therefore in some cases probably not
77 %  completely accurate.
78 % \end{quote}
80 % \StopEventually{}
82 % \section{Interface Commands}
84 % \changes{v3.0i}{1998/08/17}
85 %      {(RmS) Corrected minor glitches in changes entries.}
86 % \changes{v3.0b}{1995/06/15}
87 %      {(DPC) minor documentation changes}
88 % \changes{v3.0a}{1995/05/24}
89 %      {(DPC) Make file from previous file, latint.dtx 1995/05/21 v2.1t}
90 % \changes{v3.0p}{2015/02/21}
91 %         {Removed autoload code}
94 % \changes{v2.1o}{1994/11/22}
95 %         {wrap long lines}
96 % \changes{v2.1m}{1994/11/17}
97 %         {\cs{@tempa} to \cs{reserved@a}}
98 % \changes{v2.1j}{1994/05/29}{Use new error commands}
99 % \changes{v2.1h}{1994/05/13}{Removed file identification typeout}
100 % \changes{v2.1g}{1994/05/12}{Allow \cs{relax}'ed cmds to be declared}
101 % \changes{v2.1g}{1994/05/12}{Allow \cs{relax} as undefined command}
102 % \changes{v2.1e}{1994/04/28}{Removed all \cs{uppercase} in hex num
103 %                             parsing macros}
104 % \changes{v2.1d}{1994/04/18}{Removed surplus \cs{no@alphabet@error}
105 %                             (see fam.dtx)}
109 % \changes{v2.1f}{1994/05/03}{Renamed \cs{@@DeclareMathDelimiter} to
110 %                             \cs{@DeclareMathDelimiter}}
111 % \changes{v2.1c}{1994/03/13}{add 2ekernel module to omit repeated code}
114 % \begin{macro}{\in@}
115 % \changes{v3.0m}{2009/10/20}{More robust thanks to Heiko.}
116 % \changes{v3.0n}{2011/05/08}{Simplified thanks to Bruno.}
117 % \begin{macro}{\ifin@}
118 %    |\@in| is a utility macro with two arguments.  It determines
119 %    whether its first argument occurs in its second and sets the
120 %    switch |\ifin@| accordingly. The first argument may not
121 %    contain braces nor |#| (more precisely, tokens of category
122 %    code 1,~2, or~6).
123 %    \begin{macrocode}
124 %<*2ekernel>
125 \def\in@#1#2%
126  {%
127    \begingroup
128      \def\in@@##1#1{}%
129      \toks@\expandafter{\in@@#2{}{}#1}%
130      \edef\in@@{\the\toks@}%
131    \expandafter\endgroup
132    \ifx\in@@\@empty
133      \in@false
134    \else
135      \in@true
136    \fi
138 \newif\ifin@
139 %    \end{macrocode}
140 % \end{macro}
141 % \end{macro}
143 % Before the |\begin{document}| command several
144 % \meta{math versions} and \meta{math alphabet identifiers} may
145 % be declared.
146 % In principle, there should be exactly one family/series/shape
147 % combination be declared for each version/alphabet pair.
148 % But we want to allow for defaults as well for automagical
149 % filling of holes.
151 % While building the tables for math alphabet identifiers and math
152 % versions we keep several lists:
153 % \begin{itemize}
154 %   \item the list of all math versions, |\version@list|,
155 %         each entry prefixed by the control sequence |\version@elt|,
156 %         i.e.\ this list has the following form
157 %         \begin{quote}
158 %           |\version@elt|\meta{version$_1$}^^A
159 %           |\version@elt|\meta{version$_2$}\ldots\\\hspace*{\fill}^^A
160 %           |\version@elt|\meta{version$_n$}
161 %         \end{quote}
162 %   \item the list of all math alphabet identifiers.  Here every
163 %         entry has the form:\\[2pt]
164 %         \hspace*{\MacroIndent}
165 %         |\group@elt|\meta{math group number}\\
166 %         \hspace*{\MacroIndent}
167 %         |{{|\meta{default family}^^A
168 %         |}{|\meta{default series}^^A
169 %         |}{|\meta{default shape}|}}|.
170 %   \item Each defined math alphabet identifier holds a list containing
171 %         Information about the {\em versions\/} for which it is
172 %         defined.  This list has a more complicated structure: it
173 %         looks as follows:
174 %         \begin{quote}
175 %           |\set@alpha|\meta{the alphabet identifier itself}\\
176 %           \hspace*{\MacroIndent}
177 %             |\reserved@c|\meta{math version}\meta{font info}\\
178 %           \hspace*{\MacroIndent}\ldots\\
179 %           |\@nil|
180 %         \end{quote}
181 %         where \meta{font info} is either |\reserved@e|
182 %         (if the combination is not defined yet) or
183 %         \begin{quote}
184 %           |{{|\meta{family}|}{|\meta{series}^^A
185 %           |}{|\meta{shape}|}}|
186 %         \end{quote}
187 % \end{itemize}
189 % \begin{macro}{\version@list}
190 %    We initialize the version list to be empty.
191 %    \begin{macrocode}
192 \let\version@list=\@empty
193 \@onlypreamble\version@list
194 %    \end{macrocode}
195 % \end{macro}
198 % \begin{macro}{\version@elt}
199 %    \begin{macrocode}
200 \let\version@elt\relax
201 \@onlypreamble\version@elt
202 %    \end{macrocode}
203 % \end{macro}
206 % \begin{macro}{\new@mathversion}
207 %    The macro |\new@mathversion| is called with the version control
208 %    sequence as its argument.
209 %    \begin{macrocode}
210 %\def\new@mathversion#1{%
211 %    \end{macrocode}
212 %    The first thing this macro does is to check if the version
213 %    identifier is already present in |\version@list|.
214 %    We enclose |\version@list| in braces since it might be empty
215 %    (if no {\em version\/} is defined yet).  But this means that
216 %    we need a suitable number of |\expandafter| primitives.
217 %    \begin{macrocode}
218 %  \expandafter\in@\expandafter#1\expandafter{\version@list}%
219 %  \ifin@
220 %    \end{macrocode}
221 %    If so it prints an error message.
222 %    The |\next| macro is used to get rid of the four characters
223 %    |\mv@| that would otherwise appear at the begin of the
224 %    version name in the error message.
225 %    \begin{macrocode}
226 %    \@latex@error{Math version
227 %               `\expandafter\@gobblefour\string#1'
228 %               already defined}\@eha
229 %    \end{macrocode}
230 %    Otherwise we have a new version, and we can proceed with
231 %    entering it into the tables.
232 %    We add it to |\version@list|.  This is very easy:
233 %    we define |\version@elt| (which is the delimiter in
234 %    |\version@list|) to protect itself and the following token
235 %    from being expanded and simply redefine |\version@list|.
236 %    \begin{macrocode}
237 %  \else
238 %     \global\expandafter\newcount\csname c@\expandafter
239 %                                 \@gobble\string#1\endcsname
240 %     \global\csname c@\expandafter
241 %                                 \@gobble\string#1\endcsname\@ne
242 %     \def\version@elt{\noexpand\version@elt\noexpand}%
243 %     \edef\version@list{\version@list\version@elt#1}%
244 %    \end{macrocode}
245 %    Then we prepare to enter the new version into all math
246 %    alphabet identifier lists.  Remember that these lists
247 %    use |\reserved@c| as delimiter, and that there appears the
248 %    control sequence |\reserved@e| that must not be expanded.
249 %    Therefore we take suitable precautions.
250 %    \begin{macrocode}
251 %     \def\reserved@c{\noexpand\reserved@c\noexpand}%
252 %     \let\reserved@e\relax
253 %    \end{macrocode}
254 %    We will now go through the |\alpha@list| to process every
255 %    \meta{math alphabet identifier} in turn.
256 %    Since this list has |\group@elt| as a delimiter we define
257 %    this control sequence.  It has three arguments as every
258 %    entry consists of three items (as explained above).
259 %    \begin{macrocode}
260 %     \def\group@elt##1##2##3{%
261 %    \end{macrocode}
262 %    The first of these arguments is the \meta{math alphabet
263 %    identifier}.  We redefine it by appending the information
264 %    about the new version at the end of the list contained in
265 %    it.  However, there is one subtlety: the definitions for
266 %    |\reserved@c| and |\reserved@e| made above prevent the
267 %    main part of the list from being expanded.  But we still have
268 %    to take care of the header and the trailer.  To do this we
269 %    remove the trailer by means of the macro |\remove@nil|
270 %    which also protect the header from being expanded.  Its
271 %    definition is given below.  Now we can prepare to add the
272 %    new version.
273 %    \begin{macrocode}
274 %          \edef##1{\expandafter\remove@nil##1%
275 %                   \reserved@c
276 %                   #1%
277 %                   \reserved@e
278 %                   \noexpand\@nil}}%
279 %    \end{macrocode}
280 %    Finally we call |\alpha@list| which will now execute
281 %    the macro |\group@elt| once for every defined \meta{math
282 %    alphabet identifier}.  And that's all for now.
283 %    \begin{macrocode}
284 %     \alpha@list
285 %  \fi}
286 %    \end{macrocode}
287 % \end{macro}
290 % \begin{macro}{\alpha@list}
291 %    As we explained above every entry in |\alpha@list| has
292 %    the form\\[2pt]
293 %    |\alpha@elt|\\\meta{alphabet identifier}\meta{internal
294 %    group number}\meta{default font assignments}\ldots\\[2pt]
295 %    We initialize it to |\@empty|.
296 %    \begin{macrocode}
297 \let\alpha@list\@empty
298 \@onlypreamble\alpha@list
299 %    \end{macrocode}
300 % \end{macro}
303 % \begin{macro}{\alpha@elt}
304 %    \begin{macrocode}
305 \let\alpha@elt\relax
306 \@onlypreamble\alpha@elt
307 %    \end{macrocode}
308 % \end{macro}
312 %  \begin{macro}{\newgroup}
313 % Start the group (fam) allocation at 0. (Doesn't belong here.)
314 %    \begin{macrocode}
315 \count18=-1
316 %    \end{macrocode}
317 % \end{macro}
319 % \begin{macro}{\stepcounter}
320 % \changes{v3.0f}{1997/11/13}
321 %      {(DPC) Remove as never used. (Re)defined in ltcounts}
322 % \end{macro}
324 % \begin{macro}{\select@group}
325 %    We surround |\select@group| with braces so that functions using it
326 %    can be used directly after |_| or |^|.
327 % \changes{v2.1p}{1994/12/10}{Surround with braces (add fourth arg)}
328 %    However, if we use oldstyle syntax where the math alphabet
329 %    doesn't have arguments (ie if |\math@bgroup| is not |\bgroup|) we
330 %    need to get rid of the extra group.
331 % \changes{v2.1q}{1995/04/02}{fix problem for pr/1275}
332 % \changes{v3.0g}{1997/11/20}
333 %      {(DPC) inline use of \cs{stepcounter} (faster, and saves a csname
334 %       per math version as no reset list)}
335 % \changes{v3.0q}{2015/03/18}{Introduce \cs{e@mathgroup@top}}
336 %    \begin{macrocode}
337 %</2ekernel>
338 %<latexrelease>\IncludeInRelease{2015/01/01}
339 %<latexrelease>                 {\select@group}{\select@group}%
340 %<*2ekernel|latexrelease>
341 \def\select@group#1#2#3#4{%
342  \ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi
343  {%
344  \ifmmode
345   \ifnum\csname c@mv@\math@version\endcsname<\e@mathgroup@top
346      \begingroup
347        \escapechar\m@ne
348        \getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3%
349        \globaldefs\@ne  \math@fonts
350      \endgroup
351      \init@restore@version
352      \xdef#1{\noexpand\use@mathgroup\noexpand#2%
353              {\number\csname c@mv@\math@version\endcsname}}%
354      \global\advance\csname c@mv@\math@version\endcsname\@ne
355    \else
356      \let#1\relax
357      \@latex@error{Too many math alphabets used in
358                    version \math@version}%
359         \@eha
360    \fi
361  \else \expandafter\non@alpherr\fi
362  #1{#4}%
363  }%
365 %</2ekernel|latexrelease>
366 %<latexrelease>\EndIncludeInRelease
367 %<latexrelease>\IncludeInRelease{0000/00/00}
368 %<latexrelease>                 {\select@group}{\select@group}%
369 %<latexrelease>\def\select@group#1#2#3#4{%
370 %<latexrelease> \ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi
371 %<latexrelease> {%
372 %<latexrelease> \ifmmode
373 %<latexrelease>  \ifnum\csname c@mv@\math@version\endcsname<\sixt@@n
374 %<latexrelease>     \begingroup
375 %<latexrelease>       \escapechar\m@ne
376 %<latexrelease>       \getanddefine@fonts
377 %<latexrelease>         {\csname c@mv@\math@version\endcsname}#3%
378 %<latexrelease>       \globaldefs\@ne  \math@fonts
379 %<latexrelease>     \endgroup
380 %<latexrelease>     \init@restore@version
381 %<latexrelease>     \xdef#1{\noexpand\use@mathgroup\noexpand#2%
382 %<latexrelease>             {\number\csname c@mv@\math@version\endcsname}}%
383 %<latexrelease>     \global\advance\csname c@mv@\math@version\endcsname\@ne
384 %<latexrelease>   \else
385 %<latexrelease>     \let#1\relax
386 %<latexrelease>     \@latex@error{Too many math alphabets used in
387 %<latexrelease>                   version \math@version}%
388 %<latexrelease>        \@eha
389 %<latexrelease>   \fi
390 %<latexrelease> \else \expandafter\non@alpherr\fi
391 %<latexrelease> #1{#4}%
392 %<latexrelease> }%
393 %<latexrelease>}
394 %<latexrelease>\EndIncludeInRelease
395 %<*2ekernel>
396 %    \end{macrocode}
398 %    \begin{macrocode}
399 \@onlypreamble\restore@mathversion
400 %    \end{macrocode}
401 % \end{macro}
403 % \begin{macro}{\init@restore@version}
404 % \changes{v3.0e}{1996/07/26}{Removed \cs{ifrestore@version} switch
405 %          and replaced by \cs{init@restore@version}}
406 %    \begin{macrocode}
407 \def\init@restore@version{%
408         \global\let\init@restore@version\relax
409         \xdef\restore@mathversion
410              {\expandafter\noexpand\csname mv@\math@version\endcsname
411               \global\csname c@mv@\math@version\endcsname
412               \number\csname c@mv@\math@version\endcsname\relax}%
413         \aftergroup\dorestore@version
415 \@onlypreamble\init@restore@version
416 %    \end{macrocode}
417 % \end{macro}
419 % \begin{macro}{\non@alpherr}
420 % \changes{v3.0c}{1995/10/10}
421 %         {(DPC) autoload error message}
422 % \changes{v3.0j}{2005/07/27}
423 %         {(MH) Change because command is now properly robust}
424 %    \begin{macrocode}
425 \gdef\non@alpherr#1{\@latex@error{%
426 %    \end{macrocode}
427 % The command here will have a space at the end of its name, so we make
428 % sure not to insert an extra one.
429 %    \begin{macrocode}
430     \string#1allowed only in math mode}\@ehd}
431 %    \end{macrocode}
432 % \end{macro}
434 % \begin{macro}{\dorestore@version}
435 %    \begin{macrocode}
436 \def\dorestore@version
437  {\ifmmode
438     \aftergroup\dorestore@version
439   \else
440     \gdef\init@restore@version{%
441         \global\let\init@restore@version\relax
442         \xdef\restore@mathversion
443              {\expandafter\noexpand\csname mv@\math@version\endcsname
444               \global\csname c@mv@\math@version\endcsname
445               \number\csname c@mv@\math@version\endcsname\relax}%
446         \aftergroup\dorestore@version
447     }%
448     \begingroup
449       \let\getanddefine@fonts\@gobbletwo
450       \restore@mathversion
451     \endgroup
452   \fi}%
453 \@onlypreamble\dorestore@version
454 %    \end{macrocode}
455 % \end{macro}
457 % \begin{macro}{\document@select@group}
458 %    We surround |\select@group| with braces so that functions using it
459 %    can be used directly after |_| or |^|.
460 % \changes{v2.1p}{1994/12/10}{Surround with braces (add fourth arg)}
461 % \changes{v2.1q}{1995/04/02}{fix problem for pr/1275}
462 % \changes{v3.0g}{1997/11/20}
463 %      {(DPC) inline use of \cs{stepcounter} (faster, and saves a csname
464 %       per math version as no reset list)}
465 % \changes{v3.0q}{2015/03/18}{Introduce \cs{e@mathgroup@top}}
466 %    \begin{macrocode}
467 %</2ekernel>
468 %<latexrelease>\IncludeInRelease{2015/01/01}
469 %<latexrelease>  {\document@select@group}{\document@select@group}%
470 %<*2ekernel|latexrelease>
471 \def\document@select@group#1#2#3#4{%
472  \ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi
473  {%
474  \ifmmode
475    \ifnum\csname c@mv@\math@version\endcsname<\e@mathgroup@top
476      \begingroup
477        \escapechar\m@ne
478        \getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3%
479        \globaldefs\@ne  \math@fonts
480      \endgroup
481      \expandafter\extract@alph@from@version
482          \csname mv@\math@version\expandafter\endcsname
483          \expandafter{\number\csname
484                        c@mv@\math@version\endcsname}%
485           #1%
486      \global\advance\csname c@mv@\math@version\endcsname\@ne
487    \else
488      \let#1\relax
489      \@latex@error{Too many math alphabets used
490                    in version \math@version}%
491         \@eha
492   \fi
493  \else \expandafter\non@alpherr\fi
494  #1{#4}%
495  }%
497 %</2ekernel|latexrelease>
498 %<latexrelease>\EndIncludeInRelease
499 %<latexrelease>\IncludeInRelease{0000/00/00}
500 %<latexrelease>  {\document@select@group}{\document@select@group}%
501 %<latexrelease>\def\document@select@group#1#2#3#4{%
502 %<latexrelease> \ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi
503 %<latexrelease> {%
504 %<latexrelease> \ifmmode
505 %<latexrelease>   \ifnum\csname c@mv@\math@version\endcsname<\sixt@@n
506 %<latexrelease>     \begingroup
507 %<latexrelease>       \escapechar\m@ne
508 %<latexrelease>       \getanddefine@fonts
509 %<latexrelease>         {\csname c@mv@\math@version\endcsname}#3%
510 %<latexrelease>       \globaldefs\@ne  \math@fonts
511 %<latexrelease>     \endgroup
512 %<latexrelease>     \expandafter\extract@alph@from@version
513 %<latexrelease>         \csname mv@\math@version\expandafter\endcsname
514 %<latexrelease>         \expandafter{\number\csname
515 %<latexrelease>                       c@mv@\math@version\endcsname}%
516 %<latexrelease>          #1%
517 %<latexrelease>     \global\advance\csname c@mv@\math@version\endcsname\@ne
518 %<latexrelease>   \else
519 %<latexrelease>     \let#1\relax
520 %<latexrelease>     \@latex@error{Too many math alphabets used
521 %<latexrelease>                   in version \math@version}%
522 %<latexrelease>        \@eha
523 %<latexrelease>  \fi
524 %<latexrelease> \else \expandafter\non@alpherr\fi
525 %<latexrelease> #1{#4}%
526 %<latexrelease> }%
527 %<latexrelease>}
528 %<latexrelease>\EndIncludeInRelease
529 %<*2ekernel>
530 %    \end{macrocode}
531 % \end{macro}
533 % \begin{macro}{\process@table}
534 %    \begin{macrocode}
535 \def\process@table{%
536     \def\cdp@elt##1##2##3##4{%
537         \@font@info{Checking defaults for
538                   ##1/##2/##3/##4}%
539         \expandafter
540         \ifx\csname##1/##2/##3/##4\endcsname\relax
541 %    \end{macrocode}
542 %    Grouping is important for two reasons, first |\cdp@elt| will get
543 %    redefined if |\Declare...| functions are executed within the
544 %    external |.fd| file and secondly |\try@load@fontshape| changes a
545 %    lot of catcodes without surrounding itself with a group.
546 %    \begin{macrocode}
547           \begingroup
548            \def\f@encoding{##1}\def\f@family{##2}%
549            \try@load@fontshape
550           \endgroup
551         \fi
552         \expandafter
553         \ifx\csname##1/##2/##3/##4\endcsname\relax
554              \@latex@error{This NFSS system isn't set up properly}%
555                        {For encoding scheme ##1 the defaults
556                         ##2/##3/##4 do not form a valid font shape}%
557         \else
558              \@font@info{... okay}%
559         \fi}%
560     \cdp@list
561 %    \end{macrocode}
562 %    Now we make sure that |\error@fontshape| is okay.
563 %    \begin{macrocode}
564     \begingroup
565        \escapechar\m@ne
566        \error@fontshape
567        \expandafter\ifx\csname \curr@fontshape\endcsname\relax
568           \begingroup
569             \try@load@fontshape
570            \endgroup
571        \fi
572        \expandafter\ifx\csname \curr@fontshape\endcsname\relax
573          \@latex@error{This NFSS system isn't set up properly}%
574             {The system maintainer forgot to specify a suitable
575              substitution
576              font shape using the \noexpand\DeclareErrorFont
577              command}%
578        \fi
579     \endgroup
580 %    \end{macrocode}
581 %    Set |\select@group| to its meaning used within the document body.
582 %    \begin{macrocode}
583     \let\select@group\document@select@group
584 %    \end{macrocode}
585 %    Install the default font attributes they are currently pointing
586 %    to error font shape.
587 %    Don't use |\reset@font| since that would trigger |\selectfont|.
588 %    \begin{macrocode}
589     \fontencoding{\encodingdefault}%
590     \fontfamily{\familydefault}%
591     \fontseries{\seriesdefault}%
592     \fontshape{\shapedefault}%
593 %    \end{macrocode}
594 %    kill all macros not longer needed.
595 %    we need to add many more!!!!!!
596 %    \begin{macrocode}
597  \everyjob{}%
599 \@onlypreamble\process@table
600 %    \end{macrocode}
601 % \end{macro}
603 %    \begin{macrocode}
604 %\@onlypreamble\set@mathradical
605 %    \end{macrocode}
607 % \begin{macro}{\DeclareMathVersion}
608 %    \begin{macrocode}
609 \def\DeclareMathVersion#1{%
610   \expandafter\new@mathversion\csname mv@#1\endcsname}
611 \@onlypreamble\DeclareMathVersion
612 %    \end{macrocode}
613 % \end{macro}
615 % \begin{macro}{\new@mathversion}
616 % \changes{v3.0o}{2011/09/03}
617 %      {(Will) Remove \cs{global} before \cs{newcount} (unnecessary and caused etex bug).}
618 %    \begin{macrocode}
619 \def\new@mathversion#1{%
620   \expandafter\in@\expandafter#1\expandafter{\version@list}%
621   \ifin@
622     \@font@info{Redeclaring math version
623                `\expandafter\@gobblefour\string#1'}%
624   \else
625     \expandafter\newcount\csname c@\expandafter
626                                 \@gobble\string#1\endcsname
627     \def\version@elt{\noexpand\version@elt\noexpand}%
628     \edef\version@list{\version@list\version@elt#1}%
629   \fi
630 %    \end{macrocode}
631 %    |\toks@| is used to gather all tokens for the math version.
632 %    |\count@| will be used to count the math groups we add to this
633 %    version.
634 %    \begin{macrocode}
635   \toks@{}%
636   \count@\z@
637 %    \end{macrocode}
638 %    Now we loop over |\group@list| to add all math groups defined so
639 %    far to the version and at the same time to count them.
640 %    \begin{macrocode}
641   \def\group@elt##1##2{%
642        \advance\count@\@ne
643        \addto@hook\toks@{\getanddefine@fonts##1##2}%
644        }%
645   \group@list
646 %    \end{macrocode}
647 %    We set the counter for this math version to the number of math
648 %    groups found in |\group@list|.
649 %    \begin{macrocode}
650   \global\csname c@\expandafter\@gobble\string#1\endcsname\count@
651 %    \end{macrocode}
652 %    Now we loop over |\alpha@list| to add all math alphabets known so
653 %    far. We have to distinguish the case that an alphabet by default
654 %    should produce an error in new versions.
655 %    \begin{macrocode}
656   \def\alpha@elt##1##2##3{%
657        \ifx##2\no@alphabet@error
658          \toks@\expandafter{\the\toks@\install@mathalphabet##1%
659              {\no@alphabet@error##1}}%
660        \else
661          \toks@\expandafter{\the\toks@\install@mathalphabet##1%
662              {\select@group##1##2##3}}%
663        \fi
664           }%
665   \alpha@list
666 %    \end{macrocode}
667 %    Finally we define the math version to expand to the contents of
668 %    |\toks@|.
669 % \changes{v2.0e}{1993/08/18}{Exchanged names of encodings in warning
670 %              message of \cs{SetSymbolFont}.}
671 %    \begin{macrocode}
672   \xdef#1{\the\toks@}%
674 \@onlypreamble\new@mathversion
675 %    \end{macrocode}
676 % \end{macro}
678 % \begin{macro}{\DeclareSymbolFont}
679 %    \begin{macrocode}
680 \def\DeclareSymbolFont#1#2#3#4#5{%
681  \@tempswafalse
682  \edef\reserved@b{#2}%
683  \def\cdp@elt##1##2##3##4{\def\reserved@c{##1}%
684       \ifx\reserved@b\reserved@c \@tempswatrue\fi}%
685  \cdp@list
686  \if@tempswa
687    \@ifundefined{sym#1}{%
688 %    \end{macrocode}
690 % \changes{v3.0q}{2015/03/18}{Restrict Symbol fonts to 0-15}
691 %    \begin{macrocode}
692       \ifnum\count18<15 %
693         \expandafter\new@mathgroup\csname sym#1\endcsname
694         \expandafter\new@symbolfont\csname sym#1\endcsname
695                         {#2}{#3}{#4}{#5}%
696       \else
697          \@latex@error{Too many symbol fonts declared}\@eha
698       \fi
699      }%
700      {%
701 %    \end{macrocode}
703 %    \begin{macrocode}
704       \@font@info{Redeclaring symbol font `#1'}%
705 %    \end{macrocode}
706 % \changes{v3.0f}{1997/11/13}
707 %      {(DPC) Really update \cs{group@list} dont
708 %         leave new version in \cs{toks@}. latex/2661}
709 % Update the group list.
710 %    \begin{macrocode}
711       \def\group@elt##1##2{%
712            \noexpand\group@elt\noexpand##1%
713            \expandafter\ifx\csname sym#1\endcsname##1%
714              \expandafter\noexpand\csname#2/#3/#4/#5\endcsname
715            \else
716                \noexpand##2%
717            \fi}%
718       \xdef\group@list{\group@list}%
719 %    \end{macrocode}
720 % Update the version list.
721 %    \begin{macrocode}
722       \def\version@elt##1{%
723           \expandafter
724           \SetSymbolFont@\expandafter##1\csname#2/#3/#4/#5\expandafter
725               \endcsname \csname sym#1\endcsname
726           }%
727       \version@list
728      }%
729   \else
730     \@latex@error{Encoding scheme  `#2' unknown}\@eha
731   \fi
732   }
733 \@onlypreamble\DeclareSymbolFont
734 %    \end{macrocode}
735 % \end{macro}
737 % \begin{macro}{\group@list}
738 %    \begin{macrocode}
739 \let\group@list\@empty
740 \@onlypreamble\group@list
741 %    \end{macrocode}
742 % \end{macro}
744 % \begin{macro}{\group@elt}
745 %    \begin{macrocode}
746 \let\group@elt\relax
747 \@onlypreamble\group@elt
748 %    \end{macrocode}
749 % \end{macro}
751 % \begin{macro}{\new@symbolfont}
752 %    \begin{macrocode}
753 \def\new@symbolfont#1#2#3#4#5{%
754     \toks@\expandafter{\group@list}%
755     \edef\group@list{\the\toks@\noexpand\group@elt\noexpand#1%
756                      \expandafter\noexpand\csname#2/#3/#4/#5\endcsname}%
757     \def\version@elt##1{\toks@\expandafter{##1}%
758                    \edef##1{\the\toks@\noexpand\getanddefine@fonts
759                    #1\expandafter\noexpand\csname#2/#3/#4/#5\endcsname}%
760                   \global\advance\csname c@\expandafter
761                                  \@gobble\string##1\endcsname\@ne
762                  }%
763     \version@list
765 \@onlypreamble\new@symbolfont
766 %    \end{macrocode}
767 % \end{macro}
769 % \begin{macro}{\SetSymbolFont}
770 %    \begin{macrocode}
771 \def\SetSymbolFont#1#2#3#4#5#6{%
772  \@tempswafalse
773  \edef\reserved@b{#3}%
774  \def\cdp@elt##1##2##3##4{\def\reserved@c{##1}%
775       \ifx\reserved@b\reserved@c \@tempswatrue\fi}%
776  \cdp@list
777  \if@tempswa
778   \expandafter\SetSymbolFont@
779     \csname mv@#2\expandafter\endcsname\csname#3/#4/#5/#6\expandafter
780     \endcsname \csname sym#1\endcsname
781  \else
782   \@latex@error{Encoding scheme  `#3' unknown}\@eha
783  \fi
785 \@onlypreamble\SetSymbolFont
786 %    \end{macrocode}
787 % \end{macro}
789 % \begin{macro}{\SetSymbolFont@}
790 % \changes{v3.0l}{2007/08/31}{Font warning changed to info
791 %    for encoding change (pr/3975)}
792 %    \begin{macrocode}
793 \def\SetSymbolFont@#1#2#3{%
794   \expandafter\in@\expandafter#1\expandafter{\version@list}%
795   \ifin@
796     \expandafter\in@\expandafter#3\expandafter{\group@list}%
797     \ifin@
798       \begingroup
799         \expandafter\get@cdp\string#2\@nil\reserved@a
800         \toks@{}%
801         \def\install@mathalphabet##1##2{%
802              \addto@hook\toks@{\install@mathalphabet##1{##2}}%
803             }%
804         \def\getanddefine@fonts##1##2{%
805           \ifnum##1=#3%
806              \addto@hook\toks@{\getanddefine@fonts#3#2}%
807              \expandafter\get@cdp\string##2\@nil\reserved@b
808              \ifx\reserved@a\reserved@b\else
809                 \@font@info{Encoding `\reserved@b' has changed
810                     to `\reserved@a' for symbol font\MessageBreak
811                    `\expandafter\@gobblefour\string#3' in the
812                     math version `\expandafter
813                     \@gobblefour\string#1'}%
814              \fi
815              \@font@info{%
816                 Overwriting symbol font
817                 `\expandafter\@gobblefour\string#3' in
818                  version `\expandafter
819                 \@gobblefour\string#1'\MessageBreak
820                 \@spaces \expandafter\@gobble\string##2 -->
821                          \expandafter\@gobble\string#2}%
822           \else
823              \addto@hook\toks@{\getanddefine@fonts##1##2}%
824           \fi}%
825          #1%
826          \xdef#1{\the\toks@}%
827       \endgroup
828     \else
829        \@latex@error{Symbol font `\expandafter\@gobblefour\string#3'
830                   not defined}\@eha
831     \fi
832   \else
833     \@latex@error{Math version `\expandafter\@gobblefour\string#1'
834        is not
835        defined}{You probably misspelled the name of the math
836        version.^^JOr you have to specify an additional package.}%
837   \fi
839 \@onlypreamble\SetSymbolFont@
840 %    \end{macrocode}
841 % \end{macro}
843 % \begin{macro}{\get@cdp}
844 %    \begin{macrocode}
845 \def\get@cdp#1#2/#3\@nil#4{\def#4{#2}}
846 \@onlypreamble\get@cdp
847 %    \end{macrocode}
848 % \end{macro}
850 % \begin{macro}{\DeclareMathAlphabet}
851 % \changes{v3.0j}{2005/07/27}
852 %         {(MH) Make document commands robust}
853 %    \begin{macrocode}
854 \def\DeclareMathAlphabet#1#2#3#4#5{%
855  \@tempswafalse
856  \edef\reserved@b{#2}%
857  \def\cdp@elt##1##2##3##4{\def\reserved@c{##1}%
858       \ifx\reserved@b\reserved@c \@tempswatrue\fi}%
859  \cdp@list
860  \if@tempswa
861    \expandafter\ifx
862    \csname\expandafter\@gobble\string#1\endcsname
863    \relax
864       \new@mathalphabet#1{#2}{#3}{#4}{#5}%
865    \else
866 %    \end{macrocode}
867 %    Check if it is already a math alphabet.
868 %    \begin{macrocode}
869      \edef\reserved@a{\noexpand\in@{\string\select@group}%
870          {\expandafter\meaning\csname \expandafter
871           \@gobble\string#1\space\endcsname}}%
872      \reserved@a
873      \ifin@
874        \@font@info{Redeclaring math alphabet \string#1}%
875        \def\version@elt##1{%
876          \expandafter\SetMathAlphabet@\expandafter
877             ##1\csname#2/#3/#4/#5\expandafter\endcsname
878 %    \end{macrocode}
879 % \changes{???}{1994/04/18}{Pass correct arg (2 not 3)}
880 %    \begin{macrocode}
881             \csname M@#2\expandafter\endcsname
882             \csname \expandafter\@gobble\string#1\space\endcsname#1}%
883        \version@list
884      \else
885 %    \end{macrocode}
886 %    Check if it is a math alphabet defined via
887 %    |\DeclareSymbolFontAlphabet|.
888 %    \begin{macrocode}
889        \edef\reserved@a{\noexpand\in@{\string\use@mathgroup}%
890          {\expandafter\meaning\csname \expandafter
891           \@gobble\string#1\space\endcsname}}%
892        \reserved@a
893        \ifin@
894 %    \end{macrocode}
895 %    In that case overwriting is simple since there is nothing
896 %    inserted in the math version macros.
897 %    \begin{macrocode}
898          \@font@info{Redeclaring math alphabet \string#1}%
899          \new@mathalphabet#1{#2}{#3}{#4}{#5}%
900 %    \end{macrocode}
901 %    Otherwise panic.
902 %    \begin{macrocode}
903        \else
904          \@latex@error{Command `\string#1' already defined}\@eha
905        \fi
906      \fi
907   \fi
908  \else
909   \@latex@error{Encoding scheme  `#2' unknown}\@eha
910  \fi
911   }
912 \@onlypreamble\DeclareMathAlphabet
913 %    \end{macrocode}
914 % \end{macro}
916 % \begin{macro}{\new@mathalphabet}
917 % \changes{v3.0j}{2005/07/27}
918 %         {(MH) Make document commands robust}
919 %    \begin{macrocode}
920 \def\new@mathalphabet#1#2#3#4#5{%
921     \toks@\expandafter{\alpha@list}%
922     \edef#1{\expandafter\noexpand\csname \expandafter
923             \@gobble\string#1\space\endcsname
924             \if/#5/%
925                \noexpand\no@alphabet@error
926                \noexpand\no@alphabet@error
927             \else
928                \expandafter\noexpand\csname M@#2\endcsname
929                \expandafter\noexpand\csname#2/#3/#4/#5\endcsname
930             \fi
931            }%
932     \toks2\expandafter{#1}%
933     \edef\alpha@list{\the\toks@\noexpand\alpha@elt\the\toks2}%
934     \def\version@elt##1{\toks@\expandafter{##1}%
935                    \edef##1{\the\toks@\install@mathalphabet
936                             \expandafter\noexpand
937                             \csname \expandafter\@gobble
938                                \string#1\space\endcsname
939                            {\if/#5/%
940                              \noexpand\no@alphabet@error
941                              \noexpand#1%
942                             \else
943                              \noexpand\select@group\the\toks2
944                             \fi}}%
945                  }%
946     \version@list
947     \expandafter\edef\csname \expandafter\@gobble
948                 \string#1\space\endcsname{\if/#5/%
949               \noexpand\no@alphabet@error
950               \noexpand#1%
951             \else
952               \noexpand\select@group\the\toks2
953             \fi}%
954     \edef#1{\noexpand\protect
955             \expandafter\noexpand\csname \expandafter
956             \@gobble\string#1\space\endcsname}%
958 \@onlypreamble\new@mathalphabet
959 %    \end{macrocode}
960 % \end{macro}
962 % \begin{macro}{\SetMathAlphabet}
963 % \changes{v3.0j}{2005/07/27}
964 %         {(MH) Make document commands robust}
965 %    \begin{macrocode}
966 \def\SetMathAlphabet#1#2#3#4#5#6{%
967  \@tempswafalse
968  \edef\reserved@b{#3}%
969  \def\cdp@elt##1##2##3##4{\def\reserved@c{##1}%
970       \ifx\reserved@b\reserved@c \@tempswatrue\fi}%
971  \cdp@list
972  \if@tempswa
973   \expandafter\SetMathAlphabet@
974     \csname mv@#2\expandafter\endcsname\csname#3/#4/#5/#6\expandafter
975     \endcsname \csname M@#3\expandafter\endcsname
976     \csname \expandafter\@gobble\string#1\space\endcsname#1%
977  \else
978   \@latex@error{Encoding scheme  `#3' unknown}\@eha
979  \fi
981 \@onlypreamble\SetMathAlphabet
982 %    \end{macrocode}
983 % \end{macro}
985 % \begin{macro}{\SetMathAlphabet@}
986 %    \begin{macrocode}
987 \def\SetMathAlphabet@#1#2#3#4#5{%
988   \expandafter\in@\expandafter#1\expandafter{\version@list}%
989   \ifin@
990     \expandafter\in@\expandafter#4\expandafter{\alpha@list}%
991     \ifin@
992       \begingroup
993         \toks@{}%
994         \def\getanddefine@fonts##1##2{%
995              \addto@hook\toks@{\getanddefine@fonts##1##2}%
996             }%
997         \def\reserved@c##1##2##3##4{%                % for message below
998             \expandafter\@gobble\string##4}%
999         \def\install@mathalphabet##1##2{%
1000           \ifx##1#4%
1001              \addto@hook\toks@
1002                 {\install@mathalphabet#4{\select@group#4#3#2}}%
1003              \@font@info{Overwriting math alphabet
1004                 `\string#5' in version `\expandafter
1005                  \@gobblefour\string#1'\MessageBreak
1006                  \@spaces \reserved@c##2 -->
1007                         \expandafter\@gobble\string#2}%
1008           \else
1009              \addto@hook\toks@{\install@mathalphabet##1{##2}}%
1010           \fi
1011           }%
1012         #1%
1013         \xdef#1{\the\toks@}%
1014       \endgroup
1015     \else
1016 %    \end{macrocode}
1017 %    If the math alphabet was defined via |\DeclareSymbolFontAlphabet|
1018 %    we have remove its external definition and add it as a normal
1019 %    math alphabet to every version before trying to change it in one
1020 %    version.
1021 % \changes{v2.1b}{1994/03/11}{Changed parameter template in temporary
1022 %          macro to catch check add below.}
1023 %    \begin{macrocode}
1024        \edef\reserved@a{%
1025          \noexpand\in@{\string\use@mathgroup}{\meaning#4}}%
1026        \reserved@a
1027        \ifin@
1028          \def\reserved@b##1\use@mathgroup##2##3{%
1029              \def\reserved@b{##3}\def\reserved@c{##2}}%
1030          \expandafter\reserved@b#4%
1031          \begingroup
1032            \def\install@mathalphabet##1##2{%
1033                \addto@hook\toks@{\install@mathalphabet##1{##2}}%
1034                }%
1035             \def\getanddefine@fonts##1##2{%
1036               \addto@hook\toks@{\getanddefine@fonts##1##2}%
1037               \ifnum##1=\reserved@b
1038                  \expandafter
1039                  \addto@hook\expandafter\toks@
1040                  \expandafter{\expandafter\install@mathalphabet
1041                  \expandafter#4\expandafter
1042                        {\expandafter\select@group\expandafter
1043                          #4\reserved@c##2}}%
1044               \fi
1045                       }%
1046            \def\version@elt##1{%
1047                \toks@{}%
1048                ##1%
1049                \xdef##1{\the\toks@}%
1050               }%
1051            \version@list
1052          \endgroup
1053 %    \end{macrocode}
1054 %    Put it into the |\alpha@list| with default `error'
1055 %    \begin{macrocode}
1056          \expandafter\gdef\expandafter\alpha@list\expandafter
1057              {\alpha@list
1058               \alpha@elt #4\no@alphabet@error \no@alphabet@error}%
1059          \gdef#4{\no@alphabet@error #5}% fake things :-)
1060 %    \end{macrocode}
1061 %    Then call the internal setting routine again:
1062 %    \begin{macrocode}
1063          \SetMathAlphabet@{#1}{#2}{#3}#4#5%
1064        \else
1065          \@latex@error{Command `\string#5' not defined as a
1066                        math alphabet}%
1067             {Use \noexpand\DeclareMathAlphabet to define it.}%
1068        \fi
1069     \fi
1070   \else
1071     \@latex@error{Math version `\expandafter\@gobblefour\string#1'
1072        is not
1073        defined}{You probably misspelled the name of the math
1074        version.^^JOr you have to specify an additional package.}%
1075   \fi
1077 \@onlypreamble\SetMathAlphabet@
1078 %    \end{macrocode}
1079 % \end{macro}
1081 % \begin{macro}{\DeclareMathAlphabet}
1082 % could do with more checks like allowing single number in |#4|
1083 % lowercase in |#4| etc
1084 % \changes{v3.0r}{2016/02/18}
1085 %         {Check for mathaccent not \cs{mathaccemt}}
1086 %    \begin{macrocode}
1087 \def\DeclareMathAccent#1#2#3#4{%
1088   \expandafter\in@\csname sym#3\expandafter\endcsname
1089      \expandafter{\group@list}%
1090   \ifin@
1091     \begingroup
1092       \count\z@=#4\relax
1093       \count\tw@\count\z@
1094       \divide\count\z@\sixt@@n
1095       \count@\count\z@
1096       \multiply\count@\sixt@@n
1097       \advance\count\tw@-\count@
1098       \if\relax\noexpand#1% is command?
1099         \edef\reserved@a{\noexpand\in@
1100            {\expandafter\@gobble\string\mathaccent}{\meaning#1}}%
1101         \reserved@a
1102         \ifin@
1103           \expandafter\set@mathaccent
1104              \csname sym#3\endcsname#1#2%
1105              {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}%
1106           \@font@info{Redeclaring math accent \string#1}%
1107         \else
1108           \expandafter\ifx
1109           \csname\expandafter\@gobble\string#1\endcsname
1110           \relax
1111             \expandafter\set@mathaccent
1112                \csname sym#3\endcsname#1#2%
1113                {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}%
1114           \else
1115             \@latex@error{Command `\string#1' already defined}\@eha
1116           \fi
1117         \fi
1118       \else
1119        \@latex@error{Not a command name: `\noexpand#1'}\@eha
1120       \fi
1121     \endgroup
1122   \else
1123     \@latex@error{Symbol font `#3' is not defined}\@eha
1124   \fi
1126 \@onlypreamble\DeclareMathAccent
1127 %    \end{macrocode}
1128 % \end{macro}
1130 % \begin{macro}{\set@mathaccent}
1131 %    \begin{macrocode}
1132 \def\set@mathaccent#1#2#3#4{%
1133   \xdef#2{\mathaccent"\mathchar@type#3\hexnumber@#1#4\relax}}
1134 \@onlypreamble\set@mathaccent
1135 %    \end{macrocode}
1136 % \end{macro}
1138 % \begin{macro}{\DeclareMathSymbol}
1139 % \changes{v3.0r}{2016/02/18}
1140 %         {Check for mathchar not \cs{mathchar}}
1141 %    \begin{macrocode}
1142 \def\DeclareMathSymbol#1#2#3#4{%
1143   \expandafter\in@\csname sym#3\expandafter\endcsname
1144      \expandafter{\group@list}%
1145   \ifin@
1146     \begingroup
1147       \count\z@=#4\relax
1148       \count\tw@\count\z@
1149       \divide\count\z@\sixt@@n
1150       \count@\count\z@
1151       \multiply\count@\sixt@@n
1152       \advance\count\tw@-\count@
1153       \if\relax\noexpand#1% is command?
1154         \edef\reserved@a
1155           {\noexpand\in@{\expandafter\@gobble\string\mathchar}%
1156                         {\meaning#1}}%
1157         \reserved@a
1158         \ifin@
1159           \expandafter\set@mathsymbol
1160              \csname sym#3\endcsname#1#2%
1161              {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}%
1162           \@font@info{Redeclaring math symbol \string#1}%
1163         \else
1164             \expandafter\ifx
1165             \csname\expandafter\@gobble\string#1\endcsname
1166             \relax
1167             \expandafter\set@mathsymbol
1168                \csname sym#3\endcsname#1#2%
1169                {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}%
1170           \else
1171             \@latex@error{Command `\string#1' already defined}\@eha
1172           \fi
1173         \fi
1174       \else
1175         \expandafter\set@mathchar
1176           \csname sym#3\endcsname#1#2
1177           {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}%
1178       \fi
1179     \endgroup
1180   \else
1181     \@latex@error{Symbol font `#3' is not defined}\@eha
1182   \fi
1184 \@onlypreamble\DeclareMathSymbol
1185 %    \end{macrocode}
1186 % \end{macro}
1188 % \begin{macro}{\set@mathchar}
1189 %    \begin{macrocode}
1190 \def\set@mathchar#1#2#3#4{%
1191   \global\mathcode`#2="\mathchar@type#3\hexnumber@#1#4\relax}
1192 \@onlypreamble\set@mathchar
1193 %    \end{macrocode}
1194 % \end{macro}
1196 % \begin{macro}{\set@mathsymbol}
1197 %    \begin{macrocode}
1198 \def\set@mathsymbol#1#2#3#4{%
1199   \global\mathchardef#2"\mathchar@type#3\hexnumber@#1#4\relax}
1200 \@onlypreamble\set@mathsymbol
1201 %    \end{macrocode}
1202 % \end{macro}
1204 %    \begin{macrocode}
1205 %\def\mathsymbol#1#2#3{%
1206 %  \@tempcnta=#3\relax
1207 %  \@tempcntb\@tempcnta
1208 %  \divide\@tempcnta\sixt@@n
1209 %  \count@\@tempcnta
1210 %  \multiply\count@\sixt@@n
1211 %  \advance\@tempcntb-\count@
1212 %  \mathchar"\mathchar@type#1\hexnumber@#2%
1213 %             \hexnumber@\@tempcnta\hexnumber@\@tempcntb\relax}
1215 %\def\DeclareMathAlphabetCharacter#1#2#3{%
1216 %  \DeclareMathSymbol{#1}7{#2}{#3}}
1217 %    \end{macrocode}
1219 % \begin{macro}{\DeclareMathDelimiter}
1220 % \changes{v2.1m}{1994/11/18}
1221 %         {(DPC) \cs{expandafter} instead of \cs{next}}
1222 %    \begin{macrocode}
1223 \def\DeclareMathDelimiter#1{%
1224   \if\relax\noexpand#1%
1225     \expandafter\@DeclareMathDelimiter
1226   \else
1227     \expandafter\@xxDeclareMathDelimiter
1228   \fi
1229   #1}
1230 \@onlypreamble\DeclareMathDelimiter
1231 %    \end{macrocode}
1232 % \end{macro}
1234 % \begin{macro}{\@xxDeclareMathDelimiter}
1235 % \changes{v3.0h}{1998/04/15}{Macro added (pr/2662)}
1236 %    This macro checks if the second arg is a ``math type'' such
1237 %    as |\mathopen|. The undocumented original code didn't use math
1238 %    types when the delimiter was a single letter.
1239 %    For this reason the coding is a bit strange as it tries to
1240 %    support the undocumented syntax for compatibility reasons.
1241 %    \begin{macrocode}
1242 \def\@xxDeclareMathDelimiter#1#2#3#4{%
1243 %    \end{macrocode}
1244 %    7 is the default value returned in the case that |\mathchar@type|
1245 %    is passed something unexpected, like a math symbol font name.
1246 %    We locally move |\mathalpha| out of the way so if you use that
1247 %    the right branch is taken. This will still fail if an explicit
1248 %    number |7| is used!
1249 %    \begin{macrocode}
1250    \begingroup
1251     \let\mathalpha\mathord
1252     \ifnum7=\mathchar@type{#2}%
1253       \endgroup
1254 %    \end{macrocode}
1255 %    If this branch is taken we have old syntax (5 arguments).
1256 %    \begin{macrocode}
1257       \expandafter\@firstofone
1258     \else
1259 %    \end{macrocode}
1260 %    If this branch is taken |\mathchar@type| is different from 7 so
1261 %    we assume new syntax. In this case we also use the arguments to
1262 %    set up the letter as a math symbol for the case where it is not
1263 %    used as a delimiter.
1264 %    \begin{macrocode}
1265       \endgroup
1266       \DeclareMathSymbol#1{#2}{#3}{#4}%
1267 %    \end{macrocode}
1268 %    Then we arrange that |\@xDeclareMathDelimiter| only gets |#1|,
1269 %    |#3|, |#4| \ldots\ as it does not expect a math type as argument.
1270 %    \begin{macrocode}
1271       \expandafter\@firstoftwo
1272     \fi
1273     {\@xDeclareMathDelimiter#1}{#2}{#3}{#4}}
1274 \@onlypreamble\@xxDeclareMathDelimiter
1275 %    \end{macrocode}
1276 % \end{macro}
1278 % \begin{macro}{\@DeclareMathDelimiter}
1279 % \changes{v3.0r}{2016/02/18}
1280 %         {Check for delimiter not \cs{delimiter}}
1281 %    \begin{macrocode}
1282 \def\@DeclareMathDelimiter#1#2#3#4#5#6{%
1283   \expandafter\in@\csname sym#3\expandafter\endcsname
1284      \expandafter{\group@list}%
1285   \ifin@
1286     \expandafter\in@\csname sym#5\expandafter\endcsname
1287        \expandafter{\group@list}%
1288     \ifin@
1289       \begingroup
1290         \count\z@=#4\relax
1291         \count\tw@\count\z@
1292         \divide\count\z@\sixt@@n
1293         \count@\count\z@
1294         \multiply\count@\sixt@@n
1295         \advance\count\tw@-\count@
1296         \edef\reserved@c{\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}%
1297       %
1298         \count\z@=#6\relax
1299         \count\tw@\count\z@
1300         \divide\count\z@\sixt@@n
1301         \count@\count\z@
1302         \multiply\count@\sixt@@n
1303         \advance\count\tw@-\count@
1304         \edef\reserved@d{\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}%
1305       %
1306         \edef\reserved@a{\noexpand\in@
1307             {\expandafter\@gobble\string\delimiter}{\meaning#1}}%
1308         \reserved@a
1309         \ifin@
1310           \expandafter\set@mathdelimiter
1311              \csname sym#3\expandafter\endcsname
1312              \csname sym#5\endcsname#1#2%
1313              \reserved@c\reserved@d
1314           \@font@info{Redeclaring math delimiter \string#1}%
1315         \else
1316             \expandafter\ifx
1317             \csname\expandafter\@gobble\string#1\endcsname
1318             \relax
1319             \expandafter\set@mathdelimiter
1320               \csname sym#3\expandafter\endcsname
1321               \csname sym#5\endcsname#1#2%
1322               \reserved@c\reserved@d
1323           \else
1324             \@latex@error{Command `\string#1' already defined}\@eha
1325           \fi
1326         \fi
1327       \endgroup
1328     \else
1329       \@latex@error{Symbol font `#5' is not defined}\@eha
1330     \fi
1331   \else
1332     \@latex@error{Symbol font `#3' is not defined}\@eha
1333   \fi
1335 \@onlypreamble\@DeclareMathDelimiter
1336 %    \end{macrocode}
1337 % \end{macro}
1339 % \begin{macro}{\@xDeclareMathDelimiter}
1340 %    \begin{macrocode}
1341 \def\@xDeclareMathDelimiter#1#2#3#4#5{%
1342   \expandafter\in@\csname sym#2\expandafter\endcsname
1343      \expandafter{\group@list}%
1344   \ifin@
1345     \expandafter\in@\csname sym#4\expandafter\endcsname
1346        \expandafter{\group@list}%
1347     \ifin@
1348       \begingroup
1349         \count\z@=#3\relax
1350         \count\tw@\count\z@
1351         \divide\count\z@\sixt@@n
1352         \count@\count\z@
1353         \multiply\count@\sixt@@n
1354         \advance\count\tw@-\count@
1355         \edef\reserved@c{\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}%
1356       %
1357         \count\z@=#5\relax
1358         \count\tw@\count\z@
1359         \divide\count\z@\sixt@@n
1360         \count@\count\z@
1361         \multiply\count@\sixt@@n
1362         \advance\count\tw@-\count@
1363         \edef\reserved@d{\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}%
1364         \expandafter\set@@mathdelimiter
1365            \csname sym#2\expandafter\endcsname\csname sym#4\endcsname#1%
1366            \reserved@c\reserved@d
1367       \endgroup
1368     \else
1369       \@latex@error{Symbol font `#4' is not defined}\@eha
1370     \fi
1371   \else
1372     \@latex@error{Symbol font `#2' is not defined}\@eha
1373   \fi
1375 \@onlypreamble\@xDeclareMathDelimiter
1376 %    \end{macrocode}
1377 % \end{macro}
1379 % \begin{macro}{\set@mathdelimiter}
1380 %    We have to end the definition of a math delimiter like |\lfloor|
1381 %    with a space and not with |\relax| as we did before, because
1382 %    otherwise constructs involving |\abovewithdelims| will prematurely
1383 %    end (pr/1329)
1385 % \changes{v2.1q}{1995/04/02}{fix pr/1329}
1386 %    \begin{macrocode}
1387 \def\set@mathdelimiter#1#2#3#4#5#6{%
1388   \xdef#3{\delimiter"\mathchar@type#4\hexnumber@#1#5%
1389                                      \hexnumber@#2#6 }}
1390 \@onlypreamble\set@mathdelimiter
1391 %    \end{macrocode}
1392 % \end{macro}
1394 % \begin{macro}{\set@@mathdelimiter}
1395 %    \begin{macrocode}
1396 \def\set@@mathdelimiter#1#2#3#4#5{%
1397   \global\delcode`#3="\hexnumber@#1#4\hexnumber@#2#5\relax}
1398 \@onlypreamble\set@@mathdelimiter
1399 %    \end{macrocode}
1400 % \end{macro}
1402 % \begin{macro}{\DeclareMathRadical}
1403 %    \begin{macrocode}
1404 \def\DeclareMathRadical#1#2#3#4#5{%
1405 %    \end{macrocode}
1406 %    Below is a crude fix to make this macro work if |#1| is undefined
1407 %    or |\relax|.  Should be improved!
1408 % \changes{v2.1t}{1995/05/21}{Allow for undefined cs names}
1409 % \changes{v3.0r}{2016/02/18}
1410 %         {Check for radical not \cs{radical}}
1411 %    \begin{macrocode}
1412   \expandafter\ifx
1413        \csname\expandafter\@gobble\string#1\endcsname
1414        \relax
1415      \let#1\radical
1416   \fi
1417   \edef\reserved@a{\noexpand\in@
1418        {\expandafter\@gobble\string\radical}{\meaning#1}}%
1419   \reserved@a
1420   \ifin@
1421     \expandafter\in@\csname sym#2\expandafter\endcsname
1422        \expandafter{\group@list}%
1423     \ifin@
1424       \expandafter\in@\csname sym#4\expandafter\endcsname
1425          \expandafter{\group@list}%
1426       \ifin@
1427         \begingroup
1428           \count\z@=#3\relax
1429           \count\tw@\count\z@
1430           \divide\count\z@\sixt@@n
1431           \count@\count\z@
1432           \multiply\count@\sixt@@n
1433           \advance\count\tw@-\count@
1434           \edef\reserved@c{%
1435             \hexnumber@{\count\z@}\hexnumber@{\count\tw@}}%
1436           \count\z@=#5\relax
1437           \count\tw@\count\z@
1438           \divide\count\z@\sixt@@n
1439           \count@\count\z@
1440           \multiply\count@\sixt@@n
1441           \advance\count\tw@-\count@
1442           \edef\reserved@d{%
1443             \hexnumber@{\count\z@}\hexnumber@{\count\tw@}}%
1444 %    \end{macrocode}
1445 %    Coded inline instead of using |\set@mathradical|
1446 %    \begin{macrocode}
1447 %          \expandafter\set@mathradical
1448 %             \csname sym#2\expandafter\endcsname
1449 %             \csname sym#4\endcsname#1%
1450 %             \reserved@c\reserved@d
1451           \xdef#1{\radical"\expandafter\hexnumber@
1452                                 \csname sym#2\endcsname\reserved@c
1453                              \expandafter\hexnumber@
1454                                 \csname sym#4\endcsname\reserved@d
1455                   \relax}%
1456         \endgroup
1457       \else
1458         \@latex@error{Symbol font `#4' is not defined}\@eha
1459       \fi
1460     \else
1461       \@latex@error{Symbol font `#2' is not defined}\@eha
1462     \fi
1463   \else
1464     \@latex@error{Command `\string#1' already defined}\@eha
1465   \fi
1467 \@onlypreamble\DeclareMathRadical
1468 %    \end{macrocode}
1469 % \end{macro}
1471 % Definition below was wrong it contained |\delimiter| !
1473 %\begin{verbatim}
1474 %\def\set@mathradical#1#2#3#4#5{%
1475 %  \xdef#3{\radical"\hexnumber@#1#4\hexnumber@#2#5\relax}}
1476 %\end{verbatim}
1478 % \begin{macro}{\mathalpha}
1479 % just a dummy currently
1480 %    \begin{macrocode}
1481 \let\mathalpha\relax
1482 %    \end{macrocode}
1483 % \end{macro}
1485 % \begin{macro}{\mathchar@type}
1486 %    \begin{macrocode}
1487 \def\mathchar@type#1{%
1488   \ifodd 2#11 #1\else             % is this non-negative number?
1489     \ifx#1\mathord 0\else
1490      \ifx#1\mathop   1\else
1491        \ifx#1\mathbin 2\else
1492          \ifx#1\mathrel 3\else
1493            \ifx#1\mathopen 4\else
1494              \ifx#1\mathclose 5\else
1495                \ifx#1\mathpunct 6\else
1496                    7%             % anything else is variable ord
1497                \fi
1498              \fi
1499            \fi
1500          \fi
1501        \fi
1502      \fi
1503     \fi
1504   \fi}
1505 \@onlypreamble\mathchar@type
1506 %    \end{macrocode}
1507 % \end{macro}
1509 % \begin{macro}{\DeclareSymbolFontAlphabet}
1510 % \changes{v3.0j}{2005/07/27}
1511 %         {(MH) Make document commands robust}
1512 %    \begin{macrocode}
1513 \def\DeclareSymbolFontAlphabet#1#2{%
1514    \expandafter\DeclareSymbolFontAlphabet@
1515      \csname \expandafter\@gobble\string#1\space\endcsname{#2}#1}
1516 \@onlypreamble\DeclareSymbolFontAlphabet
1517 %    \end{macrocode}
1518 % \end{macro}
1520 % \begin{macro}{\DeclareSymbolFontAlphabet@}
1521 %    \begin{macrocode}
1522 \def\DeclareSymbolFontAlphabet@#1#2#3{%
1523 %    \end{macrocode}
1524 %    We use the switch |\if@tempswa| to decide if we can declare this
1525 %    symbol font alphabet.
1526 %    \begin{macrocode}
1527     \@tempswatrue
1528 %    \end{macrocode}
1529 %    First check if |#2| is known to be a symbol font
1530 %    \begin{macrocode}
1531   \expandafter\in@\csname sym#2\expandafter\endcsname
1532      \expandafter{\group@list}%
1533   \ifin@
1534 %    \end{macrocode}
1535 %    Check if |#1| is defined as a math alphabet defined via
1536 %    |\DeclareMathAlphabet|:
1537 %    \begin{macrocode}
1538     \expandafter\in@\expandafter#1\expandafter{\alpha@list}%
1539     \ifin@
1540 %    \end{macrocode}
1541 %    If so remove it from the |\alpha@list| and from all math version
1542 %    macros.
1543 %    \begin{macrocode}
1544       \@font@info{Redeclaring math alphabet \string#3}%
1545       \toks@{}%
1546       \def\alpha@elt##1##2##3{%
1547           \ifx##1#1\else\addto@hook\toks@{\alpha@elt##1##2##3}\fi}%
1548       \alpha@list
1549       \xdef\alpha@list{\the\toks@}%
1550 %    \end{macrocode}
1551 %    Now we loop over all versions and remove the math alphabet:
1552 %    \begin{macrocode}
1553       \def\version@elt##1{%
1554           \begingroup
1555             \toks@{}%
1556             \def\getanddefine@fonts####1####2{%
1557                \addto@hook\toks@{\getanddefine@fonts####1####2}}%
1558             \def\install@mathalphabet####1####2{%
1559                \ifx####1#1\else
1560                  \addto@hook\toks@{\install@mathalphabet
1561                                     ####1{####2}}\fi}%
1562             ##1%
1563             \xdef##1{\the\toks@}%
1564           \endgroup
1565           }%
1566       \version@list
1567     \else
1568 %    \end{macrocode}
1569 %    If |#3| is not defined as a math alphabet check if it is defined
1570 %    at all:
1571 %    \begin{macrocode}
1572       \expandafter\ifx
1573       \csname\expandafter\@gobble\string#1\space\endcsname
1574       \relax
1575 %    \end{macrocode}
1576 %    If it is undefined, fine otherwise check if it is a math alphabet
1577 %    defined via |\DeclareSymbolFontAlphabet|:
1578 %    \begin{macrocode}
1579       \else
1580         \edef\reserved@a{%
1581           \noexpand\in@{\string\use@mathgroup}{\meaning#1}}%
1582         \reserved@a
1583         \ifin@
1584           \@font@info{Redeclaring math alphabet \string#3}%
1585         \else
1586 %    \end{macrocode}
1587 %    Since the command |#3| is defined to be something which is not a
1588 %    math alphabet we have to skip redefining it.
1589 %    \begin{macrocode}
1590           \@tempswafalse
1591           \@latex@error{Command `\string#3' already defined}\@eha
1592         \fi
1593       \fi
1594     \fi
1595    \else
1596 %    \end{macrocode}
1597 %    Since the symbol font is not known we better skip defining this
1598 %    alphabet.
1599 %    \begin{macrocode}
1600      \@tempswafalse
1601      \@latex@error{Unknown symbol font `#2'}\@eha
1602    \fi
1603    \if@tempswa
1604 %    \end{macrocode}
1605 %    When we reach this point we are allowed to define |#1| to be a
1606 %    symbol font math alphabet. This means that we have to set it to
1607 %    \begin{quote}
1608 %      |\use@mathgroup| \meta{math-settings} |\sym|\meta{name}
1609 %    \end{quote}
1610 %    The \meta{math-settings} are the one for the encoding that is
1611 %    used in the font shape where |\sym|\meta{name} is pointing to.
1612 %    This means that we have to get it from the information stored in
1613 %    |\group@list|. Thus we loop through that list after defining
1614 %    |\group@elt| in a suitable way.
1615 % \changes{v2.1b}{1994/03/11}{Added check against use of alphabet
1616 %              switch outside of math mode.}
1617 %    \begin{macrocode}
1618      \def\group@elt##1##2{%
1619         \expandafter\ifx\csname sym#2\endcsname##1%
1620         \expandafter\reserved@a\string##2\@nil
1621         \fi}%
1622      \def\reserved@a##1##2/##3\@nil{%
1623         \def\reserved@a{##2}}%
1624      \group@list
1625      \toks@{\relax\ifmmode \else \non@alpherr#1\fi}%
1626      \edef#1{\the\toks@
1627              \noexpand\use@mathgroup
1628              \expandafter\noexpand\csname M@\reserved@a\endcsname
1629              \csname sym#2\endcsname}%
1630      \def#3{\protect#1}%
1631    \fi
1633 \@onlypreamble\DeclareSymbolFontAlphabet@
1634 %</2ekernel>
1635 %    \end{macrocode}
1636 %  \end{macro}
1638 % \Finale