XeTeX 3.14159265-2.6-0.99992 (TeX Live 2015/dev/Debian) 中按 hyperref 命名的目的地已损坏

XeTeX 3.14159265-2.6-0.99992 (TeX Live 2015/dev/Debian) 中按 hyperref 命名的目的地已损坏

我们有这个测试用例,可以很好地与 pdflatex 配合使用

\documentclass[en]{article}
\usepackage[
 pdfauthor={Silly testcase maker},
 pdftitle=,
 pdfsubject=,
 ]{hyperref}

\newcommand{\pdfLabel}[1]{\hyperdef{marker}{#1}{}}

\begin{document}

Hello folks
\newpage
haha this is funny
\newpage
lets do another page
\newpage
now we have a working testcase for real huh
\newpage
but rly
this is the label \pdfLabel{hahalulz} that was the label
\newpage
but does it jump
\newpage
that is the question folks

\end{document}

目的是在 PDF 文档中定义一个名为 的目标marker.hahalulz。使用 debian squeeze 时,此功能可以与 xetex 配合使用,但现在使用 debian Jessy 时,无法与 xelatex 配合使用(但仍可与 pdflatex 配合使用),我们不知道原因是什么。

失败的症状是我们无法跳转到指定的目的地,例如使用命令

$ evince -n "marker.hahalulz" testcase.pdf

xelatex 的输出

This is XeTeX, Version 3.14159265-2.6-0.99992 (TeX Live 2015/dev/Debian) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./testcase.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 79 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/minimal.cls
Document Class: minimal 2001/05/25 Standard LaTeX minimal class
) (/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg)

Package hyperref Warning: XeTeX driver only supports unicode.
(hyperref)                Enabling option `unicode'.

(/usr/share/texlive/texmf-dist/tex/latex/hyperref/puenc.def)
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty))

Package hyperref Message: Driver (autodetected): hxetex.

(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hxetex.def
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/stringenc.sty)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(./testcase.aux)

Package hyperref Warning: Height of page (\paperheight) is invalid (0.0pt),
(hyperref)                using 11in.

(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./testcase.out) (./testcase.out) [1] [2] [3] [4] [5] [6] [7] (./testcase.aux) 
)
Output written on testcase.pdf (7 pages).
Transcript written on testcase.log.

答案1

dvipdfmx配置文件搜索Dvipdfmx Compatibility Flags,你可以看到:

%% Dvipdfmx Compatibility Flags
%%
%%   0x0002  Use semi-transparent filling for tpic shading command,
%%           instead of opaque gray color. (requires PDF 1.4)
%%   0x0004  Treat all CIDFont as fixed-pitch font.
%%           This is only for backward compatibility. Don't use that.
%%   0x0008  Do not replace duplicate fontmap entries.
%%           Dvipdfm's (not 'x') behaviour.
%%   0x0010  Do not optimize PDF destinations. Use this if you want to
%%           refer from other files to destinations in the current file.

%C  0x0000

在后面添加此行%C 0x0000,然后命名目的地将按预期工作:

C  0x0010

在 Windows 7 上使用 MiKTeX 2.9 进行了测试。对于 MiKTeX,最好编辑用户的配置文件dvipdfmx配置文件和:

initexmf --edit-config-file dvipdfmx

,并将该C 0x0010行添加到此文件中。

相关内容