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

diff --git a/strayman.dtx b/strayman.dtx
index 3c41f04..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{2934}
+% \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,10 +56,11 @@
 % \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 %
@@ -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,17 @@
 %<*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
@@ -286,10 +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}
@@ -297,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}
@@ -361,11 +374,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 +394,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 +453,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 +504,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 +636,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.
 %
@@ -761,7 +775,7 @@
 %    \begin{macrocode}
 \marginparpush5\p@
 %    \end{macrocode}
-% 
+%
 % Footnotes need some setting up now.
 %
 %    \begin{macrocode}
@@ -839,8 +853,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{%
@@ -965,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.
@@ -1165,7 +1179,6 @@
     \@tempswafalse%
   \fi%
   \hbox{}\vfil%
-  \begin{centrepage}%
   \secdef\@part\@spart%
 }
 %    \end{macrocode}
@@ -1186,6 +1199,7 @@
     \addcontentsline{toc}{part}{#1}%
   \fi%
   \markboth{}{}%
+  \begin{centrepage}%
   \centering%
   \interlinepenalty\@M%
   \reset@font%
@@ -1208,6 +1222,7 @@
 %
 %    \begin{macrocode}
 \def\@spart#1{%
+  \begin{centrepage}%
   \centering%
   \interlinepenalty\@M%
   \reset@font%
@@ -1355,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}
@@ -1477,80 +1492,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 +1628,14 @@
   \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:
 %
@@ -1640,35 +1660,42 @@
 %
 %    \begin{macrocode}
 \def\@listI{%
+  \ifvmode\else\@beginparpenalty\@M\fi%
   \leftmargin\leftmargini%
-  \parsep\parskip%
-  \topsep\z@%
+  \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%
@@ -2205,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}
@@ -2382,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}
@@ -2510,7 +2537,7 @@
    \@combinefloats
    \ifvoid\footins \else
      \setbox\@outputbox \vbox {%
-       \boxmaxdepth \@maxdepth                   
+       \boxmaxdepth \@maxdepth
        \unvbox \@outputbox
        \vskip \skip\footins
        \vfil
@@ -2674,6 +2701,7 @@
 \let\headrulewidth\z@
 \headwidth\textwidth
   \advance\headwidth\leftindent
+\fancyhfoffset[LE,LO]{\leftindent}
 \fancypagestyle{headings}{%
   \fancyhf{}
   \fancyhead[LE]{\bfseries\@headertitle}
@@ -2729,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
