XeLaTeX 下 PDF 書籤中 \% 的問題

XeLaTeX 下 PDF 書籤中 \% 的問題

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

相關內容