1

For my typesetting purposes I need to check if the "footnote tag" appears in the same page of (the beginning of) the "footnote text". Sometimes indeed, it happens that, e.g., I have the footnote tag in a page and the footnote text in the next page.

Currently I do this check visually... and this is very boring and error prone.

I figured out to (temporarily) redefine the \footnote command to make it print the "tag page" and the "text page" in the .aux file that I would parse with an elisp script but, honestly I don't have any idea how to do that (I mean the LaTeX part of the trick).

To better exlain my idea, I'd like to have in the .aux file a string like this:

"Foonote1: footnotemarkePage=X, footnotetextPage=Y"  

Could anyone help me?

Is there a better solution to do that?

I'm not able to provide a MWE but I hope this can help:

\documentclass[11pt]{article}

\begin{document}

I need to print this footnote mark.\footnote{Footnote text.} page 
and the related footnote text page in the ``.aux'' file.

\end{document}

Here a screenshot of a real case.

enter image description here

Note. I'm not asking a solution to solve the problem but to "detect" it.

Note added. Sometimes the footnote text splits into two (or more) pages. It would be helpful a trick to detect this with an automatic solution.

Work in progress:

Using an egreg solution related to a similar issue I tried this:

\documentclass[12pt]{article}

\usepackage{blindtext}

\usepackage{etoolbox}
\usepackage{hyperref}

\makeatletter
\AtBeginDocument{%
  \renewcommand{\NR@setref}[1]{%
    \ref@page@write{#1}%
    \begingroup\@safe@activestrue\expandafter\endgroup
    \expandafter\NR@@setref\csname r@#1\endcsname
  }%
}
\newcommand{\ref@page@write}[1]{%
  \protected@write\@auxout{}{\string\ref@page{#1}{\thepage}}%
}
\newcommand{\ref@page}[2]{}
\makeatother

\newcounter{MyFootnote}

\let\MyOldFootnote\footnote
\renewcommand{\footnote}[1]{\stepcounter{MyFootnote}\label{FOOTNOTE\arabic{MyFootnote}}\MyOldFootnote{\ref{FOOTNOTE\arabic{MyFootnote}}#1}}

\begin{document}

\setcounter{section}{4}

\section{Section}

I need to print this footnote mark.\footnote{Footnote text.} page and the related footnote text page in the ``.aux'' file.

\blindtext
\blindtext
\blindtext
\blindtext

I need to print this footnote mark.\footnote{Footnote text.} page and the related footnote text page in the ``.aux'' file.

\blindtext
\blindtext
\blindtext
\blindtext

I need to print this footnote tag.\footnote{Footnote text.} page and the related footnote text page in the ``.aux'' file.

\end{document}

Now in the .aux file I get:

\newlabel{FOOTNOTE1}{{5}{1}{Section}{section.5}{}}
\ref@page{FOOTNOTE1}{1}
\newlabel{FOOTNOTE2}{{5}{2}{Section}{section.5}{}}
\ref@page{FOOTNOTE2}{2}
\newlabel{FOOTNOTE3}{{5}{3}{Section}{section.5}{}}
\ref@page{FOOTNOTE3}{3}

So I can compare the page the label is referred to (and where the footenotemark appears) with the page on which the footnotetext appears. The only problem with this solution is that it adds an extra string at the beginning of the foootnote text.

In the case of the screenshot I have:

\newlabel{FOOTNOTE11}{{4.2.3}{29}{xxxxxxxxxx}{equation.4.25}{}}
\ref@page{FOOTNOTE11}{31}

where "29" in the footnotemark's page number and "31" is the footnotetext page number. Please, keep in mind that the redefinition of the \footenote command is intended to be temporary.

12
  • 1
    You could use dummy text manually or with lipsum or blindtext. texblog.org/2011/02/26/…. It is importent to see your problem. Pleace try to reprocude your problem with manimial and not copyrighted text – Bobyandbob Jul 21 '17 at 10:15
  • 2
    I'm not sure how a standard footnote can get detached from its marker. Something more detailed is needed. – egreg Jul 21 '17 at 10:58
  • 1
    @GabrieleNicolardi Using \afterpage in a production environment is not recommended. – egreg Jul 21 '17 at 12:11
  • 2
    @GabrieleNicolardi This is on topic. About the (wrong) problem: the footnotes are added during the output routine and their text and formatting has already been done. – egreg Jul 21 '17 at 12:48
  • 2
    I've never had LaTeX put the footnote mark on a different page from the footnote. @egreg What's the problem with \afterpage? – cfr Jul 21 '17 at 13:49
1

Ok, this works for my purposes:

I'll compile with:

latex '\AtBeginDocument{\newcounter{MyFootnote} \let\MyOldFootnot  \footnote \renewcommand{\footnote}[1]{\stepcounter{MyFootnote}\label{FootnoteMark\arabic{MyFootnote}}\MyOldFootnote{\label{FootnoteText\arabic{MyFootnote}}#1}}} \input{Footnotes.tex}'

And I'll get in the .aux file:

\newlabel{FootnoteMark1}{{5}{1}}
\newlabel{FootnoteText1}{{1}{1}}
\newlabel{FootnoteMark2}{{5}{2}}
\newlabel{FootnoteText2}{{2}{2}}
\newlabel{FootnoteMark3}{{5}{3}}
\newlabel{FootnoteText3}{{3}{3}}

so I can compare (with a script) the page numbers of footnotemark and footenotetext.

I know it is not the most beautiful solution but it works for me.

1
  • You are right that it would take \label or at least \protected@write\@auxout to get the correct page numbers. – John Kormylo Jul 21 '17 at 17:35

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.