Using the babel
package to write Hebrew text exposes incompatibilities with all sorts of other packages. This questions is about the incompatibility with hyperref
.
Basically, you can't get links with right-to-left text. It's about the direction rather than the non-Latin language - somehow the link-start command is placed at the end due to some sort of reversal. The problem is described in Guy Rutenberg's blog, here.
Here's an MWEs for \cite
and \ref
:
\documentclass{article}
\usepackage[hebrew,english]{babel}
\usepackage{hyperref}
\begin{document}
\section{A section}
\label{mysection}
LTR English cite \cite{MYSRC}. And now in RTL Hebrew:
\selectlanguage{hebrew}
\cite{MYSRC}
\selectlanguage{english}
Let's refer to the current section:
\selectlanguage{hebrew}
\ref{mysection}
\begin{thebibliography}{MYSRC}
\bibitem[MYSRC01]{MYSRC}
The bibliography entry for MYSRC.
\end{thebibliography}
\end{document}
For both of these (and for \autoref
), you get:
! pdfTeX error (ext4): pdf_link_stack empty, \pdfendlink used without \pdfstart
link?.
\AtBegShi@Output ...ipout \box \AtBeginShipoutBox
\fi \fi
Notes:
- Vafa Khaligi's comment below may be useful in isolating the minimum offending code out of everything 'babel' does, although I can't say for sure.
- The blog entry I linked to has a workaround - which only works with xetex. Can it be adapted somehow?
- Stefan Kottwitz suggested a workaround which won a bounty on this question. But what I would really like is to make hyperref get such links correctly somehow.
pdflatex
on your document, you runxelatex
. I am not saying that change your document or use any XeTeX-specific packages but keep your original document (without modifying it) but instead runningpdflatex
on it, runxelatex
on it. – IRAN Nov 27 '11 at 2:33