3

From the MWE:

\documentclass{memoir} 

\usepackage{graphicx}
\newsubfloat{figure}
\usepackage{hyperref}

\begin{document}

\begin{figure}[h]
    \subbottom[Image A]{\includegraphics[width=0.5\columnwidth]{example-image-a}}
\end{figure}

\begin{figure}
    \subbottom[Image B]{\includegraphics[width=0.5\columnwidth]{example-image-b}}
\end{figure}

\end{document}

I get the warning destination with the same identifier (name{subfigure.1}) has been already used, duplicate ignored. If the [h] or the \usepackage{hyperref} is removed, the warning disappears.

  • Why do I get this warning?
  • How is it best resolved?
  • And what are the implications of continuing with this warning?

(I get several of these warnings in my non-MWE document, and I still want to link to the subfigures including page numbers using cleveref and varioref.)

  • The numbering scheme is not clear to me, both figures are labelled with (a) (also without hyperref). – Heiko Oberdiek Apr 8 '16 at 9:09
  • @HeikoOberdiek I removed the figure caption in order to make a MWE. If the caption is added, they will be numbered as 1(a) and 2(a), respectively. – Thomas Apr 8 '16 at 9:12
4

Package hyperref needs to be loaded before \newsubfloat. The macro calls \@addtoreset, which is supported and patched by hyperref to fix the anchor name issue. But if the macro is called before, then the original version of \@addtoreset is called without the patch, and the anchor names would have to be fixed manually. But this is not necessary with the right order:

\documentclass{memoir}

\usepackage{graphicx}
\usepackage{hyperref}
\newsubfloat{figure}

\begin{document}

\begin{figure}[h]
  \subbottom[Image A]{\includegraphics[width=0.5\columnwidth]{example-image-a}}
  \caption{First}
\end{figure}

\begin{figure}
  \subbottom[Image B]{\includegraphics[width=0.5\columnwidth]{example-image-b}}
  \caption{Second}
\end{figure}

\end{document}
  • Wow, that was an easy fix! Thanks. Obviously the third question in the list is redundant now. – Thomas Apr 8 '16 at 9:28

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.