1

Need to add a reference to the following customized footnote definition:

 \documentclass[a4paper,10pt]{article}

\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    citecolor={black},
    linkcolor={black},
    urlcolor={blue},
    pdfborder={0 0 0},
}


\usepackage{manyfoot}
\newfootnote{B}
\makeatletter
\def\sfootnote#1{\ifx\protect\@typeset@protect
    \Footnotemark{*}\FootnotetextB{*}{#1}%
  \else
    \relax
  \fi
}

\begin{document}
\tableofcontents

\newpage
\section[abc]{abc\sfootnote{cde}}

text\footnote{foot}
\end{document}

This will produce the footnote for the section abc, but when clicking on it, will not point to the footnote cde but to the first page.

Any idea how this feature could be also supported in the above definition?

  • Where is hyperref coming in here? In addition, \makeatother is desperately needed otherwise it screws up the tex run – user31729 Feb 21 '15 at 21:18
  • Not really, above code works for me – schmi Feb 21 '15 at 21:27
  • It's known that hyperref can't behave well with footnotes. – egreg Feb 21 '15 at 21:47
  • But isn't there a way to EXPLICITLY set where to ref to? Smth like \Footnoteref (since there is \Footnotemark) – schmi Feb 21 '15 at 21:58
  • 1
    @schmi Can you explain what you want to do with all that? – Keks Dose Feb 22 '15 at 17:45
1

This works, but as already mentioned hyperref doesn't play well with packages it doesn't know how to patch itself into, such as manyfoot.

Note you will need to run LaTeX more than once, to resolve the cross references correctly.

I extended your example, to make a better test.

\documentclass[a4paper,10pt]{article}

\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    citecolor={black},
    linkcolor={black},
    urlcolor={blue},
    pdfborder={0 0 0}
}


\usepackage{manyfoot}
\newfootnote{B}
\newcounter{footB}
\makeatletter
\def\sfootnote#1{\ifx\protect\@typeset@protect
    \stepcounter{footB}%
    \hyperlink{fn:B\thefootB}{\Footnotemark{{*}}}%
    \FootnotetextB{*}{\Hy@raisedlink{\hypertarget{fn:B\thefootB}{}}#1}%
  \else
    \relax
  \fi
}
\makeatother

\begin{document}
\tableofcontents

\newpage
\section[abc]{abc\sfootnote{cde}}

text\footnote{foot}

\newpage
\section[abc2]{abc2\sfootnote{cde2}}

text2\footnote{foot2}


\end{document}
  • If I click on the sfootnote, document jumps to toc - ?! – Keks Dose Feb 23 '15 at 9:48
  • does not work, jums to the first page, as was before - add the following after \begin{document} and before \tableofcontents statements to see that: asdasda \newpage – schmi Feb 23 '15 at 13:25
  • It works for me, using xelatex in TeXLve on Windows. It's possible the behaviour depends on the TeX engine (xelatex, pdflatex, Lua, etc) – alephzero Feb 24 '15 at 23:48

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.