%% %% This is file `chappg.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% chappg.dtx (with options: `package') %% %% IMPORTANT NOTICE: %% %% For the copyright see the source file. %% %% Any modified versions of this file must be renamed %% with new filenames distinct from chappg.sty. %% %% For distribution of the original source see the terms %% for copying and modification in the file chappg.dtx. %% %% This generated file may be distributed as long as the %% original source files, as listed above, are part of the %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% This is chappg.dtx, and it's -*-LaTeX-*- text \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{chappg}% [2006/05/09 v2.1b page numbering by chapter number pages by chapter (or other unit)% ]% $Id: chappg.dtx,v 1.4 2006/05/09 07:12:20 rf10 Exp rf10 $ \newif\if@chappg@auto \@chappg@autofalse \newif\if@chappg@resetting \@chappg@resettingfalse \DeclareOption{auto}{\@chappg@autotrue} \DeclareOption{noauto}{\@chappg@autofalse} \ExecuteOptions{auto} \ProcessOptions \renewcommand\pagenumbering[2][\@chappg@thechapter]{% \global\c@page\@ne \protected@xdef\thepage{% \expandafter\noexpand\csname @#2\endcsname \noexpand\c@page }% \gdef\@chappg@prefix{#1}% \def\@tempa{#2}% \def\@tempb{bychapter}% \ifx\@tempa\@tempb \@chappg@checkloc \if@chappg@resetting \else \@addtoreset{page}{chapter}% \@chappg@resettingtrue \fi \else \if@chappg@resetting \@removefromreset{page}{chapter}% \@chappg@resettingfalse \fi \fi } \newcommand\@bychapter[1]{% \@chappg@prefix\chappgsep\@arabic#1% \ifx\@chappg@prefix\@chappg@surprise \if@chappg@surprised\else \xdef\@chappg@surprise@line{\the\inputlineno}% \global\@chappg@surprisedtrue \fi \fi } \def\@chappg@thechapter{% \ifnum\c@chapter=0 \expandafter\@gobble \else \thechapter \fi } \providecommand\chappgsep{-} \let\@@mainmatter\mainmatter \def\mainmatter{\@@mainmatter \if@chappg@auto\pagenumbering{bychapter}\fi } \let\@@backmatter\backmatter \def\backmatter{\@@backmatter \let\@chappg@prefix\@chappg@surprise } \def\@chappg@surprise{\textbf{??}} \newif\if@chappg@surprised \@chappg@surprisedfalse \AtEndDocument{% \if@chappg@badloc \PackageWarningNoLine{chappg}{Bad location for \string\pagestyle{bychapter} command \MessageBreak \string\clearpage\space or \string\cleardoublepage\space \MessageBreak recommended before \string\pagestyle\space on line \@chappg@badloc@line } \fi \if@chappg@surprised \PackageWarningNoLine{chappg}{Possibly surprising page numbering in \string\backmatter \MessageBreak Use \string\pagenumbering[prefix]{bychapter}% \MessageBreak to select alternative before line \@chappg@surprise@line } \fi } \newif\if@chappg@badloc \def\@chappg@checkloc{% \ifx\@onlypreamble\@notprerr \ifhmode \@chappg@badloctrue \xdef\@chappg@badloc@line{\the\inputlineno}% \else \ifdim\pagetotal>1sp \@chappg@badloctrue \xdef\@chappg@badloc@line{\the\inputlineno}% \fi \fi \fi % not in preamble } \renewcommand\@stpelt[1]{% \global\csname c@#1\endcsname \expandafter\ifx \csname c@#1\endcsname \c@page \@ne \else \z@ \fi } \if@chappg@auto\pagenumbering{bychapter}\fi %% fragment included from\\ %% CTAN macros/latex/contrib/fragments/removefr.tex %% \def\@removefromreset#1#2{\let\@tempb\@elt \expandafter\let\expandafter\@tempa\csname c@#1\endcsname \def\@elt##1{\expandafter\ifx\csname c@##1\endcsname\@tempa\else \noexpand\@elt{##1}\fi}% \expandafter\edef\csname cl@#2\endcsname{\csname cl@#2\endcsname}% \let\@elt\@tempb} \endinput %% %% End of file `chappg.sty'.