hyperref icon indicating copy to clipboard operation
hyperref copied to clipboard

destination names with parentheses are not correctly escaped on the dvips route

Open u-fischer opened this issue 5 years ago • 0 comments

Related: https://tex.stackexchange.com/a/539499/2388

\documentclass{article}
\usepackage{l3pdf}
\ExplSyntaxOn
\pdf_uncompress:
\ExplSyntaxOff

\usepackage{hyperref}
\renewcommand\theHsection{\alph{section})}
\begin{document}
\tableofcontents
\section{sectiontoc)}
Some text
\end{document}  

After compilation with latex + dvips + ps2pdf

In the postscript all parentheses are escaped in the same way:

SDict begin [/View [/XYZ H.V]/Dest (section.a\)) cvn /DEST pdfmark end

SDict begin [/Subtype /Link/Dest (section.a\)) cvn/H /I/Border [0 0
1]BorderArrayPatch/Color [1 0 0] H.B /ANN pdfmark end

SDict begin [/Count -0/Dest (section.a\)) cvn/Title (sectiontoc\))
/OUT pdfmark end

but in the pdf the escaping in the name tree is wrong:

<<
/Limits [
(Doc-Start)
(section.a))    %<----------- missing \
]
/Names [
(Doc-Start) 9 0 R
(page.1) 6 0 R
(section*.1) 10 0 R
(section.a)) 19 0 R] %<-------- missing \
>>

The bookmark entry looks ok (apart from a ascii 0 which prevents copy&paste.

The question is if this is a ghostscript bug or if hyperref would have to escape the string differently.

u-fischer avatar Apr 19 '20 18:04 u-fischer