summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pagerange
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-11-27 01:32:09 +0000
committerKarl Berry <karl@freefriends.org>2009-11-27 01:32:09 +0000
commit9b8e7ac910475d5ec581b47d047aeb4bf3d496f9 (patch)
treeecd5f64b4fb3310f6426736136ffe637b7026e31 /Master/texmf-dist/tex/latex/pagerange
parentf13fb3da96640748f7fd22480d3f45215a1248d3 (diff)
pagernage update (26nov09)
git-svn-id: svn://tug.org/texlive/trunk@16191 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pagerange')
-rw-r--r--Master/texmf-dist/tex/latex/pagerange/pagerange-guide.cfg49
-rw-r--r--Master/texmf-dist/tex/latex/pagerange/pagerange.sty118
2 files changed, 109 insertions, 58 deletions
diff --git a/Master/texmf-dist/tex/latex/pagerange/pagerange-guide.cfg b/Master/texmf-dist/tex/latex/pagerange/pagerange-guide.cfg
new file mode 100644
index 00000000000..623df949a11
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/pagerange/pagerange-guide.cfg
@@ -0,0 +1,49 @@
+\ProvidesFile{pagerange-guide.cfg}%
+ [2009/11/07 v0.2 Configuration file for pagerange-guide.tex (A.Musa)]
+\usepackage{xspace}
+\usepackage{xcolor}
+\usepackage{shortvrb}
+\usepackage{fancyvrb}
+\usepackage{parskip}
+\usepackage{paralist}
+\usepackage{fancyhdr}
+\usepackage{tabularx}
+\usepackage[draft,allpages]{draftmark}
+\draftmarksetup{mark={\color{red}\framebox[22.3cm][c]{}\\[15.4cm]
+ \color{red}\framebox[22.3cm][c]{}},angle=90,scale=1,
+ xcoord=-.5,ycoord=-1.5}
+\ifx\pagerange\relax\usepackage[acceptempty,hyperlink]{pagerange}\fi
+\ifx\lastpage\relax\usepackage{lastpage}\fi
+\usepackage{hyperref}
+\hypersetup{colorlinks=true,linkcolor=red,pdfpagemode=UseThumbs,
+ implicit=true,breaklinks=true,citecolor=purple,pdfview=FitH,
+ pdfstartview=FitH}
+\CustomVerbatimEnvironment{pverbatim}{Verbatim}{numbers=left,
+ numberblanklines=false,firstnumber=last,frame=single,rulecolor=\color{yellow},
+ framerule=2pt,framesep=2pt, fillcolor=\color{magenta},formatcom=\color{blue},
+ xrightmargin=-0pc,commandchars=\|\(\),commentchar=W}
+\providecommand*\eg{e.g.\xspace}
+\providecommand*\ie{i.e.\xspace}
+\newcommand*\email[1]{\href{mailto:#1}{#1}}
+\newcommand*\pgtxtt{\fontfamily{txtt}\selectfont\scshape\color{brown}}
+\fancyhf{}
+\fancyhfoffset[R,L]{\dimexpr\marginparsep+\marginparwidth\relax}
+\lhead{\pgtxtt The \texttt{\textcolor{blue}{pagerange}} Package}
+\rhead{\pgtxtt Page~\thepage~of~\pageref*{LastPage}}
+\renewcommand\headrule{\color{blue}\hrule height1pt width\headwidth\relax
+ \vspace{2pt}\hrule height1pt width\headwidth\vspace{-2pt}}
+\renewcommand\footrule{\color{blue}\hrule height1pt width\headwidth\relax
+ \vspace{2pt}\hrule height1pt width\headwidth\vspace{2pt}}
+\date{\textcolor{purple}{\today}\vadjust{\kern1ex\hrule}}
+\newcounter{examplecnt}[section]
+\newcommand*\pgexample[1]{%
+ \refstepcounter{examplecnt}%
+ \endgraf\vspace*{0.5\baselineskip}%
+ \textbf{\textcolor{purple}{Example~\thesection.\theexamplecnt\enspace}#1}%
+ \endgraf\nobreak
+}
+\providecommand\space{ }
+\definecolor{xgreen}{rgb}{0.00,0.59,0.00}
+\newcommand*\result[1]{\textcolor{xgreen}{#1}}
+
+\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/pagerange/pagerange.sty b/Master/texmf-dist/tex/latex/pagerange/pagerange.sty
index a002d738707..36d7b3ca408 100644
--- a/Master/texmf-dist/tex/latex/pagerange/pagerange.sty
+++ b/Master/texmf-dist/tex/latex/pagerange/pagerange.sty
@@ -1,42 +1,11 @@
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
-% This is file 'pagerange.sty'. %
+% This is file 'pagerange.sty', version 0.2. %
% %
-% When a given page range xx-yy (simple/plain characters) or %
-% \pages (command token, eg, \def\pages{xx-yy}) is submitted to the macro %
-% \pagerange (eg, \pagerange{xx-yy} or \pagerange\pages), this package %
-% splits the range as xx in the macro \pagestart and yy in \pageend. %
-% The counter equivalents of these are \prg@cnta and \prg@cntb. %
-% The command token (eg, \pages) is fully expanded before the page %
-% range is split. %
-% %
-% If you specify a range consisting of a hyphen (or any tie) but with %
-% one or two empty page numbers, the following will happen: %
-% 1. a range of the form -34 is taken to mean pages 1 to 34; %
-% 2. a range of the form 12- is taken to mean page 12 to last page; %
-% 3. a range of the form - (only hyphen) is taken to mean page 1 to %
-% last page; %
-% %
-% An empty or blank page range (ie, containing no argument and no %
-% hyphen/tie) is taken to mean range 1-1 or it may prompt a fatal error, %
-% depending on whether the boolean 'acceptempty' is true or false %
-% (respectively). %
-% %
-% Page ranges containing more than one hyphen/tie cause fatal error. %
-% %
-% If the upper limit of the page range is smaller than the lower %
-% limit, a fatal error is flagged. %
-% %
-% The tie between the pages in the pagerange can be any single %
-% non-active character; its default is the hyphen '-'. It can be %
-% changed in the call to the package (eg, \usepackage[tie=+]{pagerange}) %
-% or at any moment through \pagerangeoptions{tie=+}. Of course, active %
-% characters can't be used as ties. %
-% %
-% Because of the need for the last page of the document, at leat 2 %
-% runs/passes are needed to obtain the correct last page. %
-% %
-% This package has been tested with the 'hyperref' package, which %
-% redefines the label used by the 'lastpage' package. %
+% This work may be distributed and/or modified under the conditions %
+% of the LaTeX Project Public License, either version 1.3 of this %
+% license or any later version. The latest version of this license %
+% is in http://www.latex-project.org/lppl.txt and version 1.3 or later %
+% is part of all distributions of LaTeX version 2005/12/01 or later. %
% %
% The LPPL maintenance status of this software is 'author-maintained'. %
% %
@@ -48,17 +17,60 @@
% Copyright (c) 2009 Ahmed Musa (a.musa@rocketmail.com). %
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
-\ProvidesPackage{pagerange}[2009/05/10 v0.1 Split page ranges intelligently]
+\ProvidesPackage{pagerange}[2009/11/10 v0.2 Split page ranges intelligently]
\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\def\prg@warn#1{\PackageWarningNoLine{pagerange}{#1}}
\def\prg@err#1{\PackageError{pagerange}{#1}{\@ehc}}
\RequirePackage{lastpage}[1994/06/25]
\RequirePackage{xkeyval}[2008/08/13]
-\newcount\orighyphencode\orighyphencode=\the\catcode045\relax
-\AtEndOfPackage{\catcode045=\orighyphencode}
-\catcode045=12\relax
+\ifcase\ifx\eTeXversion\@undefined\@ne\else
+ \ifnum\eTeXversion<\tw@\@ne\fi\fi\z@
+\else
+ \prg@err{This package requires eTeX version 2 or later}%
+\fi
+\def\prg@ifdef#1{\csname @\ifdefined#1\expandafter first\else
+ \expandafter second\fi oftwo\endcsname
+}
+\def\prg@ifundef#1{%
+ \prg@ifdef#1{\csname @\ifx#1\relax\expandafter first\else
+ \expandafter second\fi oftwo\endcsname}{\@firstoftwo}%
+}
+\def\prg@check@ifdef#1{%
+ \expandafter\prg@ifundef\csname#1\endcsname{}{%
+ \prg@err{\expandafter\noexpand\csname#1\endcsname already defined}}%
+ \prg@check@ifdef
+}
+\prg@check@ifdef{pagerange}{pagestart}{pageend}{orighyphencode}%
+ \iffalse\fi\fi\endcsname{}{}
+\newcount\orighyphencode\orighyphencode=\the\catcode45\relax
+\AtEndOfPackage{\catcode45=\orighyphencode}
+\@makeother\-
+\chardef\active=13\relax
+\begingroup
+ \catcode`\&=3\relax
+ \long\gdef\prg@ifblank#1{% credit: ifmtarg.sty
+ \prg@ifblank@i#1&&\@secondoftwo\@firstoftwo:}
+ \long\gdef\prg@ifblank@i#1#2&#3#4#5:{#4}
+\endgroup
+\long\def\prg@xifblank#1{\begingroup
+ \protected@edef\@tempa{\endgroup\noexpand\prg@ifblank{#1}}%
+ \@tempa
+}
\define@boolkeys[KV]{pagerange}[prg@]{acceptempty,hyperlink}[true]
-\define@cmdkey[KV]{pagerange}[prg@]{tie}[-]{}
+\define@cmdkey[KV]{pagerange}[prg@]{tie}[-]{%
+ \edef\prg@tie{\prg@tie}%
+ \prg@ifmacro\prg@tie
+}
+\def\prg@ifmacro#1{%
+ \prg@ifdef#1{%
+ \expandafter\def\expandafter\getparameter
+ \detokenize{macro}:##1->##2##3@stop{\prg@ifblank{##1}{%
+ \prg@ifblank{##3}{}{\prg@ismacro@err#1}}{\prg@ismacro@err#1}
+ }%
+ \expandafter\getparameter\meaning#1@stop
+ }{\prg@err{\string#1 undefined}}%
+}
+\def\prg@ismacro@err#1{\prg@err{Illegal 'tie'}}
\DeclareOptionX*{\prg@warn{Unknown option '\CurrentOption' ignored}}
\ExecuteOptionsX<pagerange>{tie}
\ProcessOptionsX*<pagerange>\relax
@@ -69,19 +81,9 @@
\ifx\relax#2\relax%
\relax
\else
- \prg@forall#2\do{#3}
+ \prg@forall#2\do{#3}%
\fi
}
-\begingroup
-\catcode`\&=3\relax
-\long\gdef\prg@ifblank#1{% adapted from ifmtarg.sty
- \i@prg@ifblank#1&&\@secondoftwo\@firstoftwo:}
-\long\gdef\i@prg@ifblank#1#2&#3#4#5:{#4}
-\endgroup
-\long\def\prg@x@ifblank#1{\begingroup
- \protected@edef\@tempa{\endgroup\noexpand\prg@ifblank{#1}}
- \@tempa
-}
\let\pagestart\@empty
\let\pageend\@empty
\newcount\prg@cntx\prg@cntx=\z@\relax
@@ -106,7 +108,7 @@
\let\pagestart\@empty
\let\pageend\@empty
\prg@cntx=\z@\relax
- \prg@x@ifblank{#1}{%
+ \prg@xifblank{#1}{%
\ifprg@acceptempty
\prg@warn{Blank page range supplied:\MessageBreak
I've therefore set the range as 1-1 and continued}
@@ -118,9 +120,9 @@
}{%
\begingroup
\edef\@tempa{\endgroup%
- \noexpand\prg@forall#1\noexpand\do{\noexpand\prg@split@pagerange}}
+ \noexpand\prg@forall#1\noexpand\do{\noexpand\prg@split@pagerange}}%
\@tempa
- }
+ }%
\ifx\@empty\pagestart
\ifnum\prg@cntx=\@ne
\def\pagestart{1}%
@@ -131,9 +133,9 @@
\prg@cntb=100000\relax
\ifnum\prg@cntx=\@ne
\ifprg@hyperlink
- \def\pageend{\pageref{LastPage}}
+ \def\pageend{\pageref{LastPage}}%
\else
- \def\pageend{\pageref*{LastPage}}
+ \def\pageend{\pageref*{LastPage}}%
\fi
\fi
\else