# How to change numeration in ToC

I've got a problem while trying to figure out a structure for report document.

At this moment I have:

\chapter[Chapter 1]{}
\section{Section 1}
\subsection{Subsection 1}
\subsection{Subsection 2}
\section{Section 2}


Effect of that in ToC is:

1. Chapter 1
1.1 Section 1
1.1.1 Subsection 1
1.1.2 Subsection 2
1.2 Section 2


What I'm looking for is:

Chapter 1
1 Section 1
1.1 Subsection 1
1.2 Subsection 2
2 Section 2


I already tried using \addcontentsline{toc}{chapter}{Chapter 1}, but obviously it solved problem only with chapter and wrong numeration for sections and subsections is still happening.
I've tested changing \chapter to \part as well. Unfortunately effect is not satisfying since it causes even more problems to fix in ToC and document structure.

-
Welcome to TeX.SX. Do you want to have this numeration in ToC only or in the body as well? – Christian Hupfer Feb 21 at 11:52
Thanks. Numeration in the body must be the same as numeration in ToC. – Estyere Feb 21 at 11:53
See my answer below please then-- I think this is what you want to achieve. – Christian Hupfer Feb 21 at 11:58

This removes the \thechapter counter output from the \thesection counter formatting. Since \thesubsection etc. are recursively using \thesection etc. this will provide the correct numbering for all sectioning commands.

Please note that this will change the numbering within the body as well!

Most likely, the spacing should be changed!

\documentclass{book}

\renewcommand{\thesection}{\arabic{section}}

\begin{document}
\tableofcontents

\chapter[Chapter 1]{}
\section{Section 1}
\subsection{Subsection 1}
\subsection{Subsection 2}
\section{Section 2}

\end{document}

-
Mixed with \addcontentsline{toc}{chapter}{}, done it's job perfectly, thanks a lot! – Estyere Feb 21 at 12:17

If you want normal numbering in the body, you can use the \p@section feature.

\documentclass{report}

\makeatletter
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\p@section}{\thechapter.}
\renewcommand{\p@subsection}{\thechapter.}
\renewcommand{\@seccntformat}[1]{%
}
\makeatother

\begin{document}
\tableofcontents

\chapter{Chapter 1}\label{ch1}
\section{Section 1}\label{sec1}
\subsection{Subsection 1}\label{ssec1}
\subsection{Subsection 2}
\section{Section 2}

\ref{ch1}; \ref{sec1}; \ref{ssec1}

\end{document}


If you also want to remove the number next to the chapter title in the TOC, you can either patch \@makechapterhead or \l@chapter.

The latter method consists in adding

\let\original@l@chapter\l@chapter
\renewcommand{\l@chapter}[2]{%
\begingroup\let\numberline\@gobble\original@l@chapter{#1}{#2}\endgroup
}


just before \makeatother in the code above.

The other method requires etoolbox:

\documentclass{report}
\usepackage{etoolbox}

\makeatletter
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\p@section}{\thechapter.}
\renewcommand{\p@subsection}{\thechapter.}
\renewcommand{\@seccntformat}[1]{%
}
\patchcmd{\@chapter}{\numberline}{\@gobble}{}{}
\makeatother

\begin{document}
\tableofcontents

\chapter{Chapter 1}\label{ch1}
\section{Section 1}\label{sec1}
\subsection{Subsection 1}\label{ssec1}
\subsection{Subsection 2}
\section{Section 2}

\ref{ch1}; \ref{sec1}; \ref{ssec1}

\end{document}


You can also get the same with tocloft.

-
@Mico That's a job for tocloft, of course. – egreg Feb 21 at 13:23
@Mico I added a couple of ways – egreg Feb 21 at 13:32