I have a book containing hundreds of activities for teachers. Each activity is designated with \section{Activity title}. \section is never used for anything else.

I need some way to count how many times \section appears in the document. Is there some built-in counter or some other way to get this value?

1 Answer 1


When your goal is to show the value of the last section you can use the \headnumber command but when you're interested in the number of sections use the \someheadnumber command instead.


    \NC first   \EQ \headnumber          [section] [first]   \NC\NR
    \NC current \EQ \headnumber          [section] [current] \NC\NR
    \NC last    \EQ \headnumber          [section] [last]    \NC\NR
    \NC first   \EQ \somenamedheadnumber {section} {first}   \NC\NR
    \NC current \EQ \somenamedheadnumber {section} {current} \NC\NR
    \NC last    \EQ \somenamedheadnumber {section} {last}    \NC\NR


  {\expanded{\section{Section \recurselevel}}


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .