Get Current Section Number
I want to put a book title above the Chapter title for the first chapter of a book. I suppose that this can be accomplished with a 'before=' clause that checks to see if it is the first chapter... but how do I look at the chapter number in order to set up the conditional? Mike
On 1/9/22 5:25 PM, Michael Urban via ntg-context wrote:
I want to put a book title above the Chapter title for the first chapter of a book. I suppose that this can be accomplished with a 'before=' clause that checks to see if it is the first chapter... but how do I look at the chapter number in order to set up the conditional?
Hi MIchael, this might do the trick: \starttext \dorecurse{5} {\chapter{Chapter \structurenumber} \dorecurse{5} {\section{Section \structurenumber} \doifelse{\somenamedheadnumber{chapter}{current}}{1} {This is the first chapter.} {This is not the first chapter.} }} \stoptext Just in case it might help, Pablo
Michael Urban via ntg-context schrieb am 09.01.2022 um 17:25:
I want to put a book title above the Chapter title for the first chapter of a book. I suppose that this can be accomplished with a 'before=' clause that checks to see if it is the first chapter... but how do I look at the chapter number in order to set up the conditional?
Can you show a example of your document, maybe there is a better way to produce the desired result. \startsetups [document:start] \startalignment[middle] {\ssd\documentparameter{title}} \stopalignment \stopsetups \setuphead [chapter] [page=no] \startdocument [title={Dummy title}] \dorecurse{5} {\startchapter[title={Chapter \convertnumber{word}{#1}}] \samplefile{lorem} \stopchapter} \stopdocument Wolfgang
participants (3)
-
Michael Urban
-
Pablo Rodriguez
-
Wolfgang Schuster