X-Git-Url: https://git.distorted.org.uk/~mdw/strayman/blobdiff_plain/4ef1fb33eebc6a1caadbc2b38a3989ac5a5ff47c..HEAD:/strayman.dtx

diff --git a/strayman.dtx b/strayman.dtx
index aac12a1..279c5f0 100644
--- a/strayman.dtx
+++ b/strayman.dtx
@@ -35,7 +35,7 @@
 %<+strayman>              [2003/09/04 1.10 Straylight document class]
 % \end{meta-comment}
 %
-% \CheckSum{3022}
+% \CheckSum{3090}
 %% \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,7 +56,7 @@
 % \begin{meta-comment} <driver>
 %
 %<*driver>
-\documentclass[10pt,a4paper,times,cmtt]{strayman}
+\documentclass[10pt,a4paper,book,nohyperref]{strayman}
 \input{mdwtools}
 \usepackage{mdwlist}
 \describesclass{strayman}
@@ -139,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}
 %
 %
@@ -196,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@hyperref\@hyperreftrue
 \newif\if@indentpar
 \newdimen\pagesurround
 \let\headfam\rmfamily
@@ -288,12 +278,16 @@
 \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}
@@ -301,19 +295,34 @@
 % 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}
@@ -766,7 +775,7 @@
 %    \begin{macrocode}
 \marginparpush5\p@
 %    \end{macrocode}
-% 
+%
 % Footnotes need some setting up now.
 %
 %    \begin{macrocode}
@@ -970,7 +979,7 @@
 %
 % \begin{environment}{titlepage}
 %
-% The \env{titlepage} environment typesets its contents on a title page. 
+% The \env{titlepage} environment typesets its contents on a title page.
 % The implementation is fairly straightforward: we just need to do some
 % fiddling with two-column layouts.  We also add in some hacking to make
 % title pages centred properly, a bit like the \env{central} environment.
@@ -1170,7 +1179,6 @@
     \@tempswafalse%
   \fi%
   \hbox{}\vfil%
-  \begin{centrepage}%
   \secdef\@part\@spart%
 }
 %    \end{macrocode}
@@ -1191,6 +1199,7 @@
     \addcontentsline{toc}{part}{#1}%
   \fi%
   \markboth{}{}%
+  \begin{centrepage}%
   \centering%
   \interlinepenalty\@M%
   \reset@font%
@@ -1213,6 +1222,7 @@
 %
 %    \begin{macrocode}
 \def\@spart#1{%
+  \begin{centrepage}%
   \centering%
   \interlinepenalty\@M%
   \reset@font%
@@ -1360,7 +1370,7 @@
 % descenders, although obviously we must lower the rule if the heading really
 % is very deep indeed.
 %
-% 
+%
 % We'll approach this a bit at a time.
 %
 %    \begin{macrocode}
@@ -1621,7 +1631,7 @@
 % And now we can set the paragraph indent.
 %    \begin{macrocode}
 \if@indentpar
-  \parindent\leftmargini
+  \parindent1.2em
 \else
   \parindent\z@
 \fi
@@ -1650,35 +1660,42 @@
 %
 %    \begin{macrocode}
 \def\@listI{%
+  \ifvmode\else\@beginparpenalty\@M\fi%
   \leftmargin\leftmargini%
   \parsep\@parskip%
   \topsep\@parshortfall%
   \itemsep\z@%
 }
 \let\@listi\@listI
-\@listi\topsep\parskip%
+\@listi%
 \def\@listii{%
+  \ifvmode\else\@beginparpenalty\@M\fi%
+  \topsep\z@\@plus\p@%
   \leftmargin\leftmarginii%
   \labelwidth\leftmarginii%
     \advance\labelwidth-\labelsep%
 }
 \def\@listiii{%
+  \ifvmode\else\@beginparpenalty\@M\fi%
   \leftmargin\leftmarginiii%
   \labelwidth\leftmarginiii%
     \advance\labelwidth-\labelsep%
 %  \partopsep\p@\@plus\z@\@minus\p@%
 }
 \def\@listiv{%
+  \ifvmode\else\@beginparpenalty\@M\fi%
   \leftmargin\leftmarginiv%
   \labelwidth\leftmarginiv%
     \advance\labelwidth-\labelsep%
 }
 \def\@listv{%
+  \ifvmode\else\@beginparpenalty\@M\fi%
   \leftmargin\leftmarginv%
   \labelwidth\leftmarginv%
     \advance\labelwidth-\labelsep%
 }
 \def\@listvi{%
+  \ifvmode\else\@beginparpenalty\@M\fi%
   \leftmargin\leftmarginvi%
   \labelwidth\leftmarginvi%
     \advance\labelwidth-\labelsep%
@@ -2215,7 +2232,7 @@
 % \begin{macro}{\@dottedtocline}
 %
 % This is actually a part of the \LaTeX\ kernel, although it's not quite
-% right the way it is.  We've improved the handling of line breaks after the 
+% right the way it is.  We've improved the handling of line breaks after the
 % title.
 %
 %    \begin{macrocode}
@@ -2392,7 +2409,7 @@
 %
 % The |passim| encapsulator is used to typeset the word `\textit{passim}'
 % after a page range.
-% 
+%
 %    \begin{macrocode}
 \def\passim#1{#1 \textit{passim}}       % Passim encapsulator for indices
 %    \end{macrocode}
@@ -2520,7 +2537,7 @@
    \@combinefloats
    \ifvoid\footins \else
      \setbox\@outputbox \vbox {%
-       \boxmaxdepth \@maxdepth                   
+       \boxmaxdepth \@maxdepth
        \unvbox \@outputbox
        \vskip \skip\footins
        \vfil
@@ -2684,6 +2701,7 @@
 \let\headrulewidth\z@
 \headwidth\textwidth
   \advance\headwidth\leftindent
+\fancyhfoffset[LE,LO]{\leftindent}
 \fancypagestyle{headings}{%
   \fancyhf{}
   \fancyhead[LE]{\bfseries\@headertitle}
@@ -2739,7 +2757,7 @@
   \parindent\z@ \parskip\z@
   \everypar{\parskip\parboxparskip\everypar{}}%
   \linewidth\hsize
-  \@totalleftmargin\z@ 
+  \@totalleftmargin\z@
   \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
   \parfillskip\@flushglue \lineskip\normallineskip
   \baselineskip\normalbaselineskip
