Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

2 Answers 2

up vote 8 down vote accepted

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~a.]{Foo\label{subfig:a}}\qquad
  \subtop[Sub~b.]{Bar\label{subfig:b}}
  \caption{First.}
\end{figure}

\clearpage

\begin{figure}
  \centering
  \subtop[Sub~c.]{Baz\label{subfig:c}}\qquad
  \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~a.]{Foo\label{subfig:a}}\qquad
  \subtop[Sub~b.]{Bar\label{subfig:b}}
  \caption{First.}\label{fig:1}
\end{figure}

\end{document}
share|improve this answer
2  
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}

after loading the package.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.