ho-tex / oberdiek

Updating the oberdiek bundle
Other
16 stars 6 forks source link

[hypcap] Hyperref not jumping to the appropriate location for memoir's subbottom #42

Closed LSinev closed 5 years ago

LSinev commented 6 years ago

I'm unable to make hyperref links jump "to the picture", rather than "to the caption".

Thorough description here https://tex.stackexchange.com/questions/440399/hyperref-not-jumping-to-the-appropriate-location-for-memoirs-subbottom May this be a problem with hypcap's support of memoir class?

I provide extended MWE based on tex.sx post above:

\documentclass[a4paper,14pt,oneside,openany]{memoir}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[all]{hypcap}

\newsubfloat{figure} % allows to use "subbottom"

\begin{document}
This link jumps to the figure caption: \ref{fig:1}.

This link jumps to the picture (the way I like): \ref{sf:11}. 

This link jumps to slightly-above-subcaption: \ref{sf:12}. % Same with \subcaptionref{sf:12}.

This link jumps to slightly-above-subcaption: \subcaptionref{sf:13}. % Same with \ref{sf:13}.

This link jumps to the picture (the way I like): \ref{sf:14}.

This link jumps to slightly-above-subcaption: \ref{sf:15}.

\begin{figure}
    \centering
    % \hfill  %  uncommenting this line makes link to sf:11 jump to incorrect vertical position as well. Why?
    \subbottom[Subfigure 1\label{sf:11}]{\includegraphics[width=0.3\linewidth]{example-image-a}}
    \hfill
    \subbottom[Subfigure 2\label{sf:12}]{\includegraphics[width=0.3\linewidth]{example-image-b}}
    \hfill
    \subbottom[\label{sf:13}Subfigure 3]{\includegraphics[width=0.3\linewidth]{example-image-c}}
    \\
    \subbottom[Subfigure 4\label{sf:14}]{\includegraphics[width=0.3\linewidth]{example-image-b}}
    \hfill
    \subbottom[\label{sf:15}Subfigure 5]{\includegraphics[width=0.3\linewidth]{example-image-a}}
    \caption{Figure with five subfigures\label{fig:1}}
\end{figure}        

\clearpage
This text is here to add more space for scrolling.

\end{document}
u-fischer commented 5 years ago

I don't think that hyperref or hypcap is the right place to adjust this. Neither can patch all sort of class specific environments/commands. memoir should define \subbottom so that the anchor is in a sensible place. I suggest that you contact its maintainer.