# pdfTeX warning (ext4): destination with the same identifier (name{figure.1}) has been already used, duplicate ignored

I've tried to make bilingual caption with package "ccaption" and compiled it with pdfLaTeX.

It works fine but with a warning:

pdfTeX warning (ext4): destination with the same identifier (name{figure.1}) has been already used, duplicate ignored.

Here is a mini example:

\documentclass[UTF8]{ctexart}
\usepackage{graphicx}
\usepackage{ccaption}
\usepackage{hyperref}

\begin{document}
Figure \ref{fig1}
\begin{figure}
\bicaption[fig1]{}{中文标题}{Fig.}{English caption}
\end{figure}
\end{document}


Sorry for the inconvenience if you don't have package ctex which defines a documents class ctexart for typesetting Chinese. You can replace the documentclass with article and the warning it still there.

-
Welcome to TeX.SX! –  Heiko Oberdiek Jul 18 '13 at 7:40
@HeikoOberdiek :) Thanks. I've got a lot help from TeX.SX. This is my very first time to register and ask a question. –  Ste Jul 18 '13 at 8:19
Warning, here comes an absolute shameless self-advertisement: The bicaption package works fine with hyperref, out-of-the-box. –  Axel Sommerfeldt Jul 19 '13 at 5:07
@AxelSommerfeldt Sure it is. Maybe you could consider adding the first example from your answer here to the manual, which I believe is easier to understand. Thanks. –  Ste Jul 20 '13 at 6:13

ccaption uses an elementary (and mostly feasible) way of producing duplicate captions for the same float. The main function at play here is \contcaption:

\newcommand{\contcaption}{%
\refstepcounter{\@captype}%
\@contcaption\@captype}


It steps the regular float counter back by one, sets a reference and then continues a call to set the actual caption text. On the .aux-file side, this leads to two cross-reference entries with the same hyperlink anchor name... something that hyperref doesn't enjoy. True, without hyperref, this problem won't be noticeable.

A way around this is to use an alias counter, provided by the aliascnt package, and using it as part of \contcaption:

\documentclass[UTF8]{ctexart}
\usepackage{aliascnt,ccaption}% http://ctan.org/pkg/{aliascnt,ccaption}
\usepackage{hyperref}% http://ctan.org/pkg/hyperref

\newaliascnt{figurealt}{figure}% New alias counter for figure float
\aliascntresetthe{figurealt}
\makeatletter
\renewcommand{\contcaption}{%
\expandafter\addtocounter\expandafter{\@captype alt}{\m@ne}% Step alias cntr back
\expandafter\refstepcounter\expandafter{\@captype alt}% Make reference
\@contcaption\@captype}
\makeatother
\begin{document}
Figures~\ref{fig1} and~\ref{fig2}.
\begin{figure}
\bicaption[fig1]{}{abc}{Fig.}{English caption}
\end{figure}
\begin{figure}
\bicaption[fig2]{}{xyz}{Fig.}{English caption}
\end{figure}
\end{document}


The above MWE provides the alias figurealt which should work in tandem with figure, using it as the replacement reference for the second (continued) caption rather than the traditional float counter.

A similar alias can be created for other floats (like table, using tablealt).

-
Wow, thank you very much for your quick response, though the solution is a little bit complicated than I thought. It works perfect. –  Ste Jul 18 '13 at 8:17