Dear All, Hello, I am trying to use Persian digits in math formulas. My document reads: \font\4 = {name:dejavusans} at 10pt \font\5 = {name:dejavusans} at 7pt \font\6 = {name:dejavusans} at 5pt \textfont4=\4 \scriptfont4=\5 \scriptscriptfont4=\6 \Umathcode`3="1"4`۳ \definefontfeature [persian] [arabic] \mainlanguage[pe] \starttext \definedfont[dejavusans*persian] \setupalign[r2l] این یک آزمایش است. 3+2=5 $3+2=5$ \setupalign[l2r] This is a test. 3+2=5 $3+2=5$ \stoptext However in the output the replaced digit "3" disappears. Any help is gratefully appreciated. Thanks, Mingranina
On 8/15/2013 4:22 PM, Mingranina Gingranina wrote:
Dear All, Hello,
I am trying to use Persian digits in math formulas. My document reads:
\font\4 = {name:dejavusans} at 10pt
\font\5 = {name:dejavusans} at 7pt
\font\6 = {name:dejavusans} at 5pt
\textfont4=\4 \scriptfont4=\5 \scriptscriptfont4=\6
\Umathcode`3="1"4`۳
\definefontfeature [persian] [arabic]
\mainlanguage[pe]
\starttext
\definedfont[dejavusans*persian]
\setupalign[r2l]
این یک آزمایش است.
3+2=5
$3+2=5$
\setupalign[l2r]
This is a test.
3+2=5
$3+2=5$
\stoptext
However in the output the replaced digit "3" disappears. Any help is gratefully appreciated.
For a text font you can add: \definefontfeature [persian-fake-math] [arabic] [anum=yes] and say: \definedfont[dejavusans*persian-fake-math] but ... nicer is this: \mainlanguage[pe] \usetypescriptfile[dejavu] \definetypeface [dejavu] [rm] [serif] [dejavu] [default] \definetypeface [dejavu] [ss] [sans] [dejavu] [default] \definetypeface [dejavu] [tt] [mono] [dejavu] [default] \definetypeface [dejavu] [mm] [math] [xitsbidi] [default] [direction=both,rscale=1.2] \setuptypeface[dejavu] \starttext \start \setupalign[r2l] \setupmathematics[align=r2l] arabic: این یک آزمایش است. \par text: 3+2=5 \par math: $3+2=5$ $\sqrt{3+2=5}$ \par \stop \start \setupalign[l2r] \setupmathematics[align=l2r] latin: This is a test. \par text: 3+2=5 \par math: $3+2=5$ $\sqrt{3+2=5}$\par \stop \stoptext (see bidi-001.tex in the test suite) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 8/15/13, Hans Hagen
On 8/15/2013 4:22 PM, Mingranina Gingranina wrote:
Dear All, Hello,
I am trying to use Persian digits in math formulas. My document reads:
\font\4 = {name:dejavusans} at 10pt
\font\5 = {name:dejavusans} at 7pt
\font\6 = {name:dejavusans} at 5pt
\textfont4=\4 \scriptfont4=\5 \scriptscriptfont4=\6
\Umathcode`3="1"4`۳
\definefontfeature [persian] [arabic]
\mainlanguage[pe]
\starttext
\definedfont[dejavusans*persian]
\setupalign[r2l]
این یک آزمایش است.
3+2=5
$3+2=5$
\setupalign[l2r]
This is a test.
3+2=5
$3+2=5$
\stoptext
However in the output the replaced digit "3" disappears. Any help is gratefully appreciated.
For a text font you can add:
\definefontfeature [persian-fake-math] [arabic] [anum=yes]
and say:
\definedfont[dejavusans*persian-fake-math]
but ... nicer is this:
\mainlanguage[pe]
\usetypescriptfile[dejavu]
\definetypeface [dejavu] [rm] [serif] [dejavu] [default] \definetypeface [dejavu] [ss] [sans] [dejavu] [default] \definetypeface [dejavu] [tt] [mono] [dejavu] [default] \definetypeface [dejavu] [mm] [math] [xitsbidi] [default] [direction=both,rscale=1.2]
\setuptypeface[dejavu]
\starttext
\start \setupalign[r2l] \setupmathematics[align=r2l] arabic: این یک آزمایش است. \par text: 3+2=5 \par math: $3+2=5$ $\sqrt{3+2=5}$ \par \stop
\start \setupalign[l2r] \setupmathematics[align=l2r] latin: This is a test. \par text: 3+2=5 \par math: $3+2=5$ $\sqrt{3+2=5}$\par \stop
\stoptext
(see bidi-001.tex in the test suite)
Dear Hans, Hello Thank you very much for your reply. A math formula In Persian language is exactly the same as in English language except that the digits should be written in Persian. So what I want to do is to replace the English digits with Persian digits in a math formula. However, with your code not only the formula is right aligned, but also the square root symbol is mirrored. By the way, I couldn't find "bidi-001.tex" on ConTeXt Site, would you please let me know where can I get it? Thanks, Mingranina The problem wi
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
On 2013–08–15 Mingranina Gingranina wrote:
By the way, I couldn't find "bidi-001.tex" on ConTeXt Site, would you please let me know where can I get it?
It's here: http://pragma-ade.com/context/latest/cont-tst.7z Marco
Am 15.08.2013 um 19:30 schrieb Mingranina Gingranina
By the way, I couldn't find "bidi-001.tex" on ConTeXt Site, would you please let me know where can I get it?
The file is part of Hans test suite you can find on his homepage: - http://pragma-ade.com/download-1.htm - http://pragma-ade.com/context/latest/cont-tst.7z Wolfgang
On 8/15/2013 7:30 PM, Mingranina Gingranina wrote:
On 8/15/13, Hans Hagen
wrote: On 8/15/2013 4:22 PM, Mingranina Gingranina wrote:
A math formula In Persian language is exactly the same as in English language except that the digits should be written in Persian. So what I want to do is to replace the English digits with Persian digits in a math formula. However, with your code not only the formula is right aligned, but also the square root symbol is mirrored.
Assuming that you use math consistently ... \starttypescript [mathdigits] [all] \resetfontfallback [mathdigits] \stoptypescript \starttypescript [mathdigits] [arabicindic] \definefontfallback [mathdigits] [dejavusansmono] [0x0660-0x0669] [check=yes,force=yes,offset=digitsnormal] \definefontfallback [mathdigits] [dejavusansmonobold] [0x0660-0x0669] [check=yes,force=yes,offset=digitsbold] \stoptypescript \starttypescript [mathdigits] [extendedarabicindic] \definefontfallback [mathdigits] [dejavusansmono] [0x06F0-0x06F9] [check=yes,force=yes,offset=digitsnormal] \definefontfallback [mathdigits] [dejavusansmonobold] [0x06F0-0x06F9] [check=yes,force=yes,offset=digitsbold] \stoptypescript % % in next beta: a few more ranges % % \starttypescript [mathdigits] [arabicindic,extendedarabicindic] % \resetfontfallback [mathdigits] % \definefontfallback [mathdigits] [dejavusansmono] [digits\typescripttwo] [check=yes,force=yes,offset=digitsnormal] % \definefontfallback [mathdigits] [dejavusansmonobold] [digits\typescripttwo] [check=yes,force=yes,offset=digitsbold] % \stoptypescript \usetypescript [mathdigits][arabicindic] \starttypescript [math] [xits] [name] \definefontsynonym[MathRoman][file:xits-math.otf][features=math\mathsizesuffix,goodies=xits-math,fallbacks=mathdigits] \stoptypescript \setupbodyfont[dejavu] \starttext $3+2=5 \quad \bf 3+2=5$ \stoptext I'm not sure yet how to organize such things in a predefined typescript. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 8/15/13, Hans Hagen
On 8/15/2013 7:30 PM, Mingranina Gingranina wrote:
On 8/15/13, Hans Hagen
wrote: On 8/15/2013 4:22 PM, Mingranina Gingranina wrote:
A math formula In Persian language is exactly the same as in English language except that the digits should be written in Persian. So what I want to do is to replace the English digits with Persian digits in a math formula. However, with your code not only the formula is right aligned, but also the square root symbol is mirrored.
Assuming that you use math consistently ...
\starttypescript [mathdigits] [all] \resetfontfallback [mathdigits] \stoptypescript
\starttypescript [mathdigits] [arabicindic] \definefontfallback [mathdigits] [dejavusansmono] [0x0660-0x0669] [check=yes,force=yes,offset=digitsnormal] \definefontfallback [mathdigits] [dejavusansmonobold] [0x0660-0x0669] [check=yes,force=yes,offset=digitsbold] \stoptypescript
\starttypescript [mathdigits] [extendedarabicindic] \definefontfallback [mathdigits] [dejavusansmono] [0x06F0-0x06F9] [check=yes,force=yes,offset=digitsnormal] \definefontfallback [mathdigits] [dejavusansmonobold] [0x06F0-0x06F9] [check=yes,force=yes,offset=digitsbold] \stoptypescript
% % in next beta: a few more ranges % % \starttypescript [mathdigits] [arabicindic,extendedarabicindic] % \resetfontfallback [mathdigits] % \definefontfallback [mathdigits] [dejavusansmono] [digits\typescripttwo] [check=yes,force=yes,offset=digitsnormal] % \definefontfallback [mathdigits] [dejavusansmonobold] [digits\typescripttwo] [check=yes,force=yes,offset=digitsbold] % \stoptypescript
\usetypescript [mathdigits][arabicindic]
\starttypescript [math] [xits] [name]
\definefontsynonym[MathRoman][file:xits-math.otf][features=math\mathsizesuffix,goodies=xits-math,fallbacks=mathdigits] \stoptypescript
\setupbodyfont[dejavu]
\starttext
$3+2=5 \quad \bf 3+2=5$
\stoptext
Dear Hans, Hello With the above code the digits are not changed to persian. For your information I have attached the source, log, and PDF files. Please note that I have changed '\setupbodyfont[dejavu] to \setupbodyfont[dejavusans] because the font 'dejavu' is not installed on my system. Thanks, Mingranina
Am 17.08.2013 um 09:57 schrieb Mingranina Gingranina
With the above code the digits are not changed to persian. For your information I have attached the source, log, and PDF files.
The following example from Hans worked in my system: \usetypescriptfile[mathdigits] \usetypescript [mathdigits] [xits-dejavu] [arabicindic] \setupbodyfont[dejavu] \starttext $3+2=5 \quad \bf 3+2=5$ \stoptext
Please note that I have changed '\setupbodyfont[dejavu] to \setupbodyfont[dejavusans] because the font 'dejavu' is not installed on my system.
The DejaVu fonts are shipped with your context installation and you can use them with \setupbodyfont[dejavu], when you write \setupbodyfont[dejavusans] context uses Latin Modern because there is no typeface with the name “dejavusans”. Wolfgang
On 8/17/13, Wolfgang Schuster
The following example from Hans worked in my system:
\usetypescriptfile[mathdigits]
\usetypescript [mathdigits] [xits-dejavu] [arabicindic]
\setupbodyfont[dejavu]
\starttext $3+2=5 \quad \bf 3+2=5$ \stoptext
Dear Wolfgang Schuster, Hello The above code works on my system too, but in text mode the digits are still in English.
The DejaVu fonts are shipped with your context installation and you can use them with \setupbodyfont[dejavu], when you write \setupbodyfont[dejavusans] context uses Latin Modern because there is no typeface with the name “dejavusans”.
Do you know in which files are these typefaces defined? I want to use them as sample files and define my own typefaces (if I can at all). Thanks Migranina
On 8/15/2013 7:30 PM, Mingranina Gingranina wrote:
On 8/15/13, Hans Hagen
wrote: On 8/15/2013 4:22 PM, Mingranina Gingranina wrote:
A math formula In Persian language is exactly the same as in English language except that the digits should be written in Persian. So what I want to do is to replace the English digits with Persian digits in a math formula. However, with your code not only the formula is right aligned, but also the square root symbol is mirrored.
In the next beta you can do this (bidi-006.tex): \usetypescriptfile[mathdigits] \usetypescript [mathdigits] [xits-dejavu] [arabicindic] \setupbodyfont[dejavu] \starttext $3+2=5 \quad \bf 3+2=5$ \stoptext Of course we need to add more combinations. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (4)
-
Hans Hagen
-
Marco Patzer
-
Mingranina Gingranina
-
Wolfgang Schuster