I am trying to create a latex class that allows sectioning below subparagraph. For doing that, I modified the article.cls class of the texlive distribution adding two more options \thesubsubsubsection and \thesubsubsubsubsection. So now, the sectioning tree goes as follows:


Please see below myarticle.cls, mysectioning.tex and the resulting mysectioning.pdf.

I achieved the wanted effects in terms of numbering, table of contents and section formatting. The only problem that I have is that in the new two headings, \thesubsubsubsection and \thesubsubsubsubsection, the heading title is repeated in the following paragraph as indented text (see Sections and below).

Do you know how can I avoid this behavior?

Many thanks in advance for your help and ideas!




myarticle PDF document


The duplicate of the title stem from a call to do something with the sectional mark. That is, each numbered sectional unit \<section> has an associated \<section>mark that is used for printing content to the header/footer. The LaTeX kernel defines these, not the class, as


This way they all do nothing (they \@gobble their argument) but they're defined. As such, you need to add


within the class file somewhere so they are at least defined.

You may wonder why there is no error reported since there is a call made to the undefined marks...? That's because they're called via a control sequence construction using

\csname <section>mark\endcsname

Here's an extraction of \@sect - called by \@startsection when you execute a generic sectional unit that should be numbered:

  \ifnum #2>\c@secnumdepth
  \@tempskipa #5\relax
  \ifdim \@tempskipa>\z@
        \@hangfrom{\hskip #3\relax\@svsec}%
          \interlinepenalty \@M #8\@@par}%
    \csname #1mark\endcsname{#7}% <=================== Call the sectional unit mark
      \ifnum #2>\c@secnumdepth \else
        \protect\numberline{\csname the#1\endcsname}%
      #6{\hskip #3\relax
      \@svsec #8}%
      \csname #1mark\endcsname{#7}%
        \ifnum #2>\c@secnumdepth \else
          \protect\numberline{\csname the#1\endcsname}%

The highlighted macro shows the call to the mark. This type of call doesn't report errors if the control sequence is not known.

| improve this answer | |
  • Thank you very much for the solution and the detailed explanation of the reasons! I just copied the two \@gobble lines into myarticle.cls and I got the desired effects mysectioning.pdf. Very easy/elegant solution after digging into the Latex Kernel. And great didactic exposition! Thanks a lot Werner! – chan gimeno Sep 16 '16 at 8:40
  • While I might agree that the duplicate I pointed to can be debatable, this is certainly a duplicate of tex.stackexchange.com/questions/241351/… – egreg Sep 17 '16 at 9:32
  • @egreg: Indeed. The first one wasn't, but the new one is. – Werner Sep 17 '16 at 13:22