8

LaTeX is very good in adjusting the numbering -- and more importantly the references to it -- when inserting new chapters, sections, etc.

Legal documents (and books), at least here in Germany, tend to insert these things by keeping the previous numbering intact, but using the number before the insertion followed by a small letter (a, b, c, ...), to indicate that something has changed (either at the last minute, or -- which is the really important case -- from a previous edition).

Since I thought it rare that there would be more than one additional consecutive footnote, I tried the following (incredibly crude and dirty) hack, shown in the MWE:

\documentclass{article}
\newcommand{\myextrafootnote}[1]{\renewcommand{\thefootnote}{\arabic{footnote}a}\footnote[\thefootnote]{#1}\renewcommand{\thefootnote}{\arabic{footnote}}}%
\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}
\end{document}

Sadly, it doesn't work as I had hoped. While the footnotes themselves look as they should: Footnotes, with a bit of extra in between

the text gets the additional a also added just before the footnotemark: as shown here: text, with more extra than is actually wanted

Ideally, of course, the a would also come from some form of counter (I tried that too, but it turned into lots of error messages about missing arguments, so I abandoned it and decided to better ask the experts...) so if there were more than one additional consecutive added footnote, it would still work correctly [and be less crude than it is now].

8

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.

9

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}

enter image description here

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}
5
  • I was about to post an almost identical update to my answer… :-) Well, looking more closely, you must surely intend \newcounter{extrastuff}[footnote].
    – GuM
    Jun 9 '16 at 12:43
  • @clemens: I understood that it should not reset, but otherwise \newcounter{extrastuff}[footnote] would be easy, of course
    – user31729
    Jun 9 '16 at 12:51
  • @clemens: I provided a version with resetting by footnote
    – user31729
    Jun 9 '16 at 12:57
  • I'm puzzled by why this breaks if I replace \alph with \Alph. Instead of displaying the whole footnote marker superscript, just the number is superscript and the following letter is printed normal size on the line. Any idea why?
    – richard
    Jan 7 '17 at 12:54
  • @richard: Works for me with \Alph too. I don't know what you have done instead.
    – user31729
    Jan 7 '17 at 16:56
1

This is a nice case of short term thinking. Your solution will cause more issues than it solves. How will you mark new footnotes of a next revision?

If you need to display the changes between two revisions of a document, provide a »diff« between document-version-1.tex and document-version-2.tex, the latter being the latest revision.

Please have a look at latexdiff, you get the manual by typing texdoc latexdiff in a console window. Basically, it's just

latexdiff document-version-1.tex document-version-2.tex > document-diff.tex

And then open and compile document-diff.tex. The PDF contains all the changes.

You can choose colors and markup of deletions and additions. I prefer to put something like

\providecommand{\DIFadd}[1]{{\protect\color{blue}#1}} %DIF PREAMBLE
\providecommand{\DIFdel}[1]{{\protect\color{red}\protect\scriptsize{#1}}}

into the preamble of document-diff.tex.

This has the advantage to display clearly the differences between two versions of a document. For now and any revision in the future.

If you expect many revisions, consider using a version control system like git and then latexbatchdiff, see here: https://tex.stackexchange.com/a/44092/4736

2
  • That's a great way of doing it, I guess, but not how "they" (meaning the legal document people I know, who -- at best -- can use MS Word) could be made to think. Mainly because they construct their documents like the laws are constructed. If there were §12 and §13 and thematically and structurally there has to be something in between, that one is called §12a and if another one comes in it will be called §12b and §12c and, if §12b then becomes obsolete, §12c will still be called §12c. Colour is great, but works only for a pdf, not for the actual documents which will be printed black-and-white.
    – BMWurm
    Jun 9 '16 at 15:57
  • 1
    I'm a German lawyer and I'm doing exaclty this stuff. If it comes to writing a contract, I'm using the package scrjura. This package indeed provides 'subparagraphs' for exactly the reasons you describe. But footnotes in legal texts are rare and if the are added later, they usually beginn with the information about the date and the circumstances of adding the footnote. If you can't use colored text, then have a look into the documentation of the ulem package, which also offers »wavy« underlines and more.
    – Keks Dose
    Jun 9 '16 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.