I've a \footnote
that appears in the wrong page. I've read that this may happen when floats are involved or when there are multiple footnotes on a single page. But in my case there's only one footnote.
Below you can find my MWE. I've tried to reduce it as much as possible, and it was very hard to keep the problem appear: actually I find it very strange that even removing that \marginpar
, the problem seems solved.
I guess that this could be due to how TeX tries to "fill" the pages, but I would expect that a footnote is kept on the page from where it is called, unless in special circumnstances. I know that my MWE may sound a lot "artificial", but it comes from a normal math thesis.
The use of \raggedbottom
or \interfootnotelinepenalty
(suggested here: Keep all footnotes on the according page) didn't help.
%!TeX encoding = utf8
%!TeX program = pdflatex
\documentclass[a4paper, 11pt]{book}
\usepackage{geometry}
\usepackage[eulerchapternumbers, palatino=false, parts=false]{classicthesis}
\usepackage[proportional, oldstyle]{cochineal}
\geometry{width=28pc, height=56pc}
\usepackage{lipsum}
\begin{document}
\pagestyle{empty}
\lipsum[1-3]
Lorem ipsum.\footnote{Footnote in the wrong page.}
\begin{equation}
\dots
\end{equation}
\vspace{13.5\baselineskip}\par
Lorem ipsum\par
Lorem ipsum\par
Lorem ipsum.
\goodbreak
\marginpar{Lorem ipsum}
\lipsum[1]
\end{document}
This is the (wrong) output I get:
EDIT:
For completeness, I add a less minimal and more natural working example,
without that \goodbreak
:
\documentclass[a4paper, 11pt]{book}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage[palatino=false]{classicthesis}
\usepackage[proportional, oldstyle]{cochineal}
\geometry{width=28pc, height=56pc}
\usepackage{lipsum}
\begin{document}
\pagestyle{empty}
\makeatletter
\newcounter{step}
\setcounter{step}{1}
\newcommand\step[1]{%
\par\bigskip\noindent
\textbf{Step \thestep.} \textit{#1}%
\marginpar{#1}%
\nobreak\par\nobreak\medskip
\stepcounter{step}}
\makeatother
It is easy to prove by induction that for any $x\in I$ and for any positive integer $k\le r$ it holds:
\begin{equation}
\label{e:higher_derivatives_psi}
\frac{d^k\Psi(\phi)}{dx^k}=H_k\left(x,\,\phi'(f(x)),\,\phi''(f(x)),\dots,\, \phi^{(k)}(f(x))\right).
\end{equation}
Again by induction, it is evident that each $H_k$ is of the form
\begin{equation}
\label{e:hk_form}
H_k(x, y_1, \dots, y_k) = \sum_{i=1}^{k} h_{k,i}(x)y_i
\end{equation}
where $h_{k,i}$ are continuous functions of $x$ and $h_{k,k} = s^{-1}f'(x)^k$.
Now let $\phi$ be a generic solution of Schröder's equation, and let
\begin{equation}
\eta_1 = \phi'(0),\quad \eta_2 = \phi''(0), \quad \dots\quad \eta_r = \phi^{(r)}(0).
\end{equation}
From~\eqref{e:higher_derivatives_psi} we deduce that for $k=1,\dots,r$ we have
\begin{equation}
\label{e:etacondition}
\eta_k = H_k(0, \eta_1,\dots,\eta_k).
\end{equation}
This condition is trivial for $k=1$, since it follows directly from the definition of $H_1$, and it does not impose any condition on $\eta_1$. Conversely, if we fix $\eta_1 = \eta$, then each $\eta_k$ ($2\le k\le r$) is uniquely determined by the recurrent relation
\begin{equation}
\label{e:eta_recursive}
\underbrace{\left(1-\frac{f'(0)^k}{s}\right)}_{\displaystyle=1-s^{k-1}\ne0}\eta_k=\sum_{i=1}^{k-1} h_{k,i}(0)\eta_i
\end{equation}
as it follows directly from~\eqref{e:hk_form} and~\eqref{e:etacondition}.
\step{Assumptions and choice of constants}
\label{s:costants}
We assume without loss of generality that $0$ is the left endpoint of~$I$.\footnote{If $0$ is in the interior of $I$, one can consider the two intervals $I_1=I\cap(-\infty,0]$ and $I_2=I\cap[0,+\infty)$.}
For $i=1,\dots,r$ and for any nonnegative real $\tau$ such that $[0,\tau]\in I$, let
\begin{equation}
L_i(\tau) = \max_{x\in[0,\tau]}|h_{r,i}(x)|,
\end{equation}
where $h_{r,i}$ are the continuous functions defined in~\eqref{e:hk_form}. It follows from~\eqref{e:hk_form} that for any $x\in[0,\tau]$ and for $k\in1,\dots,r$,
\begin{equation}
\label{e:hk_lipschitz}
\left|H_k(x,y_1,\dots,y_k)-H_k(x,z_1,\dots,z_k)\right|\le\sum_{i=1}^{k} L_i(\tau)|y_i-z_i|.
\end{equation}
The above Lipschitz condition will be useful to prove that the operator $\Psi$ is a contraction.
Now let us choose a sufficiently small $\tau$ such that
\begin{equation}
\label{e:sigma}
\sum_{i=1}^r\,L_i(\tau)\frac{\tau^{r-i}}{(r-i)!} < 1.
\end{equation}
The existence of $\tau$ is guaranteed because the left-hand side of~\eqref{e:sigma} is continuous with respect to $\tau$ and equals $0$ when $\tau=0$.
From now on, we denote by $T$ the interval $[0,\tau]$.
\step{The complete metric space $\mathcal{F}$}
\lipsum[1]
\end{document}
with the resulting wrong output:
\step
command. I've edited the MWE slightly to show that in this caseclassicthesis
is not the culprit, as it so often is.\step
does nothing special, as you can see in its definition.\marginpar
: you will find that the example works if this is commented out. Just need a cleaner way to accomplish this.\marginpar
sets\@floatpenalty
to -10003 (because it is called in vertical mode), then from\end@float
, a\penalty -\@Miv
(-10004) is put on the main vertical list. This triggers the first page break, removes the footnote\insert
from the “current page” (contents to\box\footins
), but then for some mysterious reason, the\output
routine doesn't ship the boxed footnote material to page 1, but apparently puts it back onto the vertical list for the new “current page“ (page 2). The question being, why is the\insert
put back?