chiark / gitweb /
mdwtools.tex: Set a running header without footnote markers.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 5 Sep 2020 14:51:20 +0000 (15:51 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 7 Sep 2020 15:46:47 +0000 (16:46 +0100)
The `strayman' document class, in particular, sets a running header with
the document title by default.  But if the title contains footnote
markers then these end up in every (other) page header, with steadily
incrementing numbers, which is rather bad.

The hack here only supports `strayman'.  Most classes don't have
`strayman''s optional running-header argument for `\title', so I can't
use that.

mdwtools.tex

index 1a0d37e7d49749c0f06e65dbdfbaa089fe2df64c..feca1b6c2cb9a04572fe94a96ade395cc12cb456 100644 (file)
@@ -36,7 +36,7 @@
 %</mdwtools>
 % \end{meta-comment}
 %
-% \CheckSum{709}
+% \CheckSum{743}
 %% \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
 % The first job is to add the previous item to the title string.  If this
 % is the first item, though, I'll just add the appropriate \lit{The } or
 % \lit{ and the } string to the title (this is stored in the |\@prefix|
-% macro).
+% macro).  Also maintain a parallel version which doesn't have the footnotes
+% in: this will be suitable for a running header.
 %
 %    \begin{macrocode}
     \edef\mdw@title{%
       \else,\@prevnote\ \@nextitem%
       \fi%
     }%
+    \edef\mdw@runningtitle{%
+      \mdw@runningtitle%
+      \ifcase\count@\@prefix%
+      \or\@nextitem%
+      \else, \@nextitem%
+      \fi%
+    }%
 %    \end{macrocode}
 %
 % That was rather easy.  Now I'll set up the |\@previtem| and |\@nextitem|
     \else,\@prevnote\ and \@nextitem\@nextnote\space#4%
     \fi%
   }%
+  \edef\mdw@runningtitle{%
+    \mdw@runningtitle%
+    \ifcase\count@%
+    \or\@nextitem\space#3%
+    \or\ and \@nextitem\space#4%
+    \else,\ and \@nextitem\space#4%
+    \fi%
+  }%
 %    \end{macrocode}
 %
 % Finally, if $|\count@| \ne 0$, I must set |\@prefix| to \lit{ and the }.
 %
 %    \begin{macrocode}
   \def\mdw@title{}%
+  \def\mdw@runningtitle{}%
   \def\@prefix{The }%
 %    \end{macrocode}
 %
 % following hacking will do this.
 %
 %    \begin{macrocode}
-  \edef\next{\endgroup\noexpand\title{\noexpand\mdw@titlehack\mdw@title}}%
+  \edef\next{%
+    \endgroup%
+    \noexpand\title{\noexpand\mdw@titlehack\mdw@title}%
+    \def\noexpand\@headertitle{\mdw@runningtitle}%
+  }%
   \next%
 }
 %    \end{macrocode}