% 'sane' document substyle for LaTeX 2.09. % % Dave Johnson, Dept. of Computer Science, Rice University. % % This file is updated from time to time to reflect new sanity measures % for LaTeX. Watch the comments in this file for the latest news on % new additions or changes. Where possible, new changes will be compatible % with things already in this file, but this is not guaranteed. % % Copyright (c) 1985,1986 by David B. Johnson. % Includes some material from the standard document styles which % are copyrighted by Leslie Lamport. \textheight 9in % 1in top and bottom margin \textwidth 6.5in % 1in left and right margin \oddsidemargin 0in % Both side margins are now 1in \evensidemargin 0in % The header goes .5in from top of the page and from the text. \topmargin -.5in \headsep .5in % Marginal notes have to fit within the 1in margins: use .7in for the % notes themselves with the extra .3in evenly on either side. \marginparwidth .7in \marginparsep .15in % LaTeX normally only leaves a \bigskip (12pt) between the text and the % footnote rule. Make this a little bigger and allow it to stretch % infinitely so that the footnotes will always be at the bottom of the page % even if the page is short. Also make the footnoterule a little shorter. % The standard definition comes out to 2.6 inches which looks fairly bad. % Cut it in half. \skip\footins=18pt plus 12pt minus 12pt \def\footnoterule{\kern-3\p@ \hrule width .2\columnwidth \kern 2.6\p@} % The \hrule has default height of .4pt . % For multiple citations at the same place, put a little space after the comma % separating their references. That is, make ``[foo84, bar85]'' rather % than ``[foo84,bar85]'' like LaTeX normally does. This looks nicer and % allows a page break if necessary. \def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi \def\@citea{}\@cite{\@for\@citeb:=#2\do {\@citea\def\@citea{,\hskip.25em\relax}\@ifundefined {b@\@citeb}{{\bf ?}\@warning {Citation `\@citeb' on page \thepage \space undefined}}% \hbox{\csname b@\@citeb\endcsname}}}{#1}} % Make a command that can be used to change the line-spaceing anywhere % within the document. **This forces you into /rm, although it now % keeps your fonts size the same.** \def\linespacing#1{\def\baselinestretch{#1} \let\@tempa\@currsize \let\@currsize\relax \@tempa} % Force footnotes to be single-spaced, regardless of the current setting % of baselinestretch. \long\def\@footnotetext#1{\insert\footins{\def\baselinestretch{1}\footnotesize \interlinepenalty\interfootnotelinepenalty \splittopskip\footnotesep \splitmaxdepth \dp\strutbox \floatingpenalty \@MM \hsize\columnwidth \@parboxrestore \edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}\@makefntext {\rule{\z@}{\footnotesep}\ignorespaces #1\strut}}} % Don't indent the footnote number in the actual footnote. \long\def\@makefntext#1{\parindent 1em\noindent $^{\@thefnmark}$#1} % Put a little space between multiple footnotes on the same page. \advance \footnotesep 3pt % Force figures and tables to be single-spaced, regardless of the current % setting of baselinestretch. \def\@xfloat#1[#2]{\ifhmode \@bsphack\@floatpenalty -\@Mii\else \@floatpenalty-\@Miii\fi\def\@captype{#1}\ifinner \@parmoderr\@floatpenalty\z@ \else\@next\@currbox\@freelist{\@tempcnta\csname ftype@#1\endcsname \multiply\@tempcnta\@xxxii\advance\@tempcnta\sixt@@n \@tfor \@tempa :=#2\do {\if\@tempa h\advance\@tempcnta \@ne\fi \if\@tempa t\advance\@tempcnta \tw@\fi \if\@tempa b\advance\@tempcnta 4\relax\fi \if\@tempa p\advance\@tempcnta 8\relax\fi }\global\count\@currbox\@tempcnta}\@fltovf\fi \global\setbox\@currbox\vbox\bgroup \linespacing{1} \boxmaxdepth\z@ \hsize\columnwidth \@parboxrestore} % Force quotations and quotes to be single-spaced, regardless of the current % setting of baselinestretch. These are actually defined in the document % style files, but their definitions happen to be identical between the % 'article', 'report' and 'book' styles. \def\quotation{\list{}{\listparindent 1.5em \itemindent\listparindent \rightmargin\leftmargin \parsep 0pt plus 1pt}\item \linespacing{1}} \def\quote{\list{}{\rightmargin\leftmargin}\item \linespacing{1}} % Define a more sane pagestyle. Saying \pagestyle{sane} works like % myheadings, except that you can specify both the header and the footer. % Initially, all headers and footers are empty. This also defines commands % \evenheader, \oddheader, \evenfooter, and \oddfooter to redefine these % fields. Also, the commands \header and \footer can be used to change both % even and odd settings. % WARNING: These will soon change to three-part titles as: % \header{left}{center}{right} \def\ps@sane{\let\@mkboth\@gobbletwo \def\sectionmark##1{}\def\subsectionmark##1{}% \def\@oddhead{}\def\@evenhead{}\def\@oddfoot{}\def\@evenfoot{}% \def\oddheader##1{\def\@oddhead{##1}}% \def\evenheader##1{\def\@evenhead{##1}}% \def\oddfooter##1{\def\@oddfoot{##1}}% \def\evenfooter##1{\def\@evenfoot{##1}}% \def\header##1{\def\@oddhead{##1}\def\@evenhead{##1}}% \def\footer##1{\def\@oddfoot{##1}\def\@evenfoot{##1}}} \def\@thebibliographystar#1{ \@ifundefined{bibindent}{ \list{[\arabic{enumi}]}{\settowidth\labelwidth{[#1]} \leftmargin\labelwidth \advance\leftmargin\labelsep \usecounter{enumi}} \def\newblock{\hskip .11em plus .33em minus -.07em} \sloppy \sfcode`\.=1000\relax }{ \list{[\arabic{enumi}]}{\settowidth\labelwidth{[#1]} \leftmargin\labelwidth \advance\leftmargin\labelsep \advance\leftmargin\bibindent \itemindent -\bibindent \listparindent \itemindent \parsep \z@ \usecounter{enumi}} \def\newblock{\par} \sloppy \sfcode`\.=1000\relax }} \expandafter \let\csname thebibliography*\endcsname\@thebibliographystar \def\bibliography{\@ifstar{\@bibliostar}{\@biblio}} \def\@bibliostar#1{\if@filesw\immediate\write\@auxout{\string\bibdata{#1}}\fi \let\save@thebibliography\thebibliography \let\thebibliography\@thebibliographystar\@input{\jobname.bbl}\let \thebibliography\save@thebibliography} \def\@biblio#1{\if@filesw\immediate\write\@auxout{\string\bibdata{#1}}\fi \@input{\jobname.bbl}} % Define new versions of \tableofcontents, \listoffigures, and \listoftables % after saving the old definitions. The new definitions allow a * form of % each which produces only the respective list with no titles or anything. % For each of these, the * form is equivalent to (using \tableofcontents as % an example): % \section*{Contents} % \tableofcontents* % In the 'book' and 'report' document style, the section* above is changed % to a chapter*. Some document styles and page styles also normally put a % \markboth{CONTENTS}{CONTENTS} after the \section*{Contents}. You can % use \hfill's to center the title or \vskip to add a little extra space % here and there, or whatever else you wish. % % The definitions created here are identical to that portion of the % standard definitions which actually create the list (except for the bug % of the missing checks for two-column mode in 'article'). We are careful % here in case any of these aren't even defined by the document style and % substyles in effect. Note that as used here, @restonecol has an % inverted meaning: when true, it means to restore two-column mode, not % one-column mode as the name implies. All in the name (no pun intended) % of saving space, I suppose. \@ifundefined{tableofcontents}{}{\let\save@tableofcontents\tableofcontents \def\tableofcontents{\@ifstar {\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi \@starttoc{toc}\if@restonecol\twocolumn\fi}{\save@tableofcontents}}} \@ifundefined{listoffigures}{}{\let\save@listoffigures\listoffigures \def\listoffigures{\@ifstar {\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi \@starttoc{lof}\if@restonecol\twocolumn\fi}{\save@listoffigures}}} \@ifundefined{listoftables}{}{\let\save@listoftables\listoftables \def\listoftables{\@ifstar {\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi \@starttoc{lot}\if@restonecol\twocolumn\fi}{\save@listoftables}}} % The standard definition of \today produces the date in the format % 'March 16, 1986'. Define a \today* form to produce the form % '16 March 1986', instead. \let\save@today\today \def\today{\@ifstar{\number\day\space \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\year}{\save@today}} % Add more space between figure or table and caption (from 10pt to .4in), % set the figure or table number in small caps (e.g., {\sc Figure 3.2}), % and make captions longer than a single line formatted as an indented, % single-spaced paragraph) rather than as a regular unindented one. % \@makecaption{NUMBER}{TEXT} : Macro to make a figure or table caption. % NUMBER : Figure or table number--e.g., 'Figure 3.2' % TEXT : The caption text. % Macro should be called inside a \parbox of right width, with \normalsize. \long\def\@makecaption#1#2{ \vskip .35in \setbox\@tempboxa\hbox{{\sc #1}: #2} \@tempdima \hsize \advance \@tempdima -.5in \ifdim \wd\@tempboxa >\@tempdima % IF longer than one line: \advance \@tempdima -.5in % THEN set as indented paragraph. \hfil\parbox[t]{\@tempdima} {\linespacing{1}\unhbox\@tempboxa\par}\hfil \else % ELSE center. \hbox to\hsize{\hfil\box\@tempboxa\hfil} \fi} % When the output routine is envoked from the insertion of a float, only try % to place it at the bottom of the page, since the top of the page will end % up being before the reference to the float (assuming the reference is at % the same place as the float insertion). When the output routine is envoked % for other reasons, though, try the top of the page and then the bottom of % the page to place the insertion. This way, a float will appear at the % bottom of the page of insertion, or at the top or bottom of the next page. \def\@addtotoporbot{ \@tempcntb-\outputpenalty\advance\@tempcntb-\@Mii \ifcase\@tempcntb \@addtobot\or % -10002: from horizontal mode \@addtobot\or % -10003: from vertical mode \@addtobot\else % -10004: from either \@tempcnta\count\@currbox \divide\@tempcnta\tw@ \ifodd\@tempcnta \ifnum \@topnum >\z@ \ifdim\@toproom >\ht\@currbox \@bitor\@currtype{\@midlist\@botlist}\if@test\else \global\advance\@topnum\m@ne \global\advance\@colnum\m@ne \@tempdima-\ht\@currbox \advance\@tempdima -\ifx\@toplist\@empty \textfloatsep \else\floatsep\fi \global\advance\@toproom \@tempdima \global\advance\@colroom \@tempdima \@cons\@toplist\@currbox \@inserttrue \fi\fi\fi\fi \if@insert\else\@addtobot \fi\fi} % Allow as much room at the bottom of a page for floats as there is at % the top of the page. The total space taken up by floats is still % limited by (1-\textfraction), so there really should be no difference % between the \topfraction and the \bottomfraction, and it doesn't matter % if these add up to be greater than 1. \edef\bottomfraction{\topfraction} % Make the space above, below, and between floats a little more stretchy. \floatsep 12pt plus 6pt minus 2pt % Space between adjacent floats moved % to top or bottom of text page. \textfloatsep 28pt plus 6pt minus 4pt % Space between main text and floats % at top or bottom of page. \intextsep 12pt plus 6pt minus 2pt % Space between in-text figures and % text. \ifdim \textfloatsep > \@maxsep % The maximum of \floatsep, \@maxsep \textfloatsep \fi % \textfloatsep and \intextsep (minus % the stretch and shrink). \dblfloatsep 12pt plus 8pt minus 2pt % Same as \floatsep for double-column % figures in two-column mode. \dbltextfloatsep 28pt plus 8pt minus 4pt % \textfloatsep for double-column % floats. \ifdim \dbltextfloatsep > \@dblmaxsep % The maximum of \dblfloatsep and \@dblmaxsep \dbltextfloatsep \fi % \dbltexfloatsep. % Make the space around section, subsection, and subsubsection headings a % little more stretchable to help avoid underfull or overfull pages. \def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1.2ex minus -.3ex}{2.3ex plus .3ex}{\Large\bf}} \def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1.2ex minus -.4ex}{1.5ex plus .25ex}{\large\bf}} \def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus -1.2ex minus -.4ex}{1.5ex plus .25ex}{\normalsize\bf}} % Allow for a \afterpage command that is executed after the current page is % shipped out and before the next page is started. After being used, it % is redefined so that it only affects the one page. This is useful for % creating commands that only affect the next page, such as creating a % \nextpagestyle command analogous to the standard \thispagestyle command. \def\@outputpage{\begingroup\catcode`\ =10 \if@specialpage \global\@specialpagefalse\@nameuse{ps@\@specialstyle}\fi \if@twoside \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot \let\@themargin\oddsidemargin \else \let\@thehead\@evenhead \let\@thefoot\@evenfoot \let\@themargin\evensidemargin \fi\fi \shipout \vbox{\normalsize \baselineskip\z@ \lineskip\z@ \vskip \topmargin \moveright\@themargin \vbox{\setbox\@tempboxa \vbox to\headheight{\vfil \hbox to\textwidth{\@thehead}} \dp\@tempboxa\z@ \box\@tempboxa \vskip \headsep \box\@outputbox \baselineskip\footskip \hbox to\textwidth{\@thefoot}}}\global\@colht\textheight \endgroup\stepcounter{page}\let\firstmark\botmark \let\@tempa\afterpage\global\def\afterpage{}\@tempa} \def\afterpage{} % Make \chapter headings look more reasonable. With the sane margins % defined above, the standard chapter heading looks too big and spaced % out. Make it a little more modest. This is done for both \chapter % headings and \chapter* headings. This is careful not to define a new % \@makechapterhead when there isn't an old one there already, such as % in the article documentstyle. \@ifundefined{@makechapterhead}{}{ \def\@makechapterhead#1{ % Heading for \chapter command \vspace*{15pt} % Space at top of text page. { \parindent 0pt \raggedright \ifnum \c@secnumdepth >\m@ne % IF secnumdepth > -1 THEN \huge\bf \@chapapp{} \thechapter % Print 'Chapter' and number. \par \vskip 15pt \fi % Space between number and title. \huge \bf % Title. #1\par \nobreak % TeX penalty to prevent page break. \vskip 30pt % Space between title and text. } } } \@ifundefined{@makeschapterhead}{}{ \def\@makeschapterhead#1{ % Heading for \chapter* command \vspace*{15pt} % Space at top of page. { \parindent 0pt \raggedright \huge \bf % Title. #1\par \nobreak % TeX penalty to prevent page break. \vskip 30pt % Space between title and text. } } } % Rearrange the order that things get put onto a composed page. Normally, % LaTeX puts footnotes above floats at the bottom of the page, for some % reason. This is really wrong, so this changes things so that the bottom % of page floats appear before the footnotes on the page. \def\@makecol{\setbox\@outputbox\box\@cclv \xdef\@freelist{\@freelist\@midlist}\gdef\@midlist{}\@combinefloats \ifvoid\footins\else\setbox\@outputbox\vbox {\unvbox\@outputbox\vskip\skip\footins\footnoterule\unvbox\footins}\fi \setbox\@outputbox\vbox to\@colht{\boxmaxdepth\maxdepth \@texttop\unvbox\@outputbox \@textbottom}\global\maxdepth\@maxdepth}