[Tex/LaTex] Label in a footnote in author’s field causes ‘xfootnotemark doesn’t match its definition’


I am trying to insert a \label in the footnote (\thanks) of the author's field with the following code

\author{Gopal \thanks{XYZ university\label{auth1}}}

However, LaTeX keeps giving the error \@xfootnotemark doesn't match its definition.

If I remove the label, then there are no errors.

Why am I trying to use a label? Two authors have the same affiliation and I want to refer the existing affiliation for the second author. I am also using hyperref enabled for pdf.

I tried to look up on net for this solution but could not find one. Any help would be greatly appreciated.

Best Answer

You could save the footnote counter and use it for the second author in the following way:

\newcounter{savecntr}% Save footnote counter
\newcounter{restorecntr}% Restore footnote counter
\author{Gopal \setcounter{savecntr}{\value{footnote}}\thanks{XYZ University} ,
Someone else \thanks{ABC University} ,
Another \setcounter{restorecntr}{\value{footnote}}%
  \setcounter{footnote}{\value{savecntr}}\footnotemark% Print footnotemark
  \setcounter{footnote}{\value{restorecntr}} ,
Last author \thanks{IJK College}}
\title{My title}


Here is some text.

Two different authors, same affiliation

The idea here is to store the footnote counter before reusing the affiliation, and then to restore it after you've used it so that subsequent authors receive a different (unique) \footnotemark.

Since you are using hyperref, using \footnotes as well and wanting to reference them is tricky. On the one hand, the regular titling command \author does one of two things, neither of which helps with footnotes: It typesets the contents in a tabular - a known issue that traps footnotes - and temporarily redefines the way \footnote works (by executing \let\footnote\thanks). On top of this, the hyperref README suggests the downside when "re-using a \footnotemark out of order/sequence":

The footnote support is rather limited. It is beyond the scope to use \footnotemark and \footnotetext out of order or reusing \footnotemark. Here you can either disable hyperref's footnote support by hyperfootnotes=false or fiddle with internal macros, nasty examples...

The example that follows works with modifying both the traditional footnote counter, as well as hyperref's internal Hfootnote counter. The "nasty example" makes things work, but it remains "nasty":

\usepackage[hyperfootnotes]{hyperref}% http://ctan.org/pkg/hyperref
\newcounter{savecntr}% Save footnote counter
\newcounter{restcntr}% Restore footnote counter
\newcounter{Hsavecntr}% Save Hfootnote counter
\newcounter{Hrestcntr}% Restore Hfootnote counter


  \let\footnotesize\small \let\footnoterule\relax% Set footnote parameters
  \renewcommand\thefootnote{\@fnsymbol\c@footnote}% Style of footnotes: symbols
  \vskip 60\p@
    {\LARGE My title \par}%
    \vskip 3em%
      \lineskip .75em%
      \setcounter{savecntr}{\value{footnote}} \setcounter{Hsavecntr}{\value{Hfootnote}}% Save counters
      Gopal \footnote{XYZ University} ,% First author
      Someone else \footnote{ABC University} ,% Second author
      \setcounter{restcntr}{\value{footnote}} \setcounter{Hrestcntr}{\value{Hfootnote}}% Save restore counters
      \setcounter{footnote}{\value{savecntr}} \setcounter{Hfootnote}{\value{Hsavecntr}}% Restore similar counter
      Another \footnotemark ,% Print footnotemark with third author
      \setcounter{footnote}{\value{restcntr}} \setcounter{Hfootnote}{\value{Hrestcntr}}% Restore original counters
      Last author \footnote{IJK College}% Last author
  \vskip 1.5em%
  {\large \@date \par}%       % Set date in \large size.

Here is some text.\footnote{Here's a footnote.}

The definition of the title, author and date was taken from article.cls

Correct hyperlinks from authors to footnotes/affiliations