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/10/27 v2.1b 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}
365 \def\newwrite {\e@alloc\write \chardef{\count17}\m@ne\sixt@@n}
367 {\e@alloc\mathgroup\chardef{\count18}\m@ne\e@mathgroup@top}
368 \def\newlanguage {\e@alloc\language \chardef{\count19}\m@ne\@cclvi}
369 \let\newfam\new@mathgroup
370 %</2ekernel|latexrelease>
374 %<latexrelease>\EndIncludeInRelease
375 %<latexrelease>\IncludeInRelease{0000/00/00}%
376 %<latexrelease> {\newcount}{Extended Allocation}%
377 %<latexrelease>\def\newcount{\alloc@0\count\countdef\insc@unt}
378 %<latexrelease>\def\newdimen{\alloc@1\dimen\dimendef\insc@unt}
379 %<latexrelease>\def\newskip{\alloc@2\skip\skipdef\insc@unt}
380 %<latexrelease>\def\newmuskip{\alloc@3\muskip\muskipdef\@cclvi}
381 %<latexrelease>\def\newbox{\alloc@4\box\chardef\insc@unt}
382 %<latexrelease>\def\newtoks{\alloc@5\toks\toksdef\@cclvi}
383 %<latexrelease>\def\newread{\alloc@6\read\chardef\sixt@@n}
384 %<latexrelease>\def\newwrite{\alloc@7\write\chardef\sixt@@n}
385 %<latexrelease>\def\new@mathgroup{\alloc@8\fam\chardef\sixt@@n}
386 %<latexrelease>\def\newlanguage{\alloc@9\language\chardef\@cclvi}
387 %<latexrelease>\let\newfam\new@mathgroup
388 %<latexrelease>\EndIncludeInRelease
399 %\begin{macro}{\e@alloc@chardef}
400 % \changes{v2.0a}{2014/12/30}{macro added}
401 %\begin{macro}{\e@alloc@top}
402 % \changes{v2.0a}{2014/12/30}{macro added}
403 % The upper limit of extended registers, which leaves
404 % this number (eg |\dimen32767|) always unallocated
406 % cf traditional |\dimen255|.
408 %<*2ekernel|latexrelease>
409 %<latexrelease>\IncludeInRelease{2015/01/01}%
410 %<latexrelease> {\e@alloc@chardef}{Extended Allocation}%
414 \ifx\directlua\@undefined
415 \ifx\widowpenalties\@undefined
417 % classic tex has $2^8$ registers.
419 \mathchardef\e@alloc@top=255
420 \let\e@alloc@chardef\chardef
423 % etex and xetex have $2^{15}$ registers.
425 \mathchardef\e@alloc@top=32767
426 \let\e@alloc@chardef\mathchardef
430 % luatex has $2^{16}$ registers.
432 \chardef\e@alloc@top=65535
433 \let\e@alloc@chardef\chardef
438 %</2ekernel|latexrelease>
439 %<latexrelease>\EndIncludeInRelease
440 %<latexrelease>\IncludeInRelease{0000/00/00}%
441 %<latexrelease> {\e@alloc@chardef}{Extended Allocation}%
442 %<latexrelease>\let\e@alloc@top\@undefined
443 %<latexrelease>\let\e@alloc@chardef\@undefined
444 %<latexrelease>\EndIncludeInRelease
449 %\begin{macro}{\e@mathgroup@top}
450 % \changes{v2.0f}{2015/03/02}{macro added}
451 % The upper limit of extended math groups (|\fam|)
452 % 16 in classic \TeX\ and e-\TeX, but 256 in Unicode TeX variants.
454 %<*2ekernel|latexrelease>
455 %<latexrelease>\IncludeInRelease{2015/01/01}%
456 %<latexrelease> {\e@mathgroup@top}{Extended Allocation}%
460 \ifx\Umathcode\@undefined
462 % classic and e tex have 16 fam (0--15).
464 \chardef\e@mathgroup@top=16
467 % xetex and luatex have 256 fam (0--255).
469 \chardef\e@mathgroup@top=256
474 %</2ekernel|latexrelease>
475 %<latexrelease>\EndIncludeInRelease
476 %<latexrelease>\IncludeInRelease{0000/00/00}%
477 %<latexrelease> {\e@mathgroup@top}{Extended Allocation}%
478 %<latexrelease>\let\e@mathgroup@top\@undefined
479 %<latexrelease>\EndIncludeInRelease
483 % \begin{macro}{\e@alloc}
484 % \changes{v2.0a}{2014/12/30}{macro added}
485 % A modified version of |\alloc@| that
486 % takes the count register rather than just the final digit of its number
487 % (assuming |\count|$1x$).
488 % It also has an extra argument to give the top of the extended range.
490 % | #1 #2 #3 #4 #5 #6 |
492 % | \e@alloc type defcmd current top extended-top newname|
494 % Note that if just a single allocation range is required
495 % (not omitting a range up to 255 for inserts) then $-1$
496 % should be used for the first upper bound argument, |#4|.
499 %<*2ekernel|latexrelease>
500 %<latexrelease>\IncludeInRelease{2015/01/01}{\e@alloc}{Extended Allocation}%
503 % \changes{v2.0h}{2015/06/19}{extra braces in case arguments not single token}
505 \def\e@alloc#1#2#3#4#5#6{%
506 \global\advance#3\@ne
507 \e@ch@ck{#3}{#4}{#5}#1%
508 \allocationnumber#3\relax
509 \global#2#6\allocationnumber
510 \wlog{\string#6=\string#1\the\allocationnumber}}%
514 %</2ekernel|latexrelease>
515 %<latexrelease>\EndIncludeInRelease
516 %<latexrelease>\IncludeInRelease{0000/00/00}{\e@alloc}{Extended Allocation}%
517 %<latexrelease>\let\e@alloc\@undefined
518 %<latexrelease>\EndIncludeInRelease
523 %\begin{macro}{\e@ch@ck}
524 % \changes{v2.0a}{2014/12/30}{macro added}
525 % Extended check command.
526 % If the first range is exceeded, bump to 256 (or 266 for counts)
527 % and try again, testing the extended range.
528 %\begin{macro}{\extrafloats}
529 % \changes{v2.0a}{2014/12/30}{macro added}
530 % \changes{v2.0c}{2015/01/23}{reserve counts 256--265}
531 % Allocate matching registers from the top of the extended range
532 % and add to |\@freelist|.
535 %<*2ekernel|latexrelease>
536 %<latexrelease>\IncludeInRelease{2015/10/01}
537 %<latexrelease> {\e@ch@ck}{Extended Allocation (checking)}%
541 \gdef\e@ch@ck#1#2#3#4{%
545 % If we've reached the classical top limit, bump to 256
546 % or 266 for counts (count 256--265 are reserved by the allocation
548 % \changes{v2.1b}{2015/10/27}
549 % {Use global assignment when switching to extended range}
553 \ifx\count#4\global\advance#1 10 \fi
556 % Check we are below the extended limit.
557 % \changes{v2.0i}{2015/08/06}
558 % {Add \cs{string} in case argument is not an unexpandable primitive}
562 \errmessage{No room for a new \string#4}%
565 %<latexrelease>\EndIncludeInRelease
566 %<latexrelease>\IncludeInRelease{2015/01/01}%
567 %<latexrelease> {\e@ch@ck}{Extended Allocation (checking)}%
568 %<latexrelease>\gdef\e@ch@ck#1#2#3#4{%
569 %<latexrelease> \ifnum#1<#2\else
570 %<latexrelease> \ifnum#1=#2\relax
571 %<latexrelease> #1\@cclvi
572 %<latexrelease> \ifx\count#4\advance#1 10 \fi
574 %<latexrelease> \ifnum#1<#3\relax
575 %<latexrelease> \else
576 %<latexrelease> \errmessage{No room for a new #4}%
578 %<latexrelease> \fi}%
579 %<latexrelease>\EndIncludeInRelease
580 %<latexrelease>\IncludeInRelease{0000/00/00}%
581 %<latexrelease> {\e@ch@ck}{Extended Allocation (checking)}%
582 %<latexrelease>\let\e@ch@ck\@undefined
583 %<latexrelease>\EndIncludeInRelease
587 %<latexrelease>\IncludeInRelease{2015/01/01}%
588 %<latexrelease> {\extrafloats}{Extra floats}%
593 \let\float@count\e@alloc@top
596 % \begin{macro}{\extrafloats}
598 \ifx\numexpr\@undefined
600 % In classic TeX use |\newinsert| to allocate float boxes.
605 \newinsert\reserved@a
607 \csname bx@\the\allocationnumber\endcsname\allocationnumber
608 \@cons\@freelist{\csname bx@\the\allocationnumber\endcsname}%
610 \expandafter\extrafloats
619 % In e-tex take float boxes from the top of the extended range.
623 \count@\numexpr\float@count-1\relax
628 \e@alloc@chardef\float@count\count@
629 \expandafter\e@alloc@chardef
630 \csname bx@\the\float@count\endcsname\float@count
631 \@cons\@freelist{\csname bx@\the\float@count\endcsname}%
633 \extrafloats\expandafter{\numexpr#1-1\relax}%
642 %</2ekernel|latexrelease>
643 %<latexrelease>\EndIncludeInRelease
644 %<latexrelease>\IncludeInRelease{0000/00/00}%
645 %<latexrelease> {\extrafloats}{Extra floats}%
646 %<latexrelease>\let\float@count\@undefined
647 %<latexrelease>\let\extrafloats\@undefined
648 %<latexrelease>\EndIncludeInRelease
654 % \begin{macro}{\alloc@}
656 \def\alloc@#1#2#3#4#5{\global\advance\count1#1\@ne
657 \ch@ck#1#4#2% make sure there's still room
658 \allocationnumber\count1#1%
659 \global#3#5\allocationnumber
660 \wlog{\string#5=\string#2\the\allocationnumber}}
664 % \begin{macro}{\newinsert}
665 % \changes{v2.1a}{2015/08/30}{new \cs{newinsert} implementation}
668 %<*2ekernel|latexrelease>
669 %<latexrelease>\IncludeInRelease{2015/10/01}
670 %<latexrelease> {\newinsert}{Extended \newinsert}%
673 \ifx\numexpr\@undefined
675 % If e-\TeX\ is not available use the original plain \TeX\
676 % definition of |\newinsert|.
678 \def\newinsert#1{\global\advance\insc@unt \m@ne
679 \ch@ck0\insc@unt\count
680 \ch@ck1\insc@unt\dimen
681 \ch@ck2\insc@unt\skip
683 \allocationnumber\insc@unt
684 \global\chardef#1\allocationnumber
685 \wlog{\string#1=\string\insert\the\allocationnumber}}
690 % The highest register allowed with |\insert|.
692 \ifx\directlua\@undefined
693 \chardef\e@insert@top255
695 \chardef\e@insert@top\e@alloc@top
698 % If the classic registers are exausted, take an insert from the free float list
699 % and use |\extrafloats| to add a new float to that list.
703 \ifnum\count10<\insc@unt
704 \ifnum\count11<\insc@unt
705 \ifnum\count12<\insc@unt
706 \ifnum\count14<\insc@unt
710 \global\advance\insc@unt\m@ne
711 \allocationnumber\insc@unt
714 \@next\@currbox\@freelist
715 {\ifnum\@currbox<\e@insert@top
716 \allocationnumber\@currbox
720 {\ch@ck0\m@ne\insert}%
722 \global\chardef#1\allocationnumber
723 \wlog{\string#1=\string\insert\the\allocationnumber}%
728 %</2ekernel|latexrelease>
732 %<latexrelease>\EndIncludeInRelease
733 %<latexrelease>\IncludeInRelease{0000/00/00}%
734 %<latexrelease> {\newinsert}{Extended \newinsert}%
735 %<latexrelease>\let\e@insert@top\@undefined
736 %<latexrelease>\def\newinsert#1{\global\advance\insc@unt \m@ne
737 %<latexrelease> \ch@ck0\insc@unt\count
738 %<latexrelease> \ch@ck1\insc@unt\dimen
739 %<latexrelease> \ch@ck2\insc@unt\skip
740 %<latexrelease> \ch@ck4\insc@unt\box
741 %<latexrelease> \allocationnumber\insc@unt
742 %<latexrelease> \global\chardef#1\allocationnumber
743 %<latexrelease> \wlog{\string#1=\string\insert\the\allocationnumber}}
744 %<latexrelease>\EndIncludeInRelease
749 % \begin{macro}{\ch@ck}
752 \ifnum\count1#1<#2\else
753 \errmessage{No room for a new #3}%
758 % \changes{v2.0h}{2015/06/19}{delete spurious old definition of \cs{newtoks}}
759 % \begin{macro}{\newhelp}
761 \def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}}
765 % \begin{macro}{\maxdimen}
766 % \begin{macro}{\hideskip}
767 % Here are some examples of allocation.
769 \newdimen\maxdimen \maxdimen=16383.99999pt % the largest legal <dimen>
770 \newskip\hideskip \hideskip=-1000pt plus 1fill % negative but can grow
777 % \begin{macro}{\z@skip}
778 % \begin{macro}{\voidb@x}
780 \newdimen\p@ \p@=1pt % this saves macro space and time
781 \newdimen\z@ \z@=0pt % can be used both for 0pt and 0
782 \newskip\z@skip \z@skip=0pt plus0pt minus0pt
783 \newbox\voidb@x % permanently void box register
790 % \changes{v1.1p}{1995/10/02}{Move \cs{newif} to ltdefns}
793 \message{compatibility for TeX 2, }
796 % If this file is used in an old \TeX\ we define the new features
797 % of \TeX\ 3.0 as simple macros or counters so that files that uses
798 % these features can be processed in such an environment
799 % (They will however produce some other results).
802 \ifx\@undefined\inputlineno
803 \newcount\inputlineno
805 % This could be used to detect that an old \TeX\ is in force
809 % Extra test for MLTeX 2, RmS 91/11/07.
811 \ifx\@undefined\language
814 \newcount\lefthyphenmin
815 \newcount\righthyphenmin
816 \newcount\errorcontextlines
817 \newcount\holdinginserts
818 \newdimen\emergencystretch
820 \let\noboundary\relax
821 \newcount\setlanguage
825 % Assign initial values to \TeX's parameters
828 \message{parameters,}
831 % All of \TeX's numeric parameters are listed here,
832 % but the code is commented out if no special value needs to be set.
833 % INITEX makes all parameters zero except where noted.
835 % \begin{oldcomments}
838 \tolerance=200 % INITEX sets this to 10000
848 \displaywidowpenalty=50
850 \predisplaypenalty=10000
852 % \postdisplaypenalty=0
853 % \interlinepenalty=0
854 % \floatingpenalty=0, set during \insert
855 % \outputpenalty=0, set before TeX enters \output
857 \doublehyphendemerits=10000
858 \finalhyphendemerits=5000
861 % \looseness=0, cleared by TeX after each paragraph
867 % \tracingparagraphs=0
879 % \lefthyphenmin=2 \righthyphenmin=3 set below
881 % \maxdeadcycles=25 % INITEX does this
882 % \hangafter=1 % INITEX does this, also TeX after each paragraph
884 % \mag=1000 % INITEX does this
885 % \escapechar=`\\ % INITEX does this
887 \defaulthyphenchar=`\-
890 % \endlinechar=`\^^M % INITEX does this
891 % \newlinechar=-1 \LaTeX\ sets this in ltdefns.dtx.
895 % \time=now % TeX does this at beginning of job
896 % \day=now % TeX does this at beginning of job
897 % \month=now % TeX does this at beginning of job
898 % \year=now % TeX does this at beginning of job
901 % In \LaTeX{} we don't want box information in the transcript
902 % unless we do a full tracing.
903 % \changes{v1.0g}{1994/04/28}{Turn off overfull box tracing in log}
908 \errorcontextlines=-1
916 \splitmaxdepth=\maxdimen
917 \boxmaxdepth=\maxdimen
920 % \begin{oldcomments}
921 % \lineskiplimit=0pt, changed by \normalbaselines
923 \delimitershortfall=5pt
924 \nulldelimiterspace=1.2pt
928 % \predisplaysize=0pt, set before TeX enters $$
929 % \displaywidth=0pt, set before TeX enters $$
930 % \displayindent=0pt, set before TeX enters $$
934 % \hangindent=0pt, zeroed by TeX after each paragraph
938 % \baselineskip=0pt, changed by \normalbaselines
939 % \lineskip=0pt, changed by \normalbaselines
941 \parskip=0pt plus 1pt
942 \abovedisplayskip=12pt plus 3pt minus 9pt
943 \abovedisplayshortskip=0pt plus 3pt
944 \belowdisplayskip=12pt plus 3pt minus 9pt
945 \belowdisplayshortskip=7pt plus 3pt minus 4pt
957 \parfillskip=0pt plus 1fil
962 % \begin{macro}{\normalbaselineskip}
963 % \begin{macro}{\normallineskip}
964 % \begin{macro}{\normallineskiplimit}
965 % We also define special registers that function like parameters:
967 \newskip\normalbaselineskip \normalbaselineskip=12pt
968 \newskip\normallineskip \normallineskip=1pt
969 \newdimen\normallineskiplimit \normallineskiplimit=0pt
975 % \begin{macro}{\interfootlinepenalty}
977 \newcount\interfootnotelinepenalty \interfootnotelinepenalty=100
981 % Definitions for preloaded fonts
983 % \begin{macro}{\magstephalf}
984 % \begin{macro}{\magstep}
986 \def\magstephalf{1095 }
987 \def\magstep#1{\ifcase#1 \@m\or 1200\or 1440\or 1728\or
988 2074\or 2488\fi\relax}
994 % Macros for setting ordinary text
996 % \begin{macro}{\frenchspacing}
997 % \begin{macro}{\nonfrenchspacing}
999 \def\frenchspacing{\sfcode`\.\@m \sfcode`\?\@m \sfcode`\!\@m
1000 \sfcode`\:\@m \sfcode`\;\@m \sfcode`\,\@m}
1001 \def\nonfrenchspacing{\sfcode`\.3000\sfcode`\?3000\sfcode`\!3000%
1002 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 }
1007 % \begin{macro}{\normalbaselines}
1009 \def\normalbaselines{\lineskip\normallineskip
1010 \baselineskip\normalbaselineskip \lineskiplimit\normallineskiplimit}
1016 % \changes{v1.1m}{1995/09/01}{Use \cs{let} to save space}
1017 % Save a bit of space by using |\let| here.
1019 \def\^^M{\ } % control <return> = control <space>
1020 \let\^^I\^^M % same for <tab>
1025 % \begin{macro}{\lq}
1026 % \begin{macro}{\rq}
1034 % \begin{macro}{\lbrack}
1035 % \begin{macro}{\rbrack}
1043 % \begin{macro}{\aa}
1044 % \begin{macro}{\AA}
1045 % These are not from plain.tex but they are similar to other commands
1046 % found here and nowhere else, being alternate input forms for
1055 % \begin{macro}{\endgraf}
1056 % \begin{macro}{\endline}
1064 % \begin{macro}{\space}
1070 % \begin{macro}{\empty}
1071 % \changes{v1.1m}{1995/09/01}{Use \cs{let} to save space}
1072 % This probably ought to go altogether, but let it to the \LaTeX\
1073 % version to save space.
1079 % \begin{macro}{\null}
1085 % \begin{macro}{\bgroup}
1086 % \begin{macro}{\egroup}
1094 % \begin{macro}{\obeylines}
1095 % \begin{macro}{\obeyspaces}
1096 % In |\obeylines|, we say |\let^^M=\par| instead of |\def^^M{\par}|
1097 % since this allows, for example, |\let\par=\cr \obeylines \halign{...|
1099 {\catcode`\^^M=\active % these lines must end with %
1100 \gdef\obeylines{\catcode`\^^M\active \let^^M\par}%
1101 \global\let^^M\par} % this is in case ^^M appears in a \write
1102 \def\obeyspaces{\catcode`\ \active}
1103 {\obeyspaces\global\let =\space}
1108 % \begin{macro}{\loop}
1109 % \changes{v1.0h}{1994/05/16}{Use Kabelschacht method}
1110 % \begin{macro}{\iterate}
1111 % \changes{v1.1b}{1994/11/10}
1112 % {(CAR) added extra \cs{relax}}
1113 % \changes{v1.1m}{1994/05/26}
1114 % {(CAR) added \cs{long}}
1115 % \begin{macro}{\repeat}
1116 % We use Kabelschacht's method of doing loops, see TUB 8\#2 (1987).
1117 % (unless that breaks something :-). It turned out to need an
1118 % extra |\relax|: see pr/642 (|\loop| could do one iteration too much
1119 % in certain cases).
1121 \long\def \loop #1\repeat{%
1122 \def\iterate{#1\relax % Extra \relax
1123 \expandafter\iterate\fi
1129 % This setting of |\repeat| is needed to make |\loop...\if...\repeat|
1130 % skippable within another |\if...|.
1138 % \LaTeX\ defines |\smallskip|, etc.\ in |ltspace.dtx|.
1140 % \begin{macro}{\nointerlineskip}
1141 % \begin{macro}{\offinterlineskip}
1142 % \changes{v1.1n}{1995/07/02}{Replaced 1000 by \cs{@m}}
1144 \def\nointerlineskip{\prevdepth-\@m\p@}
1145 \def\offinterlineskip{\baselineskip-\@m\p@
1146 \lineskip\z@ \lineskiplimit\maxdimen}
1151 % \begin{macro}{\vglue}
1152 % \begin{macro}{\hglue}
1154 \def\vglue{\afterassignment\vgl@\skip@=}
1155 \def\vgl@{\par \dimen@\prevdepth \hrule \@height\z@
1156 \nobreak\vskip\skip@ \prevdepth\dimen@}
1157 \def\hglue{\afterassignment\hgl@\skip@=}
1158 \def\hgl@{\leavevmode \count@\spacefactor \vrule \@width\z@
1159 \nobreak\hskip\skip@ \spacefactor\count@}
1164 % \LaTeX\ defines |~| in |ltdefns.dtx|.
1166 % \begin{macro}{\slash}
1168 \def\slash{/\penalty\exhyphenpenalty} % a `/' that acts like a `-'
1172 % \begin{macro}{\break}
1173 % \begin{macro}{\nobreak}
1174 % \begin{macro}{\allowbreak}
1176 \def\break{\penalty-\@M}
1177 \def\nobreak{\penalty \@M}
1178 \def\allowbreak{\penalty \z@}
1184 % \begin{macro}{\filbreak}
1185 % \begin{macro}{\goodbreak}
1187 \def\filbreak{\par\vfil\penalty-200\vfilneg}
1188 \def\goodbreak{\par\penalty-500 }
1193 % \begin{macro}{\eject}
1194 % \changes{v1.1s}{1995/10/17}{Move \cs{supereject} to compat file}
1195 % Define |\eject| as in plain \TeX\ but define |\supereject| only in
1196 % the compatibility file.
1198 \def\eject{\par\break}
1202 % \begin{macro}{\removelastskip}
1204 \def\removelastskip{\ifdim\lastskip=\z@\else\vskip-\lastskip\fi}
1208 % \begin{macro}{\smallbreak}
1209 % \begin{macro}{\medbreak}
1210 % \begin{macro}{\bigbreak}
1212 \def\smallbreak{\par\ifdim\lastskip<\smallskipamount
1213 \removelastskip\penalty-50\smallskip\fi}
1214 \def\medbreak{\par\ifdim\lastskip<\medskipamount
1215 \removelastskip\penalty-100\medskip\fi}
1216 \def\bigbreak{\par\ifdim\lastskip<\bigskipamount
1217 \removelastskip\penalty-200\bigskip\fi}
1223 % \begin{macro}{\m@th}
1224 % \changes{v1.0h}{1994/05/16}{Remove unnecessary space}
1226 \def\m@th{\mathsurround\z@}
1230 % \begin{macro}{\underbar}
1231 % Due to \LaTeX's redefinition of |\underline| plain \TeX's
1232 % |\underbar| can be done in a simpler fashion (but do we
1234 % \changes{v1.1m}{1994/05/26}
1235 % {(CAR/FMi) changed to use box \cs{tw@}}
1236 % \changes{v1.1p}{1994/05/26}
1237 % {(DPC) changed to use \cs{sbox}}
1239 \def\underbar#1{\underline{\sbox\tw@{#1}\dp\tw@\z@\box\tw@}}
1243 % \begin{macro}{\strutbox}
1244 % \begin{macro}{\strut}
1245 % \LaTeX\ sets |\strutbox| in |\set@fontsize|.
1248 \def\strut{\relax\ifmmode\copy\strutbox\else\unhcopy\strutbox\fi}
1253 % \begin{macro}{\hidewidth}
1254 % For alignment entries that can stick out.
1256 \def\hidewidth{\hskip\hideskip}
1260 % \changes{v1.0h}{1994/05/16}{Remove unnecessary def for \cs{item}}
1261 % \changes{v1.1i}{1995/04/27}
1262 % {Move \cs{hang} and \cs{textindent} to latex209.def}
1263 % \changes{RmS}{1991/11/04}{Removed \cs{itemitem} since never
1264 % needed/useful with \LaTeX.}
1266 % \begin{macro}{\narrower}
1269 \advance\leftskip\parindent
1270 \advance\rightskip\parindent}
1274 % \changes{v1.1c}{1994/11/12}{Comment out more encoding specific
1276 % \LaTeX\ defines |\ae| and similar commands elsewhere.
1284 % Most text commands are actually encoding specific and therefore
1285 % defined later, so commented out or removed from this file.
1286 % \changes{v1.0h}{1994/05/16}{Comment out encoding specific commands}
1288 % \begin{macro}{\leavevmode}
1289 % begins a paragraph, if necessary
1291 \def\leavevmode{\unhbox\voidb@x}
1295 % \begin{macro}{\mathhexbox}
1297 \def\mathhexbox#1#2#3{\mbox{$\m@th \mathchar"#1#2#3$}}
1302 % \begin{macro}{\ialign}
1304 \def\ialign{\everycr{}\tabskip\z@skip\halign} % initialized \halign
1308 % \begin{macro}{\oalign}
1309 % \begin{macro}{\o@lign}
1310 % \begin{macro}{\ooalign}
1312 \def\oalign#1{\leavevmode\vtop{\baselineskip\z@skip \lineskip.25ex%
1313 \ialign{##\crcr#1\crcr}}}
1314 \def\o@lign{\lineskiplimit\z@ \oalign}
1315 \def\ooalign{\lineskiplimit-\maxdimen \oalign}
1321 % \begin{macro}{\sh@ft}
1322 % \changes{v1.1t}{1996/07/26}{replace \cs{dimen}\cs{z@} by
1324 % \changes{v1.1y}{2005/09/27}{Macro no longer used but
1325 % left for compatibility}
1326 % The definition of this macro in plain.tex was improved in
1327 % about 1997; but as a result its usage was changed and its new
1328 % definition is not appropriate for \LaTeX{}.
1330 % Since the version given here has been in use by
1331 % \LaTeX{} for many years it does not seem prudent to remove it now.
1332 % As far as we can tell it has only been used to define~|\b| and~|\d|
1333 % but this cannot be certain.
1335 \def\sh@ft#1{\dimen@.00#1ex\multiply\dimen@\fontdimen1\font
1336 \kern-.0156\dimen@} % compensate for slant in lowered accents
1340 % \begin{macro}{\ltx@sh@ft}
1341 % \changes{v1.1y}{2005/09/27}{New macro}
1342 % This is the \LaTeX{} version of the second incarnation of the plain
1343 % macro |\sh@ft|, which takes a dimension as its argument. It shifts
1344 % a pseudo-accent horizontally by an amount proportional to the product
1345 % of its argument and the slant-per-point (fontdimen 1).
1351 \fontdimen1\font \dimen@
1352 } % kern by #1 times the current slant
1358 % \LaTeX{} change: the text commands such as
1359 % |\d|, |\b|, |\c|, |\copyright|,~|\TeX|
1360 % are now defined elsewhere.
1363 % {1993/11/29}{All accents in decimals; suggested by Paul Taylor}
1364 % \changes{v1.0d}{1994/04/12}
1365 % {Define \cs{@acci}}
1366 % \changes{v1.0h}{1994/05/16}{Remove \cs{@acci} and friends again}
1368 % \LaTeX{} change: Make |\t| work in a moving argument.
1369 % Now defined elsewhere.
1371 % \begin{macro}{\hrulefill}
1372 % \begin{macro}{\dotfill}
1373 % \LaTeX\ change: |\kern\z@| added to end of
1374 % |\hrulefill| and |\dotfill|
1375 % to make them work in `tabular' and `array' environments.
1376 % (Change made 24 July 1987).
1377 % \LaTeX\ change: |\leavevmode| added at beginning of
1378 % |\dotfill| and |\hrulefill|
1379 % so that they work as expected in vertical mode.
1381 \def\hrulefill{\leavevmode\leaders\hrule\hfill\kern\z@}
1383 % The box in |\dotfill| originally contained (in plain.tex):\\
1384 % |\mkern 1.5mu .\mkern 1.5mu|;\\
1385 % the width of .44em differs from this
1386 % by .04pt which is probably an acceptable difference within leaders.
1387 % \changes{v1.1u}{1996/10/28}{Removed math mode}
1388 % \changes{v1.1v}{1996/10/29}{Got arithmetic correct (CAR)}
1389 % \changes{v1.1w}{1996/11/03}{Saved tokens by using \cs{hb@xt@}}
1393 \cleaders \hb@xt@ .44em{\hss.\hss}\hfill
1399 % INITEX sets |\sfcode x=1000| for all x, except that |\sfcode`X=999|
1400 % for uppercase letters. The following changes are needed:
1402 \sfcode`\)=0 \sfcode`\'=0 \sfcode`\]=0
1404 % The |\nonfrenchspacing| macro will make further changes to
1408 % Definitions related to output
1411 % \changes{v1.1k}{1995/05/22}{Definitions of \cs{footins} and
1412 % \cs{footnoterule} moved to ltfloat.}
1415 % |\magnification| doesn't work in \LaTeX.
1417 %\def\magnification{\afterassignment\m@g\count@}
1418 %\def\m@g{\mag\count@
1419 % \hsize6.5truein\vsize8.9truein\dimen\footins8truein}
1422 % \begin{macro}{\showoverfull}
1423 % \changes{v0.1k ltfinal}{1994/05/19}{used \cs{@ne} not 1}
1424 % The following commands are used in debugging:
1426 \def\showoverfull{\tracingonline\@ne}
1430 % \begin{macro}{\showoutput}
1431 % \changes{v0.1k ltfinal}{1994/05/19}
1432 % {used \cs{maxdimen} not 99999}
1433 % \changes{v1.1n}{1995/07/02}{Use \cs{showoverfull} to save space}
1434 % \changes{v1.1x}{2002/02/24}{Use newly added \cs{loggingoutput}}
1435 % \begin{macro}{\loggingoutput}
1436 % \changes{v1.1x}{2002/02/24}{Macro added}
1438 \gdef\loggingoutput{\tracingoutput\@ne
1439 \showboxbreadth\maxdimen\showboxdepth\maxdimen\errorstopmode}
1440 \gdef\showoutput{\loggingoutput\showoverfull}
1447 % \begin{macro}{\tracingall}
1448 % \changes{LaTeX209}{1991/08/26}{Added
1449 % \cs{errorcontextlines}!=\cs{maxdimen}, suggested by J. Schrod}
1450 % \changes{v1.1n}{1995/07/02}{Use \cs{showoutput} to save space}
1451 % \changes{v1.1x}{2002/02/24}{Use newly added \cs{loggingoutput}}
1452 % \begin{macro}{\loggingall}
1453 % \changes{v1.1x}{2002/02/24}{Macro added}
1454 % \changes{v2.0b}{2012/01/20}{etex tracing if available}
1455 % \changes{v2.0d}{2015/02/20}{Spell commands correctly :-)}
1456 % \changes{v2.0g}{2015/03/10}{Reorganise to be less noisy}
1458 %<latexrelease>\IncludeInRelease{2015/01/20}{\loggingall}{etex tracing}%
1459 %<*2ekernel|latexrelease>
1460 \ifx\tracingscantokens\@undefined
1464 \tracinglostchars\@ne
1465 \tracingparagraphs\@ne
1466 \errorcontextlines\maxdimen
1469 \tracingcommands\tw@
1470 \tracingrestores\@ne
1476 \tracinglostchars\tw@
1477 \tracingparagraphs\@ne
1480 \tracingscantokens\@ne
1482 \errorcontextlines\maxdimen
1485 \tracingcommands\thr@@
1486 \tracingrestores\@ne
1490 \gdef\tracingall{\showoverfull\loggingall}
1491 %</2ekernel|latexrelease>
1492 %<latexrelease>\EndIncludeInRelease
1493 %<latexrelease>\IncludeInRelease{0000/00/00}{\loggingall}{etex tracing}%
1494 %<latexrelease>\gdef\loggingall{\tracingcommands\tw@\tracingstats\tw@
1495 %<latexrelease> \tracingpages\@ne\tracinglostchars\@ne
1496 %<latexrelease> \tracingmacros\tw@\tracingparagraphs\@ne\tracingrestores\@ne
1497 %<latexrelease> \errorcontextlines\maxdimen\loggingoutput}
1498 %<latexrelease> \gdef\tracingall{\loggingall\showoverfull}
1499 %<latexrelease>\EndIncludeInRelease
1505 % \begin{macro}{\tracingnone}
1506 % \changes{v2.0g}{2015/03/10}{macro added}
1507 % \begin{macro}{\hideoutput}
1508 % \changes{v2.0g}{2015/03/10}{macro added}
1510 %<latexrelease>\IncludeInRelease{2015/01/20}{\tracingnone}%
1511 %<latexrelease> {turn off etex tracing}%
1512 %<*2ekernel|latexrelease>
1513 \ifx\tracingscantokens\@undefined
1518 \showboxbreadth\m@ne
1520 \errorcontextlines\m@ne
1522 \tracingparagraphs\z@
1524 \tracinglostchars\@ne
1535 \showboxbreadth\m@ne
1537 \errorcontextlines\m@ne
1539 \tracingscantokens\z@
1542 \tracingparagraphs\z@
1544 \tracinglostchars\@ne
1554 \showboxbreadth\m@ne
1561 %</2ekernel|latexrelease>
1562 %<latexrelease>\EndIncludeInRelease
1563 %<latexrelease>\IncludeInRelease{0000/00/00}{\tracingnone}%
1564 %<latexrelease> {turn off etex tracing}%
1565 %<latexrelease>\let\tracingnone\@undefined
1566 %<latexrelease>\let\hideoutput\@undefined
1567 %<latexrelease>\EndIncludeInRelease
1573 % \LaTeX\ change: |\showhyphens| Defined later.
1575 % Punctuation affects the spacing.