
MWE 是:
% !TeX program = XeLaTeX
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\section{\^e\%}
\section{20\%}
\end{document}
它可以在 pdfLaTeX 和 LuaLaTeX 下正常工作。但是在XeLaTeX下出現錯誤:
(./mwe.out)
Runaway argument?
{ê\BOOKMARK [1][-]{section.2}{20\045}{}
! File ended while scanning use of \@@BOOKMARK.
<inserted text>
\par
l.5 \begin{document}
?
(./mwe.out)
Runaway argument?
{ê\BOOKMARK [1][-]{section.2}{20\045}{}
! File ended while scanning use of \@@BOOKMARK.
<inserted text>
\par
l.5 \begin{document}
?
\@outlinefile=\write3
\openout3 = `mwe.out'.
我可以看到書籤輔助文件(mwe.out)是
\BOOKMARK [1][-]{section.1}{ê%}{}% 1
\BOOKMARK [1][-]{section.2}{20\045}{}% 2
我認為這是由於%
第一中的第一\BOOKMARK
。在XeLaTeX下如何避免它?
答案1
載入bookmark
包裹反而;它提供了更新的書籤參考:
\documentclass{article}
\usepackage{bookmark}
\begin{document}
\section{\^e\%}
\section{20\%}
\end{document}
bookmark
負載hyperref
(看我應該先加載哪個包:hyperref
或者bookmark
?)