
Hi everyone, I need some help customizing the default TOC so that it has hanging indents. Meaning that, if a heading spans more the one line, all lines after the second one should be indented. For example, if you look at this screen: [cid:image001.png@01DBCA3D.76664030] I would want "den" to be indented to the same level of "Von" in the line above. How would I set this up in ConTeXt? Thanks for any help! Johannes -- Johannes Gottschalt Forschung und Entwicklung Georg-August-Universität Göttingen Niedersächsische Staats- und Universitätsbibliothek Göttingen D-37070 Göttingen Papendiek 14 (Historisches Gebäude) +49 551 39-38116 (Tel.) gottschalt@sub.uni-goettingen.demailto:gottschalt@sub.uni-goettingen.de http://www.sub.uni-goettingen.dehttp://www.sub.uni-goettingen.de/

Am 21.05.2025 um 10:45 schrieb Gottschalt, Johannes:
Hi everyone,
I need some help customizing the default TOC so that it has hanging indents. Meaning that, if a heading spans more the one line, all lines after the second one should be indented. For example, if you look at this screen:
I would want “den” to be indented to the same level of “Von” in the line above. How would I set this up in ConTeXt?
You have to provide a minimal example for your problem because the default layout indents the text on all lines. %%%% begin example \usemodule[visual] \starttext \completecontent[alternative=c] \chapter{\fakewords{30}{40}} \section{\fakewords{10}{15}} \stoptext %%%% end example Wolfgang

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
}
\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.
Thanks for your help!
Johannes
-----Ursprüngliche Nachricht-----
Von: Wolfgang Schuster
Hi everyone,
I need some help customizing the default TOC so that it has hanging indents. Meaning that, if a heading spans more the one line, all lines after the second one should be indented. For example, if you look at this screen:
I would want “den” to be indented to the same level of “Von” in the line above. How would I set this up in ConTeXt?
You have to provide a minimal example for your problem because the default layout indents the text on all lines. %%%% begin example \usemodule[visual] \starttext \completecontent[alternative=c] \chapter{\fakewords{30}{40}} \section{\fakewords{10}{15}} \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 ___________________________________________________________________________________

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

That works, thanks for your help, Wolfgang! :)
-----Ursprüngliche Nachricht-----
Von: Wolfgang Schuster
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 ___________________________________________________________________________________
participants (2)
-
Gottschalt, Johannes
-
Wolfgang Schuster