Require e-TeX
[latex2e.git] / trunk / base / ltplain.dtx
blob47a37c2b16e025d24fd62b8869eddbe547c1fd58
1 % \iffalse meta-comment
3 % Copyright 1993-2016
4 % The LaTeX3 Project and any individual authors listed elsewhere
5 % in this file.
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 %    http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2005/12/01 or later.
18 % This file has the LPPL maintenance status "maintained".
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
22 % information.
24 % The list of derived (unpacked) files belonging to the distribution
25 % and covered by LPPL is defined by the unpacking scripts (with
26 % extension .ins) which are part of the distribution.
28 % \fi
29 % \iffalse
30 %%% From File: ltplain.dtx
32 %<*driver>
33 % \fi
34 \ProvidesFile{ltplain.dtx}
35              [2016/10/15 v2.2d LaTeX Kernel (Plain TeX)]
36 % \iffalse
37 \documentclass{ltxdoc}
38 \GetFileInfo{ltplain.dtx}
39 \begin{document}
40 \title{\filename\\(The file plain.tex, modified for \LaTeX)}
41 \author{Donald~E.~Knuth\\
42  Modified by
43  Leslie Lamport, Frank Mittelbach,\\
44  Rainer Sch\"opf, David Carlisle}
45 \date{\filedate}
46  \MaintainedByLaTeXTeam{latex}
47  \maketitle
48  \DocInput{\filename}
49 \end{document}
50 %</driver>
51 % \fi
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
71 %                             various places}
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 \eTeX{}}
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).
86 % \begin{verbatim}
87 %    \magstep    \magstephalf
88 %    \mathhexbox
89 %    \vglue      \vgl@
90 %    \hglue      \hgl@
91 % \end{verbatim}
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
102 % removed.
104 % \StopEventually{}
107 %    \begin{macrocode}
108 %<*2ekernel>
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
119 %    \end{macrocode}
121 %    \begin{macrocode}
122 \message{catcodes,}
123 %    \end{macrocode}
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:
140 %    \begin{macrocode}
141 \def\dospecials{\do\ \do\\\do\{\do\}\do\$\do\&%
142   \do\#\do\^\do\_\do\%\do\~}
143 %    \end{macrocode}
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.
150 %    \begin{macrocode}
151 \catcode`@=11
152 %    \end{macrocode}
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|.
164 %    \begin{macrocode}
165 \chardef\@ne=1
166 \chardef\tw@=2
167 \chardef\thr@@=3
168 \chardef\sixt@@n=16
169 \chardef\@cclv=255
170 %    \end{macrocode}
171 % \end{macro}
172 % \end{macro}
173 % \end{macro}
174 % \end{macro}
175 % \end{macro}
177 % \begin{macro}{\@cclvi}
178 % \begin{macro}{\@m}
179 % \begin{macro}{\@M}
180 % \begin{macro}{\@MM}
181 % Constants above 255 defined using |\mathchardef|.
182 %    \begin{macrocode}
183 \mathchardef\@cclvi=256
184 \mathchardef\@m=1000
185 \mathchardef\@M=10000
186 \mathchardef\@MM=20000
187 %    \end{macrocode}
188 % \end{macro}
189 % \end{macro}
190 % \end{macro}
191 % \end{macro}
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.
200 %    \begin{macrocode}
201 \message{registers,}
202 %    \end{macrocode}
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
211 % the same time.
213 % \begin{oldcomments}
214 % The following counters are reserved:
215 %   0 to 9  page numbering
216 %       10  count allocation
217 %       11  dimen allocation
218 %       12  skip allocation
219 %       13  muskip allocation
220 %       14  box allocation
221 %       15  toks 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
228 %       22  constant -1
229 % \end{oldcomments}
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\\
245 % 1, 3, 5, 7, 9,\\
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.
250 %    \begin{macrocode}
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, ...
262 %    \end{macrocode}
264 % \begin{macro}{\insc@unt}
265 % \begin{macro}{\allocationnumber}
266 % The insertion counter and most recent allocation.
267 %    \begin{macrocode}
268 \countdef\insc@unt=20
269 \countdef\allocationnumber=21
270 %    \end{macrocode}
271 % \end{macro}
272 % \end{macro}
274 % \begin{macro}{\m@ne}
275 % The constant $-1$.
276 %    \begin{macrocode}
277 \countdef\m@ne=22 \m@ne=-1
278 %    \end{macrocode}
279 % \end{macro}
281 % \begin{macro}{\wlog}
282 % Write on log file (only)
283 %    \begin{macrocode}
284 \def\wlog{\immediate\write\m@ne}
285 %    \end{macrocode}
286 % \end{macro}
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.
296 %    \begin{macrocode}
297 \countdef\count@=255
298 \dimendef\dimen@=0
299 \dimendef\dimen@i=1 % global only
300 \dimendef\dimen@ii=2
301 \skipdef\skip@=0
302 \toksdef\toks@=0
303 %    \end{macrocode}
304 % \end{macro}
305 % \end{macro}
306 % \end{macro}
307 % \end{macro}
308 % \end{macro}
309 % \end{macro}
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}
340 %    \begin{macrocode}
341 %</2ekernel>
342 %<*2ekernel|latexrelease>
343 %<latexrelease>\IncludeInRelease{2015/01/01}%
344 %<latexrelease>                 {\newcount}{Extended Allocation}%
345 %    \end{macrocode}
347 %    \begin{macrocode}
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}
351 \def\newmuskip
352            {\e@alloc\muskip\muskipdef{\count13}\m@ne\e@alloc@top}
353 %    \end{macrocode}
354 % For compatibility use |\chardef| in the classical range.
355 %    \begin{macrocode}
356 \def\newbox   {\e@alloc\box
357                   {\ifnum\allocationnumber<\@cclvi
358                      \expandafter\chardef
359                    \else
360                      \expandafter\e@alloc@chardef
361                    \fi}
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 %    \end{macrocode}
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.
372 %    \begin{macrocode}
373 \ifx\directlua\@undefined
374   \def\newwrite   {\e@alloc\write \chardef{\count17}\m@ne\sixt@@n}
375 \else
376   \def\newwrite   {\e@alloc\write    
377                    {\ifnum\allocationnumber=18 \allocationnumber19\fi
378                      \global\chardef}%
379                    {\count17}%
380                    \m@ne
381                    {128}}
383 %    \end{macrocode}
385 %    \begin{macrocode}
386 \def\new@mathgroup
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>
391 %    \end{macrocode}
393 %    \begin{macrocode}
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
409 %    \end{macrocode}
410 % \end{macro}
411 % \end{macro}
412 % \end{macro}
413 % \end{macro}
414 % \end{macro}
415 % \end{macro}
416 % \end{macro}
417 % \end{macro}
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
425 % by these macros.
426 % cf traditional |\dimen255|.
427 %    \begin{macrocode}
428 %<*2ekernel|latexrelease>
429 %<latexrelease>\IncludeInRelease{2015/01/01}%
430 %<latexrelease>                 {\e@alloc@chardef}{Extended Allocation}%
431 %    \end{macrocode}
433 %    \begin{macrocode}
434 \ifx\directlua\@undefined
435   \ifx\widowpenalties\@undefined
436 %    \end{macrocode}
437 % classic tex has $2^8$ registers.
438 %    \begin{macrocode}
439     \mathchardef\e@alloc@top=255
440     \let\e@alloc@chardef\chardef
441   \else
442 %    \end{macrocode}
443 % etex and xetex have $2^{15}$ registers.
444 %    \begin{macrocode}
445     \mathchardef\e@alloc@top=32767
446     \let\e@alloc@chardef\mathchardef
447   \fi
448 \else
449 %    \end{macrocode}
450 % luatex has $2^{16}$ registers.
451 %    \begin{macrocode}
452   \chardef\e@alloc@top=65535
453   \let\e@alloc@chardef\chardef
455 %    \end{macrocode}
457 %    \begin{macrocode}
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
465 %    \end{macrocode}
466 % \end{macro}
467 % \end{macro}
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.
473 %    \begin{macrocode}
474 %<*2ekernel|latexrelease>
475 %<latexrelease>\IncludeInRelease{2015/01/01}%
476 %<latexrelease>                 {\e@mathgroup@top}{Extended Allocation}%
477 %    \end{macrocode}
479 %    \begin{macrocode}
480 \ifx\Umathcode\@undefined
481 %    \end{macrocode}
482 % classic and e tex have 16 fam (0--15).
483 %    \begin{macrocode}
484   \chardef\e@mathgroup@top=16
485 \else
486 %    \end{macrocode}
487 % xetex and luatex have 256 fam (0--255).
488 %    \begin{macrocode}
489   \chardef\e@mathgroup@top=256
491 %    \end{macrocode}
493 %    \begin{macrocode}
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
500 %    \end{macrocode}
501 % \end{macro}
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|.
518 %    \begin{macrocode}
519 %<*2ekernel|latexrelease>
520 %<latexrelease>\IncludeInRelease{2015/01/01}{\e@alloc}{Extended Allocation}%
521 %    \end{macrocode}
523 % \changes{v2.0h}{2015/06/19}{extra braces in case arguments not single token}
524 %    \begin{macrocode}
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}}%
531 %    \end{macrocode}
533 %    \begin{macrocode}
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
539 %<*2ekernel>
540 %    \end{macrocode}
541 % \end{macro}
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|.
553 %    \begin{macrocode}
554 %</2ekernel>
555 %<*2ekernel|latexrelease>
556 %<latexrelease>\IncludeInRelease{2015/10/01}
557 %<latexrelease>                 {\e@ch@ck}{Extended Allocation (checking)}%
558 %    \end{macrocode}
560 %    \begin{macrocode}
561 \gdef\e@ch@ck#1#2#3#4{%
562   \ifnum#1<#2\else
563 %    \end{macrocode}
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
567 % system).
568 % \changes{v2.1b}{2015/10/27}
569 %         {Use global assignment when switching to extended range}
570 %    \begin{macrocode}
571     \ifnum#1=#2\relax
572       \global#1\@cclvi
573       \ifx\count#4\global\advance#1 10 \fi
574     \fi
575 %    \end{macrocode}
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}
579 %    \begin{macrocode}
580     \ifnum#1<#3\relax
581     \else
582       \errmessage{No room for a new \string#4}%
583     \fi
584   \fi}%
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
593 %<latexrelease>    \fi
594 %<latexrelease>    \ifnum#1<#3\relax
595 %<latexrelease>    \else
596 %<latexrelease>      \errmessage{No room for a new #4}%
597 %<latexrelease>    \fi
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
604 %    \end{macrocode}
606 %    \begin{macrocode}
607 %<latexrelease>\IncludeInRelease{2015/01/01}%
608 %<latexrelease>                 {\extrafloats}{Extra floats}%
609 %    \end{macrocode}
610 % \end{macro}
612 %    \begin{macrocode}
613 \let\float@count\e@alloc@top
614 %    \end{macrocode}
616 % \begin{macro}{\extrafloats}
617 % \changes{v2.2c}{2016/07/29}{use \cs{global} \cs{chardef}}
618 %    \begin{macrocode}
619 \ifx\numexpr\@undefined
620 %    \end{macrocode}
621 % In classic TeX use |\newinsert| to allocate float boxes.
622 %    \begin{macrocode}
623 \def\extrafloats#1{%
624 \count@#1\relax
625 \ifnum\count@>\z@
626 \newinsert\reserved@a
627 \global\expandafter\chardef
628             \csname bx@\the\allocationnumber\endcsname\allocationnumber
629 \@cons\@freelist{\csname bx@\the\allocationnumber\endcsname}%
630 \advance\count@\m@ne
631 \expandafter\extrafloats
632 \expandafter\count@
635 %    \end{macrocode}
637 %    \begin{macrocode}
638 \else
639 %    \end{macrocode}
640 % In e-tex take float boxes from the top of the extended range.
641 %    \begin{macrocode}
642 \def\extrafloats#1{%
643 \ifnum#1>\z@
644 \count@\numexpr\float@count-1\relax
645   \ch@ck0\count@\count
646   \ch@ck1\count@\dimen
647   \ch@ck2\count@\skip
648   \ch@ck4\count@\box
649 \global\e@alloc@chardef\float@count\count@
650 \global\expandafter\e@alloc@chardef
651             \csname bx@\the\float@count\endcsname\float@count
652 \@cons\@freelist{\csname bx@\the\float@count\endcsname}%
653 \expandafter
654 \extrafloats\expandafter{\numexpr#1-1\relax}%
655 \fi}%
656 %    \end{macrocode}
658 %    \begin{macrocode}
660 %    \end{macrocode}
662 %    \begin{macrocode}
663 %</2ekernel|latexrelease>
664 %<latexrelease>\EndIncludeInRelease
665 %<latexrelease>\IncludeInRelease{0000/00/00}%
666 %<latexrelease>                 {\extrafloats}{Extra floats}%
667 %<latexrelease>\let\float@count\@undefined
668 %<latexrelease>\let\extrafloats\@undefined
669 %<latexrelease>\EndIncludeInRelease
670 %<*2ekernel>
671 %    \end{macrocode}
672 % \end{macro}
673 % \end{macro}
675 % \begin{macro}{\alloc@}
676 %    \begin{macrocode}
677 \def\alloc@#1#2#3#4#5{\global\advance\count1#1\@ne
678   \ch@ck#1#4#2% make sure there's still room
679   \allocationnumber\count1#1%
680   \global#3#5\allocationnumber
681   \wlog{\string#5=\string#2\the\allocationnumber}}
682 %    \end{macrocode}
683 % \end{macro}
685 % \begin{macro}{\newinsert}
686 % \changes{v2.1a}{2015/08/30}{new \cs{newinsert} implementation}
687 %    \begin{macrocode}
688 %</2ekernel>
689 %<*2ekernel|latexrelease>
690 %<latexrelease>\IncludeInRelease{2015/10/01}
691 %<latexrelease>                 {\newinsert}{Extended \newinsert}%
692 %    \end{macrocode}
693 %    \begin{macrocode}
694 \ifx\numexpr\@undefined
695 %    \end{macrocode}
696 % If e-\TeX\ is not available use the original plain \TeX\
697 % definition of |\newinsert|.
698 %    \begin{macrocode}
699 \def\newinsert#1{\global\advance\insc@unt \m@ne
700   \ch@ck0\insc@unt\count
701   \ch@ck1\insc@unt\dimen
702   \ch@ck2\insc@unt\skip
703   \ch@ck4\insc@unt\box
704   \allocationnumber\insc@unt
705   \global\chardef#1\allocationnumber
706   \wlog{\string#1=\string\insert\the\allocationnumber}}
707 %    \end{macrocode}
708 %    \begin{macrocode}
709 \else
710 %    \end{macrocode}
711 % The highest register allowed with |\insert|.
712 %    \begin{macrocode}
713 \ifx\directlua\@undefined
714   \chardef\e@insert@top255
715 \else
716   \chardef\e@insert@top\e@alloc@top
718 %    \end{macrocode}
719 % If the classic registers are exausted, take an insert from the free float list
720 % and use |\extrafloats| to add a new float to that list.
721 % \changes{v2.2c}{2016/07/29}{fix for tlb-newinsert-001}
722 %    \begin{macrocode}
723 \def\newinsert#1{%
724 \@tempswafalse
725 \global\advance\insc@unt\m@ne
726 \ifnum\count10<\insc@unt
727 \ifnum\count11<\insc@unt
728 \ifnum\count12<\insc@unt
729 \ifnum\count14<\insc@unt
730   \@tempswatrue
731 \fi\fi\fi\fi
732 \if@tempswa
733 \allocationnumber\insc@unt
734 \else
735 \global\advance\insc@unt\@ne
736   \extrafloats\@ne
737   \@next\@currbox\@freelist
738     {\ifnum\@currbox<\e@insert@top
739       \allocationnumber\@currbox
740      \else
741      \ch@ck0\m@ne\insert
742      \fi}%
743      {\ch@ck0\m@ne\insert}%
745 \global\chardef#1\allocationnumber
746 \wlog{\string#1=\string\insert\the\allocationnumber}%
748 %    \end{macrocode}
749 %    \begin{macrocode}
751 %</2ekernel|latexrelease>
752 %    \end{macrocode}
754 %    \begin{macrocode}
755 %<latexrelease>\EndIncludeInRelease
756 %<latexrelease>\IncludeInRelease{0000/00/00}%
757 %<latexrelease>                 {\newinsert}{Extended \newinsert}%
758 %<latexrelease>\let\e@insert@top\@undefined
759 %<latexrelease>\def\newinsert#1{\global\advance\insc@unt \m@ne
760 %<latexrelease>  \ch@ck0\insc@unt\count
761 %<latexrelease>  \ch@ck1\insc@unt\dimen
762 %<latexrelease>  \ch@ck2\insc@unt\skip
763 %<latexrelease>  \ch@ck4\insc@unt\box
764 %<latexrelease>  \allocationnumber\insc@unt
765 %<latexrelease>  \global\chardef#1\allocationnumber
766 %<latexrelease>  \wlog{\string#1=\string\insert\the\allocationnumber}}
767 %<latexrelease>\EndIncludeInRelease
768 %<*2ekernel>
769 %    \end{macrocode}
770 % \end{macro}
772 % \begin{macro}{\ch@ck}
773 %    \begin{macrocode}
774 \gdef\ch@ck#1#2#3{%
775   \ifnum\count1#1<#2\else
776     \errmessage{No room for a new #3}%
777   \fi}
778 %    \end{macrocode}
779 % \end{macro}
781 % \changes{v2.0h}{2015/06/19}{delete spurious old definition of \cs{newtoks}}
782 % \begin{macro}{\newhelp}
783 %    \begin{macrocode}
784 \def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}}
785 %    \end{macrocode}
786 % \end{macro}
788 % \begin{macro}{\maxdimen}
789 % \begin{macro}{\hideskip}
790 % Here are some examples of allocation.
791 %    \begin{macrocode}
792 \newdimen\maxdimen \maxdimen=16383.99999pt % the largest legal <dimen>
793 \newskip\hideskip \hideskip=-1000pt plus 1fill % negative but can grow
794 %    \end{macrocode}
795 % \end{macro}
796 % \end{macro}
798 % \begin{macro}{\p@}
799 % \begin{macro}{\z@}
800 % \begin{macro}{\z@skip}
801 % \begin{macro}{\voidb@x}
802 %    \begin{macrocode}
803 \newdimen\p@ \p@=1pt % this saves macro space and time
804 \newdimen\z@ \z@=0pt % can be used both for 0pt and 0
805 \newskip\z@skip \z@skip=0pt plus0pt minus0pt
806 \newbox\voidb@x % permanently void box register
807 %    \end{macrocode}
808 % \end{macro}
809 % \end{macro}
810 % \end{macro}
811 % \end{macro}
813 % Assign initial values to \TeX's parameters
815 %    \begin{macrocode}
816 \message{parameters,}
817 %    \end{macrocode}
819 % All of \TeX's numeric parameters are listed here,
820 % but the code is commented out if no special value needs to be set.
821 % INITEX makes all parameters zero except where noted.
823 % \begin{oldcomments}
824 %    \begin{macrocode}
825 \pretolerance=100
826 \tolerance=200 % INITEX sets this to 10000
827 \hbadness=1000
828 \vbadness=1000
829 \linepenalty=10
830 \hyphenpenalty=50
831 \exhyphenpenalty=50
832 \binoppenalty=700
833 \relpenalty=500
834 \clubpenalty=150
835 \widowpenalty=150
836 \displaywidowpenalty=50
837 \brokenpenalty=100
838 \predisplaypenalty=10000
839 %    \end{macrocode}
840 % \postdisplaypenalty=0
841 % \interlinepenalty=0
842 % \floatingpenalty=0, set during \insert
843 % \outputpenalty=0, set before TeX enters \output
844 %    \begin{macrocode}
845 \doublehyphendemerits=10000
846 \finalhyphendemerits=5000
847 \adjdemerits=10000
848 %    \end{macrocode}
849 % \looseness=0, cleared by TeX after each paragraph
850 % \pausing=0
851 % \holdinginserts=0
852 % \tracingonline=0
853 % \tracingmacros=0
854 % \tracingstats=0
855 % \tracingparagraphs=0
856 % \tracingpages=0
857 % \tracingoutput=0
858 %    \begin{macrocode}
859 \tracinglostchars=1
860 %    \end{macrocode}
861 % \tracingcommands=0
862 % \tracingrestores=0
863 % \language=0
864 %    \begin{macrocode}
865 \uchyph=1
866 %    \end{macrocode}
867 % \lefthyphenmin=2 \righthyphenmin=3 set below
868 % \globaldefs=0
869 % \maxdeadcycles=25 % INITEX does this
870 % \hangafter=1 % INITEX does this, also TeX after each paragraph
871 % \fam=0
872 % \mag=1000 % INITEX does this
873 % \escapechar=`\\ % INITEX does this
874 %    \begin{macrocode}
875 \defaulthyphenchar=`\-
876 \defaultskewchar=-1
877 %    \end{macrocode}
878 % \endlinechar=`\^^M % INITEX does this
879 % \newlinechar=-1     \LaTeX\ sets this in ltdefns.dtx.
880 %    \begin{macrocode}
881 \delimiterfactor=901
882 %    \end{macrocode}
883 % \time=now % TeX does this at beginning of job
884 % \day=now % TeX does this at beginning of job
885 % \month=now % TeX does this at beginning of job
886 % \year=now % TeX does this at beginning of job
888 % \end{oldcomments}
889 %    In \LaTeX{} we don't want box information in the transcript
890 %    unless we do a full tracing.
891 %  \changes{v1.0g}{1994/04/28}{Turn off overfull box tracing in log}
893 %    \begin{macrocode}
894 \showboxbreadth=-1
895 \showboxdepth=-1
896 \errorcontextlines=-1
897 %    \end{macrocode}
899 %    \begin{macrocode}
900 \hfuzz=0.1pt
901 \vfuzz=0.1pt
902 \overfullrule=5pt
903 \maxdepth=4pt
904 \splitmaxdepth=\maxdimen
905 \boxmaxdepth=\maxdimen
906 %    \end{macrocode}
908 % \begin{oldcomments}
909 % \lineskiplimit=0pt, changed by \normalbaselines
910 %    \begin{macrocode}
911 \delimitershortfall=5pt
912 \nulldelimiterspace=1.2pt
913 \scriptspace=0.5pt
914 %    \end{macrocode}
915 % \mathsurround=0pt
916 % \predisplaysize=0pt, set before TeX enters $$
917 % \displaywidth=0pt, set before TeX enters $$
918 % \displayindent=0pt, set before TeX enters $$
919 %    \begin{macrocode}
920 \parindent=20pt
921 %    \end{macrocode}
922 % \hangindent=0pt, zeroed by TeX after each paragraph
923 % \hoffset=0pt
924 % \voffset=0pt
926 % \baselineskip=0pt, changed by \normalbaselines
927 % \lineskip=0pt, changed by \normalbaselines
928 %    \begin{macrocode}
929 \parskip=0pt plus 1pt
930 \abovedisplayskip=12pt plus 3pt minus 9pt
931 \abovedisplayshortskip=0pt plus 3pt
932 \belowdisplayskip=12pt plus 3pt minus 9pt
933 \belowdisplayshortskip=7pt plus 3pt minus 4pt
934 %    \end{macrocode}
935 % \leftskip=0pt
936 % \rightskip=0pt
937 %    \begin{macrocode}
938 \topskip=10pt
939 \splittopskip=10pt
940 %    \end{macrocode}
941 % \tabskip=0pt
942 % \spaceskip=0pt
943 % \xspaceskip=0pt
944 %    \begin{macrocode}
945 \parfillskip=0pt plus 1fil
946 %    \end{macrocode}
947 % \end{oldcomments}
950 % \begin{macro}{\normalbaselineskip}
951 % \begin{macro}{\normallineskip}
952 % \begin{macro}{\normallineskiplimit}
953 % We also define special registers that function like parameters:
954 %    \begin{macrocode}
955 \newskip\normalbaselineskip \normalbaselineskip=12pt
956 \newskip\normallineskip \normallineskip=1pt
957 \newdimen\normallineskiplimit \normallineskiplimit=0pt
958 %    \end{macrocode}
959 % \end{macro}
960 % \end{macro}
961 % \end{macro}
963 % \begin{macro}{\interfootlinepenalty}
964 %    \begin{macrocode}
965 \newcount\interfootnotelinepenalty \interfootnotelinepenalty=100
966 %    \end{macrocode}
967 % \end{macro}
969 % Definitions for preloaded fonts
971 % \begin{macro}{\magstephalf}
972 % \begin{macro}{\magstep}
973 %    \begin{macrocode}
974 \def\magstephalf{1095 }
975 \def\magstep#1{\ifcase#1 \@m\or 1200\or 1440\or 1728\or
976                2074\or 2488\fi\relax}
977 %    \end{macrocode}
978 % \end{macro}
979 % \end{macro}
982 % Macros for setting ordinary text
984 % \begin{macro}{\frenchspacing}
985 % \begin{macro}{\nonfrenchspacing}
986 %    \begin{macrocode}
987 \def\frenchspacing{\sfcode`\.\@m \sfcode`\?\@m \sfcode`\!\@m
988   \sfcode`\:\@m \sfcode`\;\@m \sfcode`\,\@m}
989 \def\nonfrenchspacing{\sfcode`\.3000\sfcode`\?3000\sfcode`\!3000%
990   \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 }
991 %    \end{macrocode}
992 % \end{macro}
993 % \end{macro}
995 % \begin{macro}{\normalbaselines}
996 %    \begin{macrocode}
997 \def\normalbaselines{\lineskip\normallineskip
998   \baselineskip\normalbaselineskip \lineskiplimit\normallineskiplimit}
999 %    \end{macrocode}
1000 % \end{macro}
1002 % \begin{macro}{\M}
1003 % \begin{macro}{\I}
1004 % \changes{v1.1m}{1995/09/01}{Use \cs{let} to save space}
1005 % Save a bit of space by using |\let| here.
1006 %    \begin{macrocode}
1007 \def\^^M{\ } % control <return> = control <space>
1008 \let\^^I\^^M % same for <tab>
1009 %    \end{macrocode}
1010 % \end{macro}
1011 % \end{macro}
1013 % \begin{macro}{\lq}
1014 % \begin{macro}{\rq}
1015 %    \begin{macrocode}
1016 \def\lq{`}
1017 \def\rq{'}
1018 %    \end{macrocode}
1019 % \end{macro}
1020 % \end{macro}
1022 % \begin{macro}{\lbrack}
1023 % \begin{macro}{\rbrack}
1024 %    \begin{macrocode}
1025 \def\lbrack{[}
1026 \def\rbrack{]}
1027 %    \end{macrocode}
1028 % \end{macro}
1029 % \end{macro}
1031 % \begin{macro}{\aa}
1032 % \begin{macro}{\AA}
1033 % These are not from plain.tex but they are similar to other commands
1034 % found here and nowhere else, being alternate input forms for
1035 % characters.
1036 %    \begin{macrocode}
1037 \def \aa {\r a}
1038 \def \AA {\r A}
1039 %    \end{macrocode}
1040 % \end{macro}
1041 % \end{macro}
1043 % \begin{macro}{\endgraf}
1044 % \begin{macro}{\endline}
1045 %    \begin{macrocode}
1046 \let\endgraf=\par
1047 \let\endline=\cr
1048 %    \end{macrocode}
1049 % \end{macro}
1050 % \end{macro}
1052 % \begin{macro}{\space}
1053 %    \begin{macrocode}
1054 \def\space{ }
1055 %    \end{macrocode}
1056 % \end{macro}
1058 % \begin{macro}{\empty}
1059 % \changes{v1.1m}{1995/09/01}{Use \cs{let} to save space}
1060 % This probably ought to go altogether, but let it to the \LaTeX\
1061 % version to save space.
1062 %    \begin{macrocode}
1063 \let\empty\@empty
1064 %    \end{macrocode}
1065 % \end{macro}
1067 % \begin{macro}{\null}
1068 %    \begin{macrocode}
1069 \def\null{\hbox{}}
1070 %    \end{macrocode}
1071 % \end{macro}
1073 % \begin{macro}{\bgroup}
1074 % \begin{macro}{\egroup}
1075 %    \begin{macrocode}
1076 \let\bgroup={
1077 \let\egroup=}
1078 %    \end{macrocode}
1079 % \end{macro}
1080 % \end{macro}
1082 % \begin{macro}{\obeylines}
1083 % \begin{macro}{\obeyspaces}
1084 % In |\obeylines|, we say |\let^^M=\par| instead of |\def^^M{\par}|
1085 % since this allows, for example, |\let\par=\cr \obeylines \halign{...|
1086 %    \begin{macrocode}
1087 {\catcode`\^^M=\active % these lines must end with %
1088   \gdef\obeylines{\catcode`\^^M\active \let^^M\par}%
1089   \global\let^^M\par} % this is in case ^^M appears in a \write
1090 \def\obeyspaces{\catcode`\ \active}
1091 {\obeyspaces\global\let =\space}
1092 %    \end{macrocode}
1093 % \end{macro}
1094 % \end{macro}
1096 %  \begin{macro}{\loop}
1097 % \changes{v1.0h}{1994/05/16}{Use Kabelschacht method}
1098 %  \begin{macro}{\iterate}
1099 % \changes{v1.1b}{1994/11/10}
1100 %         {(CAR) added extra \cs{relax}}
1101 % \changes{v1.1m}{1994/05/26}
1102 %         {(CAR) added \cs{long}}
1103 %  \begin{macro}{\repeat}
1104 %    We use Kabelschacht's method of doing loops, see TUB 8\#2 (1987).
1105 %    (unless that breaks something :-).  It turned out to need an
1106 %    extra |\relax|: see pr/642 (|\loop| could do one iteration too much
1107 %    in certain cases).
1108 %    \begin{macrocode}
1109 \long\def \loop #1\repeat{%
1110   \def\iterate{#1\relax  % Extra \relax
1111                \expandafter\iterate\fi
1112                }%
1113   \iterate
1114   \let\iterate\relax
1116 %    \end{macrocode}
1117 %    This setting of |\repeat| is needed to make |\loop...\if...\repeat|
1118 %    skippable within another |\if...|.
1119 %    \begin{macrocode}
1120 \let\repeat=\fi
1121 %    \end{macrocode}
1122 %  \end{macro}
1123 %  \end{macro}
1124 %  \end{macro}
1126 % \LaTeX\ defines |\smallskip|, etc.\ in |ltspace.dtx|.
1128 % \begin{macro}{\nointerlineskip}
1129 % \begin{macro}{\offinterlineskip}
1130 % \changes{v1.1n}{1995/07/02}{Replaced 1000 by \cs{@m}}
1131 %    \begin{macrocode}
1132 \def\nointerlineskip{\prevdepth-\@m\p@}
1133 \def\offinterlineskip{\baselineskip-\@m\p@
1134   \lineskip\z@ \lineskiplimit\maxdimen}
1135 %    \end{macrocode}
1136 %  \end{macro}
1137 %  \end{macro}
1139 % \begin{macro}{\vglue}
1140 % \begin{macro}{\hglue}
1141 %    \begin{macrocode}
1142 \def\vglue{\afterassignment\vgl@\skip@=}
1143 \def\vgl@{\par \dimen@\prevdepth \hrule \@height\z@
1144   \nobreak\vskip\skip@ \prevdepth\dimen@}
1145 \def\hglue{\afterassignment\hgl@\skip@=}
1146 \def\hgl@{\leavevmode \count@\spacefactor \vrule \@width\z@
1147   \nobreak\hskip\skip@ \spacefactor\count@}
1148 %    \end{macrocode}
1149 %  \end{macro}
1150 %  \end{macro}
1152 % \LaTeX\ defines |~| in |ltdefns.dtx|.
1154 % \begin{macro}{\slash}
1155 %    \begin{macrocode}
1156 \def\slash{/\penalty\exhyphenpenalty} % a `/' that acts like a `-'
1157 %    \end{macrocode}
1158 %  \end{macro}
1160 % \begin{macro}{\break}
1161 % \begin{macro}{\nobreak}
1162 % \begin{macro}{\allowbreak}
1163 %    \begin{macrocode}
1164 \def\break{\penalty-\@M}
1165 \def\nobreak{\penalty \@M}
1166 \def\allowbreak{\penalty \z@}
1167 %    \end{macrocode}
1168 %  \end{macro}
1169 %  \end{macro}
1170 %  \end{macro}
1172 % \begin{macro}{\filbreak}
1173 % \begin{macro}{\goodbreak}
1174 %    \begin{macrocode}
1175 \def\filbreak{\par\vfil\penalty-200\vfilneg}
1176 \def\goodbreak{\par\penalty-500 }
1177 %    \end{macrocode}
1178 %  \end{macro}
1179 %  \end{macro}
1181 % \begin{macro}{\eject}
1182 % \changes{v1.1s}{1995/10/17}{Move \cs{supereject} to compat file}
1183 % Define |\eject| as in plain \TeX\ but define |\supereject| only in
1184 % the compatibility file.
1185 %    \begin{macrocode}
1186 \def\eject{\par\break}
1187 %    \end{macrocode}
1188 %  \end{macro}
1190 % \begin{macro}{\removelastskip}
1191 %    \begin{macrocode}
1192 \def\removelastskip{\ifdim\lastskip=\z@\else\vskip-\lastskip\fi}
1193 %    \end{macrocode}
1194 %  \end{macro}
1196 % \begin{macro}{\smallbreak}
1197 % \begin{macro}{\medbreak}
1198 % \begin{macro}{\bigbreak}
1199 %    \begin{macrocode}
1200 \def\smallbreak{\par\ifdim\lastskip<\smallskipamount
1201   \removelastskip\penalty-50\smallskip\fi}
1202 \def\medbreak{\par\ifdim\lastskip<\medskipamount
1203   \removelastskip\penalty-100\medskip\fi}
1204 \def\bigbreak{\par\ifdim\lastskip<\bigskipamount
1205   \removelastskip\penalty-200\bigskip\fi}
1206 %    \end{macrocode}
1207 %  \end{macro}
1208 %  \end{macro}
1209 %  \end{macro}
1211 % \begin{macro}{\m@th}
1212 % \changes{v1.0h}{1994/05/16}{Remove unnecessary space}
1213 %    \begin{macrocode}
1214 \def\m@th{\mathsurround\z@}
1215 %    \end{macrocode}
1216 %  \end{macro}
1218 % \begin{macro}{\underbar}
1219 %    Due to \LaTeX's redefinition of |\underline| plain \TeX's
1220 %    |\underbar| can be done in a simpler fashion (but do we
1221 %    need it at all?).
1222 % \changes{v1.1m}{1994/05/26}
1223 %         {(CAR/FMi) changed to use box \cs{tw@}}
1224 % \changes{v1.1p}{1994/05/26}
1225 %         {(DPC) changed to use \cs{sbox}}
1226 %    \begin{macrocode}
1227 \def\underbar#1{\underline{\sbox\tw@{#1}\dp\tw@\z@\box\tw@}}
1228 %    \end{macrocode}
1229 %  \end{macro}
1231 % \begin{macro}{\strutbox}
1232 % \begin{macro}{\strut}
1233 % \LaTeX\ sets |\strutbox| in |\set@fontsize|.
1234 %    \begin{macrocode}
1235 \newbox\strutbox
1236 \def\strut{\relax\ifmmode\copy\strutbox\else\unhcopy\strutbox\fi}
1237 %    \end{macrocode}
1238 %  \end{macro}
1239 %  \end{macro}
1241 % \begin{macro}{\hidewidth}
1242 % For alignment entries that can stick out.
1243 %    \begin{macrocode}
1244 \def\hidewidth{\hskip\hideskip}
1245 %    \end{macrocode}
1246 %  \end{macro}
1248 % \changes{v1.0h}{1994/05/16}{Remove unnecessary def for \cs{item}}
1249 % \changes{v1.1i}{1995/04/27}
1250 %   {Move \cs{hang} and \cs{textindent} to latex209.def}
1251 % \changes{RmS}{1991/11/04}{Removed \cs{itemitem} since never
1252 %    needed/useful with \LaTeX.}
1254 % \begin{macro}{\narrower}
1255 %    \begin{macrocode}
1256 \def\narrower{%
1257   \advance\leftskip\parindent
1258   \advance\rightskip\parindent}
1259 %    \end{macrocode}
1260 %  \end{macro}
1262 % \changes{v1.1c}{1994/11/12}{Comment out more encoding specific
1263 %                             commands}
1264 % \LaTeX\ defines |\ae| and similar commands elsewhere.
1266 %    \begin{macrocode}
1267 \chardef\%=`\%
1268 \chardef\&=`\&
1269 \chardef\#=`\#
1270 %    \end{macrocode}
1272 % Most text commands are actually encoding specific and therefore
1273 % defined later, so commented out or removed from this file.
1274 % \changes{v1.0h}{1994/05/16}{Comment out encoding specific commands}
1276 % \begin{macro}{\leavevmode}
1277 % begins a paragraph, if necessary
1278 %    \begin{macrocode}
1279 \def\leavevmode{\unhbox\voidb@x}
1280 %    \end{macrocode}
1281 %  \end{macro}
1283 % \begin{macro}{\mathhexbox}
1284 %    \begin{macrocode}
1285 \def\mathhexbox#1#2#3{\mbox{$\m@th \mathchar"#1#2#3$}}
1286 %    \end{macrocode}
1287 %  \end{macro}
1290 % \begin{macro}{\ialign}
1291 %    \begin{macrocode}
1292 \def\ialign{\everycr{}\tabskip\z@skip\halign} % initialized \halign
1293 %    \end{macrocode}
1294 %  \end{macro}
1296 % \begin{macro}{\oalign}
1297 % \begin{macro}{\o@lign}
1298 % \begin{macro}{\ooalign}
1299 %    \begin{macrocode}
1300 \def\oalign#1{\leavevmode\vtop{\baselineskip\z@skip \lineskip.25ex%
1301   \ialign{##\crcr#1\crcr}}}
1302 \def\o@lign{\lineskiplimit\z@ \oalign}
1303 \def\ooalign{\lineskiplimit-\maxdimen \oalign}
1304 %    \end{macrocode}
1305 %  \end{macro}
1306 %  \end{macro}
1307 %  \end{macro}
1309 % \begin{macro}{\sh@ft}
1310 % \changes{v1.1t}{1996/07/26}{replace \cs{dimen}\cs{z@} by
1311 %          \cs{dimen@}}
1312 % \changes{v1.1y}{2005/09/27}{Macro no longer used but
1313 %   left for compatibility}
1314 % The definition of this macro in plain.tex was improved in
1315 % about 1997; but as a result its usage was changed and its new
1316 % definition is not appropriate for \LaTeX{}.
1318 % Since the version given here has been in use by
1319 % \LaTeX{} for many years it does not seem prudent to remove it now.
1320 % As far as we can tell it has only been used to define~|\b| and~|\d|
1321 % but this cannot be certain.
1322 %    \begin{macrocode}
1323 \def\sh@ft#1{\dimen@.00#1ex\multiply\dimen@\fontdimen1\font
1324   \kern-.0156\dimen@} % compensate for slant in lowered accents
1325 %    \end{macrocode}
1326 %  \end{macro}
1328 % \begin{macro}{\ltx@sh@ft}
1329 % \changes{v1.1y}{2005/09/27}{New macro}
1330 % This is the \LaTeX{} version of the second incarnation of the plain
1331 % macro |\sh@ft|, which takes a dimension as its argument.  It shifts
1332 % a pseudo-accent horizontally by an amount proportional to the product
1333 % of its argument and the slant-per-point (fontdimen 1).
1335 %    \begin{macrocode}
1336 \def\ltx@sh@ft #1{%
1337   \dimen@ #1%
1338   \kern \strip@pt
1339     \fontdimen1\font \dimen@
1340   } % kern by #1 times the current slant
1341 %    \end{macrocode}
1342 %  \end{macro}
1346 % \LaTeX{} change: the text commands such as
1347 % |\d|, |\b|, |\c|, |\copyright|,~|\TeX|
1348 % are now defined elsewhere.
1350 % \changes{LaTeX2e}
1351 %     {1993/11/29}{All accents in decimals; suggested by Paul Taylor}
1352 % \changes{v1.0d}{1994/04/12}
1353 %         {Define \cs{@acci}}
1354 % \changes{v1.0h}{1994/05/16}{Remove \cs{@acci} and friends again}
1356 % \LaTeX{} change: Make |\t| work in a moving argument.
1357 % Now defined elsewhere.
1359 % \begin{macro}{\hrulefill}
1360 % \begin{macro}{\dotfill}
1361 % \LaTeX\ change: |\kern\z@| added to end of
1362 % |\hrulefill| and |\dotfill|
1363 % to make them work in `tabular' and `array' environments.
1364 % (Change made 24 July 1987).
1365 % \LaTeX\ change: |\leavevmode| added at beginning of
1366 % |\dotfill| and |\hrulefill|
1367 % so that they work as expected in vertical mode.
1368 %    \begin{macrocode}
1369 \def\hrulefill{\leavevmode\leaders\hrule\hfill\kern\z@}
1370 %    \end{macrocode}
1371 % The box in |\dotfill| originally contained (in plain.tex):\\
1372 % |\mkern 1.5mu .\mkern 1.5mu|;\\
1373 % the width of .44em differs from this
1374 % by .04pt which is probably an acceptable difference within leaders.
1375 % \changes{v1.1u}{1996/10/28}{Removed math mode}
1376 % \changes{v1.1v}{1996/10/29}{Got arithmetic correct (CAR)}
1377 % \changes{v1.1w}{1996/11/03}{Saved tokens by using \cs{hb@xt@}}
1378 %    \begin{macrocode}
1379 \def\dotfill{%
1380   \leavevmode
1381   \cleaders \hb@xt@ .44em{\hss.\hss}\hfill
1382   \kern\z@}
1383 %    \end{macrocode}
1384 %  \end{macro}
1385 %  \end{macro}
1387 % INITEX sets |\sfcode x=1000| for all x, except that |\sfcode`X=999|
1388 % for uppercase letters. The following changes are needed:
1389 %    \begin{macrocode}
1390 \sfcode`\)=0 \sfcode`\'=0 \sfcode`\]=0
1391 %    \end{macrocode}
1392 % The |\nonfrenchspacing| macro will make further changes to
1393 % |\sfcode| values.
1396 % Definitions related to output
1399 % \changes{v1.1k}{1995/05/22}{Definitions of \cs{footins} and
1400 %                 \cs{footnoterule} moved to ltfloat.}
1403 % |\magnification| doesn't work in \LaTeX.
1404 %\begin{verbatim}
1405 %\def\magnification{\afterassignment\m@g\count@}
1406 %\def\m@g{\mag\count@
1407 %  \hsize6.5truein\vsize8.9truein\dimen\footins8truein}
1408 %\end{verbatim}
1410 % \begin{macro}{\showoverfull}
1411 % \changes{v0.1k ltfinal}{1994/05/19}{used \cs{@ne} not 1}
1412 % The following commands are used in debugging:
1413 %    \begin{macrocode}
1414 \def\showoverfull{\tracingonline\@ne}
1415 %    \end{macrocode}
1416 % \end{macro}
1418 % \begin{macro}{\showoutput}
1419 % \changes{v0.1k ltfinal}{1994/05/19}
1420 %         {used \cs{maxdimen} not 99999}
1421 % \changes{v1.1n}{1995/07/02}{Use \cs{showoverfull} to save space}
1422 % \changes{v1.1x}{2002/02/24}{Use newly added \cs{loggingoutput}}
1423 % \begin{macro}{\loggingoutput}
1424 % \changes{v1.1x}{2002/02/24}{Macro added}
1425 %    \begin{macrocode}
1426 \gdef\loggingoutput{\tracingoutput\@ne
1427     \showboxbreadth\maxdimen\showboxdepth\maxdimen\errorstopmode}
1428 \gdef\showoutput{\loggingoutput\showoverfull}
1429 %</2ekernel>
1430 %    \end{macrocode}
1431 % \end{macro}
1432 % \end{macro}
1435 % \begin{macro}{\tracingall}
1436 % \changes{LaTeX209}{1991/08/26}{Added
1437 %    \cs{errorcontextlines}!=\cs{maxdimen}, suggested by J. Schrod}
1438 % \changes{v1.1n}{1995/07/02}{Use \cs{showoutput} to save space}
1439 % \changes{v1.1x}{2002/02/24}{Use newly added \cs{loggingoutput}}
1440 % \begin{macro}{\loggingall}
1441 % \changes{v1.1x}{2002/02/24}{Macro added}
1442 % \changes{v2.0b}{2012/01/20}{etex tracing if available}
1443 % \changes{v2.0d}{2015/02/20}{Spell commands correctly :-)}
1444 % \changes{v2.0g}{2015/03/10}{Reorganise to be less noisy}
1445 %    \begin{macrocode}
1446 %<latexrelease>\IncludeInRelease{2015/01/20}{\loggingall}{etex tracing}%
1447 %<*2ekernel|latexrelease>
1448 \ifx\tracingscantokens\@undefined
1449 \gdef\loggingall{%
1450   \tracingstats\tw@
1451   \tracingpages\@ne
1452   \tracinglostchars\@ne
1453   \tracingparagraphs\@ne
1454   \errorcontextlines\maxdimen
1455   \loggingoutput
1456   \tracingmacros\tw@
1457   \tracingcommands\tw@
1458   \tracingrestores\@ne
1459   }%
1460 \else
1461 \gdef\loggingall{%
1462   \tracingstats\tw@
1463   \tracingpages\@ne
1464   \tracinglostchars\tw@
1465   \tracingparagraphs\@ne
1466   \tracinggroups\@ne
1467   \tracingifs\@ne
1468   \tracingscantokens\@ne
1469   \tracingnesting\@ne
1470   \errorcontextlines\maxdimen
1471   \loggingoutput
1472   \tracingmacros\tw@
1473   \tracingcommands\thr@@
1474   \tracingrestores\@ne
1475   \tracingassigns\@ne
1478 \gdef\tracingall{\showoverfull\loggingall}
1479 %</2ekernel|latexrelease>
1480 %<latexrelease>\EndIncludeInRelease
1481 %<latexrelease>\IncludeInRelease{0000/00/00}{\loggingall}{etex tracing}%
1482 %<latexrelease>\gdef\loggingall{\tracingcommands\tw@\tracingstats\tw@
1483 %<latexrelease>  \tracingpages\@ne\tracinglostchars\@ne
1484 %<latexrelease>  \tracingmacros\tw@\tracingparagraphs\@ne\tracingrestores\@ne
1485 %<latexrelease>  \errorcontextlines\maxdimen\loggingoutput}
1486 %<latexrelease>  \gdef\tracingall{\loggingall\showoverfull}
1487 %<latexrelease>\EndIncludeInRelease
1488 %    \end{macrocode}
1489 % \end{macro}
1490 % \end{macro}
1493 % \begin{macro}{\tracingnone}
1494 % \changes{v2.0g}{2015/03/10}{macro added}
1495 % \begin{macro}{\hideoutput}
1496 % \changes{v2.0g}{2015/03/10}{macro added}
1497 %    \begin{macrocode}
1498 %<latexrelease>\IncludeInRelease{2015/01/20}{\tracingnone}%
1499 %<latexrelease>                             {turn off etex tracing}%
1500 %<*2ekernel|latexrelease>
1501 \ifx\tracingscantokens\@undefined
1502 \def\tracingnone{%
1503   \tracingonline\z@
1504   \tracingcommands\z@
1505   \showboxdepth\m@ne
1506   \showboxbreadth\m@ne
1507   \tracingoutput\z@
1508   \errorcontextlines\m@ne
1509   \tracingrestores\z@
1510   \tracingparagraphs\z@
1511   \tracingmacros\z@
1512   \tracinglostchars\@ne
1513   \tracingpages\z@
1514   \tracingstats\z@
1516 \else
1517 \def\tracingnone{%
1518   \tracingassigns\z@
1519   \tracingrestores\z@
1520   \tracingonline\z@
1521   \tracingcommands\z@
1522   \showboxdepth\m@ne
1523   \showboxbreadth\m@ne
1524   \tracingoutput\z@
1525   \errorcontextlines\m@ne
1526   \tracingnesting\z@
1527   \tracingscantokens\z@
1528   \tracingifs\z@
1529   \tracinggroups\z@
1530   \tracingparagraphs\z@
1531   \tracingmacros\z@
1532   \tracinglostchars\@ne
1533   \tracingpages\z@
1534   \tracingstats\z@
1537 %    \end{macrocode}
1539 %    \begin{macrocode}
1540 \def\hideoutput{%
1541   \tracingoutput\z@
1542   \showboxbreadth\m@ne
1543   \showboxdepth\m@ne
1544   \tracingonline\m@ne
1546 %    \end{macrocode}
1548 %    \begin{macrocode}
1549 %</2ekernel|latexrelease>
1550 %<latexrelease>\EndIncludeInRelease
1551 %<latexrelease>\IncludeInRelease{0000/00/00}{\tracingnone}%
1552 %<latexrelease>                             {turn off etex tracing}%
1553 %<latexrelease>\let\tracingnone\@undefined
1554 %<latexrelease>\let\hideoutput\@undefined
1555 %<latexrelease>\EndIncludeInRelease
1556 %    \end{macrocode}
1557 % \end{macro}
1558 % \end{macro}
1561 % \LaTeX\ change: |\showhyphens| Defined later.
1563 % Punctuation affects the spacing.
1564 %    \begin{macrocode}
1565 %<*2ekernel>
1566 \nonfrenchspacing
1567 %</2ekernel>
1568 %    \end{macrocode}
1571 % \Finale