[NTG-context] Help on tweaking alignment, page numbers and ToC

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Wed Aug 12 06:12:21 CEST 2020


Nicola schrieb am 11.08.2020 um 22:21:
> On 2020-08-11, Pablo Rodriguez <oinos at gmx.es> wrote:
>> On 8/11/20 9:24 PM, Nicola wrote:
>>> Thank Pablo, Wolfgang,
>>> I have learned more by reading your replies than by myself in the rest
>>> of the afternoon.
>>
>> Hi Nicola,
>>
>> if you found replies useful, please update the wiki (this may help others).
>>
>>> Just one more thing:
>>> [...]
>>> I'd prefer all the titles to be aligned:
>>>
>>>           Preface
>>>     I     XYZ
>>>    ...
>>> VIII     XYZ
>>>    ...
>>>
>>> I have tried to do my homework by playing with \setuphead, but I am
>>> afraid I need your help on this.
>>
>> Sorry, but too tired to type a sample.
>>
>> How about setting distance for \setuplist[chapter] in the sectionblock
>> frontpart with the desired width?
> 
> That does not seem to change the layout, unfortunately. I have tried
> with `margin` and `aligntitle` as well:
> 
> \setuplist[chapter][distance=1cm,aligntitle=yes]
> \startsectionblockenvironment[frontpart]
> \setuplist[chapter][aligntitle=yes,margin=2cm,distance=2cm]
> \stopsectionblockenvironment
> 
> I'll take a fresh look tomorrow.

When you a unnumbered section with the list alternatives a-c your're out 
of luck with the regular \setuplist options because it always use a 
width of 0pt for regular section number. The aligntitle works only for 
numbered entries to align them when you disable the number entry in the TOC.

To show the section entry and align all entries on the same line you can 
use the following method:

   1. Set the width and distance for the section number to 0pt.

   2. Set the margin key to a value large enough to fit all numbers

   3. Apply a command to the numbercommand key where you shift the 
number to the left in the margin area you set in the previous step

%%%% begin example
\define[1]\ChapterListNumbercommand
   {\offset[x=-1cm,width=0pt]{\simplealignedbox{1cm}{flushleft}{#1}}}

\setuplist
   [chapter]
   [distance=0cm,
    width=0cm,
    margin=1cm,
    numbercommand=\ChapterListNumbercommand]

\starttext

\startfrontmatter
   \completecontent
   \chapter{Preface}
\stopfrontmatter

\startbodymatter
   \chapter{Introduction}
   \chapter{Workflow}
   \chapter{Input}
   \chapter{Output}
\stopbodymatter

\startbackmatter
   \chapter{Index}
\stopbackmatter

\stoptext
%%%% end example

Wolfgang


More information about the ntg-context mailing list