0

I am using the scrbook class.

In some chapters, I have sections so the elements therein get numbered x.y.z where x denotes the numbering of the chapter, y the one of the section and z the one of the specific element within the section.

However, I also have chapters without sections and I don't want to have a single section title for the whole chapter. If I just use no section, the elements in the content get numbered x.0.z since there is no section.

How can I get rid of the 0 for the chapters without section, so to have a numbering

x.1
x.2
...

therein?

  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Sep 6 '15 at 11:33
  • With elements in the content you mean ... what? Subsections? Subsubsections? – user31729 Sep 6 '15 at 11:35
3

The zero section numbers can be omitted the following way, example for equation:

\renewcommand*{\theequation}{%
  \ifnum\value{section}=0 %
    \thechapter
  \else
    \thesection
  \fi
  .\arabic{equation}%
}
  • There's no equation mentioned in the OP – user31729 Sep 6 '15 at 11:36
  • @ChristianHupfer The question refers to elements. I assume this means figure, table, equation or whatever the document uses. Since I cannot provide definitions for infinite element types, equation is just an example. – Heiko Oberdiek Sep 6 '15 at 11:40
  • @clemens Usually the section number already includes the chapter number. If the document uses a different layout, then the example needs to be adjusted, of course. – Heiko Oberdiek Sep 6 '15 at 11:41

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.