0

I insert an english fragment into arabic text. If there is a comma after a digit, I get surprising result. The comma goes before the number, not after.

enter image description here

The font above is "Amiri". I tested also "arabtype.ttf" from Microsoft (http://www.microsoft.com/typography/OpenTypeDev/arabic/intro.htm) and got the same result. Therefore I consider it is not a bug, but some important feature.

Question 1, not important, just for curiosity: where can I read about this feature?

A general solution is to somehow remove script=arabic from font for LTR texts. I suspect it is a hard task.

An easy solution for this concrete problem is to add \hbox{} after the number. Then:

The question 2: are there other surprises for english text fragments when using script=arabic?

Sample code:

\documentclass[a4paper]{article}
\usepackage[RTLdocument]{bidi}

\begin{document}

\font\f="Amiri:script=arabic"
\f

\LRE{Print 42, then exit, but not.}

\LRE{Print 42: then exit: but not.}


\end{document}
  • Further special cases: 1) I should also add \hbox{} before the number 2) Parenthesis are mirrored 3) I stopped here and gave up. Now I do change fonts. Still, I'm happy to hear the answers. – olpa Dec 4 '14 at 9:03
2

You should use fontspec to select fonts and font features. You can change the script now using \addfontfeature{Script=Latin}.

To make things more convenient it is possible to renew \LRE:

\documentclass[a4paper]{article}
\usepackage{fontspec}
\setmainfont[Script=Arabic]{Amiri}

\usepackage[RTLdocument]{bidi}

\let\oldLRE\LRE
\renewcommand*{\LRE}[1]{\oldLRE{\addfontfeature{Script=Latin} #1}} % <-- Change script to latin within \LRE 

\begin{document}

   \LRE{Print 42, then exit, but not.}

   \LRE{Print 42: then exit: but not.}

\end{document}

Which gives you:

enter image description here

  • This is what exactly I wanted to avoid. In general case I don't know which fonts are in use. Therefore a good solution should somehow switch "script=Arabic" on and off. – olpa Dec 4 '14 at 9:01
  • 1
    In that case use \addfontfeature{Script=Latin}. I've updated my answer accordingly. – DG' Dec 4 '14 at 9:05

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.