That works, thanks for your help, Wolfgang! :)

-----Ursprüngliche Nachricht-----
Von: Wolfgang Schuster <wolfgang.schuster.li...@gmail.com> 
Gesendet: Donnerstag, 22. Mai 2025 11:58
An: ntg-context@ntg.nl
Betreff: [NTG-context] Re: Hanging indent in TOC

Am 22.05.2025 um 08:51 schrieb Gottschalt, Johannes:
> My current setup is this:
> 
> 
> % TOC setup
> 
> \setupcombinedlist[content]%
> [ list={defaultchapter,defaultsection,defaultsubsection},%
>    after={\blank[10pt]},%
>    alternative=c,%
>    criterium=all,%
> ]
> \definelist[defaultchapter][chapter]%default first layer 
> \definelist[defaultsection][section]
> \setuplist[defaultsection]
> [ margin=1em,%
>    alternative=c%
> ]
> \definelist[defaultsubsection][subsection]
> \setuplist[defaultsubsection]
> [ margin=2em,%
>    alternative=c%
> ]
> \definelist[defaultsubsubsection][subsection]
> \setuplist[defaultsubsubsection]
> [ margin=3em,%
>    alternative=c%
> ]
> 
> \def\TOC{%
>      \blank[-24pt,back]%
>      \placecontent
> }

Why the negative space?

> \def\TocChapter#1{%
>      \writetolist[defaultchapter]{}{#1}%
> }
> \def\TocSection#1{%
>      \writetolist[defaultsection]{}{#1}%
> }
> \def\TocSubsection#1{%
>      \writetolist[defaultsubsection]{}{#1}%
> }
> \def\TocSubsubsection#1{%
>      \writetolist[defaultsubsubsection]{}{#1}%
> }
> \def\TocSubsubsubsection#1{%
>      \writetolist[defaultsection]{}{#1}%
> }
> 
> 
> And then I use commands like
> \TocChapter{I. Von den katechetischen Grundwahrheiten, oder von den 
> Gründen der christlichen Religion} \HeadingSubjectSub{Das erste 
> Hauptstück, \TocSection{1. Von der natürlichen Erkentnis Gottes}
> 
> To write the TOC entries because in some instances they deviate from the 
> chapter headlines.

How should ConTeXt know there are numbers which should have a separate 
alignment from the title when you put everything in the same blob?

To ensure the section number and text are separate you can use the ownnumber 
option and pass each of them as separate argument to your section commands as 
shown below.

%%%% begin example
\setupcombinedlist
   [content]
   [list={TocChapter,TocSection}]

\definehead [TocChapter] [chapter] [ownnumber=yes] \definehead [TocSection] 
[section] [ownnumber=yes,sectionsegments=section]

\starttext
\placecontent
\TocChapter{I.}{Von den katechetischen Grundwahrheiten, oder von den Gründen 
der christlichen Religion} \TocSection{1.}{Von der natürlichen Erkentnis 
Gottes} \stoptext %%%% end example

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) 
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to