[XeTeX] Problems with hyperref and bidi

Ross Moore ross at ics.mq.edu.au
Sat Apr 26 03:19:24 CEST 2008

Hi Vafa, Khaled, and others.

On 26/04/2008, at 12:42 AM, VAFA KHALIGHI wrote:
> If you are producing a book or a report, then put these commands in  
> your preamble: (You can vary the hyperref options to meet your  
> needs or add anyother things)

> %%%%%%%%%%%%%%%%%%
> If you are producing an article, then put these commands in your  
> preamble:

> \makeatletter
> \renewcommand*\l at section[2]{%
> \ifnum \c at tocdepth >\m at ne
> \addpenalty{-\@highpenalty}%
> \vskip 1.0em \@plus\p@
> \setlength\@tempdima{1.5em}%
> \begingroup
> \parindent \z@ \rightskip \@pnumwidth
> \parfillskip -\@pnumwidth
> \leavevmode \bfseries
> \advance\leftskip\@tempdima
> \hskip -\leftskip
> #1\nobreak\hfil \nobreak\hb at xt@\@pnumwidth{\hss \textroman{#2}}\par

This is using the \textroman  command from  arabxetex.sty .

> \penalty\@highpenalty
> \endgroup
> \fi}
> \makeatother
> %%%%%%%%%%%%%%%%%%%%%%%%%%

If you don't use arabxetex.sty , or even if you do, then
also include a coding line here:

    \providecommand{\textroman}[1]{{\LR{\rmfamily #1}}}

which will give you this command if your packages don't
define it already.

But even with this, there are still some 'minor' problems.

Using  xdvipdfmx  as the xdv processor, I get warnings:

rossmoor% xdvipdfmx-0997 test.xdv
test.xdv -> test.pdf

** WARNING ** End color with no corresponding begin color.]

** WARNING ** Invalid CMap mapping entry. (ignored)

Using  xdv2pdf  (MacOS X only)  the messages are:

   *** rule color stack underflow

   *** text color stack underflow

Clearly there is an interaction with the color-stack mechanism
that isn't yet adapted to getting the order of the push/pop
correct within a  right-to-left setting.

To resolve this, it looks like the \LR cannot apply to just
the text of the hyperlink, but must also include the internal
color-commands that are placed by hyperref .
But this cannot be done globally, as there may be a legitimate
need for \RL text within the text of the anchor.

Surely someone has tackled this kind of difficulty already.

the only  /ToUnicode  CMap within the PDF
is associated with the   Scheherezade  font:

/DescendantFonts[7 0 R]
/ToUnicode 34 0 R

So there must be a problem in there somewhere.

While this doesn't affect the appearance of the font within the PDF,
it can affect searching and copying the text from this document.



Ross Moore                                       ross at maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114

More information about the XeTeX mailing list