[XeTeX] RTL paragraphs with XeTeX?
Jonathan Kew
jfkthame at googlemail.com
Fri Jul 1 18:11:12 CEST 2011
On 1 Jul 2011, at 16:17, Petr Tomasek wrote:
> Ok, I found, that the following sort-of does:
>
> -----------------------------------------
> \parfillskip=0pt\parindent=0pt
> \leavevmode\beginR \hskip 8em Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris luctus accumsan vulputate. Vivamus vel lacus nunc, a dictum lacus. Duis rutrum, odio blandit dapibus facilisis, ipsum neque vestibulum ligula, ut vulputate leo nisl eget dolor. Donec luctus consequat porta. Duis tristique elit in sapien vulputate non pulvinar felis interdum. Praesent auctor eleifend sollicitudin. In hac habitasse platea dictumst. Donec congue congue interdum. Suspendisse vel dictum nulla. Nullam sit amet mi ut libero blandit scelerisque.\hskip 3em plus 1fil\nobreak\hbox{}\break\endR
> \par
Don't put all that stuff at the end of the paragraph! For a standard RTL paragraph, you want to still be in RTL mode when the \par is encountered.
So, try:
\noindent \beginR \indent Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris luctus accumsan vulputate. Vivamus vel lacus nunc, a dictum lacus. Duis rutrum, odio blandit dapibus facilisis, ipsum neque vestibulum ligula, ut vulputate leo nisl eget dolor. Donec luctus consequat porta. Duis tristique elit in sapien vulputate non pulvinar felis interdum. Praesent auctor eleifend sollicitudin. In hac habitasse platea dictumst. Donec congue congue interdum. Suspendisse vel dictum nulla. Nullam sit amet mi ut libero blandit scelerisque.\par
Or just precede a series of paragraphs with:
\everypar={\setbox0=\lastbox \beginR \box0 }
for automatic RTL-ness. (Explanation: \lastbox is used to retrieve the box that was inserted for the original automatic (LTR) paragraph indent; then after switching directionality, we put it back again so as to get the indent at the right end.)
JK
More information about the XeTeX
mailing list