* total number of sections
@ 2013-10-16 14:44 Peter Münster
2013-10-17 8:17 ` Hans Hagen
0 siblings, 1 reply; 3+ messages in thread
From: Peter Münster @ 2013-10-16 14:44 UTC (permalink / raw)
To: ConTeXt users
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...
TIA for any help,
--
Peter
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: total number of sections
2013-10-16 14:44 total number of sections Peter Münster
@ 2013-10-17 8:17 ` Hans Hagen
2013-10-20 23:31 ` Peter Münster
0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2013-10-17 8:17 UTC (permalink / raw)
To: ntg-context
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
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: total number of sections
2013-10-17 8:17 ` Hans Hagen
@ 2013-10-20 23:31 ` Peter Münster
0 siblings, 0 replies; 3+ messages in thread
From: Peter Münster @ 2013-10-20 23:31 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Thu, Oct 17 2013, Hans Hagen wrote:
> \determinelistcharacteristics[section][criterium=text]
> \ifnum\structurelistsize=1 ... \fi
Thanks. Now I've found another example on the mailing list:
\determinelistcharacteristics[section][criterium=all]
number of sections: \utilitylistlength
That works too.
What is the difference between criterium=all and criterium=text?
And what is the difference between \structurelistsize and
\utilitylistlength?
TIA,
--
Peter
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-20 23:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-16 14:44 total number of sections Peter Münster
2013-10-17 8:17 ` Hans Hagen
2013-10-20 23:31 ` Peter Münster
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).