# Let the section of the part recount [duplicate]

I want every part have a new counter.

\documentclass[UTF8,10pt,a4paper]{article}
\author{wsy}
\title{test}
\begin{document}
\maketitle

\tableofcontents
\part{part $1$}
\section{part 1, section 1}
\part{part $2$}
\section{  how to make this section label become 1}
%(* now  it is 1 *)
\end{document}

• article does not provide chapters. Are you looking for report class? – Johannes_B Dec 3 '16 at 7:45
• To the actual problem: \usepackage{chngcntr} \counterwithin{section}{part}  – Johannes_B Dec 3 '16 at 7:50
• this is useful, but have a problem. section name and content is partial overlap – tiankonghewo Dec 3 '16 at 7:54

With chngcntr it's easy:

\documentclass[10pt,a4paper]{article}
\usepackage{chngcntr}

\counterwithin*{section}{part}

\author{wsy}
\title{test}
\begin{document}
\maketitle

\tableofcontents

\part{part 1}
\section{part 1, section 1}

\part{part 2}
\section{how to make this section label become 1}

\end{document}


Note \counterwithin*, so the definition of \thesection is not changed.

If you want arabic numbers for parts and sections in the style part.section, you can do like

\documentclass[10pt,a4paper]{article}
\usepackage{chngcntr}
\usepackage{xpatch}

\renewcommand{\thepart}{\arabic{part}}
\counterwithin{section}{part}
\makeatletter
\xpatchcmd{\l@section}{1.5em}{2em}{}{}
\xpatchcmd{\l@subsection}{1.5em}{2em}{}{}
\xpatchcmd{\l@subsection}{2.3em}{2.8em}{}{}
\makeatother

\author{wsy}
\title{test}
\begin{document}
\maketitle

\tableofcontents

\part{part 1}
\section{part 1, section 1}
\subsection{what's this}

\part{part 2}
\section{how to make this section label become 1}

\end{document}