For obvious reasons, it is a good practice (actually the correct way to do it) to place footnote markers after the punctuation marks, this is:
- Incorrect:
- This is a statement1.
- This is a statement2, and this is another statement.
- Is this a question3?
- Correct:
- This is a statement.1
- This is a statement,2 and this is another statement.
- Is this a question?3
Now, I'm quite forgetful, so I normally do it in a wrong way. This is, I often write This is a statement\footnotemark.
instead of This is a statement.\footnotemark
. Besides, I'm lazy so I'd rather have the computer fixing my (and others') mistakes for me, or at least remind me. Therefore, I made the following macro:
\let\oldfootnotemark\footnotemark
\renewcommand{\footnotemark}{%
\@ifnextchar.{%
% I neet to change this line so the dot and the mark switch places
\oldfootnotemark\textcolor{red}{\bfseries Fix me!}
}{\oldfootnotemark\xspace}%
}
That's a MWE, in the real implementation there are several \@ifnextchar
nested to cover coma, semicolon, period, and question and exclamation marks.
My questions in concrete are:
- How can I suppress the next character (the one following the macro) so the footnote mark and the punctuation character switch places? Please consider that this must also work with
\footnote
which already takes a parameter. - Is it there a more elegant way to approach this other tan nesting
\@ifnextchar
?
I'm almost sure this can't be done in LaTeX but before giving up, I rather ask the experts.
Thanks in advance.
Note: Please abstain from suggesting sed
or any other bash-based approaches. I know I can add some lines in Makefile to fix the latex code, but that's not the point (already implemented).
sed
footnotes and integrate this package once the draft moves to a definitive version.