# Is it possible to use hyperref, subfigure, and memoir together?

I asked a question about how to use subfigure with memoir. I got some great tips, but now pdflatex is making all subfigure hyper-refs point to the first couple subfigures. It also gives me this error:

destination with the same identifier (name{subfigure.3}) has been already used, duplicate ignored


for every subfigure (except the first one at any index, i.e., the first {subfigure.n} gets no error for every n.)

I was pointed to this, but hyperref is the last package loaded.

Has anyone gotten this working?

Solution:

Make sure that

\newsubfloat{figure}


follows

\usepackage{hyperref}

-

Please provide an example where it is not working? This seems to work for me:

\documentclass{memoir}

\usepackage{hyperref}
\newsubfloat{figure}

\begin{document}

\begin{figure}
\centering
\subtop[Sub~b.]{Bar\label{subfig:b}}
\caption{First.}
\end{figure}

\clearpage

\begin{figure}
\centering
\subtop[Sub~d.]{Foobar\label{subfig:d}}
\caption{Second.}
\end{figure}

\clearpage
\noindent
Main: \ref{subfig:a} Sub: \subcaptionref{subfig:a}\\
Main: \ref{subfig:b} Sub: \subcaptionref{subfig:b}\\
Main: \ref{subfig:c} Sub: \subcaptionref{subfig:c}\\
Main: \ref{subfig:d} Sub: \subcaptionref{subfig:d}

\end{document}


You can even use the \autoref from hypreref if you like.

\documentclass{memoir}

\usepackage{hyperref}
\newsubfloat{figure}

\providecommand*{\subfigureautorefname}{Subfig.}

\begin{document}

\noindent
\autoref{fig:1} on page \pageref{fig:1} contains two subfigures,
\autoref{subfig:a} \& \subcaptionref{subfig:b}.

\clearpage

\begin{figure}
\centering
\subtop[Sub~b.]{Bar\label{subfig:b}}
\caption{First.}\label{fig:1}
\end{figure}

\end{document}

-
Thank you for taking the time to answer. Your solution worked and mine didn't, so using the two I was able to narrow down the offending command. I updated the question with the solution. – Neil G Aug 6 '10 at 19:22

The option hypertexnames might fix it. Specify it when loading the package or in \hypersetup, i.e.

\usepackage[hypertexnames=true]{hyperref}


or

\hypersetup{hypertexnames=true}