% ********************************************************************
% LOGIC.sty                                         I. W. Hall 15.9.90
% Royal Octavo format: 100%
% ********************************************************************
\typeout{ }
\typeout{* Document Style `LOGIC'  * * * *}
\typeout{* * by I. W. Hall * * * * * * * *}
\typeout{* * * Oxford University Press * *}
\typeout{* * * * Copyright Jan 1991  * * *}
\typeout{* * * * * Version 1.2 * * * * * *}
\typeout{ }
\typeout{ }

% *************
% Error message
% *************
\def\@logicerr#1%
  {\errhelp{This standard LaTeX command is not used in LOGIC.STY.
            ^^JTry pressing return, and it'll probably be ignored.}%
  \typeout{Style error. \space See `Typesetting your chapter....}%
  \errmessage{#1}}

% **************************************
% Page dimensions, lineskips, type sizes
% **************************************
\lineskip 1pt \normallineskip 1pt
\def\baselinestretch{1}

\@twosidetrue     % Left and right pages
\@mparswitchtrue  % Marginal notes in the outside margin

\def\@normalsize{\@setsize\normalsize{12pt}\xpt\@xpt
   \abovedisplayskip 12pt plus3pt minus7pt
   \belowdisplayskip\abovedisplayskip
   \abovedisplayshortskip \z@ plus3pt
   \belowdisplayshortskip 6.5pt plus3.5pt minus3pt
   \let\@listi\@listI} 
\def\small{\@setsize\small{11pt}\ixpt\@ixpt
   \abovedisplayskip 11pt plus3pt minus6pt
   \belowdisplayskip\abovedisplayskip
   \abovedisplayshortskip \z@ plus2pt
   \belowdisplayshortskip 4pt plus2pt minus2pt
   \def\@listi{\parsep 4.5pt plus 2pt minus 1pt
   \itemsep \parsep
   \topsep 9pt plus 3pt minus 5pt}}
\def\footnotesize{\@setsize\footnotesize{10pt}\viiipt\@viiipt
   \abovedisplayskip 6pt plus2pt minus4pt
   \belowdisplayskip \abovedisplayskip
   \abovedisplayshortskip \z@ plus1pt
   \belowdisplayshortskip 3pt plus1pt minus2pt
   \def\@listi{\leftmargin\leftmargini
   \topsep 4pt plus 2pt minus 2pt
   \parsep 2pt plus 1pt minus 1pt
   \itemsep \parsep}}
\def\scriptsize{\@setsize\scriptsize{9.5pt}\viiipt\@viiipt}
\def\tiny{\@setsize\tiny{7pt}\vipt\@vipt}
\def\large{\@setsize\large{14pt}\xiipt\@xiipt}   % B
\def\Large{\@setsize\Large{16pt}\xivpt\@xivpt}   % A
\def\LARGE{\@setsize\LARGE{22pt}\xxpt\@xxpt}     % Chap
\def\huge{\@setsize\huge{30pt}\xxvpt\@xxvpt}
\let\Huge=\huge
\def\em{\sl}
\normalsize 

% **********************

\oddsidemargin 6.25pc
\evensidemargin 6.25pc
\marginparwidth 85pt

\marginparsep 10pt 
\topmargin 27pt 
\headheight 8pt 
\headsep 10pt 
\footskip 30pt
\topskip 10pt

\textheight = 43\baselineskip       % 44 lines on a page
\advance\textheight by \topskip     %
\textwidth 27pc 
\columnsep 2 pc 
\columnseprule 0pt

\footnotesep 8.4pt 
\skip\footins 10.8pt plus 4pt minus 2pt 
\marginparpush 7pt 


\parskip 0pt 
\parindent 1.5em 
\partopsep 3pt plus 2pt minus 2pt 

% Penalties
% \spaceskip = .5 em plus .6em minus .2em
% \pretolerance=2000
\binoppenalty=2000
\relpenalty=1500

\@lowpenalty 51 \@medpenalty 151 \@highpenalty 301 
\@beginparpenalty -\@lowpenalty
\@endparpenalty -\@lowpenalty
\@itempenalty -\@lowpenalty
\clubpenalty 1500
\widowpenalty 1500
\displaywidowpenalty 1500
\predisplaypenalty 500
\postdisplaypenalty 500
\interlinepenalty 0
\brokenpenalty 2000
 

\def\@ptsize{0} 
\@namedef{ds@11pt}{\@logicerr{Only 10 point is available}}
\@namedef{ds@12pt}{\@logicerr{Only 10 point is available}}
\def\ds@twoside{}
\def\ds@draft{\overfullrule 5pt} 
\@options
\relax 

% *******************
% Sectioning commands
% *******************
% Counters
% \newcounter {part}
\newcounter {chapter}
\newcounter {section}[chapter]
\newcounter {subsection}[section]
\newcounter {subsubsection}[subsection]
\newcounter {paragraph}[subsubsection]
\newcounter {subparagraph}[paragraph]

% Form of the numbers
% \def\thepart{\roman{part}}
\def\thechapter{\arabic{chapter}} 
\def\thesection{\arabic{section}}
\def\thesubsection{\thesection.\arabic{subsection}}
\def\thesubsubsection{\thesubsection .\arabic{subsubsection}}
\def\theparagraph{\thesubsubsection.\arabic{paragraph}}
\def\thesubparagraph{\theparagraph.\arabic{subparagraph}}

% Section macros
%\def\part#1{
%    \cleardoublepage
%    \hbox{} 
%    \addvspace{4\baselineskip}
%    \LARGE #1 \normalsize \par
%    
%    }
%
%
%
\def\chapter{\par \addvspace{4ex} \@afterindentfalse
    \secdef\@chapter\@schapter}
\def\@chapter[#1]#2#3{\ifnum \c@secnumdepth >\m@ne
   \refstepcounter{chapter}
% \addcontentsline{toc}{chapter}{\thechapter \hspace{1em}#1}\else
% \addcontentsline{toc}{chapter}{#1}\fi
   \fi
   \hbox{} \vskip 2pc
   {\raggedright
   \ifnum \c@secnumdepth >\m@ne
   \fi \rm\LARGE
   {\leftskip=2pc #2  \par}
   \vskip 6pt \hskip 2 pc \large \bf #3 \vskip 2 pc
   \hrule width 27pc depth 0.5pt \vskip 1pc
   \thispagestyle{plain}
   \markboth{#3}{#1}\par }
   \nobreak \vskip 3ex
   \tableofcontents
   \@afterheading}
\def\@schapter#1{{\parindent 0pt \raggedright
   \LARGE \rm
   #1\par} \nobreak \vskip 3ex \@afterheading }
\def\section{\par \@afterindentfalse
   \secdef\@section\@ssection}
\def\@section[#1]#2{
   \typeout{* #2}
   \addvspace{22pt}
   \ifnum \c@secnumdepth > \m@ne
   \refstepcounter{section} \setcounter{equation}{0}
   \addcontentsline{toc}{section}
   {\protect\numberline{\thesection}{#1}}
   \else
   \addcontentsline{toc}{section}{#1}
   \fi
   {\parindent 0pt \raggedright
   \ifnum \c@secnumdepth > \m@ne
   \Large \bf \thesection \hskip 1 pc
   \fi
   \rm \Large #2 \par}
   \nobreak
   \addvspace{14pt}
   \@afterheading
   }
\def\@ssection#1{{\parindent 0pt \raggedright
   \Large \rm
   #1\par} \nobreak \vskip 14pt \@afterheading }
\def\subsection{\@startsection{subsection}{2}{\z@}{-12pt}{12pt}{\large\bf}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-14pt}{2pt}
{\normalsize\sl\bf}}
\def\paragraph{\@startsection
 {paragraph}{4}{\z@}{3.25ex plus 1ex minus .2ex}{-1em}{\normalsize\bf}}
\def\subparagraph{\@startsection
 {subparagraph}{4}{\parindent}{3.25ex plus 1ex minus 
 .2ex}{-1em}{\normalsize\bf}}

\setcounter{secnumdepth}{3}

% Running headlines
\mark{{}{}} 

\def\ps@headings
   {\let\@mkboth\markboth
    \def\@oddfoot{}%
    \def\@evenfoot{}%
    \def\@evenhead{\rm\thepage\hfil\it\leftmark\hfil\hbox{}}%
    \def\@oddhead{\hbox{}\hfil\it\rightmark\hfil\rm\thepage}%
    \def\sectionmark##1{\markright{##1}}%
    \def\chaptermark##1{\markboth{##1}{##1}}%
    \def\subsectionmark##1{}}

\def\ps@myheadings
  {\@logicerr{The page style `myheadings' is not available.}}
          
% Figures and tables
\long\def\@makecaption#1#2{
   \vskip 10pt 
   \setbox\@tempboxa\hbox{\bf #1. \rm #2}
   \ifdim \wd\@tempboxa >\hsize \bf #1. \rm #2\par 
      \else \hbox to\hsize{\hfil\box\@tempboxa\hfil} 
      \fi }

\long\def\@tablecaption#1#2{
   \setbox\@tempboxa\hbox{\bf #1. \rm #2}
   \ifdim \wd\@tempboxa >\hsize \bf #1. \rm #2\par \else \hbox
   to\hsize{\hfil\box\@tempboxa\hfil} 
   \fi \vskip 10pt}

\newcounter{figure}[chapter]
\def\thefigure{\@arabic\c@figure}
\def\fps@figure{tbp}
\def\ftype@figure{1}
\def\ext@figure{lof}
\def\fnum@figure{Fig. \thefigure}
\def\figure{\@float{figure}}
\let\endfigure\end@float
\@namedef{figure*}{\@dblfloat{figure}}
\@namedef{endfigure*}{\end@dblfloat}
\newcounter{table}[chapter]
\def\thetable{\@arabic\c@table}
\def\fps@table{tbp}
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{Table \thetable}
\def\table{\let\@makecaption\@tablecaption \@float{table}}
\let\endtable\end@float
\@namedef{table*}{\@dblfloat{table}}
\@namedef{endtable*}{\end@dblfloat}


% Modifications to the equation environment
\@addtoreset{equation}{section}
\def\theequation{\thesection.\arabic{equation}}
\arraycolsep 5pt \tabcolsep 6pt \arrayrulewidth .4pt \doublerulesep 2pt
\tabbingsep \labelsep 

% New theorem-like environments
\@addtoreset{definition}{section}
\newtheorem{definition}{Definition}[subsection]
\newtheorem{theorem}[definition]{Theorem}
\newtheorem{lemma}[definition]{Lemma}
\newtheorem{example}[definition]{Example}
\newtheorem{fact}[definition]{Fact}
\newtheorem{conjecture}[definition]{Conjecture}
\newtheorem{proposition}[definition]{Proposition}
\newtheorem{characterization}[definition]{Characterization}
\newtheorem{corollary}[definition]{Corollary}
\newtheorem{remarks}[definition]{Remarks}
\newtheorem{puzzle}[definition]{Puzzle}
\def\setthmfont{%
  \def\theoremtest{theorem}
  \def\proptest{proposition}
  \def\lemmatest{lemma}
  \def\coroltest{corollary}
  \ifx\@currenvir\theoremtest \def\@thmfont{\sl} \else
  \ifx\@currenvir\proptest    \def\@thmfont{\sl} \else
  \ifx\@currenvir\lemmatest   \def\@thmfont{\sl} \else
  \ifx\@currenvir\coroltest   \def\@thmfont{\sl} \else
  \def\@thmfont{\rm}  \fi \fi \fi \fi
}
\def\@begintheorem#1#2{%
\setthmfont
\par\addvspace{6pt}\noindent
{\bf #1\ #2.}\ignorespaces
\hskip 0.5pc\@thmfont}
\def\@opargbegintheorem#1#2#3{%
\setthmfont
\par\addvspace{6pt}\noindent
{\bf #1\ #2\ (#3).}\ignorespaces
\hskip0.5pc\@thmfont}
\def\@endtheorem{\rm\vskip 6pt}

\def\followon#1{\trivlist \item[\hskip\labelsep{\bf#1.}]}
\def\endfollowon{\hfill\rule{2mm}{4mm}\endtrivlist}
\def\proof{\vskip 6pt
\followon{Proof}}
\let\endproof=\endfollowon

% New environments for exercises
\def\exercises{%
\subsection*{Exercises}
\small
\enumerate}
\let\endexercises=\endlist
\def\exercise{%
\subsection*{Exercise}
\small
\enumerate}
\let\endexercise=\endlist

% List numbering and lettering
\def\labelenumi{\arabic{enumi}.} 
\def\theenumi{\arabic{enumi}} 
\def\labelenumii{(\alph{enumii})}
\def\theenumii{\alph{enumii}}
\def\p@enumii{\theenumi}
\def\labelenumiii{\roman{enumiii}.}
\def\theenumiii{\roman{enumiii}}
\def\p@enumiii{\theenumi(\theenumii)}
\def\labelenumiv{\Alph{enumiv}.}
\def\theenumiv{\Alph{enumiv}} 
\def\p@enumiv{\p@enumiii\theenumiii}

\def\labelitemi{$\bullet$}
\def\labelitemiv{\bf --}
\def\labelitemii{$\ast$}
\def\labelitemiii{$\circ$}

\def\descriptionlabel#1{\hspace\labelsep \bf #1}
\def\description{\list{}{\labelwidth\z@ \itemindent-\leftmargin
 \let\makelabel\descriptionlabel}}
\let\enddescription\endlist

\leftmargini 2.5em
\leftmarginii 2.2em \leftmarginiii 1.87em \leftmarginiv 1.7em
\leftmarginv 1em
\leftmarginvi 1em
\leftmargin\leftmargini
\labelsep .5em
\labelwidth\leftmargini\advance\labelwidth-\labelsep
\def\@listI{\leftmargin\leftmargini \parsep 5pt plus 2.5pt minus
1pt\topsep
10pt plus 4pt minus 6pt\itemsep 2pt plus 0.5pt minus 0pt}
\let\@listi\@listI
\@listi 
\def\@listii{\leftmargin\leftmarginii
 \labelwidth\leftmarginii\advance\labelwidth-\labelsep
 \topsep 5pt plus 2.5pt minus 1pt
 \parsep 2.5pt plus 1pt minus 1pt
 \itemsep \parsep}
\def\@listiii{\leftmargin\leftmarginiii
 \labelwidth\leftmarginiii\advance\labelwidth-\labelsep
 \topsep 2.5pt plus 1pt minus 1pt 
 \parsep \z@ \partopsep 1pt plus 0pt minus 1pt
 \itemsep \topsep}
\def\@listiv{\leftmargin\leftmarginiv
 \labelwidth\leftmarginiv\advance\labelwidth-\labelsep}
\def\@listv{\leftmargin\leftmarginv
 \labelwidth\leftmarginv\advance\labelwidth-\labelsep}
\def\@listvi{\leftmargin\leftmarginvi
 \labelwidth\leftmarginvi\advance\labelwidth-\labelsep}

% Verse, quotation, and quote environments
\def\verse{\let\\=\@centercr 
 \list{}{\itemsep\z@ \itemindent -1.5em\listparindent \itemindent 
 \rightmargin\leftmargin\advance\leftmargin 1.5em}\item[]}
\let\endverse\endlist
\def\quotation{\list{}{\listparindent 1.5em
 \itemindent\listparindent
 \rightmargin\leftmargin \parsep 0pt plus 1pt}\item[]}
\let\endquotation=\endlist
\def\quote{\list{}{\rightmargin\leftmargin}\item[]}
\let\endquote=\endlist

\skip\@mpfootins = \skip\footins
\fboxsep = 3pt \fboxrule = .4pt 
% Table of contents
\def\@pnumwidth{1.55em}
\def\@tocrmarg {2.55em}
\def\@dotsep{4.5}
\setcounter{tocdepth}{3}
\def\tableofcontents{\section*{Contents}
 \@starttoc{toc}}
\def\l@chapter#1#2{\addpenalty{\@secpenalty}
 \addvspace{2.25em plus 1pt} \begingroup
 \@tempdima 3em \parindent \z@ \rightskip \@pnumwidth \parfillskip
-\@pnumwidth 
 {\large \bf \leavevmode #1\hfil \hbox to\@pnumwidth{\hss #2}}\par
 \nobreak \endgroup}
% \def\l@section#1#2{\addpenalty{\@secpenalty} \addvspace{1.0em plus %
% 1pt}
% \@tempdima 1.5em \begingroup
%  \parindent \z@ \rightskip \@pnumwidth
%  \parfillskip -\@pnumwidth
%  \bf \leavevmode #1\hfil \hbox to\@pnumwidth{\hss #2}\par
%  \endgroup}
\def\l@section{\@dottedtocline{1}{0em}{1.5em}}
\def\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
\def\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}}
\def\l@paragraph{\@dottedtocline{4}{7.0em}{4.1em}}
\def\l@subparagraph{\@dottedtocline{5}{10em}{5em}}
\def\listoffigures{\section*{List of Figures\@mkboth
 {LIST OF FIGURES}{LIST OF FIGURES}}\@starttoc{lof}}
\def\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
\def\listoftables{\section*{List of Tables\@mkboth
 {LIST OF TABLES}{LIST OF TABLES}}\@starttoc{lot}}
\let\l@table\l@figure

% Bibliography
\def\thebibliography#1{\section*{References\@mkboth
 {REFERENCES}{REFERENCES}}\list
 {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
 \advance\leftmargin\labelsep
 \usecounter{enumi}}
 \def\newblock{\hskip .11em plus .33em minus .07em}
 \sloppy\clubpenalty4000\widowpenalty4000
 \sfcode`\.=1000\relax}
\let\endthebibliography=\endlist

% *****
% Index
% *****
\def\makeindex{\if@filesw
  \newwrite\@subindexfile\immediate\openout\@subindexfile=\jobname.sbj
  \newwrite\@auindexfile\immediate\openout\@auindexfile=\jobname.aut
  \newwrite\@notindexfile\immediate\openout\@notindexfile=\jobname.not
  \def\subind{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrindex\@subindexfile}\typeout
{Writing the subject index file:  \jobname.sbj }
  \def\auind{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrindex\@auindexfile}\typeout
{Writing the author index file:   \jobname.aut }
  \def\notind{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrindex\@notindexfile}\typeout
{Writing the notation index file: \jobname.not }\fi}

\def\@wrindex#1#2{\let\thepage\relax
  \xdef\@gtempa{\write#1{\string
    \indexentry{#2}{\thepage}}}\endgroup\@gtempa
  \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}

\def\subind{\@bsphack\begingroup \@sanitize\@index}
\def\auind{\@bsphack\begingroup \@sanitize\@index}
\def\notind{\@bsphack\begingroup \@sanitize\@index}

\def\@index#1{\endgroup\@esphack}

\newif\if@restonecol
\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
\columnseprule \z@
\columnsep 35pt\twocolumn[\chapter*{Index}]
 \@mkboth{INDEX}{INDEX}\thispagestyle{plain}\parindent\z@
 \parskip\z@ plus .3pt\relax\let\item\@idxitem}
\def\@idxitem{\par\hangindent 40pt}
\def\subitem{\par\hangindent 40pt \hspace*{20pt}}
\def\subsubitem{\par\hangindent 40pt \hspace*{30pt}}
\def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi}
\def\indexspace{\par \vskip 10pt plus 5pt minus 3pt\relax}

\def\see#1#2{{\em see\/} #1}
\def\printindex{\@input{\jobname.ind}}


% Footnotes
\def\footnoterule{\kern-3\p@ 
 \hrule width .4\columnwidth 
 \kern 2.6\p@} 

\long\def\@makefntext#1{\parindent 1em\noindent 
 \hbox to 1.8em{\hss$^{\@thefnmark}$}#1}

\setcounter{topnumber}{3}
\def\topfraction{.9}
\setcounter{bottomnumber}{2}
\def\bottomfraction{.85}
\setcounter{totalnumber}{4}
\def\textfraction{.1}
\def\floatpagefraction{.5}
\setcounter{dbltopnumber}{2}
\def\dbltopfraction{.7}
\def\dblfloatpagefraction{.5}

% Title page (not needed??)
\def\titlepage{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
 \else \newpage \fi \thispagestyle{empty}\c@page\z@}
\def\endtitlepage{\if@restonecol\twocolumn \else \newpage \fi}
\def\maketitle{\par
 \begingroup
 \def\thefootnote{\fnsymbol{footnote}}
 \def\@makefnmark{\hbox 
 to 0pt{$^{\@thefnmark}$\hss}} 
 \if@twocolumn 
 \twocolumn[\@maketitle] 
 \else \newpage
 \global\@topnum\z@ \@maketitle \fi\thispagestyle{plain}\@thanks
 \endgroup
 \setcounter{footnote}{0}
 \let\maketitle\relax
 \let\@maketitle\relax
 \gdef\@thanks{}\gdef\@author{}\gdef\@title{}\let\thanks\relax}
\def\@maketitle{\newpage
 \null
 \vskip 2em \begin{center}
 {\LARGE \@title \par} \vskip 1.5em {\large \lineskip .5em
\begin{tabular}[t]{c}\@author 
 \end{tabular}\par} 
 \vskip 1em {\large \@date} \end{center}
 \par
 \vskip 1.5em} 
\def\abstract{\if@twocolumn
\section*{Abstract}
\else \small 
\begin{center}
{\bf Abstract\vspace{-.5em}\vspace{0pt}} 
\end{center}
\quotation 
\fi}
\def\endabstract{\if@twocolumn\else\endquotation\fi}

% Date
\def\today{\ifcase\month\or
 January\or February\or March\or April\or May\or June\or
 July\or August\or September\or October\or November\or December\fi
 \space\number\day, \number\year}

% Appendix
\def\appendix{\par
 \setcounter{section}{0}
 \setcounter{subsection}{0}
 \def\thesection{\Alph{section}}}

\ps@headings \pagenumbering{arabic} \onecolumn
%
% Pages will be stretched to fill the full depth
% and a warning message will be given if underfull
\flushbottom

%%%%%%%%%%
\floatsep 14pt plus 2pt minus 4pt 
\textfloatsep 20pt plus 2pt minus 4pt
\intextsep 14pt plus 4pt minus 4pt 
\@maxsep 20pt 
\dblfloatsep 14pt plus 2pt minus 4pt 
\dbltextfloatsep 20pt plus 2pt minus 4pt 
\@dblmaxsep 20pt 
\@fptop 0pt plus 1fil 
\@fpsep 10pt plus 2fil 
\@fpbot 0pt plus 1fil 
\@dblfptop 0pt plus 1fil 
\@dblfpsep 10pt plus 2fil 
\@dblfpbot 0pt plus 1fil
%%%%%%%%%%
