mdwtools.tex: Set footnote markers to the right of punctuation in the title.
[mdwtools] / mdwtools.tex
index 38287a9..391ae90 100644 (file)
@@ -36,7 +36,7 @@
 %</mdwtools>
 % \end{meta-comment}
 %
-% \CheckSum{672}
+% \CheckSum{691}
 %% \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
 % everything works.  It will automatically read in the licence text (from
 % |gpl.tex|, and wraps some other things up.
 %
-% 
+%
 % \subsection{Other commands}
 %
 % The |mdwtools.tex| file includes the \package{syntax} and \package{sverb}
 % names and environment names (both in the sans serif font, for now).
 %
 %    \begin{macrocode}
-\tlet\package\textsf
-\tlet\env\textsf
+\tdef\package{\textsf}
+\tdef\env{\textsf}
 %    \end{macrocode}
 %
 % I'll define the |\<|\dots|>| shortcut for syntax items suggested in the
 %
 % Now to get to work.  I need to keep one `lookahead' list item, and a count
 % of the number of items read so far.  I'll keep the lookahead item in
-% |\@nextitem| and the counter in |\count@|.
+% |\@nextitem| and the counter in |\count@|.  Things are even worse because
+% the footnote symbols should appear \emph{after} the separating punctuation,
+% so we need to delay those by another cycle, hence we have |\@nextnote| and
+% |\@prevnote|.
 %
 %    \begin{macrocode}
   \count@\z@%
       \mdw@title%
       \ifcase\count@\@prefix%
       \or\@nextitem%
-      \else, \@nextitem%
+      \else,\@prevnote\ \@nextitem%
       \fi%
     }%
 %    \end{macrocode}
 %
-% That was rather easy.  Now I'll set up the |\@nextitem| macro for the
-% next time around the loop.
+% That was rather easy.  Now I'll set up the |\@previtem| and |\@nextitem|
+% macros for the next time around the loop.
 %
 %    \begin{macrocode}
-    \edef\@nextitem{%
-      \protect#2{##1}%
+    \edef\@nextitem{\protect#2{##1}}%
+    \let\@prevnote\@nextnote
+    \edef\@nextnote{%
       \protect\footnote{%
         The \protect#2{##1} #3 is currently at version %
         \mdwfileinfo{##1}{version}, dated \mdwfileinfo{##1}{date}.%
-      }\space%
+      }%
     }%
 %    \end{macrocode}
 %
   \edef\mdw@title{%
     \mdw@title%
     \ifcase\count@%
-    \or\@nextitem\space#3%
-    \or\ and \@nextitem\space#4%
-    \else,\ and \@nextitem\space#4%
+    \or\@nextitem\@nextnote\space#3%
+    \or\@prevnote\ and \@nextitem\@nextnote\space#4%
+    \else,\@prevnote\ and \@nextitem\@nextnote\space#4%
     \fi%
   }%
 %    \end{macrocode}
 % following hacking will do this.
 %
 %    \begin{macrocode}
-  \edef\next{\endgroup\noexpand\title{\mdw@title}}%
+  \edef\next{\endgroup\noexpand\title{\noexpand\mdw@titlehack\mdw@title}}%
   \next%
 }
 %    \end{macrocode}
 %
 % \end{macro}
 %
+% \begin{macro}{\mdw@titlehack}
+%
+% Wait!  Did you notice that |\mdw@titlehack|?  What's that about?
+%
+% It turns out that the default document classes hack the footnote insertion
+% commands to make footnote symbols take up no horizontal space in the title.
+% Apparently this makes author names look as if they're centred properly when
+% there are affiliation footnotes.  Anyway, \package{doc} perpetuates this
+% silliness, but it makes a mess of the version markers I insert, so I must
+% deploy countermeasures.
+%
+%    \begin{macrocode}
+\def\mdw@titlehack{\def\@makefnmark{$\m@th^{\@thefnmark}$}}
+%    \end{macrocode}
+%
+% \end{macro}
 %
 % \subsection{Starting the main document}
 %