4

I'm trying to disable the warning

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

using the silence package as suggested here: How do I get rid of particular pdftex warning message?

Example from the link above:

\documentclass{article}

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

\usepackage{silence}
\WarningFilter{pdftex}{destination with the same}

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

\begin{document}

\begin{lem}
Lemma
\end{lem}

\end{document}

The warning is not filtered. Using MiKTeX.

Edit: This example is purely illustrative, I have a completely different document that gives me headaches. It is huge, importing maybe 50-100 packages, so it is not feasible to get a MWE from it. And it involves figures, not theorems. What I want is not to alter the document, not to reorder \usepackage commands, but just to disable the warning. For this point the example above is enough.

Is there a way to do this? Either by using silence, something equivalent, or a latex build wrapper.

  • Those warning messages come from the engine, not by packages, so silence can do nothing with them. – egreg Mar 14 '15 at 11:28
  • You better solve the issue by loading amsthm between hyperref and cleveref. – egreg Mar 14 '15 at 11:34
  • This message indicates faulty links, so you should better try to correct the code. In most cases (amsthm is a special case) this can be easily done by defining or changing the relevant \Hcounter of hyperref. – Ulrike Fischer Mar 14 '15 at 15:00
5

You can't silence those warnings with the silence package, because they come directly from the pdftex engine and are not issued by packages. It's the same behavior as with Overfull \hbox warnings, that cannot be silenced.

You solve the issue by changing the loading order of packages:

\documentclass{article}

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

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

\begin{document}

\begin{lem}\label{x}
Lemma
\end{lem}

\newpage

\ref{x}

\cref{x}

\end{document}

Here's the transcript from the terminal

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./bogdanas.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 79 languages loaded.
(/usr/local/texlive/2014/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2014/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/usr/local/texlive/2014/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2014/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2014/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/local/texlive/2014/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2014/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/local/texlive/2014/texmf-dist/tex/latex/url/url.sty))

Package hyperref Message: Driver (autodetected): hpdftex.

(/usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/local/texlive/2014/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/local/texlive/2014/texmf-dist/tex/latex/amscls/amsthm.sty)
(/usr/local/texlive/2014/texmf-dist/tex/latex/cleveref/cleveref.sty)
(./bogdanas.aux)
(/usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./bogdanas.out) (./bogdanas.out) [1{/usr/local/texlive/2014/texmf-var/fonts/ma
p/pdftex/updmap/pdftex.map}] [2] (./bogdanas.aux) )</usr/local/texlive/2014/tex
mf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/local/texlive/2014/texm
f-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/local/texlive/2014/texmf-
dist/fonts/type1/public/amsfonts/cm/cmti10.pfb>
Output written on bogdanas.pdf (2 pages, 30387 bytes).
Transcript written on bogdanas.log.

You can also check that the links are correctly formed.

  • The code that gives me headaches is completely different, and involves figures, not theorems. It uses maybe 50-100 packages. I cannot get a MWE from that. but the point is illustrated by the example above. – Desik Mar 14 '15 at 12:06
  • @DenisBogdanas Difficult to diagnose, without more information. – egreg Mar 14 '15 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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