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