Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!uhccux!munnari.oz.au!murtoa.cs.mu.oz.au!viccol!dougcc From: dougcc@csv.viccol.edu.au (Douglas Miller) Newsgroups: comp.text Subject: Re: Page numbering by chapter in LaTeX Message-ID: <819@csv.viccol.edu.au> Date: 20 Jul 89 04:34:08 GMT References: <31495@ccicpg.UUCP> Organization: Computer Services, Victoria College, Melbourne Lines: 74 In article <31495@ccicpg.UUCP>, swonk@ccicpg.UUCP (Glen Swonk) writes: > I would like to write a large document in pieces, > so that each chapter can be compiled/debugged separately. > > What I would like is a page numbering scheme that the page number > would restart at the beginning of each chapter > For example: > > Chapter1: Intro > pages 1-1 thru 1-10 > Of course, I would like to generate a table of contents > that reflect the page numbering style. Below are some fragments from our Operations Manaual style that provide what you have asked for (you may need to do some reconciliation with your style file). Also, roman numeral are used for pages before chapter one (e.g. the contents pages), and the TeX counters have been reasssigned, so that TeX reports pages as [0.1] [0.2] ... [1.1] [1.2] [1.3] ... [2.1] [2.2] ... etc. ---------------------------- cut here --------------------------- \input book.sty \def\chapter{\@startsection{chapter}{1}{\z@}% {-8ex}{3ex}{\huge\bf\centering}} \def\thechaptertext{} \def\chaptermark#1{\global\def\thechaptertext{#1}} \@addtoreset{page}{chapter} % the page counter will be reset at the % start of each chapter \def\manualpageheading#1#2#3#4{% \hspace{-0.75in}\parbox[t]{7.04in}{\sl \rule{0mm}{0mm} #1 \hfill #2\\ \rule{0mm}{0mm} #3 \hfill #4\vfill}} \def\manualpage{% \stepcounter{page}% \ifnum\value{chapter}>0% \global\def\thepage{\arabic{chapter}-\arabic{page}}\else \global\def\thepage{\roman{page}}\fi \manualpageheading{\thetitle}{Page \thepage}{\thechaptertext}{\shortdate}} \def\manual#1{% \countdef\c@chapter=0 \c@chapter=0 \countdef\c@page=1 \c@page=0 \def\thetitle{#1}% \let\@mkboth\markboth \def\@oddfoot{}\def\@evenfoot{}% No feet. \def\@evenhead{\manualpage} \def\@oddhead{\manualpage} \tableofcontents} -------------------------- cut here --------------------------------- % Example manual \documentstyle{manual} \begin{document} \manual{Technical Manual} \include{chapter-one} \include{chapter-two} \include{chapter-three} \end{document}