5

I minimized it to the following snippet:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\section{\%н}
\end{document}

When I compile it:

xelatex test.tex

the first run compiles fine, but on the second run it complains:

Runaway argument?
{
! File ended while scanning use of \@@BOOKMARK.
<inserted text>
                \par
l.3 \begin{document}

If I remove either hyperref, or percent sign, or cyrillic char, it compiles fine. I observe this behavior only on TeXLive 2012 distribution - 2009 distribution works just fine.

What is the problem?

1 Answer 1

7

With that setting, the annotation written in the .out file is

\BOOKMARK [1][-]{section.1}{%н}{}% 1

where the problem is self evident: the "naked" % ends the line.

You have two workarounds available:

\usepackage[unicode]{hyperref}

that makes the following annotation

\BOOKMARK [1][-]{section.1}{\376\377\000\045\004\075}{}% 1

thus avoiding the problem. The second workaround is

\usepackage{hyperref}
\usepackage{bookmark}

This seems better, because the bookmark package better manages bookmarks.

3
  • With the first workaround, I get ** WARNING ** Failed to convert input string to UTF16.... Second workaround works fine, but is a bit strange - since I don't work with bookmarks, just with simple links.
    – Rogach
    Commented Jun 2, 2013 at 12:24
  • @Rogach The warning can be safely ignored. If you don't need bookmarks, you can pass the option bookmarks=false to hyperref (they are enabled by default).
    – egreg
    Commented Jun 2, 2013 at 12:28
  • adding \usepackage{bookmark} helped me, thanks! Commented May 20, 2017 at 12:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .