# colored box hyperref error for latex->dvips->ps2pdf in tex live 2019

I am using tex live 2019, and I have a problem with hyperref.

The error does not happen when I use PDFLaTeX as shown in the first image.

However, when I use latex->dvips->ps2pdf, all citations and references are hidden with the colored box. (second image)

How can I solve this problem?

\documentclass[twocolumn, 10pt]{IEEEtran}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{cite}
\usepackage{stfloats}
\usepackage{subfigure}
\usepackage{epstopdf}
\usepackage{psfrag}
\usepackage[mathscr]{euscript}
\usepackage{acronym}
\usepackage{booktabs}
\usepackage[table]{xcolor}

\begin{document}
\begin{align}
A=B
\label{equation}
\end{align}
This is the equation \eqref{equation}.
\end{document}


Above is the code I used.

I am using TexStudio. So I compiled my code by:

Tools > Commands > LaTeX

Tools > Commands > DVI->PS

Tools > Commands > PS->PDF

• Welcome to TeX - LaTeX! Please show us the code for these examples. For example, in the second case did you pass the dvips option to hyperref? – Andrew Swann Jan 13 at 7:51
• I have edited the question! What do you mean by "passing the dvips option to hyperref" ? – He Won Cho Jan 13 at 8:42
• I can reproduce it (with a much smaller example), but I can't look now. – Ulrike Fischer Jan 13 at 8:42
• It is possible to write \usepackage[dvips]{hyperref} or \usepackage[ps2pdf]{hyperref}. Does either of these help? I can't reproduce your problem on my system. – Andrew Swann Jan 13 at 8:49
• If you are using dvips and ps2pdf then no need of epstopdf package – MadyYuvi Jan 13 at 8:58

Note: hyperref has been updated to detect the version of GhostScript being used by pstopdf and to use the appropriate code in each case. So the workaround described below is not needed (since January 2020 release of hyperref).

Ulrike in chat provided a simpler test case

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\url{www.abc.de}
\end{document}


which for me (with gs 9.27) produces

but with 9.50 produces

It turns out GhostScript changed its interpretation of the border specification at 9.50

http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=90bdf83d696562e4136b8f565cac06cc32b161ae

In the comments under the question Ulrike showed how to disable the code in hyperref but that makes things work in 9.50 but fail in any older release, the code below should I hope work with either way, it inserts a test on the gs release number that is implemented in PostScript so deferred until you run ps2pdf on the PostScript generated by dvips.

If anyone who tries this comments whether it works or doesn't work and which version of gs they have, that would be useful, thanks!

Save the code below as hdvips.def in the same folder as the test file (whole file provided as it is inconvenient to patch this)

%%
%% This is file hdvips.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% hyperref.dtx  (with options: dvips')
%%
%% File: hyperref.dtx Copyright 1995-2001 Sebastian Rahtz,
%% with portions written by David Carlisle and Heiko Oberdiek,
%% 2001-2012 Heiko Oberdiek.
%% 2016-2019 Oberdiek Package Suport Group
%% 2019 LaTeX3 Project
%%      https://github.com/latex3/hyperref/issues
%%
%% This file is part of the Hyperref Bundle'.
%% -------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status maintained'.
%%
%% The Current Maintainer of this work is the LaTeX3 Project.
%%
%% The list of all files belonging to the Hyperref Bundle' is
%% given in the file manifest.txt'.
%%
\ProvidesFile{hdvips.def}
[2019/11/10 v7.00c %
Hyperref driver for dvips + gs test]
\Hy@VersionCheck{hdvips.def}
\providecommand*{\XR@ext}{pdf}
\def\literalps@out#1{\special{ps:SDict begin #1 end}}%
\input{pdfmark.def}%
\ifx\@pdfproducer\relax
\def\@pdfproducer{dvips + Distiller}%
\fi
\providecommand*\@pdfborder{0 0 1}
\providecommand*\@pdfborderstyle{}
\providecommand*\@pdfview{XYZ}
\providecommand*\@pdfviewparams{ H.V}
\def\Hy@BorderArrayPatch{BorderArrayPatch}
/DvipsToPDF{72.27 mul Resolution div} def%
/PDFToDvips{72.27 div Resolution mul} def%
/BPToDvips{72 div Resolution mul}def
%%%%%
%%%%%
%%%%% START CHANGE
%if  using gs and release < 9.50 patch, otherwise make this a no-op
product (Ghostscript) search {pop pop pop  revision 950 lt } {pop false} ifelse
{
/BorderArrayPatch{%
[exch{%
dup dup type/integertype eq exch type/realtype eq or%
{BPToDvips}if%
}forall]%
}def
}{
/BorderArrayPatch{} def
}
ifelse
% end of gs version test
%%%
%%% END
%%%
/HyperBorder {1 PDFToDvips} def%
/H.V {pdf@hoff pdf@voff null} def%
/H.B {/Rect[pdf@llx pdf@lly pdf@urx pdf@ury]} def%
/H.S {%
currentpoint %
HyperBorder add /pdf@lly exch def %
dup DvipsToPDF 72 add /pdf@hoff exch def %
HyperBorder sub /pdf@llx exch def%
} def%
/H.L {%
2 sub dup%
/HyperBasePt exch def %
PDFToDvips /HyperBaseDvips exch def %
currentpoint %
HyperBaseDvips sub /pdf@ury exch def%
/pdf@urx exch def%
} def%
/H.A {%
H.L %
currentpoint exch pop %
vsize 72 sub exch DvipsToPDF %
HyperBasePt sub % baseline skip
sub /pdf@voff exch def%
} def%
/H.R {%
currentpoint %
HyperBorder sub /pdf@ury exch def %
HyperBorder add /pdf@urx exch def %
currentpoint exch pop vsize 72 sub %
exch DvipsToPDF sub /pdf@voff exch def%
} def%
}%
}
\AtBeginShipoutFirst{%
\ifHy@setpagesize
\begingroup
\@ifundefined{stockwidth}{%
\ifdim\paperwidth>\z@
\ifdim\paperheight>\z@
\special{papersize=\the\paperwidth,\the\paperheight}%
\fi
\fi
}{%
\ifdim\stockwidth>\z@
\ifdim\stockheight>\z@
\special{papersize=\the\stockwidth,\the\stockheight}%
\fi
\fi
}%
\endgroup
\fi
\Hy@DisableOption{setpagesize}%
}
\begingroup
\setlength{\dimen@}{#1}%
\literalps@out{%
/HyperBorder{\strip@pt\dimen@\space PDFToDvips}def%
}%
\endgroup
}
\endinput
%%
%% End of file hdvips.def'.
`
• Thus, it is a long-standing incompatibility of GS with Distiller that has been fixed eventually. Thanks! – AlexG Jan 14 at 7:56
• The issue has been resolved with the latest hyperref update. – Ulrike Fischer Jan 27 at 10:51
• @UlrikeFischer I'll add a note to the answer (feel free to edit answers if we fix things:-) – David Carlisle Jan 27 at 10:59