# Sections without chapters in a LaTeX document [duplicate]

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?

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

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.

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.

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.