I could not be bothered looking through lineno.sty to see what setups they
have so this is another quick/dirty fix. The problem is that in the
definition of \MakeLineNo, they use \sbox, \sbox itself uses
\s...@color.bidi changes the definition of \set@colorwhen color/xcolor
package is loaded such that in the definition of \sbox at
the beginning of \hbox, you get \beginR, and at the end of \hbox, you get
\endR, that is, it makes \hbox and consequently \sbox RTL in RTL mode.
lineno setup for right linenumbers expect that \hbox or \sbox to be an LTR
one. Well, it can be RTL but you need to reverse the process (putting
\hskips, etc) I did not have time to look through the whole lineno.sty so
instead I used \setbox instead \sbox so it fixes the problem. Replace the
previously given code by this one:

 \makeatletter

\@ifpackageloaded{color}{%

\def\MakeLineNo{%

\@LN@maybe@normalLineNumber % v4.31

\boxmaxdepth\maxdimen\setbox\z@\vbox{\unvbox\@cclv}%

\@tempdima\dp\z@ \unvbox\z@

\setbox\@tempboxa=\hbox to \z@{\makeLineNumber}%

\stepLineNumber

\ht\@tempboxa\z@ \@LN@depthbox

\@LN@do@vadjusts

\count@\lastpenalty

\ifnum\outputpenalty=-\linenopenaltypar

\ifnum\count@=\z@ \else

\xdef\@LN@parpgbrk{%

\penalty\the\count@

\global\let\noexpand\@LN@parpgbrk

\noexpand\@LN@screenoff@pen}% v4.4

\fi

\else

\@tempcnta\outputpenalty

\advance\@tempcnta -\linenopenalty

\penalty \ifnum\count@<\@tempcnta \@tempcnta \else \count@ \fi

\fi

}}{}

\makeatother

--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex

Reply via email to