# Trying to use \MakePerPage{footnote} kills the build of my LaTeX doc

The standard LaTeX footnote behavior is to mark footnotes using superscript numbers. I can't use that, since all of my citations are superscript numbers. What I'd like is for my footnotes to be marked with symbols, and for the set of symbols to reset on each page (eg the first footnote on a page should always be marked with *). To make this happen I added the following to one of my .sty files:

\renewcommand*{\thefootnote}{\fnsymbol{footnote}}
\usepackage{perpage}
\MakePerPage{footnote}


However, these lines break my build. When I run the make command and my makefile gets to the pdflatex step, every footnote after the 7th one now raises an error of the form:

! LaTeX Error: Counter too large.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.502 ... the topic of enhanced sampling\footnote{
Technically, Kahn et al., ...


If I comment out those lines, everything builds just fine, though of course then the footnotes are wrong. If I comment out just the \MakePerPage{footnote}, then errors don't begin until after the 8th footnote. Either way, it seems like the \MakePerPage{footnote} directive is being ignored, and that LaTeX is running out of footnote symbols.

I've used the above approach to get symbol footnotes in previous projects. The difference seems to be that before I was writing/building my docs using Texpad, whereas now I have a manual makefile build. So obviously there's something wrong with/missing from my makefile. Here's what the contents of the makefile look like:

fname=main
${fname}.pdf:${fname}.tex \
abstract/abstract.tex \
committee/committee.tex \
acknowledgments/acknowledgments.tex \
thesis_intro/thesis_intro.tex \
bib/thesis_intro.bib \
eces_chapter/error_control_of_enhanced_sampling.tex \
bib/error_control_of_enhanced_sampling.bib \
conclusion_chapter/conclusion_chapter.tex
if [ -e ${fname}.aux ]; \ then \ rm${fname}.aux; \
fi;
pdflatex ${fname} bibtex${fname}
bibtex ${fname}1-blx bibtex${fname}2-blx
# Add more if you have more chapters
pdflatex ${fname} pdflatex${fname}
cp ${fname}.pdf PhD_Thesis.pdf open PhD_Thesis.pdf clean: ... open: open${fname}.pdf
edit:
open \${fname}.tex


All of the footnote errors occur during the first call to pdflatex. At the end of that first call to pdflatex, an (incomplete) pdf is produced, and the build halts with another error message:

make: *** [main.pdf] Error 1


This project is a PhD thesis, so I'm working off a template (written by another student a few years ago) that meets my school/library's formatting requirements (basically, some weird wide margins + the output has to be PDF/A). I didn't write the makefile, nor do I particularly understand it, I just substituted the .tex/.bib filenames with my own. The makefile doesn't resemble other example LaTeX makefile's that I was able to find on the internet, so I'm at a loss as how to fix it. Anyone familiar enough with the perpage package and/or similar footnote issues who can point me in the right direction?

If you want more details, the entire set of sources for my thesis are in a public repo here.

• Odd that you get an error for 7th I'd expect it to be 9th, the standard fnsymbol counter style only has 9 symbols, although you can easily extend it. – David Carlisle Jan 12 at 21:00
• it would be simpler to answer if you had posted a small but complete document with 7 footnotes on a page that gave the error (none of the makefile is related to the error message) – David Carlisle Jan 12 at 21:01
• The 7th one works, while the 8th one has the error. Looking through the incomplete pdf output it seems like somehow the * is getting skipped, and the first footnote is using the † symbol. – tel Jan 12 at 21:01
• @DavidCarlisle I know the problem has something to do with the makefile, at least. All of the info I've found on \MakePerPage{footnote} suggest that it requires two passes of pdflatex to work correctly. Is there some way to just make the makefile power through and do the second pass instead of halting on error? Also, I'll see if I can create the same error with just a single .tex file alongside a makefile. – tel Jan 12 at 21:12
• you shouldn't get an error – David Carlisle Jan 12 at 21:27

The problem has nothing to do with the make file. It is caused by the fact that LaTeX processes the input past the end of a page (for example, up to the end of the current paragraph) before it knows there is a page full of text, so the on the first pass through the document you have already processed some footnotes that will eventually end up on page 2 before makeperpage "knows" they are not all on page 1.

makeperpage works fine with numbered footnotes, because it is very unlikely to run out of numbers during the first pass through the document!

During the first pass, makeperpage remembers where the page breaks actually were, and uses that information to produce the correct footnote symbols on the second pass.

A brute force way to fix this is just to turn the error message into a warning. Insert the following into the preamble of your .tex input file, before \begin{document}:

\makeatletter
\gdef\@ctrerr{%
\@latex@warning{Counter too large}}
\makeatother


The "standard" version of LaTeX uses \@latex@error not \@latex@warning here.

• Haha, awesome. Thank you. Latex: so much spaghetti that for the first time silencing an error message was the actually correct fix for an error. – tel Jan 12 at 21:48

the expected behaviour is to get an error on the 10th, some code you have not shown is presumably using two footnotes somewhere.

\documentclass{article}

\renewcommand*{\thefootnote}{\fnsymbol{footnote}}
\usepackage{perpage}
\MakePerPage{footnote}

\begin{document}

1\footnote{zz}
2\footnote{zz}
3\footnote{zz}
4\footnote{zz}
5\footnote{zz}
6\footnote{zz}
7\footnote{zz}
8\footnote{zz}
9\footnote{zz}
10\footnote{zz}
11\footnote{zz}

\end{document}


produces

! LaTeX Error: Counter too large.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.18 10\footnote{
zz}
?


However fnsymbol is a trivial macro that can easily be extended, the default definition is

\def\@fnsymbol#1{%
\ifcase#1\or \TextOrMath\textasteriskcentered *\or
\TextOrMath \textdagger \dagger\or
\TextOrMath \textdaggerdbl \ddagger \or
\TextOrMath \textsection  \mathsection\or
\TextOrMath \textparagraph \mathparagraph\or
\TextOrMath \textbardbl \|\or
\TextOrMath {\textasteriskcentered\textasteriskcentered}{**}\or
\TextOrMath {\textdagger\textdagger}{\dagger\dagger}\or
\TextOrMath {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}\else
\@ctrerr \fi
}%


so you could use

\documentclass{article}

\renewcommand*{\thefootnote}{\fnsymbol{footnote}}
\usepackage{perpage}
\MakePerPage{footnote}

\makeatletter
\def\@fnsymbol#1{%
\ifcase#1\or
\TextOrMath\textasteriskcentered *\or
\TextOrMath \textdagger \dagger\or
\TextOrMath \textdaggerdbl \ddagger \or
\TextOrMath \textsection  \mathsection\or
\TextOrMath \textparagraph \mathparagraph\or
\TextOrMath \textbardbl \|\or
\TextOrMath {\textasteriskcentered\textasteriskcentered}{**}\or
\TextOrMath {\textdagger\textdagger}{\dagger\dagger}\or
\TextOrMath {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}\or
\TextOrMath {\textsection\textsection}{\mathsection\mathsection}\or
\TextOrMath {\textbardbl\textbardbl}{\|\|}\else
\@ctrerr \fi
}%
\makeatother

\begin{document}

1\footnote{zz}
2\footnote{zz}
3\footnote{zz}
4\footnote{zz}
5\footnote{zz}
6\footnote{zz}
7\footnote{zz}
8\footnote{zz}
9\footnote{zz}
10\footnote{zz}
11\footnote{zz}

\end{document}

• I just doubled up characters here but of course you can use any symbols that you have available. – David Carlisle Jan 12 at 21:39
• Thanks for the info. I was wondering how to extend the set of symbols. However, alephzero directly addresses the issue of making perpage correctly reset the symbols on each page, so I had to go with his answer. – tel Jan 12 at 21:50
• @tel I can probably survive without the points:-) – David Carlisle Jan 12 at 22:01
• if you change the final \@ctrerr by \arabic{#1} then it will use numbers when it runs out of symbols and never give an error. @tel – David Carlisle Jan 12 at 22:10