% local.sty should give a right format for your thesis.
% written by T.Bulik and modified by B. Thomas for the playbook

% TEXT DEFINITIONS
\def\etal{{\it et al.}}
\def\cf{{\sl Crossfire}}
\def\playbook{{\sl Crossfire} player's handbook}
\def\spoiler{{\sl Crossfire} {\bf spoiler}}
\def\divinemagic{divine magic}
\def\wizardry{wizardry}
\def\incantation{incantation}
% this is the case a/an for 'incantation' def
\def\ina{n}
% using this caus Klaus yelled at me ;)
\def\emdash{{\em $-$}}
% here are some names
\def\angband{{\sl Angband}}
\def\ragnarok{{\sl Ragnarok}}
\def\gauntlet{{\sl Gauntlet (TM)}}
\def\rogue{{\sl Rogue}}
\def\hack{{\sl NetHack}}
\def\moria{{\sl Moria}}
\def\sngc#1{\multicolumn{1}{c}{#1}}
\def\snglc#1{\multicolumn{1}{|c}{#1}}
\def\sngLc#1{\multicolumn{1}{|c|}{#1}}
\def\tplc#1{\multicolumn{3}{c|}{#1}}

% Define the command \mychapter{<head1>}{<head2>}.  <head1>
% is the text to put in the chapter head if there is a
% chapter number; <head2>, if not.

\def\@chapapp{Chapter}
\def\chapapp{\@chapapp}

\def\mychapter#1#2{
   \def\@chaphead##1{#1}
   \def\@schaphead##1{#2}
}

\def\@makechapterhead#1{ \vspace*{\chaptopsep} { \parindent 0pt \raggedright
 \ifnum \c@secnumdepth >\m@ne \@chaphead{#1} \else \@schaphead{#1} \fi
 \par \nobreak \vskip \chapaftersep } }

\def\@makeschapterhead#1{ \vspace*{\chaptopsep} { \parindent 0pt \raggedright
 \@schaphead{#1}\par
 \nobreak \vskip \chapaftersep } }

% \chaptopsep is the space between the top of the text page and the
% chapter head.  \chapaftersep is the space between the chapter
% head and the text.

\newlength{\chaptopsep}
\setlength{\chaptopsep}{.1in}
\newlength{\chapaftersep}
\setlength{\chapaftersep}{.5in}

% Default chapter headings.

% \mychapter{\LARGE \sc \thechapter. #1}{\LARGE \sc #1}
% \mychapter{\LARGE \sc . #1}{\LARGE \sc #1}
%
% This defines the chapter headings as required by you know who.
%
% \mychapter{\large\bf \begin{center} \chapapp\ \thechapter \end{center}
% \mychapter{\large\bf \thechapter . #1 $-$ }
\mychapter{\large\bf Chapter \thechapter . #1 }
        {\large\bf \begin{center} #1 \end{center}}



% Define the command \mysection{<sec>}{<style>}{<prefix>}.
% <sec> is the section level--section, subsection, etc.  <style>
% is the style in which the section head is to be set; e.g.,
% \large\bf.  <prefix> is what proceeds the head text, usually
% \the<sec> followed by some putctuation.


\def\@startsection#1#2#3#4#5#6{\if@noskipsec \leavevmode \fi
   \par \@tempskipa #4\relax
   \@afterindenttrue
   \ifdim \@tempskipa <\z@ \@tempskipa -\@tempskipa \@afterindentfalse\fi
   \if@nobreak \everypar{}\else
     \addpenalty{\@secpenalty}\addvspace{\@tempskipa}\fi \@ifstar
     {\@ssect{#3}{#4}{#5}{#1}}{\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}


\def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth
     \def\@svsec{}\else
     \refstepcounter{#1}
     \edef\@svsec{\expandafter\relax\csname @pre#1\endcsname}\fi
     \@tempskipa #5\relax
      \ifdim \@tempskipa>\z@
        \begingroup \expandafter\relax\csname @#1style\endcsname\relax
          \@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty \@M #8\par}
        \endgroup
       \csname #1mark\endcsname{#7}\addcontentsline
         {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                      \protect\numberline{\csname the#1\endcsname}\fi
                    #7}\else
        \def\@svsechd{
            \expandafter\relax\csname @#1style\endcsname\relax
            \hskip #3\@svsec #8\csname #1mark\endcsname
                      {#7}\addcontentsline
                           {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                             \protect\numberline{\csname the#1\endcsname}\fi
                       #7}}\fi
     \@xsect{#5}}


\def\@ssect#1#2#3#4#5{\@tempskipa #3\relax
   \ifdim \@tempskipa>\z@
     \begingroup \expandafter\relax\csname @#4style\endcsname\relax
     \@hangfrom{\hskip #1}{\interlinepenalty \@M #5\par}\endgroup
   \else \def\@svsechd{#4\hskip #1\relax #5}\fi
    \@xsect{#3}}

\def\mysection#1#2#3{
     \expandafter\def\csname @#1style\endcsname{#2}
     \expandafter\def\csname @pre#1\endcsname{#3}
}

% Default section heads.

\mysection{section}{\normalsize\bf}{Section \thesection .~}
\mysection{subsection}{\normalsize\bf}{\thesubsection.~}
% Line added by me follows
\mysection{subsubsection}{\normalsize\bf}{\thesubsubsection.~}

\renewcommand{\listoffigures}{\@restonecolfalse \if@twocolumn
 \@restonecoltrue \onecolumn \fi
\chapter*{\listfigurename \@mkboth {\uppercase {\listfigurename }
\addcontentsline{toc}{chapter}{\listfigurename}}{\uppercase {\listfigurename
 }}\addcontentsline{toc}{chapter}{\listfigurename} }
 \@starttoc{lof}\if@restonecol \twocolumn \fi }


\renewcommand{\listoftables}{\@restonecolfalse \if@twocolumn
 \@restonecoltrue \onecolumn \fi
\chapter*{\listtablename \@mkboth {\uppercase {\listtablename }
\addcontentsline{toc}{chapter}{\listtablename}}{\uppercase {\listtablename
 }}\addcontentsline{toc}{chapter}{\listtablename} }
 \@starttoc{lot}\if@restonecol \twocolumn \fi }


%----new margins from 12/89
\advance\textheight by 1.1in
\advance\voffset by -0.4in
\advance\textwidth by 0.5in
\advance\oddsidemargin by -0.05in

%
% LINE SPACING for single space
\newcommand{\snglsp}{\baselineskip=14pt plus .1pt}
% LINE SPACING for double space
\newcommand{\dblesp}{\baselineskip=28pt plus .1pt}
%
\newcommand{\bequ}{\begin{equation}}
\newcommand{\eequ}{\end{equation}}
\newcommand{\beqn}{\begin{eqnarray}}
\newcommand{\eeqn}{\end{eqnarray}}
%
%
\newcommand{\omc}{\mbox{$\omega_c$}}
\newcommand{\gray}{\mbox{$\gamma$-ray}}
\newcommand{\ctg}{\mathop{\rm ctg}\nolimits}

%
% INPUTTING MONGO FILES:
% see psfig.tex for more detail .
%
%\input psfig.tex
%\pssilent
\def\mongovaryheight#1 #2 {\psfig{bbllx=36pt,bblly=36pt,bburx=576pt,bbury=756pt,file=#1,height=#2,angle=-90}}
\def\mongovarywidth#1 #2 {\psfig{bbllx=36pt,bblly=36pt,bburx=576pt,bbury=756pt,file=#1,width=#2,angle=-90}}
\def\mongovaryboth#1 #2 #3 {\psfig{bbllx=36pt,bblly=36pt,bburx=576pt,bbury=756pt,file=#1,height=#2,width=#3,angle=-90}}
\def\mongovarybothside#1 #2 #3 {\psfig{bbllx=36pt,bblly=36pt,bburx=576pt,bbury=756pt,file=#1,height=#2,width=#3,angle=0}}
\def\mongovary5height#1 #2 {\psfig{bbllx=36pt,bblly=36pt,bburx=756pt,bbury=576pt,file=#1,height=#2}}

%
% This command creates bibliography and adds an entry to the table of
% contents.
%
\def\bibname{References}
\renewcommand{\thebibliography}[1]
{\chapter *{\bibname \@mkboth
{\uppercase {\bibname }}{\uppercase {\bibname }}}
\addcontentsline{toc}{chapter}{\bibname}
\list {\@biblabel {\arabic {enumiv}}}{\settowidth \labelwidth {\@biblabel {#1}}
\leftmargin \labelwidth
\advance \leftmargin \labelsep
\usecounter {enumiv}
\let \p@enumiv \@empty
\def \theenumiv {\arabic {enumiv}}}
\def \newblock {\hskip .11em plus.33em minus.07em}
\sloppy \clubpenalty 4000\widowpenalty 4000
\sfcode`\.=\@m }

%
% STUFF ADDED BY ME, RJT
%

\def\references{\section*{REFERENCES}
\bgroup\parindent=\z@\parskip=\itemsep
\def\reference{\par\noindent \hangafter=1 \hangindent 22.76pt}}
\def\endreferences{\reference\egroup}

\def\plotone#1{\centering \leavevmode
    \epsfxsize=\textwidth \epsfbox{#1}}

\def\plottwo#1#2{\centering \leavevmode
    \epsfxsize=.45\textwidth \epsfbox{#1} \hfil
    \epsfxsize=.45\textwidth \epsfbox{#2}}

\def\plotfiddle#1#2#3#4#5#6#7{\centering \leavevmode
    \vbox to#2{\rule{0pt}{#2}}
    \special{psfile=#1 voffset=#7 hoffset=#6 vscale=#5 hscale=#4 angle=#3}}


\newif\if@topcaption \@topcaptiontrue
\def\topcaption{\@topcaptiontrue\tablecaption}
\def\bottomcaption{\@topcaptionfalse\tablecaption}

%
% Added the command \tablecaption, with the use of the definition
% of the \caption and \@caption commands from latex.tex.
% This command has to function exactly like \caption does except it
% has to store its argument (and the optional argument) for later
% processing WITHIN the supertabular environment
% JB
%
\long\def\tablecaption{\refstepcounter{table} \@dblarg{\@xtablecaption}}
\long\def\@xtablecaption[#1]#2{%
  \long\def\@process@tablecaption{\@stcaption{table}[#1]{#2}}}
\let\@process@tablecaption\relax

%
% This is a redefinition of LaTeX's \@caption, \@makecaption is
% called within a group so as not to return to \normalsize globally.
% also a fix is made for the `feature' of the \@makecaption of article.sty and
% friends that a caption ALWAYS gets a \vskip 10pt at the top and NONE at the
% bottom. If a user wants to precede his table with a caption this results
% in a collision.
%

\long\def\@stcaption#1[#2]#3{\par%
    \addcontentsline{\csname ext@#1\endcsname}{#1}%
        {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}
  \begingroup
    \@parboxrestore
    \normalsize
    \if@topcaption \vskip -10pt \fi % 'fix'
    \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
    \if@topcaption \vskip 10pt \fi % 'fix'
  \endgroup}


                             % \tablehead activates the new tabular \cr
                             % commands
\def\@tablehead{}
\def\tablehead#1{\gdef\@tablehead{#1}}
\def\tablefirsthead#1{\gdef\@table@first@head{#1}}

%+
%     If the user uses an extra amount of tabular-data (like \multicolumn)
%     in \verb=\tabletail= \TeX\ starts looping because of the definition
%     of \verb=\nextline=. So make \verb=\\= act like just a \verb=\cr=
%     inside this tail to prevent the loop.
%     Save and restore the value of \verb=\\=
%-
\def\@tabletail{}
\def\tabletail#1{%
    \gdef\@tabletail{\noalign{\global\let\@savcr=\\\global\let\\=\cr}%
                     #1\noalign{\global\let\\=\@savcr}}}
\def\tablelasttail#1{\gdef\@table@last@tail{#1}}

\newdimen\maxsize            % maximum pagesize
\newdimen\actsize            % actual pagesize
\newdimen\twocolsize         % needed for correct max height if twocolumn
\newdimen\parboxheight       % height plus depth of a parbox-argument
\newdimen\addspace           % stores the value of \\[#1]
\newdimen\midlineheight      % estimated size of a normal line
\newdimen\pargcorrection     % to set page height tolerance if p-arg
\newdimen\computedimens      % computation variable
\newbox\tabparbox

         %%%%  Redefine original LaTeX tabular \cr commands. %%%%
         %%%%  New tabular \cr commands get a leading `s'    %%%%

% Insert  \nextline command for counting
\def\@stabularcr{{\ifnum0=`}\fi\@ifstar{\@sxtabularcr}{\@sxtabularcr}}
\def\@sxtabularcr{\@ifnextchar[{\@sargtabularcr}%
                 {\ifnum0=`{\fi}\cr\nextline}}

                             % contents of command unchanged
\def\@sargtabularcr[#1]{\ifnum0=`{\fi}\ifdim #1>\z@
    \unskip\@sxargarraycr{#1}\else \@syargarraycr{#1}\fi}

                             % here copy the value #1 of [ ] of \\
                             % to \addspace
\def\@sxargarraycr#1{\@tempdima #1\advance\@tempdima \dp \@arstrutbox%
    \vrule \@height\z@ \@depth\@tempdima \@width\z@ \cr%
    \noalign{\global\addspace=#1}\nextline}

                             % command will be called when \\[0pt]
\def\@syargarraycr#1{\cr\noalign{\vskip #1\global\addspace=#1}\nextline}

         %%%%  Redefine original LaTeX p-arg commands.       %%%%
         %%%%  New commands get a leading `s'                %%%%

                                      % reduce maximum pagesize to have
                                      % a small tolerance for last entry
\def\@sstartpbox#1{\global\advance\maxsize by -\pargcorrection
                   \global\pargcorrection=0pt
                                      % put text into box to save height
                   \setbox\tabparbox%
                          \vtop\bgroup\hsize#1\@arrayparboxrestore}
\def\@sendpbox{\par\vskip\dp\@arstrutbox\egroup%
               \computedimens=\ht\tabparbox%
               \advance\computedimens by \dp\tabparbox%
               \ifnum\parboxheight<\computedimens
                  \global\parboxheight=\computedimens
               \fi
               \computedimens=0pt
               \box\tabparbox\hfil}

         %%%%  Here start really new supertabular commands   %%%%

                                 % estimate height of normal line
                                 % regarding \array- and \baselinestretch
\def\calmidlineheight{\midlineheight=\arraystretch \baslineskp
                      \global\advance\midlineheight by 1pt
                      \global\pargcorrection=4\midlineheight}

\def\calpage{\global\actsize=\pagetotal  % where am I on the actual page?
             \twocolsize=\textheight            %  added 06.06.89
             \advance\twocolsize by -\@colroom  %        "
             \advance\actsize by \twocolsize    %        "
             \global\advance\actsize by \midlineheight
             \maxsize=\textheight        % start a new page when 90% of
             \multiply \maxsize by 9     % the page are used
             \divide\maxsize by 10
             \ifnum\actsize > \maxsize
                   \clearpage
                   \global\actsize=\pagetotal
             \fi
             \maxsize=\textheight       % now set \maxsize with tolerance
             \global\advance\maxsize by -\midlineheight}   % of one lines
                             % Here is the definition of supertabular

% modified JB (15.2.91)
\def\supertabular#1 {%           % before it was \edef\tableformat,
                                 % but gave error with @{\hspace{..}} !
    \def\tableformat{\string#1} % store preamble
    \global\starfalse % remember this is the normal version

                                 % Check if we have to insert a caption
    \if@topcaption\@process@tablecaption
    \fi

    \def\baslineskp{\baselineskip}
    \calmidlineheight% estimate height of a normal line
    \calpage         % calculate max. pagesize and startpoint

                                 % save old \@tabularcr
    \let\@@tabularcr\@tabularcr%             Added JB 4/2/91
                                % Now insert the definition of \@stabularcr
    \let\@tabularcr\@stabularcr
                                 % save old \\
    \global\let\@oldcr=\\

                                 % activate new parbox algorithm
    \let\@@startpbox=\@sstartpbox
    \let\@@endpbox=\@sendpbox
%
%    Moved the check for the use of \tablefirsthead to befor the start of
%    the tabular environment in order to make the \futurelet inside \hline
%    do its work correctly (15.02.91)
%
    \ifx\@table@first@head\undefined
        \let\@@tablehead=\@tablehead
    \else
        \let\@@tablehead=\@table@first@head
    \fi%                                     Added JB 4/2/91
                                 % start normal tabular environment
    \begin{tabular}{\tableformat}%
    \@@tablehead}%   Added JB 15/2/91

                                 % this is \end{supertabular}
\def\endsupertabular{%
    \ifx\@table@last@tail\undefined%
        \@tabletail%
    \else%
        \@table@last@tail%
    \fi%                                     Added JB 4/2/91
%removed JB                \noalign{\global\let\\=\@oldcr}%
%   \let\@@startpbox=\@startpbox%
%   \let\@@endpbox=\@endpbox%
    \end{tabular}
                                 % restore old \@tabularcr
    \let\@tabularcr\@@tabularcr             % Added JB 4/2/91
                                 % Check if we have to insert a caption
    \if@topcaption
    \else
        \@process@tablecaption
                                 % resore to default behaviour
        \@topcaptiontrue
    \fi
%+
%    Restore the meaning of \verb=\\= to the one it had before the start
%    of this environment. Also re-initialize some control-sequences
%-
    \global\let\\=\@oldcr
    \let\@table@first@head\undefined        % For the next ocurrence
    \let\@table@last@tail\undefined         % of this environment
    \let\@process@tablecaption\relax
}
                             % Here is the definition of supertabular*
\newif\ifstar
\newdimen\tabularwidth
\@namedef{supertabular*}#1#2 {% modified JB (15.2.91)
                                 % before it was \edef\tableformat,
                                 % but gave error with @{\hspace{..}} !
    \def\tableformat{\string#2} % store preamble
    \tabularwidth=#1 % The total width of the tabular
    \global\startrue % remember this is the *-version

                                 % Check if we have to insert a caption
    \if@topcaption\@process@tablecaption\fi

    \def\baslineskp{\baselineskip}
    \calmidlineheight% estimate height of a normal line
    \calpage         % calculate max. pagesize and startpoint


                                 % save old \@tabularcr
    \let\@@tabularcr\@tabularcr%              Added JB 4/2/91
                                % Now insert the definition of \@stabularcr
    \let\@tabularcr\@stabularcr%              Added JB 4/2/91
                                 % save old \\
    \global\let\@oldcr=\\

                                 % activate new parbox algorithm
    \let\@@startpbox=\@sstartpbox
    \let\@@endpbox=\@sendpbox
%
%    The same modification as for \tabular 15.2.91
    \ifx\@table@first@head\undefined
        \let\@@tablehead\@tablehead
    \else
        \let\@@tablehead\@table@first@head
    \fi%                                     Added JB 4/2/91
                                 % start normal tabular environment
    \begin{tabular*}{\tabularwidth}{\tableformat}%
%
%removed JB                \noalign{\global\let\\=\@stabularcr}
    \@@tablehead}%
                                 % this is \end{supertabular*}
\@namedef{endsupertabular*}{%
    \ifx\@table@last@tail\undefined%
        \@tabletail%
    \else%
        \@table@last@tail%
    \fi%                                     Added JB 4/2/91
%removed JB                \noalign{\global\let\\=\@oldcr}%
    \end{tabular*}
                                 % restore old \@tabularcr
    \let\@tabularcr\@@tabularcr
%               \let\@@startpbox=\@startpbox%
%               \let\@@endpbox=\@endpbox%
                                 % Check if we have to insert a caption
    \if@topcaption
    \else
        \@process@tablecaption
                                 % resore to default behaviour
        \@topcaptiontrue
    \fi
%+
%    Restore the meaning of \verb=\\= to the one it had before the start
%    of this environment. Also re-initialize some control-sequences
%-
    \global\let\\=\@oldcr
    \let\@table@first@head\undefined        % For the next ocurrence
    \let\@table@last@tail\undefined         % of this environment
    \let\@process@tablecaption\relax}
\def\nextline{%           %%% algorithm to calculate the pagebreaks %%%
    \noalign{\ifnum\parboxheight=0
                                 % if no p-arg add `normal' line height
                   \advance\actsize by \midlineheight
                                      % \addspace is value #1 of \\[#1]
                   \global\advance\actsize by \addspace
             \else
                                 % if p-arg add height of box and more
                   \global\advance\actsize by \parboxheight
                   \divide\parboxheight by 11\relax
                   \global\advance\actsize by \parboxheight%
                   \global\parboxheight=0pt
             \fi
             \global\addspace=0pt}%
                                      % when page becomes full:
    \ifnum\actsize<\maxsize
%
%    This line is necessary because the tablehead has to be inserted *after*
%    the \if\else\fi-clause. For this purpose \next is used. In the middle
%    of tableprocessing it shoud be an *empty* macro (*not* \relax).
%    (15.2.91)
    \noalign{\global\let\next\@empty}
    \else
                                      % output \tabletail, close tabular
                                      % output all material and start a
                                      % fresh new page
         \@tabletail
         \ifstar%                     % Added 16-10-90
           \end{tabular*}%
         \else%
           \end{tabular}%
         \fi
         \if@twocolumn%                        % added 10.05.89
            \if@firstcolumn%                   %
               \newpage%                       %
            \else%                             %
               \clearpage%                     %
            \fi%                               %
            \twocolsize=\textheight%           % added 06.06.89
            \advance\twocolsize by -\@colroom% %       "
            \global\actsize=\twocolsize%       %       "
         \else                                 %
            \clearpage                         %
            \global\actsize=\midlineheight%
         \fi                                   %
         \let\next\@tablehead%                 % Added 15.2.91
         \ifstar%                              % Added 16-10-90
           \begin{tabular*}{\tabularwidth}{\tableformat}%
         \else%
           \begin{tabular}{\tableformat}%
         \fi%
%removed JB         \noalign{\global\let\\=\@stabularcr}  % added 10.05.89
%removed JB         \@tablehead%
    \fi\next}%                                % Added \next 15.2.91

% stuff for table footnotes
\def\tablenotemark#1{\rlap{$^{\rm #1}$}}
\newtoks\@temptokenb
\def\tblnote@list{}
\def\tablenotetext#1#2{
\@temptokena={\vspace{.5ex}{\noindent\llap{$^{#1}$}#2}\par}
\@temptokenb=\expandafter{\tblnote@list}
\xdef\tblnote@list{\the\@temptokenb\the\@temptokena}}
\def\spew@tblnotes{
\ifx\tblnote@list\@empty\relax
\else
\vspace{4.5ex}
\footnoterule
\vspace{.5ex}
{\footnotesize\tblnote@list}
\gdef\tblnote@list{}
\fi}
\def\endtable{\spew@tblnotes\end@float}
\@namedef{endtable*}{\spew@tblnotes\end@dblfloat}
\let\tableline=\hline
\long\def\@makecaption#1#2{\vskip 2ex\noindent #1 #2\par}
\def\tablenum#1{\def\thetable{#1}\let\@currentlabel\thetable
\addtocounter{table}{\m@ne}}

