# Multiple use of figure number, ext4 warning

I'm getting the warning message:

C:/Users/User/AppData/Local/MiKTeX/2.9/pdftex/config/pdf
tex.map}pdfTeX warning (ext4): destination with the same identifier (name{figur
e.0.1}) has been already used, duplicate ignored


MWE:

\documentclass{book}
\usepackage{graphicx}
\usepackage{float}

\makeatletter
\def\figcaption{%
\refstepcounter{figure}%
\@dblarg{\@caption{figure}}}
\makeatother

\usepackage{hyperref}

\begin{document}

\begin{figure}[H]%
\begin{center}%
\includegraphics{example-image}
\figcaption{Main window}
\end{center}%
\end{figure}%

\end{document}


I saw some similar issues, but couldn't find a solution. How to fix figcaption so the warning is gone?

(Note the problem is based on / due to the fix required for (I cannot remember seeing a problem at that time):

and based on

).

First of all it's not clear to me why you are using \figcaption inside a figure. Why not use \caption?

Regarding your problem: The hyperref package patches \caption so \H@refstepcounter is used instead of \refstepcounter. Your \figcaption misses that patch:

\documentclass{book}
\usepackage{graphicx}
\usepackage{float}

\makeatletter
\def\figcaption{%
\H@refstepcounter{figure}%
\@dblarg{\@caption{figure}}}
\makeatother

\usepackage{hyperref}

\begin{document}

\begin{figure}[H]%
\begin{center}%
\includegraphics{example-image}
\figcaption{Main window}
\end{center}%
\end{figure}%

\end{document}

• Thanks, I will check the results tomorrow. Just a small question on another question I was advised (@samcarter_is_at_topanswers.xyz) to use htbp instead of H, wil this have an influence on the \H@refstepcounter change? Oct 13 '20 at 19:34
• \H@refstepcounter is hyperrefs variant of \refstepcounter. There is no connection to the float placement H or htbp.
– user205700
Oct 14 '20 at 7:24
• OK thanks. A bit confusing in this case both times the H but it is logical. Oct 14 '20 at 7:57