52

I'm trying to make a PDF document, using the book class, divided like this:

  • Part: 1
    • Chapter 1
    • Chapter 2
    • Etc.
  • Part: 2
    • Chapter 1
    • Chapter 2
    • Etc.

How do I do this without the break in page numbers?

lockstep
  • 250,273
Simon
  • 523
  • Sorry for not being specific enough. I'm using book class, and with "messing up the numbers" I mean that I don't want a break in the page numbers. So I want them to be continuously and don't start over whenever I begin a new part. –  Nov 22 '11 at 15:36
  • I've updated the question with this information :). –  Nov 22 '11 at 15:41

1 Answers1

55

There is nothing fancy about creating such a document in LaTeX. You can use either the report or book document class (or another, like memoir). The example below uses the book document class.

enter image description here

\documentclass{book}
% Comment the following to have chapters numbered without interruption (numbering through parts)
\makeatletter\@addtoreset{chapter}{part}\makeatother%
\begin{document}
\tableofcontents
\part{First part}
\chapter{First chapter}
\chapter{Second chapter}
%...
\chapter{Last chapter}
\part{Second part}
\chapter{First chapter}
\chapter{Second chapter}
%...
\chapter{Last chapter}
\part{Last part}
\chapter{First chapter}
\chapter{Second chapter}
%...
\chapter{Last chapter}
\end{document}

The \tableofcontents shows the document structure. In order to have this structure accurately represent the document contents, you need to compile your code at least twice. Similar counter-resetting functionality is provided by the cnhgcntr package via \counterwithin*{chapter}{part}, although LaTeX provides its own \@addtoreset{<slave>}{<master>}. Here is some information on counter resetting: Master and slave counters

If you want to have the numbering continue through the parts (rather than having it numbered on a per-part basis), you can comment the 3rd line of code.

David Carlisle
  • 757,742
Werner
  • 603,163
  • Thanks a lot! The "\part{}"-command and the last part with uncomment the 3rd line did the job – Simon Nov 22 '11 at 16:07
  • @Simon: I've reverted my answer to have the chapters numbered on a per-part basis, rather than displaying it with the possibility to number as such. I know it already solved your problem; I just wanted to be consistent in the presentation, as reflected in your original question. – Werner Nov 22 '11 at 17:00
  • 1
    do you know how to remove the blank page after the part?
    Right now it is:
    part 1
    blank page
    chapter 1
    part 2
    blank page
    chapter 1

    I have tried with
    \makeatletter@openrightfalse
    \part{A}
    @openrighttrue\makeatother

    But that didn't help.

    – Simon Nov 23 '11 at 10:17
  • A note for hyperref: \@addtoreset and \counterwithin should be used after hyperref is loaded. – Heiko Oberdiek Aug 23 '15 at 08:52