[NTG-context] toc and macro

Wolfgang Schuster schuster.wolfgang at gmail.com
Fri May 29 02:38:51 CEST 2015


> Am 28.05.2015 um 23:08 schrieb Harry <irgksjd at gmx.de>:
> 
> What I want to do is something like this:
> 
> _______________________
> 
> \starttext
> 
>  \completecontent[criterium=all]
> 
>  % how i have to do it
>  \startchapter[colors][Colors]
>    \startsection,[black][Black]
>      black is a dark color
>    \stopsection,
>    \startsection[white][White]
>      white is light color
>    \stopsection
>  \stopchapter
> 
>  % how i want it to write (with the same result of the code above)
>  \startSameCommand[colors][Colors]
>    \startSameCommand[black][Black]
>      black is a dark color
>    \stopSameCommand
>    \startSameCommand[white][White]
>      white is light color
>    \stopSameCommand
>  \stopSameCommand
> 
> \stoptext
> 
> _______________________
> 
> The \startSameCommand finds itself out (by the nesting of the command)
> if its behave
> as  \startpart or \startchapter or \startsection or \startsubsection or
> \startsubsubsection …


You’re looking for the \startsectionlevel command.

%\definesectionlevels[default][part,chapter,section,subsection]

\starttext

\completecontent[criterium=all]

\startsectionlevel[title=Colors,reference=colors]

\startsectionlevel[title=Black,reference=black]
black is a dark color
\stopsectionlevel

\startsectionlevel[title=White,reference=white]
white is light color
\stopsectionlevel

\stopsectionlevel

\stoptext

Wolfgang


More information about the ntg-context mailing list