% \iffalse meta-comment
%
% Copyright 1994 the LaTeX3 project and the individual authors.
% All rights reserved. For further copyright information see the file
% legal.txt, and any other copyright indicated in this file.
% 
% This file is part of the LaTeX2e system.
% ----------------------------------------
% 
%  This system is distributed in the hope that it will be useful,
%  but WITHOUT ANY WARRANTY; without even the implied warranty of
%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% 
% 
% IMPORTANT NOTICE:
% 
% For error reports in case of UNCHANGED versions see bugs.txt.
% 
% Please do not request updates from us directly.  Distribution is
% done through Mail-Servers and TeX organizations.
% 
% You are not allowed to change this file.
% 
% You are allowed to distribute this file under the condition that
% it is distributed together with all files mentioned in manifest.txt.
% 
% If you receive only some of these files from someone, complain!
% 
% You are NOT ALLOWED to distribute this file alone.  You are NOT
% ALLOWED to take money for the distribution or use of either this
% file or a changed version, except for a nominal charge for copying
% etc.
% \fi
%
% \iffalse
%%% File: ltfinal
%
%<*driver>
% \fi
\ProvidesFile{ltfinal.dtx}
             [1994/12/01 v1.0p LaTeX Kernel (Final Settings)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltfinal.dtx}
\title{\filename}
\date{\filedate}
\author{Leslie Lamport}
\begin{document}
\maketitle
 \DocInput{ltfinal.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{273}
%
% \section{Final settings}
% This section contains the final settings for \LaTeX.  It initilizes
% some debugging and typesetting parameters, sets the default
% |\catcode|s, and inputs the hyphenation file.
%
% \StopEventually{}
%
% \changes{v0.1a}{1994/03/07}{Initial version, split from latex.dtx}
% \changes{v0.1a}{1994/03/07}{Remove oldcomments environment}
% \changes{v0.1c}{1994/04/21}{Added comments, set the catcodes of
%    128--255.}
% \changes{v0.1d}{1994/04/23}{Check that \cmd\font@submax is still zero}
% \changes{v0.1e}{1994/05/02}{Set all the catcodes}
% \changes{v0.1f}{1994/05/03}{Set the catcode of control-J to be
%    `other', for use in messages.}
% \changes{v0.1g}{1994/05/05}{Added empty errhelp.}
% \changes{v0.1h}{1994/05/13}{Added package ot1enc, and defined
%    \cs{@acci}, \cs{@accii} and \cs{@acciii}.}
% \changes{v0.1j}{1994/05/18}{Corrected the lccode for d-bar.}
% \changes{v0.1k}{1994/05/19}{Removed \cs{makeat...}}
% \changes{v1.0n}{1994/05/31}{Renamed lthyphen.* to lthyphen.*.}
% \changes{v1.0o}{1994/11/17}
%         {\cs{@tempa} to \cs{reserved@a}}
% \changes{v1.0p}{1994/12/01}
%         {Renamed lthyphen.* to hyphen.*.}
%
% \subsection{Debugging}
%
% \begin{macro}{\showoverfull}
% \changes{v0.1k}{1994/05/19}{used \cs{@ne} not 1}
% \begin{macro}{\showoutput}
% The following commands are used in debugging:
% \changes{v0.1k}{1994/05/19}{used \cs{maxdimen} not 99999}
%    \begin{macrocode}
%<*2ekernel>
\def\showoverfull{\tracingonline\@ne}
\def\showoutput{\tracingonline\@ne\tracingoutput\@ne
    \showboxbreadth\maxdimen\showboxdepth\maxdimen\errorstopmode}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% By default, \LaTeX{} shows statistics:
%    \begin{macrocode}
\tracingstats1
%    \end{macrocode}
% \changes{v0.1g}{1994/05/05}{Set error help empty.}
% Empty the error help message, which may have some rubbish:
%    \begin{macrocode}
\errhelp{}
%    \end{macrocode}
% 
%
% \subsection{Typesetting parameters}
%
% \begin{macro}{\@lowpenalty}
% \begin{macro}{\@medpenalty}
% \begin{macro}{\@highpenalty}
%    These are penalties used internally.
%    \begin{macrocode}
\newcount\@lowpenalty
\newcount\@medpenalty
\newcount\@highpenalty
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% The default values of the picture and |\fbox| parameters:
%    \begin{macrocode}
\unitlength = 1pt
\fboxsep = 3pt
\fboxrule = .4pt
%    \end{macrocode}
% The saved value of \TeX's |\maxdepth|:
%    \begin{macrocode}
\@maxdepth       = \maxdepth
%    \end{macrocode}
% |\vsize| initialized because a |\clearpage| with |\vsize < \topskip|
%  causes trouble.
% |\@colroom| and |\@colht| also initialized because |\vsize| may be
%  set to them if a |\clearpage| is done before the |\begin{document}|
%
%    \begin{macrocode}
\vsize = 1000pt
\@colroom = \vsize
\@colht = \vsize
%    \end{macrocode}
% Initialise |\textheight| |\textwidth| and page style, to avoid
% internal errors if they are not set by the class.
% \changes{v0.1b}{1994/04/18}
%         {Initialise \cmd\textheight\ \cmd\textwidth\ and page style}
%    \begin{macrocode}
\textheight=.5\maxdimen
\textwidth=\textheight
\ps@empty
%    \end{macrocode}
%
%
% \subsection{Hyphenation}
%
% \changes{v0.1a}{1994/03/07}{move code here from lhyphen.dtx}
% \changes{v0.1a}{1994/03/07}
%         {use \cmd\InputIfFileExists not \cmd\IfFileExists}
%
% The following code will be compiled into the format file. It checks
% for the existance of \texttt{hyphen.cfg} in inputs that file if
% found. Otherwise it inputs \texttt{hyphen.ltx}.  Note that these
% are loaded in \emph{before} the |\catcode|s are set, so local
% hyphenation files can use 8-bit input.
%
% We try to load the customized hyphenation description file.
%    \begin{macrocode}
\InputIfFileExists{hyphen.cfg}
           {\typeout{********************************************^^J%
                     * Local configuration file hyphen.cfg used^^J%
                     ********************************************}}
           {\input{hyphen.ltx}}
%    \end{macrocode}
%
%
%
% \subsection{Font loading}
%    Fonts loaded during the formatting process might already have
%    changed the |\font@submax| from |0pt| to something higher.
%    If so be put out a bold warning.
% \changes{v0.1l}{1994/05/20}{Use new font warning commands}
%    \begin{macrocode}
\ifdim \font@submax >\z@
   \@font@warning{Size substitutions with differences\MessageBreak
                 up to \font@submax\space have occured.\MessageBreak
                \MessageBreak
                Please check the transcript file
                carefully\MessageBreak
                and redo the format generation if necessary!
                \@gobbletwo}%
   \errhelp{Only stopped, to give you time to
            read the above message.}
   \errmessage{}
%    \end{macrocode}
%    We reset the macro. Otherwise every user will get a warning on
%    every job.
%    \begin{macrocode}
\def\font@submax{0pt}
\fi
%    \end{macrocode}
%
% \subsection{Input encoding}
%
% We temporarily define |\reserved@a| to apply |\reserved@c| to all the
% numbers in the range of its arguments.
%    \begin{macrocode}
\def\reserved@a#1#2{%
   \@tempcnta#1\relax
   \@tempcntb#2\relax
   \reserved@b
}
\def\reserved@b{%
   \ifnum\@tempcnta>\@tempcntb\else
      \reserved@c\@tempcnta
      \advance\@tempcnta\@ne
      \expandafter\reserved@b
   \fi
}
%    \end{macrocode}
% \changes{v0.1e}{1994/05/02}{Added setting the special catcodes.}
% \changes{v0.1f}{1994/05/02}{Set the catcode of control-J.}
% Set the special catcodes (although some of these are useless, since an
% error will have occurred if the catcodes have changed).  Note that
% |^^J| has catcode `other' for use in warning messages.
%    \begin{macrocode}
\catcode`\ =10
\catcode`\#=6
\catcode`\$=3
\catcode`\%=14
\catcode`\&=4
\catcode`\\=0
\catcode`\^=7
\catcode`\_=8
\catcode`\{=1
\catcode`\}=2
\catcode`\~=13
\catcode`\@=11
\catcode`\^^I=10
\catcode`\^^J=12
\catcode`\^^L=13
\catcode`\^^M=5
%    \end{macrocode}
% \changes{v0.1e}{1994/05/02}{Added setting the `other' catcodes.}
% Set the `other' catcodes.
%    \begin{macrocode}
\def\reserved@c#1{\catcode#1=12\relax}
\reserved@c{`\!}
\reserved@c{`\"}
\reserved@a{`\'}{`\?}
\reserved@c{`\[}
\reserved@c{`\]}
\reserved@c{`\`}
\reserved@c{`\|}
%    \end{macrocode}
% \changes{v0.1e}{1994/05/02}{Added setting the `letter' catcodes.}
% Set the `letter' catcodes.
%    \begin{macrocode}
\def\reserved@c#1{\catcode#1=11\relax}
\reserved@a{`\A}{`\Z}
\reserved@a{`\a}{`\z}
%    \end{macrocode}
% \changes{v0.1e}{1994/05/02}{Made slot 127 illegal}
% \changes{v1.0n}{1994/11/18}
%         {re-allow slots 127--255}
% All the characters in the range 0--31 and 127--255 are illegal,
% \emph{except} tab (|^^I|), nl (|^^J|), ff (|^^L|) and cr (|^^M|).
%
% Now allow 8-bit characters, although their use in this way is
% strongly discouraged. See |inputenc.dtx| for a supported mechanism
% for 8-bit input.
%    \begin{macrocode}
\def\reserved@c#1{\catcode#1=15\relax}
\reserved@a{0}{`\^^H}
\reserved@c{`\^^K}
\reserved@a{`\^^N}{31}
%\ifnum\inputlineno=\m@ne
  \catcode"7F=15
%\else
%  \reserved@a{"7F}{"FF}
%\fi
%    \end{macrocode}
% The lower case characters need their |\uccode| and |\lccode| values
% set. Depending on the \TeX{} version, we might not be allowed to do
% this for non-ASCII characters.
%    \begin{macrocode}
% \changes{v1.0n}{1994/06/09}{For \TeX2, do not set codes for higher
%                   half of character table.}
\def\reserved@c#1{%
   \count@=#1\advance\count@ by -"20
   \uccode#1=\count@
   \lccode#1=#1
}
\reserved@a{`\a}{`\z}
\ifnum\inputlineno=\m@ne\else
  \reserved@a{"A0}{"BC}
  \reserved@a{"E0}{"FF}
\fi
%    \end{macrocode}
% The upper case characters need their |\uccode| and |\lccode| values
% set, and their |\sfcode| set to 999.
%    \begin{macrocode}
\def\reserved@c#1{%
   \count@=#1\advance\count@ by "20
   \uccode#1=#1
   \lccode#1=\count@
   \sfcode#1=999
}
\reserved@a{`\A}{`\Z}
\ifnum\inputlineno=\m@ne\else
  \reserved@a{"80}{"9C}
  \reserved@a{"C0}{"DF}
\fi
%    \end{macrocode}
% Well, it would be nice if that were correct, but unfortunately, the
% Cork encoding contains some odd slots whose uccode or lccode isn't
% quite what you'd expect.
%    \begin{macrocode}
\uccode`\^^Y=`\I     % dotless i
\lccode`\^^Y=`\^^Y   % dotless i
\uccode`\^^Z=`\J     % dotless j, ae in OT1
\lccode`\^^Z=`\^^Z   % dotless j, ae in OT1
\ifnum\inputlineno=\m@ne\else
  \lccode`\^^9d=`\i    % dotted I
  \uccode`\^^9d=`\^^9d % dotted I
  \lccode`\^^9e=`\^^9e % d-bar
  \uccode`\^^9e=`\^^d0 % d-bar
\fi
%    \end{macrocode}
% And just to make sure nobody relies on those definitions of
% |\reserved@a| and friends:
%    \begin{macrocode}
\let\reserved@a=\@undefined
\let\reserved@b=\@undefined
\let\reserved@c=\@undefined
%    \end{macrocode}
%
%
% \changes{v1.0h}{1994/05/13}{Added output enc stuff}
% \changes{v1.0i}{1994/05/16}{moved output enc stuff to lfonts}
%
% \changes{v0.1a}{1994/03/07}{Add code from the old dump.dtx}
%
% \subsection{Applying Patch files}
% Between major releases, small patches will be distributed in
% files |ltpatch.ltx| which must be added at this point.
% \changes{v1.0m}{1994/06/08}{Add patch file system}
%    \begin{macrocode}
\IfFileExists{ltpatch.ltx}
  {\typeout{***********************************^^J%
            * Applying patch file ltpatch.ltx *^^J%
            ***********************************}
   \def\fmtversion@topatch{unknown}
   \input{ltpatch.ltx} 
   \ifx\fmtversion\fmtversion@topatch
      \ifx\patch@level\@undefined
        \typeout{^^J^^J^^J%
         !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J%
         !! Patch file `ltpatch.ltx' not suitable for this^^J%
         !! version of LaTeX.^^J^^J%
         !! Please check if initex found an old patch file:^^J%
         !! --- if so, rename it or delete it, and redo the^^J%
         !! initex run.^^J%
         !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J}%
        \batchmode \@@end
      \else
        \everyjob{%
          \typeout{%
            \fmtname\space<\fmtversion> patch level \patch@level}}%
        \the\everyjob
      \fi
   \else
      \typeout{^^J^^J^^J%
     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J%
     !! Patch file `ltpatch.ltx' (for version <\fmtversion@topatch>)^^J%
     !! is not suitable for version <\fmtversion> of LaTeX.^^J^^J%
     !! Please check if initex found an old patch file:^^J%
     !! --- if so, rename it or delete it, and redo the^^J%
     !!     initex run.^^J%
     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J}%
       \batchmode \@@end
   \fi
   \let\fmtversion@topatch\relax
  }{}
%    \end{macrocode}
%
% \subsection{Initialise file list}
% Reset |\@filelist| so files input while making the format are not
% listed.
%    \begin{macrocode}
\let\@filelist\@gobble
%    \end{macrocode}
%
% \subsection{Dumping the format}
%    Finally we make |@| into a letter, and dump everything into the
%    format file.
%    \begin{macrocode}
\makeatother
\dump
%</2ekernel>
%    \end{macrocode}
%
% \Finale
%
