1 % \iffalse meta-comment
4 % The LaTeX3 Project and any individual authors listed elsewhere
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 % http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2005/12/01 or later.
18 % This file has the LPPL maintenance status "maintained".
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
24 % The list of derived (unpacked) files belonging to the distribution
25 % and covered by LPPL is defined by the unpacking scripts (with
26 % extension .ins) which are part of the distribution.
30 %%% From File: ltplain.dtx
34 \ProvidesFile{ltplain.dtx}
35 [2015/11/18 v2.2b LaTeX Kernel (Plain TeX)]
37 \documentclass{ltxdoc}
38 \GetFileInfo{ltplain.dtx}
40 \title{\filename\\(The file plain.tex, modified for \LaTeX)}
41 \author{Donald~E.~Knuth\\
43 Leslie Lamport, Frank Mittelbach,\\
44 Rainer Sch\"opf, David Carlisle}
46 \MaintainedByLaTeXTeam{latex}
55 % \changes{v1.0a}{1994/03/08}
56 % {Remove need for a driver file.}
57 % \changes{v1.0b}{1994/03/12}
58 % {Name changed from lplain. The end of an era}
59 % \changes{v1.0e}{1994/03/12}{Replaced remaining width, height, depth
60 % by \LaTeX{} macro names to save tokens.}
61 % \changes{v1.1a}{1994/10/14}
62 % {Moved code to other files.}
63 % \changes{v1.1b}{1994/11/10}
64 % {(CAR) added patch to \cs{loop}.}
65 % \changes{v1.1f}{1994/11/25}
66 % {(DPC) Comment out lots of obsolete code}
67 % \changes{v1.1g}{1994/12/01}
68 % {(DPC) More doc changes}
69 % \changes{v1.1j}{1995/05/07}{Use \cs{hb@xt@}}
70 % \changes{v1.1j}{1995/05/21}{Moved some code to other files}
71 % \changes{v1.1n}{1995/07/02}{Removed surplus `by' and `\quotechar=' in
73 % \changes{v1.1o}{1995/09/14}{Moved \cs{multispan} to lttab.dtx}
74 % \changes{v1.1r}{1995/10/10}{Autoload tracing code}
75 % \changes{v1.1u}{1996/10/28}{(CAR) More doc changes}
76 % \changes{v2.0e}{2015/02/21}{Removed autoload code}
78 % \section{Plain \TeX}
80 % \LaTeX\ includes almost all of the functionality of Knuth's original
81 % `Basic Macros' That is, the plain \TeX\ format described in Appendix~B
82 % of the \TeX{}Book. However, some of the user commands are not much
83 % use so, in order to save memory, we may remove them from the kernel
84 % into a package. Here is a list of the commands that may be removed
85 % (PROBABLY NOT COMPLETE).
87 % \magstep \magstephalf
93 % This file is by now very small as most of it has been moved to more
94 % appropriate kernel files: it may disappear completely one day.
96 % \LaTeX\ font definitions are done using NFSS2 so none of PLAIN's
97 % font definitions are in \LaTeX.
99 % \LaTeX\ has its own tabbing environment, so PLAIN's is disabled.
101 % \LaTeX{} uses its own output routine, so most of the plain one was
109 \catcode`\{=1 % left brace is begin-group character
110 \catcode`\}=2 % right brace is end-group character
111 \catcode`\$=3 % dollar sign is math shift
112 \catcode`\&=4 % ampersand is alignment tab
113 \catcode`\#=6 % hash mark is macro parameter character
114 \catcode`\^=7 % circumflex and uparrow are for superscripts
115 \catcode`\_=8 % underline and downarrow are for subscripts
116 \catcode`\^^I=10 % ascii tab is a blank space
117 \chardef\active=13 \catcode`\~=\active % tilde is active
118 \catcode`\^^L=\active \outer\def^^L{\par}% ascii form-feed is \outer\par
125 % We had to define the |\catcodes| right away, before the message line,
126 % since |\message| uses the |{| and |}| characters.
127 % When INITEX (the \TeX\ initializer) starts up,
128 % it has defined the following |\catcode| values:\\
129 % |\catcode`\^^@=9 % | ascii null is ignored\\
130 % |\catcode`\^^M=5 % | ascii return is end-line\\
131 % |\catcode`\\=0 % | backslash is TeX escape character\\
132 % |\catcode`\%=14 % | percent sign is comment character\\
133 % |\catcode`\ =10 % | ascii space is blank space\\
134 % |\catcode`\^^?=15 %| ascii delete is invalid\\
135 % |\catcode`\A=11 ... \catcode`\Z=11 %| uppercase letters\\
136 % |\catcode`\a=11 ... \catcode`\z=11 %| lowercase letters\\
137 % all others are type 12 (other)
139 % Here is a list of the characters that have been specially catcoded:
141 \def\dospecials{\do\ \do\\\do\{\do\}\do\$\do\&%
142 \do\#\do\^\do\_\do\%\do\~}
144 % (not counting ascii null, tab, linefeed, formfeed, return, delete)
145 % Each symbol in the list is preceded by \do, which can be defined
146 % if you want to do something to every item in the list.
148 % We make |@| signs act like letters, temporarily, to avoid conflict
149 % between user names and internal control sequences of plain format.
154 % To make the plain macros more efficient in time and space,
155 % several constant values are declared here as control sequences.
156 % If they were changed, anything could happen;
157 % so they are private symbols.
158 % \begin{macro}{\@ne}
159 % \begin{macro}{\tw@}
160 % \begin{macro}{\thr@@}
161 % \begin{macro}{\sixt@@n}
162 % \begin{macro}{\@cclv}
163 % Small constants are defined using |\chardef|.
177 % \begin{macro}{\@cclvi}
180 % \begin{macro}{\@MM}
181 % Constants above 255 defined using |\mathchardef|.
183 \mathchardef\@cclvi=256
185 \mathchardef\@M=10000
186 \mathchardef\@MM=20000
193 % Allocation of registers
195 % Here are macros for the automatic allocation of |\count|, |\box|,
196 % |\dimen|, |\skip|, |\muskip|, and |\toks| registers, as well as
197 % |\read| and |\write| stream numbers, |\fam| codes, |\language| codes,
198 % and |\insert| numbers.
204 % When a register is used only temporarily, it need not be allocated;
205 % grouping can be used, making the value previously in the register
206 % return after the close of the group. The main use of these macros is
207 % for registers that are defined by one macro and used by others,
208 % possibly at different nesting levels. All such registers should be
209 % defined through these macros; otherwise conflicts may occur,
210 % especially when two or more macro packages are being used at
213 % \begin{oldcomments}
214 % The following counters are reserved:
215 % 0 to 9 page numbering
216 % 10 count allocation
217 % 11 dimen allocation
219 % 13 muskip allocation
222 % 16 read file allocation
223 % 17 write file allocation
224 % 18 math family allocation
225 % 19 language allocation
226 % 20 insert allocation
227 % 21 the most recently allocated number
231 % New counters are allocated starting with 23, 24, etc. Other registers
232 % are allocated starting with 10. This leaves 0 through 9 for the user
233 % to play with safely, except that counts 0 to 9 are considered to be
234 % the page and subpage numbers (since they are displayed during
235 % output). In this scheme, |\count| 10 always contains the number of the
236 % highest-numbered counter that has been allocated, |\count| 14 the
237 % highest-numbered box, etc. Inserts are given numbers 254, 253, etc.,
238 % since they require a |\count|, |\dimen|, |\skip|, and |\box| all with
239 % the same number; |\count| 20 contains the lowest-numbered insert that
240 % has been allocated. Of course, |\box|255 is reserved for |\output|;
241 % |\count|255, |\dimen|255, and |\skip|255 can be used freely.
243 % It is recommended that macro designers always use
244 % |\global| assignments with respect to registers numbered\\
246 % and always non-|\global| assignments with respect to registers\\
247 % 0, 2, 4, 6, 8, 255.\\
248 % This will prevent ``save stack buildup'' that might otherwise occur.
251 \count10=22 % allocates \count registers 23, 24, ...
252 \count11=9 % allocates \dimen registers 10, 11, ...
253 \count12=9 % allocates \skip registers 10, 11, ...
254 \count13=9 % allocates \muskip registers 10, 11, ...
255 \count14=9 % allocates \box registers 10, 11, ...
256 \count15=9 % allocates \toks registers 10, 11, ...
257 \count16=-1 % allocates input streams 0, 1, ...
258 \count17=-1 % allocates output streams 0, 1, ...
259 \count18=3 % allocates math families 4, 5, ...
260 \count19=0 % allocates \language codes 1, 2, ...
261 \count20=255 % allocates insertions 254, 253, ...
264 % \begin{macro}{\insc@unt}
265 % \begin{macro}{\allocationnumber}
266 % The insertion counter and most recent allocation.
268 \countdef\insc@unt=20
269 \countdef\allocationnumber=21
274 % \begin{macro}{\m@ne}
277 \countdef\m@ne=22 \m@ne=-1
281 % \begin{macro}{\wlog}
282 % Write on log file (only)
284 \def\wlog{\immediate\write\m@ne}
288 % \begin{macro}{\count@}
289 % \begin{macro}{\dimen@}
290 % \begin{macro}{\dimen@i}
291 % \begin{macro}{\dimen@ii}
292 % \begin{macro}{\skip@}
293 % \begin{macro}{\toks@}
294 % Here are abbreviations for the names of scratch registers
295 % that don't need to be allocated.
299 \dimendef\dimen@i=1 % global only
311 % \begin{macro}{\newcount}
312 % \begin{macro}{\newdimen}
313 % \begin{macro}{\newskip}
314 % \begin{macro}{\newmuskip}
315 % \begin{macro}{\newbox}
316 % \begin{macro}{\newread}
317 % \begin{macro}{\newwrite}
318 % \begin{macro}{\newlanguage}
319 % \changes{v1.0c}{1994/03/28}
320 % {Remove some \cs{outer} declarations.}
321 % \changes{v1.1h}{1995/04/24}
322 % {Remove remaining \cs{outer} declarations.}
323 % Now, we define |\newcount|, |\newbox|, etc. so that you can say
324 % |\newcount\foo| and |\foo| will be defined (with |\countdef|) to
325 % be the next counter.
327 % To find out which counter |\foo| is, you can look at
328 % |\allocationnumber|.
330 % Since there's no |\boxdef| command, |\chardef| is used to define a
331 % |\newbox|, |\newinsert|, |\newfam|, and so on.
333 % \LaTeX\ change: remove |\outer| from |\newcount| and |\newdimen| (FMi)
334 % This is necessary to use |\newcount| inside |\if...|
335 % later on. Also remove from |\newskip|, |\newbox|
336 % |\newwrite| and |\newfam| (DPC) to save later redefinition.
337 % \changes{v2.0a}{2014/12/30}{New engine-specific allocation scheme (latexrelease)}
338 % \changes{v2.0f}{2015/03/02}{allow 255 math groups in Unicode engines}
339 % \changes{v2.0h}{2015/06/19}{Use $-1$ for first range to get contiguous allocation}
342 %<*2ekernel|latexrelease>
343 %<latexrelease>\IncludeInRelease{2015/01/01}%
344 %<latexrelease> {\newcount}{Extended Allocation}%
348 \def\newcount {\e@alloc\count \countdef {\count10}\insc@unt\float@count}
349 \def\newdimen {\e@alloc\dimen \dimendef {\count11}\insc@unt\float@count}
350 \def\newskip {\e@alloc\skip \skipdef {\count12}\insc@unt\float@count}
352 {\e@alloc\muskip\muskipdef{\count13}\m@ne\e@alloc@top}
354 % For compatibility use |\chardef| in the classical range.
356 \def\newbox {\e@alloc\box
357 {\ifnum\allocationnumber<\@cclvi
360 \expandafter\e@alloc@chardef
362 {\count14}\insc@unt\float@count}
363 \def\newtoks {\e@alloc\toks \toksdef{\count15}\m@ne\e@alloc@top}
364 \def\newread {\e@alloc\read \chardef{\count16}\m@ne\sixt@@n}
367 % \changes{v2.2a}{2015/11/18}
368 % {Extended stream allocation in luatex (0.85)}
369 % \changes{v2.2b}{2015/11/19}
370 % {Only extend allocation of write streams (see luatex list)}
371 % Skip |\write18| due to its traditional use as a shell-escape.
373 \ifx\directlua\@undefined
374 \def\newwrite {\e@alloc\write \chardef{\count17}\m@ne\sixt@@n}
376 \def\newwrite {\e@alloc\write
377 {\ifnum\allocationnumber=18 \allocationnumber19\fi
387 {\e@alloc\mathgroup\chardef{\count18}\m@ne\e@mathgroup@top}
388 \def\newlanguage {\e@alloc\language \chardef{\count19}\m@ne\@cclvi}
389 \let\newfam\new@mathgroup
390 %</2ekernel|latexrelease>
394 %<latexrelease>\EndIncludeInRelease
395 %<latexrelease>\IncludeInRelease{0000/00/00}%
396 %<latexrelease> {\newcount}{Extended Allocation}%
397 %<latexrelease>\def\newcount{\alloc@0\count\countdef\insc@unt}
398 %<latexrelease>\def\newdimen{\alloc@1\dimen\dimendef\insc@unt}
399 %<latexrelease>\def\newskip{\alloc@2\skip\skipdef\insc@unt}
400 %<latexrelease>\def\newmuskip{\alloc@3\muskip\muskipdef\@cclvi}
401 %<latexrelease>\def\newbox{\alloc@4\box\chardef\insc@unt}
402 %<latexrelease>\def\newtoks{\alloc@5\toks\toksdef\@cclvi}
403 %<latexrelease>\def\newread{\alloc@6\read\chardef\sixt@@n}
404 %<latexrelease>\def\newwrite{\alloc@7\write\chardef\sixt@@n}
405 %<latexrelease>\def\new@mathgroup{\alloc@8\fam\chardef\sixt@@n}
406 %<latexrelease>\def\newlanguage{\alloc@9\language\chardef\@cclvi}
407 %<latexrelease>\let\newfam\new@mathgroup
408 %<latexrelease>\EndIncludeInRelease
419 %\begin{macro}{\e@alloc@chardef}
420 % \changes{v2.0a}{2014/12/30}{macro added}
421 %\begin{macro}{\e@alloc@top}
422 % \changes{v2.0a}{2014/12/30}{macro added}
423 % The upper limit of extended registers, which leaves
424 % this number (eg |\dimen32767|) always unallocated
426 % cf traditional |\dimen255|.
428 %<*2ekernel|latexrelease>
429 %<latexrelease>\IncludeInRelease{2015/01/01}%
430 %<latexrelease> {\e@alloc@chardef}{Extended Allocation}%
434 \ifx\directlua\@undefined
435 \ifx\widowpenalties\@undefined
437 % classic tex has $2^8$ registers.
439 \mathchardef\e@alloc@top=255
440 \let\e@alloc@chardef\chardef
443 % etex and xetex have $2^{15}$ registers.
445 \mathchardef\e@alloc@top=32767
446 \let\e@alloc@chardef\mathchardef
450 % luatex has $2^{16}$ registers.
452 \chardef\e@alloc@top=65535
453 \let\e@alloc@chardef\chardef
458 %</2ekernel|latexrelease>
459 %<latexrelease>\EndIncludeInRelease
460 %<latexrelease>\IncludeInRelease{0000/00/00}%
461 %<latexrelease> {\e@alloc@chardef}{Extended Allocation}%
462 %<latexrelease>\let\e@alloc@top\@undefined
463 %<latexrelease>\let\e@alloc@chardef\@undefined
464 %<latexrelease>\EndIncludeInRelease
469 %\begin{macro}{\e@mathgroup@top}
470 % \changes{v2.0f}{2015/03/02}{macro added}
471 % The upper limit of extended math groups (|\fam|)
472 % 16 in classic \TeX\ and e-\TeX, but 256 in Unicode TeX variants.
474 %<*2ekernel|latexrelease>
475 %<latexrelease>\IncludeInRelease{2015/01/01}%
476 %<latexrelease> {\e@mathgroup@top}{Extended Allocation}%
480 \ifx\Umathcode\@undefined
482 % classic and e tex have 16 fam (0--15).
484 \chardef\e@mathgroup@top=16
487 % xetex and luatex have 256 fam (0--255).
489 \chardef\e@mathgroup@top=256
494 %</2ekernel|latexrelease>
495 %<latexrelease>\EndIncludeInRelease
496 %<latexrelease>\IncludeInRelease{0000/00/00}%
497 %<latexrelease> {\e@mathgroup@top}{Extended Allocation}%
498 %<latexrelease>\let\e@mathgroup@top\@undefined
499 %<latexrelease>\EndIncludeInRelease
503 % \begin{macro}{\e@alloc}
504 % \changes{v2.0a}{2014/12/30}{macro added}
505 % A modified version of |\alloc@| that
506 % takes the count register rather than just the final digit of its number
507 % (assuming |\count|$1x$).
508 % It also has an extra argument to give the top of the extended range.
510 % | #1 #2 #3 #4 #5 #6 |
512 % | \e@alloc type defcmd current top extended-top newname|
514 % Note that if just a single allocation range is required
515 % (not omitting a range up to 255 for inserts) then $-1$
516 % should be used for the first upper bound argument, |#4|.
519 %<*2ekernel|latexrelease>
520 %<latexrelease>\IncludeInRelease{2015/01/01}{\e@alloc}{Extended Allocation}%
523 % \changes{v2.0h}{2015/06/19}{extra braces in case arguments not single token}
525 \def\e@alloc#1#2#3#4#5#6{%
526 \global\advance#3\@ne
527 \e@ch@ck{#3}{#4}{#5}#1%
528 \allocationnumber#3\relax
529 \global#2#6\allocationnumber
530 \wlog{\string#6=\string#1\the\allocationnumber}}%
534 %</2ekernel|latexrelease>
535 %<latexrelease>\EndIncludeInRelease
536 %<latexrelease>\IncludeInRelease{0000/00/00}{\e@alloc}{Extended Allocation}%
537 %<latexrelease>\let\e@alloc\@undefined
538 %<latexrelease>\EndIncludeInRelease
543 %\begin{macro}{\e@ch@ck}
544 % \changes{v2.0a}{2014/12/30}{macro added}
545 % Extended check command.
546 % If the first range is exceeded, bump to 256 (or 266 for counts)
547 % and try again, testing the extended range.
548 %\begin{macro}{\extrafloats}
549 % \changes{v2.0a}{2014/12/30}{macro added}
550 % \changes{v2.0c}{2015/01/23}{reserve counts 256--265}
551 % Allocate matching registers from the top of the extended range
552 % and add to |\@freelist|.
555 %<*2ekernel|latexrelease>
556 %<latexrelease>\IncludeInRelease{2015/10/01}
557 %<latexrelease> {\e@ch@ck}{Extended Allocation (checking)}%
561 \gdef\e@ch@ck#1#2#3#4{%
565 % If we've reached the classical top limit, bump to 256
566 % or 266 for counts (count 256--265 are reserved by the allocation
568 % \changes{v2.1b}{2015/10/27}
569 % {Use global assignment when switching to extended range}
573 \ifx\count#4\global\advance#1 10 \fi
576 % Check we are below the extended limit.
577 % \changes{v2.0i}{2015/08/06}
578 % {Add \cs{string} in case argument is not an unexpandable primitive}
582 \errmessage{No room for a new \string#4}%
585 %<latexrelease>\EndIncludeInRelease
586 %<latexrelease>\IncludeInRelease{2015/01/01}%
587 %<latexrelease> {\e@ch@ck}{Extended Allocation (checking)}%
588 %<latexrelease>\gdef\e@ch@ck#1#2#3#4{%
589 %<latexrelease> \ifnum#1<#2\else
590 %<latexrelease> \ifnum#1=#2\relax
591 %<latexrelease> #1\@cclvi
592 %<latexrelease> \ifx\count#4\advance#1 10 \fi
594 %<latexrelease> \ifnum#1<#3\relax
595 %<latexrelease> \else
596 %<latexrelease> \errmessage{No room for a new #4}%
598 %<latexrelease> \fi}%
599 %<latexrelease>\EndIncludeInRelease
600 %<latexrelease>\IncludeInRelease{0000/00/00}%
601 %<latexrelease> {\e@ch@ck}{Extended Allocation (checking)}%
602 %<latexrelease>\let\e@ch@ck\@undefined
603 %<latexrelease>\EndIncludeInRelease
607 %<latexrelease>\IncludeInRelease{2015/01/01}%
608 %<latexrelease> {\extrafloats}{Extra floats}%
613 \let\float@count\e@alloc@top
616 % \begin{macro}{\extrafloats}
618 \ifx\numexpr\@undefined
620 % In classic TeX use |\newinsert| to allocate float boxes.
625 \newinsert\reserved@a
627 \csname bx@\the\allocationnumber\endcsname\allocationnumber
628 \@cons\@freelist{\csname bx@\the\allocationnumber\endcsname}%
630 \expandafter\extrafloats
639 % In e-tex take float boxes from the top of the extended range.
643 \count@\numexpr\float@count-1\relax
648 \e@alloc@chardef\float@count\count@
649 \expandafter\e@alloc@chardef
650 \csname bx@\the\float@count\endcsname\float@count
651 \@cons\@freelist{\csname bx@\the\float@count\endcsname}%
653 \extrafloats\expandafter{\numexpr#1-1\relax}%
662 %</2ekernel|latexrelease>
663 %<latexrelease>\EndIncludeInRelease
664 %<latexrelease>\IncludeInRelease{0000/00/00}%
665 %<latexrelease> {\extrafloats}{Extra floats}%
666 %<latexrelease>\let\float@count\@undefined
667 %<latexrelease>\let\extrafloats\@undefined
668 %<latexrelease>\EndIncludeInRelease
674 % \begin{macro}{\alloc@}
676 \def\alloc@#1#2#3#4#5{\global\advance\count1#1\@ne
677 \ch@ck#1#4#2% make sure there's still room
678 \allocationnumber\count1#1%
679 \global#3#5\allocationnumber
680 \wlog{\string#5=\string#2\the\allocationnumber}}
684 % \begin{macro}{\newinsert}
685 % \changes{v2.1a}{2015/08/30}{new \cs{newinsert} implementation}
688 %<*2ekernel|latexrelease>
689 %<latexrelease>\IncludeInRelease{2015/10/01}
690 %<latexrelease> {\newinsert}{Extended \newinsert}%
693 \ifx\numexpr\@undefined
695 % If e-\TeX\ is not available use the original plain \TeX\
696 % definition of |\newinsert|.
698 \def\newinsert#1{\global\advance\insc@unt \m@ne
699 \ch@ck0\insc@unt\count
700 \ch@ck1\insc@unt\dimen
701 \ch@ck2\insc@unt\skip
703 \allocationnumber\insc@unt
704 \global\chardef#1\allocationnumber
705 \wlog{\string#1=\string\insert\the\allocationnumber}}
710 % The highest register allowed with |\insert|.
712 \ifx\directlua\@undefined
713 \chardef\e@insert@top255
715 \chardef\e@insert@top\e@alloc@top
718 % If the classic registers are exausted, take an insert from the free float list
719 % and use |\extrafloats| to add a new float to that list.
723 \ifnum\count10<\insc@unt
724 \ifnum\count11<\insc@unt
725 \ifnum\count12<\insc@unt
726 \ifnum\count14<\insc@unt
730 \global\advance\insc@unt\m@ne
731 \allocationnumber\insc@unt
734 \@next\@currbox\@freelist
735 {\ifnum\@currbox<\e@insert@top
736 \allocationnumber\@currbox
740 {\ch@ck0\m@ne\insert}%
742 \global\chardef#1\allocationnumber
743 \wlog{\string#1=\string\insert\the\allocationnumber}%
748 %</2ekernel|latexrelease>
752 %<latexrelease>\EndIncludeInRelease
753 %<latexrelease>\IncludeInRelease{0000/00/00}%
754 %<latexrelease> {\newinsert}{Extended \newinsert}%
755 %<latexrelease>\let\e@insert@top\@undefined
756 %<latexrelease>\def\newinsert#1{\global\advance\insc@unt \m@ne
757 %<latexrelease> \ch@ck0\insc@unt\count
758 %<latexrelease> \ch@ck1\insc@unt\dimen
759 %<latexrelease> \ch@ck2\insc@unt\skip
760 %<latexrelease> \ch@ck4\insc@unt\box
761 %<latexrelease> \allocationnumber\insc@unt
762 %<latexrelease> \global\chardef#1\allocationnumber
763 %<latexrelease> \wlog{\string#1=\string\insert\the\allocationnumber}}
764 %<latexrelease>\EndIncludeInRelease
769 % \begin{macro}{\ch@ck}
772 \ifnum\count1#1<#2\else
773 \errmessage{No room for a new #3}%
778 % \changes{v2.0h}{2015/06/19}{delete spurious old definition of \cs{newtoks}}
779 % \begin{macro}{\newhelp}
781 \def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}}
785 % \begin{macro}{\maxdimen}
786 % \begin{macro}{\hideskip}
787 % Here are some examples of allocation.
789 \newdimen\maxdimen \maxdimen=16383.99999pt % the largest legal <dimen>
790 \newskip\hideskip \hideskip=-1000pt plus 1fill % negative but can grow
797 % \begin{macro}{\z@skip}
798 % \begin{macro}{\voidb@x}
800 \newdimen\p@ \p@=1pt % this saves macro space and time
801 \newdimen\z@ \z@=0pt % can be used both for 0pt and 0
802 \newskip\z@skip \z@skip=0pt plus0pt minus0pt
803 \newbox\voidb@x % permanently void box register
810 % \changes{v1.1p}{1995/10/02}{Move \cs{newif} to ltdefns}
813 \message{compatibility for TeX 2, }
816 % If this file is used in an old \TeX\ we define the new features
817 % of \TeX\ 3.0 as simple macros or counters so that files that uses
818 % these features can be processed in such an environment
819 % (They will however produce some other results).
822 \ifx\@undefined\inputlineno
823 \newcount\inputlineno
825 % This could be used to detect that an old \TeX\ is in force
829 % Extra test for MLTeX 2, RmS 91/11/07.
831 \ifx\@undefined\language
834 \newcount\lefthyphenmin
835 \newcount\righthyphenmin
836 \newcount\errorcontextlines
837 \newcount\holdinginserts
838 \newdimen\emergencystretch
840 \let\noboundary\relax
841 \newcount\setlanguage
845 % Assign initial values to \TeX's parameters
848 \message{parameters,}
851 % All of \TeX's numeric parameters are listed here,
852 % but the code is commented out if no special value needs to be set.
853 % INITEX makes all parameters zero except where noted.
855 % \begin{oldcomments}
858 \tolerance=200 % INITEX sets this to 10000
868 \displaywidowpenalty=50
870 \predisplaypenalty=10000
872 % \postdisplaypenalty=0
873 % \interlinepenalty=0
874 % \floatingpenalty=0, set during \insert
875 % \outputpenalty=0, set before TeX enters \output
877 \doublehyphendemerits=10000
878 \finalhyphendemerits=5000
881 % \looseness=0, cleared by TeX after each paragraph
887 % \tracingparagraphs=0
899 % \lefthyphenmin=2 \righthyphenmin=3 set below
901 % \maxdeadcycles=25 % INITEX does this
902 % \hangafter=1 % INITEX does this, also TeX after each paragraph
904 % \mag=1000 % INITEX does this
905 % \escapechar=`\\ % INITEX does this
907 \defaulthyphenchar=`\-
910 % \endlinechar=`\^^M % INITEX does this
911 % \newlinechar=-1 \LaTeX\ sets this in ltdefns.dtx.
915 % \time=now % TeX does this at beginning of job
916 % \day=now % TeX does this at beginning of job
917 % \month=now % TeX does this at beginning of job
918 % \year=now % TeX does this at beginning of job
921 % In \LaTeX{} we don't want box information in the transcript
922 % unless we do a full tracing.
923 % \changes{v1.0g}{1994/04/28}{Turn off overfull box tracing in log}
928 \errorcontextlines=-1
936 \splitmaxdepth=\maxdimen
937 \boxmaxdepth=\maxdimen
940 % \begin{oldcomments}
941 % \lineskiplimit=0pt, changed by \normalbaselines
943 \delimitershortfall=5pt
944 \nulldelimiterspace=1.2pt
948 % \predisplaysize=0pt, set before TeX enters $$
949 % \displaywidth=0pt, set before TeX enters $$
950 % \displayindent=0pt, set before TeX enters $$
954 % \hangindent=0pt, zeroed by TeX after each paragraph
958 % \baselineskip=0pt, changed by \normalbaselines
959 % \lineskip=0pt, changed by \normalbaselines
961 \parskip=0pt plus 1pt
962 \abovedisplayskip=12pt plus 3pt minus 9pt
963 \abovedisplayshortskip=0pt plus 3pt
964 \belowdisplayskip=12pt plus 3pt minus 9pt
965 \belowdisplayshortskip=7pt plus 3pt minus 4pt
977 \parfillskip=0pt plus 1fil
982 % \begin{macro}{\normalbaselineskip}
983 % \begin{macro}{\normallineskip}
984 % \begin{macro}{\normallineskiplimit}
985 % We also define special registers that function like parameters:
987 \newskip\normalbaselineskip \normalbaselineskip=12pt
988 \newskip\normallineskip \normallineskip=1pt
989 \newdimen\normallineskiplimit \normallineskiplimit=0pt
995 % \begin{macro}{\interfootlinepenalty}
997 \newcount\interfootnotelinepenalty \interfootnotelinepenalty=100
1001 % Definitions for preloaded fonts
1003 % \begin{macro}{\magstephalf}
1004 % \begin{macro}{\magstep}
1006 \def\magstephalf{1095 }
1007 \def\magstep#1{\ifcase#1 \@m\or 1200\or 1440\or 1728\or
1008 2074\or 2488\fi\relax}
1014 % Macros for setting ordinary text
1016 % \begin{macro}{\frenchspacing}
1017 % \begin{macro}{\nonfrenchspacing}
1019 \def\frenchspacing{\sfcode`\.\@m \sfcode`\?\@m \sfcode`\!\@m
1020 \sfcode`\:\@m \sfcode`\;\@m \sfcode`\,\@m}
1021 \def\nonfrenchspacing{\sfcode`\.3000\sfcode`\?3000\sfcode`\!3000%
1022 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 }
1027 % \begin{macro}{\normalbaselines}
1029 \def\normalbaselines{\lineskip\normallineskip
1030 \baselineskip\normalbaselineskip \lineskiplimit\normallineskiplimit}
1036 % \changes{v1.1m}{1995/09/01}{Use \cs{let} to save space}
1037 % Save a bit of space by using |\let| here.
1039 \def\^^M{\ } % control <return> = control <space>
1040 \let\^^I\^^M % same for <tab>
1045 % \begin{macro}{\lq}
1046 % \begin{macro}{\rq}
1054 % \begin{macro}{\lbrack}
1055 % \begin{macro}{\rbrack}
1063 % \begin{macro}{\aa}
1064 % \begin{macro}{\AA}
1065 % These are not from plain.tex but they are similar to other commands
1066 % found here and nowhere else, being alternate input forms for
1075 % \begin{macro}{\endgraf}
1076 % \begin{macro}{\endline}
1084 % \begin{macro}{\space}
1090 % \begin{macro}{\empty}
1091 % \changes{v1.1m}{1995/09/01}{Use \cs{let} to save space}
1092 % This probably ought to go altogether, but let it to the \LaTeX\
1093 % version to save space.
1099 % \begin{macro}{\null}
1105 % \begin{macro}{\bgroup}
1106 % \begin{macro}{\egroup}
1114 % \begin{macro}{\obeylines}
1115 % \begin{macro}{\obeyspaces}
1116 % In |\obeylines|, we say |\let^^M=\par| instead of |\def^^M{\par}|
1117 % since this allows, for example, |\let\par=\cr \obeylines \halign{...|
1119 {\catcode`\^^M=\active % these lines must end with %
1120 \gdef\obeylines{\catcode`\^^M\active \let^^M\par}%
1121 \global\let^^M\par} % this is in case ^^M appears in a \write
1122 \def\obeyspaces{\catcode`\ \active}
1123 {\obeyspaces\global\let =\space}
1128 % \begin{macro}{\loop}
1129 % \changes{v1.0h}{1994/05/16}{Use Kabelschacht method}
1130 % \begin{macro}{\iterate}
1131 % \changes{v1.1b}{1994/11/10}
1132 % {(CAR) added extra \cs{relax}}
1133 % \changes{v1.1m}{1994/05/26}
1134 % {(CAR) added \cs{long}}
1135 % \begin{macro}{\repeat}
1136 % We use Kabelschacht's method of doing loops, see TUB 8\#2 (1987).
1137 % (unless that breaks something :-). It turned out to need an
1138 % extra |\relax|: see pr/642 (|\loop| could do one iteration too much
1139 % in certain cases).
1141 \long\def \loop #1\repeat{%
1142 \def\iterate{#1\relax % Extra \relax
1143 \expandafter\iterate\fi
1149 % This setting of |\repeat| is needed to make |\loop...\if...\repeat|
1150 % skippable within another |\if...|.
1158 % \LaTeX\ defines |\smallskip|, etc.\ in |ltspace.dtx|.
1160 % \begin{macro}{\nointerlineskip}
1161 % \begin{macro}{\offinterlineskip}
1162 % \changes{v1.1n}{1995/07/02}{Replaced 1000 by \cs{@m}}
1164 \def\nointerlineskip{\prevdepth-\@m\p@}
1165 \def\offinterlineskip{\baselineskip-\@m\p@
1166 \lineskip\z@ \lineskiplimit\maxdimen}
1171 % \begin{macro}{\vglue}
1172 % \begin{macro}{\hglue}
1174 \def\vglue{\afterassignment\vgl@\skip@=}
1175 \def\vgl@{\par \dimen@\prevdepth \hrule \@height\z@
1176 \nobreak\vskip\skip@ \prevdepth\dimen@}
1177 \def\hglue{\afterassignment\hgl@\skip@=}
1178 \def\hgl@{\leavevmode \count@\spacefactor \vrule \@width\z@
1179 \nobreak\hskip\skip@ \spacefactor\count@}
1184 % \LaTeX\ defines |~| in |ltdefns.dtx|.
1186 % \begin{macro}{\slash}
1188 \def\slash{/\penalty\exhyphenpenalty} % a `/' that acts like a `-'
1192 % \begin{macro}{\break}
1193 % \begin{macro}{\nobreak}
1194 % \begin{macro}{\allowbreak}
1196 \def\break{\penalty-\@M}
1197 \def\nobreak{\penalty \@M}
1198 \def\allowbreak{\penalty \z@}
1204 % \begin{macro}{\filbreak}
1205 % \begin{macro}{\goodbreak}
1207 \def\filbreak{\par\vfil\penalty-200\vfilneg}
1208 \def\goodbreak{\par\penalty-500 }
1213 % \begin{macro}{\eject}
1214 % \changes{v1.1s}{1995/10/17}{Move \cs{supereject} to compat file}
1215 % Define |\eject| as in plain \TeX\ but define |\supereject| only in
1216 % the compatibility file.
1218 \def\eject{\par\break}
1222 % \begin{macro}{\removelastskip}
1224 \def\removelastskip{\ifdim\lastskip=\z@\else\vskip-\lastskip\fi}
1228 % \begin{macro}{\smallbreak}
1229 % \begin{macro}{\medbreak}
1230 % \begin{macro}{\bigbreak}
1232 \def\smallbreak{\par\ifdim\lastskip<\smallskipamount
1233 \removelastskip\penalty-50\smallskip\fi}
1234 \def\medbreak{\par\ifdim\lastskip<\medskipamount
1235 \removelastskip\penalty-100\medskip\fi}
1236 \def\bigbreak{\par\ifdim\lastskip<\bigskipamount
1237 \removelastskip\penalty-200\bigskip\fi}
1243 % \begin{macro}{\m@th}
1244 % \changes{v1.0h}{1994/05/16}{Remove unnecessary space}
1246 \def\m@th{\mathsurround\z@}
1250 % \begin{macro}{\underbar}
1251 % Due to \LaTeX's redefinition of |\underline| plain \TeX's
1252 % |\underbar| can be done in a simpler fashion (but do we
1254 % \changes{v1.1m}{1994/05/26}
1255 % {(CAR/FMi) changed to use box \cs{tw@}}
1256 % \changes{v1.1p}{1994/05/26}
1257 % {(DPC) changed to use \cs{sbox}}
1259 \def\underbar#1{\underline{\sbox\tw@{#1}\dp\tw@\z@\box\tw@}}
1263 % \begin{macro}{\strutbox}
1264 % \begin{macro}{\strut}
1265 % \LaTeX\ sets |\strutbox| in |\set@fontsize|.
1268 \def\strut{\relax\ifmmode\copy\strutbox\else\unhcopy\strutbox\fi}
1273 % \begin{macro}{\hidewidth}
1274 % For alignment entries that can stick out.
1276 \def\hidewidth{\hskip\hideskip}
1280 % \changes{v1.0h}{1994/05/16}{Remove unnecessary def for \cs{item}}
1281 % \changes{v1.1i}{1995/04/27}
1282 % {Move \cs{hang} and \cs{textindent} to latex209.def}
1283 % \changes{RmS}{1991/11/04}{Removed \cs{itemitem} since never
1284 % needed/useful with \LaTeX.}
1286 % \begin{macro}{\narrower}
1289 \advance\leftskip\parindent
1290 \advance\rightskip\parindent}
1294 % \changes{v1.1c}{1994/11/12}{Comment out more encoding specific
1296 % \LaTeX\ defines |\ae| and similar commands elsewhere.
1304 % Most text commands are actually encoding specific and therefore
1305 % defined later, so commented out or removed from this file.
1306 % \changes{v1.0h}{1994/05/16}{Comment out encoding specific commands}
1308 % \begin{macro}{\leavevmode}
1309 % begins a paragraph, if necessary
1311 \def\leavevmode{\unhbox\voidb@x}
1315 % \begin{macro}{\mathhexbox}
1317 \def\mathhexbox#1#2#3{\mbox{$\m@th \mathchar"#1#2#3$}}
1322 % \begin{macro}{\ialign}
1324 \def\ialign{\everycr{}\tabskip\z@skip\halign} % initialized \halign
1328 % \begin{macro}{\oalign}
1329 % \begin{macro}{\o@lign}
1330 % \begin{macro}{\ooalign}
1332 \def\oalign#1{\leavevmode\vtop{\baselineskip\z@skip \lineskip.25ex%
1333 \ialign{##\crcr#1\crcr}}}
1334 \def\o@lign{\lineskiplimit\z@ \oalign}
1335 \def\ooalign{\lineskiplimit-\maxdimen \oalign}
1341 % \begin{macro}{\sh@ft}
1342 % \changes{v1.1t}{1996/07/26}{replace \cs{dimen}\cs{z@} by
1344 % \changes{v1.1y}{2005/09/27}{Macro no longer used but
1345 % left for compatibility}
1346 % The definition of this macro in plain.tex was improved in
1347 % about 1997; but as a result its usage was changed and its new
1348 % definition is not appropriate for \LaTeX{}.
1350 % Since the version given here has been in use by
1351 % \LaTeX{} for many years it does not seem prudent to remove it now.
1352 % As far as we can tell it has only been used to define~|\b| and~|\d|
1353 % but this cannot be certain.
1355 \def\sh@ft#1{\dimen@.00#1ex\multiply\dimen@\fontdimen1\font
1356 \kern-.0156\dimen@} % compensate for slant in lowered accents
1360 % \begin{macro}{\ltx@sh@ft}
1361 % \changes{v1.1y}{2005/09/27}{New macro}
1362 % This is the \LaTeX{} version of the second incarnation of the plain
1363 % macro |\sh@ft|, which takes a dimension as its argument. It shifts
1364 % a pseudo-accent horizontally by an amount proportional to the product
1365 % of its argument and the slant-per-point (fontdimen 1).
1371 \fontdimen1\font \dimen@
1372 } % kern by #1 times the current slant
1378 % \LaTeX{} change: the text commands such as
1379 % |\d|, |\b|, |\c|, |\copyright|,~|\TeX|
1380 % are now defined elsewhere.
1383 % {1993/11/29}{All accents in decimals; suggested by Paul Taylor}
1384 % \changes{v1.0d}{1994/04/12}
1385 % {Define \cs{@acci}}
1386 % \changes{v1.0h}{1994/05/16}{Remove \cs{@acci} and friends again}
1388 % \LaTeX{} change: Make |\t| work in a moving argument.
1389 % Now defined elsewhere.
1391 % \begin{macro}{\hrulefill}
1392 % \begin{macro}{\dotfill}
1393 % \LaTeX\ change: |\kern\z@| added to end of
1394 % |\hrulefill| and |\dotfill|
1395 % to make them work in `tabular' and `array' environments.
1396 % (Change made 24 July 1987).
1397 % \LaTeX\ change: |\leavevmode| added at beginning of
1398 % |\dotfill| and |\hrulefill|
1399 % so that they work as expected in vertical mode.
1401 \def\hrulefill{\leavevmode\leaders\hrule\hfill\kern\z@}
1403 % The box in |\dotfill| originally contained (in plain.tex):\\
1404 % |\mkern 1.5mu .\mkern 1.5mu|;\\
1405 % the width of .44em differs from this
1406 % by .04pt which is probably an acceptable difference within leaders.
1407 % \changes{v1.1u}{1996/10/28}{Removed math mode}
1408 % \changes{v1.1v}{1996/10/29}{Got arithmetic correct (CAR)}
1409 % \changes{v1.1w}{1996/11/03}{Saved tokens by using \cs{hb@xt@}}
1413 \cleaders \hb@xt@ .44em{\hss.\hss}\hfill
1419 % INITEX sets |\sfcode x=1000| for all x, except that |\sfcode`X=999|
1420 % for uppercase letters. The following changes are needed:
1422 \sfcode`\)=0 \sfcode`\'=0 \sfcode`\]=0
1424 % The |\nonfrenchspacing| macro will make further changes to
1428 % Definitions related to output
1431 % \changes{v1.1k}{1995/05/22}{Definitions of \cs{footins} and
1432 % \cs{footnoterule} moved to ltfloat.}
1435 % |\magnification| doesn't work in \LaTeX.
1437 %\def\magnification{\afterassignment\m@g\count@}
1438 %\def\m@g{\mag\count@
1439 % \hsize6.5truein\vsize8.9truein\dimen\footins8truein}
1442 % \begin{macro}{\showoverfull}
1443 % \changes{v0.1k ltfinal}{1994/05/19}{used \cs{@ne} not 1}
1444 % The following commands are used in debugging:
1446 \def\showoverfull{\tracingonline\@ne}
1450 % \begin{macro}{\showoutput}
1451 % \changes{v0.1k ltfinal}{1994/05/19}
1452 % {used \cs{maxdimen} not 99999}
1453 % \changes{v1.1n}{1995/07/02}{Use \cs{showoverfull} to save space}
1454 % \changes{v1.1x}{2002/02/24}{Use newly added \cs{loggingoutput}}
1455 % \begin{macro}{\loggingoutput}
1456 % \changes{v1.1x}{2002/02/24}{Macro added}
1458 \gdef\loggingoutput{\tracingoutput\@ne
1459 \showboxbreadth\maxdimen\showboxdepth\maxdimen\errorstopmode}
1460 \gdef\showoutput{\loggingoutput\showoverfull}
1467 % \begin{macro}{\tracingall}
1468 % \changes{LaTeX209}{1991/08/26}{Added
1469 % \cs{errorcontextlines}!=\cs{maxdimen}, suggested by J. Schrod}
1470 % \changes{v1.1n}{1995/07/02}{Use \cs{showoutput} to save space}
1471 % \changes{v1.1x}{2002/02/24}{Use newly added \cs{loggingoutput}}
1472 % \begin{macro}{\loggingall}
1473 % \changes{v1.1x}{2002/02/24}{Macro added}
1474 % \changes{v2.0b}{2012/01/20}{etex tracing if available}
1475 % \changes{v2.0d}{2015/02/20}{Spell commands correctly :-)}
1476 % \changes{v2.0g}{2015/03/10}{Reorganise to be less noisy}
1478 %<latexrelease>\IncludeInRelease{2015/01/20}{\loggingall}{etex tracing}%
1479 %<*2ekernel|latexrelease>
1480 \ifx\tracingscantokens\@undefined
1484 \tracinglostchars\@ne
1485 \tracingparagraphs\@ne
1486 \errorcontextlines\maxdimen
1489 \tracingcommands\tw@
1490 \tracingrestores\@ne
1496 \tracinglostchars\tw@
1497 \tracingparagraphs\@ne
1500 \tracingscantokens\@ne
1502 \errorcontextlines\maxdimen
1505 \tracingcommands\thr@@
1506 \tracingrestores\@ne
1510 \gdef\tracingall{\showoverfull\loggingall}
1511 %</2ekernel|latexrelease>
1512 %<latexrelease>\EndIncludeInRelease
1513 %<latexrelease>\IncludeInRelease{0000/00/00}{\loggingall}{etex tracing}%
1514 %<latexrelease>\gdef\loggingall{\tracingcommands\tw@\tracingstats\tw@
1515 %<latexrelease> \tracingpages\@ne\tracinglostchars\@ne
1516 %<latexrelease> \tracingmacros\tw@\tracingparagraphs\@ne\tracingrestores\@ne
1517 %<latexrelease> \errorcontextlines\maxdimen\loggingoutput}
1518 %<latexrelease> \gdef\tracingall{\loggingall\showoverfull}
1519 %<latexrelease>\EndIncludeInRelease
1525 % \begin{macro}{\tracingnone}
1526 % \changes{v2.0g}{2015/03/10}{macro added}
1527 % \begin{macro}{\hideoutput}
1528 % \changes{v2.0g}{2015/03/10}{macro added}
1530 %<latexrelease>\IncludeInRelease{2015/01/20}{\tracingnone}%
1531 %<latexrelease> {turn off etex tracing}%
1532 %<*2ekernel|latexrelease>
1533 \ifx\tracingscantokens\@undefined
1538 \showboxbreadth\m@ne
1540 \errorcontextlines\m@ne
1542 \tracingparagraphs\z@
1544 \tracinglostchars\@ne
1555 \showboxbreadth\m@ne
1557 \errorcontextlines\m@ne
1559 \tracingscantokens\z@
1562 \tracingparagraphs\z@
1564 \tracinglostchars\@ne
1574 \showboxbreadth\m@ne
1581 %</2ekernel|latexrelease>
1582 %<latexrelease>\EndIncludeInRelease
1583 %<latexrelease>\IncludeInRelease{0000/00/00}{\tracingnone}%
1584 %<latexrelease> {turn off etex tracing}%
1585 %<latexrelease>\let\tracingnone\@undefined
1586 %<latexrelease>\let\hideoutput\@undefined
1587 %<latexrelease>\EndIncludeInRelease
1593 % \LaTeX\ change: |\showhyphens| Defined later.
1595 % Punctuation affects the spacing.