Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.text Subject: Re: Looking for style for numbering pages by chapter Message-ID: <21526@mimsy.umd.edu> Date: 29 Dec 89 05:36:05 GMT References: <915@eecea.eece.ksu.edu> Distribution: usa Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 36 In article <915@eecea.eece.ksu.edu> khc@eecea.eece.ksu.edu Ken Carpenter) writes: >I recall seeing some discussion earlier about ways to cause LaTeX to >number pages within chapters and still preserve this in the table >of contents. (Page numbers like, e.g., 3-5, for the 5th in chpt.3.) At the least, you need to: a) tell LaTeX to how to write page numbers: \def\thepage{\arabic{chapter}--\arabic{\page}} b) make LaTeX reset \c@page on changing chapters: % \@addtoreset{page}{chapter} % the above does not work, since LaTeX wants the page number % to start at 1, not zero. Instead, we redefine \cl@chapter % directly: {\let\@elt\relax\xdef\cl@chapter{\cl@chapter\global\c@page=1\relax}} As a nicety, useful with dviselect, it helps to adjust the counter usage as well: \countdef\c@chapter=0 % use \count0 for chapter ... \countdef\c@page=1 % and \count1 for page within chapter \c@chapter=0 \c@page=1 % accomodate LaTeX's counting peculiarities Putting the above commands in a style file will suffice for simple tasks: % cat c-p.sty \countdef\c@chapter=0 \countdef\c@page=1 \c@chapter=0 \c@page=1 {\let\@elt\relax\xdef\cl@chapter{\cl@chapter\global\c@page=1\relax}} \def\thepage{\arabic{chapter}--\arabic{page}} % Something fancier is probably needed if the LaTeX program uses \pagestyle. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris