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?

2
  • 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
    Commented Sep 6, 2015 at 11:33
  • With elements in the content you mean ... what? Subsections? Subsubsections?
    – user31729
    Commented Sep 6, 2015 at 11:35

1 Answer 1

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}%
}
3
  • There's no equation mentioned in the OP
    – user31729
    Commented Sep 6, 2015 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. Commented Sep 6, 2015 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. Commented Sep 6, 2015 at 11:41

You must log in to answer this question.

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