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 [2017/01/06 v2.3b 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}
54 % \changes{v1.0a}{1994/03/08}
55 % {Remove need for a driver file.}
56 % \changes{v1.0b}{1994/03/12}
57 % {Name changed from lplain. The end of an era}
58 % \changes{v1.0e}{1994/03/12}{Replaced remaining width, height, depth
59 % by \LaTeX{} macro names to save tokens.}
60 % \changes{v1.1a}{1994/10/14}
61 % {Moved code to other files.}
62 % \changes{v1.1b}{1994/11/10}
63 % {(CAR) added patch to \cs{loop}.}
64 % \changes{v1.1f}{1994/11/25}
65 % {(DPC) Comment out lots of obsolete code}
66 % \changes{v1.1g}{1994/12/01}
67 % {(DPC) More doc changes}
68 % \changes{v1.1j}{1995/05/07}{Use \cs{hb@xt@}}
69 % \changes{v1.1j}{1995/05/21}{Moved some code to other files}
70 % \changes{v1.1n}{1995/07/02}{Removed surplus `by' and `\quotechar=' in
72 % \changes{v1.1o}{1995/09/14}{Moved \cs{multispan} to lttab.dtx}
73 % \changes{v1.1r}{1995/10/10}{Autoload tracing code}
74 % \changes{v1.1u}{1996/10/28}{(CAR) More doc changes}
75 % \changes{v2.0e}{2015/02/21}{Removed autoload code}
76 % \changes{v2.2d}{2016/10/15}{Require e\TeX{}}
77 % \changes{v2.3b}{2016/11/06}{Drop \cs{outer} entirely}
79 % \section{Plain \TeX}
81 % \LaTeX\ includes almost all of the functionality of Knuth's original
82 % `Basic Macros' That is, the plain \TeX\ format described in Appendix~B
83 % of the \TeX{}Book. However, some of the user commands are not much
84 % use so, in order to save memory, we may remove them from the kernel
85 % into a package. Here is a list of the commands that may be removed
86 % (PROBABLY NOT COMPLETE).
88 % \magstep \magstephalf
94 % This file is by now very small as most of it has been moved to more
95 % appropriate kernel files: it may disappear completely one day.
97 % \LaTeX\ font definitions are done using NFSS2 so none of PLAIN's
98 % font definitions are in \LaTeX.
100 % \LaTeX\ has its own tabbing environment, so PLAIN's is disabled.
102 % \LaTeX{} uses its own output routine, so most of the plain one was
110 \catcode`\{=1 % left brace is begin-group character
111 \catcode`\}=2 % right brace is end-group character
112 \catcode`\$=3 % dollar sign is math shift
113 \catcode`\&=4 % ampersand is alignment tab
114 \catcode`\#=6 % hash mark is macro parameter character
115 \catcode`\^=7 % circumflex and uparrow are for superscripts
116 \catcode`\_=8 % underline and downarrow are for subscripts
117 \catcode`\^^I=10 % ascii tab is a blank space
118 \chardef\active=13 \catcode`\~=\active % tilde is active
119 \catcode`\^^L=\active \def^^L{\par}% ascii form-feed is \par
126 % We had to define the |\catcodes| right away, before the message line,
127 % since |\message| uses the |{| and |}| characters.
128 % When INITEX (the \TeX\ initializer) starts up,
129 % it has defined the following |\catcode| values:\\
130 % |\catcode`\^^@=9 % | ascii null is ignored\\
131 % |\catcode`\^^M=5 % | ascii return is end-line\\
132 % |\catcode`\\=0 % | backslash is TeX escape character\\
133 % |\catcode`\%=14 % | percent sign is comment character\\
134 % |\catcode`\ =10 % | ascii space is blank space\\
135 % |\catcode`\^^?=15 %| ascii delete is invalid\\
136 % |\catcode`\A=11 ... \catcode`\Z=11 %| uppercase letters\\
137 % |\catcode`\a=11 ... \catcode`\z=11 %| lowercase letters\\
138 % all others are type 12 (other)
140 % Here is a list of the characters that have been specially catcoded:
142 \def\dospecials{\do\ \do\\\do\{\do\}\do\$\do\&%
143 \do\#\do\^\do\_\do\%\do\~}
145 % (not counting ascii null, tab, linefeed, formfeed, return, delete)
146 % Each symbol in the list is preceded by \do, which can be defined
147 % if you want to do something to every item in the list.
149 % We make |@| signs act like letters, temporarily, to avoid conflict
150 % between user names and internal control sequences of plain format.
155 % To make the plain macros more efficient in time and space,
156 % several constant values are declared here as control sequences.
157 % If they were changed, anything could happen;
158 % so they are private symbols.
159 % \begin{macro}{\@ne}
160 % \begin{macro}{\tw@}
161 % \begin{macro}{\thr@@}
162 % \begin{macro}{\sixt@@n}
163 % \begin{macro}{\@cclv}
164 % Small constants are defined using |\chardef|.
178 % \begin{macro}{\@cclvi}
181 % \begin{macro}{\@MM}
182 % Constants above 255 defined using |\mathchardef|.
184 \mathchardef\@cclvi=256
186 \mathchardef\@M=10000
187 \mathchardef\@MM=20000
194 % Allocation of registers
196 % Here are macros for the automatic allocation of |\count|, |\box|,
197 % |\dimen|, |\skip|, |\muskip|, and |\toks| registers, as well as
198 % |\read| and |\write| stream numbers, |\fam| codes, |\language| codes,
199 % and |\insert| numbers.
205 % When a register is used only temporarily, it need not be allocated;
206 % grouping can be used, making the value previously in the register
207 % return after the close of the group. The main use of these macros is
208 % for registers that are defined by one macro and used by others,
209 % possibly at different nesting levels. All such registers should be
210 % defined through these macros; otherwise conflicts may occur,
211 % especially when two or more macro packages are being used at
214 % \begin{oldcomments}
215 % The following counters are reserved:
216 % 0 to 9 page numbering
217 % 10 count allocation
218 % 11 dimen allocation
220 % 13 muskip allocation
223 % 16 read file allocation
224 % 17 write file allocation
225 % 18 math family allocation
226 % 19 language allocation
227 % 20 insert allocation
228 % 21 the most recently allocated number
232 % New counters are allocated starting with 23, 24, etc. Other registers
233 % are allocated starting with 10. This leaves 0 through 9 for the user
234 % to play with safely, except that counts 0 to 9 are considered to be
235 % the page and subpage numbers (since they are displayed during
236 % output). In this scheme, |\count| 10 always contains the number of the
237 % highest-numbered counter that has been allocated, |\count| 14 the
238 % highest-numbered box, etc. Inserts are given numbers 254, 253, etc.,
239 % since they require a |\count|, |\dimen|, |\skip|, and |\box| all with
240 % the same number; |\count| 20 contains the lowest-numbered insert that
241 % has been allocated. Of course, |\box|255 is reserved for |\output|;
242 % |\count|255, |\dimen|255, and |\skip|255 can be used freely.
244 % It is recommended that macro designers always use
245 % |\global| assignments with respect to registers numbered\\
247 % and always non-|\global| assignments with respect to registers\\
248 % 0, 2, 4, 6, 8, 255.\\
249 % This will prevent ``save stack buildup'' that might otherwise occur.
252 \count10=22 % allocates \count registers 23, 24, ...
253 \count11=9 % allocates \dimen registers 10, 11, ...
254 \count12=9 % allocates \skip registers 10, 11, ...
255 \count13=9 % allocates \muskip registers 10, 11, ...
256 \count14=9 % allocates \box registers 10, 11, ...
257 \count15=9 % allocates \toks registers 10, 11, ...
258 \count16=-1 % allocates input streams 0, 1, ...
259 \count17=-1 % allocates output streams 0, 1, ...
260 \count18=3 % allocates math families 4, 5, ...
261 \count19=0 % allocates \language codes 1, 2, ...
262 \count20=255 % allocates insertions 254, 253, ...
265 % \begin{macro}{\insc@unt}
266 % \begin{macro}{\allocationnumber}
267 % The insertion counter and most recent allocation.
269 \countdef\insc@unt=20
270 \countdef\allocationnumber=21
275 % \begin{macro}{\m@ne}
278 \countdef\m@ne=22 \m@ne=-1
282 % \begin{macro}{\wlog}
283 % Write on log file (only)
285 \def\wlog{\immediate\write\m@ne}
289 % \begin{macro}{\count@}
290 % \begin{macro}{\dimen@}
291 % \begin{macro}{\dimen@i}
292 % \begin{macro}{\dimen@ii}
293 % \begin{macro}{\skip@}
294 % \begin{macro}{\toks@}
295 % Here are abbreviations for the names of scratch registers
296 % that don't need to be allocated.
300 \dimendef\dimen@i=1 % global only
312 % \begin{macro}{\newcount}
313 % \begin{macro}{\newdimen}
314 % \begin{macro}{\newskip}
315 % \begin{macro}{\newmuskip}
316 % \begin{macro}{\newbox}
317 % \begin{macro}{\newread}
318 % \begin{macro}{\newwrite}
319 % \begin{macro}{\newlanguage}
320 % \changes{v1.0c}{1994/03/28}
321 % {Remove some \cs{outer} declarations.}
322 % \changes{v1.1h}{1995/04/24}
323 % {Remove remaining \cs{outer} declarations.}
324 % Now, we define |\newcount|, |\newbox|, etc. so that you can say
325 % |\newcount\foo| and |\foo| will be defined (with |\countdef|) to
326 % be the next counter.
328 % To find out which counter |\foo| is, you can look at
329 % |\allocationnumber|.
331 % Since there's no |\boxdef| command, |\chardef| is used to define a
332 % |\newbox|, |\newinsert|, |\newfam|, and so on.
334 % \LaTeX\ change: remove |\outer| from |\newcount| and |\newdimen| (FMi)
335 % This is necessary to use |\newcount| inside |\if...|
336 % later on. Also remove from |\newskip|, |\newbox|
337 % |\newwrite| and |\newfam| (DPC) to save later redefinition.
338 % \changes{v2.0a}{2014/12/30}{New engine-specific allocation scheme (latexrelease)}
339 % \changes{v2.0f}{2015/03/02}{allow 255 math groups in Unicode engines}
340 % \changes{v2.0h}{2015/06/19}{Use $-1$ for first range to get contiguous allocation}
343 %<*2ekernel|latexrelease>
344 %<latexrelease>\IncludeInRelease{2015/01/01}%
345 %<latexrelease> {\newcount}{Extended Allocation}%
349 \def\newcount {\e@alloc\count \countdef {\count10}\insc@unt\float@count}
350 \def\newdimen {\e@alloc\dimen \dimendef {\count11}\insc@unt\float@count}
351 \def\newskip {\e@alloc\skip \skipdef {\count12}\insc@unt\float@count}
353 {\e@alloc\muskip\muskipdef{\count13}\m@ne\e@alloc@top}
355 % For compatibility use |\chardef| in the classical range.
357 \def\newbox {\e@alloc\box
358 {\ifnum\allocationnumber<\@cclvi
361 \expandafter\e@alloc@chardef
363 {\count14}\insc@unt\float@count}
364 \def\newtoks {\e@alloc\toks \toksdef{\count15}\m@ne\e@alloc@top}
365 \def\newread {\e@alloc\read \chardef{\count16}\m@ne\sixt@@n}
368 % \changes{v2.2a}{2015/11/18}
369 % {Extended stream allocation in luatex (0.85)}
370 % \changes{v2.2b}{2015/11/19}
371 % {Only extend allocation of write streams (see luatex list)}
372 % Skip |\write18| due to its traditional use as a shell-escape.
374 \ifx\directlua\@undefined
375 \def\newwrite {\e@alloc\write \chardef{\count17}\m@ne\sixt@@n}
377 \def\newwrite {\e@alloc\write
378 {\ifnum\allocationnumber=18 \allocationnumber19\fi
388 {\e@alloc\mathgroup\chardef{\count18}\m@ne\e@mathgroup@top}
389 \let\newfam\new@mathgroup
392 % \changes{v2.3a}{2016/10/16}{Allow languages up to 16383 in luatex}
394 \ifx\directlua\@undefined
395 \def\newlanguage {\e@alloc\language \chardef{\count19}\m@ne\@cclvi}
397 \def\newlanguage {\e@alloc\language \chardef{\count19}\m@ne{16384}}
399 %</2ekernel|latexrelease>
403 %<latexrelease>\EndIncludeInRelease
404 %<latexrelease>\IncludeInRelease{0000/00/00}%
405 %<latexrelease> {\newcount}{Extended Allocation}%
406 %<latexrelease>\def\newcount{\alloc@0\count\countdef\insc@unt}
407 %<latexrelease>\def\newdimen{\alloc@1\dimen\dimendef\insc@unt}
408 %<latexrelease>\def\newskip{\alloc@2\skip\skipdef\insc@unt}
409 %<latexrelease>\def\newmuskip{\alloc@3\muskip\muskipdef\@cclvi}
410 %<latexrelease>\def\newbox{\alloc@4\box\chardef\insc@unt}
411 %<latexrelease>\def\newtoks{\alloc@5\toks\toksdef\@cclvi}
412 %<latexrelease>\def\newread{\alloc@6\read\chardef\sixt@@n}
413 %<latexrelease>\def\newwrite{\alloc@7\write\chardef\sixt@@n}
414 %<latexrelease>\def\new@mathgroup{\alloc@8\fam\chardef\sixt@@n}
415 %<latexrelease>\def\newlanguage{\alloc@9\language\chardef\@cclvi}
416 %<latexrelease>\let\newfam\new@mathgroup
417 %<latexrelease>\EndIncludeInRelease
428 %\begin{macro}{\e@alloc@chardef}
429 % \changes{v2.0a}{2014/12/30}{macro added}
430 %\begin{macro}{\e@alloc@top}
431 % \changes{v2.0a}{2014/12/30}{macro added}
432 % The upper limit of extended registers, which leaves
433 % this number (eg |\dimen32767|) always unallocated
435 % cf traditional |\dimen255|.
437 %<*2ekernel|latexrelease>
438 %<latexrelease>\IncludeInRelease{2015/01/01}%
439 %<latexrelease> {\e@alloc@chardef}{Extended Allocation}%
443 \ifx\directlua\@undefined
444 \ifx\widowpenalties\@undefined
446 % classic tex has $2^8$ registers.
448 \mathchardef\e@alloc@top=255
449 \let\e@alloc@chardef\chardef
452 % etex and xetex have $2^{15}$ registers.
454 \mathchardef\e@alloc@top=32767
455 \let\e@alloc@chardef\mathchardef
459 % luatex has $2^{16}$ registers.
461 \chardef\e@alloc@top=65535
462 \let\e@alloc@chardef\chardef
467 %</2ekernel|latexrelease>
468 %<latexrelease>\EndIncludeInRelease
469 %<latexrelease>\IncludeInRelease{0000/00/00}%
470 %<latexrelease> {\e@alloc@chardef}{Extended Allocation}%
471 %<latexrelease>\let\e@alloc@top\@undefined
472 %<latexrelease>\let\e@alloc@chardef\@undefined
473 %<latexrelease>\EndIncludeInRelease
478 %\begin{macro}{\e@mathgroup@top}
479 % \changes{v2.0f}{2015/03/02}{macro added}
480 % The upper limit of extended math groups (|\fam|)
481 % 16 in classic \TeX\ and e-\TeX, but 256 in Unicode TeX variants.
483 %<*2ekernel|latexrelease>
484 %<latexrelease>\IncludeInRelease{2015/01/01}%
485 %<latexrelease> {\e@mathgroup@top}{Extended Allocation}%
489 \ifx\Umathcode\@undefined
491 % classic and e tex have 16 fam (0--15).
493 \chardef\e@mathgroup@top=16
496 % xetex and luatex have 256 fam (0--255).
498 \chardef\e@mathgroup@top=256
503 %</2ekernel|latexrelease>
504 %<latexrelease>\EndIncludeInRelease
505 %<latexrelease>\IncludeInRelease{0000/00/00}%
506 %<latexrelease> {\e@mathgroup@top}{Extended Allocation}%
507 %<latexrelease>\let\e@mathgroup@top\@undefined
508 %<latexrelease>\EndIncludeInRelease
512 % \begin{macro}{\e@alloc}
513 % \changes{v2.0a}{2014/12/30}{macro added}
514 % A modified version of |\alloc@| that
515 % takes the count register rather than just the final digit of its number
516 % (assuming |\count|$1x$).
517 % It also has an extra argument to give the top of the extended range.
519 % | #1 #2 #3 #4 #5 #6 |
521 % | \e@alloc type defcmd current top extended-top newname|
523 % Note that if just a single allocation range is required
524 % (not omitting a range up to 255 for inserts) then $-1$
525 % should be used for the first upper bound argument, |#4|.
528 %<*2ekernel|latexrelease>
529 %<latexrelease>\IncludeInRelease{2015/01/01}{\e@alloc}{Extended Allocation}%
532 % \changes{v2.0h}{2015/06/19}{extra braces in case arguments not single token}
534 \def\e@alloc#1#2#3#4#5#6{%
535 \global\advance#3\@ne
536 \e@ch@ck{#3}{#4}{#5}#1%
537 \allocationnumber#3\relax
538 \global#2#6\allocationnumber
539 \wlog{\string#6=\string#1\the\allocationnumber}}%
543 %</2ekernel|latexrelease>
544 %<latexrelease>\EndIncludeInRelease
545 %<latexrelease>\IncludeInRelease{0000/00/00}{\e@alloc}{Extended Allocation}%
546 %<latexrelease>\let\e@alloc\@undefined
547 %<latexrelease>\EndIncludeInRelease
552 %\begin{macro}{\e@ch@ck}
553 % \changes{v2.0a}{2014/12/30}{macro added}
554 % Extended check command.
555 % If the first range is exceeded, bump to 256 (or 266 for counts)
556 % and try again, testing the extended range.
557 %\begin{macro}{\extrafloats}
558 % \changes{v2.0a}{2014/12/30}{macro added}
559 % \changes{v2.0c}{2015/01/23}{reserve counts 256--265}
560 % Allocate matching registers from the top of the extended range
561 % and add to |\@freelist|.
564 %<*2ekernel|latexrelease>
565 %<latexrelease>\IncludeInRelease{2015/10/01}
566 %<latexrelease> {\e@ch@ck}{Extended Allocation (checking)}%
570 \gdef\e@ch@ck#1#2#3#4{%
574 % If we've reached the classical top limit, bump to 256
575 % or 266 for counts (count 256--265 are reserved by the allocation
577 % \changes{v2.1b}{2015/10/27}
578 % {Use global assignment when switching to extended range}
582 \ifx\count#4\global\advance#1 10 \fi
585 % Check we are below the extended limit.
586 % \changes{v2.0i}{2015/08/06}
587 % {Add \cs{string} in case argument is not an unexpandable primitive}
591 \errmessage{No room for a new \string#4}%
594 %<latexrelease>\EndIncludeInRelease
595 %<latexrelease>\IncludeInRelease{2015/01/01}%
596 %<latexrelease> {\e@ch@ck}{Extended Allocation (checking)}%
597 %<latexrelease>\gdef\e@ch@ck#1#2#3#4{%
598 %<latexrelease> \ifnum#1<#2\else
599 %<latexrelease> \ifnum#1=#2\relax
600 %<latexrelease> #1\@cclvi
601 %<latexrelease> \ifx\count#4\advance#1 10 \fi
603 %<latexrelease> \ifnum#1<#3\relax
604 %<latexrelease> \else
605 %<latexrelease> \errmessage{No room for a new #4}%
607 %<latexrelease> \fi}%
608 %<latexrelease>\EndIncludeInRelease
609 %<latexrelease>\IncludeInRelease{0000/00/00}%
610 %<latexrelease> {\e@ch@ck}{Extended Allocation (checking)}%
611 %<latexrelease>\let\e@ch@ck\@undefined
612 %<latexrelease>\EndIncludeInRelease
616 %<latexrelease>\IncludeInRelease{2015/01/01}%
617 %<latexrelease> {\extrafloats}{Extra floats}%
622 \let\float@count\e@alloc@top
625 % \begin{macro}{\extrafloats}
626 % \changes{v2.2c}{2016/07/29}{use \cs{global} \cs{chardef}}
628 \ifx\numexpr\@undefined
630 % In classic TeX use |\newinsert| to allocate float boxes.
635 \newinsert\reserved@a
636 \global\expandafter\chardef
637 \csname bx@\the\allocationnumber\endcsname\allocationnumber
638 \@cons\@freelist{\csname bx@\the\allocationnumber\endcsname}%
640 \expandafter\extrafloats
649 % In e-tex take float boxes from the top of the extended range.
653 \count@\numexpr\float@count-1\relax
658 \global\e@alloc@chardef\float@count\count@
659 \global\expandafter\e@alloc@chardef
660 \csname bx@\the\float@count\endcsname\float@count
661 \@cons\@freelist{\csname bx@\the\float@count\endcsname}%
663 \extrafloats\expandafter{\numexpr#1-1\relax}%
672 %</2ekernel|latexrelease>
673 %<latexrelease>\EndIncludeInRelease
674 %<latexrelease>\IncludeInRelease{0000/00/00}%
675 %<latexrelease> {\extrafloats}{Extra floats}%
676 %<latexrelease>\let\float@count\@undefined
677 %<latexrelease>\let\extrafloats\@undefined
678 %<latexrelease>\EndIncludeInRelease
684 % \begin{macro}{\alloc@}
686 \def\alloc@#1#2#3#4#5{\global\advance\count1#1\@ne
687 \ch@ck#1#4#2% make sure there's still room
688 \allocationnumber\count1#1%
689 \global#3#5\allocationnumber
690 \wlog{\string#5=\string#2\the\allocationnumber}}
694 % \begin{macro}{\newinsert}
695 % \changes{v2.1a}{2015/08/30}{new \cs{newinsert} implementation}
698 %<*2ekernel|latexrelease>
699 %<latexrelease>\IncludeInRelease{2015/10/01}
700 %<latexrelease> {\newinsert}{Extended \newinsert}%
703 \ifx\numexpr\@undefined
705 % If e-\TeX\ is not available use the original plain \TeX\
706 % definition of |\newinsert|.
708 \def\newinsert#1{\global\advance\insc@unt \m@ne
709 \ch@ck0\insc@unt\count
710 \ch@ck1\insc@unt\dimen
711 \ch@ck2\insc@unt\skip
713 \allocationnumber\insc@unt
714 \global\chardef#1\allocationnumber
715 \wlog{\string#1=\string\insert\the\allocationnumber}}
720 % The highest register allowed with |\insert|.
722 \ifx\directlua\@undefined
723 \chardef\e@insert@top255
725 \chardef\e@insert@top\e@alloc@top
728 % If the classic registers are exausted, take an insert from the free float list
729 % and use |\extrafloats| to add a new float to that list.
730 % \changes{v2.2c}{2016/07/29}{fix for tlb-newinsert-001}
734 \global\advance\insc@unt\m@ne
735 \ifnum\count10<\insc@unt
736 \ifnum\count11<\insc@unt
737 \ifnum\count12<\insc@unt
738 \ifnum\count14<\insc@unt
742 \allocationnumber\insc@unt
744 \global\advance\insc@unt\@ne
746 \@next\@currbox\@freelist
747 {\ifnum\@currbox<\e@insert@top
748 \allocationnumber\@currbox
752 {\ch@ck0\m@ne\insert}%
754 \global\chardef#1\allocationnumber
755 \wlog{\string#1=\string\insert\the\allocationnumber}%
760 %</2ekernel|latexrelease>
764 %<latexrelease>\EndIncludeInRelease
765 %<latexrelease>\IncludeInRelease{0000/00/00}%
766 %<latexrelease> {\newinsert}{Extended \newinsert}%
767 %<latexrelease>\let\e@insert@top\@undefined
768 %<latexrelease>\def\newinsert#1{\global\advance\insc@unt \m@ne
769 %<latexrelease> \ch@ck0\insc@unt\count
770 %<latexrelease> \ch@ck1\insc@unt\dimen
771 %<latexrelease> \ch@ck2\insc@unt\skip
772 %<latexrelease> \ch@ck4\insc@unt\box
773 %<latexrelease> \allocationnumber\insc@unt
774 %<latexrelease> \global\chardef#1\allocationnumber
775 %<latexrelease> \wlog{\string#1=\string\insert\the\allocationnumber}}
776 %<latexrelease>\EndIncludeInRelease
781 % \begin{macro}{\ch@ck}
784 \ifnum\count1#1<#2\else
785 \errmessage{No room for a new #3}%
790 % \changes{v2.0h}{2015/06/19}{delete spurious old definition of \cs{newtoks}}
791 % \begin{macro}{\newhelp}
793 \def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}}
797 % \begin{macro}{\maxdimen}
798 % \begin{macro}{\hideskip}
799 % Here are some examples of allocation.
801 \newdimen\maxdimen \maxdimen=16383.99999pt % the largest legal <dimen>
802 \newskip\hideskip \hideskip=-1000pt plus 1fill % negative but can grow
809 % \begin{macro}{\z@skip}
810 % \begin{macro}{\voidb@x}
812 \newdimen\p@ \p@=1pt % this saves macro space and time
813 \newdimen\z@ \z@=0pt % can be used both for 0pt and 0
814 \newskip\z@skip \z@skip=0pt plus0pt minus0pt
815 \newbox\voidb@x % permanently void box register
822 % Assign initial values to \TeX's parameters
825 \message{parameters,}
828 % All of \TeX's numeric parameters are listed here,
829 % but the code is commented out if no special value needs to be set.
830 % INITEX makes all parameters zero except where noted.
832 % \begin{oldcomments}
835 \tolerance=200 % INITEX sets this to 10000
845 \displaywidowpenalty=50
847 \predisplaypenalty=10000
849 % \postdisplaypenalty=0
850 % \interlinepenalty=0
851 % \floatingpenalty=0, set during \insert
852 % \outputpenalty=0, set before TeX enters \output
854 \doublehyphendemerits=10000
855 \finalhyphendemerits=5000
858 % \looseness=0, cleared by TeX after each paragraph
864 % \tracingparagraphs=0
876 % \lefthyphenmin=2 \righthyphenmin=3 set below
878 % \maxdeadcycles=25 % INITEX does this
879 % \hangafter=1 % INITEX does this, also TeX after each paragraph
881 % \mag=1000 % INITEX does this
882 % \escapechar=`\\ % INITEX does this
884 \defaulthyphenchar=`\-
887 % \endlinechar=`\^^M % INITEX does this
888 % \newlinechar=-1 \LaTeX\ sets this in ltdefns.dtx.
892 % \time=now % TeX does this at beginning of job
893 % \day=now % TeX does this at beginning of job
894 % \month=now % TeX does this at beginning of job
895 % \year=now % TeX does this at beginning of job
898 % In \LaTeX{} we don't want box information in the transcript
899 % unless we do a full tracing.
900 % \changes{v1.0g}{1994/04/28}{Turn off overfull box tracing in log}
905 \errorcontextlines=-1
913 \splitmaxdepth=\maxdimen
914 \boxmaxdepth=\maxdimen
917 % \begin{oldcomments}
918 % \lineskiplimit=0pt, changed by \normalbaselines
920 \delimitershortfall=5pt
921 \nulldelimiterspace=1.2pt
925 % \predisplaysize=0pt, set before TeX enters $$
926 % \displaywidth=0pt, set before TeX enters $$
927 % \displayindent=0pt, set before TeX enters $$
931 % \hangindent=0pt, zeroed by TeX after each paragraph
935 % \baselineskip=0pt, changed by \normalbaselines
936 % \lineskip=0pt, changed by \normalbaselines
938 \parskip=0pt plus 1pt
939 \abovedisplayskip=12pt plus 3pt minus 9pt
940 \abovedisplayshortskip=0pt plus 3pt
941 \belowdisplayskip=12pt plus 3pt minus 9pt
942 \belowdisplayshortskip=7pt plus 3pt minus 4pt
954 \parfillskip=0pt plus 1fil
959 % \begin{macro}{\normalbaselineskip}
960 % \begin{macro}{\normallineskip}
961 % \begin{macro}{\normallineskiplimit}
962 % We also define special registers that function like parameters:
964 \newskip\normalbaselineskip \normalbaselineskip=12pt
965 \newskip\normallineskip \normallineskip=1pt
966 \newdimen\normallineskiplimit \normallineskiplimit=0pt
972 % \begin{macro}{\interfootlinepenalty}
974 \newcount\interfootnotelinepenalty \interfootnotelinepenalty=100
978 % Definitions for preloaded fonts
980 % \begin{macro}{\magstephalf}
981 % \begin{macro}{\magstep}
983 \def\magstephalf{1095 }
984 \def\magstep#1{\ifcase#1 \@m\or 1200\or 1440\or 1728\or
985 2074\or 2488\fi\relax}
991 % Macros for setting ordinary text
993 % \begin{macro}{\frenchspacing}
994 % \begin{macro}{\nonfrenchspacing}
996 \def\frenchspacing{\sfcode`\.\@m \sfcode`\?\@m \sfcode`\!\@m
997 \sfcode`\:\@m \sfcode`\;\@m \sfcode`\,\@m}
998 \def\nonfrenchspacing{\sfcode`\.3000\sfcode`\?3000\sfcode`\!3000%
999 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 }
1004 % \begin{macro}{\normalbaselines}
1006 \def\normalbaselines{\lineskip\normallineskip
1007 \baselineskip\normalbaselineskip \lineskiplimit\normallineskiplimit}
1013 % \changes{v1.1m}{1995/09/01}{Use \cs{let} to save space}
1014 % Save a bit of space by using |\let| here.
1016 \def\^^M{\ } % control <return> = control <space>
1017 \let\^^I\^^M % same for <tab>
1022 % \begin{macro}{\lq}
1023 % \begin{macro}{\rq}
1031 % \begin{macro}{\lbrack}
1032 % \begin{macro}{\rbrack}
1040 % \begin{macro}{\aa}
1041 % \begin{macro}{\AA}
1042 % These are not from plain.tex but they are similar to other commands
1043 % found here and nowhere else, being alternate input forms for
1052 % \begin{macro}{\endgraf}
1053 % \begin{macro}{\endline}
1061 % \begin{macro}{\space}
1067 % \begin{macro}{\empty}
1068 % \changes{v1.1m}{1995/09/01}{Use \cs{let} to save space}
1069 % This probably ought to go altogether, but let it to the \LaTeX\
1070 % version to save space.
1076 % \begin{macro}{\null}
1082 % \begin{macro}{\bgroup}
1083 % \begin{macro}{\egroup}
1091 % \begin{macro}{\obeylines}
1092 % \begin{macro}{\obeyspaces}
1093 % In |\obeylines|, we say |\let^^M=\par| instead of |\def^^M{\par}|
1094 % since this allows, for example, |\let\par=\cr \obeylines \halign{...|
1096 {\catcode`\^^M=\active % these lines must end with %
1097 \gdef\obeylines{\catcode`\^^M\active \let^^M\par}%
1098 \global\let^^M\par} % this is in case ^^M appears in a \write
1099 \def\obeyspaces{\catcode`\ \active}
1100 {\obeyspaces\global\let =\space}
1105 % \begin{macro}{\loop}
1106 % \changes{v1.0h}{1994/05/16}{Use Kabelschacht method}
1107 % \begin{macro}{\iterate}
1108 % \changes{v1.1b}{1994/11/10}
1109 % {(CAR) added extra \cs{relax}}
1110 % \changes{v1.1m}{1994/05/26}
1111 % {(CAR) added \cs{long}}
1112 % \begin{macro}{\repeat}
1113 % We use Kabelschacht's method of doing loops, see TUB 8\#2 (1987).
1114 % (unless that breaks something :-). It turned out to need an
1115 % extra |\relax|: see pr/642 (|\loop| could do one iteration too much
1116 % in certain cases).
1118 \long\def \loop #1\repeat{%
1119 \def\iterate{#1\relax % Extra \relax
1120 \expandafter\iterate\fi
1126 % This setting of |\repeat| is needed to make |\loop...\if...\repeat|
1127 % skippable within another |\if...|.
1135 % \LaTeX\ defines |\smallskip|, etc.\ in |ltspace.dtx|.
1137 % \begin{macro}{\nointerlineskip}
1138 % \begin{macro}{\offinterlineskip}
1139 % \changes{v1.1n}{1995/07/02}{Replaced 1000 by \cs{@m}}
1141 \def\nointerlineskip{\prevdepth-\@m\p@}
1142 \def\offinterlineskip{\baselineskip-\@m\p@
1143 \lineskip\z@ \lineskiplimit\maxdimen}
1148 % \begin{macro}{\vglue}
1149 % \begin{macro}{\hglue}
1151 \def\vglue{\afterassignment\vgl@\skip@=}
1152 \def\vgl@{\par \dimen@\prevdepth \hrule \@height\z@
1153 \nobreak\vskip\skip@ \prevdepth\dimen@}
1154 \def\hglue{\afterassignment\hgl@\skip@=}
1155 \def\hgl@{\leavevmode \count@\spacefactor \vrule \@width\z@
1156 \nobreak\hskip\skip@ \spacefactor\count@}
1161 % \LaTeX\ defines |~| in |ltdefns.dtx|.
1163 % \begin{macro}{\slash}
1164 % This generates a |/| acting a bit like |-| but still allows hyphenation
1165 % in the word part preceding it (but not after).
1167 \def\slash{/\penalty\exhyphenpenalty}
1171 % \begin{macro}{\break}
1172 % \begin{macro}{\nobreak}
1173 % \begin{macro}{\allowbreak}
1175 \def\break{\penalty-\@M}
1176 \def\nobreak{\penalty \@M}
1177 \def\allowbreak{\penalty \z@}
1183 % \begin{macro}{\filbreak}
1184 % \begin{macro}{\goodbreak}
1186 \def\filbreak{\par\vfil\penalty-200\vfilneg}
1187 \def\goodbreak{\par\penalty-500 }
1192 % \begin{macro}{\eject}
1193 % \changes{v1.1s}{1995/10/17}{Move \cs{supereject} to compat file}
1194 % Define |\eject| as in plain \TeX\ but define |\supereject| only in
1195 % the compatibility file.
1197 \def\eject{\par\break}
1201 % \begin{macro}{\removelastskip}
1203 \def\removelastskip{\ifdim\lastskip=\z@\else\vskip-\lastskip\fi}
1207 % \begin{macro}{\smallbreak}
1208 % \begin{macro}{\medbreak}
1209 % \begin{macro}{\bigbreak}
1211 \def\smallbreak{\par\ifdim\lastskip<\smallskipamount
1212 \removelastskip\penalty-50\smallskip\fi}
1213 \def\medbreak{\par\ifdim\lastskip<\medskipamount
1214 \removelastskip\penalty-100\medskip\fi}
1215 \def\bigbreak{\par\ifdim\lastskip<\bigskipamount
1216 \removelastskip\penalty-200\bigskip\fi}
1222 % \begin{macro}{\m@th}
1223 % \changes{v1.0h}{1994/05/16}{Remove unnecessary space}
1225 \def\m@th{\mathsurround\z@}
1229 % \begin{macro}{\underbar}
1230 % Due to \LaTeX's redefinition of |\underline| plain \TeX's
1231 % |\underbar| can be done in a simpler fashion (but do we
1233 % \changes{v1.1m}{1994/05/26}
1234 % {(CAR/FMi) changed to use box \cs{tw@}}
1235 % \changes{v1.1p}{1994/05/26}
1236 % {(DPC) changed to use \cs{sbox}}
1238 \def\underbar#1{\underline{\sbox\tw@{#1}\dp\tw@\z@\box\tw@}}
1242 % \begin{macro}{\strutbox}
1243 % \begin{macro}{\strut}
1244 % \LaTeX\ sets |\strutbox| in |\set@fontsize|.
1247 \def\strut{\relax\ifmmode\copy\strutbox\else\unhcopy\strutbox\fi}
1252 % \begin{macro}{\hidewidth}
1253 % For alignment entries that can stick out.
1255 \def\hidewidth{\hskip\hideskip}
1259 % \changes{v1.0h}{1994/05/16}{Remove unnecessary def for \cs{item}}
1260 % \changes{v1.1i}{1995/04/27}
1261 % {Move \cs{hang} and \cs{textindent} to latex209.def}
1262 % \changes{RmS}{1991/11/04}{Removed \cs{itemitem} since never
1263 % needed/useful with \LaTeX.}
1265 % \begin{macro}{\narrower}
1268 \advance\leftskip\parindent
1269 \advance\rightskip\parindent}
1273 % \changes{v1.1c}{1994/11/12}{Comment out more encoding specific
1275 % \LaTeX\ defines |\ae| and similar commands elsewhere.
1283 % Most text commands are actually encoding specific and therefore
1284 % defined later, so commented out or removed from this file.
1285 % \changes{v1.0h}{1994/05/16}{Comment out encoding specific commands}
1287 % \begin{macro}{\leavevmode}
1288 % begins a paragraph, if necessary
1290 \def\leavevmode{\unhbox\voidb@x}
1294 % \begin{macro}{\mathhexbox}
1296 \def\mathhexbox#1#2#3{\mbox{$\m@th \mathchar"#1#2#3$}}
1301 % \begin{macro}{\ialign}
1303 \def\ialign{\everycr{}\tabskip\z@skip\halign} % initialized \halign
1307 % \begin{macro}{\oalign}
1308 % \begin{macro}{\o@lign}
1309 % \begin{macro}{\ooalign}
1311 \def\oalign#1{\leavevmode\vtop{\baselineskip\z@skip \lineskip.25ex%
1312 \ialign{##\crcr#1\crcr}}}
1313 \def\o@lign{\lineskiplimit\z@ \oalign}
1314 \def\ooalign{\lineskiplimit-\maxdimen \oalign}
1320 % \begin{macro}{\sh@ft}
1321 % \changes{v1.1t}{1996/07/26}{replace \cs{dimen}\cs{z@} by
1323 % \changes{v1.1y}{2005/09/27}{Macro no longer used but
1324 % left for compatibility}
1325 % The definition of this macro in plain.tex was improved in
1326 % about 1997; but as a result its usage was changed and its new
1327 % definition is not appropriate for \LaTeX{}.
1329 % Since the version given here has been in use by
1330 % \LaTeX{} for many years it does not seem prudent to remove it now.
1331 % As far as we can tell it has only been used to define~|\b| and~|\d|
1332 % but this cannot be certain.
1334 \def\sh@ft#1{\dimen@.00#1ex\multiply\dimen@\fontdimen1\font
1335 \kern-.0156\dimen@} % compensate for slant in lowered accents
1339 % \begin{macro}{\ltx@sh@ft}
1340 % \changes{v1.1y}{2005/09/27}{New macro}
1341 % This is the \LaTeX{} version of the second incarnation of the plain
1342 % macro |\sh@ft|, which takes a dimension as its argument. It shifts
1343 % a pseudo-accent horizontally by an amount proportional to the product
1344 % of its argument and the slant-per-point (fontdimen 1).
1350 \fontdimen1\font \dimen@
1351 } % kern by #1 times the current slant
1357 % \LaTeX{} change: the text commands such as
1358 % |\d|, |\b|, |\c|, |\copyright|,~|\TeX|
1359 % are now defined elsewhere.
1362 % {1993/11/29}{All accents in decimals; suggested by Paul Taylor}
1363 % \changes{v1.0d}{1994/04/12}
1364 % {Define \cs{@acci}}
1365 % \changes{v1.0h}{1994/05/16}{Remove \cs{@acci} and friends again}
1367 % \LaTeX{} change: Make |\t| work in a moving argument.
1368 % Now defined elsewhere.
1370 % \begin{macro}{\hrulefill}
1371 % \begin{macro}{\dotfill}
1372 % \LaTeX\ change: |\kern\z@| added to end of
1373 % |\hrulefill| and |\dotfill|
1374 % to make them work in `tabular' and `array' environments.
1375 % (Change made 24 July 1987).
1376 % \LaTeX\ change: |\leavevmode| added at beginning of
1377 % |\dotfill| and |\hrulefill|
1378 % so that they work as expected in vertical mode.
1380 \def\hrulefill{\leavevmode\leaders\hrule\hfill\kern\z@}
1382 % The box in |\dotfill| originally contained (in plain.tex):\\
1383 % |\mkern 1.5mu .\mkern 1.5mu|;\\
1384 % the width of .44em differs from this
1385 % by .04pt which is probably an acceptable difference within leaders.
1386 % \changes{v1.1u}{1996/10/28}{Removed math mode}
1387 % \changes{v1.1v}{1996/10/29}{Got arithmetic correct (CAR)}
1388 % \changes{v1.1w}{1996/11/03}{Saved tokens by using \cs{hb@xt@}}
1392 \cleaders \hb@xt@ .44em{\hss.\hss}\hfill
1398 % INITEX sets |\sfcode x=1000| for all x, except that |\sfcode`X=999|
1399 % for uppercase letters. The following changes are needed:
1401 \sfcode`\)=0 \sfcode`\'=0 \sfcode`\]=0
1403 % The |\nonfrenchspacing| macro will make further changes to
1407 % Definitions related to output
1410 % \changes{v1.1k}{1995/05/22}{Definitions of \cs{footins} and
1411 % \cs{footnoterule} moved to ltfloat.}
1414 % |\magnification| doesn't work in \LaTeX.
1416 %\def\magnification{\afterassignment\m@g\count@}
1417 %\def\m@g{\mag\count@
1418 % \hsize6.5truein\vsize8.9truein\dimen\footins8truein}
1421 % \begin{macro}{\showoverfull}
1422 % \changes{v0.1k ltfinal}{1994/05/19}{used \cs{@ne} not 1}
1423 % The following commands are used in debugging:
1425 \def\showoverfull{\tracingonline\@ne}
1429 % \begin{macro}{\showoutput}
1430 % \changes{v0.1k ltfinal}{1994/05/19}
1431 % {used \cs{maxdimen} not 99999}
1432 % \changes{v1.1n}{1995/07/02}{Use \cs{showoverfull} to save space}
1433 % \changes{v1.1x}{2002/02/24}{Use newly added \cs{loggingoutput}}
1434 % \begin{macro}{\loggingoutput}
1435 % \changes{v1.1x}{2002/02/24}{Macro added}
1437 \gdef\loggingoutput{\tracingoutput\@ne
1438 \showboxbreadth\maxdimen\showboxdepth\maxdimen\errorstopmode}
1439 \gdef\showoutput{\loggingoutput\showoverfull}
1446 % \begin{macro}{\tracingall}
1447 % \changes{LaTeX209}{1991/08/26}{Added
1448 % \cs{errorcontextlines}!=\cs{maxdimen}, suggested by J. Schrod}
1449 % \changes{v1.1n}{1995/07/02}{Use \cs{showoutput} to save space}
1450 % \changes{v1.1x}{2002/02/24}{Use newly added \cs{loggingoutput}}
1451 % \begin{macro}{\loggingall}
1452 % \changes{v1.1x}{2002/02/24}{Macro added}
1453 % \changes{v2.0b}{2012/01/20}{etex tracing if available}
1454 % \changes{v2.0d}{2015/02/20}{Spell commands correctly :-)}
1455 % \changes{v2.0g}{2015/03/10}{Reorganise to be less noisy}
1457 %<latexrelease>\IncludeInRelease{2015/01/20}{\loggingall}{etex tracing}%
1458 %<*2ekernel|latexrelease>
1459 \ifx\tracingscantokens\@undefined
1463 \tracinglostchars\@ne
1464 \tracingparagraphs\@ne
1465 \errorcontextlines\maxdimen
1468 \tracingcommands\tw@
1469 \tracingrestores\@ne
1475 \tracinglostchars\tw@
1476 \tracingparagraphs\@ne
1479 \tracingscantokens\@ne
1481 \errorcontextlines\maxdimen
1484 \tracingcommands\thr@@
1485 \tracingrestores\@ne
1489 \gdef\tracingall{\showoverfull\loggingall}
1490 %</2ekernel|latexrelease>
1491 %<latexrelease>\EndIncludeInRelease
1492 %<latexrelease>\IncludeInRelease{0000/00/00}{\loggingall}{etex tracing}%
1493 %<latexrelease>\gdef\loggingall{\tracingcommands\tw@\tracingstats\tw@
1494 %<latexrelease> \tracingpages\@ne\tracinglostchars\@ne
1495 %<latexrelease> \tracingmacros\tw@\tracingparagraphs\@ne\tracingrestores\@ne
1496 %<latexrelease> \errorcontextlines\maxdimen\loggingoutput}
1497 %<latexrelease> \gdef\tracingall{\loggingall\showoverfull}
1498 %<latexrelease>\EndIncludeInRelease
1504 % \begin{macro}{\tracingnone}
1505 % \changes{v2.0g}{2015/03/10}{macro added}
1506 % \begin{macro}{\hideoutput}
1507 % \changes{v2.0g}{2015/03/10}{macro added}
1509 %<latexrelease>\IncludeInRelease{2015/01/20}{\tracingnone}%
1510 %<latexrelease> {turn off etex tracing}%
1511 %<*2ekernel|latexrelease>
1512 \ifx\tracingscantokens\@undefined
1517 \showboxbreadth\m@ne
1519 \errorcontextlines\m@ne
1521 \tracingparagraphs\z@
1523 \tracinglostchars\@ne
1534 \showboxbreadth\m@ne
1536 \errorcontextlines\m@ne
1538 \tracingscantokens\z@
1541 \tracingparagraphs\z@
1543 \tracinglostchars\@ne
1553 \showboxbreadth\m@ne
1560 %</2ekernel|latexrelease>
1561 %<latexrelease>\EndIncludeInRelease
1562 %<latexrelease>\IncludeInRelease{0000/00/00}{\tracingnone}%
1563 %<latexrelease> {turn off etex tracing}%
1564 %<latexrelease>\let\tracingnone\@undefined
1565 %<latexrelease>\let\hideoutput\@undefined
1566 %<latexrelease>\EndIncludeInRelease
1572 % \LaTeX\ change: |\showhyphens| Defined later.
1574 % Punctuation affects the spacing.