[XeTeX] Arabic XeLaTeX sample

Jonathan Kew jonathan_kew at sil.org
Mon Jul 5 22:39:05 CEST 2004


On 5 Jul 2004, at 9:16 pm, Musa Furber wrote:

> %%%%%%%%%%%%%%%%%%%%%%
> %  for Arabic formatting
> %%%%%%%%%%%%%%%%%%%%%%
> % make paragraphs RTL instead of LTR
> \let\myeverypar\everypar
> \newtoks\everypar
> \everypar\expandafter{\the\myeverypar}
> \myeverypar{\the\everypar\beginR}
>
> % get rid of the paragraph indent, otherwise it will
> % appear on the LEFT hand side of the page, instead
> % of the right.
> \parindent=0pt
>

If you want to be able to use the paragraph indent, you can enhance the 
\everypar code slightly. What I typically use (in plain TeX, where I'm 
not concerned about other packages using \everypar without my 
knowledge) is:
	\everypar={\setbox0=\lastbox \beginR \box0 }
This works because a paragraph indent is created by inserting a \box at 
the start of the horizontal list for the paragraph, before \everypar is 
called. We just need to move that box so that it follows the \beginR, 
and all will be well.

I guess the equivalent in your example would be to replace:
	\myeverypar{\the\everypar\beginR}
with:
	\newbox\saveparindentbox
	\myeverypar{\setbox\saveparindentbox=\lastbox \the\everypar \beginR 
\box\saveparindentbox}
(better not just use \box0 in case \the\everypar includes something 
that messes with it).

Jonathan



More information about the XeTeX mailing list