Suppose I'm writing a report document, where most chapters have sections, with subsections within them; but some chapters (say, an introduction) is shorter than the others - about the same size as a section of a "normal" chapter; and I only want this short-chapter to have subsection-level headings.

If I do this, it either messes up the numbering (e.g. I get 1.0.1, 1.0.2 for these section/subsections) - or I also drop the numbering, in which case these subsections are removed from the table-of-contents and I have to reintroduce them "manually".

Anyway, I was wondering what's the idiomatic way to deal with this scenario, or at least what you have found useful to go about it.

closed as primarily opinion-based by Keks Dose, Andrew, Troy, Stefan Pinnow, Andrew Swann Jun 13 '18 at 19:06

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    I guess I would just bite the bullet and promote the subsections to sections in that case. – moewe May 14 '18 at 14:05
  • @moewe: So, as in the famous quote regarding the US and Vietnam: "Withdraw and declare victory"... well, I guess that's not the worst thing I could do :-) – einpoklum May 14 '18 at 14:43
  • 1
    It's all about the framing ... But on a more serious note, why do you want to use \section-less \subsections, i.e. why did you not want to go for the (for me at least natural) way of using \section directly. And if you have answered the why, there is still the question of what you expect to see. The answer illustrates that you can suppress the spurious 0, but you end up with an apparent inconsistency: The \subsection still produce the same output in terms of fonts etc., but the numbering looks like that of a \section. – moewe May 14 '18 at 18:41
  • 1
    @einpoklum Bad idea. Your readers might consider that they had gotten a book with a missing section or however something were not correct. Stick to the structure, please. Usually readers can't come and ask. – Keks Dose May 14 '18 at 19:42
  • @KeksDose: Ok, so what do I do instead? – einpoklum May 14 '18 at 19:50

The macro \thesubsection controls how subsection numbers are displayed, both in section titles and in cross references. By default, it is (effectively) defined as \thesection.\arabic{subsection}, and \thesection is defined similarly using \thechapter. So it takes the (formatted) number of the current section and adds a period and the value of the subsection counter.

You can redefine \thesubsection so that it expands to \thechapter.\arabic{subsection} instead if the value of the section counter is zero. Like this:




\chapter{First chapter}
\subsection{A subsection}

\chapter{Second chapter}
\section{A section}
\subsection{Another subsection}


Here is the result:

enter image description here enter image description here

  • Upon rereading your question I now wonder if I answered it at all. You ask for "the idiomatic way" to deal with this scenario, and I don't really know what that would be. – Circumscribe May 14 '18 at 15:42
  • If you occasionally do what you've described, then it's a 1-sample of what's idiomatic... – einpoklum May 14 '18 at 18:44
  • 1
    I can't honestly say that I've ever skipped the section level heading, only that this is how I'd do it. – Circumscribe May 14 '18 at 19:58
  • (Although I suppose the \ifnum...\fi bit is probably more idiomatic for TeX than for LaTeX. Maybe loading etoolbox and using \ifnumequal{\value{section}}{0}{\thechapter}{\thesection} instead might've been better in that sense.) – Circumscribe May 14 '18 at 20:10

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