To get the output Toc or pdf bookmark below:
Part I
Chapter I
Chapter II
Part II
Chapter I
Chapter II
I need to reset the chapter counter. I google and get one method.
\makeatletter
\@addtoreset{chapter}{part}
\makeatother
Yes, It can output like this. But hyperref
package can not link to right target for chapters after chapter I. That is said page ref link broken.
I like to define all style in style file. the mini-document:
\documentclass[]{book}
\usepackage[]{hyperref}
\usepackage{mini} % my own style file
\begin{document}
\tableofcontents
\part{Test}
\chapter{One}
\chapter{Two}
\part{Test}
\chapter{Three}
\chapter{Four}
\end{document}
and the mini style file:
\renewcommand\part{%
\if@openright
\cleardoublepage
\else
\clearpage
\fi
\setcounter{chapter}{0}} % I reset manually here.
0
every time you issue a\part
command, you generate multiple instances of this counter taking on values1
,2
, etc. However,hyperref
needs a unique hook for each hyperlink it's supposed to create. Would you be willing to consider numbering your chapters as\thepart\thechapter
? This could be achieved by loading thechngcntr
package and issuing the command\numberwithin{chapter}{part}
. – Mico May 4 '12 at 13:38