I'm trying to utilize native Memoir subbottom
command. However, I'm unable to make hyperref
links jump "to the picture", rather than "to the caption". Only links to (a) and (d) work as desired.
\documentclass[a4paper,14pt]{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 one could be fixed with "\usepackage[all]{hypcap}",
% but is it the correct approach?
This link jumps to the picture (the way I like): \ref{sf:1}.
This link jumps to slightly-above-subcaption: \ref{sf:2}.
This link jumps to slightly-above-subcaption: \subcaptionref{sf:3}, same as \ref{sf:3}.
This link jumps to the picture (the way I like): \ref{sf:4}.
This link jumps to slightly-above-subcaption: \ref{sf:5}.
\begin{figure}
\centering
% \hfill % if uncommented, link to sf:1 jumps to incorrect vertical position too. Why?
\subbottom[Subfigure 1\label{sf:1}]{\includegraphics[width=3cm]{example-image-a}}
\hfill
\subbottom[Subfigure 2\label{sf:2}]{\includegraphics[width=3cm]{example-image-b}}
\hfill
\subbottom[\label{sf:3}Subfigure 3]{\includegraphics[width=3cm]{example-image-c}}
\\
\subbottom[Subfigure 4\label{sf:4}]{\includegraphics[width=3cm]{example-image-b}}
\hfill
\subbottom[\label{sf:5}Subfigure 5]{\includegraphics[width=3cm]{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}
Here's the result I see (TexLive 2018, Windows 10):
My example is similar to those provided in the docs (Figure 10.19 in version v3.7g, 2018/04/04). And it looks like the issue is present in the docs pdf itself.
Similar code, utilizing subcaptionbox
works OK. And "Where do hyperlinks jump?" is nicely documented in the subcaption package docs. But it looks like using subcaptionbox
with Memoir is discouraged - the following warning is generated:
You are using the caption package with the memoir class. To prepare we will now reset all captioning macros and configurations to kernel defaults, and then let the caption package take over. Please remember to use the caption package interfaces in order to configure your captions.
Am I doing something wrong?
Is there any other way to make links jump "to the picture", rather than using
caption
andsubcaption
packages?
hypcap
maintainer: github.com/ho-tex/oberdiek/issues/42caption
has now taken over.