summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-11-22 19:02:13 +0000
committerKarl Berry <karl@freefriends.org>2007-11-22 19:02:13 +0000
commit10e7ca1dbb544a401baeed19a6d871fae0dd82c7 (patch)
tree99b394b0664ecfe1d769b5d23af156dd06e12868 /Master/texmf-dist/tex
parent5f24b7cfebd86d4ec19ff264e850d9e14c193fed (diff)
cleveref update (21nov07)
git-svn-id: svn://tug.org/texlive/trunk@5556 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/cleveref/cleveref.sty1157
1 files changed, 636 insertions, 521 deletions
diff --git a/Master/texmf-dist/tex/latex/cleveref/cleveref.sty b/Master/texmf-dist/tex/latex/cleveref/cleveref.sty
index 71d7d2a4690..2f5ba2ab5a1 100644
--- a/Master/texmf-dist/tex/latex/cleveref/cleveref.sty
+++ b/Master/texmf-dist/tex/latex/cleveref/cleveref.sty
@@ -22,7 +22,7 @@
%% version 1999/12/01 or later.
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{cleveref}
- [2007/30/10 v0.10 Automatic cross-reference formatting]
+ [2007/21/11 v0.11 Automatic cross-reference formatting]
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -38,38 +38,39 @@
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
-\let\old@refstepcounter\refstepcounter
+\let\cref@old@refstepcounter\refstepcounter
\def\refstepcounter%
{\@ifnextchar[{\refstepcounter@optarg}{\refstepcounter@noarg}}%]
\def\refstepcounter@noarg#1{%
- \old@refstepcounter{#1}%
+ \cref@old@refstepcounter{#1}%
\reset@by{#1}{\@result}%
\ifx\@result\relax\def\@result{}%
\else\edef\@result{\csname the\@result\endcsname}\fi%
\protected@edef\@currentlabel{%
[#1][\arabic{#1}][\@result]\@currentlabel}}
\def\refstepcounter@optarg[#1]#2{%
- \old@refstepcounter{#2}%
+ \cref@old@refstepcounter{#2}%
\reset@by{#2}{\@result}%
\ifx\@result\relax\def\@result{}%
\else\edef\@result{\csname the\@result\endcsname}\fi%
\protected@edef\@currentlabel{%
[#1][\arabic{#2}][\@result]\@currentlabel}}
+\def\cref@override@label@type[#1][#2][#3]#4\@nil#5{[#5][#2][#3]#4}
\AtBeginDocument{%
- \let\old@label\label
- \def\label{\@ifnextchar[\label@optarg\old@label}%]
- \def\override@label@type[#1][#2][#3]#4\@nil#5{[#5][#2][#3]#4}
+ \let\cref@old@label\label
+ \def\label{\@ifnextchar[\label@optarg\cref@old@label}%]
\def\label@optarg[#1]{%
\protected@edef\@currentlabel{%
- \expandafter\override@label@type\@currentlabel\@nil{#1}}%
- \old@label}%
+ \expandafter\cref@override@label@type\@currentlabel\@nil{#1}}%
+ \cref@old@label}%
\@ifpackageloaded{amsmath}{%
\let\cref@label\label%
- \let\old@label@in@display\label@in@display%
+ \let\cref@old@label@in@display\label@in@display%
\def\label@in@display{%
\@ifnextchar[\label@in@display@optarg\label@in@display@noarg}%]
- \def\label@in@display@noarg#1{\old@label@in@display{{#1}}}
- \def\label@in@display@optarg[#1]#2{\old@label@in@display{[#1]{#2}}}
+ \def\label@in@display@noarg#1{\cref@old@label@in@display{{#1}}}
+ \def\label@in@display@optarg[#1]#2{%
+ \cref@old@label@in@display{[#1]{#2}}}
\def\ltx@label#1{\cref@label#1}%
}{}%
}
@@ -84,105 +85,141 @@
\expandafter\@setref\csname r@#1\endcsname{\cref@reflabel}{#1}}%
\def\ref{\expandafter\protect\csname ref \endcsname}%
}
+\let\cref@old@appendix\appendix
+\renewcommand\appendix{%
+ \cref@old@appendix%
+ \@ifundefined{chapter}{%
+ \def\refstepcounter@noarg##1{%
+ \cref@old@refstepcounter{##1}%
+ \reset@by{##1}{\@result}%
+ \ifx\@result\relax\def\@result{}%
+ \else\edef\@result{\csname the\@result\endcsname}\fi%
+ \def\@tmpa{##1}
+ \def\@tmpb{section}%
+ \ifx\@tmpa\@tmpb%
+ \protected@edef\@currentlabel{%
+ [appendix][\arabic{##1}][\@result]\@currentlabel}%
+ \else
+ \protected@edef\@currentlabel{%
+ [##1][\arabic{##1}][\@result]\@currentlabel}
+ \fi}
+ }{%
+ \def\refstepcounter@noarg##1{%
+ \cref@old@refstepcounter{##1}%
+ \reset@by{##1}{\@result}%
+ \ifx\@result\relax\def\@result{}%
+ \else\edef\@result{\csname the\@result\endcsname}\fi%
+ \def\@tmpa{##1}
+ \def\@tmpb{chapter}%
+ \ifx\@tmpa\@tmpb%
+ \protected@edef\@currentlabel{%
+ [appendix][\arabic{##1}][\@result]\@currentlabel}%
+ \else
+ \protected@edef\@currentlabel{%
+ [##1][\arabic{##1}][\@result]\@currentlabel}
+ \fi}
+ }%
+}
\def\cref@getlabel#1#2{%
- \expandafter\let\expandafter\@tempa\csname r@#1\endcsname%
- \edef\@tempa{\expandafter\@firstoftwo\@tempa}%
- \expandafter\@cref@getlabel\@tempa\@nil#2}
+ \expandafter\let\expandafter\@tmpa\csname r@#1\endcsname%
+ \edef\@tmpa{\expandafter\@firstoftwo\@tmpa}%
+ \expandafter\@cref@getlabel\@tmpa\@nil#2}
\def\@cref@getlabel{\@ifnextchar[%]
\@@cref@getlabel{\@@cref@getlabel[][][]}}
\def\@@cref@getlabel[#1][#2][#3]#4\@nil#5{\def#5{#4}}
\def\cref@gettype#1#2{%
- \expandafter\let\expandafter\@tempa\csname r@#1\endcsname%
- \edef\@tempa{\expandafter\@firstoftwo\@tempa}%
- \expandafter\@cref@gettype\@tempa\@nil#2}
+ \expandafter\let\expandafter\@tmpa\csname r@#1\endcsname%
+ \edef\@tmpa{\expandafter\@firstoftwo\@tmpa}%
+ \expandafter\@cref@gettype\@tmpa\@nil#2}
\def\@cref@gettype{\@ifnextchar[%]
\@@cref@gettype{\@@cref@gettype[][][]}}
\def\@@cref@gettype[#1][#2][#3]#4\@nil#5{\def#5{#1}}
\def\cref@getcounter#1#2{%
- \expandafter\let\expandafter\@tempa\csname r@#1\endcsname%
- \edef\@tempa{\expandafter\@firstoftwo\@tempa}%
- \expandafter\@cref@getcounter\@tempa\@nil#2}
+ \expandafter\let\expandafter\@tmpa\csname r@#1\endcsname%
+ \edef\@tmpa{\expandafter\@firstoftwo\@tmpa}%
+ \expandafter\@cref@getcounter\@tmpa\@nil#2}
\def\@cref@getcounter{\@ifnextchar[%]
\@@cref@getcounter{\@@cref@getcounter[][][]}}
\def\@@cref@getcounter[#1][#2][#3]#4\@nil#5{\def#5{#2}}
\def\cref@getprefix#1#2{%
- \expandafter\let\expandafter\@tempa\csname r@#1\endcsname%
- \edef\@tempa{\expandafter\@firstoftwo\@tempa}%
- \expandafter\@cref@getprefix\@tempa\@nil#2}
+ \expandafter\let\expandafter\@tmpa\csname r@#1\endcsname%
+ \edef\@tmpa{\expandafter\@firstoftwo\@tmpa}%
+ \expandafter\@cref@getprefix\@tmpa\@nil#2}
\def\@cref@getprefix{\@ifnextchar[%]
\@@cref@getprefix{\@@cref@getprefix[][][]}}
\def\@@cref@getprefix[#1][#2][#3]#4\@nil#5{\def#5{#3}}
-\def\append@toks#1#2{\toks0={#2}%
+\def\cref@append@toks#1#2{\toks0={#2}%
\edef\act{\noexpand#1={\the#1\the\toks0}}%
\act}%
-\def\stack@init#1{\def#1{\@nil}}
-\def\stack@top#1{\expandafter\stack@top@aux#1}
-\def\stack@top@aux#1,#2\@nil{#1}
-\def\stack@pop#1{\expandafter\stack@pop@aux#1#1}
-\def\stack@pop@aux#1,#2\@nil#3{\def#3{#2\@nil}}
-\def\stack@push#1#2{\expandafter\stack@push@aux\expandafter{#2}{#1}{#2}}
-\def\stack@push@aux#1#2#3{\def#3{#2,#1}}
-\def\stack@pull#1#2{\expandafter\stack@pull@aux#2{#1}{#2}}
-\def\stack@pull@aux#1\@nil#2#3{\def#3{#1#2,\@nil}}
-\newif\ifstackempty
-\newif\ifstackfull
-\def\isstackempty#1{%
+\def\cref@stack@init#1{\def#1{\@nil}}
+\def\cref@stack@top#1{\expandafter\cref@stack@top@aux#1}
+\def\cref@stack@top@aux#1,#2\@nil{#1}
+\def\cref@stack@pop#1{\expandafter\cref@stack@pop@aux#1#1}
+\def\cref@stack@pop@aux#1,#2\@nil#3{\def#3{#2\@nil}}
+\def\cref@stack@push#1#2{%
+ \expandafter\cref@stack@push@aux\expandafter{#2}{#1}{#2}}
+\def\cref@stack@push@aux#1#2#3{\def#3{#2,#1}}
+\def\cref@stack@pull#1#2{\expandafter\cref@stack@pull@aux#2{#1}{#2}}
+\def\cref@stack@pull@aux#1\@nil#2#3{\def#3{#1#2,\@nil}}
+\newif\if@cref@stackempty
+\newif\if@cref@stackfull
+\def\cref@isstackempty#1{%
\def\@tmpa{\@nil}%
- \ifx#1\@tmpa\stackemptytrue%
- \else\stackemptyfalse\fi}
-\def\isstackfull#1{%
+ \ifx#1\@tmpa\@cref@stackemptytrue%
+ \else\@cref@stackemptyfalse\fi}
+\def\cref@isstackfull#1{%
\def\@tmpa{\@nil}%
- \ifx#1\@tmpa\stackfullfalse%
- \else\stackfulltrue\fi}
-\newif\ifinresetlist
-\def\isinresetlist#1#2{%
+ \ifx#1\@tmpa\@cref@stackfullfalse%
+ \else\@cref@stackfulltrue\fi}
+\newif\if@cref@inresetlist
+\def\cref@isinresetlist#1#2{%
\def\@counter{#1}%
\begingroup%
\def\@elt##1{##1,}%
\expandafter\ifx\csname cl@#2\endcsname\relax%
- \gdef\@resetstack{,\@nil}%
+ \gdef\cref@resetstack{,\@nil}%
\else%
- \xdef\@resetstack{\csname cl@#2\endcsname\noexpand\@nil}%
+ \xdef\cref@resetstack{\csname cl@#2\endcsname\noexpand\@nil}%
\fi%
\endgroup%
- \isstackfull{\@resetstack}%
- \@whilesw\ifstackfull\fi{%
- \edef\@nextcounter{\stack@top{\@resetstack}}%
+ \cref@isstackfull{\cref@resetstack}%
+ \@whilesw\if@cref@stackfull\fi{%
+ \edef\@nextcounter{\cref@stack@top{\cref@resetstack}}%
\ifx\@nextcounter\@counter%
- \stackfullfalse%
+ \@cref@stackfullfalse%
\else%
\let\@nextcounter\relax%
- \stack@pop{\@resetstack}%
- \isstackfull{\@resetstack}%
+ \cref@stack@pop{\cref@resetstack}%
+ \cref@isstackfull{\cref@resetstack}%
\fi}%
\ifx\@nextcounter\relax%
- \inresetlistfalse%
+ \@cref@inresetlistfalse%
\else%
- \inresetlisttrue%
+ \@cref@inresetlisttrue%
\fi}
-\def\reset@by#1#2{%
- \isinresetlist{#1}{subsubsubsection}%
- \ifinresetlist%
+\def\cref@resetby#1#2{%
+ \cref@isinresetlist{#1}{subsubsubsection}%
+ \if@cref@inresetlist%
\def#2{subsubsubsection}%
\else%
- \isinresetlist{#1}{subsubsection}%
- \ifinresetlist%
+ \cref@isinresetlist{#1}{subsubsection}%
+ \if@cref@inresetlist%
\def#2{subsubsection}%
\else%
- \isinresetlist{#1}{subsection}%
- \ifinresetlist%
+ \cref@isinresetlist{#1}{subsection}%
+ \if@cref@inresetlist%
\def#2{subsection}%
\else%
- \isinresetlist{#1}{section}%
- \ifinresetlist%
+ \cref@isinresetlist{#1}{section}%
+ \if@cref@inresetlist%
\def#2{section}%
\else%
- \isinresetlist{#1}{chapter}%
- \ifinresetlist%
+ \cref@isinresetlist{#1}{chapter}%
+ \if@cref@inresetlist%
\def#2{chapter}%
\else%
- \isinresetlist{#1}{part}%
- \ifinresetlist%
+ \cref@isinresetlist{#1}{part}%
+ \if@cref@inresetlist%
\def#2{part}%
\else%
\let#2\relax%
@@ -203,14 +240,14 @@
\newif\if@firstgroup%
\newif\if@secondgroup%
\newif\if@secondref%
- \stack@init{\@refstack}%
- \stack@push{#2}{\@refstack}%
+ \cref@stack@init{\@refstack}%
+ \cref@stack@push{#2}{\@refstack}%
\@firstgrouptrue%
\@secondgroupfalse%
- \isstackfull{\@refstack}%
- \@whilesw\ifstackfull\fi{%
- \stack@init{\@refsubstack}%
- \edef\@nextref{\stack@top{\@refstack}}%
+ \cref@isstackfull{\@refstack}%
+ \@whilesw\if@cref@stackfull\fi{%
+ \cref@stack@init{\@refsubstack}%
+ \edef\@nextref{\cref@stack@top{\@refstack}}%
\expandafter\ifx\csname r@\@nextref\endcsname\relax%
\def\@currenttype{\@undefined}%
\else%
@@ -218,13 +255,14 @@
\fi%
\let\@nexttype\@currenttype%
\@whilesw\ifx\@nexttype\@currenttype\fi{%
- \expandafter\stack@pull\expandafter{\@nextref}{\@refsubstack}%
- \stack@pop{\@refstack}%
- \isstackempty{\@refstack}%
- \ifstackempty%
+ \expandafter\cref@stack@pull\expandafter%
+ {\@nextref}{\@refsubstack}%
+ \cref@stack@pop{\@refstack}%
+ \cref@isstackempty{\@refstack}%
+ \if@cref@stackempty%
\def\@nexttype{\relax}%
\else%
- \edef\@nextref{\stack@top{\@refstack}}%
+ \edef\@nextref{\cref@stack@top{\@refstack}}%
\ifx\@nextref\@empty%
\let\@currenttype\@nexttype%
\else%
@@ -240,8 +278,8 @@
\@firstgroupfalse%
\@secondgrouptrue%
\else%
- \isstackfull{\@refstack}%
- \ifstackfull%
+ \cref@isstackfull{\@refstack}%
+ \if@cref@stackfull%
\@setcref@middlegroupconjunction%
\else%
\if@secondgroup%
@@ -252,28 +290,28 @@
\fi%
\@secondgroupfalse%
\fi%
- \edef\@nextref{\stack@top{\@refsubstack}}%
- \stack@pop{\@refsubstack}%
- \isstackempty{\@refsubstack}%
- \ifstackempty%
+ \edef\@nextref{\cref@stack@top{\@refsubstack}}%
+ \cref@stack@pop{\@refsubstack}%
+ \cref@isstackempty{\@refsubstack}%
+ \if@cref@stackempty%
\expandafter\@setcref\expandafter{\@nextref}{#1}{}%
\else%
\edef\@beginref{\@nextref}%
\let\@endref\relax%
- \edef\@nextref{\stack@top{\@refsubstack}}%
+ \edef\@nextref{\cref@stack@top{\@refsubstack}}%
\count@consecutive=1%
\expandafter\ifx\csname r@\@beginref\endcsname\relax%
- \refconsecutivefalse%
+ \@cref@refconsecutivefalse%
\else%
\ifx\@nextref\@empty%
- \refconsecutivefalse%
+ \@cref@refconsecutivefalse%
\@whilesw\ifx\@nextref\@empty\fi{%
- \stack@pop{\@refsubstack}%
- \isstackempty{\@refsubstack}%
- \ifstackempty%
+ \cref@stack@pop{\@refsubstack}%
+ \cref@isstackempty{\@refsubstack}%
+ \if@cref@stackempty%
\let\@nextref\relax%
\else%
- \edef\@nextref{\stack@top{\@refsubstack}}%
+ \edef\@nextref{\cref@stack@top{\@refsubstack}}%
\fi%
}%
\ifnum\count@consecutive=2%
@@ -281,31 +319,31 @@
\fi%
\else%
\expandafter\ifx\csname r@\@nextref\endcsname\relax%
- \refconsecutivefalse%
+ \@cref@refconsecutivefalse%
\else%
\edef\@tmpa{{\@beginref}{\@nextref}}%
- \expandafter\isrefconsecutive\@tmpa%
+ \expandafter\cref@isrefconsecutive\@tmpa%
\fi%
\fi%
\fi%
- \@whilesw\ifrefconsecutive\fi{%
+ \@whilesw\if@cref@refconsecutive\fi{%
\advance\count@consecutive 1%
\let\@endref\@nextref%
- \stack@pop{\@refsubstack}%
- \isstackempty{\@refsubstack}%
- \ifstackempty%
- \refconsecutivefalse%
+ \cref@stack@pop{\@refsubstack}%
+ \cref@isstackempty{\@refsubstack}%
+ \if@cref@stackempty%
+ \@cref@refconsecutivefalse%
\else%
- \edef\@nextref{\stack@top{\@refsubstack}}%
+ \edef\@nextref{\cref@stack@top{\@refsubstack}}%
\ifx\@nextref\@empty%
- \refconsecutivefalse%
+ \@cref@refconsecutivefalse%
\@whilesw\ifx\@nextref\@empty\fi{%
- \stack@pop{\@refsubstack}%
- \isstackempty{\@refsubstack}%
- \ifstackempty%
+ \cref@stack@pop{\@refsubstack}%
+ \cref@isstackempty{\@refsubstack}%
+ \if@cref@stackempty%
\let\@nextref\relax%
\else%
- \edef\@nextref{\stack@top{\@refsubstack}}%
+ \edef\@nextref{\cref@stack@top{\@refsubstack}}%
\fi%
}%
\ifnum\count@consecutive=2%
@@ -313,10 +351,10 @@
\fi%
\else%
\expandafter\ifx\csname r@\@nextref\endcsname\relax%
- \refconsecutivefalse%
+ \@cref@refconsecutivefalse%
\else%
\edef\@tmpa{{\@endref}{\@nextref}}%
- \expandafter\isrefconsecutive\@tmpa%
+ \expandafter\cref@isrefconsecutive\@tmpa%
\fi%
\fi%
\fi}%
@@ -325,10 +363,11 @@
\else%
\ifnum\count@consecutive=2%
\expandafter\@setcref\expandafter{\@beginref}{#1}{@first}%
- \expandafter\stack@push\expandafter{\@endref}{\@refsubstack}%
+ \expandafter\cref@stack@push\expandafter%
+ {\@endref}{\@refsubstack}%
\else%
\edef\@tmpa{{\@beginref}{\@endref}}%
- \ifstackempty%
+ \if@cref@stackempty%
\expandafter\@setcrefrange\@tmpa{#1}{}%
\else%
\expandafter\@setcrefrange\@tmpa{#1}{@first}%
@@ -336,30 +375,30 @@
\fi%
\fi%
\@secondreftrue%
- \isstackfull{\@refsubstack}%
- \@whilesw\ifstackfull\fi{%
- \edef\@beginref{\stack@top{\@refsubstack}}%
- \stack@pop{\@refsubstack}%
+ \cref@isstackfull{\@refsubstack}%
+ \@whilesw\if@cref@stackfull\fi{%
+ \edef\@beginref{\cref@stack@top{\@refsubstack}}%
+ \cref@stack@pop{\@refsubstack}%
\let\@endref\relax%
- \isstackempty{\@refsubstack}%
- \ifstackempty%
+ \cref@isstackempty{\@refsubstack}%
+ \if@cref@stackempty%
\if@secondref%
\expandafter\@setcref\expandafter{\@beginref}{#1}{@second}%
\else%
\expandafter\@setcref\expandafter{\@beginref}{#1}{@last}%
\fi%
\else%
- \edef\@nextref{\stack@top{\@refsubstack}}%
+ \edef\@nextref{\cref@stack@top{\@refsubstack}}%
\count@consecutive=1%
\ifx\@nextref\@empty%
- \refconsecutivefalse%
+ \@cref@refconsecutivefalse%
\@whilesw\ifx\@nextref\@empty\fi{%
- \stack@pop{\@refsubstack}%
- \isstackempty{\@refsubstack}%
- \ifstackempty%
+ \cref@stack@pop{\@refsubstack}%
+ \cref@isstackempty{\@refsubstack}%
+ \if@cref@stackempty%
\let\@nextref\relax%
\else%
- \edef\@nextref{\stack@top{\@refsubstack}}%
+ \edef\@nextref{\cref@stack@top{\@refsubstack}}%
\fi%
}%
\ifnum\count@consecutive=2%
@@ -367,30 +406,30 @@
\fi%
\else%
\expandafter\ifx\csname r@\@nextref\endcsname\relax%
- \refconsecutivefalse%
+ \@cref@refconsecutivefalse%
\else%
\edef\@tmpa{{\@beginref}{\@nextref}}%
- \expandafter\isrefconsecutive\@tmpa%
+ \expandafter\cref@isrefconsecutive\@tmpa%
\fi%
\fi%
- \@whilesw\ifrefconsecutive\fi{%
+ \@whilesw\if@cref@refconsecutive\fi{%
\advance\count@consecutive 1%
\let\@endref\@nextref%
- \stack@pop{\@refsubstack}%
- \isstackempty{\@refsubstack}%
- \ifstackempty%
- \refconsecutivefalse%
+ \cref@stack@pop{\@refsubstack}%
+ \cref@isstackempty{\@refsubstack}%
+ \if@cref@stackempty%
+ \@cref@refconsecutivefalse%
\else%
- \edef\@nextref{\stack@top{\@refsubstack}}%
+ \edef\@nextref{\cref@stack@top{\@refsubstack}}%
\ifx\@nextref\@empty%
- \refconsecutivefalse%
+ \@cref@refconsecutivefalse%
\@whilesw\ifx\@nextref\@empty\fi{%
- \stack@pop{\@refsubstack}%
- \isstackempty{\@refsubstack}%
- \ifstackempty%
+ \cref@stack@pop{\@refsubstack}%
+ \cref@isstackempty{\@refsubstack}%
+ \if@cref@stackempty%
\let\@nextref\relax%
\else%
- \edef\@nextref{\stack@top{\@refsubstack}}%
+ \edef\@nextref{\cref@stack@top{\@refsubstack}}%
\fi%
}%
\ifnum\count@consecutive=2%
@@ -398,15 +437,15 @@
\fi%
\else%
\expandafter\ifx\csname r@\@nextref\endcsname\relax%
- \refconsecutivefalse%
+ \@cref@refconsecutivefalse%
\else%
\edef\@tmpa{{\@endref}{\@nextref}}%
- \expandafter\isrefconsecutive\@tmpa%
+ \expandafter\cref@isrefconsecutive\@tmpa%
\fi%
\fi%
\fi}%
- \isstackempty{\@refsubstack}%
- \ifstackempty%
+ \cref@isstackempty{\@refsubstack}%
+ \if@cref@stackempty%
\if@secondref%
\def\@pos{@second}%
\else%
@@ -422,7 +461,7 @@
\ifnum\count@consecutive=2%
\expandafter\@setcref\expandafter%
{\@beginref}{#1}{@middle}%
- \expandafter\stack@push\expandafter%
+ \expandafter\cref@stack@push\expandafter%
{\@endref}{\@refsubstack}%
\else%
\edef\@tmpa{{\@beginref}{\@endref}{#1}{\@pos}}%
@@ -431,10 +470,10 @@
\fi%
\fi%
\@secondreffalse%
- \isstackfull{\@refsubstack}%
+ \cref@isstackfull{\@refsubstack}%
}% end loop over reference substack
\fi%
- \isstackfull{\@refstack}%
+ \cref@isstackfull{\@refstack}%
}% end loop over main reference stack
\endgroup}
\def\@setcref#1#2#3{%
@@ -456,8 +495,8 @@
\fi%
\fi}
\def\@@setcref#1#2{\cref@getlabel{#2}{\@templabel}#1{\@templabel}{}{}}
-\newif\ifrefconsecutive%
-\def\isrefconsecutive#1#2{%
+\newif\if@cref@refconsecutive%
+\def\cref@isrefconsecutive#1#2{%
\begingroup%
\countdef\refa@counter=1%
\countdef\refb@counter=2%
@@ -468,57 +507,61 @@
\refb@counter=\@result%
\cref@getprefix{#1}{\refa@prefix}%
\cref@getprefix{#2}{\refb@prefix}%
- \def\@after{\refconsecutivefalse}%
+ \def\@after{\@cref@refconsecutivefalse}%
\ifx\refa@prefix\refb@prefix%
\ifnum\refa@counter=\refb@counter%
- \def\@after{\refconsecutivetrue}%
+ \def\@after{\@cref@refconsecutivetrue}%
\fi%
\fi%
\expandafter\endgroup\@after}
\def\@setcrefrange#1#2#3#4{%
- \expandafter\ifx\csname r@#1\endcsname\relax%
- \protect\G@refundefinedtrue%
- \@latex@warning{Reference `#1' on page \thepage \space undefined}%
- \expandafter\ifx\csname r@#2\endcsname\relax%
- \nfss@text{\reset@font\bfseries ??}--%
- \nfss@text{\reset@font\bfseries ??}%
- \@latex@warning{Reference `#2' on page \thepage \space undefined}%
- \else%
- \cref@getlabel{#2}{\@labelb}%
- \nfss@text{\reset@font\bfseries ??}--\@labelb%
- \fi%
- \else%
- \expandafter\ifx\csname r@#2\endcsname\relax%
+ \begingroup%
+ \expandafter\ifx\csname r@#1\endcsname\relax%
\protect\G@refundefinedtrue%
- \cref@getlabel{#1}{\@labela}%
- \@labela--\nfss@text{\reset@font\bfseries ??}%
- \@latex@warning{Reference `#2' on page \thepage \space undefined}%
+ \@latex@warning{Reference `#1' on page \thepage \space%
+ undefined}%
+ \expandafter\ifx\csname r@#2\endcsname\relax%
+ \nfss@text{\reset@font\bfseries ??}--%
+ \nfss@text{\reset@font\bfseries ??}%
+ \@latex@warning{Reference `#2' on page \thepage \space%
+ undefined}%
+ \else%
+ \cref@getlabel{#2}{\@labelb}%
+ \nfss@text{\reset@font\bfseries ??}--\@labelb%
+ \fi%
\else%
- \cref@gettype{#1}{\@typea}%
- \cref@gettype{#2}{\@typeb}%
- \cref@getlabel{#1}{\@labela}%
- \cref@getlabel{#2}{\@labelb}%
- \edef\@formata{\expandafter\noexpand%
- \csname #3range@\@typea @format#4\endcsname}%
- \edef\@formatb{\expandafter\noexpand%
- \csname #3range@\@typeb @format#4\endcsname}%
- \expandafter\ifx\@formata\relax%
+ \expandafter\ifx\csname r@#2\endcsname\relax%
\protect\G@refundefinedtrue%
- \nfss@text{\reset@font\bfseries ??}~\@labela--\@labelb%
- \@latex@warning{#3\space reference range format for label
- type `\@typea' undefined}%
+ \cref@getlabel{#1}{\@labela}%
+ \@labela--\nfss@text{\reset@font\bfseries ??}%
+ \@latex@warning{Reference `#2' on page \thepage \space undefined}%
\else%
- \ifx\formata\formatb%
- \expandafter\@@setcrefrange\expandafter{\@formata}{#1}{#2}%
- \else%
+ \cref@gettype{#1}{\@typea}%
+ \cref@gettype{#2}{\@typeb}%
+ \cref@getlabel{#1}{\@labela}%
+ \cref@getlabel{#2}{\@labelb}%
+ \edef\@formata{\expandafter\noexpand%
+ \csname #3range@\@typea @format#4\endcsname}%
+ \edef\@formatb{\expandafter\noexpand%
+ \csname #3range@\@typeb @format#4\endcsname}%
+ \expandafter\ifx\@formata\relax%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries ??}~\@labela--\@labelb%
- \@latex@warning{Types inconsistent in reference range for
- references `#1' and `#2' on page \thepage}%
+ \@latex@warning{#3\space reference range format for label
+ type `\@typea' undefined}%
+ \else%
+ \ifx\formata\formatb%
+ \expandafter\@@setcrefrange\expandafter{\@formata}{#1}{#2}%
+ \else%
+ \protect\G@refundefinedtrue%
+ \nfss@text{\reset@font\bfseries ??}~\@labela--\@labelb%
+ \@latex@warning{Types inconsistent in reference range for
+ references `#1' and `#2' on page \thepage}%
+ \fi%
\fi%
\fi%
\fi%
- \fi}
+ \endgroup}
\def\@@setcrefrange#1#2#3{%
\cref@getlabel{#2}{\@labela}%
\cref@getlabel{#3}{\@labelb}%
@@ -546,43 +589,44 @@
\expandafter\def\csname cref@#1@rangelabel\endcsname%
##1##2##3##4##5##6{#2}}
\def\@crefname#1#2#3#4{%
- \expandafter\def\csname #1@#2@name\endcsname{#3}%
- \expandafter\def\csname #1@#2@name@plural\endcsname{#4}%
- \def\@tmpa##1##2\@nil{%
- \if##1c%
- \def\@other{C##2}%
- \def\@changecase{\MakeUppercase}%
- \else%
- \def\@other{c##2}%
- \def\@changecase{\MakeLowercase}%
- \fi}%
- \@tmpa#1\@nil%
- \@ifundefined{\@other @#2@name}{%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpa%
- \expandafter\expandafter\expandafter{%
- \csname#1@#2@name\endcsname}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpb%
- \expandafter\expandafter\expandafter{%
- \csname#1@#2@name@plural\endcsname}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpa%
- \expandafter\expandafter\expandafter{%
- \expandafter\@changecase\@tmpa}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpb%
- \expandafter\expandafter\expandafter{%
- \expandafter\@changecase\@tmpb}%
- \newtoks\@toksa%
- \@toksa={%
- \expandafter\def\csname\@other @#2@name\endcsname}%
- \expandafter\the\expandafter\@toksa\expandafter{\@tmpa}%
- \@toksa={%
- \expandafter\def\csname\@other @#2@name@plural\endcsname}%
- \expandafter\the\expandafter\@toksa\expandafter{\@tmpb}%
- }{}%
-}
+ \begingroup%
+ \expandafter\gdef\csname #1@#2@name\endcsname{#3}%
+ \expandafter\gdef\csname #1@#2@name@plural\endcsname{#4}%
+ \def\@tmpa##1##2\@nil{%
+ \if##1c%
+ \def\@other{C##2}%
+ \def\@changecase{\MakeUppercase}%
+ \else%
+ \def\@other{c##2}%
+ \def\@changecase{\MakeLowercase}%
+ \fi}%
+ \@tmpa#1\@nil%
+ \@ifundefined{\@other @#2@name}{%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpa%
+ \expandafter\expandafter\expandafter{%
+ \csname#1@#2@name\endcsname}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpb%
+ \expandafter\expandafter\expandafter{%
+ \csname#1@#2@name@plural\endcsname}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpa%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@changecase\@tmpa}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpb%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@changecase\@tmpb}%
+ \newtoks\@toksa%
+ \@toksa={%
+ \expandafter\gdef\csname\@other @#2@name\endcsname}%
+ \expandafter\the\expandafter\@toksa\expandafter{\@tmpa}%
+ \@toksa={%
+ \expandafter\gdef\csname\@other @#2@name@plural\endcsname}%
+ \expandafter\the\expandafter\@toksa\expandafter{\@tmpb}%
+ }{}%
+ \endgroup}
\def\@crefconstructcomponents#1{%
\@ifundefined{cref@#1@label}{%
\let\@tmplabel\cref@default@label%
@@ -631,132 +675,136 @@
{########4}{########5}{########6}}%
}
\def\@crefdefineformat#1{%
- \newtoks\@toksa%
- \@crefconstructcomponents{#1}% puts format components into tmp macros
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpfirst%
- \expandafter\expandafter\expandafter{%
- \expandafter\@tmpname\expandafter~\@tmplabel}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpFirst%
- \expandafter\expandafter\expandafter{%
- \expandafter\@tmpName\expandafter~\@tmplabel}%
- \@toksa={\crefformat{#1}}%
- \expandafter\the\expandafter\@toksa\expandafter{\@tmpfirst}%
- \@toksa={\Crefformat{#1}}%
- \expandafter\the\expandafter\@toksa\expandafter{\@tmpFirst}%
-}
+ \begingroup%
+ \newtoks\@toksa%
+ \@crefconstructcomponents{#1}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpfirst%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@tmpname\expandafter~\@tmplabel}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpFirst%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@tmpName\expandafter~\@tmplabel}%
+ \@toksa={\crefformat{#1}}%
+ \expandafter\the\expandafter\@toksa\expandafter{\@tmpfirst}%
+ \@toksa={\Crefformat{#1}}%
+ \expandafter\the\expandafter\@toksa\expandafter{\@tmpFirst}%
+ \endgroup}
\def\@crefrangedefineformat#1{%
- \newtoks\@toksa%
- \newtoks\@toksb%
- \@crefconstructcomponents{#1}% puts format components into tmp macros
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpfirst%
- \expandafter\expandafter\expandafter{%
- \expandafter\@tmpnameplural\expandafter~\@tmprangelabel}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpFirst%
- \expandafter\expandafter\expandafter{%
- \expandafter\@tmpNameplural\expandafter~\@tmprangelabel}%
- \@toksa={\crefrangeformat{#1}}%
- \expandafter\the\expandafter\@toksa\expandafter{\@tmpfirst}%
- \@toksa={\Crefrangeformat{#1}}%
- \expandafter\the\expandafter\@toksa\expandafter{\@tmpFirst}%
-}
+ \begingroup%
+ \newtoks\@toksa%
+ \newtoks\@toksb%
+ \@crefconstructcomponents{#1}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpfirst%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@tmpnameplural\expandafter~\@tmprangelabel}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpFirst%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@tmpNameplural\expandafter~\@tmprangelabel}%
+ \@toksa={\crefrangeformat{#1}}%
+ \expandafter\the\expandafter\@toksa\expandafter{\@tmpfirst}%
+ \@toksa={\Crefrangeformat{#1}}%
+ \expandafter\the\expandafter\@toksa\expandafter{\@tmpFirst}%
+ \endgroup}
\def\@crefdefinemultiformat#1{%
- \newtoks\@toksa%
- \newtoks\@toksb%
- \@crefconstructcomponents{#1}% puts format components into tmp macros
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpfirst%
- \expandafter\expandafter\expandafter{%
- \expandafter\@tmpnameplural\expandafter~\@tmplabel}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpFirst%
- \expandafter\expandafter\expandafter{%
- \expandafter\@tmpNameplural\expandafter~\@tmplabel}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpsecond%
- \expandafter\expandafter\expandafter{%
- \expandafter\crefpairconjunction\@tmplabel}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpmiddle%
- \expandafter\expandafter\expandafter{%
- \expandafter\crefmiddleconjunction\@tmplabel}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmplast%
- \expandafter\expandafter\expandafter{%
- \expandafter\creflastconjunction\@tmplabel}%
- \@toksb={}%
- \expandafter\append@toks\expandafter\@toksb\expandafter{%
- \expandafter{\@tmpfirst}}%
- \expandafter\append@toks\expandafter\@toksb\expandafter{%
- \expandafter{\@tmpsecond}}%
- \expandafter\append@toks\expandafter\@toksb\expandafter{%
- \expandafter{\@tmpmiddle}}%
- \expandafter\append@toks\expandafter\@toksb\expandafter{%
- \expandafter{\@tmplast}}%
- \@toksa={\crefmultiformat{#1}}%
- \expandafter\the\expandafter\@toksa\the\@toksb%
- \@toksb={}%
- \expandafter\append@toks\expandafter\@toksb\expandafter{%
- \expandafter{\@tmpFirst}}%
- \expandafter\append@toks\expandafter\@toksb\expandafter{%
- \expandafter{\@tmpsecond}}%
- \expandafter\append@toks\expandafter\@toksb\expandafter{%
- \expandafter{\@tmpmiddle}}%
- \expandafter\append@toks\expandafter\@toksb\expandafter{%
- \expandafter{\@tmplast}}%
- \@toksa={\Crefmultiformat{#1}}%
- \expandafter\the\expandafter\@toksa\the\@toksb%
-}
+ \begingroup%
+ \newtoks\@toksa%
+ \newtoks\@toksb%
+ \@crefconstructcomponents{#1}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpfirst%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@tmpnameplural\expandafter~\@tmplabel}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpFirst%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@tmpNameplural\expandafter~\@tmplabel}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpsecond%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\crefpairconjunction\@tmplabel}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpmiddle%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\crefmiddleconjunction\@tmplabel}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmplast%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\creflastconjunction\@tmplabel}%
+ \@toksb={}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpfirst}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpsecond}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpmiddle}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmplast}}%
+ \@toksa={\crefmultiformat{#1}}%
+ \expandafter\the\expandafter\@toksa\the\@toksb%
+ \@toksb={}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpFirst}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpsecond}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpmiddle}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmplast}}%
+ \@toksa={\Crefmultiformat{#1}}%
+ \expandafter\the\expandafter\@toksa\the\@toksb%
+ \endgroup}
\def\@crefrangedefinemultiformat#1{%
- \newtoks\@toksa%
- \newtoks\@toksb%
- \@crefconstructcomponents{#1}% puts format components into tmp macros
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpfirst%
- \expandafter\expandafter\expandafter{%
- \expandafter\@tmpnameplural\expandafter~\@tmprangelabel}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpFirst%
- \expandafter\expandafter\expandafter{%
- \expandafter\@tmpNameplural\expandafter~\@tmprangelabel}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpsecond%
- \expandafter\expandafter\expandafter{%
- \expandafter\crefpairconjunction\@tmprangelabel}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpmiddle%
- \expandafter\expandafter\expandafter{%
- \expandafter\crefmiddleconjunction\@tmprangelabel}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmplast%
- \expandafter\expandafter\expandafter{%
- \expandafter\creflastconjunction\@tmprangelabel}%
- \@toksb={}%
- \expandafter\append@toks\expandafter\@toksb\expandafter{%
- \expandafter{\@tmpfirst}}%
- \expandafter\append@toks\expandafter\@toksb\expandafter{%
- \expandafter{\@tmpsecond}}%
- \expandafter\append@toks\expandafter\@toksb\expandafter{%
- \expandafter{\@tmpmiddle}}%
- \expandafter\append@toks\expandafter\@toksb\expandafter{%
- \expandafter{\@tmplast}}%
- \@toksa={\crefrangemultiformat{#1}}%
- \expandafter\the\expandafter\@toksa\the\@toksb%
- \@toksb={}%
- \expandafter\append@toks\expandafter\@toksb\expandafter{%
- \expandafter{\@tmpFirst}}%
- \expandafter\append@toks\expandafter\@toksb\expandafter{%
- \expandafter{\@tmpsecond}}%
- \expandafter\append@toks\expandafter\@toksb\expandafter{%
- \expandafter{\@tmpmiddle}}%
- \expandafter\append@toks\expandafter\@toksb\expandafter{%
- \expandafter{\@tmplast}}%
- \@toksa={\Crefrangemultiformat{#1}}%
- \expandafter\the\expandafter\@toksa\the\@toksb%
-}
+ \begingroup%
+ \newtoks\@toksa%
+ \newtoks\@toksb%
+ \@crefconstructcomponents{#1}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpfirst%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@tmpnameplural\expandafter~\@tmprangelabel}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpFirst%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@tmpNameplural\expandafter~\@tmprangelabel}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpsecond%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\crefpairconjunction\@tmprangelabel}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpmiddle%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\crefmiddleconjunction\@tmprangelabel}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmplast%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\creflastconjunction\@tmprangelabel}%
+ \@toksb={}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpfirst}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpsecond}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpmiddle}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmplast}}%
+ \@toksa={\crefrangemultiformat{#1}}%
+ \expandafter\the\expandafter\@toksa\the\@toksb%
+ \@toksb={}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpFirst}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpsecond}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpmiddle}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmplast}}%
+ \@toksa={\Crefrangemultiformat{#1}}%
+ \expandafter\the\expandafter\@toksa\the\@toksb%
+ \endgroup}
\def\@crefdefineallformats#1{%
\@crefdefineformat{#1}%
\@crefrangedefineformat{#1}%
@@ -775,165 +823,175 @@
\newcommand{\Crefrangemultiformat}[5]{%
\@crefrangemultiformat{Crefrange}{#1}{#2}{#3}{#4}{#5}}
\def\@crefformat#1#2#3{%
- \expandafter\def\csname #1@#2@format\endcsname##1##2##3{#3}%
- \def\@tmpa##1##2\@nil{%
- \if##1c%
- \def\@other{C##2}%
- \def\@changecase{\MakeUppercase}%
- \else%
- \def\@other{c##2}%
- \def\@changecase{\MakeLowercase}%
- \fi}%
- \@tmpa#1\@nil%
- \@ifundefined{\@other @#2@format}{%
- \newtoks\@toksa%
- \@toksa={\def\@tmpa##1##2##3}%
- \expandafter\expandafter\expandafter\the%
- \expandafter\expandafter\expandafter\@toksa%
- \expandafter\expandafter\expandafter{%
- \csname#1@#2@format\endcsname{##1}{##2}{##3}}%
- \expandafter\expandafter\expandafter\the%
- \expandafter\expandafter\expandafter\@toksa%
- \expandafter\expandafter\expandafter{%
- \expandafter\@changecase\@tmpa{##1}{##2}{##3}}%
- \@toksa={%
- \expandafter\def\csname\@other @#2@format\endcsname##1##2##3}%
- \expandafter\the\expandafter\@toksa\expandafter{%
- \@tmpa{##1}{##2}{##3}}%
- }{}%
-}
+ \begingroup%
+ \expandafter\gdef\csname #1@#2@format\endcsname##1##2##3{#3}%
+ \def\@tmpa##1##2\@nil{%
+ \if##1c%
+ \def\@other{C##2}%
+ \def\@changecase{\MakeUppercase}%
+ \else%
+ \def\@other{c##2}%
+ \def\@changecase{\MakeLowercase}%
+ \fi}%
+ \@tmpa#1\@nil%
+ \@ifundefined{\@other @#2@format}{%
+ \newtoks\@toksa%
+ \@toksa={\def\@tmpa##1##2##3}%
+ \expandafter\expandafter\expandafter\the%
+ \expandafter\expandafter\expandafter\@toksa%
+ \expandafter\expandafter\expandafter{%
+ \csname#1@#2@format\endcsname{##1}{##2}{##3}}%
+ \expandafter\expandafter\expandafter\the%
+ \expandafter\expandafter\expandafter\@toksa%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@changecase\@tmpa{##1}{##2}{##3}}%
+ \@toksa={%
+ \expandafter\gdef\csname\@other @#2@format\endcsname##1##2##3}%
+ \expandafter\the\expandafter\@toksa\expandafter{%
+ \@tmpa{##1}{##2}{##3}}%
+ }{}%
+ \endgroup}
\def\@crefrangeformat#1#2#3{%
- \expandafter\def\csname #1@#2@format\endcsname%
- ##1##2##3##4##5##6{#3}%
- \def\@tmpa##1##2\@nil{%
- \if##1c%
- \def\@other{C##2}%
- \def\@changecase{\MakeUppercase}%
- \else%
- \def\@other{c##2}%
- \def\@changecase{\MakeLowercase}%
- \fi}%
- \@tmpa#1\@nil%
- \@ifundefined{\@other @#2@format}{%
- \newtoks\@toksa%
- \@toksa={\def\@tmpa##1##2##3##4##5##6}%
- \expandafter\expandafter\expandafter\the%
- \expandafter\expandafter\expandafter\@toksa%
- \expandafter\expandafter\expandafter{%
- \csname#1@#2@format\endcsname{##1}{##2}{##3}{##4}{##5}{##6}}%
- \expandafter\expandafter\expandafter\the%
- \expandafter\expandafter\expandafter\@toksa%
- \expandafter\expandafter\expandafter{%
- \expandafter\@changecase\@tmpa{##1}{##2}{##3}{##4}{##5}{##6}}%
- \@toksa={\expandafter\def%
- \csname\@other @#2@format\endcsname##1##2##3##4##5##6}%
- \expandafter\the\expandafter\@toksa\expandafter{%
- \@tmpa{##1}{##2}{##3}{##4}{##5}{##6}}%
- }{}%
-}
+ \begingroup%
+ \expandafter\gdef\csname #1@#2@format\endcsname%
+ ##1##2##3##4##5##6{#3}%
+ \def\@tmpa##1##2\@nil{%
+ \if##1c%
+ \def\@other{C##2}%
+ \def\@changecase{\MakeUppercase}%
+ \else%
+ \def\@other{c##2}%
+ \def\@changecase{\MakeLowercase}%
+ \fi}%
+ \@tmpa#1\@nil%
+ \@ifundefined{\@other @#2@format}{%
+ \newtoks\@toksa%
+ \@toksa={\def\@tmpa##1##2##3##4##5##6}%
+ \expandafter\expandafter\expandafter\the%
+ \expandafter\expandafter\expandafter\@toksa%
+ \expandafter\expandafter\expandafter{%
+ \csname#1@#2@format\endcsname{##1}{##2}{##3}{##4}{##5}{##6}}%
+ \expandafter\expandafter\expandafter\the%
+ \expandafter\expandafter\expandafter\@toksa%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@changecase\@tmpa{##1}{##2}{##3}{##4}{##5}{##6}}%
+ \@toksa={\expandafter\gdef%
+ \csname\@other @#2@format\endcsname##1##2##3##4##5##6}%
+ \expandafter\the\expandafter\@toksa\expandafter{%
+ \@tmpa{##1}{##2}{##3}{##4}{##5}{##6}}%
+ }{}%
+ \endgroup}
\def\@crefmultiformat#1#2#3#4#5#6{%
- \expandafter\def\csname #1@#2@format@first\endcsname##1##2##3{#3}%
- \expandafter\def\csname #1@#2@format@second\endcsname##1##2##3{#4}%
- \expandafter\def\csname #1@#2@format@middle\endcsname##1##2##3{#5}%
- \expandafter\def\csname #1@#2@format@last\endcsname##1##2##3{#6}%
- \def\@tmpa##1##2\@nil{%
- \if##1c%
- \def\@other{C##2}%
- \def\@changecase{\MakeUppercase}%
- \else%
- \def\@other{c##2}%
- \def\@changecase{\MakeLowercase}%
- \fi}%
- \@tmpa#1\@nil%
- \@ifundefined{\@other @#2@format@first}{%
- \@toksa={\def\@tmpa##1##2##3}%
- \expandafter\expandafter\expandafter\the%
- \expandafter\expandafter\expandafter\@toksa%
- \expandafter\expandafter\expandafter{%
- \csname#1@#2@format@first\endcsname{##1}{##2}{##3}}%
- \expandafter\expandafter\expandafter\the%
- \expandafter\expandafter\expandafter\@toksa%
- \expandafter\expandafter\expandafter{%
- \expandafter\@changecase\@tmpa{##1}{##2}{##3}}%
- \@toksa={%
- \expandafter\def\csname\@other @#2@format@first\endcsname%
- ##1##2##3}%
- \expandafter\the\expandafter\@toksa\expandafter{%
- \@tmpa{##1}{##2}{##3}}%
- }{}%
- \@ifundefined{\@other @#2@format@second}{%
- \@toksa={%
- \expandafter\let\csname\@other @#2@format@second\endcsname}%
- \expandafter\the\expandafter\@toksa%
- \csname #1@#2@format@second\endcsname%
- }{}%
- \@ifundefined{\@other @#2@format@middle}{%
- \@toksa={%
- \expandafter\let\csname\@other @#2@format@middle\endcsname}%
- \expandafter\the\expandafter\@toksa%
- \csname #1@#2@format@middle\endcsname%
- }{}%
- \@ifundefined{\@other @#2@format@last}{%
- \@toksa={%
- \expandafter\let\csname\@other @#2@format@last\endcsname}%
- \expandafter\the\expandafter\@toksa%
- \csname #1@#2@format@last\endcsname%
- }{}%
-}
+ \begingroup%
+ \expandafter\gdef\csname #1@#2@format@first\endcsname##1##2##3{#3}%
+ \expandafter\gdef\csname #1@#2@format@second\endcsname##1##2##3{#4}%
+ \expandafter\gdef\csname #1@#2@format@middle\endcsname##1##2##3{#5}%
+ \expandafter\gdef\csname #1@#2@format@last\endcsname##1##2##3{#6}%
+ \def\@tmpa##1##2\@nil{%
+ \if##1c%
+ \def\@other{C##2}%
+ \def\@changecase{\MakeUppercase}%
+ \else%
+ \def\@other{c##2}%
+ \def\@changecase{\MakeLowercase}%
+ \fi}%
+ \@tmpa#1\@nil%
+ \@ifundefined{\@other @#2@format@first}{%
+ \@toksa={\def\@tmpa##1##2##3}%
+ \expandafter\expandafter\expandafter\the%
+ \expandafter\expandafter\expandafter\@toksa%
+ \expandafter\expandafter\expandafter{%
+ \csname#1@#2@format@first\endcsname{##1}{##2}{##3}}%
+ \expandafter\expandafter\expandafter\the%
+ \expandafter\expandafter\expandafter\@toksa%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@changecase\@tmpa{##1}{##2}{##3}}%
+ \@toksa={%
+ \expandafter\gdef\csname\@other @#2@format@first\endcsname%
+ ##1##2##3}%
+ \expandafter\the\expandafter\@toksa\expandafter{%
+ \@tmpa{##1}{##2}{##3}}%
+ }{}%
+ \@ifundefined{\@other @#2@format@second}{%
+ \@toksa={%
+ \expandafter\global\expandafter\let%
+ \csname\@other @#2@format@second\endcsname}%
+ \expandafter\the\expandafter\@toksa%
+ \csname #1@#2@format@second\endcsname%
+ }{}%
+ \@ifundefined{\@other @#2@format@middle}{%
+ \@toksa={%
+ \expandafter\global\expandafter\let%
+ \csname\@other @#2@format@middle\endcsname}%
+ \expandafter\the\expandafter\@toksa%
+ \csname #1@#2@format@middle\endcsname%
+ }{}%
+ \@ifundefined{\@other @#2@format@last}{%
+ \@toksa={%
+ \expandafter\global\expandafter\let%
+ \csname\@other @#2@format@last\endcsname}%
+ \expandafter\the\expandafter\@toksa%
+ \csname #1@#2@format@last\endcsname%
+ }{}%
+ \endgroup}
\def\@crefrangemultiformat#1#2#3#4#5#6{%
- \expandafter\def\csname #1@#2@format@first\endcsname%
- ##1##2##3##4##5##6{#3}%
- \expandafter\def\csname #1@#2@format@second\endcsname%
- ##1##2##3##4##5##6{#4}%
- \expandafter\def\csname #1@#2@format@middle\endcsname%
- ##1##2##3##4##5##6{#5}%
- \expandafter\def\csname #1@#2@format@last\endcsname%
- ##1##2##3##4##5##6{#6}%
- \def\@tmpa##1##2\@nil{%
- \if##1c%
- \def\@other{C##2}%
- \def\@changecase{\MakeUppercase}%
- \else%
- \def\@other{c##2}%
- \def\@changecase{\MakeLowercase}%
- \fi}%
- \@tmpa#1\@nil%
- \@ifundefined{\@other @#2@format@first}{%
- \@toksa={\def\@tmpa##1##2##3##4##5##6}%
- \expandafter\expandafter\expandafter\the%
- \expandafter\expandafter\expandafter\@toksa%
- \expandafter\expandafter\expandafter{%
- \csname#1@#2@format@first\endcsname%
- {##1}{##2}{##3}{##4}{##5}{##6}}%
- \expandafter\expandafter\expandafter\the%
- \expandafter\expandafter\expandafter\@toksa%
- \expandafter\expandafter\expandafter{%
- \expandafter\@changecase\@tmpa{##1}{##2}{##3}{##4}{##5}{##6}}%
- \@toksa={%
- \expandafter\def\csname\@other @#2@format@first\endcsname%
- ##1##2##3##4##5##6}%
- \expandafter\the\expandafter\@toksa\expandafter{%
- \@tmpa{##1}{##2}{##3}{##4}{##5}{##6}}%
- }{}%
- \@ifundefined{\@other @#2@format@second}{%
- \@toksa={%
- \expandafter\let\csname\@other @#2@format@second\endcsname}%
- \expandafter\the\expandafter\@toksa%
- \csname #1@#2@format@second\endcsname%
- }{}%
- \@ifundefined{\@other @#2@format@middle}{%
- \@toksa={%
- \expandafter\let\csname\@other @#2@format@middle\endcsname}%
- \expandafter\the\expandafter\@toksa%
- \csname #1@#2@format@middle\endcsname%
- }{}%
- \@ifundefined{\@other @#2@format@last}{%
- \@toksa={%
- \expandafter\let\csname\@other @#2@format@last\endcsname}%
- \expandafter\the\expandafter\@toksa%
- \csname #1@#2@format@last\endcsname%
- }{}%
-}
+ \begingroup%
+ \expandafter\gdef\csname #1@#2@format@first\endcsname%
+ ##1##2##3##4##5##6{#3}%
+ \expandafter\gdef\csname #1@#2@format@second\endcsname%
+ ##1##2##3##4##5##6{#4}%
+ \expandafter\gdef\csname #1@#2@format@middle\endcsname%
+ ##1##2##3##4##5##6{#5}%
+ \expandafter\gdef\csname #1@#2@format@last\endcsname%
+ ##1##2##3##4##5##6{#6}%
+ \def\@tmpa##1##2\@nil{%
+ \if##1c%
+ \def\@other{C##2}%
+ \def\@changecase{\MakeUppercase}%
+ \else%
+ \def\@other{c##2}%
+ \def\@changecase{\MakeLowercase}%
+ \fi}%
+ \@tmpa#1\@nil%
+ \@ifundefined{\@other @#2@format@first}{%
+ \@toksa={\def\@tmpa##1##2##3##4##5##6}%
+ \expandafter\expandafter\expandafter\the%
+ \expandafter\expandafter\expandafter\@toksa%
+ \expandafter\expandafter\expandafter{%
+ \csname#1@#2@format@first\endcsname%
+ {##1}{##2}{##3}{##4}{##5}{##6}}%
+ \expandafter\expandafter\expandafter\the%
+ \expandafter\expandafter\expandafter\@toksa%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@changecase\@tmpa{##1}{##2}{##3}{##4}{##5}{##6}}%
+ \@toksa={%
+ \expandafter\gdef\csname\@other @#2@format@first\endcsname%
+ ##1##2##3##4##5##6}%
+ \expandafter\the\expandafter\@toksa\expandafter{%
+ \@tmpa{##1}{##2}{##3}{##4}{##5}{##6}}%
+ }{}%
+ \@ifundefined{\@other @#2@format@second}{%
+ \@toksa={%
+ \expandafter\global\expandafter\let%
+ \csname\@other @#2@format@second\endcsname}%
+ \expandafter\the\expandafter\@toksa%
+ \csname #1@#2@format@second\endcsname%
+ }{}%
+ \@ifundefined{\@other @#2@format@middle}{%
+ \@toksa={%
+ \expandafter\global\expandafter\let%
+ \csname\@other @#2@format@middle\endcsname}%
+ \expandafter\the\expandafter\@toksa%
+ \csname #1@#2@format@middle\endcsname%
+ }{}%
+ \@ifundefined{\@other @#2@format@last}{%
+ \@toksa={%
+ \expandafter\global\expandafter\let%
+ \csname\@other @#2@format@last\endcsname}%
+ \expandafter\the\expandafter\@toksa%
+ \csname #1@#2@format@last\endcsname%
+ }{}%
+ \endgroup}
\newcommand{\crefrangeconjunction}{ to~}
\newcommand{\crefpairconjunction}{ and~}
\newcommand{\crefmiddleconjunction}{, }
@@ -974,6 +1032,9 @@
\@ifundefined{cref@subsubsubsection@name}{%
\@crefname{cref}{subsubsubsection}{section}{sections}%
\@crefname{Cref}{subsubsubsection}{Section}{Sections}}{}%
+ \@ifundefined{cref@appendix@name}{%
+ \@crefname{cref}{appendix}{appendix}{appendices}%
+ \@crefname{Cref}{appendix}{Appendix}{Appendices}}{}%
\@ifundefined{cref@figure@name}{%
\@crefname{cref}{figure}{fig.}{figs.}%
\@crefname{Cref}{figure}{Figure}{Figures}}{}%
@@ -1048,6 +1109,14 @@
\@crefdefinemultiformat{subsubsubsection}}{}%
\@ifundefined{crefrange@subsubsubsection@format@first}{%
\@crefrangedefinemultiformat{subsubsubsection}}{}%
+ \@ifundefined{cref@appendix@format}{%
+ \@crefdefineformat{appendix}}{}%
+ \@ifundefined{crefrange@appendix@format}{%
+ \@crefrangedefineformat{appendix}}{}%
+ \@ifundefined{cref@appendix@format@first}{%
+ \@crefdefinemultiformat{appendix}}{}%
+ \@ifundefined{crefrange@appendix@format@first}{%
+ \@crefrangedefinemultiformat{appendix}}{}%
\@ifundefined{cref@figure@format}{%
\@crefdefineformat{figure}}{}%
\@ifundefined{crefrange@figure@format}{%
@@ -1056,6 +1125,14 @@
\@crefdefinemultiformat{figure}}{}%
\@ifundefined{crefrange@figure@format@first}{%
\@crefrangedefinemultiformat{figure}}{}%
+ \@ifundefined{cref@table@format}{%
+ \@crefdefineformat{table}}{}%
+ \@ifundefined{crefrange@table@format}{%
+ \@crefrangedefineformat{table}}{}%
+ \@ifundefined{cref@table@format@first}{%
+ \@crefdefinemultiformat{table}}{}%
+ \@ifundefined{crefrange@table@format@first}{%
+ \@crefrangedefinemultiformat{table}}{}%
\@ifundefined{cref@theorem@format}{%
\@crefdefineformat{theorem}}{}%
\@ifundefined{crefrange@theorem@format}{%
@@ -1115,38 +1192,76 @@
\def\cref@hyperref#1{\expandafter\expandafter\expandafter%
\@fourthoffive\csname r@#1\endcsname}
\def\cref@getlabel#1#2{%
- \expandafter\let\expandafter\@tempa\csname r@#1\endcsname%
- \edef\@tempa{\expandafter\@firstoffive\@tempa}%
- \expandafter\@cref@getlabel\@tempa\@nil#2}
+ \expandafter\let\expandafter\@tmpa\csname r@#1\endcsname%
+ \edef\@tmpa{\expandafter\@firstoffive\@tmpa}%
+ \expandafter\@cref@getlabel\@tmpa\@nil#2}
\def\cref@gettype#1#2{%
- \expandafter\let\expandafter\@tempa\csname r@#1\endcsname%
- \edef\@tempa{\expandafter\@firstoffive\@tempa}%
- \expandafter\@cref@gettype\@tempa\@nil#2}
+ \expandafter\let\expandafter\@tmpa\csname r@#1\endcsname%
+ \edef\@tmpa{\expandafter\@firstoffive\@tmpa}%
+ \expandafter\@cref@gettype\@tmpa\@nil#2}
\def\cref@getcounter#1#2{%
- \expandafter\let\expandafter\@tempa\csname r@#1\endcsname%
- \edef\@tempa{\expandafter\@firstoffive\@tempa}%
- \expandafter\@cref@getcounter\@tempa\@nil#2}
+ \expandafter\let\expandafter\@tmpa\csname r@#1\endcsname%
+ \edef\@tmpa{\expandafter\@firstoffive\@tmpa}%
+ \expandafter\@cref@getcounter\@tmpa\@nil#2}
\def\cref@getprefix#1#2{%
- \expandafter\let\expandafter\@tempa\csname r@#1\endcsname%
- \edef\@tempa{\expandafter\@firstoffive\@tempa}%
- \expandafter\@cref@getprefix\@tempa\@nil#2}
+ \expandafter\let\expandafter\@tmpa\csname r@#1\endcsname%
+ \edef\@tmpa{\expandafter\@firstoffive\@tmpa}%
+ \expandafter\@cref@getprefix\@tmpa\@nil#2}
\def\H@refstepcounter#1{%
\stepcounter{#1}%
- \reset@by{#1}{\@result}%
+ \cref@resetby{#1}{\@result}%
\ifx\@result\relax\def\@result{}%
\else\edef\@result{\csname the\@result\endcsname}\fi%
- \protected@edef\@currentlabel%
- {[#1][\arabic{#1}][\@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}}
-\def\refstepcounter@noarg#1{\old@refstepcounter{#1}}
+ \protected@edef\@currentlabel{%
+ [#1][\arabic{#1}][\@result]%
+ \csname p@#1\endcsname\csname the#1\endcsname}}
+\def\refstepcounter@noarg#1{\cref@old@refstepcounter{#1}}
\def\refstepcounter@optarg[#1]#2{%
- \old@refstepcounter{#2}%
- \expandafter\@cref@getlabel\@currentlabel\@nil{\@templabel}%
- \reset@by{#2}{\@tempreset}%
- \ifx\@tempreset\relax\def\@tempreset{}%
- \else\edef\@tempreset{\csname the\@tempreset\endcsname}\fi%
+ \cref@old@refstepcounter{#2}%
+ \expandafter\@cref@getlabel\@currentlabel\@nil{\@tmplabel}%
+ \cref@resetby{#2}{\@tmpreset}%
+ \ifx\@tmpreset\relax\def\@tmpreset{}%
+ \else\edef\@tmpreset{\csname the\@tmpreset\endcsname}\fi%
\protected@edef\@currentlabel{%
- [#1][\arabic{#2}][\@tempreset]\@templabel}}
+ [#1][\arabic{#2}][\@tmpreset]\@tmplabel}}
+\renewcommand\appendix{%
+ \cref@old@appendix%
+ \@ifundefined{chapter}{%
+ \def\H@refstepcounter##1{%
+ \stepcounter{##1}%
+ \cref@resetby{##1}{\@result}%
+ \ifx\@result\relax\def\@result{}%
+ \else\edef\@result{\csname the\@result\endcsname}\fi%
+ \def\@tmpa{##1}
+ \def\@tmpb{section}%
+ \ifx\@tmpa\@tmpb%
+ \protected@edef\@currentlabel{%
+ [appendix][\arabic{##1}][\@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
+ \else
+ \protected@edef\@currentlabel{%
+ [##1][\arabic{##1}][\@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
+ fi}%
+ }{%
+ \def\H@refstepcounter##1{%
+ \stepcounter{##1}%
+ \cref@resetby{##1}{\@result}%
+ \ifx\@result\relax\def\@result{}%
+ \else\edef\@result{\csname the\@result\endcsname}\fi%
+ \def\@tmpa{##1}
+ \def\@tmpb{chapter}%
+ \ifx\@tmpa\@tmpb%
+ \protected@edef\@currentlabel{%
+ [appendix][\arabic{##1}][\@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
+ \else
+ \protected@edef\@currentlabel{%
+ [##1][\arabic{##1}][\@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
+ fi}%
+ }%
+}
\newif\if@crefstarred
\DeclareRobustCommand{\cref}{%
\@ifstar{\@crefstar{cref}}{\@crefnostar{cref}}}
@@ -1163,12 +1278,12 @@
\def\@crefrangestar#1#2#3{%
\@crefstarredtrue\@crefrangenostar{#1}{#2}{#3}\@crefstarredfalse}
\def\@@setcref#1#2{%
- \cref@getlabel{#2}{\@templabel}%
+ \cref@getlabel{#2}{\@tmplabel}%
\if@crefstarred%
- #1{\@templabel}{}{}%
+ #1{\@tmplabel}{}{}%
\else%
- \edef\@templink{\cref@hyperref{#2}}%
- #1{\@templabel}{\hyper@linkstart{link}{\@templink}}{\hyper@linkend}%
+ \edef\@tmplink{\cref@hyperref{#2}}%
+ #1{\@tmplabel}{\hyper@linkstart{link}{\@tmplink}}{\hyper@linkend}%
\fi}
\def\@@setcrefrange#1#2#3{%
\cref@getlabel{#2}{\@labela}%