How can I insert LTR script directly within RTL text without cumbersome markup? (consider a Language learning book. )

What is most clean method to write following texts?

Aa bb cc ااا ببب تتت dd ee ff.


ااا ببب ثثث aa bb cc تتت خخ.

If I do not use extera markup the output of One Two Three will be Three Two One in RTL document and output of یک دو سه will be سه دو یک‍‍ in LTR documents.

also see: LTR sequences within RTL text - alternative to cumbersome markup?

  • The bidi package offers you this possibility through commands to typeset short LTR text inside RTL paragraphs and viceversa. – Gonzalo Medina Jul 25 '12 at 4:49
  • @GonzaloMedina As mentioned above I want use no extra command, mixing up RTL and LTR text in all other environment is displayed corrctily without any markup (Notepad, HTML, ...) – PHPst Jul 25 '12 at 5:12
  • Didn't you ask this question already? tex.stackexchange.com/questions/54320/…. What's wrong with the answer you got there? – Ulrike Fischer Jul 25 '12 at 6:25
  • @UlrikeFischer That answer do not work (as mentioned in its comment) also this question is in general and that question was about XePersian – PHPst Jul 25 '12 at 8:36
  • 1
    Then you should add a link to the older question and explain what's wrong with it so that people don't start from scratch again. – Ulrike Fischer Jul 25 '12 at 9:03

No, you can’t. XeTeX processes each word in isolation and does not apply the BiDi algorithm to the whole paragraph. It is possible to use interchar classes to do very primitive BiDi processing, but it is too limited to be reliable (because the nature of BiDi handling and the fact interchar classes were not meant for such use cases).

P.S. I have a Bidi algorithm implementation in Lua that I use with ConTeXt, but it is not very well tested beyond my personal documents and I stopped providing a LaTeX package for it.

  • That is not my experience, though. – Khaled Hosny Jul 27 '12 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.