ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Numerals in mkiv
@ 2009-04-17 21:08 Otared Kavian
  2009-04-18 12:15 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Otared Kavian @ 2009-04-17 21:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Hans,

It seems that Arabic or Persian numerals (for instance in section  
numbers) in mkiv begin at 0, instead of 1… well it is true that in  
Mathematics natural integers begin with 0, but not in books in those  
languages :-)
Here is a minimal example:

\setupdirections[bidi=global]
\pagedir TRT
\bodydir TRT
\pardir TRT
\textdir TRT

\starttypescript[serif][arabic]
\usetypescript[serif][fallback]
\definefontsynonym [Serif][name:SimpleNaskhi] [features=arabic]
\stoptypescript

\starttypescript  [arabic]
   \definetypeface [arabic][rm] [serif] [arabic]  [default]
\stoptypescript

\usetypescript[arabic]
\setupbodyfont[arabic,12pt]

%%%%%%%%%%%%%%%%%%
% heading numbers:
    \setuphead[section][conversion=persiannumerals]  
%,numberstyle={arabic}]
%%%%%%%%%%%%%%%%%%%

\starttext
\dorecurse{5}{%
\section{بخش}\par
آزمایش
}
\stoptext

Pardon me if I have been missing something already explained elsewhere.

Best regards: OK
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Numerals in mkiv
  2009-04-17 21:08 Numerals in mkiv Otared Kavian
@ 2009-04-18 12:15 ` Hans Hagen
  2009-04-18 14:06   ` Otared Kavian
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2009-04-18 12:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Idris Samawi Hamid

Otared Kavian wrote:
> Hi Hans,
> 
> It seems that Arabic or Persian numerals (for instance in section 
> numbers) in mkiv begin at 0, instead of 1… well it is true that in 
> Mathematics natural integers begin with 0, but not in books in those 
> languages :-)
> Here is a minimal example:
> 
> \setupdirections[bidi=global]
> \pagedir TRT
> \bodydir TRT
> \pardir TRT
> \textdir TRT
> 
> \starttypescript[serif][arabic]
> \usetypescript[serif][fallback]
> \definefontsynonym [Serif][name:SimpleNaskhi] [features=arabic]
> \stoptypescript
> 
> \starttypescript  [arabic]
>   \definetypeface [arabic][rm] [serif] [arabic]  [default]
> \stoptypescript
> 
> \usetypescript[arabic]
> \setupbodyfont[arabic,12pt]
> 
> %%%%%%%%%%%%%%%%%%
> % heading numbers:
>    \setuphead[section][conversion=persiannumerals] %,numberstyle={arabic}]
> %%%%%%%%%%%%%%%%%%%
> 
> \starttext
> \dorecurse{5}{%
> \section{بخش}\par
> آزمایش
> }
> \stoptext
> 
> Pardon me if I have been missing something already explained elsewhere.

it all depends how we define conversions

- numeric (1,2,3,4)
- alphabetic (a,b,c,d)

numeric is used in chapter numbering and alphabetic for instance in 
itemized (ok, all can be used everywhere but those are most common)

so, the question is ... how do we define the commands ... maybe we need:


\def\abjadnumerals     #1{\ctxlua{converters.abjadnumerals(\number#1)}}
\def\abjadnodotnumerals#1{\ctxlua{converters.abjadnodotnumerals(\number#1)}}
\def\abjadnaivenumerals#1{\ctxlua{converters.abjadnumerals(\number#1)}}

\defineconversion [arabicnumerals]    [\abjadnumerals]
\defineconversion [persiannumerals]   [\abjadnumerals]

Idris ... any ideas about this? We never finished this so it's about time

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Numerals in mkiv
  2009-04-18 12:15 ` Hans Hagen
@ 2009-04-18 14:06   ` Otared Kavian
  0 siblings, 0 replies; 3+ messages in thread
From: Otared Kavian @ 2009-04-18 14:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 18 avr. 09, at 14:15, Hans Hagen wrote:

> […]
> it all depends how we define conversions
>
> - numeric (1,2,3,4)
> - alphabetic (a,b,c,d)
>
> numeric is used in chapter numbering and alphabetic for instance in  
> itemized (ok, all can be used everywhere but those are most common)
>
> so, the question is ... how do we define the commands ... maybe we  
> need:
>
>
> \def\abjadnumerals      
> #1{\ctxlua{converters.abjadnumerals(\number#1)}}
> \def 
> \abjadnodotnumerals 
> #1{\ctxlua{converters.abjadnodotnumerals(\number#1)}}
> \def 
> \abjadnaivenumerals#1{\ctxlua{converters.abjadnumerals(\number#1)}}
>
> \defineconversion [arabicnumerals]    [\abjadnumerals]
> \defineconversion [persiannumerals]   [\abjadnumerals]
>
> Idris ... any ideas about this? We never finished this so it's about  
> time
>
> Hans


Hi Hans,

What you are saying about conversions makes sense indeed, and the code  
you sent works fine as far as conversion to alphabetic numeration is  
considered (the "abjad" numbering would correspond to the use of  
"roman" numbering in items and pages, such as i, ii, iii, iv, etc, or  
to the "alphabetic" numbering a, b, c, d, etc).

However my point is slightly different: the ordinal numbers in mkiv,  
while using Arabic or Persian, begin at zero instead of beginning at  
one. Here is an example:

\setupdirections[bidi=global]
\pagedir TRT
\bodydir TRT
\pardir TRT
\textdir TRT

\starttypescript     [serif][arabic]
  \usetypescript      [serif][fallback]
  \definefontsynonym  [Serif][name:SimpleNaskhi] [features=arabic]
\stoptypescript

\starttypescript  [arabic]
   \definetypeface [arabic][rm] [serif] [arabic]  [default]
\stoptypescript

\usetypescript[arabic]
\setupbodyfont[arabic,12pt]

\starttext
\dorecurse{10}{\recurselevel\quad\persiannumerals{\recurselevel}\par}
\stoptext

In front of "1" you'll see the Arabic or Persian "0" that is ".",  
which is incorrect.

Thanks again for your attention,
Best regards: OK
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-04-18 14:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-17 21:08 Numerals in mkiv Otared Kavian
2009-04-18 12:15 ` Hans Hagen
2009-04-18 14:06   ` Otared Kavian

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).