[XeTeX] Problems with hyperref and bidi

Khaled Hosny khaledhosny at eglug.org
Sun Apr 27 04:38:38 CEST 2008


On Sat, Apr 26, 2008 at 10:35:42PM +0100, Jonathan Kew wrote:
> On 26 Apr 2008, at 8:58 pm, Khaled Hosny wrote:
> 
> > On Sat, Apr 26, 2008 at 11:19:24AM +1000, Ross Moore wrote:
> >> 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
> >> [1
> >>
> >> ** 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.
> >>
> >
> > Reading the bidi package documentation again
> > (http://www.ctan.org/tex-archive/macros/xetex/latex/bidi/bidi.pdf)
> > It is mentioned that the color commands doesn't work properly with RL,
> > though the package redefine \textcolor command, it doesn't work with
> > hyperref. This thread is related too
> > http://listserv.tau.ac.il/cgi-bin/wa? 
> > A2=ind0404&L=ivritex&D=0&T=0&P=268,
> > though non of the mentioned workarounds seem to affect hyperref.
> 
> 
> I think all this is related to the basic problem that when the TeX-- 
> XeT bidi mechanism is used, horizontal lists get reversed before  
> output. This means that when you have \special commands in the line,  
> their order also gets reversed. So if the text contains a \special  
> that in some way implements "begin a link" or "set a new color", and  
> later in the same line there's "end link" or "pop the color stack",  
> the DVI driver ends up seeing these in the opposite order.
 

Thanks for the clarification.

> I submitted the original message in this thread to the XeTeX bug  
> tracker at <http://sourceforge.net/tracker/? 
> group_id=194926&atid=951385>, as I think it's an issue that can't  
> easily be solved at the level of individual documents or macro  
> packages. You may be able to work around some of the problems, but a  
> general solution will need to be implemented at a more fundamental  
> level.
 
I would have submitted this bug myself (doing my community homework :),
but I wasn't sure if this is a bug or misconfiguration from my side.

Lets hope the issue won't be so fundamental to be fixed.

Thanks,
 -Khaled

> JK
> 
> _______________________________________________
> XeTeX mailing list
> postmaster at tug.org
> http://tug.org/mailman/listinfo/xetex

-- 
 Khaled Hosny
 Arabic localizer and member of Arabeyes.org team
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://tug.org/pipermail/xetex/attachments/20080427/f3e050ca/attachment.bin 


More information about the XeTeX mailing list