\chapter
calls \@chapter
, which does \refstepcounter
(in mainmatter
mode) -- this means that any counter on the reset list of the chapter counter is reset to zero, this is true for the section
counter of course.
Either \@chapter
is redefined or one can add some additional code, that sets the section counter to -1
after the refstepping has be done.
Please note: This does not set the subsection
counters to -1 etc.
\documentclass{book}
\usepackage{xpatch}
\makeatletter
\AtBeginDocument{%
\xpatchcmd{\@chapter}{%
\refstepcounter{chapter}%
}{%
\refstepcounter{chapter}%
\setcounter{section}{-1}%
}{\typeout{Success}}{}
}
\makeatother
\begin{document}
\tableofcontents
\chapter{First chapter}
\section{First section}
\section{Second section}
\section{Third section}
\chapter{Second chapter}
\section{First section}
\section{Second section}
\section{Third section}
\end{document}

Here's a version that cascades down to \subparagraph
:
\documentclass{book}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\@sect}{%
\refstepcounter{#1}%
}{%
\refstepcounter{#1}%
% Now use the \@elt - trick to set all depending counters to -1 (well even that one that shouldn't, most likely :-()
\def\@elt##1{\setcounter{##1}{-1}}
\csname cl@#1\endcsname%
}{}{}
\AtBeginDocument{%
\xpatchcmd{\@chapter}{%
\refstepcounter{chapter}%
}{%
\refstepcounter{chapter}%
\setcounter{section}{-1}%
}{\typeout{Success}}{\typeout{Failed!}}
}
\makeatother
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{5}
\begin{document}
\tableofcontents
\chapter{First chapter}
\section{First section}
\subsection{First subsection}
\subsubsection{First subsubsection}
\paragraph{First paragraph}
\subparagraph{First subparagraph}
\section{Second section}
\subsection{First subsection}
\subsubsection{First subsubsection}
\paragraph{First paragraph}
\subparagraph{First subparagraph}
\section{Third section}
\chapter{Second chapter}
\section{First section}
\section{Second section}
\section{Third section}
\end{document}
0
?