0

How can get section numbers to start at \thechapter * 100. So we have in chapter 1: section 100, section 101, etc

In chapter 2: section 200, section 201, etc

Sam
  • 89

2 Answers2

2

Adaptations

  • calculate section number with \the\numexpr100*\thechapter-1\relax
  • use xpatch to execute the \setcounter command after each chapter

Code

\documentclass{book}

\usepackage{xpatch} \makeatletter \xapptocmd{@chapter}{% \setcounter{section}{\the\numexpr100*\thechapter-1\relax} }{}{} \makeatother

\begin{document}

\chapter{A}

\section{A1} \section{A2} \chapter{B} \section{B1} \section{B2}

\end{document}

Result

enter image description here enter image description here

dexteritas
  • 9,161
  • 1
    Wow! This is pretty much exactly what I was looking for! I should be able to figure out how to get rid of extra "1" or "2" at beginning of headings, but now the numbering works correctly. – Sam Feb 06 '23 at 20:15
0

You can set the counter to any number you want \setcounter{section}{99}

Houcine
  • 136
  • 1
    Great. But in chapter 2, I want \setcounter{section}{199}.

    What if I have \input{chapter1} \input{chapter2} and then rearrange? Don't want to be manually reseting counters per chapter.

    How do I \setcounter{section}{ \thechapter *100 -1}

    – Sam Feb 06 '23 at 18:03