1

I'm using a document class that omits section numbering – i.e., \section, \subsection and \subsubsection behave as \section*, \subsection* and \subsubsection*, respectively. I need to use this document class, but I'd like to restore the article document class behavior when it comes to section numbering.

I'm not experienced with defining document classes at all, so, to my untrained eye, it looks like the problem is here:

\titleformat{\section}
  {\scshape\normalsize\mdseries}
  {\thesection}
  {0pt}
  {#1}

\titleformat{\subsection}
  {\itshape\mdseries\normalsize}
  {\thesubsection}
  {0pt}
  {#1}

\titleformat{\subsubsection}[runin]
  {\itshape\mdseries\normalsize}
  {\thesubsubsection}
  {0pt}
  {#1.}

I read the titlesec documentation, but I'm not sure about how to work with \titleformat (in part because I'm blind and PDF is not the most accessible file format; if someone can refer me to an HTML version of the documentation, I'd appreciate it). So, what should I change here to restore the section numbering behavior from the article document class? If it is not \titleformat that is changing this behavior, what should I look for on the .cls file?

5
  • 3
    Unless your document class does things in a particularly devious way, it probably contains an instruction such as \setcounter{secnumdepth}{0} or \setcounter{secnumdepth}{-1} to suppress the numbering of sectioning headers. If that's the case, you can re-enable the use of sectioning numbering down to the subsubsection level by issuing the instruction \setcounter{secnumdepth}{3} in the preamble of your document. – Mico Nov 21 '19 at 21:52
  • 1
    Could you post a link to your document class? – Bernard Nov 21 '19 at 22:02
  • @Mico, that worked beautifully. Please post your comment as an answer so that I can accept it. – Lucas De Abreu Maia Nov 21 '19 at 22:37
  • 3
    This class file indeed has the instruction setcounter{secnumdepth}{0}line 40, as suggested by @Mico. Follow the advice given in his comment. – Bernard Nov 21 '19 at 22:58
4

In a comment to @Bernard, you mention (somewhat indirectly) that you employ the cupjournal document class, by Cambridge University Press.

The file cupjournal.cls contains the following instruction on line 40:

\setcounter{secnumdepth}{0}

The effect of this instruction is to suppress the display the sectioning numbers for section, subsubsection, subsubsection etc level headers.

To re-enable the display of sectioning numbering down to the subsubsection level, simply issue the instruction

\setcounter{secnumdepth}{3}

in the preamble of your document.

Setting the value of this counter to 3 will continue to suppress the display of numbers for \paragraph and \subparagraph level headers. To re-enable the display of sectioning numbering down to the \subparagraph level as well, you'd need to issue the instruction

\setcounter{secnumdepth}{5}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.