GeneralProblem with Numbering of Chapter, Section and Subsection

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
LaTex lover
Posts: 13
Joined: Wed Aug 10, 2011 11:15 am

Problem with Numbering of Chapter, Section and Subsection

Post by LaTex lover »

Hi folk,

This is my first post here, happy :D
I am naive to LaTeX,so I am sorry if my question sounds silly.

I am writing a report and got a problem with chaptering and sectioning. I use the following command to define chapters, sections and so on:

\chapter{blablabla}
\section{blablabla}
\subsection{blablabla}

Now the problem is that chapter numbering appears fine in the main body and in the TOC but section and subsection does not. The counter is reset for those. For example what appears in chapter 2 in the main body and the TOC is this:

Chapetr 2 Background concept
1 background concept
1.1 brain and its function
1.2 different techniques in brain stimulation
1.2.1 DBS
1.2.2 TMS
and so on.But this is not what I want, I want like this:
Chapter 2 Background concept
2 background concept
2.1 brain and its function
2.2 differen techniques in barain stimulation
2.2.1 DBS
2.2.2 TMS
and so on.

I appreciate for your help. Thank you.[url][/url]

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Frits
Posts: 169
Joined: Wed Feb 02, 2011 6:02 pm

Re: Problem with Numbering of Chapter, Section and Subsectio

Post by Frits »

That's strange, LaTeX should automatically produce the format you want.

Can you please post a Minimal Working Example of your document.
howtoTeX.com - Your LaTeX resource site (Tips, Tricks, Templates and more!)
Follow howtoTeX on twitter
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Problem with Numbering of Chapter, Section and Subsection

Post by frabjous »

If I understand the problem, you don't want the section number to reset when you start a new chapter? (Your example is a bit confusing, since there's only one section per chapter, and it's unclear which number is which.)

If so, one way is to use the \counterwithout command from the changcntr package.

Code: Select all

\documentclass{report}
\usepackage{chngcntr}
\counterwithout{section}{chapter}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\begin{document}
\tableofcontents
\chapter{First}
\section{background concept}
\subsection{brain and its function}
\subsection{differen techniques in barain stimulation}
\subsubsection{DBS}
\subsubsection{TMS}
\chapter{Second}
\section{background concept}
\subsection{brain and its function}
\subsection{differen techniques in barain stimulation}
\subsubsection{DBS}
\subsubsection{TMS}
\end{document}

LaTex lover
Posts: 13
Joined: Wed Aug 10, 2011 11:15 am

Problem with Numbering of Chapter, Section and Subsection

Post by LaTex lover »

frabjous wrote:If I understand the problem, you don't want the section number to reset when you start a new chapter? (Your example is a bit confusing, since there's only one section per chapter, and it's unclear which number is which.)

If so, one way is to use the \counterwithout command from the changcntr package.

Code: Select all

\documentclass{report}
\usepackage{chngcntr}
\counterwithout{section}{chapter}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\begin{document}
\tableofcontents
\chapter{First}
\section{background concept}
\subsection{brain and its function}
\subsection{differen techniques in barain stimulation}
\subsubsection{DBS}
\subsubsection{TMS}
\chapter{Second}
\section{background concept}
\subsection{brain and its function}
\subsection{differen techniques in barain stimulation}
\subsubsection{DBS}
\subsubsection{TMS}
\end{document}

Thank you so much Frabjous, adding lines 2 and 3 solve my problem. Thank you again.
LaTex lover
Posts: 13
Joined: Wed Aug 10, 2011 11:15 am

Problem with Numbering of Chapter, Section and Subsection

Post by LaTex lover »

Frits wrote:That's strange, LaTeX should automatically produce the format you want.

Can you please post a Minimal Working Example of your document.
Frits, thanks for spending time on my post, frabjous's idea solve the problem!:)
Post Reply