[XeTeX] Numerals in Right-to-Left

Otared Kavian otared at wanadoo.fr
Wed Nov 17 16:31:11 CET 2004


At 9:32 -0500 17/11/04, Jonathan Kew wrote:
>I suppose people might like an example of how this could be done. 
>Here's a possible approach:
>
>% - - - - - convert numbers to different digit sets - - - - -
>\font\x="Geeza Pro" at 12pt \x
>
>\def\translitnumber#1#2{%
>   % #1 -> the number to transliterate
>   % #2 -> unicode value of "zero" in the desired digit set
>   \begingroup
>   \count255=#2
>   \uccode`\0=\count255 \advance\count255 by 1
>   \uccode`\1=\count255 \advance\count255 by 1
>   \uccode`\2=\count255 \advance\count255 by 1
>   \uccode`\3=\count255 \advance\count255 by 1
>   \uccode`\4=\count255 \advance\count255 by 1
>   \uccode`\5=\count255 \advance\count255 by 1
>   \uccode`\6=\count255 \advance\count255 by 1
>   \uccode`\7=\count255 \advance\count255 by 1
>   \uccode`\8=\count255 \advance\count255 by 1
>   \uccode`\9=\count255
>   \edef\thenumber{#1}%
>   \expandafter\uppercase\expandafter{\thenumber}%
>   \endgroup}
>
>\def\arabicnumber#1{\translitnumber{#1}{"0660}}
>\def\persiannumber#1{\translitnumber{#1}{"06F0}}

Thanks a lot Jonathan! This is exactly what I wanted to know, but was 
afraid to ask...
I am writing a few macros for Plain XeTeX in order o use your 
suggestion in other situations (footnotes, section numbers and so on) 
for Persian (and Arabic). When they are clean I'll let know the 
community.

I imagine that there is more or less the same procedure in order to 
have Persian or Arabic numbers in math mode (the above command does 
not produce what is wanted).

Again thank you very much!
Best regards: OK




More information about the XeTeX mailing list