1

I would like a numbering of the sections as below. I have previously asked this question in Numbering sections independent of chapters numbering. An excellent answer was provided https://tex.stackexchange.com/a/207971/39306 using remreset package. Also a more general solution is given in https://tex.stackexchange.com/a/28334/39306 using chngcntr package.

I am wondering if there is a solution without the use of any external package?

Chapter 1
   section 1
   section 2
Chapter 2
   section 3
   section 4
   section 5
Chapter 3
   section 6
   section 7

Here is my file:

\documentclass{book}

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

\begin{document}
\tableofcontents
\chapter{First}
\section{First}
\section{Second}
\section{Third}
\chapter{Second}
\section{Fourth}
\section{Fifth}
\section{Sixth}

\end{document}
5
  • What is wrong with remreset? ;-)
    – user31729
    Commented Dec 3, 2014 at 13:55
  • @ChristianHupfer you should always avoid my packages Commented Dec 3, 2014 at 14:00
  • @ChristianHupfer your solution was excellent, and anything was wrong with it. I was just curious to know an answer without using an external package.
    – Name
    Commented Dec 3, 2014 at 14:03
  • @Name: I did not check that it was a solution of mine :D
    – user31729
    Commented Dec 3, 2014 at 14:07
  • Look at the package file, it is not very complicated ;-)
    – Johannes_B
    Commented Dec 3, 2014 at 14:33

1 Answer 1

3
\documentclass{book}

\makeatletter
\def\cl@chapter{}
\makeatletter

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

\begin{document}
\tableofcontents
\chapter{First}
\section{First}
\section{Second}
\section{Third}
\chapter{Second}
\section{Fourth}
\section{Fifth}
\section{Sixth}

\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .