It appears that a % together with some non-ASCII characters on a heading is causing problems for hyperref in xelatex. Here's a minimal working example:
\documentclass[]{article}
\usepackage{hyperref}
\begin{document}
\section{\%á}
\end{document}
It goes through with pdflatex but balks when running under xelatex in a second invocation. The error message is:
Runaway argument?
{
! File ended while scanning use of \@@BOOKMARK.
<inserted text>
\par
l.3 \begin{document}
This is noticed when try to convert a CJK markdown document into LaTeX/PDF using pandoc. See pandoc-discussion.
If this a bug? And suggestions of workaround would be much appreciated.
hyperref
with theunicode
option or loadingbookmark
solves the issue. – egreg Jun 6 '16 at 7:14\HyPsd@SanitizeForOutFile
(in hxetex.def) also take care of the percentchar. You should report it at github.com/ho-tex/hyperref/issues. – Ulrike Fischer Jun 6 '16 at 8:08\edef\temp{\%á} \section{\temp}
Interestingly, it works until I insert the line\usepackage[utf8]{inputenc}
. Even more interestingly, it works, if I substitute utf8 with latin9. Can you explain this (shortly)? – MaestroGlanz Jun 6 '16 at 8:35inputenc
,á
is just a character (or a pair of characters if the file is UTF-8 encoded); withinputenc
it depends on the encoding: with Latin-9 it is an active character expanding to a character, with UTF-8 the two (active) characters don't survive\edef
. – egreg Jun 6 '16 at 8:40