* Persian digits in math formulas @ 2013-08-15 14:22 Mingranina Gingranina 2013-08-15 15:39 ` Hans Hagen 0 siblings, 1 reply; 10+ messages in thread From: Mingranina Gingranina @ 2013-08-15 14:22 UTC (permalink / raw) To: ntg-context 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 ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Persian digits in math formulas 2013-08-15 14:22 Persian digits in math formulas Mingranina Gingranina @ 2013-08-15 15:39 ` Hans Hagen 2013-08-15 17:30 ` Mingranina Gingranina 0 siblings, 1 reply; 10+ messages in thread From: Hans Hagen @ 2013-08-15 15:39 UTC (permalink / raw) To: ntg-context 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 ----------------------------------------------------------------- ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Persian digits in math formulas 2013-08-15 15:39 ` Hans Hagen @ 2013-08-15 17:30 ` Mingranina Gingranina 2013-08-15 17:42 ` Marco Patzer ` (3 more replies) 0 siblings, 4 replies; 10+ messages in thread From: Mingranina Gingranina @ 2013-08-15 17:30 UTC (permalink / raw) To: mailing list for ConTeXt users On 8/15/13, Hans Hagen <pragma@wxs.nl> wrote: > 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 > ___________________________________________________________________________________ ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Persian digits in math formulas 2013-08-15 17:30 ` Mingranina Gingranina @ 2013-08-15 17:42 ` Marco Patzer 2013-08-15 17:43 ` Wolfgang Schuster ` (2 subsequent siblings) 3 siblings, 0 replies; 10+ messages in thread From: Marco Patzer @ 2013-08-15 17:42 UTC (permalink / raw) To: ntg-context 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 ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Persian digits in math formulas 2013-08-15 17:30 ` Mingranina Gingranina 2013-08-15 17:42 ` Marco Patzer @ 2013-08-15 17:43 ` Wolfgang Schuster 2013-08-15 20:50 ` Hans Hagen 2013-08-15 22:03 ` Hans Hagen 3 siblings, 0 replies; 10+ messages in thread From: Wolfgang Schuster @ 2013-08-15 17:43 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 360 bytes --] Am 15.08.2013 um 19:30 schrieb Mingranina Gingranina <mingranina@gmail.com>: > 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 [-- Attachment #1.2: Type: text/html, Size: 914 bytes --] [-- Attachment #2: Type: text/plain, Size: 485 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Persian digits in math formulas 2013-08-15 17:30 ` Mingranina Gingranina 2013-08-15 17:42 ` Marco Patzer 2013-08-15 17:43 ` Wolfgang Schuster @ 2013-08-15 20:50 ` Hans Hagen 2013-08-17 7:57 ` Mingranina Gingranina 2013-08-15 22:03 ` Hans Hagen 3 siblings, 1 reply; 10+ messages in thread From: Hans Hagen @ 2013-08-15 20:50 UTC (permalink / raw) To: ntg-context On 8/15/2013 7:30 PM, Mingranina Gingranina wrote: > On 8/15/13, Hans Hagen <pragma@wxs.nl> 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 ----------------------------------------------------------------- ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Persian digits in math formulas 2013-08-15 20:50 ` Hans Hagen @ 2013-08-17 7:57 ` Mingranina Gingranina 2013-08-17 12:38 ` Wolfgang Schuster 0 siblings, 1 reply; 10+ messages in thread From: Mingranina Gingranina @ 2013-08-17 7:57 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1: Type: text/plain, Size: 2384 bytes --] On 8/15/13, Hans Hagen <pragma@wxs.nl> wrote: > On 8/15/2013 7:30 PM, Mingranina Gingranina wrote: >> On 8/15/13, Hans Hagen <pragma@wxs.nl> 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 [-- Attachment #2: test-009.zip --] [-- Type: application/zip, Size: 8753 bytes --] [-- Attachment #3: Type: text/plain, Size: 485 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Persian digits in math formulas 2013-08-17 7:57 ` Mingranina Gingranina @ 2013-08-17 12:38 ` Wolfgang Schuster 2013-08-17 16:35 ` Mingranina Gingranina 0 siblings, 1 reply; 10+ messages in thread From: Wolfgang Schuster @ 2013-08-17 12:38 UTC (permalink / raw) To: mailing list for ConTeXt users Am 17.08.2013 um 09:57 schrieb Mingranina Gingranina <mingranina@gmail.com>: > 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 ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Persian digits in math formulas 2013-08-17 12:38 ` Wolfgang Schuster @ 2013-08-17 16:35 ` Mingranina Gingranina 0 siblings, 0 replies; 10+ messages in thread From: Mingranina Gingranina @ 2013-08-17 16:35 UTC (permalink / raw) To: mailing list for ConTeXt users On 8/17/13, Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote: > > 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 ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Persian digits in math formulas 2013-08-15 17:30 ` Mingranina Gingranina ` (2 preceding siblings ...) 2013-08-15 20:50 ` Hans Hagen @ 2013-08-15 22:03 ` Hans Hagen 3 siblings, 0 replies; 10+ messages in thread From: Hans Hagen @ 2013-08-15 22:03 UTC (permalink / raw) To: ntg-context On 8/15/2013 7:30 PM, Mingranina Gingranina wrote: > On 8/15/13, Hans Hagen <pragma@wxs.nl> 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 ----------------------------------------------------------------- ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-08-17 16:35 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-08-15 14:22 Persian digits in math formulas Mingranina Gingranina 2013-08-15 15:39 ` Hans Hagen 2013-08-15 17:30 ` Mingranina Gingranina 2013-08-15 17:42 ` Marco Patzer 2013-08-15 17:43 ` Wolfgang Schuster 2013-08-15 20:50 ` Hans Hagen 2013-08-17 7:57 ` Mingranina Gingranina 2013-08-17 12:38 ` Wolfgang Schuster 2013-08-17 16:35 ` Mingranina Gingranina 2013-08-15 22:03 ` Hans Hagen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).