[XeTeX] Please help me with \XeTeXinterchartoks

Ulrike Fischer news2 at nililand.de
Mon Dec 1 22:27:48 CET 2008

Am Mon, 1 Dec 2008 23:14:38 +1100 schrieb VAFA KHALIGHI:

> Human Beings..! Please help.
> I feel that when I ask a question on the mailing list no one answers it and
> I solve the problems most of the time myself but why?

In my case: partly because you sent only code snippets instead of small,
complete examples. 

> I want to set \XeTeXinterchartoks for small English sentenses in a Right to
> Left direction such that when I write an/Two English it will be typeset in
> rmfamily and from Left to Write. This is what I have done

And this is good example: a lot of incomplete code. 

> but when I write "This is" in a Right to left direction, I see that it is
> typeset in rmfamily but in the reverse order "is This", so can you please
> help me to get this done?

You get what is to be expected, the same result if you surround every
word by \beginL ... \endL:

\XeTeXinterchartokenstate = 1
\XeTeXcharclass `\a 5
\XeTeXcharclass `\r 6
\XeTeXcharclass `\t 7


\beginR begin \beginL art\endL\ \beginL arta\endL\ end \endR

\XeTeXinterchartoks 255 5={\beginL\begin{rmfamily}}
\XeTeXinterchartoks 5 255={\end{rmfamily}\endL}
\XeTeXinterchartoks 255 6={\beginL\begin{rmfamily}}
\XeTeXinterchartoks 6 255={\end{rmfamily}\endL}
\XeTeXinterchartoks 255 7={\beginL \begin{rmfamily}}
\XeTeXinterchartoks 7 255={\end{rmfamily}\endL}

\beginR begin art arta end \endR


> I am only asking for one example, please just show me how to do this for
> "This is".

I doubt that is is possible. You would have to be able to distinguish
spaces between english words from spaces between an english and a
non-english word. And even if you solve this problem. Are you sure that
there are not chars in both sets, e.g. punctuation symbols? 

Ulrike Fischer 

More information about the XeTeX mailing list