# Define new section

I have this document in the article documentclass. Everything is divided into sections and subsections. Now I'd like to have an example in my chapter two, that is also divided into sections. So I have my normal document and in the second section there is an example of some code where the section numbering starts again from 1... Not sure if I can make myself clear enough but here is some pseudocode;

\section{1}
\section{2}
\section{Here starts the example counter with 1}
\section{New section in the example}
\section{3}

-
\subsection and in the preamble \renewcommand*\thesubsection{\arabic{subsection}} will do? –  Count Zero Nov 22 '12 at 14:37
Take a look at this question: Deeper levels of (sub)sections –  mkota Nov 22 '12 at 14:38
Yeah okay... But the sections already have subsections of their own... –  Pieterjan Nov 22 '12 at 14:46

I'm not sure if I understand your question. Is this what you require?

\documentclass{article}
\begin{document}

\section{Section 1}
\section{Section 2}

\newcounter{sectionOld}
\setcounter{sectionOld}{\thesection}
\setcounter{section}{0}

\section{Here starts the example counter with 1}
\subsection{Subsection 1}
\section{New section in the example}
\subsection{Subsection 2}

\setcounter{section}{\thesectionOld}

\section{Section 3}

\end{document}

-
Yes! That's exactly it :) Thank you Jay! –  Pieterjan Nov 22 '12 at 15:19