0

I'm making some un-numbered chapters for my thesis but I'm adding numerated sections. The thing is that the enumeration doesn't reset when I add a new chapter, so I have

Chapter 1 > Section 1 - Section 2

Chapter 2 > Section 3 - Section 4

Instead of

Chapter 1 > Section 1 - Section 2

Chapter 2 > Section 1 - Section 2

This is a MWE, because I'm running fancyhdr and Creff, but I guess this does the work well enough portraying my problem

\documentclass[oneside]{amsbook}

\usepackage[utf8]{inputenc} \usepackage{manfnt} \usepackage{mathtools} \usepackage{tikz-cd} \usepackage{latexsym,mathrsfs} \usepackage{amsmath,amsthm,amsfonts,amssymb,enumerate}

\begin{document} \chapter{Ch 1} \input{chapters/ch1} \chapter{Ch 2} \input{chapters/ch2} \end{document}

Where each "ch" looks like this:

\section{Sec 1}
\subsection{Subsec 1}
\begin{theorem} \label{thmc1}
Thm
\end{theorem}

\section{Sec 2} \subsection{Subsec 2} \begin{theorem} \label{thmc2} Thm \end{theorem}

I'll add an image to make it easier to visualize:

enter image description here enter image description here

What I'm looking for is a way to reset the numeration of each section and subsection, etc. in each chapter, so it says 1. Sec 1 - 1.1 Subsec 1 in chapter 2, etc.

Thanks!

  • How should cross references look like? Something like "see Section 1" is ambiguous if you restart the section numbering inside of each unnumbered chapter. – leandriis Dec 29 '20 at 19:15
  • by adding an hyperlink to said theorem and clarifying, just in case, in which chapter it is, say something like "in Chapter 4, look at [theorem 1.1.3]", besides, in these unnumbered chapters I don't think I'll put many cross references outside the same chapter. – Duramil Dec 29 '20 at 19:17
  • 1
    You can use \setcounter{section}{0} to restart the section counter. Since you mentioned hyperlinks, the following question might also be interesting: Reset section numbering between unnumbered chapters – leandriis Dec 29 '20 at 19:24

1 Answers1

1

For working with hyperref, I suggest the following strategy.

\documentclass[oneside]{amsbook}

\usepackage[utf8]{inputenc} \usepackage{manfnt} \usepackage{mathtools} \usepackage{tikz-cd} \usepackage{mathrsfs} \usepackage{amsmath,amsthm,amsfonts,amssymb,enumerate} \usepackage{hyperref}

\newtheorem{theorem}{Theorem}[section]

\newcounter{fakechapter} \newcommand{\unchapter}[1]{% \chapter*{#1}% \stepcounter{fakechapter}% \setcounter{section}{0}% } \renewcommand{\theHsection}{F\thefakechapter.\arabic{section}} \newcommand{\normalchapters}{% \renewcommand{\thesection}{\thechapter.\arabic{section}}% \renewcommand{\theHsection}{\thechapter.\arabic{section}}% }

\begin{document}

\tableofcontents

\unchapter{Ch 1}

\section{Sec 1} \subsection{Subsec 1} \begin{theorem} \label{thmc1-A} Thm \end{theorem}

\section{Sec 2} \subsection{Subsec 2} \begin{theorem} \label{thmc2-A} Thm \end{theorem}

\unchapter{Ch 2} \section{Sec 1} \subsection{Subsec 1} \begin{theorem} \label{thmc1-B} Thm \end{theorem}

\section{Sec 2} \subsection{Subsec 2} \begin{theorem} \label{thmc2-B} Thm \end{theorem}

\normalchapters

\chapter{Normal} \section{Sec 1} \subsection{Subsec 1} \begin{theorem} \label{thmc1-C} Thm \end{theorem}

\section{Sec 2} \subsection{Subsec 2} \begin{theorem} \label{thmc2-C} Thm \end{theorem}

\end{document}

I removed latexsym that should not be used along with amssymb (and generally to be avoided anyway).

Remember to issue \normalchapters when you start with numbered chapters.

egreg
  • 1,121,712