[tex-live] hyperref trouble with color and graphicx

Hironobu YAMASHITA h.y.acetaminophen at gmail.com
Fri Jun 26 07:48:01 CEST 2015


Hello,

I have some trouble with hyperref.sty when used at the same time with
graphicx.sty. The following LaTeX source can cause an error.
Please typeset using LaTeX + dvipdfmx.
(tiger.pdf can be obtained by converting tiger.eps with Ghostscript.)

----- test.tex -----
%#!latex -> dvipdfmx
\documentclass{article}
\usepackage[dvipdfmx,colorlinks=true,linkcolor=blue]{hyperref}
\usepackage[dvipdfmx]{graphicx}
\begin{document}
I will introduce an example of mathematical beauty.
\begin{equation}
  e^{i \pi} + 1 = 0 \label{eq1}
\end{equation}
Equation (\ref{eq1}) is called ``Euler's identity.''

Sample image here:
\includegraphics[width=3ex]{tiger} % tiger.pdf (extension implicit)
%\includegraphics[width=3ex]{tiger.pdf} % tiger.pdf
Tiger!
\end{document}
----- End of test.tex -----

The error message is:
----------
./test.tex:12: LaTeX Error: File `tiger' not found.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.12 \includegraphics[width=3ex]{tiger}
                                        % tiger.pdf
?
----------

However,
* When "colorlinks" option is removed, test.tex causes no error.
* When .pdf extension is given explicitly, test.tex causes no error.

I think this is because "dvips.def" is loaded internally by color.sty
without driver option, and overloads "dvipdfmx.def" which has been
already loaded by graphicx.sty. This problem can be fixed:

l.2974 in "hyperref.sty" (2012/11/06 v6.83m)
----------
\DeclareVoidOption{dvipdfmx}{%
  \HyOpt at CheckDvi{dvipdfmx}{%
    \def\Hy at driver{hdvipdfm}%
    \PassOptionsToPackage{dvipdfmx}{color}% <- Add this line!
  }%
}
----------

This will solve all the unexpected results coming from conflict
between two drivers.
I hope this information helps improve hyperref package.
Regards,

Hironobu Y
​AMASHITA

h.y.acetaminophen at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/tex-live/attachments/20150626/ce4205a5/attachment.html>


More information about the tex-live mailing list