summaryrefslogtreecommitdiff
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
parentf13fb3da96640748f7fd22480d3f45215a1248d3 (diff)
pagernage update (26nov09)
git-svn-id: svn://tug.org/texlive/trunk@16191 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/pagerange/README82
-rw-r--r--Master/texmf-dist/doc/latex/pagerange/pagerange-guide.pdfbin52617 -> 91597 bytes
-rw-r--r--Master/texmf-dist/doc/latex/pagerange/pagerange-guide.tex311
-rw-r--r--Master/texmf-dist/tex/latex/pagerange/pagerange-guide.cfg49
-rw-r--r--Master/texmf-dist/tex/latex/pagerange/pagerange.sty118
5 files changed, 395 insertions, 165 deletions
diff --git a/Master/texmf-dist/doc/latex/pagerange/README b/Master/texmf-dist/doc/latex/pagerange/README
index a13f231a81b..b80be0a1d74 100644
--- a/Master/texmf-dist/doc/latex/pagerange/README
+++ b/Master/texmf-dist/doc/latex/pagerange/README
@@ -1,48 +1,34 @@
-% This is file 'pagerange.sty'. %
-% %
-% 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. %
-% %
-% Copyright (c) 2009 Ahmed Musa (a.musa@rocketmail.com). %
-% %
-% The LPPL maintenance status of this software is 'author-maintained'. %
-% %
-% This software is provided 'as it is', without warranty of any kind, %
-% either expressed or implied, including, but not limited to, the %
-% implied warranties of merchantability and fitness for a particular %
-% purpose. %
-%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
+This is the README file for 'pagerange' package, 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 containing the page range (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.
+
+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'.
+
+This software is provided 'as it is', without warranty of any kind,
+either expressed or implied, including, but not limited to, the
+implied warranties of merchantability and fitness for a particular
+purpose.
+
+Copyright (c) 2009 Ahmed Musa (a.musa@rocketmail.com).
+
+End of README file. \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/pagerange/pagerange-guide.pdf b/Master/texmf-dist/doc/latex/pagerange/pagerange-guide.pdf
index 05d68998c73..c73d3c0168a 100644
--- a/Master/texmf-dist/doc/latex/pagerange/pagerange-guide.pdf
+++ b/Master/texmf-dist/doc/latex/pagerange/pagerange-guide.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/pagerange/pagerange-guide.tex b/Master/texmf-dist/doc/latex/pagerange/pagerange-guide.tex
index 866709ca404..6c1a330b496 100644
--- a/Master/texmf-dist/doc/latex/pagerange/pagerange-guide.tex
+++ b/Master/texmf-dist/doc/latex/pagerange/pagerange-guide.tex
@@ -1,109 +1,302 @@
\documentclass[10pt,a4paper]{article}
-\usepackage{lipsum}
-\usepackage{shortvrb}
-\usepackage{fancyvrb}
-\usepackage{parskip}
-\usepackage{paralist}
-\usepackage[acceptempty,hyperlink]{pagerange}
-\usepackage{hyperref}
-\hypersetup{colorlinks=true,linkcolor=red,pdfpagemode=UseThumbs,
- implicit=true,breaklinks=true,citecolor=purple,pdfview=FitH,
- pdfstartview=FitH}
+\InputIfFileExists{pagerange-guide.cfg}{}{%
+ \errmessage{No file pagerange-guide.cfg}}
+\pagestyle{fancyplain}
\begin{document}
\MakeShortVerb{\+}
-\title{The {\tt pagerange} Package}
+\title{\textbf{The {\tt pagerange} Package}\\[1ex] Version 0.2}
\author{Ahmed Musa\\[.5ex]University of Central Lancashire\\
- Preston, United Kingdom\\[1ex]\url{a.musa@rocketmail.com}
+ Preston, United Kingdom\\[1ex]\email{a.musa@rocketmail.com}
}
\maketitle
\section{Introduction}
This package emerged from my desire to resolve page ranges in the +draftmark+ package, but it may be useful to other \LaTeX{} enthusiasts.
-There is additional user guide in the comments within the package.
+\section{Usage}
+
+When a given page range +xx-yy+ (simple/plain characters) or +\pages+ (control sequence, \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 control sequence containing the page range (\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:
+\begin{compactenum}[a)]
+\item a range of the form ``+-34+'' is taken to mean pages~1 to 34;
+\item a range of the form ``+12-+'' is taken to mean page~12 to last page;
+\item a range of the form ``+-+'' (\ie, only hyphen and no pages) is taken to mean page~1 to the last page.
+\end{compactenum}
+
+An empty or blank page range (\ie, containing no argument and no hyphen/tie) is taken to mean the range +1-1+ or it may prompt a fatal error, depending on whether the boolean +acceptempty+ is set 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 page range can be any single non-active character; its default is the hyphen character ``+-+''. 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. The package easily terminates with a warning when an active character is passed as +tie+.
+
+Because of the need for the last page of the document, at least~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. By default, the last page is not hyperlinked. If you want the last page to be hyperlinked, you should set the boolean option +hyperlink=true+ in +\usepackage{pagerange}+ or in +\pagerangeoptions+.
+
+\section{Package options}
+The package has only three options, namely,
+
+\begin{tabularx}{\linewidth}{m{2.5cm}m{2.0cm}X}
+\bf Option & \bf Default & \bf Meaning\\
++tie+ & hyphen (+-+) & The tie that show the breakpoint for the page range.\\
++acceptempty+ & +false+ & The boolean option that specifies if empty page ranges (\ie, no page numbers and no tie) submitted to the package should be accepted. If +true+, the page range is assumed to be from page~1 to the last page.\\
++hyperlink+& +false+& The boolean switch that determines if the last page (of the page range) should be hyperlinked.\\
+\end{tabularx}
\section{Examples}
+\pgexample{}
+The following
+\begin{pverbatim}
\pagerange{123-456}
-\par\medskip\noindent
Pages~\pagestart\space to\space\pageend
+\end{pverbatim}
+\pagerange{123-456}
+produces \result{Pages~\pagestart\space to\space\pageend}.
+
+\pgexample{}
+
+The following
+
+\begin{pverbatim}
\pagerange{12345-67890}
-\par\medskip\noindent
-Pages~\pagestart\space to\space\pageend
+\end{pverbatim}
+\pagerange{12345-67890}
+produces \result{Pages~\pagestart\space to\space\pageend}.
+
+\pgexample{}
+The following
+
+\begin{pverbatim}
\pagerange{123-4567}
-\par\medskip\noindent
-Pages~\pagestart\space to\space\pageend
+\end{pverbatim}
+
+\pagerange{123-4567}
+produces \result{Pages~\pagestart\space to\space\pageend}.
+\pgexample{}
+The following
+
+\begin{pverbatim}
\pagerange{600-601}
-\par\medskip\noindent
-Pages~\pagestart\space to\space\pageend
+\end{pverbatim}
+\pagerange{600-601}
+produces \result{Pages~\pagestart\space to\space\pageend}.
+
+\pgexample{}
+The following
+
+\begin{pverbatim}
\pagerange{-34}
-\par\medskip\noindent
-Pages~\pagestart\space to\space\pageend
+\end{pverbatim}
+
+\pagerange{-34}
+produces \result{Pages~\pagestart\space to\space\pageend}.
+
+\pgexample{Hyperlinking of last page}
+
+The package was loaded as
+\par\medskip
+\centerline{\tt\string\usepackage[acceptempty,hyperlink]\{pagerange\},}
-\bigskip\noindent
-Hyperlinking of last page:
+in which both +acceptempty+ and +hyperlink+ are +true+. They can, of course, both be reversed (\ie, set as +false+). Since the prevailing value of +hyperlink+ is +true+, we see that
+
+\begin{pverbatim}
\pagerange{1-}
-\par\medskip\noindent
-Pages~\pagestart\space to\space\pageend
+\end{pverbatim}
-\pagerange{-}
-\par\medskip\noindent
-Pages~\pagestart\space to\space\pageend
+\pagerange{1-}
+yields \result{Pages~\pagestart\space to\space\pageend}.
-\bigskip\noindent
-No hyperlinking of last page:
+\pgexample{No hyperlinking of last page}
+In the following the value of +hyperlink+ is +false+:
+
+\begin{pverbatim}
\pagerangeoptions{hyperlink=false}
\pagerange{1-}
-\par\medskip\noindent
-Pages~\pagestart\space to\space\pageend
+\end{pverbatim}
+
+\pagerangeoptions{hyperlink=false}
+\pagerange{1-}
+which produces \result{Pages~\pagestart\space to\space\pageend}.
+\pgexample{No page numbers given}
+The following
+
+\begin{pverbatim}
+\pagerangeoptions{hyperlink=true}
\pagerange{-}
-\par\medskip\noindent
-Pages~\pagestart\space to\space\pageend
+\end{pverbatim}
-\pagerange{123-234}
+\pagerangeoptions{hyperlink=true}
+\pagerange{-}
\par\medskip\noindent
-Pages~\pagestart\space to\space\pageend
+produces \result{Pages~\pagestart\space to\space\pageend}.
-\pagerange{} % This logs a warning message or issues fatal error.
-\par\medskip\noindent
-Page~\pagestart\space to\space\pageend
+\pgexample{}
+The following logs a warning message or issues fatal error, depending on the status of +acceptempty+ option:
-%\pagerange{123-456-789} % Uncomment this line to get fatal error.
+\begin{pverbatim}
+\pagerange{}
+\end{pverbatim}
-%\pagerange{34-12} % Uncomment this line to get fatal error.
+%\pagerange{}
+%Page~\pagestart\space to\space\pageend
-\par\medskip
+\pgexample{}
+The following fails because of multiple hyphens (ties):
+
+\begin{pverbatim}
+\pagerange{123-456-789}
+\end{pverbatim}
+
+%\pagerange{123-456-789}
+
+\pgexample{}
+The following fails because +\pagestart+ is larger than +\pageend+:
+
+\begin{pverbatim}
+\pagerange{34-12}
+\end{pverbatim}
+
+%\pagerange{34-12}
+
+\pgexample{}
+The following fails because +tie+ can't be active character:
+
+\begin{pverbatim}
+\pagerangeoptions{tie=~}
+\end{pverbatim}
+
+%\pagerangeoptions{tie=~}
+
+\pgexample{}
+For the same reason (\ie, the use of active character as +tie+), the following fails---although nested commands are permitted:
+
+\begin{pverbatim}
+\def\Xone{~}
+\def\Xtwo{\Xone}
+\pagerangeoptions{tie=\Xtwo}
+\end{pverbatim}
+
+%\def\Xone{~}
+%\def\Xtwo{\Xone}
+%\pagerangeoptions{tie=\Xtwo}
+
+\pgexample{}
+The following works because the +\pagerange+ is fully expanded before splitting:
+
+\begin{pverbatim}
+\def\Xone{-}
+\def\Xtwo{\Xone}
+\pagerange{22\Xtwo 23}
+\end{pverbatim}
+
+\def\Xone{-}
+\def\Xtwo{\Xone}
+\pagerange{22\Xtwo 23}
+This produces \result{Pages~\pagestart\space to\space\pageend}.
+
+\pgexample{}
+The following also works because the +\pagerange+ is fully expanded before splitting:
+
+\begin{pverbatim}
+\def\X{-}
+\def\Y{2222}
+\def\Z{3333}
+\pagerange{\Y\X\Z}
+\end{pverbatim}
+
+\def\X{-}
+\def\Y{2222}
+\def\Z{3333}
+\pagerange{\Y\X\Z}
+This produces \result{Pages~\pagestart\space to\space\pageend}.
+
+\pgexample{}
+The following also works because the +\pagerange+ and +tie+ are fully expanded before splitting page range:
+
+\begin{pverbatim}
+\def\X{-}
+\pagerangeoptions{tie=\X}
+\pagerange{123\X 234}
+\end{pverbatim}
+\def\X{-}
+\pagerangeoptions{tie=\X}
+\pagerange{123\X 234}
+This produces \result{Pages~\pagestart\space to\space\pageend}.
+
+\pgexample{}
+The following works because infinite nesting of +tie+ and +\pagerange+ are permitted:
+
+\begin{pverbatim}
+\def\Xone{-}
+\def\Xtwo{\Xone}
+\pagerangeoptions{tie=\Xtwo}
+\pagerange{444\Xtwo 555}
+\end{pverbatim}
+
+\def\Xone{-}
+\def\Xtwo{\Xone}
+\pagerangeoptions{tie=\Xtwo}
+\pagerange{444\Xtwo 555}
+This yields \result{Pages~\pagestart\space to\space\pageend}.
+
+\pgexample{}
+The following gives incorrect (in fact, weird) result because the prevailing +tie+ is not a star:
+
+\begin{pverbatim}
+\pagerange{33*44}
+\end{pverbatim}
+
+%\pagerange{33*44}
+%It produces \result{Pages~\pagestart\space to\space\pageend}.
+
+\pgexample{}
+The +tie+ can be changed to a star (or any non-active character) as follows:
+
+\begin{pverbatim}
\pagerangeoptions{tie=*}
-\pagerange{123*234}
-\par\noindent
-Pages~\pagestart\space to\space\pageend
+\pagerange{2233*3344}
+\end{pverbatim}
+
+\pagerangeoptions{tie=*}
+\pagerange{2233*3344}
+This correctly produces \result{Pages~\pagestart\space to\space\pageend}.
+
+\pgexample{}
+In the following the +tie+ is changed to letter ``T'':
+\begin{pverbatim}
\pagerangeoptions{tie=T}
\pagerange{1234T1235}
-\par\medskip\noindent
-Pages~\pagestart\space to\space\pageend
+\end{pverbatim}
+
+\pagerangeoptions{tie=T}
+\pagerange{1234T1235}
+It produces \result{Pages~\pagestart\space to\space\pageend}.
+\pgexample{}
+The following
+
+\begin{pverbatim}
\pagerangeoptions{tie=X}
\pagerange{2034X2135}
-\par\medskip\noindent
-Pages~\pagestart\space to\space\pageend
+\end{pverbatim}
-\section{To-do}
+\pagerangeoptions{tie=X}
+\pagerange{2034X2135}
+correctly yields \result{Pages~\pagestart\space to\space\pageend}.
-\begin{compactenum}[a)]
-\item To provide for calls such as in {\tt\string\pagerange\{\string\pageref\{page:label\}-200\}}.
-\item Documentation.
-\end{compactenum}
+\section{To-do}
-\par\bigskip
-\centerline{\rule{.5\hsize}{.4pt}}
-\bigskip
-\lipsum[1-4]
+To provide for calls such as in +\pagerange{\pageref{page:label}-200}+.
\end{document} \ No newline at end of file
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