I have already asked a similar question here:
Incorrect ToC/Index cross-references when resetting memoir class counters
and received a satisfactory answer. Now, I wish to apply the chapter counter reset (using \counterwithin*) to a more complex document, but this seems to fail. I simply wish to restart the chapter counter within each Part of a Book, and within each Book of my document structure, which goes like this:
Book1
- Part1
- Chapter1
- ...
- Part2
- Chapter1
- ...
- ...
- Part1
Book2
- Chapter1
- ...
Book3
- Chapter1
- ...
I currently have the following MWE:
\documentclass[a4paper,12pt]{memoir}
\usepackage{hyperref}
\hypersetup{
hypertexnames=true,
linktocpage=false,
colorlinks=true,
}
\counterwithin*{chapter}{book}
\counterwithin*{chapter}{part}
\begin{document}
\tableofcontents*
\book{Book1}
\part{Part1}
\chapter{Chapter1}
\part{Part2}
\chapter{Chapter1}
\book{Book2}
\chapter{Chapter1}
\book{Book3}
\chapter{Chapter1}
\end{document}
I can't seem to get proper cross-referencing in my ToC for chapters in Book2 and Book3. Should I splice the \counterwithin* commands somehow throughout the sections?