In my arabic environment the arabic numbers are mirrored. Minimal Example:

\definefont[Sheh][name:Scheherazade*arabic at 18pt]   
            \setupalign[r2l]\Sheh \startalignment [middle] #1 \stopalignment


إِنَّ مَثَلَ عِيسَىٰ عِندَ ٱللَّـهِ كَمَثَلِ ءَادَمَ خَلَقَهُ مِن تُرَابٍ ثُمَّ قَالَ لَهُ كُن فَيَكُونُ ﴿٥٩﴾

The verse-number is wrong, it shows 95, but it is 59 in the code.  

I think this is an effect of \setupalign[r2l], so how to fix this, that


is indeed interpreted as it is (59). Of course I could always mirror the numbers myself, but that would be not very suitable.

  • Have you tried \setupdirections[bidi=global]? – user22486 Oct 23 '12 at 10:41
  • Definetly a good step! But now in the above code, the number is out of the brackets. If we can fix this one, than we are done! – Mustafa Oct 23 '12 at 11:09
  • 2
    That is a bug of ConTeXt. Write to the author of ConText. – user22486 Oct 23 '12 at 11:29

If I understand the subject correctly, Eastern numbers are written (1) left-to-right (2) big-endian (the thousands digit is entered before the hundreds digit). They are written this way in input, and typeset the same way in output.

Your problem, again if I understand the mechanics correctly, is that ConTeXt, either by intention or by omission, does not automatically recognise numbers in the text, and therefore typesets them r2l like the rest of the text.

This might solve your problem:



This solution does not suffice if you want to typeset mathematics r2l and typeset the numbers in the maths l2r. This seems to be a difficult problem: see

I personally think that if one could set up the \digits command for this, that command would be a better fit than \math. \digits semantically corresponds to numbers, whereas \math semantically corresponds to mathematics. Something like this would be nice:



٥٩, not ٩٥.

May I ask that you sign up to the ntg-context mailing list and ask your question again there? Hans Hagen, the main developer, is on that list; and I believe Khaled Hosny and/or Idris Hamid are, too. You will get an authoritative answer, and then we can amend this answer for the benefit of future visitors of this site.

  • 1
    At the moment I do not want to typeset both. But your solution does not work for me \environment arab-besser-sty \setupmathematics[align=l2r] \starttext \Arab[\math{٥٩}] \stoptext This does not print any number at all. Thank you for your suggestion with the mailing list, I will sign up there in a few days. – Mustafa Oct 19 '12 at 7:31
  • Did you manage to solve your problem, in the end? – Esteis Jun 5 '13 at 13:45

Source: https://wiki.contextgarden.net/RTL

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.