[NTG-context] total number of sections

Hans Hagen pragma at wxs.nl
Thu Oct 17 10:17:27 CEST 2013


On 10/16/2013 4:44 PM, Peter Münster wrote:
> Hi,
>
> How could I get the number of sections in a document please?
>
> Example application:
>
> --8<---------------cut here---------------start------------->8---
> \doif{\nofsections}{1}{\setuphead[section][number=no]}
> \starttext
> \startsection[title=title 1] section 1 \stopsection
> %\startsection[title=title 2] section 2 \stopsection
> \stoptext
> --8<---------------cut here---------------end--------------->8---
>
> I've done it like this:
>
> --8<---------------cut here---------------start------------->8---
> \definedataset[mydata]
> \doif{\datasetvariable{mydata}{1}{nofsecs}}{1}{\setuphead[section][number=no]}
> \starttext
> \startsection[title=title 1] section 1 \stopsection
> %\startsection[title=title 2] section 2 \stopsection
> \setdataset[mydata][nofsecs=\structurenumber]
> \stoptext
> --8<---------------cut here---------------end--------------->8---
>
> But I don't know, if this is the right way...

\determinelistcharacteristics[section][criterium=text]
\ifnum\structurelistsize=1 ... \fi

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list