jw@aplvax.jhuapl.edu (Jeff Wong) (07/26/88)
I am currently creating a new document style which requires that the page numbers be the section number with the page number of that section attached, for example, 2-4, or page four of section two. This style carries over in the appendixes of this type of document such that I will end up with page numbers like B-2. The document style which I am using as a basis is the 'article' document style. I have created a new counter which is implemented as each new section is called and in my page style it specifies... \arabic{sectioncounter}--\arabic{page} in my footer information. How do I go about getting these changes to show up in the table of contents. Thanks in advance. Amanda S. Hanes (using J.W.'s account)
tgl@zog.cs.cmu.edu (Tom Lane) (07/26/88)
In article <1369@aplcomm.jhuapl.edu>, jw@aplvax.jhuapl.edu (Jeff Wong) writes: > I am currently creating a new document style which requires that the > page numbers be the section number with the page number of that section attached, > for example, 2-4, or page four of section two. This style carries over in the > appendixes of this type of document such that I will end up with page numbers > like B-2. The document style which I am using as a basis is the 'article' > document style. I have created a new counter which is implemented as each new > section is called and in my page style it specifies... > > Amanda S. Hanes (using J.W.'s account) Actually, you shouldn't be changing the page style at all. What you want to mess with is the \thepage macro, which defines how the page number is displayed. Fixing that will automatically fix your table of contents, *and* page cross-references, etc. It turns out to be a bit more complicated than that, because you also need to make sure the page number counter is reset at the right times. Here is the solution I used recently: \makeatletter %%%%% Number pages in style chapter-page. % This is invoked by \bychapterhack, rather than \pagenumbering{bychapter}. % The command must be placed in the root file, not an include file. \newif\if@bychapter \@bychapterfalse \def\bychapterhack{\@bychaptertrue\def\thepage{\thechapter-\@arabic\c@page}} \def\chapter{\cleardoublepage % Start new right-hand page. % \thispagestyle{plain} % Page style of chapter page is 'plain' \if@bychapter \setcounter{page}{1}\fi \global\@topnum\z@ % Prevents figures from going at top of page. \@afterindentfalse % Suppress indent in first paragraph. Change \secdef\@chapter\@schapter} % to \@afterindenttrue to cause indent. \def\appendix{\cleardoublepage % Get to RH page before changing chapter! \setcounter{chapter}{0} \setcounter{section}{0} \count2=1 % Mark DVI file pages \def\@chapapp{Appendix} \def\thechapter{\Alph{chapter}}} \def\@pnumwidth{2.5em} % page number width in table of contents \countdef\c@chapter=1 % put chapter number into DVI file pages \makeatother (Omit the \makeatletter and \makeatother if you put this in a .sty file.) The document that goes with this looks like so: \pagenumbering{roman} title page, \tableofcontents, etc. \cleardoublepage \bychapterhack \chapter{the first} etc. etc. \appendix \chapter{the first appendix} etc. etc. This was based on "book" style, but I think it would need no changes for "article" style. -- tom lane Internet: tgl@zog.cs.cmu.edu UUCP: <your favorite internet/arpanet gateway>!zog.cs.cmu.edu!tgl BITNET: tgl%zog.cs.cmu.edu@cmuccvma