[NTG-context] Fwd: Re: styling individual parts of ToC entry

jbf roma83537 at gmail.com
Thu Sep 10 03:30:07 CEST 2020


After making silly mistakes, for which I apologize, I finally got the 
ToC to work for frontmatter and chapters, creating new \defineheads as 
required, and including the earlier \ChapterListCommand, with the 
results correctly showing.

To add some named sections with authors, I did the following, using an 
idea Hraban had floated:

  \setupsectionblock
  [bodypart]
  [number=no]

\define[1]\SectionTocEntry{%
   #1\crlf% title
   \structurelistuservariable{author}%
}

\setuplist[section][
   textcommand=\SectionTocEntry,
]

I need to adjust the \setuplist[section] so these section entries move 
across under the Chapter titles (not be left-aligned as they are now 
under Chapter number. The earlier \ChapterListCommand has titles and 
authors moved across 3cm.

I have tried:

\setuplist[section][width=3cm,
   textcommand=\SectionTocEntry,
   ]

The width=3cm is not doing anything, so I've got that wrong. How do I 
move sections across by a specific amount in the TOC?

Julian





On 9/9/20 5:10 pm, Wolfgang Schuster wrote:
> 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