4

This question already has an answer here:

I have a document generated by doxygen with just \section directives and no chapters, so they're getting numbered as

0.1 Section 1
0.2 Section 2
0.2.1 SubSection 1

How can I skip the chapter number and display 1.1, 1.2, instead?

marked as duplicate by Qrrbrbirlbel, cmhughes, henrique, Guido, karlkoeller Nov 20 '13 at 6:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • In some way, add \renewcommand{\thesection}{\arabic{section}} to your preamble... – Werner Nov 20 '13 at 0:50
12

Your Mistake

You are actually using the book or report class or something like that.

\documentclass{book}

\begin{document}

\section{Section 1}
\section{Section 2}
\subsection{SubSection 1}

\end{document}

So, your output looks like this as reported by you.

enter image description here

The Solution

Please use the article class in place of book class.

\documentclass{article}

\begin{document}

\section{Section 1}
\section{Section 2}
\subsection{SubSection 1}

\end{document}

The above gives your desired output.

enter image description here

Relevant Explanations

  • book class is for real books. And article class is for articles in scientific journals, presentations, short reports, program documentation, invitations.
  • It is supposed that a book will contain chapters. Unless you specify a \chapter command at the start, your chapter number is zero, which is reflected in your output as you have told us. Please remember that \chapter command is not even recognized in article class.
  • To get a nice overview of the classes, this one is a must see.

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