🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text
Article #400

Re: Page numbering by chapter in LaTeX (CORRECTED)

#400
From: Hellmuth Broda
Date: Wed, 26 Jul 1989 08:15
73 lines
3094 bytes
Sorry, I messed up because I wanted to catch a train...
In article <849@cgch.UUCP> whbr@cgchd6.UUCP (Hellmuth Broda) writes:
: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 (like it
:>does in some technical manuals).
:>
:>For example:
[...]
:>
:>Any help is appreciated.
:>thanks
:>Glenn L. Swonk		CCI Computers 
:>uunet!ccicpg!swonk
:
:We have been using the following approach:
:
Now here comes the corrected version:
:
\documentstyle{report}
\title{}
\author{}

\begin{document}
\maketitle
\pagenumbering{Roman}% The first pages will be numbered with `normal' Romans
\tableofcontents
\clearpage
% all this is irrellevant to the problem
\addcontentsline{toc}{chapter}{\protect\numberline{}{List of tables}}
\listoftables
\clearpage
\typeout{Starting chapter relative page numbering...}%  
% here comes the relevant part:
\makeatletter%                                        
\def\pagenumbering#1{\global\c@page \@ne%            
   \gdef\thepage{\thechapter -\csname @#1\endcsname \c@page}}% 
\makeatother
\setcounter{page}{1}
\pagenumbering{arabic}% The redefined command takes action
\include{FOO}
\include{BAR}
%...
\appendix
\include{REST}
%...
\end{document}

The included files start like:

\chapter{FOO}
\setcounter{page}{1}% Sorry---this line has to be added to each chapter.
		    % But that ain't much trouble ;-)
:
:------------
:This works with all xrefs, cits etc.  We had to twiggle our local 
:makeindex somewhat to have it digest the new page numbers but that
:was a job on a few awk scripts.
:
Acknowledgement: I want to thank Toni Wuersch <warw@cgch> who helped
		 considerably with the redefinition of \pagenumbering
:
:Hope that helps---Hellmuth Broda
 ___________________________________________________________________________
| Dr.rer.nat. Hellmuth W. Broda |  c/o CIBA-GEIGY Scientific Computing Ctr. |
| Biologist and Systems Analyst |  R-1045.3.16, P.O.Box, Tel:+4161 697-7109 |
| UUCP:...!uunet!mcvax!cernvax!cgch!whbr         CH-4002 Basel, Switzerland |
| Internet:whbr%cgch.uucp@uunet.uu.net; BITNET:whbr%cgch.uucp@cernvax.bitnet|
 ---------------------------------------------------------------------------
                ---The early bird gets caught by the worm---
Technical Details
Message-ID: <850@cgch.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!mcvax!cernvax!cgch!whbr
References: <31495@ccicpg.UUCP> <849@cgch.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!mcvax!cernvax!cgch!whbr
From: whbr@cgch.UUCP (Hellmuth Broda)
Newsgroups: comp.text
Subject: Re: Page numbering by chapter in LaTeX (CORRECTED)
Summary: redefine \pagenumbering
Keywords: LaTeX
Message-ID: <850@cgch.UUCP>
Date: 26 Jul 89 08:15:30 GMT
References: <31495@ccicpg.UUCP> <849@cgch.UUCP>
Sender: news@cgch.UUCP
Reply-To: whbr@cgchd6.UUCP (Hellmuth Broda)
Organization: c/o CIBA-GEIGY Ltd, Sci.Comp.Centre, CH-4002 Basel, Switzerland
Lines: 73