From 205f178e5bd86f9fd729a2df7d01b0562b11cffe Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 5 Feb 2010 01:24:29 +0000 Subject: pagerange update (4feb10) git-svn-id: svn://tug.org/texlive/trunk@16915 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/pagerange/README | 6 +- .../doc/latex/pagerange/pagerange-guide.pdf | Bin 82727 -> 93677 bytes .../doc/latex/pagerange/pagerange-guide.tex | 54 +++--- .../tex/latex/pagerange/pagerange-guide.cfg | 36 ++-- .../texmf-dist/tex/latex/pagerange/pagerange.sty | 183 ++++++++++++++------- 5 files changed, 184 insertions(+), 95 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/pagerange/README b/Master/texmf-dist/doc/latex/pagerange/README index 878888e88d7..c3d220d17a4 100644 --- a/Master/texmf-dist/doc/latex/pagerange/README +++ b/Master/texmf-dist/doc/latex/pagerange/README @@ -1,4 +1,4 @@ -This is the README file for 'pagerange' package, version 0.3. +This is the README file for 'pagerange' package, version 0.5. When a given page range xx-yy (simple/plain characters) or \pages (command token, eg, \def\pages{xx-yy}) is submitted to the macro @@ -29,6 +29,6 @@ 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). +Copyright (c) 2010 Ahmed Musa (a.musa@rocketmail.com). -End of README file. \ No newline at end of file +End of README file. diff --git a/Master/texmf-dist/doc/latex/pagerange/pagerange-guide.pdf b/Master/texmf-dist/doc/latex/pagerange/pagerange-guide.pdf index c0e5e1e1767..00f3ac14c4a 100644 Binary files a/Master/texmf-dist/doc/latex/pagerange/pagerange-guide.pdf and b/Master/texmf-dist/doc/latex/pagerange/pagerange-guide.pdf differ diff --git a/Master/texmf-dist/doc/latex/pagerange/pagerange-guide.tex b/Master/texmf-dist/doc/latex/pagerange/pagerange-guide.tex index db78f40c054..6ca29217971 100644 --- a/Master/texmf-dist/doc/latex/pagerange/pagerange-guide.tex +++ b/Master/texmf-dist/doc/latex/pagerange/pagerange-guide.tex @@ -7,14 +7,14 @@ \label{page:first} \MakeShortVerb{\+} -\title{\textbf{The {\tt pagerange} Package}\\[1ex] Version 0.3} +\title{\textbf{The {\tt pagerange} Package}\\[1ex] Version 0.5} \author{Ahmed Musa\\[.5ex]University of Central Lancashire\\ 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. +This package emerged from my desire to resolve page ranges in the +draftmark+ package, but it may be useful to other \texorlatex enthusiasts and users. \section{Usage} @@ -25,19 +25,35 @@ If you specify a range consisting of a hyphen (or any tie) but with one or two e \item A range of the form ``+-34+'' is taken to mean pages +defaultfirstpage+ to 34. The default value of +defaultfirstpage+ is 1; it can be changed via +\pagerangeoptions+. \item A range of the form ``+12-+'' is taken to mean page~12 to +defaultlastpage+, where the default value of +defaultlastpage+ is the document's last page. \item A range of the form ``+-+'' (\ie, only hyphen and no pages) is taken to mean from +defaultfirstpage+ to +defaultlastpage+. -\item An empty or blank page range (\ie, containing no argument and no hyphen/tie) is taken to mean the range +defaultfirstpage+ to +defaultlastpage+, or it may prompt a fatal error, depending on whether the boolean +acceptempty+ is set true or false (respectively). +\item A blank page range (\ie, containing no argument and no hyphen/tie) is taken to mean the range +defaultfirstpage+ to +defaultlastpage+, or it may prompt a fatal error, depending on whether the boolean +acceptempty+ is set true or false (respectively). \end{compactenum} 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=*}+. Active characters can't, unfortunately, be used as ties. The package easily terminates with a warning when an active character is passed as +tie+. It wouldn't be safe to change the catcode of an active character submitted as +tie+ through +\pagerangeoptions+, since at the time the macro +\pagerangeoptions+ is invoked, the page may already be in the process of being built. +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=*}+. 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. +\subsection{Using an active character as the ``tie''} + +Active characters can't, unfortunately, be used as ties. The package easily terminates with a fatal error when an active character is passed as +tie+. It wouldn't be safe to change the catcode of an active character submitted as +tie+ through +\pagerangeoptions+, since at the time the macro +\pagerangeoptions+ is invoked, the page may already be in the process of being built. + +To use an active character (say \string~) as a tie, it is necessary to first locally change its catcode, \eg, as follows: + +\begin{pverbatim} +\begingroup +\catcode`\~=11 +\pagerangeoptions{tie=~} +\pagerange{1~4} +\endgroup +\end{pverbatim} + +which gives \pgresult{Pages 1 to 4}. + \section{Package options}\label{sec:package-options} The package options are as follows: @@ -60,7 +76,7 @@ Pages~\pagestart\space to\space\pageend \end{pverbatim} \pagerange{123-456} -produces \result{Pages~\pagestart\space to\space\pageend}. +produces \pgresult{Pages~\pagestart\space to\space\pageend}. \pgexample{} @@ -71,7 +87,7 @@ The following \end{pverbatim} \pagerange{12345-67890} -produces \result{Pages~\pagestart\space to\space\pageend}. +produces \pgresult{Pages~\pagestart\space to\space\pageend}. \pgexample{} The following @@ -81,7 +97,7 @@ The following \end{pverbatim} \pagerange{123-4567} -produces \result{Pages~\pagestart\space to\space\pageend}. +produces \pgresult{Pages~\pagestart\space to\space\pageend}. \pgexample{} The following @@ -91,7 +107,7 @@ The following \end{pverbatim} \pagerange{600-601} -produces \result{Pages~\pagestart\space to\space\pageend}. +produces \pgresult{Pages~\pagestart\space to\space\pageend}. \pgexample{} The following @@ -101,7 +117,7 @@ The following \end{pverbatim} \pagerange{-34} -produces \result{Pages~\pagestart\space to\space\pageend}. +produces \pgresult{Pages~\pagestart\space to\space\pageend}. \pgexample{No page numbers given} The following @@ -112,7 +128,7 @@ The following \pagerange{-} \par\medskip\noindent -produces \result{Pages~\pagestart\space to\space\pageend}. +produces \pgresult{Pages~\pagestart\space to\space\pageend}. \pgexample{} The following logs a warning message or issues fatal error, depending on the status of +acceptempty+ option: @@ -177,7 +193,7 @@ The following works because the +\pagerange+ is fully expanded before splitting: \def\Xone{-} \def\Xtwo{\Xone} \pagerange{22\Xtwo 23} -This produces \result{Pages~\pagestart\space to\space\pageend}. +This produces \pgresult{Pages~\pagestart\space to\space\pageend}. \pgexample{} The following also works because the +\pagerange+ is fully expanded before splitting: @@ -193,7 +209,7 @@ The following also works because the +\pagerange+ is fully expanded before split \def\Y{2222} \def\Z{3333} \pagerange{\Y\X\Z} -This produces \result{Pages~\pagestart\space to\space\pageend}. +This produces \pgresult{Pages~\pagestart\space to\space\pageend}. \pgexample{} The following also works because the +\pagerange+ and +tie+ are fully expanded before splitting page range: @@ -207,7 +223,7 @@ The following also works because the +\pagerange+ and +tie+ are fully expanded b \def\X{-} \pagerangeoptions{tie=\X} \pagerange{123\X 234} -This produces \result{Pages~\pagestart\space to\space\pageend}. +This produces \pgresult{Pages~\pagestart\space to\space\pageend}. \pgexample{} The following works because infinite nesting of +tie+ and +\pagerange+ are permitted: @@ -223,7 +239,7 @@ The following works because infinite nesting of +tie+ and +\pagerange+ are permi \def\Xtwo{\Xone} \pagerangeoptions{tie=\Xtwo} \pagerange{444\Xtwo 555} -This yields \result{Pages~\pagestart\space to\space\pageend}. +This yields \pgresult{Pages~\pagestart\space to\space\pageend}. \pgexample{} The following gives incorrect (in fact, weird) result because the prevailing +tie+ is not a star: @@ -233,7 +249,7 @@ The following gives incorrect (in fact, weird) result because the prevailing +ti \end{pverbatim} %\pagerange{33*44} -%It produces \result{Pages~\pagestart\space to\space\pageend}. +%It produces \pgresult{Pages~\pagestart\space to\space\pageend}. \pgexample{} The +tie+ can be changed to a star (or any non-active character) as follows: @@ -245,7 +261,7 @@ The +tie+ can be changed to a star (or any non-active character) as follows: \pagerangeoptions{tie=*} \pagerange{2233*3344} -This correctly produces \result{Pages~\pagestart\space to\space\pageend}. +This correctly produces \pgresult{Pages~\pagestart\space to\space\pageend}. \pgexample{} In the following the +tie+ is changed to letter ``T'': @@ -257,7 +273,7 @@ In the following the +tie+ is changed to letter ``T'': \pagerangeoptions{tie=T} \pagerange{1234T1235} -It produces \result{Pages~\pagestart\space to\space\pageend}. +It produces \pgresult{Pages~\pagestart\space to\space\pageend}. \pgexample{} The following @@ -269,7 +285,7 @@ The following \pagerangeoptions{tie=X} \pagerange{2034X2135} -correctly yields \result{Pages~\pagestart\space to\space\pageend}. +correctly yields \pgresult{Pages~\pagestart\space to\space\pageend}. \section{Using page labels} @@ -285,7 +301,7 @@ From version 0.3 of the package, it has been possible to obtain page ranges from \label{page:last} \pagerangeoptions{tie=-} \pagerange{\getpagenumber{page:first}-\getpagenumber{page:last}} -which yields \result{Pages~\pagestart\space to\space\pageend}. +which yields \pgresult{Pages~\pagestart\space to\space\pageend}. The command +\getpagenumber+ is provided in the package and may, in general, be used to convert page labels into page numbers even in expansion contexts, where +\pageref+ will normally fail. If the page label or reference is undefined, the default start page number (+defaultfirstpage+) is used. The +defaultfirstpage+ is a package option (see Section~\ref{sec:package-options}). diff --git a/Master/texmf-dist/tex/latex/pagerange/pagerange-guide.cfg b/Master/texmf-dist/tex/latex/pagerange/pagerange-guide.cfg index 1647320f8b5..959799e6989 100644 --- a/Master/texmf-dist/tex/latex/pagerange/pagerange-guide.cfg +++ b/Master/texmf-dist/tex/latex/pagerange/pagerange-guide.cfg @@ -1,6 +1,6 @@ \ProvidesFile{pagerange-guide.cfg}% - [2009/12/10 v0.3 Configuration file for pagerange-guide.tex (A.Musa)] -\usepackage{mathpazo} + [2010/02/03 v0.5 Configuration file for pagerange-guide.tex (A.Musa)] +\makeatletter \usepackage[scaled=0.9]{helvet} \usepackage{xspace} \usepackage{xcolor} @@ -10,11 +10,13 @@ \usepackage{paralist} \usepackage{fancyhdr} \usepackage{tabularx} +\usepackage{ltablex} +\keepXColumns \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 +\draftmarksetup{mark={\color{red}\framebox[22.2cm][c]{}\\[15.4cm] + \color{red}\framebox[22.2cm][c]{}},angle=90,scale=1, + xcoord=-.2,ycoord=-1.5} +\ifx\pagerange\relax\usepackage[acceptempty]{pagerange}\fi \ifx\lastpage\relax\usepackage{lastpage}\fi \usepackage{hyperref} \hypersetup{colorlinks=true,linkcolor=red,pdfpagemode=UseThumbs, @@ -23,10 +25,11 @@ \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}} + xrightmargin=-0pc,commandchars=\|\(\),commentchar=\&} +\def\ie{\@ifnextchar.{i.e}{i.e.}\xspace} +\def\eg{\@ifnextchar.{e.g}{e.g.}\xspace} +\def\etc{\@ifnextchar.{etc}{etc.}\xspace} +\providecommand*\email[1]{\href{mailto:#1}{#1}} \newcommand*\pgtxtt{\fontfamily{txtt}\selectfont\scshape\color{brown}} \fancyhf{} \fancyhfoffset[R,L]{\dimexpr\marginparsep+\marginparwidth\relax} @@ -42,10 +45,15 @@ \refstepcounter{examplecnt}% \endgraf\vspace*{0.5\baselineskip}% \textbf{\textcolor{purple}{Example~\thesection.\theexamplecnt\enspace}#1}% - \endgraf\nobreak + \endgraf\nobreak\@nobreakfalse } -\providecommand\space{ } +\providecommand*\space{ } \definecolor{xgreen}{rgb}{0.00,0.59,0.00} -\newcommand*\result[1]{\textcolor{xgreen}{#1}} +\@ifdefinable\pgresult{\def\pgresult#1{\textcolor{xgreen}{#1}}} +\newcommand*\La{\leavevmode L\raise.42ex\hbox{\footnotesize\kern-.35em A}} +\newcommand*\TeXorLaTeX{\hbox{(\/\La\kern-.15em\/)\kern-.1em\TeX}} +\newcommand*\texorlatex{\TeXorLaTeX\xspace} -\endinput \ No newline at end of file +\endinput + +%%% End of file pagerange-guide.cfg %%% \ 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 97d2b9361c7..c6be8784aec 100644 --- a/Master/texmf-dist/tex/latex/pagerange/pagerange.sty +++ b/Master/texmf-dist/tex/latex/pagerange/pagerange.sty @@ -1,5 +1,5 @@ %+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -% This is file 'pagerange.sty', version 0.3. % +% This is file 'pagerange.sty', version 0.5. % % % % This work may be distributed and/or modified under the conditions % % of the LaTeX Project Public License, either version 1.3 of this % @@ -14,85 +14,147 @@ % implied warranties of merchantability and fitness for a particular % % purpose. % % % -% Copyright (c) 2009 Ahmed Musa (a.musa@rocketmail.com). % +% Copyright (c) 2010 Ahmed Musa (a.musa@rocketmail.com). % %+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% - +\begingroup +\catcode064 11\relax% @ +\catcode123 01\relax% { +\catcode125 02\relax% } +\def\prg@tempa{\endgroup + \edef\prg@restorecodes{% + \catcode035 \the\catcode035\relax% # + \catcode064 \the\catcode064\relax% @ + \catcode123 \the\catcode123\relax% { + \catcode125 \the\catcode125\relax% } + \catcode061 \the\catcode061\relax% = + \catcode038 \the\catcode038\relax% & + }% +} +\prg@tempa +\catcode061 12\relax% = +\catcode035 06\relax% # +\catcode064 11\relax% @ +\catcode123 01\relax% { +\catcode125 02\relax% } +\catcode038 03\relax% & +\AtEndOfPackage{\prg@restorecodes} \ProvidesPackage{pagerange}% - [2009/11/10 v0.3 Split page ranges intelligently (Ahmed Musa)] + [2010/02/04 v0.5 Split page ranges intelligently (Ahmed Musa)] \NeedsTeXFormat{LaTeX2e}[1996/12/01] -\def\prg@warn#1{\PackageWarningNoLine{pagerange}{#1}} -\def\prg@err#1{\PackageError{pagerange}{#1}{\@ehc}} \@ifpackageloaded{lastpage}{}{\RequirePackage{lastpage}[1994/06/25]} \@ifpackageloaded{xkeyval}{}{\RequirePackage{xkeyval}[2008/08/13]} \ifcase0% \ifx\eTeXversion\@undefined 1\else\ifnum\eTeXversion<\tw@ 1\fi\fi \else - \prg@err{eTeX not loaded or old version.\MessageBreak - This package requires eTeX version 2 or later.} + \@latex@error{eTeX not loaded or old version.\MessageBreak + This package requires eTeX version 2 or later.}\@ehc \fi -\def\prg@ifdef#1{\csname @\ifdefined#1\expandafter first\else - \expandafter second\fi oftwo\endcsname +\newcommand*\prg@ifdefinable[1]{% + \edef\reserved@a{\expandafter\@gobble\string#1}% + \begingroup + \ifdefined#1% + \aftergroup\@notdefinable + \else + \edef\reserved@b{\expandafter\@carcube\reserved@a xxx\@nil}% + \ifx\reserved@b\@qend + \aftergroup\@notdefinable + \else + \ifx\reserved@a\@qrelax + \aftergroup\@notdefinable + \else + \aftergroup\@firstofone + \fi + \fi + \fi + \endgroup } +\prg@ifdefinable\prg@protect@relax\relax +\prg@ifdefinable\prg@star@or@long\relax +\prg@ifdefinable\prg@pdef\relax +\prg@ifdefinable\prg@@def\relax +\def\prg@star@or@long#1{% + \@ifstar{\let\prg@protect@relax\protected#1}% + {\def\prg@protect@relax{\protected\long}#1}% +} +\let\prg@protect@relax\protected +\protected\def\prg@pdef{\prg@star@or@long\prg@@def} +\def\prg@@def#1{\prg@ifdefinable#1{\prg@protect@relax\def#1}} +\prg@pdef\prg@warn#1{\PackageWarningNoLine{pagerange}{#1}} +\prg@pdef\prg@err#1{\PackageError{pagerange}{#1}\@ehc} +\prg@ifdefinable\prg@tempcnta{\newcount\prg@tempcnta} +\prg@ifdefinable\prg@tempcntb{\newcount\prg@tempcntb} +\prg@ifdefinable\prg@tempcntc{\newcount\prg@tempcntc} +\def\prg@c@r#1#2{% + \unless\ifx#2\null + \prg@err{Inadmissible multiple arguments '\string#1\string#2' + \MessageBreak for '\string\prg@ifdef' test}% + \fi +} +\prg@ifdefinable\prg@ifdef\relax +\def\prg@ifdef#1{% + \prg@c@r#1\null + \csname @\ifdefined#1\expandafter first\else + \expandafter second\fi oftwo\endcsname +} +\prg@ifdefinable\prg@ifundef\relax \def\prg@ifundef#1{% \prg@ifdef{#1}{\csname @\ifx#1\relax\expandafter first\else \expandafter second\fi oftwo\endcsname}{\@firstoftwo}% } \def\prg@ifcsundef#1{\expandafter\prg@ifundef\csname#1\endcsname} -\def\prg@check@ifdef#1{% +\prg@pdef*\prg@check@ifdef#1{% \prg@ifcsundef{#1}{}{% - \prg@err{\expandafter\noexpand\csname#1\endcsname already defined}}% + \prg@err{\expandafter\noexpand\csname#1\endcsname already defined}% + }% \prg@check@ifdef } \prg@check@ifdef{pagerange}{pagestart}{pageend}{getpagenumber}% - \iffalse\fi\fi\endcsname{}{} -\edef\prg@restorecodes{% - \catcode45=\the\catcode45\relax % - - \catcode38=\the\catcode38\relax % & + {pagerangeoptions}\iffalse\fi\fi\endcsname{}{} +\prg@pdef\prg@ifblank#1{\prg@ifbl@nk#1&&\@secondoftwo\@firstoftwo:} +\long\def\prg@ifbl@nk#1#2#4#5:{#4} +\prg@pdef\prg@xifblank#1{\begingroup + \protected@edef\prg@tempa{\endgroup\noexpand\prg@ifblank{#1}}% + \prg@tempa } -\AtEndOfPackage{\prg@restorecodes} -\catcode38=3\relax -\@makeother\-% -\long\gdef\prg@ifblank#1{% macro credit: ifmtarg.sty - \prg@ifblank@aux#1&&\@secondoftwo\@firstoftwo:} -\long\gdef\prg@ifblank@aux#1#2#4#5:{#4} -\long\def\prg@xifblank#1{\begingroup - \protected@edef\x{\endgroup\noexpand\prg@ifblank{#1}}\x% -} -\chardef\active=13\relax -\def\prg@ifmacro#1{% - \prg@ifdef{#1}\relax{\prg@err{\string#1 undefined}}% +\prg@pdef\prg@ifmacro#1{% \begingroup - \edef\x{\endgroup - \noexpand\def\noexpand\getparameter####1\detokenize{macro}:####2&{% + \edef\prg@tempa{\endgroup + \def\noexpand\getparameter####1\detokenize{macro}:####2&{% \noexpand\prg@ifblank{####2}{\noexpand\@secondoftwo}% {\noexpand\@firstoftwo}% }% - \noexpand\expandafter\noexpand\getparameter% + \noexpand\expandafter\noexpand\getparameter% \noexpand\meaning\noexpand#1\detokenize{macro}:&% - }\x + }\prg@tempa } \def\prg@ismacro@err#1{% \prg@err{% Illegal tie '#1'.\MessageBreak - Note that the 'tie' has been fully expanded \MessageBreak + Note that the 'tie' has been expanded once\MessageBreak and may be different from what you submitted.\MessageBreak Perhaps you've used an active character as 'tie' }% } -\define@boolkeys[KV]{pagerange}[prg@]{acceptempty}[true] \define@cmdkey[KV]{pagerange}[prg@]{tie}[-]{% + \edef\@tempa{\expandafter\noexpand\prg@tie}% \edef\prg@tie{\prg@tie}% - \expandafter\prg@ifmacro\prg@tie{\prg@ismacro@err\prg@tie}{} + \let\@@protect\protect\let\protect\@empty + \expandafter\prg@ifmacro\expandafter{\prg@tie}{% + \restore@protect\prg@ismacro@err\@tempa + }{}% + \restore@protect } +\define@boolkey[KV]{pagerange}[prg@]{acceptempty}[true]{} \define@cmdkey[KV]{pagerange}[prg@]{defaultfirstpage}[1]{} -\define@cmdkey[KV]{pagerange}[prg@]{defaultlastpage}[\getpagenumber{LastPage}]{} +\define@cmdkey[KV]{pagerange}[prg@]{defaultlastpage}% + [\getpagenumber{LastPage}]{} \DeclareOptionX*{\prg@warn{Unknown option '\CurrentOption' ignored}} \ExecuteOptionsX{tie,defaultfirstpage,defaultlastpage} \ProcessOptionsX*\relax -\gdef\pagerangeoptions#1{\setkeys[KV]{pagerange}{#1}} -\long\def\prg@forall#1#2\do#3{% +\long\def\pagerangeoptions#1{\setkeys[KV]{pagerange}{#1}} +\prg@pdef\prg@forall#1#2\do#3{% #3{#1}% - \ifx\\#2\\% + \expandafter\ifx\expandafter\@empty\detokenize{#2}\@empty% \relax \else \prg@forall#2\do{#3}% @@ -100,29 +162,28 @@ } \let\pagestart\@empty \let\pageend\@empty -\newcount\prg@cntx\prg@cntx=\z@\relax -\long\def\prg@split@pagerange#1{% +\prg@tempcntc=\z@ +\prg@pdef*\prg@split@pagerange#1{% \def\reserved@a{#1}% \ifx\reserved@a\prg@tie - \advance\prg@cntx\@ne\relax + \advance\prg@tempcntc\@ne \fi - \ifnum\prg@cntx=\z@ + \ifnum\prg@tempcntc=\z@ \g@addto@macro\pagestart{#1}% - \else\ifnum\prg@cntx=\@ne + \else\ifnum\prg@tempcntc=\@ne \ifx\reserved@a\prg@tie\else \g@addto@macro\pageend{#1}% \fi - \else\ifnum\prg@cntx>\@ne + \else\ifnum\prg@tempcntc>\@ne \prg@err{Multiple ties in page range.\MessageBreak Please use only one tie}% \fi\fi\fi } -\newcount\prg@cnta\prg@cnta=\z@\relax -\newcount\prg@cntb\prg@cntb=\z@\relax +\prg@tempcnta=\z@\prg@tempcntb=\z@ \def\pagerange#1{% \let\pagestart\@empty \let\pageend\@empty - \prg@cntx=\z@\relax + \prg@tempcntc=\z@ \prg@xifblank{#1}{% \ifprg@acceptempty \prg@warn{Blank page range supplied:\MessageBreak @@ -136,30 +197,32 @@ }% \fi }{% - \begingroup\edef\@tempa{\endgroup% - \noexpand\prg@forall#1\noexpand\do{\noexpand\prg@split@pagerange}}% - \@tempa + \begingroup\edef\prg@tempa{\endgroup% + \prg@forall#1\noexpand\do{\prg@split@pagerange}}% + \prg@tempa }% \ifx\@empty\pagestart - \ifnum\prg@cntx=\@ne + \ifnum\prg@tempcntc=\@ne \let\pagestart\prg@defaultfirstpage \fi \fi - \prg@cnta=\number\pagestart\relax + \prg@tempcnta=\number\pagestart\relax \ifx\@empty\pageend - \prg@cntb=\@M\relax - \ifnum\prg@cntx=\@ne + \prg@tempcntb=\@M + \ifnum\prg@tempcntc=\@ne \let\pageend\prg@defaultlastpage \fi \else - \prg@cntb=\number\pageend\relax + \prg@tempcntb=\number\pageend\relax \fi - \ifnum\prg@cnta>\prg@cntb + \ifnum\prg@tempcnta>\prg@tempcntb \prg@err{Inconsistent page range: Page \pageend\space > \pagestart}% \fi } \def\prg@carr#1#2#3\@nil{% - \ifx\relax#3\relax\prg@err{Problem with page reference}\fi + \expandafter\ifx\expandafter\relax\detokenize{#3}\relax + \prg@err{Problem with page reference} + \fi #2% } \def\getpagenumber#1{% @@ -169,4 +232,6 @@ }% } -\endinput \ No newline at end of file +\endinput + +%%% End of file pagerange.sty %%% \ No newline at end of file -- cgit v1.2.3