[Tex/LaTex] babel \L command reverses letters, inserts Ł symbol

babelcharactershyperrefright-to-left

It's time for Eyal's babel+Hebrew (or right-to-left) incompatibility of the week; and this time, it's hyperref again.

If you have:

\documentclass{article}
\usepackage[hebrew,english]{babel}
\usepackage{hyperref}
\begin{document}
\selectlanguage{hebrew}
מלל בעברית, \L{Some English within the Hebrew} ועוד עברית לאחר מכן.
\end{document}

You get the following:

Ł and reversed English text

if you use just babel without hyperref, you get the expected effect of \L:

English text appears properly

This is pretty easy to work around – but I just noticed it, I thought it was some weird part of my other babel+hyperref compatibility issue. Why would hyperref do this?

For those interested, here's some information about the Ł character.

Best Answer

Here's the obvious workaround:

\documentclass{article}
\usepackage[hebrew,english]{babel}
\usepackage{hyperref}
\def\L{\protect\pL}
\begin{document}
\selectlanguage{hebrew}
מלל בעברית, \L{Some English within the Hebrew} ועוד עברית לאחר מכן.
\end{document}

This is the definition of \L lifted from rlbabel.def. Alternatively, if you can remember not to use \L itself, don't re-define it, just use something like \def\babelL{\protect\pL}.