Am 23.06.2011 um 16:49 schrieb Steffen Wolfrum:

> Hi,
> 
> say, I want to design the TOC. Now I would write:
> 
> \setuplist[LevelFour]  [margin=1.20cm,width=0.5cm,...]
> \setuplist[LevelFive]  [margin=1.70cm,width=0.5cm,]
> 
> 
> But is there some clever command that makes a calculation like this:
> 
> \setuplist[LevelFour]  [margin=1.20cm,width=0.5cm,...]
> \setuplist[LevelFive]  
> [margin={\the\dimexpr\measure{margin[LevelFour]+width[LevelFour]}\relax},width=0.5cm,]
> 
> Any idea?



Variant 1:

\definemeasure [chapter:width]       [0.4cm]
\definemeasure [section:width]       [0.7cm]
\definemeasure [subsection:width]    [1.0cm]
\definemeasure [subsubsection:width] [1.3cm]

\definemeasure [chapter:margin]       [0cm]
\definemeasure [section:margin]       
[\the\dimexpr\measure{chapter:margin}+\measure{chapter:width}\relax]
\definemeasure [subsection:margin]    
[\the\dimexpr\measure{section:margin}+\measure{section:width}\relax]
\definemeasure [subsubsection:margin] 
[\the\dimexpr\measure{subsection:margin}+\measure{subsection:width}\relax]

\setuplist [chapter]       
[margin=\measure{chapter:margin},width=\measure{chapter:width}]
\setuplist [section]       
[margin=\measure{section:margin},width=\measure{section:width}]
\setuplist [subsection]    
[margin=\measure{subsection:margin},width=\measure{subsection:width}]
\setuplist [subsubsection] 
[margin=\measure{subsubsection:margin},width=\measure{subsubsection:width}]

\starttext

\placecontent

\chapter{One}

\section{Two}

\subsection{Three}

\subsubsection{Four}

\stoptext


Variant 2:

\setuplist [chapter]       [width=0.4cm,margin=0cm]
\setuplist [section]       
[width=0.7cm,margin=\the\dimexpr\namedlistparameter{chapter}{margin}+\namedlistparameter{chapter}{width}\relax]
\setuplist [subsection]    
[width=1.0cm,margin=\the\dimexpr\namedlistparameter{section}{margin}+\namedlistparameter{section}{width}\relax]
\setuplist [subsubsection] 
[width=1.3cm,margin=\the\dimexpr\namedlistparameter{subsection}{margin}+\namedlistparameter{subsection}{width}\relax]

\starttext

\placecontent

\chapter{One}

\section{Two}

\subsection{Three}

\subsubsection{Four}

\stoptext


Wolfgang

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

maillist : [email protected] / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to