1 % \iffalse meta-comment
3 % Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009
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.
31 %%% From File: ltfinal.dtx
35 \ProvidesFile{ltfinal.dtx}
36 [2003/10/13 v1.1e LaTeX Kernel (Final Settings)]
38 \documentclass{ltxdoc}
39 \GetFileInfo{ltfinal.dtx}
52 \DocInput{ltfinal.dtx}
59 % \section{Final settings}
60 % This section contains the final settings for \LaTeX. It initialises
61 % some debugging and typesetting parameters, sets the default
62 % |\catcode|s and uc/lc codes, and inputs the hyphenation file.
66 % \changes{v0.1a}{1994/03/07}{Initial version, split from latex.dtx}
67 % \changes{v0.1a}{1994/03/07}{Remove oldcomments environment}
68 % \changes{v0.1c}{1994/04/21}{Added comments, set the catcodes of
70 % \changes{v0.1d}{1994/04/23}{Check that \cs{font@submax} is still zero}
71 % \changes{v0.1e}{1994/05/02}{Set all the catcodes}
72 % \changes{v0.1f}{1994/05/03}{Set the catcode of control-J to be
73 % `other', for use in messages.}
74 % \changes{v0.1g}{1994/05/05}{Added empty errhelp.}
75 % \changes{v0.1h}{1994/05/13}{Added package ot1enc, and defined
76 % \cs{@acci}, \cs{@accii} and \cs{@acciii}.}
77 % \changes{v0.1j}{1994/05/18}{Corrected the lccode for d-bar.}
78 % \changes{v0.1k}{1994/05/19}{Removed \cs{makeat...}}
79 % \changes{v1.0n}{1994/05/31}{Renamed lthyphen.* to lthyphen.*.}
80 % \changes{v1.0o}{1994/11/17}
81 % {\cs{@tempa} to \cs{reserved@a}}
82 % \changes{v1.0p}{1994/12/01}
83 % {Renamed lthyphen.* to hyphen.*.}
84 % \changes{v1.0r}{1995/06/05}
85 % {Added \cs{MakeUppercase} and \cs{MakeLowercase}.}
86 % \changes{v1.0s}{1995/06/06}
87 % {Made \cs{MakeUppercase} and \cs{MakeLowercase} brace their
90 % \subsection{Debugging}
92 % By default, \LaTeX{} shows statistics:
98 % \subsection{Typesetting parameters}
100 % \begin{macro}{\@lowpenalty}
101 % \begin{macro}{\@medpenalty}
102 % \begin{macro}{\@highpenalty}
103 % These are penalties used internally.
105 \newcount\@lowpenalty
106 \newcount\@medpenalty
107 \newcount\@highpenalty
112 % The default values of the picture and |\fbox| parameters:
118 % The saved value of \TeX's |\maxdepth|:
120 \@maxdepth = \maxdepth
122 % |\vsize| initialized because a |\clearpage| with |\vsize < \topskip|
124 % |\@colroom| and |\@colht| also initialized because |\vsize| may be
125 % set to them if a |\clearpage| is done before the |\begin{document}|
132 % Initialise |\textheight| |\textwidth| and page style, to avoid
133 % internal errors if they are not set by the class.
134 % \changes{v0.1b}{1994/04/18}
135 % {Initialise \cs{textheight}, \cs{textwidth} and page style}
137 \textheight=.5\maxdimen
138 \textwidth=\textheight
142 % \subsection{Lccodes for hyphenation}
144 % \changes{v1.1b}{1998/05/20}{Set up lccodes before loading
145 % hyphenation files: pr/2639}
146 % We set things up so that hypehnation files can assume that the
147 % default (T1) lccodes are in use (at present this also sets up the
149 % We temporarily define |\reserved@a| to apply |\reserved@c| to
150 % all the numbers in the range of its arguments.
152 \def\reserved@a#1#2{%
158 \ifnum\@tempcnta>\@tempcntb\else
159 \reserved@c\@tempcnta
160 \advance\@tempcnta\@ne
161 \expandafter\reserved@b
165 % Depending on the \TeX{} version, we might not be allowed to do
166 % this for non-ASCII characters.
167 % \changes{v1.0n}{1994/06/09}{For \TeX2, do not set codes for higher
168 % half of character table.}
171 \count@=#1\advance\count@ by -"20
175 \reserved@a{`\a}{`\z}
176 \ifnum\inputlineno=\m@ne\else
177 \reserved@a{"A0}{"BC}
178 \reserved@a{"E0}{"FF}
181 % The upper case characters need their |\uccode| and |\lccode| values
182 % set, and their |\sfcode| set to 999.
185 \count@=#1\advance\count@ by "20
190 \reserved@a{`\A}{`\Z}
191 \ifnum\inputlineno=\m@ne\else
192 \reserved@a{"80}{"9C}
193 \reserved@a{"C0}{"DF}
196 % Well, it would be nice if that were correct, but unfortunately, the
197 % Cork encoding contains some odd slots whose uccode or lccode isn't
198 % quite what you'd expect.
200 \uccode`\^^Y=`\I % dotless i
201 \lccode`\^^Y=`\^^Y % dotless i
202 \uccode`\^^Z=`\J % dotless j, ae in OT1
203 \lccode`\^^Z=`\^^Z % dotless j, ae in OT1
204 \ifnum\inputlineno=\m@ne\else
205 \lccode`\^^9d=`\i % dotted I
206 \uccode`\^^9d=`\^^9d % dotted I
207 \lccode`\^^9e=`\^^9e % d-bar
208 \uccode`\^^9e=`\^^d0 % d-bar
211 % Finally here is one that helps hyphenation in the OT1 encoding.
212 % \changes{v1.0z}{1996/10/31}
213 % {Added extra \cs{lcode}, hoping it does no harm in T1 (pr/1969)}
215 \lccode`\^^[=`\^^[ % oe in OT1
218 % And we also set the |\lccode| of |\-| and |\textcompwordmark| so
219 % that they do not prevent hyphenation in the remainder of the word
220 % (as suggested by Lars Helstr\"om).
221 % \changes{v1.1e}{2003/10/13}
222 % {Added extra \cs{lccode} for \cs{-} and \cs{textcompwordmark}}
224 \lccode`\- =`\- % default hyphen char
225 \lccode 127=127 % alternate hyphen char
226 \lccode 23 =23 % textcompwordmark in T1
229 % \subsection{Hyphenation}
231 % \changes{v0.1a}{1994/03/07}{move code here from lhyphen.dtx}
232 % \changes{v0.1a}{1994/03/07}
233 % {use \cs{InputIfFileExists} not \cs{IfFileExists}}
234 % \changes{v1.0x}{1995/11/01}
235 % {(DPC) Switch meaning of \cs{@addtofilelist} for cfg files}%
236 % The following code will be compiled into the format file. It checks
237 % for the existance of \texttt{hyphen.cfg} in inputs that file if
238 % found. Otherwise it inputs \texttt{hyphen.ltx}. Note that these
239 % are loaded in \emph{before} the |\catcode|s are set, so local
240 % hyphenation files can use 8-bit input.
242 % We try to load the customized hyphenation description file.
244 \InputIfFileExists{hyphen.cfg}
245 {\typeout{===========================================^^J%
246 Local configuration file hyphen.cfg used^^J%
247 ===========================================}%
248 \def\@addtofilelist##1{\xdef\@filelist{\@filelist,##1}}%
251 \let\@addtofilelist\@gobble
256 % \subsection{Font loading}
257 % Fonts loaded during the formatting process might already have
258 % changed the |\font@submax| from |0pt| to something higher.
259 % If so, we put out a bold warning.
260 % \changes{v0.1l}{1994/05/20}{Use new font warning commands}
262 % \changes{v1.1c}{2000/08/23}{Fix typo in warning}
263 \ifdim \font@submax >\z@
264 \@font@warning{Size substitutions with differences\MessageBreak
265 up to \font@submax\space have occurred.\MessageBreak
267 Please check the transcript file
268 carefully\MessageBreak
269 and redo the format generation if necessary!
271 \errhelp{Only stopped, to give you time to
272 read the above message.}
275 % We reset the macro. Otherwise every user will get a warning on
278 \def\font@submax{0pt}
282 % \subsection{Input encoding}
284 % We temporarily define |\reserved@a| to apply |\reserved@c| to all the
285 % numbers in the range of its arguments.
287 \def\reserved@a#1#2{%
293 \ifnum\@tempcnta>\@tempcntb\else
294 \reserved@c\@tempcnta
295 \advance\@tempcnta\@ne
296 \expandafter\reserved@b
300 % \changes{v0.1e}{1994/05/02}{Added setting the special catcodes.}
301 % \changes{v0.1f}{1994/05/02}{Set the catcode of control-J.}
302 % Set the special catcodes (although some of these are useless, since an
303 % error will have occurred if the catcodes have changed). Note that
304 % |^^J| has catcode `other' for use in warning messages.
323 % \changes{v0.1e}{1994/05/02}{Added setting the `other' catcodes.}
324 % Set the `other' catcodes.
326 \def\reserved@c#1{\catcode#1=12\relax}
329 \reserved@a{`\'}{`\?}
335 % \changes{v0.1e}{1994/05/02}{Added setting the `letter' catcodes.}
336 % Set the `letter' catcodes.
338 \def\reserved@c#1{\catcode#1=11\relax}
339 \reserved@a{`\A}{`\Z}
340 \reserved@a{`\a}{`\z}
342 % \changes{v0.1e}{1994/05/02}{Made slot 127 illegal}
343 % \changes{v1.0n}{1994/11/18}
344 % {re-allow slots 127--255}
345 % All the characters in the range 0--31 and 127--255 are illegal,
346 % \emph{except} tab (|^^I|), nl (|^^J|), ff (|^^L|) and cr (|^^M|).
348 % Now allow 8-bit characters, although their use in this way is
349 % strongly discouraged. See |inputenc.dtx| for a supported mechanism
352 \def\reserved@c#1{\catcode#1=15\relax}
353 \reserved@a{0}{`\^^H}
355 \reserved@a{`\^^N}{31}
356 %\ifnum\inputlineno=\m@ne
359 % \reserved@a{"7F}{"FF}
363 % \subsection{Lccodes and uccodes}
365 % \changes{v1.1b}{1998/05/20}{Set up uc/lccodes after loading
366 % hyphenation files: pr/2639}
367 % We now again set up the default (T1) uc/lccodes.
368 % The lower case characters need their |\uccode| and |\lccode| values
369 % set. Some of this is a repeat of the set-up before loading
371 % Depending on the \TeX{} version, we might not be allowed to do
372 % this for non-ASCII characters.
373 % \changes{v1.0n}{1994/06/09}{For \TeX2, do not set codes for higher
374 % half of character table.}
377 \count@=#1\advance\count@ by -"20
381 \reserved@a{`\a}{`\z}
382 \ifnum\inputlineno=\m@ne\else
383 \reserved@a{"A0}{"BC}
384 \reserved@a{"E0}{"FF}
387 % The upper case characters need their |\uccode| and |\lccode| values
388 % set, and their |\sfcode| set to 999.
391 \count@=#1\advance\count@ by "20
396 \reserved@a{`\A}{`\Z}
397 \ifnum\inputlineno=\m@ne\else
398 \reserved@a{"80}{"9C}
399 \reserved@a{"C0}{"DF}
402 % Well, it would be nice if that were correct, but unfortunately, the
403 % Cork encoding contains some odd slots whose uccode or lccode isn't
404 % quite what you'd expect.
406 \uccode`\^^Y=`\I % dotless i
407 \lccode`\^^Y=`\^^Y % dotless i
408 \uccode`\^^Z=`\J % dotless j, ae in OT1
409 \lccode`\^^Z=`\^^Z % dotless j, ae in OT1
410 \ifnum\inputlineno=\m@ne\else
411 \lccode`\^^9d=`\i % dotted I
412 \uccode`\^^9d=`\^^9d % dotted I
413 \lccode`\^^9e=`\^^9e % d-bar
414 \uccode`\^^9e=`\^^d0 % d-bar
417 % Finally here is one that helps hyphenation in the OT1 encoding.
418 % \changes{v1.0z}{1996/10/31}
419 % {Added extra \cs{lcode}, hoping it does no harm in T1 (pr/1969)}
421 \lccode`\^^[=`\^^[ % oe in OT1
424 % \begin{macro}{\MakeUppercase}
425 % \begin{macro}{\MakeUppercase}
426 % \begin{macro}{\@uclclist}
428 % \changes{v1.1a}{1997/10/20}{Removed \cs{aa} and \cs{AA} from
429 % \cs{@uclclist} as these are macros.}
431 % And whilst we're doing things with uc/lc tables, here are two
432 % commands to upper- and lower-case a string.
434 % \emph{Note} that this implementation is subject to change! At
435 % the moment we're not providing any way to extend the list of
436 % uc/lc commands, since finding a good interface is difficult.
437 % These commands have some nasty features, such as uppercasing
438 % mathematics, environment names, labels, etc. A much better
439 % long-term solution is to use all-caps fonts, but these aren't
440 % generally available.
442 \DeclareRobustCommand{\MakeUppercase}[1]{{%
444 \def\reserved@a##1##2{\let##1##2\reserved@a}%
445 \expandafter\reserved@a\@uclclist\reserved@b{\reserved@b\@gobble}%
446 \protected@edef\reserved@a{\uppercase{#1}}%
449 \DeclareRobustCommand{\MakeLowercase}[1]{{%
450 \def\reserved@a##1##2{\let##2##1\reserved@a}%
451 \expandafter\reserved@a\@uclclist\reserved@b{\reserved@b\@gobble}%
452 \protected@edef\reserved@a{\lowercase{#1}}%
455 \def\@uclclist{\oe\OE\o\O\ae\AE
456 \dh\DH\dj\DJ\l\L\ng\NG\ss\SS\th\TH}
458 % The above code works, but has the nasty side-effect that if you
459 % say something like:
461 % \markboth{\MakeUppercase\contentsname}
462 % {\MakeUppercase\contentsname}
464 % then the uppercasing is only done to the first letter of the
465 % contents name, since the mark expands out to:
467 % \mark{\protect\MakeUppercase Table of Contents}
468 % {\protect\MakeUppercase Table of Contents}
470 % In order to get round this, we redefine |\MakeUppercase| and
471 % |\MakeLowercase| to grab their argument and brace it. This is a
472 % very low-level hack, and is \emph{not} recommended practice!
473 % This is an instance of a general problem that makes it unsafe to
474 % grab arguments unbraced, and probably needs a more general
475 % solution. For the moment though, this hack will do:
477 \protected@edef\MakeUppercase#1{\MakeUppercase{#1}}
478 \protected@edef\MakeLowercase#1{\MakeLowercase{#1}}
484 % \changes{v1.0h}{1994/05/13}{Added output enc stuff}
485 % \changes{v1.0i}{1994/05/16}{moved output enc stuff to lfonts}
487 % \changes{v0.1a}{1994/03/07}{Add code from the old dump.dtx}
489 % \subsection{Applying Patch files}
490 % Between major releases, small patches will be distributed in
491 % files |ltpatch.ltx| which must be added at this point.
492 % \changes{v1.0m}{1994/06/08}{Add patch file system}
494 \IfFileExists{ltpatch.ltx}
495 {\typeout{=================================^^J%
496 Applying patch file ltpatch.ltx^^J%
497 =================================}
498 \def\fmtversion@topatch{unknown}
500 \ifx\fmtversion\fmtversion@topatch
501 \ifx\patch@level\@undefined
503 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J%
504 !! Patch file `ltpatch.ltx' not suitable for this^^J%
505 !! version of LaTeX.^^J^^J%
506 !! Please check if initex found an old patch file:^^J%
507 !! --- if so, rename it or delete it, and redo the^^J%
509 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J}%
513 % \changes{v1.0q}{1995/04/21}
514 % {Allow initial patch level 0}
515 % \changes{v1.0t}{1995/06/13}
516 % {Add patch level string more carefully}
517 % The code below adds the `patch level' string to the first |\typeout|
518 % in the startup banner.
520 \def\fmtversion@topatch{0}%
521 \ifx\fmtversion@topatch\patch@level\else
522 \def\reserved@a\typeout##1##2\reserved@a{%
523 \typeout{##1 patch level \patch@level}##2}
524 \everyjob\expandafter\expandafter\expandafter{%
525 \expandafter\reserved@a\the\everyjob\reserved@a}
526 \let\reserved@a\relax
532 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J%
533 !! Patch file `ltpatch.ltx' (for version <\fmtversion@topatch>)^^J%
534 !! is not suitable for version <\fmtversion> of LaTeX.^^J^^J%
535 !! Please check if initex found an old patch file:^^J%
536 !! --- if so, rename it or delete it, and redo the^^J%
538 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J}%
541 \let\fmtversion@topatch\relax
545 % \subsection{Freeing Memory}
547 % \begin{macro}{\reserved@a}
548 % \begin{macro}{\reserved@b}
549 % \changes{v1.0v}{1995/10/17}{reset here after the \cs{input} above}
550 % And just to make sure nobody relies on those definitions of
551 % |\reserved@b| and friends.
552 % These macros are reserved for use in the kernel. \emph{Do not use
553 % them as general scratch macros}.
555 \let\reserved@a\@filelist
556 \let\reserved@b=\@undefined
557 \let\reserved@c=\@undefined
558 \let\reserved@d=\@undefined
559 \let\reserved@e=\@undefined
560 \let\reserved@f=\@undefined
565 % \begin{macro}{\toks}
566 % \changes{v1.0y}{1996/07/10}
567 % {Free up memory from scratch registers /2213}
577 % \begin{macro}{\errhelp}
578 % \changes{v0.1g}{1994/05/05}{Set error help empty.}
579 % \changes{v1.1d}{2000/09/01}{Set error help empty at very end
580 % (pr/449 done correctly).}
581 % Empty the error help message, which may have some rubbish:
587 % \subsection{Initialise file list}
589 % \begin{macro}{\@providesfile}
590 % \changes{v1.0v}{1995/10/17}{reset macro}
591 % Initialise for use in the document. During initex a modified version
592 % has been used which leaves debugging information for |latexbug.tex|.
594 \def\@providesfile#1[#2]{%
596 \expandafter\xdef\csname ver@#1\endcsname{#2}%
601 % \begin{macro}{\@filelist}
602 % \changes{v1.0w}{1995/10/19}{Move after \cs{reserved@a} setting:-)}
603 % \begin{macro}{\@addtofilelist}
604 % Reset |\@filelist| so files input while making the format are not
605 % listed. The list built up so far may take up a lot of memory and so
606 % it is moved to |\reserved@a| where it will be overwritten as soon
607 % as almost any \LaTeX\ command is issued in a class file.
608 % However the |latexbug.tex| program will be able to access this
609 % information and insert it into a bug report.
611 \let\@filelist\@gobble
612 \def\@addtofilelist#1{\xdef\@filelist{\@filelist,#1}}%
617 % \subsection{Dumping the format}
618 % Finally we make |@| into a letter, ensure the format will
619 % be in the `normal' error mode, and dump everything into the
621 % \changes{v1.0t}{1995/06/13}
622 % {Call \cs{errorstopmode}}