[NTG-context] How to use \setuplist for formatting a chapter entry?

Wolfgang Schuster schuster.wolfgang at gmail.com
Tue Feb 3 12:30:36 CET 2015


> Am 03.02.2015 um 12:15 schrieb Rob Heusdens <robheus at xs4all.nl>:
> 
>> 
>> You have to write your own layout for the complete list entry. When you
>> don’t
>> need hyperlinks for the list entries you can use “alternative=command”
>> instead
>> of “alternative=interactive” for \setuplist.
>> 
>> \setupcombinedlist[content][list=chapter]
>> 
>> \definefiller[ChapterFiller]
>> 
>> \define[3]\ChapterListEntry
>>  {\vbox{Hoofdstuk #1 – #2 \filler[ChapterFiller] #3}}
>> 
>> \setuplist[chapter][alternative=interactive,command=\ChapterListEntry]
>> 
>> \starttext
>> \completecontent
>> \dorecurse{5}{
>> \chapter {Knuth} \input knuth
>> \chapter {Zapf}  \input zapf}
>> \stoptext
>> 
>> Wolfgang
>> 
> 
> Hello Wolfgang,
> 
> The example works. However, if I do the same changes you made to my
> example to my actual document, the result is different for some reason.
> 
> The chapter entry in the list (TOC) gets printed like:
> 
> "#1   #2 . . . . . . . . . . .  #3"
> 
> So the "Hoofdstuk" and " -- " element is not printed, and title is on a
> fixed position. The entry IS interactive (printed green but not bold).
> 
> Here are my changes (replaced \ChapterToc for \ChapterListEntry)
> 
> \definefiller[ChapterFiller]
> 
> \define[3]\ChapterToc%
> 	{\vbox{\bf Hoofdstuk #1 -- #2 \filler[ChapterFiller] #3}}
> 
> \setuplist[chapter][alternative=interactive,command=\ChapterToc]
> 
> And my list is defined like this:
> 
> \definecombinedlist[content][chapter,section,intro,summary,appendix,back]
> \setupcombinedlist[content][level=4, alternative=c]

Remove the line above (the level key down’t work with MkIV) and use \setuplist
to set “alternative=c” for the list entries where you want to apply this layout.

Wolfgang


More information about the ntg-context mailing list