[XeTeX] Syriac: Text Direction

Jonathan Kew jonathan_kew at sil.org
Sun Apr 29 12:48:28 CEST 2007

On 28 Apr 2007, at 9:36 pm, Thomas Thackery wrote:

> Thank you for the help.  The "Script=" solved the vowel and  
> connection issues.  The last remaining bit is to get it to display  
> right-to-left; i.e., each word is written correctly, but the  
> sentence as a whole is written in the wrong direction.  In the  
> attached example, the text on top (from Accordance) correctly shows  
> the RTL.  The bottom example, from Xe(La)Tex; displays improperly  
> from left-to-right.

As others have also noted, you need to use the direction control  
primitives (from e-TeX -- see the e-TeX reference manual for details)  
to set the text direction. Within each word, the inherent  
directionality of the Unicode characters means they'll be correct,  
but the sequence of words will depend on the current line direction,  
controlled by \beginL, \endL, \beginR, \endR.

In simple cases, you just need to introduce \beginR at the start of  
each paragraph; one way to do this in plain XeTeX is to use \everypar:

   \everypar = {\setbox0=\lastbox % save the paragraph indent (if any)
                \beginR % set the direction to RTL
                \box0 % then restore the indent

You also need to set \TeXXeTstate=1 at the start of your document, to  
enable the direction commands.

This may also work in XeLaTeX, but \everypar is liable to be  
overwritten by various LaTeX environments, etc. You might want to  
look at François Charette's ArabXeTeX package (announced recently on  
this mailing list) to see what it does about controlling direction; I  
expect it's much more fully integrated with LaTeX features.


More information about the XeTeX mailing list