[NTG-context] total number of sections

Peter Münster pmlists at free.fr
Wed Oct 16 16:44:24 CEST 2013


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


More information about the ntg-context mailing list