ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: setuplist inherit margin and width
Date: Thu, 23 Jun 2011 18:08:29 +0200	[thread overview]
Message-ID: <3930CD66-BEA3-45C4-B1E1-15B949FA0516@googlemail.com> (raw)
In-Reply-To: <41AEACB6-83E9-4EE1-B6FE-312A20D1C9EC@st.estfiles.de>


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 : ntg-context@ntg.nl / 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	other threads:[~2011-06-23 16:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-23 14:49 Steffen Wolfrum
2011-06-23 16:08 ` Wolfgang Schuster [this message]
2011-06-23 17:49   ` Jaroslav Hajtmar
2011-06-23 18:43     ` Wolfgang Schuster
2011-06-23 17:57   ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3930CD66-BEA3-45C4-B1E1-15B949FA0516@googlemail.com \
    --to=schuster.wolfgang@googlemail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).