# Wrong label position in the footnote with hyperref

The hyperref package attempts to handle the footnotes in a useful way, but the implementation seems wrong and I am looking for a way to fix it. Please consider the following MWE:

\documentclass{article}
\usepackage{lipsum}
\usepackage{hyperref}

\begin{document}

\lipsum[2-4]\footnote{\lipsum[1]}
\lipsum[5-10]

\end{document}


Whenever I click the footnote mark in the document, it brings me to the footer, somewhere close to the related footnote, but the first line of the note is not visible -- as if the hyperref label was placed too low (bottom of the first line instead of the top). I believe that the whole footnote should be seen, like this:

However, what I get instead is (EDIT: compare it to the previous image so it makes some sense):

My usual toolkit is LaTeX+dvips+gs, dependent on the desired output format. I made sure to use no additional arguments for the MWE. NO SUCH THING (EDIT: I made a mistake here and noticed it thanks to @Ulrike Fischer) happens with pdfLaTeX. I have checked it with acroread and Evince. I failed to find any package or option that would change it, but I might just have missed something obvious. I would appreciate any help!

• Note that it is basically impossible to understand what is the problem with the last image you posted. Feb 21 at 12:40
• @daleif thanks, I added some edit whit a hope that it helps. Definitely, the last image is not enough to understand the problem -- that is why the rest of the post exists. Feb 21 at 13:04
• well with pdflatex the destination is raised, but the dvips driver doesn't use \Hy@raisedlink (I have no idea why there is no comment in the code). Feb 21 at 13:05
• with the dvips the shifting should be done at the postscript level, but it seems not to work with footnote markers. You could open an issue at the hyperref github, but I doubt that there will be a fast solution, this probably require some changes in the latex footnote code first. Feb 21 at 13:16
• Thanks @UlrikeFischer, your diagnosis is right, sorry for my mistake! This brings a helpful perspective. Is there any way to make it work anyways? Feb 21 at 13:17

It seems pretty complex (@UrlikeFischer suggestions are great, but implementing and supporting it would require way more research for me). Temporarily, I can offer a hack:

\newcommand{\fnprocesscounter}{\fnsymbol} % \arabic, \fnsymbol, ...
\newcounter{footlabel}
\newcommand{\footlabel}[2][0]{%
\phantomsection\label{footlabelback\thefootlabel}%
\renewcommand\thefootnote{}%
\footnotetext[0]{%
\renewcommand\thefootnote{\fnprocesscounter{footnote}}%
\phantomsection\label{footlabelfront\thefootlabel}%
\hyperref[footlabelback\thefootlabel]{\footnotemark}%
#2%
}%
\renewcommand\thefootnote{\fnprocesscounter{footnote}}%

\fnprocesscounter is configurable, it works on a counter. The presented \footlabel command takes optional number that stands for an additional jump and the required text of the footnote itself. Make sure to use hyperref and set hyperfootnotes=false. In the intended case, you have only one reference to the footnote, and you get two-way hyperrefs. Anything beyond that (removal of hyperrefs in some direction, using footlabelfrontX/footlabelbackX labels anywhere else, ...) is up to your hacking. Have fun on your responsibility!