[Tex/LaTex] Name clash, “\ifpdf is already defined” between JHEP3.cls and ifpdf.sty


You might be interested that there seems to be a clash between JHEP3.cls version 3.1.5 (from http://jhep.sissa.it/jhep/help/JHEP/TeXclass/tools_JHEPlog.html) and the ifpdf package. I think both packages use variable \ifpdf, which clashes.

When I compile:


\keywords{ble bel}

\begin{document} ble ble \end{document}

I get

Package ifpdf Error: Name clash, \ifpdf is already defined.

However, when I replace all \ifpdf in JHEP3.cls to \ifpddf, all \pdftrue to \pddftrue, and all \pdffalse to \pddffalse, it works fine!

I will also write to inform JHEP.

Including \let\ifpdf\relax (as suggested in Package ifpdf Error) does not help, because an error message like Extra \fi \begin{document} appears.

Do you have another/better idea, how to deal with this?

Best Answer

Yes, \ifpdf is defined both in the class file and in the package ifpdf that is loaded by graphics.cfg. Workaround:


Then \ifpdf will be overwritten by the class, but with a similar meaning (the class is wrong for negative numbers of \pdfoutput). But the warning of ifpdf is not triggered and the package will not be loaded again later, because the package is already loaded.