[Tex/LaTex] Repeat footnote every page

footnotes

I am using the footmisc package to reference for footnotes. The problem I have is that when I refer to a footnote on a different page, latex does not reproduce the footnote on that page, I want it to reproduce it so that there is no need to return to that page to see the footnote.

\documentclass{article}
\usepackage{footmisc}
\begin{document}
Example\footnote{\label{test}Some footnote}
\newpage
Example\footref{test}
\end{document}

For example, the above text creates a document with 2 pages and I want the footnote to appear on every page. Here I have forced a new page, but in my document, a page break can happen anywhere.

Best Answer

I think this does what you want.

The basic idea is to make custom \footnote and \footref macros. The custom \footnote macro saves the current page number and footnote text before inserting the footnote. Then the custom \footref checks whether the current page is different to the page the footnote first appears on. If it's different, it inserts a new footnote with the right number, otherwise it just inserts the reference.

\documentclass{article}
\usepackage{etoolbox}
\usepackage{refcount}
\usepackage{footmisc}
% temporary counter to save footnote number
\newcounter{foottmpcnt}
% custom \footnote command
% #1: label
% #2: footnote text
\newcommand{\myfootnote}[2]{%
  \csgdef{footnote@text@#1}{#2}%
  \global\newcounter{footnote@page@#1}%
  \setcounter{footnote@page@#1}{\value{page}}%
  \footnote{\label{#1}#2}}
% custom \footref command
% #1: label
\newcommand{\myfootref}[1]{%
  \footref{#1}%
  \ifnumcomp{\value{footnote@page@#1}}{=}{\value{page}}
    {}
    {\setcounter{foottmpcnt}{\value{footnote}}%
     \setcounter{footnote}{\getrefnumber{#1}}%
     \footnotetext{\csuse{footnote@text@#1}}%
     \setcounter{footnote}{\value{foottmpcnt}}%
     \setcounter{footnote@page@#1}{\value{page}}}}
\begin{document}
Example\myfootnote{testa}{Some footnote}

Example\myfootnote{testb}{Some footnote}

Example\myfootref{testa}
\newpage
Example\myfootnote{testc}{Some footnote}

Example\myfootref{testa}

Example\myfootnote{testd}{Some footnote}

Example\myfootref{testc}

Example\myfootref{testa}
\newpage
Example\myfootref{testa}

Example\myfootref{testc}
\end{document}
Related Question