How to insert an extra footnote without changing the previous numbering?
Here's an addition of an extrastuff
counter, that is stepped each time \myextrafootnote
is used.
However, more than 26
additions aren't possible this way, since \alph{extrastuff}
is used.
If you need even more additions, the alphalph
package for increasing the counter output is useful!
\documentclass{book}
\newcounter{extrastuff}[chapter]
\newcommand{\myextrafootnote}[1]{%
\stepcounter{extrastuff}%
\begingroup
\renewcommand{\thefootnote}{\arabic{footnote}\alph{extrastuff}}%
\footnote[\value{footnote}]{#1}%
\endgroup
}%
\begin{document}
This is the old text\footnote{foo}, followed by the new insert\myextrafootnote{New Exciting Stuff!!}, followed by the old next one.\footnote{bar}
New however is this text\myextrafootnote{Really new Exciting Stuff!!}, followed by the old next one.\footnote{foobar}
\end{document}
Update
Resetting extrastuff
with footnote counter:
\documentclass{book}
\newcounter{extrastuff}[footnote]
\newcommand{\myextrafootnote}[1]{%
\stepcounter{extrastuff}%
\begingroup
\renewcommand{\thefootnote}{\arabic{footnote}\alph{extrastuff}}%
\footnote[\value{footnote}]{#1}%
\endgroup
}%
\begin{document}
This is the old text\footnote{foo}, followed by the new insert\myextrafootnote{New Exciting Stuff!!}, now for something completely different\myextrafootnote{Other top secret content}, followed by the old next one.\footnote{bar}
New however is this text\myextrafootnote{Really new Exciting Stuff!!}, followed by the old next one.\footnote{foobar}
\end{document}
The optional argument of the \footnote
command expects an integer containing the number of the footnote, not the textual representation of that number. So, you should use
\footnote[\value{footnote}]{#1}
instead of
\footnote[\thefootnote]{#1}
Addition
So, where does the extra “a” come from? To understand this, let us examine step by step how the erroneous code
\footnote[\thefootnote]{#1}
is digested by TeX. The macro \thefootnote
expands (in the context in which the OP used it) to 1a
, so (La)TeX sees the equivalent of
\footnote[1a]{...}
But, as already said, it expects the optional argument to contain an integer value; this integer value is locally assigned to a dedicated counter (either footnote
or mpfootnote
, depending on the context) inside the \@xfootnote
internal command. The code for this assignment is (equivalent to)
<counter> = #1\relax
that, in our case, becomes
<counter> = 1a\relax
But the a
terminates the integer constant 1
, and therefore also the assignment; at this point, the a
token is interpreted as a command to typeset an “a” character in horizontal (i.e., the current) mode. And here we are.