Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  Simon Nov 22 '11 at 15:36
    
I've updated the question with this information :). –  Lewis Norton Nov 22 '11 at 15:41
add comment

migrated from stackoverflow.com Nov 22 '11 at 16:00

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 13 down vote accepted

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.

share|improve this answer
    
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
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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