Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In my country, we usually don't use number 1, 2 ... as the head number (the section number, the chapter number and so on) but our own characters, for instance, the stands for number 1, the stands for number 2, the stands for 10.

Now, all my teachers, maybe you have known what I mean, I hope that I can get the head number, for example, the section number, so, I can define a macro called \def\mysectionnumbers#1{...} and pass it to the option numbercommand in the \setuphead[section][...,numbercommand={\mysectionnumber},...] so that I can change the section number into the above.

But, the #1 in the numbercommand = \...#1 is not only a digital, so I can't use the \ifnum or \ifcase. It seems like that it is the ...\getheadnumber.... How can I get the head number and change it?

By the way, what's the replacement text of \getheadnumber?

share|improve this question
1  
Usually you can create your own number conversion with \defineconversion[foo][A,B,C] and then set \setupheads[conversion=foo], but for some reason this fails for CJK ideographs. –  Marco Apr 11 '13 at 12:33
    
@Marco Thanks very much. It can really work exactly! But I think the users should first define some typescripts and \setscript[hanzi]. –  Timothy Li Apr 11 '13 at 12:46
    
@Marco The \defineconversion and option conversion in \setupheads don't appear in the ConTeXt manual, where have you learnt this commands? Why I can't find this in contextgarden.net? –  Timothy Li Apr 11 '13 at 12:54
1  
It probably appeared on the mailing list at some point, but it's on the ConTeXt wiki - defineconversion, too. Actually, I just checked the source and the chinese conversion is already defined, check: \dorecurse{42}{\convertnumber{cn}{\recurselevel}}. But I still don't know why it fails within the head setup. –  Marco Apr 11 '13 at 13:17
    
@Marco please wait for a moment, let me have a try again. –  Timothy Li Apr 11 '13 at 13:39

1 Answer 1

up vote 3 down vote accepted

If you use a font which contains the necessary characters all you need is \setupheads[conversion=cn]. Here a full example:

\setupbodyfont [heiti]
\setscript     [hanzi]
\setupheads    [conversion=cn]

\starttext
  \dorecurse{6}{\startsection[title=\recurselevel]\stopsection}
\stoptext

result

share|improve this answer
    
Yeah, that is it. –  Timothy Li Apr 11 '13 at 13:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.