From: Mark Wooding Date: Sat, 5 Sep 2020 14:51:20 +0000 (+0100) Subject: mdwtools.tex: Set a running header without footnote markers. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/mdwtools/commitdiff_plain/bc1b2c52955504200818fb858a7e792707a7475a?ds=sidebyside mdwtools.tex: Set a running header without footnote markers. 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. --- diff --git a/mdwtools.tex b/mdwtools.tex index 1a0d37e..feca1b6 100644 --- a/mdwtools.tex +++ b/mdwtools.tex @@ -36,7 +36,7 @@ % % \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 @@ -972,7 +972,8 @@ % 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{% @@ -982,6 +983,13 @@ \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| @@ -1023,6 +1031,14 @@ \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 }. @@ -1064,6 +1080,7 @@ % % \begin{macrocode} \def\mdw@title{}% + \def\mdw@runningtitle{}% \def\@prefix{The }% % \end{macrocode} % @@ -1079,7 +1096,11 @@ % 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}