# Perpage + Para won't Stabilize

I'm new to Latex (using xelatex) and I am trying to lay out a document with lots of short footnotes. I'm using para and perpage.

I've tried para with both bigfoot and footmisc. I've tried perpage from footmisc, perpage and bigfoot. In all combinations of these (when I finally get something compiling), though, I end up with a sort of race condition where the a page will begin with footnotes 27 and 28, for example. When I rerun xetex, the footnotes end up on the previous page but are numbered 1 and 2 and the following page begins on footnote 3.

In other words, it seems as though the footnote number(s) being two digits are at the threshold that wraps the word(s) to the next page. When xetex runs again (with the words and footnotes on the next page), the footnote number is lowered by perpage which causes the word(s) to wrap back onto the previous page.

I can rerun xetex infinitely but the numbering/spacing doesn't stabilize. I can give a working example but it won't be "minimal" because the documents are often long. They're also mostly Greek.

[EDIT:] Like I said, I'm new to Latex and it seems as though the whole system is kind of fragile. If there's a Right Way™ to do it, I'm all ears. One thing I thought might help, though, was if there were a way to set a minimum footnote width. I don't think I have 100 footnotes on any page so it would just be a matter of fixing the width to something wide enough to hold the two widest digits. I don't know if that's possible but that would make footnote numbers predictable for wrapping.

• Welcome to TeX.SE! I don't know para, but never-ending oscillations as you describe are quite possible. Can't you stabilize the document using some rewording or geometry, font, etc. changes? If so, you can probably leave the problem as is until the final touches to your document, at which point you can do the required visual formatting to get rid of such problems (and add prominent XXX comments where you did some visual formatting, in case you decide to further edit the document later :-). – frougon Aug 17 '19 at 22:05
• I would try to add more space, like \pagebreak[3] or \raggedbottom. – John Kormylo Aug 18 '19 at 1:02
• @JohnKormylo I tried \raggedbottom to no avail. From my understanding \pagebreak suggests a pagebreak at a point. The problem with this is that it's often a sequence of words, not only the ones with the footnotes, that are moving to the next page. Predicting good pagebreak locations would be impossible. – jcuenod Aug 18 '19 at 1:30
• @frougon the docs that I'm dealing with are 1000s of pages. They're generated using software. It's not practical to go back and visually reformat things. – jcuenod Aug 18 '19 at 1:32
• @James or jcuenod Are you using two different accounts? I take note of the previous comment but can't give better suggestions. I fear you won't get much help without a reproducible example. To rephrase the usual thing with references that don't stabilize: if you give LaTeX an unsolvable problem, you can't expect it to solve it. You have to change the code so that LaTeX is given a different problem, one that has a solution. – frougon Aug 18 '19 at 8:02

Standard LaTeX footnote marks are typeset in boxes whose width is just large enough to fit their contents. This is done by the \@makefnmark command defined in ltfloat.dtx by:

\def\@makefnmark{\hbox{\@textsuperscript{\normalfont\@thefnmark}}}


As per your comment, I'll show how you can alter this definition in order to typeset footnote marks in boxes that all have the same width. I'm afraid this will be ugly for small (e.g., one digit) footnote numbers...

For the common width shared by all footnote mark boxes, we'll use the natural width of 00 in the \normalfont and size for standard footnotes. If you want to fix the width in a more straightforward way—that won't adapt to the document font—, you can use something like \setlength{\myfootnotemarkwidth}{4mm}.

Since boxes for footnote marks have a fixed width in this setup, you need to choose how the contents is to be aligned within the box. The following, used in the full example below, centers each footnote mark inside its box:

\renewcommand*\@makefnmark{%
\hbox to \myfootnotemarkwidth{%
\hfil\@textsuperscript{\normalfont\@thefnmark}\hfil
}%
}


If you prefer left or right alignment, just remove one of the \hfil commands.

If you have footnote marks that are too large for the chosen box width (which is \myfootnotemarkwidth in my code), this will correctly produce overfull \hbox warnings. As I understood from your question, the overfull situation may be temporary due to perpage and bound to disappear on the next LaTeX run. That said, if you are too bothered by the overfull \hbox warnings on the first run (why?), you may want to replace \hfil with \hss; but beware that if you do so, you may have footnote marks overlapping with nearby text without being notified. So, carefully weigh the pros and the cons before doing such a change.

Here is the complete example:

\documentclass{article}

\makeatletter
\newlength{\myfootnotemarkwidth}

% Compute the width of a standard footnote mark numbered 00 (two digits) in
% \normalfont.
\AtBeginDocument{%
\settowidth{\myfootnotemarkwidth}{\@textsuperscript{\normalfont 00}}%
}

\renewcommand*\@makefnmark{%
\hbox to \myfootnotemarkwidth{%
\hfil\@textsuperscript{\normalfont\@thefnmark}\hfil
}%
}
\makeatother

\begin{document}

Some text\footnote{The footnote text.} to show the width of the footnote mark.
And now a high-numbered\footnote[99]{Other footnote text.} footnote.

\end{document}


Top of page:

Bottom of page:

In case you want footnote marks used by the \footnotetext command (i.e., the “destination” place for footnotes, at the bottom of the page body) to remain with their usual formatting, you can modify the previous example this way:

\documentclass{article}
\usepackage{etoolbox}

(...)

\AtBeginDocument{(...)
}

\let\@latex@makefnmark\@makefnmark
\patchcmd{\@makefntext}{\@makefnmark}{\@latex@makefnmark}{}{\FAILED}

\renewcommand*\@makefnmark{%
(...)


Then the footer of the example will look like this (the figure “1” is closer to the word “The” than in the full example shown above):

• Thanks! I was trying to do this but there's too much unfamiliar territory here for me. Is there a way to only affect the fnmark in the body? I don't like the affect it has on the footer. Thank you very much for the working example! – jcuenod Aug 19 '19 at 21:58
• Please see the latest edit. – frougon Aug 19 '19 at 22:16
• Thanks @frougon, I appreciate the help! When my accounts are merged, I'll upvote & accept. If you can think of other alternatives that will prevent the oscillation, I welcome suggestions. – jcuenod Aug 20 '19 at 15:06