ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Getting the current chapter number in the TOC
@ 2014-04-17 15:27 Maggyero
  2014-04-17 16:25 ` Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: Maggyero @ 2014-04-17 15:27 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 500 bytes --]

Hello,


How can I get the following table of contents?


Contents

Chapter first MyTitle
Chapter II MyTitle
Chapter III MyTitle


I have tried:

\MyNumber{\doifelse{\currentsectioncountervalue}{1}{first}{#1}}
setuplist[chapter][numbercommand=\MyNumber]

but it does not work. Actually because \currentsectioncountervalue always
returns 0 in the table of contents. So I need another command which gives
me the current number for testing if it is equal to one (first chapter).


Thank you in advance.

[-- Attachment #1.2: Type: text/html, Size: 782 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] 3+ messages in thread

* Re: Getting the current chapter number in the TOC
  2014-04-17 15:27 Getting the current chapter number in the TOC Maggyero
@ 2014-04-17 16:25 ` Wolfgang Schuster
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Schuster @ 2014-04-17 16:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 17.04.2014 um 17:27 schrieb Maggyero <maggyero@gmail.com>:

> Hello,
> 
> 
> How can I get the following table of contents?
> 
> 
> Contents
> 
> Chapter first MyTitle
> Chapter II MyTitle
> Chapter III MyTitle
> 
> 
> I have tried:
> 
> \MyNumber{\doifelse{\currentsectioncountervalue}{1}{first}{#1}}
> setuplist[chapter][numbercommand=\MyNumber]
> 
> but it does not work. Actually because \currentsectioncountervalue always returns 0 in the table of contents. So I need another command which gives me the current number for testing if it is equal to one (first chapter).

\define[1]\Weirdnumber
  {\ifcase#1\relax
     % 0
   \or
     First% 1
   \else
     \convertnumber{Romannumerals}{#1}%
   \fi}

\defineconversion[Weirdnumber][\Weirdnumber]

\defineconversionset[Weirdchapter][number,Weirdnumber][number]

\setuplist[chapter][width=3em,numberconversionset=Weirdchapter]

\starttext

\completecontent

\dorecurse{10}{\expanded{\chapter{Chapter \recurselevel}}}

\stoptext

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] 3+ messages in thread

* Getting the current chapter number in the TOC
@ 2014-04-22  4:13 Maggyero
  0 siblings, 0 replies; 3+ messages in thread
From: Maggyero @ 2014-04-22  4:13 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 30 bytes --]

Thank you Wolfgang, it works.

[-- Attachment #1.2: Type: text/html, Size: 51 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] 3+ messages in thread

end of thread, other threads:[~2014-04-22  4:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-17 15:27 Getting the current chapter number in the TOC Maggyero
2014-04-17 16:25 ` Wolfgang Schuster
2014-04-22  4:13 Maggyero

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