[NTG-context] How to use \setuplist for formatting a chapter entry?
Rob Heusdens
robheus at xs4all.nl
Wed Feb 4 15:33:33 CET 2015
> You have to write a working minimal example for further help.
>
> Wolfgang
>
So this is the example:
\setupinteraction[state=start]
\definehead[intro][chapter]
\definehead[back][chapter]
\definehead[appendix][chapter]
\definecombinedlist[content][chapter,intro,appendix,back]
\setupcombinedlist[content][alternative=c]
\setupheadtext[content=Inhoud]
\setupheadtext[chapter=Hoofdstuk]
\setupheadtext[appendix=Bijlage]
\setupheadtext[back=Noten]
\definefiller[ChapterFiller]
\define[1]\MyContentCommand%
{\framed[frame=off,offset=none,frameoffset=0pt]
{\vbox{\blank[4cm]\Word{#1}}}}
\define[1]\MyIntroCommand%
{\framed[frame=off,offset=none,frameoffset=0pt]
{\vbox{\blank[4cm]\Word{#1}}}}
\define[2]\MyChapterCommand%
{\framed[frame=off,offset=none,frameoffset=0pt]
{\vbox{\blank[4cm]{\small \headtext{chapter}
#1}\blank\unhyphenated{#2}}}}
\define[1]\MyAppendixCommand%
{\framed[frame=off,offset=none,frameoffset=0pt]
{\vbox{\blank[4cm]{\small \headtext{appendix}}\blank\unhyphenated{#1}}}}
\define[1]\MyBackCommand%
{\framed[frame=off,offset=none,frameoffset=0pt]
{\vbox{\blank[4cm]{\small \headtext{back}}\blank\unhyphenated{#1}}}}
\definefiller[ChapterFiller]
\define[1]\ChapterNumberToc%
{Hoofdstuk #1 -- }
\define[3]\ChapterToc%
{\vbox{\bf Hoofdstuk #1 -- #2 \filler[ChapterFiller] #3}}
\define[1]\AppendixToc%
{Bijlage -- #1}
\define[1]\BackToc%
{Noten -- #1}
\setuphead[intro][number=no,header=nomarking,command=\MyIntroCommand]
\setuphead[chapter][header=nomarking,command=\MyChapterCommand,aligntitle=yes,align={flushleft,nothyphenated,verytolerant}]
\setuphead[title][command=,textcommand=\MyContentCommand]
\setuphead[appendix][number=no,header=nomarking,command=,textcommand=\MyAppendixCommand,align={flushleft,nothyphenated,verytolerant}]
\setuphead[back][number=no,header=nomarking,command=,textcommand=\MyBackCommand,align={flushleft,nothyphenated,verytolerant}]
\setuplist[chapter][headnumber=yes,style=bold,width=17ex,numbercommand=\ChapterNumberToc]
%\setuplist[chapter][headnumber=yes,style=bold,alternative=command,command=\ChapterToc]
\setuplist[appendix][headnumber=no,style=bold,textcommand=\AppendixToc]
\setuplist[back][headnumber=no,style=bold,textcommand=\BackToc]
\starttext
\completecontent
\startfrontmatter
\intro{Intro}
\stopfrontmatter
\startbodymatter
\dorecurse{5}{
\chapter {Knuth} \input knuth
\chapter {Zapf} \input zapf}
\stopbodymatter
\startappendices
\appendix{Appendix}
\stopappendices
\startbackmatter
\back{Back}
\stopbackmatter
\stoptext
As you can see, starting from chapter 10 (there are 21 chapters in the
real document) there is now no space between the endash and the title,
like it is for the first 9 chapters.
So, instead of using the numbercommand for the \setuplist[chapter] I tried
using:
\setuplist[chapter][headnumber=yes,style=bold,alternative=command,command=\ChapterToc]
(by uncommenting that line and commenting out the old \setuplist[chapter]
with the command \ChapterToc already defined in the MWE.
However, that does not produce the desired result.
Can you give a clue?
Thanks,
Rob
More information about the ntg-context
mailing list