4

My first post on tex.sx, so bear with me...

The Goal: Arabic chapter numbers in the Table of Contents, and Words in the chapter headings (i.e. Chapter One)

Seems simple enough, but I'm having the darnedest time getting it right. If I use this...

\definestructureconversionset
 [words]
 [Romannumerals, Words, numbers, numbers, numbers]
 [numbers]

\setuphead 
 [chapter]
 [page=chapterpagebreak,
  sectionconversionset=words,
  header=empty,
  footer=empty,
  numberstyle={\scx},
  textstyle={\bfd},
  align={middle, nothyphenated, verytolerant},
  command=\MyChapter
 ]

... then I end up with a Table of Contents like this:

One Chapter Title
Two Chapter Title

I've scoured here, the wiki, manuals, and I still haven't found a solution, so any help would be much appreciated!

  • Anybody anybody? @marco, the ConTeXt master?! Haha – derBingle Mar 6 '14 at 13:44
1

A bit late to the party, sorry.

You can use deepnumbercommand together with \convertnumber. The deepnumbercommand option takes a command with one argument and \convertnumber takes two arguments, where the first one is the conversion set and the second one is the number. What we can do is, we can curry the \convertnumber macro by giving it only one argument, technically making it a macro that takes one argument.

deepnumbercommand=\convertnumber{words}

Here is the full example.

\definestructureconversionset
  [words]
  [Romannumerals, Words, numbers, numbers, numbers]
  [numbers]

\setuphead 
  [chapter]
  [page=chapterpagebreak,
   header=empty,
   footer=empty,
   numberstyle={\scx},
   textstyle={\bfd},
   align={middle, nothyphenated, verytolerant},
   deepnumbercommand=\convertnumber{words}]

\starttext

\completecontent

\startchapter[title={Title 1}]

\stopchapter

\startchapter[title={Title 2}]

\stopchapter

\stoptext

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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