Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm getting an "improper alphabetic constant" error in xelatex which appears to be due to an interaction between the bidi and hyperref packages, when I redefine the \section cmd. Here's an MWE:

\documentclass{report}
\usepackage[unicode]{hyperref}
\usepackage{bidi} %Must be loaded after hyperref pkg
\makeatletter
\renewcommand\section{\@startsection{section}{1}{0pt}{0pt}{0pt}{}}
\makeatother
\begin{document}
\section{\RL{foo}}
\RL{bar}
\end{document}

It's important that the text \RL{bar} be the first non-whitespace after the \section{}, otherwise the error is not triggered.

I've checked the suggested "Similar Questions," and don't see anything quite like this.

Suggestions?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I do not think, you need to pass unicode option to hyperref package with XeTeX engine. So with the following example:

\documentclass{report}
\usepackage{hyperref}
\usepackage{bidi} %Must be loaded after hyperref pkg
\makeatletter
\renewcommand\section{\@startsection{section}{1}{0pt}{0pt}{0pt}{}}
\makeatother
\begin{document}
\section{\RL{foo}}
\RL{bar}
\end{document}

I get no error (using Updated TeXLive 2012) but one related warning which is due to the use of \RL macro inside \section:

Package hyperref Warning: Token not allowed in a PDF string (Unicode):
(hyperref)                removing `\RL' on input line 9.

For details see page 19 of hyperref manual, under Replacement macros subsubsection.

To get rid off this warning, you can change your example into:

\documentclass{report}
\usepackage{hyperref}
\usepackage{bidi} %Must be loaded after hyperref pkg
\makeatletter
\renewcommand\section{\@startsection{section}{1}{0pt}{0pt}{0pt}{}}
\makeatother
\begin{document}
\section{\texorpdfstring{\RL{foo}}{foo}}
\RL{bar}
\end{document}

and if you do not like \texorpdfstring, you can try:

\documentclass{report}
\usepackage{hyperref}
\usepackage{bidi} %Must be loaded after hyperref pkg
\makeatletter
\renewcommand\section{\@startsection{section}{1}{0pt}{0pt}{0pt}{}}
\pdfstringdefDisableCommands{%
\let\RL\@firstofone
}
\makeatother
\begin{document}
\section{\RL{foo}}
\RL{bar}
\end{document}
share|improve this answer
    
Odd, I had tried it without the [unicode] arg to hyperref first (and re-tried that just now), but I get the same error. I'm running the TexLive 2011 version, I must have missed the 2012 update! –  Mike Maxwell Oct 26 '12 at 14:11
    
Thanks for the fixes--both work with 2011, although I'm now in the process of updating our installation to 2012, so maybe I won't need them :-). –  Mike Maxwell Oct 26 '12 at 20:42
    
We updated to the 2012 version, but I still get my original error msg ("improper alphabetic constant"), rather than the one you get about '\RL' not being allowed. I guess you have some files that have been updated since TeXLive 2012 came out. Can you explain the effect of omitting the \RL command (which IIUC is what the \pdfstringdefDisableCommands{} that you give is doing)? I would have thought it would mean that Arabic script comes out left-to-right in bookmarks, but I can't see any diff in the output. –  Mike Maxwell Oct 30 '12 at 17:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.