2

Because I need a reference to the same footnote, I like to use \footnoteref which is defined here.

Writing

\documentclass[12pt,a4paper]{report}
\usepackage[british]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[bottom,hang]{footmisc}
\usepackage{hyperref}
\usepackage{zref-perpage}
\usepackage[gen]{eurosym}
\usepackage{footnote}
\makesavenoteenv{tabular}
\makesavenoteenv{equation}
\zmakeperpage{footnote}

% Remove counter "footnote" from the reset counter list
% of counter "chapter".
\usepackage{remreset}
\makeatletter
\@removefromreset{footnote}{chapter}
\makeatother
\usepackage[labelfont=bf]{caption}

\makeatletter
\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark}
\makeatother

\begin{document}
    \begin{equation}
        \begin{tabular}{@{} l r @{}}
            Wood\footnote{\label{one}Footnote for wood.}\ \ & 10,000\ \euro\\
            Steel\ \ & 25,000\ \euro\\
            Coal\ \ & 5,000\ \euro\\
            Oil\ \ & 100,000\ \euro\\
            \hline
            Sum\ \ & 140,000\ \euro
        \end{tabular}
    \end{equation}
    \begin{equation}
        \begin{tabular}{@{} l r @{}}
            Wood\footnoteref{one}\ \ & 10,000\ \euro\\
            Steel\ \ & 25,000\ \euro\\
            Coal\ \ & 5,000\ \euro\\
            Oil\ \ & 100,000\ \euro\\
            \hline
            Sum\ \ & 140,000\ \euro
        \end{tabular}
    \end{equation}
\end{document}

results in

enter image description here

which is the result I would like to have. But inserting \chapter{One} between \begin{document} and the first \begin{equation} will result in

enter image description here

which I would not like to have.

Where is the error in this whole thing? I cannot find it. I suppose that the definition of \footnoteref has to be modified in order to solve the problem. Or maybe some chapter/equation numbering has to be modified.

Nemgathos
  • 545
  • 3
  • 15

1 Answers1

1

Three issues:

Issue 1:

As you load the footmisc-package, you can use its \footref-command instead of defining your own \footnoteref-command.

But you need to adjust the \footref-command to take the hyperref-package into account correctly.

You're in luck here—a discussion about a similar problem took place recently in the German-language-newsgroup de.comp.text.tex.
Subject: "Fussnoten wiederholen". (Repeating footnotes.)
url: https://groups.google.com/forum/#!topic/de.comp.text.tex/fCIRB-5Fy_A

Issue 2:

The amsmath-package does within the equation-environment redefine the \label-command in a way which makes it impossible to use it within footnotes within equations also. Therefore I suggest saving the \label command under a different macro name and using that within things where amsmath applies its "nice" modifications.

Issue 3:

Your \makesavenoteenv-entries make sure that "spitting out" footnotes will be delayed to a moment in time where \label-placement will be broken due to internal macros like \@currentlabel and \@currentHref being redefined already.
Therefore you need to ensure the local restoring of these macros before processing a \label-command.

\documentclass[12pt,a4paper]{report}
\usepackage[british]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[bottom,hang]{footmisc}
\usepackage{hyperref}
\usepackage{zref-perpage}
\usepackage[gen]{eurosym}
\usepackage{footnote}
\makesavenoteenv{tabular}
\makesavenoteenv{equation}
\zmakeperpage{footnote}

% Remove counter "footnote" from the reset counter list
% of counter "chapter".
\usepackage{remreset}
\makeatletter
\@removefromreset{footnote}{chapter}
\makeatother
\usepackage[labelfont=bf]{caption}

\makeatletter
\@ifpackageloaded{hyperref}{% 
  \renewcommand\footref[1]{% 
    \begingroup 
    \unrestored@protected@xdef\@thefnmark{% 
      \ref*{#1}% 
    }% 
    \endgroup 
    \ifHy@hyperfootnotes 
       \expandafter\@firstoftwo 
    \else 
       \expandafter\@secondoftwo 
    \fi 
    {\hyperref[#1]{\strut\H@@footnotemark}}{\@footnotemark}% 
  }% 
}{}% 

\newcommand\savedlabel{}%
\AtBeginDocument{\let\savedlabel=\label}%
\newcommand\footnotereflabel[1]{%
   \@bsphack
   \begingroup
   \def\@currentHref{Hfootnote.\theHfootnote}\savedlabel{#1}%
   \endgroup
   \@esphack
}%

\makeatother

\begin{document}
\chapter{One}
    \begin{equation}
        \begin{tabular}{@{} l r @{}}
            Wood\footnote{\footnotereflabel{one}Footnote for wood.}\ \ & 10,000\ \euro\\
            Steel\ \ & 25,000\ \euro\\
            Coal\ \ & 5,000\ \euro\\
            Oil\ \ & 100,000\ \euro\\
            \hline
            Sum\ \ & 140,000\ \euro
        \end{tabular}
    \end{equation}
    \begin{equation}
        \begin{tabular}{@{} l r @{}}
            Wood\footref{one}\ \ & 10,000\ \euro\\
            Steel\ \ & 25,000\ \euro\\
            Coal\ \ & 5,000\ \euro\\
            Oil\ \ & 100,000\ \euro\\
            \hline
            Sum\ \ & 140,000\ \euro
        \end{tabular}
    \end{equation}
\end{document}

enter image description here

Ulrich Diez
  • 28,770