avoyance wrote:
This code is only good for the first chapter. But for the second, and the chapters follows, it has no use. Sorry I do not know how to modify it.
It would be convenient to support such a criticism with some code or well-founded arguments

. In fact, it seems to me that you have misunderstood the opening post, which only mentions the use of parts and sections. It can be logically assumed that the underlying document class is article (or an article-like class). So it has no sense to speak about chapters. It is quite clear that the above code should be adapted for the book and report classes if sections, except the first one, are required to start in a new page inside every chapter. The code works well for articles, except, perhaps some details that may need some tweaking depending on the author's needs. Assume, for example, that, coherently, parts should also start in a new page, that the section counter must be reset in each part, and that floats of a section should be placed before the beginning of the next section. Here you have a complete example:
Code: Select all
\documentclass[a4paper]{article}
\makeatletter
\newif\iffirstsection \firstsectiontrue
\let\@partOLD\@part
\renewcommand{\@part}[2][]{\clearpage\@partOLD[#1]{#2}\firstsectiontrue}
\let\@spartOLD\@spart
\renewcommand{\@spart}[1]{\clearpage\@spartOLD{#1}\firstsectiontrue}
\renewcommand{\section}{%
\iffirstsection\firstsectionfalse\else\clearpage\fi%
\@startsection {section}{1}%
{\z@}{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}{\reset@font\Large\bfseries}}
\@addtoreset{section}{part}
\makeatother
\begin{document}
\title{Test of some code}
\author{You and Me}
\date{\today}
\maketitle
\begin{abstract} Testing some code about parts and sections. \end{abstract}
\tableofcontents
\part{Title of the first part}
\section{Title of the first section in the first part}
This section goes in the same page as the part title.
\section{Title of the second section in the first part}
This section goes in a new page.
\section{Title of the third section in the first part}
This section goes in a new page.
\part{Title of the second part}
\section{Title of the first section in the second part}
This section goes in the same page as the part title.
\section{Title of the second section in the second part}
This section goes in a new page.
\section{Title of the third section in the second part}
This section goes in a new page.
\end{document}