0

Following, this answer I've been able to start anew the \chapter numbering for each new \part. Unfortunately, that didn't affect the unnumbered \part*s.

Manually setting the counter (\setcounter{chapter}{0}), seems to do the job as long as hyperref is not involved. However, resetting the counter causes TOC to link the chapters in the unnumbered part to the chapters with the same local number from a previous part, which doesn't happen with automatically restarted chapters in numbered parts. E.g. "Discussion" points to "At First I Was Afraid".

\documentclass{report}
\usepackage{hyperref}
\makeatletter
\@addtoreset{chapter}{part}
\makeatother

\begin{document}
\tableofcontents
\chapter*{Foreword}
\addcontentsline{toc}{chapter}{Foreword}
\chapter*{Achnowlegements}
\addcontentsline{toc}{chapter}{Acknowlegements}
\part*{Introduction}
\addcontentsline{toc}{part}{Introduction}
\chapter{Background}
\chapter{Related Work}
\part{Where It All Begun...}
\chapter{At First I Was Afraid}
\chapter{I Was Petrified}
\part*{Discussion and Future Work}
\setcounter{chapter}{0}
\addcontentsline{toc}{part}{Discussion and Future Work}
\chapter{Discussion}
\chapter{Future Work}
\end{document}

\@add to reset{chapter}{part*} seems to have no effect at all.

What is the proper way to reset chapter numbering for both numbered and unnumbered parts?

  • What's the reason for an unnumbered part? Assuming that resetting the chapter number at parts is a good idea, which it isn't. – egreg Jan 19 at 15:37
  • The unnumbered parts are the "intro" and "outro", they don't really deserve a number in my book. – Necto Jan 19 at 16:46
  • Neither you need to restart chapter numbers. – egreg Jan 19 at 16:59
1

You have to provide clues for hyperref in order to distinguish equally numbered chapters. This can be done by redefining \theHchapter. For the last part, provide a suitable value for \theHpart.

Of course, your internal references to chapters will be clumsy: “in chapter 1 of the introduction part” or “in chapter 3 of part II”.

Avoid resetting chapter numbers, if you are not compelled to by some devious rule.

\documentclass{report}
\usepackage{hyperref}

\counterwithin*{chapter}{part}
\renewcommand{\theHchapter}{\theHpart.\thechapter}

\begin{document}
\tableofcontents

\chapter*{Foreword}
\addcontentsline{toc}{chapter}{Foreword}

\chapter*{Achnowlegements}
\addcontentsline{toc}{chapter}{Acknowlegements}

\part*{Introduction}
\addcontentsline{toc}{part}{Introduction}

\chapter{Background}
\chapter{Related Work}

\part{Where It All Begun...}
\chapter{At First I Was Afraid}
\chapter{I Was Petrified}

\part*{Discussion and Future Work}
\setcounter{chapter}{0}\renewcommand{\theHpart}{DFW}
\addcontentsline{toc}{part}{Discussion and Future Work}

\chapter{Discussion}
\chapter{Future Work}

\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.