X-Git-Url: https://git.distorted.org.uk/~mdw/strayman/blobdiff_plain/9518b8956321c48a4ee0223d15a3a932cd0d7943..b8d14be93379e4a61ccb6d06a7c30a39dfe44481:/strayman.dtx

diff --git a/strayman.dtx b/strayman.dtx
index 3c41f04..d1327ba 100644
--- a/strayman.dtx
+++ b/strayman.dtx
@@ -35,7 +35,7 @@
 %<+strayman>              [2003/09/04 1.10 Straylight document class]
 % \end{meta-comment}
 %
-% \CheckSum{2934}
+% \CheckSum{3040}
 %% \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
@@ -56,10 +56,11 @@
 % \begin{meta-comment} <driver>
 %
 %<*driver>
-\documentclass[10pt,a4paper,times,cmtt]{strayman}
+\documentclass[10pt,a4paper,book]{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 %
@@ -75,7 +76,7 @@
 %
 % 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
@@ -138,17 +139,6 @@
 % \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}
 %
 %
@@ -195,15 +185,16 @@
 %<*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@indentpar
 \newdimen\pagesurround
 \let\headfam\rmfamily
 \let\pad@margin\@empty
@@ -286,10 +277,14 @@
 \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}
 %    \end{macrocode}
 %
 % \subsection{Set up the options}
@@ -297,19 +292,26 @@
 % 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
-}
+  \AtEndOfClass{%
+    \RequirePackage[%
+      pdftex, bookmarks = true, bookmarksnumbered = true, bookmarksdepth = 3,
+      colorlinks = true, linkcolor = blue, breaklinks = true]{hyperref}
+  }
+\fi
 %    \end{macrocode}
 %
 % \subsection{Read in the text size option}
@@ -361,11 +363,14 @@
 % 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}
 %
@@ -378,45 +383,49 @@
 %<*8pt>
   \@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}
 %
@@ -433,37 +442,37 @@
 %<*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%
@@ -484,38 +493,38 @@
 \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%
@@ -616,13 +625,7 @@
 \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.
 %
@@ -839,8 +842,8 @@
 \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{%
@@ -1477,80 +1480,77 @@
 % 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}
 %
@@ -1616,6 +1616,14 @@
   \leftmarginvi1em
 \fi
 %    \end{macrocode}
+% And now we can set the paragraph indent.
+%    \begin{macrocode}
+\if@indentpar
+  \parindent\leftmargini
+\else
+  \parindent\z@
+\fi
+%    \end{macrocode}
 %
 % Other spacing defaults:
 %
@@ -1641,12 +1649,12 @@
 %    \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{%
   \leftmargin\leftmarginii%
   \labelwidth\leftmarginii%
