I am writing a book in Persian but text in Latin scripts is scattered all over the book.
I have to wrap every Latin script with \lt{}
to guide xetex to align words from left to right. It's really cumbersome.
If I do not use \lr{} output of One Two Three
will be Three Two One
in Persian documents and the output of یک دو سه
will be سه دو یک
in English documents.
This is a very basic requirement and I wonder why xetex can not do it without extra markup.
Is there any way for not using \lr{}
Best Answer
To start it, this is not as basic as you claim it to be. You may be able to do it with using
\XeTeXinterchartoks
primitive of XeTeX. Aan example:The following was a response of Jonathan Kew (the author of XeTeX) to me a while ago, I just modified his example to work with XePersian:
In Addition, LR and RL scripts share some characters. So for example, how would you be able to decide if ) or ( is a RL chracter or an LR one?
Alternatively, you may be able to implement a preprocessor (written in C or any other language) that converts say, test.tex to test1.tex and places all LR words inside \lr. Actually
BiDiTeX
exists so you may be able to get its sources and modify it a bit to work with bidi/XePersian packages.