summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-06-01 22:55:28 +0000
committerKarl Berry <karl@freefriends.org>2006-06-01 22:55:28 +0000
commite39a33ec4d6321f43329645a687af33893234ff5 (patch)
treec0d0b451e31a63049413e1a1bd84a41561402303 /Master/texmf-dist/tex/latex
parent28be218625f3e3978617db02d1d16b56316f779a (diff)
new package chappg
git-svn-id: svn://tug.org/texlive/trunk@1646 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/chappg/chappg.sty140
1 files changed, 140 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/chappg/chappg.sty b/Master/texmf-dist/tex/latex/chappg/chappg.sty
new file mode 100644
index 00000000000..cd4526335d7
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/chappg/chappg.sty
@@ -0,0 +1,140 @@
+%%
+%% 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'.