# How do I get rid of particular pdftex warning message?

Here is a minimal example that showcases my problem:

\documentclass{article}

\usepackage{amsthm}
\usepackage{hyperref}
\usepackage{cleveref}

\newtheorem{thm}{Theorem}
\newtheorem{lem}[thm]{Lemma}

\begin{document}

\begin{lem}
Lemma
\end{lem}

\end{document}


The warning I get is the following:

[1pdfTeX warning (ext4): destination with the same identifier (name{thm.1}) has been

\AtBegShi@Output ...ipout \box \AtBeginShipoutBox
\fi \fi
l.16 \end{document}
{<install dir>/MiKTeX/2.9/pdftex/config/pdftex.map}]


I know that it is just a warning and that, my document will still work perfectly fine with regards to cross-referencing and hyperlinking, but I would still like to know why I am getting this warning and if anything can be done to fix it without removing functionality of the included packages.

Bonus question: Whats going on behind the scenes when this warning (or any generic 'destination with the same identifier (name{XXX.YYY}) has been already used, duplicate ignored') is produced, as this is not limited to theorem environments.

From log file:

Package: amsthm 2004/08/06 v2.20
Package: hyperref 2011/04/17 v6.82g Hypertext links for LaTeX
Package: cleveref.sty 2011/03/22 v0.17.9 Intelligent cross-referencing
Package cleveref Info: hyperref' support loaded on input line 2157.
Package cleveref Info: amsthm' support loaded on input line 2300.

-

This is a known issue that is associated with hyperref and is discussed/answered in the UK TeX FAQ.

In answer to your "bonus question": This stems from the fact that you're using the same counter to reference two different things by virtue of

\newtheorem{thm}{Theorem}
\newtheorem{lem}[thm]{Lemma}


This tells LaTeX that you want a new environment called lem, labelled Lemma, but that is should use the same counter as the environment thm (with label Theorem). In essence, if you had used a thm before lem, then the appropriate counter increases would have occurred, eliminating the problem.

On a side note, specific to your minimal example: removing the cleveref package clears this pdfTeX warning. However, this may just be since you're trying to illustrate the problem.

If you feel like you want to get rid of all such warnings and that your "document will still work perfectly fine", you can stop pdfTeX from outputting them by using the silence package. For example, adding

\usepackage{silence}% Filter out unwanted warnings and error messages
\WarningFilter{pdftex}{destination with the same}% Remove all warnings issued by pdfTeX
% (as pdfTeX Warning: 'destination with the same'...)


to your document preamble will "silence" pdfTeX's warning starting with "destination with the same".

-
\usepackage{hyperref}