h39542
s 00215/00000/00000
d D 1.1 91/09/06 11:18:18 ExDS 1 0
c date and time created 91/09/06 11:18:18 by ExDS
e
u
U
f e 0
t
T
I 1
%----------------------------------------------------------------------------%
% LaTeXfix.tex                                                               %
% Maxes LaTeX more space-efficient on documents with many \include{}d parts. %
% Author: Damon Hart-Davis                                                   %
% Start Date:  24/Mar/90                                                     %
% Finish Date:                                                               %
%                                                                            %
% File 1 of 1                                                                %
%----------------------------------------------------------------------------%
% @(#)(c) ExNet 1988--1990  LaTeXfix.tex 1.18@(#) 90/09/23 %
% We do a major redefinition of \include and \white@ckpt.
%
% The modified code comes from LATEX VERSION 2.09 - RELEASE OF 4 November 1985
%
% \document ==
%   BEGIN
%     \endgroup   % cancels \begingroup generated by \begin command
%     \@colht := \@colroom := \vsize := \textheight
%     \columnwidth := \textwidth
%     \@clubpenalty := \clubpenalty          % \@clubpenalty saves value.
%     IF @twocolumn = T 
%       THEN \columnwidth := (\columnwidth - \columnsep)/2
%            @firstcolumn := T
%     FI
%     \hsize  := \linewidth := \columnwidth
%     \begingroup
%        \@floatplacement \@dblfloatplacement
%        \@input{\jobname.aux}
%     \endgroup
%     IF \@filesw = T
%       THEN  open file \@mainaux for writing
%             write ``\relax''on file \@mainaux
%     FI
%     \do{COMMAND} == BEGIN \let COMMAND = \@notprerr END
%     \@preamblecmds
%     \do == \noexpand
%     \@normalsize
%     \everypar{}
%   END
%
% \includeonly{FILELIST} ==
%  BEGIN
%   \@partsw   := T
%   \@partlist := FILELIST
%  END
%
% \include{FILE} ==
%  BEGIN
%   \clearpage
%   if \@filesw = T
%     then  \immediate\write\@mainaux{\string\@input{FILE.AUX}}
%   fi
%   if  \@partsw = T
%     then \@tempswa := F
%          \@tempb == FILE
%          for \@tempa := \@partlist
%              do if eval(\@tempa) = eval(\@tempb)
%                   then \@tempswa := T          fi
%              od
%   fi
%
%   if \@NOTSKIPCHKPT or \SINGLEFILE
%       \begingroup
%       \@NOTCHKPT := F
%	    \@input{FILE.aux}	% Get Checkpoint info.
%       \@NOTCHKPT := T
%       \endgroup
%   fi
%
%   if \@tempswa = T        
%      then \@auxout := \@partaux
%           if \@filesw = T
%             then  \immediate\openout\@partaux{FILE.AUX}
%                   \immediate\write\@partaux{\relax}
%                   \immediate\write\@partaux{\if@NOTCHKPT\relax}
%           fi
%           \@input{FILE.TEX}
%           \clearpage
%           \@writeckpt{FILE}
%           \@NOTSKIPCHKPT := F
%           if @filesw then \closeout \@partaux fi
%           \@auxout := \@mainaux
%   fi
%  END
%  
% \@writeckpt{FILE} ==
%  BEGIN
%    if \@filesw = T
%        \immediate\write on file \@partaux:
%                  \else\global\def\TMPVAL{                  %% } 
%        for \@tempa := \cl@@ckpt
%           do  \immediate\write on file \@partaux:
%                   \global\string\setcounter
%                       {eval(\@tempa)}{eval(\c@eval(\@tempa))}
%           od                                     %% {
%
%		 \immediate\write on file \@partaux:
%                  \markboth{ ...\leftmark... }{ ...\rightmark... }
%		 \immediate\write on file \@partaux:
%                  \global\def\EX@PARTNAME{ ...\EX@PARTNAME...}
%
%        \immediate\write on file \@partaux:  } fi
%    fi
%  END
%
%------------------------
%
% \enddocument ==
%   BEGIN
%    \@checkend{document}   %% checks for unmatched \begin
%    \clearpage
%    \begingroup
%      if @filesw = true
%        then  close file @mainaux
%              \global \@namedef {ARG1}{ARG2} == null
%              \newlabel{LABEL}{VAL} ==
%                  BEGIN
%                    \@tempa == VAL
%                    if def(\@tempa) = def(\r@LABEL)
%                      else @tempswa := true          fi
%                  END
%              \bibcite{LABEL}{VAL} == null
%                  BEGIN
%                    \@tempa == VAL
%                    if def(\@tempa) = def(\g@LABEL)
%                      else @tempswa := true          fi
%                  END
%              @tempswa := false
%              make @ a letter
%              \input \jobname.AUX  
%              if @tempswa = true
%                then LaTeX Warning: 'Label may have changed.
%                                     Rerun to get cross-references right.'
%       fi     fi
%    \endgroup
%    finish up
%   END
%
%------------------------
%
%  INITIALIZATION
%    \@tempswa := T
%    \@NOTCHKPT := T		 % Not to do Check Pointing operations on reading .auxs
%    \NOTSKIPCHKPKT := T % Cannot skip remaining checkpoints.

\catcode`@=11 \relax

\global\def\NCPIF{\string\if@NOTCHKPT}
\global\def\NCPFI{\string\fi}
\global\def\NCPEL{\string\else}
\global\let\TMPVALS=\relax
\global\newif\if@NOTCHKPT \@NOTCHKPTtrue
\global\newif\if@NOTSKIPCHKPT \@NOTSKIPCHKPTtrue
\global\newif\ifSINGLEFILE \SINGLEFILEfalse 
									% Assume multiple updated included files.

% The following defines \@PERCENT to be %
% with \catcode 11.
{\catcode`\%=11
\gdef\@PERCENT{%}}

% Quieten \include down by abbreviating  warning message.
\def\@input#1{\openin1 #1 \ifeof1 \message{<No #1>}
	\else\closein1 \relax\@@input #1 \fi}

\global\def\include#1{\clearpage
\if@filesw \immediate\write\@mainaux{\string\@input{#1.aux}}\fi
\@tempswatrue\if@partsw \@tempswafalse\def\@tempb{#1}\@for
\@tempa:=\@partlist\do{\ifx\@tempa\@tempb\@tempswatrue\fi}\fi
%\typeout{Reading aux file}
\ifSINGLEFILE
\begingroup\makeatletter\@NOTCHKPTfalse\@input{#1.aux}\@NOTCHKPTtrue\endgroup
\else
\if@NOTSKIPCHKPT
\begingroup
\makeatletter\let\@writefile\@gobbletwo
\@NOTCHKPTfalse\@input{#1.aux}\@NOTCHKPTtrue
\endgroup
\fi
\fi
%\typeout{Read aux file}
\if@tempswa \if@filesw \let\@auxout=\@partaux
%\typeout{Writing our aux file}
\immediate\openout\@partaux #1.aux
\immediate\write\@partaux{\relax}
\immediate\write\@partaux{\NCPIF}\fi\@input{#1.tex}\clearpage
\@writeckpt{#1}\if@filesw \immediate\closeout\@partaux%
%\typeout{Written our aux file}%
\global\@NOTSKIPCHKPTfalse % Having dealt with our file we can ignore the rest.
\fi\let\@auxout=\@mainaux\else\TMPVALS\fi}

\global\def\@writeckpt#1{\if@filesw 
\immediate\write\@partaux{\NCPEL%
\string\global\string\def\string\TMPVALS\@charlb}% 
{\let\@elt\@wckptelt \cl@@ckpt}
%\ifx\leftmark\isnotdefined\else\ifx\rightmark\isnotdefined\else
%\immediate\write\@partaux{\@PERCENT\string\markboth%
%\@charlb\leftmark\@charrb\@charlb\rightmark\@charrb}\fi\fi
\ifx\EX@PARTNAME\isnotdefined\else
\immediate\write\@partaux{\string\global\string\def\string\EX@PARTNAME\@charlb%
\EX@PARTNAME\@charrb}\fi
\immediate\write\@partaux{\@charrb\NCPFI}\fi}

\global\def\@wckptelt#1{\immediate\write\@partaux
{\string\setcounter{#1}{\the\@nameuse{c@#1}}}}

%\global\def\enddocument{\@checkend{document}\clearpage\begingroup  
%\if@filesw \immediate\closeout\@mainaux 
%\let\@writefile\@gobbletwo%
%\def\global\@namedef##1##2{}\def\newlabel{\@testdef r}%
%\def\bibcite{\@testdef b}\@tempswafalse \makeatletter\input \jobname.aux
%\if@tempswa \@warning{Label(s) may have changed.  Rerun to get
%cross-references right}\fi\fi\endgroup\deadcycles\z@\@@end}

\catcode`@=12 \relax
E 1
