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
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
\the\numexpr100*\thechapter-1\relaxxpatch to execute the \setcounter command after each chapter\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}
You can set the counter to any number you want \setcounter{section}{99}
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
\renewcommand{\chapter}{
\setcounter{section}{ 100\thechapter -1}
\oldchapter
}
% something like this? Not working!
– Sam Feb 06 '23 at 18:20\setcounter{section}{\numexpr\thechapter*100-1\relax}. Whether this is a good idea is another question. – Jasper Habicht Feb 06 '23 at 19:40