% \begin{meta-comment}
%
-% $Id: strayman.dtx,v 1.1 2002/02/19 23:27:57 mdw Exp $
+% $Id: strayman.dtx,v 1.4 2003/11/07 11:32:53 mdw Exp $
%
-% Another rewrite of the tabular environment, and maths alignments
-%
-% (c) 1996 Mark Wooding
-%
-%----- Revision history -----------------------------------------------------
-%
-% $Log: strayman.dtx,v $
-% Revision 1.1 2002/02/19 23:27:57 mdw
-% Initial revision.
-%
-% Revision 1.8 1996/12/09 23:20:42 mdw
-% (\tab@setstrut): Fixed so that it uses \dimen\tw@ for the strut depth,
-% as advertised.
-%
-% Revision 1.7 1996/11/29 21:59:16 mdw
-% Fixed a little formatting mistake in a syntax diagram, and switched over
-% to the new syntax diagram commands on the grounds that they're slightly
-% less messy. Maybe.
-%
-% Revision 1.6 1996/11/19 20:54:33 mdw
-% Entered into RCS
+% Document class for Straylight manuals
%
+% (c) 1996 Straylight
%
% \end{meta-comment}
%
% \begin{meta-comment} <general public licence>
%%
-%% mdwtab package -- another rewrite of the tabular environment, etc.
-%% Copyright (c) 1996 Mark Wooding
+%% strayman -- a LaTeX document class for Straylight manuals
+%% Copyright (c) 1996 Straylight
%%
%% This program is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
% \begin{meta-comment} <Package preamble>
%<+strayman>\NeedsTeXFormat{LaTeX2e}
%<+strayman>\ProvidesClass{strayman}
-%<+strayman> [1996/03/26 1.05 Straylight document class]
+%<+strayman> [2003/09/04 1.10 Straylight document class]
% \end{meta-comment}
%
-% \CheckSum{2919}
+% \CheckSum{3057}
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
% \begin{meta-comment} <driver>
%
%<*driver>
-\documentclass[10pt,a4paper,times,cmtt]{strayman}
+\documentclass[10pt,a4paper,book,nohyperref]{strayman}
\input{mdwtools}
\usepackage{mdwlist}
\describesclass{strayman}
+\errorcontextlines\maxdimen
\title[The \strayman\ document class]
{The \strayman\footnote{The \strayman\ document class is currently %
at version \mdwfileinfo{strayman.cls}{version}, dated %
%
% The standard \LaTeX\ document classes are all very well for simple
% documents, but the style isn't appropriate for works like manuals.
-% The \strayman\ document class is an attempt to recitfy this situataion,
+% The \strayman\ document class is an attempt to rectify this situation,
% providing an attractive and distinctive style for Straylight documents.
% The layout is based on an earlier style built for \emph{Impression}
% documents, although many improvements have been made. This document
% \item [\texttt{square} \| \texttt{rounded}] These options are passed
% directly to the \package{syntax} package, when it's loaded.
%
-% \item [\texttt{helvetica}] Typeset headings in the Helvetica font,
-% not in Computer Modern.
-%
-% \item [\texttt{palatino}] Typeset the main body text in Palatino, and
-% headings in Helvetica. The |\tt| font is changed to Courier, but
-% see the \texttt{cmtt} option.
-%
-% \item [\texttt{times}] Typeset the main body text in Times, and headings
-% in Helvetica. The |\tt| font is changed to Courier, but see the
-% \texttt{cmtt} option.
-%
% \end{description}
%
%
%<*strayman>
\newcommand\@ptsize{}
\newif\if@restonecol\@restonecolfalse
-\newif\if@titlepage\@titlepagetrue
+\newif\if@titlepage\@titlepagefalse
\newif\if@openright\@openrighttrue
\newif\if@openbib\@openbibfalse
\newif\if@appendix\@appendixfalse
-\newif\if@article\@articlefalse
+\newif\if@article\@articletrue
\newif\if@offsetpages\@offsetpagestrue
-\newif\if@numbering\@numberingfalse
-\newif\if@herefloats\@herefloatstrue
-\newif\if@runinsubsubsec\@runinsubsubsecfalse
+\newif\if@numbering\@numberingtrue
+\newif\if@herefloats\@herefloatsfalse
+\newif\if@runinsubsubsec\@runinsubsubsectrue
+\newif\if@hyperref\@hyperreftrue
+\newif\if@indentpar
\newdimen\pagesurround
\let\headfam\rmfamily
\let\pad@margin\@empty
\DeclareOption{fleqn}{\input{fleqn.clo}}
\DeclareOption{openbib}{\@openbibtrue}
\DeclareOption{article}{\@articletrue}
+\DeclareOption{noarticle}{\@articlefalse}
\DeclareOption{numbering}{\@numberingtrue}
\DeclareOption{nonumbering}{\@numberingfalse}
\DeclareOption{runinsubsubsec}{\@runinsubsubsectrue}
\DeclareOption{noruninsubsubsec}{\@runinsubsubsecfalse}
+\DeclareOption{indentpar}{\@indentpartrue}
+\DeclareOption{noindentpar}{\@indentparfalse}
+\DeclareOption{book}{\@titlepagetrue\@articlefalse}
+\DeclareOption{hyperref}{\@hyperreftrue}
+\DeclareOption{nohyperref}{\@hyperreffalse}
% \end{macrocode}
%
% \subsection{Set up the options}
% We set up some default options, and then read the user's.
%
% \begin{macrocode}
-\ExecuteOptions{a5paper,8pt,twoside,onecolumn,final,openright}
+\ExecuteOptions{a4paper,10pt,twoside,onecolumn,final}
\ProcessOptions
% \end{macrocode}
%
% If this is PDF\TeX\ then tell it the page bounds.
%
% \begin{macrocode}
-\@ifundefined{pdfpageheight}{
- \relax
-}{
+\newif\ifpdfing\pdfingfalse
+\if1\ifx\pdfoutput\@@undefined@@0\else\the\pdfoutput\fi
+ \pdfingtrue
+\fi
+\ifpdfing
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth
-}
+\fi
+\if@hyperref
+ \AtEndOfClass{%
+ \RequirePackage[%
+ bookmarks = true, bookmarksnumbered = true, bookmarksdepth = 3,
+ colorlinks = true, linkcolor = blue, citecolor = blue, urlcolor = blue,
+ breaklinks = true]{hyperref}
+ }
+ \ifpdfing
+ \PassOptionsToPackage{pdftex}{hyperref}
+ \else
+ \PassOptionsToPackage{dvips}{hyperref}
+ \fi
+\fi
% \end{macrocode}
%
% \subsection{Read in the text size option}
% gap when we change font size. This macro does the job.
%
% \begin{macrocode}
+\newskip\@parskip
+\newdimen\@parshortfall
\def\@setparskip{%
- \relax\ifdim\parskip=\z@\else%
- \parskip.67\baselineskip\@plus\p@\relax%
- \fi%
+ \@parskip.67\baselineskip\@plus\p@\relax%
+ \ifdim\parskip=\z@\else\parskip\@parskip\relax\fi%
+ \@parshortfall\@parskip\advance\@parshortfall-\parskip%
}
+\def\set@vsep#1{#1\@parshortfall\advance#1}
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
\renewcommand\normalsize{%
%<*8pt>
- \@setfontsize\normalsize\@viiipt\@xpt%
+ \@setfontsize\normalsize\@viiipt{9.6\p@}%
\abovedisplayskip8\p@\@plus2\p@\@minus4\p@%
- \abovedisplayshortskip\z@\@plus3\p@%
- \belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
+ \set@vsep\abovedisplayshortskip\z@\@plus3\p@%
+ \set@vsep\belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
%</8pt>
%<*9pt>
\@setfontsize\normalsize\@ixpt\@xipt%
\abovedisplayskip9\p@\@plus2\p@\@minus5\p@%
- \abovedisplayshortskip\z@\@plus3\p@%
- \belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
+ \set@vsep\abovedisplayshortskip\z@\@plus3\p@%
+ \set@vsep\belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
%</9pt>
%<*10pt>
\@setfontsize\normalsize\@xpt\@xiipt%
\abovedisplayskip10\p@\@plus2\p@\@minus5\p@%
- \abovedisplayshortskip\z@\@plus3\p@%
- \belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
+ \set@vsep\abovedisplayshortskip\z@\@plus3\p@%
+ \set@vsep\belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
%</10pt>
%<*11pt>
\@setfontsize\normalsize\@xipt{13.6}%
\abovedisplayskip11\p@\@plus3\p@\@minus6\p@%
- \abovedisplayshortskip\z@\@plus3\p@%
- \belowdisplayshortskip6.5\p@ \@plus3.5\p@\@minus3\p@%
+ \set@vsep\abovedisplayshortskip\z@\@plus3\p@%
+ \set@vsep\belowdisplayshortskip6.5\p@ \@plus3.5\p@\@minus3\p@%
%</11pt>
%<*12pt>
\@setfontsize\normalsize\@xiipt{14.5}%
\abovedisplayskip12\p@\@plus3\p@\@minus7\p@%
- \abovedisplayshortskip\z@\@plus3\p@%
- \belowdisplayshortskip6.5\p@ \@plus3.5\p@\@minus3\p@%
+ \set@vsep\abovedisplayshortskip\z@\@plus3\p@%
+ \set@vsep\belowdisplayshortskip6.5\p@ \@plus3.5\p@\@minus3\p@%
%</12pt>
%<*text>
\@setfontsize\normalsize\@xpt\@xiipt%
\abovedisplayskip10\p@\@plus2\p@\@minus5\p@%
- \abovedisplayshortskip\z@\@plus3\p@%
- \belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
+ \set@vsep\abovedisplayshortskip\z@\@plus3\p@%
+ \set@vsep\belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
%</text>
\belowdisplayskip\abovedisplayskip%
\let\@listi\@listI%
\@setparskip%
}
\normalsize
-\parskip2ex\@plus\p@
+\if@indentpar
+ \parskip0pt\@plus\p@
+\else
+ \parskip2ex\@plus\p@
+\fi
% \end{macrocode}
% \end{macro}
%
%<*8pt>
\@setfontsize\small\@viipt{8.4}%
\abovedisplayskip8\p@\@plus2\p@\@minus4\p@%
- \abovedisplayshortskip\z@\@plus2\p@%
- \belowdisplayshortskip4\p@\@plus2\p@\@minus2\p@%
+ \set@vsep\abovedisplayshortskip\z@\@plus2\p@%
+ \set@vsep\belowdisplayshortskip4\p@\@plus2\p@\@minus2\p@%
%</8pt>
%<*9pt>
\@setfontsize\small\@viiipt{9.5}%
\abovedisplayskip8\p@\@plus2\p@\@minus4\p@%
- \abovedisplayshortskip\z@\@plus2\p@%
- \belowdisplayshortskip4\p@\@plus2\p@\@minus2\p@%
+ \set@vsep\abovedisplayshortskip\z@\@plus2\p@%
+ \set@vsep\belowdisplayshortskip4\p@\@plus2\p@\@minus2\p@%
%</9pt>
%<*10pt>
\@setfontsize\small\@ixpt{11}%
\abovedisplayskip8.5\p@\@plus3\p@\@minus4\p@%
- \abovedisplayshortskip\z@\@plus2\p@%
- \belowdisplayshortskip4\p@\@plus2\p@\@minus2\p@%
+ \set@vsep\abovedisplayshortskip\z@\@plus2\p@%
+ \set@vsep\belowdisplayshortskip4\p@\@plus2\p@\@minus2\p@%
%</10pt>
%<*11pt>
\@setfontsize\small\@xpt\@xiipt%
\abovedisplayskip10\p@\@plus2\p@\@minus5\p@%
- \abovedisplayshortskip\z@\@plus3\p@%
- \belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
+ \set@vsep\abovedisplayshortskip\z@\@plus3\p@%
+ \set@vsep\belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
%</11pt>
%<*12pt>
\@setfontsize\small\@xipt{13.6}%
\abovedisplayskip11\p@\@plus3\p@\@minus6\p@%
- \abovedisplayshortskip\z@ \@plus3\p@%
- \belowdisplayshortskip6.5\p@ \@plus3.5\p@\@minus3\p@%
+ \set@vsep\abovedisplayshortskip\z@ \@plus3\p@%
+ \set@vsep\belowdisplayshortskip6.5\p@ \@plus3.5\p@\@minus3\p@%
%</12pt>
\def\@listi{%
\leftmargin\leftmargini%
- \topsep\z@%
- \parsep\parskip%
+ \topsep\@parshortfall%
+ \parsep\@parskip%
\itemsep\z@%
}%
\belowdisplayskip\abovedisplayskip%
\newcommand\footnotesize{%
%<*8pt>
\@setfontsize\footnotesize\@vipt\@viipt%
- \abovedisplayskip6\p@\@plus2\p@\@minus4\p@%
- \abovedisplayshortskip\z@\@plus\p@%
- \belowdisplayshortskip3\p@\@plus\p@\@minus2\p@%
+ \set@vsep\abovedisplayskip6\p@\@plus2\p@\@minus4\p@%
+ \set@vsep\abovedisplayshortskip\z@\@plus\p@%
+ \set@vsep\belowdisplayshortskip3\p@\@plus\p@\@minus2\p@%
%</8pt>
%<*9pt>
\@setfontsize\footnotesize\@viipt{8.4}%
- \abovedisplayskip6\p@\@plus2\p@\@minus4\p@%
- \abovedisplayshortskip\z@\@plus\p@%
- \belowdisplayshortskip3\p@\@plus\p@\@minus2\p@%
+ \set@vsep\abovedisplayskip6\p@\@plus2\p@\@minus4\p@%
+ \set@vsep\abovedisplayshortskip\z@\@plus\p@%
+ \set@vsep\belowdisplayshortskip3\p@\@plus\p@\@minus2\p@%
%</9pt>
%<*10pt>
\@setfontsize\footnotesize\@viiipt{9.5}%
- \abovedisplayskip6\p@\@plus2\p@\@minus4\p@%
- \abovedisplayshortskip\z@\@plus\p@%
- \belowdisplayshortskip3\p@\@plus\p@\@minus2\p@%
+ \set@vsep\abovedisplayskip6\p@\@plus2\p@\@minus4\p@%
+ \set@vsep\abovedisplayshortskip\z@\@plus\p@%
+ \set@vsep\belowdisplayshortskip3\p@\@plus\p@\@minus2\p@%
%</10pt>
%<*11pt>
\@setfontsize\footnotesize\@ixpt{11}%
- \abovedisplayskip8\p@\@plus2\p@\@minus4\p@%
- \abovedisplayshortskip\z@\@plus\p@%
- \belowdisplayshortskip4\p@\@plus2\p@\@minus2\p@%
+ \set@vsep\abovedisplayskip8\p@\@plus2\p@\@minus4\p@%
+ \set@vsep\abovedisplayshortskip\z@\@plus\p@%
+ \set@vsep\belowdisplayshortskip4\p@\@plus2\p@\@minus2\p@%
%</11pt>
%<*12pt>
\@setfontsize\footnotesize\@xpt\@xiipt
- \abovedisplayskip10\p@\@plus2\p@\@minus5\p@%
- \abovedisplayshortskip\z@\@plus3\p@%
- \belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
+ \set@vsep\abovedisplayskip10\p@\@plus2\p@\@minus5\p@%
+ \set@vsep\abovedisplayshortskip\z@\@plus3\p@%
+ \set@vsep\belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
%</12pt>
\def\@listi{%
\leftmargin\leftmargini%
- \topsep\z@%
- \parsep\parskip%
+ \topsep\@parshortfall%
+ \parsep\@parskip%
\itemsep\z@%
}%
\belowdisplayskip\abovedisplayskip%
\newcommand\LARGE{\@setfontsize\LARGE\@xiipt\@xivpt\@setparskip}
\newcommand\huge{\@setfontsize\huge\@xviipt{20}\@setparskip}
\newcommand\Huge{\@setfontsize\Huge\@xxpt{26}\@setparskip}
-\newcommand\listingsize{\@setfontsize\listingsize\@viipt\@viiipt\@setparskip}
%</8pt>
%<*9pt>
\newcommand\scriptsize{\@setfontsize\scriptsize\@vipt\@viipt\@setparskip}
\newcommand\LARGE{\@setfontsize\LARGE\@xivpt{17}\@setparskip}
\newcommand\huge{\@setfontsize\huge\@xviipt{20}\@setparskip}
\newcommand\Huge{\@setfontsize\Huge\@xxpt{26}\@setparskip}
-\newcommand\listingsize{\@setfontsize\listingsize\@viipt\@viiipt\@setparskip}
%</9pt>
%<*10pt>
\newcommand\scriptsize{\@setfontsize\scriptsize\@viipt\@viiipt\@setparskip}
\newcommand\LARGE{\@setfontsize\LARGE\@xviipt{22}\@setparskip}
\newcommand\huge{\@setfontsize\huge\@xxpt{25}\@setparskip}
\newcommand\Huge{\@setfontsize\Huge\@xxvpt{30}\@setparskip}
-\newcommand\listingsize{\@setfontsize\listingsize\@viipt\@viiipt\@setparskip}
%</10pt>
%<*11pt>
\newcommand\scriptsize{\@setfontsize\scriptsize\@viiipt{9.5}\@setparskip}
\newcommand\LARGE{\@setfontsize\LARGE\@xviipt{22}\@setparskip}
\newcommand\huge{\@setfontsize\huge\@xxpt{25}\@setparskip}
\newcommand\Huge{\@setfontsize\Huge\@xxvpt{30}\@setparskip}
-\newcommand\listingsize{\@setfontsize\listingsize\@viiipt{9.5}\@setparskip}
%</11pt>
%<*12pt>
\newcommand\scriptsize{\@setfontsize\scriptsize\@viiipt{9.5}\@setparskip}
\newcommand\LARGE{\@setfontsize\LARGE\@xxpt{25}\@setparskip}
\newcommand\huge{\@setfontsize\huge\@xxvpt{30}\@setparskip}
\let\Huge\huge
-\newcommand\listingsize{\@setfontsize\listingsize\@viiipt{9.5}\@setparskip}
%</12pt>
+%<+8pt|9pt|10pt|11pt|12pt>\let\listingsize\footnotesize
%<*text>
\def\scriptsize{\@setfontsize\scriptsize\@xpt\@xiipt\@setparskip}
\let\tiny\scriptsize
\renewcommand\baselinestretch{}
% \end{macrocode}
%
-% We don't indent paragraphs at all; instead, we separate them with blank
-% lines. The vertical gap is worked out in the size command; we just clear
-% |\parindent|.
-%
-% \begin{macrocode}
-\parindent\z@
-% \end{macrocode}
+% Paragraph indentation is set up later.
%
% Set up some standard penalty values.
%
\def\@evenhead{\thepage\hfil\slshape\leftmark}%
\def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
\let\@mkboth\markboth
-\def\chaptermark##1{\markboth {##1}{}}%
-\def\sectionmark##1{\markright {##1}}%
+\def\chaptermark##1{\markboth {\thechapter. ##1}{}}%
+\def\sectionmark##1{\markright {\thesection. ##1}}%
}
%
\def\ps@myheadings{%
% introduced.
%
% \begin{macrocode}
-\newcommand\section{%
- \@startsection%
+\def\@defsection#1#2#3#4#5#6{%
+ \expandafter\newcommand\csname#1\endcsname{%
+ \skip@#4\advance\skip@\ifdim\skip@<\z@-\fi\@parshortfall%
+ \skip\tw@#5\relax\ifdim\skip\tw@>\z@\advance\skip\tw@\@parshortfall\fi%
+ \@startsection%
+ {#1}%
+ {#2}%
+ {#3}%
+ \skip@
+ {\skip\tw@}%
+ {\reset@font#6\bfseries\headfam}%
+ }%
+}
+\@defsection
{section}% % Section name (for contents)
{1}% % Level number (for numbering)
{-.5\sectindent}% % Indentation of title
{-1.5ex\@plus-1ex\@minus-.2ex}% % Space after title (vert/horiz)
{.3ex\@plus.2ex}% % Space before title
{\reset@font\Large\bfseries\headfam}% How to typeset the title
-}
-\newcommand\subsection{%
- \@startsection%
+\@defsection
{subsection}%
{2}%
{-.25\sectindent}%
{-1.25ex\@plus-1ex\@minus-.2ex}%
{\p@\@plus.2ex}%
{\reset@font\large\bfseries\headfam}%
-}
\if@runinsubsubsec
-\newcommand\subsubsection{%
- \@startsection%
+\@defsection
{subsubsection}%
{3}%
{\z@}%
{0pt\@plus1ex\@minus.2ex}%
{-1em}%
{\reset@font\normalsize\bfseries\headfam}%
-}
-\newcommand\paragraph{%
- \@startsection%
+\@defsection
{paragraph}%
{4}%
{\z@}%
{0pt\@plus.5ex\@minus.1ex}%
{-1em}%
{\reset@font\normalsize\bfseries\headfam}%
-}
-\newcommand\subparagraph{%
- \@startsection%
+\@defsection
{subparagraph}%
{5}%
{\parindent}%
{0pt\@plus.5ex\@minus.1ex}%
{-1em}%
{\reset@font\normalsize\bfseries\headfam}%
-}
\else
-\newcommand\subsubsection{%
- \@startsection%
+\@defsection
{subsubsection}%
{3}%
{\z@}%
{-1.25ex\@plus-1ex\@minus-.2ex}%
{\p@\@plus.2ex}%
{\reset@font\normalsize\bfseries\headfam}%
-}
-\newcommand\paragraph{%
- \@startsection%
+\@defsection
{paragraph}%
{4}%
{\z@}%
{0pt\@plus1ex\@minus.2ex}%
{-1em}%
{\reset@font\normalsize\bfseries\headfam}%
-}
-\newcommand\subparagraph{%
- \@startsection%
+\@defsection
{subparagraph}%
{5}%
{\parindent}%
{0pt\@plus.5ex\@minus.1ex}%
{-1em}%
{\reset@font\normalsize\bfseries\headfam}%
-}
\fi
% \end{macrocode}
%
%
% \begin{macrocode}
\if@article
- \def\@topsect{\section*}
+ \def\@topsect@star{\section*}
+ \let\@topsect\section
\else
+ \let\@topsect@star\chapter
\let\@topsect\chapter
\fi
% \end{macrocode}
\leftmarginvi1em
\fi
% \end{macrocode}
+% And now we can set the paragraph indent.
+% \begin{macrocode}
+\if@indentpar
+ \parindent1.2em
+\else
+ \parindent\z@
+\fi
+% \end{macrocode}
%
% Other spacing defaults:
%
% \begin{macrocode}
\def\@listI{%
\leftmargin\leftmargini%
- \parsep\parskip%
- \topsep\z@%
+ \parsep\@parskip%
+ \topsep\@parshortfall%
\itemsep\z@%
}
\let\@listi\@listI
-\@listi\topsep\parskip%
+\@listi%
\def\@listii{%
+ \topsep\z@\@plus\p@%
\leftmargin\leftmarginii%
\labelwidth\leftmarginii%
\advance\labelwidth-\labelsep%
\leftmargin\leftmarginiii%
\labelwidth\leftmarginiii%
\advance\labelwidth-\labelsep%
- \partopsep\p@\@plus\z@\@minus\p@%
+% \partopsep\p@\@plus\z@\@minus\p@%
}
\def\@listiv{%
\leftmargin\leftmarginiv%
}
% \end{macrocode}
%
+% \subsection{Numbering things}
+%
+% \begin{macro}{\numberwithin}
+%
+% Does the obvious thing. Optional argument gives numbering style.
+%
+% \begin{macrocode}
+\def\numberwithin{\@testopt\nw@i\arabic}
+\def\nw@i[#1]#2#3{%
+ \@addtoreset{#2}{#3}%
+ \expandafter\xdef\csname the#2\endcsname{%
+ \expandafter\noexpand\csname the#3\endcsname.%
+ \noexpand#1{#2}}%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\removefromreset}
+%
+% Does the obvious thing.
+%
+% \begin{macrocode}
+\def\removefromreset#1#2{%
+ \begingroup%
+ \def\@tempa{#1}%
+ \toks@{}%
+ \def\@elt##1{%
+ \def\@tempb{##1}%
+ \ifx\@tempa\@tempb%
+ \else\toks@\expandafter{\the\toks@\@elt{##1}}%
+ \fi%
+ }
+ \csname cl@#2\endcsname%
+ \expandafter\xdef\csname cl@#2\endcsname{\the\toks@}%
+ \endgroup%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
% \subsection{Enumerated lists}
%
% We busily redefine all the counters for enumerated lists, and how to
\abovecaptionskip10\p@
\belowcaptionskip0\p@
%
+\long\def\captionstyle#1#2{\itshape #1: #2}
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip%
- \sbox\@tempboxa{#1: #2}%
+ \sbox\@tempboxa{\captionstyle{#1}{#2}}%
\ifdim\wd\@tempboxa>\hsize%
- #1: #2\par%
+ \unhbox\@tempboxa\par%
\else%
- \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \hb@xt@\hsize{\hfil\unhbox\@tempboxa\hfil}%
\fi%
\vskip\belowcaptionskip%
}
% file, and then restore the old layout.
%
% \begin{macrocode}
-\newcommand\tableofcontents{%
- \if@twocolumn%
- \@restonecoltrue%
- \onecolumn%
- \else%
- \@restonecolfalse%
- \fi%
- \@topsect\contentsname%
- {\parskip\z@\@starttoc{toc}}%
- \if@restonecol%
- \twocolumn%
- \fi%
+\def\@tocthing#1#2{%
+ \@ifnextchar[{\@tocthing@i{#1}{#2}}{\@tocthing@i{#1}{#2}[\relax][\relax]}%
+}
+\def\@tocthing@i#1#2[#3][#4]{%
+ \if@twocolumn\@restonecoltrue\onecolumn\else\@restonecolfalse\fi%
+ \@topsect@star{#1}#3{\parskip\z@\@starttoc{#2}}#4%
+ \if@restonecol\twocolumn\fi%
}
+\newcommand\tableofcontents{\@tocthing\contentsname{toc}}
% \end{macrocode}
% \end{macro}
%
% These macros are terribly similar to the other ones.
%
% \begin{macrocode}
-\newcommand\listoffigures{%
- \if@twocolumn%
- \@restonecoltrue\onecolumn%
- \else%
- \@restonecolfalse%
- \fi%
- \@topsect\listfigurename%
- {\parskip\z@ \@starttoc{lof}}%
- \if@restonecol\twocolumn\fi%
-}
-%
-\newcommand\l@figure{\@dottedtocline{1}{1.5em}{2.5em}}
-%
-\newcommand\listoftables{%
- \if@twocolumn%
- \@restonecoltrue\onecolumn%
- \else%
- \@restonecolfalse%
- \fi%
- \@topsect\listtablename%
- {\parksip\z@ \@starttoc{lot}}%
- \if@restonecol\twocolumn\fi%
-}
-%
+\newcommand\listoffigures{\@tocthing\listfigurename{lof}}
+\newcommand\l@figure{\@dottedtocline{0}{0pt}{2em}}
+\newcommand\listoftables{\@tocthing\listtablename{lot}}
\let\l@table\l@figure
% \end{macrocode}
%
%
% \begin{macrocode}
\newcommand\contentsname{Contents}
-\newcommand\listfigurename{List of Figures}
-\newcommand\listtablename{List of Tables}
+\newcommand\listfigurename{List of figures}
+\newcommand\listtablename{List of tables}
\if@article\newcommand\bibname{References}
\else\newcommand\bibname{Bibliography}\fi
\newcommand\indexname{Index}