% Document Type: LaTeX
% Master File: preload.tex
% 
%             PRELOADED LaTeX FORMAT  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%                D. P. Carlisle
%                carlisle@uk.ac.man.cs
%
%                 29 September 1989
%   
%    This file will produce a format that will LaTeX documents faster 
% as the style file and various options are preloaded.
%
%    The \documentstyle command is redefined so that it ignores the 
% preloaded options, but loads any other option files. The job 
% terminates if a style other than the preloaded style is requested.
% Note that this means that if you mis-type the style as in artikle,
% you will not be prompted to give an alternative file name, the job
% stops immediately.
%
%    Note that the preloaded options will ALWAYS be loaded even if 
% omitted from the file, so
% \documentsyle{article}
% would be sufficient to specify 12pt,a4,amssymbols,dpc and article.
% This is not recomended as it means that the file could not be run 
% through standard LaTeX.
%
%    To create the format:
%  1 Rename this file to the name you wish
% plus the extension .tex (eg mytex.tex).
%  2 Edit the file to refer to the style and options you require. 
%  3 Create the format with 
% initex &lplain mytex     (initex \&lplain mytex      under unix).
%
%    To use the format, create your LaTeX document (eg paper.tex).
% LaTeX it with
% virtex &mytex paper     (virtex \&lplain mytex      under unix).
%
% If you have not got virtex use tex: tex &mytex paper
% Some PC implementations of TeX do not have a separate program
% for initex, they use the tex.exe, possibly with a command line 
% switch such as /i.
%
%    It may also be possible to created a TeX preloaded 
% with this format so that 
% mytex paper 
% would suffice.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter

\def\@documentstyle[#1]#2{\makeatletter
   \def\@styl@{#2}
   \def\@@@pts{#1}
   \def\@optionlist{#1}\gdef\@optionfiles{}\input #2.sty\relax
   \let\@elt\input \@optionfiles \let\@elt\relax \makeatother}
             
\def\cle@r#1{\expandafter\def\csname ds@#1\endcsname{}}
\def\@options{\let\@elt\relax
    \@for\@tempa:=\@optionlist\do
        {\@ifundefined{ds@\@tempa}{\xdef\@optionfiles{\@optionfiles 
             \@elt \@tempa.sty\relax}}
        {\csname ds@\@tempa\endcsname}\cle@r\@tempa}}

\makeatother

% PUT YOUR FAVOURITE STYLE AND OPTIONS HERE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentstyle[12pt,a4,amssymbols,dpc]{article}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\makeatletter

\everyjob{\typeout{\protect\documentstyle[\@@@pts]{\@styl@} preloaded}}

\def\st@p{\fi\stop}
\def\@documentstyle[#1]#2{\makeatletter
   \def\@@styl@{#2}
   \def\@optionlist{#1}\gdef\@optionfiles{}%
\ifx\@styl@\@@styl@\@options%
\else\typeout{Attempt to use #2.sty when \@styl@.sty preloaded}\st@p\fi 
   \let\@elt\input \@optionfiles \let\@elt\relax \makeatother}

\makeatother   
\dump

 
