[NTG-context] styling individual parts of ToC entry

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Wed Sep 9 09:10:44 CEST 2020


jbf schrieb am 09.09.2020 um 08:04:
> Have to confess I am still not getting far with the final problem in a 
> book that is now fully laid out: frontmatter through to appendices is 
> all correct and working, but the Table of Contents not the way I need it 
> (as explained earlier and listed in a previous email).
> 
> My latest effort focuses on just one item, the Foreword, since if I get 
> that right, I can apply the same logic to sections. Chapters are already 
> working correctly, thanks to Wolfgang's ChapterListCommand and I am 
> assuming I need that for the several frontmatter 'chapters'.
> 
> I was earlier using \title for foreword, preface and notes to 
> contributors, but have abandoned that as complicating things, and am now 
> using \chapter, since it does not produce a numbered item - however, it 
> is producing the label 'Chapter' which I don't want for these item. You 
> can see below how I tried to avoid that, but it failed. My MWE addition 
> to what Wolfgang provided is:
> 
> \definehead [foreword] [chapter]
> 
> \setuphead [foreword]
> 
> \setuplist [foreword]
>   [label=foreword,
>   alternative=command,
>   command=\ChapterListCommand]% definition not included here. It was 
> given in an earlier response from Wolfgang.
> 
> .... And in the frontmatter itself:
> 
> \startchapter[foreword][title={\ss Foreword}][author={A. Uthor}]
> 
> ..........

You can set the forword string as labeltext and ignore the title (but 
use a empty argument when set userdata like the author).

\definehead
   [forword] [chapter]

\setuplabeltext
   [en]
   [forword=Forword,
    chapter=Chapter ]

\setuphead
   [forword]
   [frontpartlabel=forword,
    conversion=empty]

\setupsectionblock
   [frontpart]
   [number=yes]

\setuplist
   [forword]
   [label=forword,
    width=2cm]

\setuplist
   [chapter]
   [label=chapter,
    width=2cm]

\starttext

\startfrontmatter

\placelist [chapter,forword]

\startforword [] [author={A. u. thor}] \stopforword

\stopfrontmatter

\startbodymatter

\startchapter [title=Chapter 1] [author={A. u. thor}] \stopchapter

\stopbodymatter

\stoptext

Wolfgang


More information about the ntg-context mailing list