From d3671f22432b637eaff8373f0a05d42b116d39be Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 18 Jan 2012 23:23:14 +0000 Subject: cleveref 0.18.2 (17jan12) git-svn-id: svn://tug.org/texlive/trunk@25141 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/cleveref/cleveref.sty | 355 ++++++++++------------ 1 file changed, 160 insertions(+), 195 deletions(-) (limited to 'Master/texmf-dist/tex/latex/cleveref') diff --git a/Master/texmf-dist/tex/latex/cleveref/cleveref.sty b/Master/texmf-dist/tex/latex/cleveref/cleveref.sty index d31f1b45ae4..7b6479f04e4 100644 --- a/Master/texmf-dist/tex/latex/cleveref/cleveref.sty +++ b/Master/texmf-dist/tex/latex/cleveref/cleveref.sty @@ -11,8 +11,8 @@ %% Copyright (C) 2006 Toby Cubitt %% See the files README and COPYING. %% -\def\packagedate{2011/12/24} -\def\packageversion{0.18.1} +\def\packagedate{2012/01/17} +\def\packageversion{0.18.2} %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.2 %% of this license or (at your option) any later version. @@ -163,83 +163,38 @@ \fi% \cref@stack@add{#1}{\cref@label@types}% \cref@old@ynthm{#1}{#2}} -\let\cref@old@appendix\appendix -\renewcommand\appendix{% - \cref@old@appendix% - \@ifundefined{chapter}{% - \gdef\refstepcounter@noarg##1{% - \cref@old@refstepcounter{##1}% - \cref@constructprefix{##1}{\cref@result}% - \ifx\cref@result\@empty% - \def\cref@result{2147483647}% - \else% - \edef\cref@result{2147483647,\cref@result}% - \fi% - \def\@tempa{##1}% - \def\@tempb{section}% - \ifx\@tempa\@tempb% - \protected@xdef\cref@currentlabel{% - [appendix][\arabic{##1}][\cref@result]% - \csname p@##1\endcsname\csname the##1\endcsname}% - \else% - \def\@tempa{##1}% - \def\@tempb{subsection}% - \ifx\@tempa\@tempb% - \protected@xdef\cref@currentlabel{% - [subappendix][\arabic{##1}][\cref@result]% - \csname p@##1\endcsname\csname the##1\endcsname}% +\@ifundefined{appendix}{}{% + \let\cref@old@appendix\appendix + \renewcommand\appendix{% + \cref@old@appendix% + \@ifundefined{chapter}{% + \gdef\refstepcounter@noarg##1{% + \cref@old@refstepcounter{##1}% + \cref@constructprefix{##1}{\cref@result}% + \ifx\cref@result\@empty% + \def\cref@result{2147483647}% \else% - \def\@tempa{##1}% - \def\@tempb{subsubsection}% - \ifx\@tempa\@tempb% - \protected@xdef\cref@currentlabel{% - [subsubappendix][\arabic{##1}][\cref@result]% - \csname p@##1\endcsname\csname the##1\endcsname}% - \else% - \@ifundefined{cref@##1@alias}% - {\def\@tempa{##1}}% - {\def\@tempa{\csname cref@##1@alias\endcsname}}% - \protected@xdef\cref@currentlabel{% - [\@tempa][\arabic{##1}][\cref@result]% - \csname p@##1\endcsname\csname the##1\endcsname} - \fi% + \edef\cref@result{2147483647,\cref@result}% \fi% - \fi}% - }{% - \def\refstepcounter@noarg##1{% - \cref@old@refstepcounter{##1}% - \cref@constructprefix{##1}{\cref@result}% - \ifx\cref@result\@empty% - \def\cref@result{2147483647}% - \else% - \edef\cref@result{2147483647,\cref@result}% - \fi% - \def\@tempa{##1}% - \def\@tempb{chapter}% - \ifx\@tempa\@tempb% - \protected@xdef\cref@currentlabel{% - [appendix][\arabic{##1}][\cref@result]% - \csname p@##1\endcsname\csname the##1\endcsname}% - \else% \def\@tempa{##1}% \def\@tempb{section}% \ifx\@tempa\@tempb% \protected@xdef\cref@currentlabel{% - [subappendix][\arabic{##1}][\cref@result]% + [appendix][\arabic{##1}][\cref@result]% \csname p@##1\endcsname\csname the##1\endcsname}% \else% \def\@tempa{##1}% \def\@tempb{subsection}% \ifx\@tempa\@tempb% \protected@xdef\cref@currentlabel{% - [subsubappendix][\arabic{##1}][\cref@result]% + [subappendix][\arabic{##1}][\cref@result]% \csname p@##1\endcsname\csname the##1\endcsname}% \else% \def\@tempa{##1}% \def\@tempb{subsubsection}% \ifx\@tempa\@tempb% \protected@xdef\cref@currentlabel{% - [subsubsubappendix][\arabic{##1}][\cref@result]% + [subsubappendix][\arabic{##1}][\cref@result]% \csname p@##1\endcsname\csname the##1\endcsname}% \else% \@ifundefined{cref@##1@alias}% @@ -250,10 +205,57 @@ \csname p@##1\endcsname\csname the##1\endcsname} \fi% \fi% + \fi}% + }{% + \def\refstepcounter@noarg##1{% + \cref@old@refstepcounter{##1}% + \cref@constructprefix{##1}{\cref@result}% + \ifx\cref@result\@empty% + \def\cref@result{2147483647}% + \else% + \edef\cref@result{2147483647,\cref@result}% \fi% - \fi}% + \def\@tempa{##1}% + \def\@tempb{chapter}% + \ifx\@tempa\@tempb% + \protected@xdef\cref@currentlabel{% + [appendix][\arabic{##1}][\cref@result]% + \csname p@##1\endcsname\csname the##1\endcsname}% + \else% + \def\@tempa{##1}% + \def\@tempb{section}% + \ifx\@tempa\@tempb% + \protected@xdef\cref@currentlabel{% + [subappendix][\arabic{##1}][\cref@result]% + \csname p@##1\endcsname\csname the##1\endcsname}% + \else% + \def\@tempa{##1}% + \def\@tempb{subsection}% + \ifx\@tempa\@tempb% + \protected@xdef\cref@currentlabel{% + [subsubappendix][\arabic{##1}][\cref@result]% + \csname p@##1\endcsname\csname the##1\endcsname}% + \else% + \def\@tempa{##1}% + \def\@tempb{subsubsection}% + \ifx\@tempa\@tempb% + \protected@xdef\cref@currentlabel{% + [subsubsubappendix][\arabic{##1}][\cref@result]% + \csname p@##1\endcsname\csname the##1\endcsname}% + \else% + \@ifundefined{cref@##1@alias}% + {\def\@tempa{##1}}% + {\def\@tempa{\csname cref@##1@alias\endcsname}}% + \protected@xdef\cref@currentlabel{% + [\@tempa][\arabic{##1}][\cref@result]% + \csname p@##1\endcsname\csname the##1\endcsname} + \fi% + \fi% + \fi% + \fi}% + }% }% -} +}% end of \@ifundefined{appendix} \def\@gobble@optarg{\@ifnextchar[\@@gobble@optarg\@gobble@orig}%] \def\@gobble@orig#1{} \def\@@gobble@optarg[#1]#2{} @@ -1163,7 +1165,7 @@ }% \fi} \def\@@setnamecref#1#2{% - \edef\@tempa{#1}% + \expandafter\def\expandafter\@tempa\expandafter{#1}% \expandafter#2\@tempa} \DeclareRobustCommand{\cpageref}[1]{% \@cpageref{cref}{#1}{\@setcpageref}{\@setcpagerefrange}} @@ -1366,23 +1368,24 @@ \@crefname{cref}{#1}{#2}{#3}{@preamble}} \newcommand{\Crefname@preamble}[3]{% \@crefname{Cref}{#1}{#2}{#3}{@preamble}} +\def\cref@othervariant#1#2#3{\cref@@othervariant#1\@nil#2#3} +\def\cref@@othervariant#1#2\@nil#3#4{% + \if#1c% + \def#3{C#2}% + \def#4{\MakeUppercase}% + \else% + \def#3{c#2}% + \if@cref@capitalise% + \def#4{}% + \else% + \def#4{\MakeLowercase}% + \fi% + \fi} \def\@crefname#1#2#3#4#5{% \expandafter\def\csname #1@#2@name#5\endcsname{#3}% \expandafter\def\csname #1@#2@name@plural#5\endcsname{#4}% - \def\@tempa##1##2\@nil{% - \if##1c% - \def\@other{C##2}% - \def\@tempc{\expandafter\MakeUppercase}% - \else% - \def\@other{c##2}% - \if@cref@capitalise% - \def\@tempc{}% - \else% - \def\@tempc{\MakeLowercase}% - \fi% - \fi}% - \@tempa#1\@nil% - \@ifundefined{\@other @#2@name#5}{% + \cref@othervariant{#1}{\@tempc}{\@tempd}% + \@ifundefined{\@tempc @#2@name#5}{% \expandafter\expandafter\expandafter\def% \expandafter\expandafter\expandafter\@tempa% \expandafter\expandafter\expandafter{% @@ -1395,18 +1398,18 @@ \expandafter\expandafter\expandafter\def% \expandafter\expandafter\expandafter\@tempa% \expandafter\expandafter\expandafter{% - \expandafter\@tempc\@tempa}% + \expandafter\@tempd\@tempa}% \expandafter\expandafter\expandafter\def% \expandafter\expandafter\expandafter\@tempb% \expandafter\expandafter\expandafter{% - \expandafter\@tempc\@tempb}% + \expandafter\@tempd\@tempb}% \fi% \toksdef\@toksa=0% \@toksa={% - \expandafter\def\csname\@other @#2@name#5\endcsname}% + \expandafter\def\csname\@tempc @#2@name#5\endcsname}% \expandafter\the\expandafter\@toksa\expandafter{\@tempa}% \@toksa={% - \expandafter\def\csname\@other @#2@name@plural#5\endcsname}% + \expandafter\def\csname\@tempc @#2@name@plural#5\endcsname}% \expandafter\the\expandafter\@toksa\expandafter{\@tempb}% }{}% \cref@stack@add{#2}{\cref@label@types}} @@ -1808,19 +1811,7 @@ \def\@crefformat#1#2#3{% \begingroup% \expandafter\gdef\csname #1@#2@format\endcsname##1##2##3{#3}% - \def\@tempa##1##2\@nil{% - \if##1c% - \def\@other{C##2}% - \def\@changecase{\expandafter\MakeUppercase}% - \else% - \def\@other{c##2}% - \if@cref@capitalise% - \def\@changecase{}% - \else% - \def\@changecase{\MakeLowercase}% - \fi% - \fi}% - \@tempa#1\@nil% + \cref@othervariant{#1}{\@other}{\@changecase}% \@ifundefined{\@other @#2@format}{% \toksdef\@toksa=0% \@toksa={\def\@tempa##1##2##3}% @@ -1842,19 +1833,7 @@ \begingroup% \expandafter\gdef\csname #1@#2@format\endcsname% ##1##2##3##4##5##6{#3}% - \def\@tempa##1##2\@nil{% - \if##1c% - \def\@other{C##2}% - \def\@changecase{\expandafter\MakeUppercase}% - \else% - \def\@other{c##2}% - \if@cref@capitalise% - \def\@changecase{}% - \else% - \def\@changecase{\MakeLowercase}% - \fi% - \fi}% - \@tempa#1\@nil% + \cref@othervariant{#1}{\@other}{\@changecase}% \@ifundefined{\@other @#2@format}{% \toksdef\@toksa=0% \@toksa={\def\@tempa##1##2##3##4##5##6}% @@ -1878,19 +1857,7 @@ \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\@tempa##1##2\@nil{% - \if##1c% - \def\@other{C##2}% - \def\@changecase{\expandafter\MakeUppercase}% - \else% - \def\@other{c##2}% - \if@cref@capitalise% - \def\@changecase{}% - \else% - \def\@changecase{\MakeLowercase}% - \fi% - \fi}% - \@tempa#1\@nil% + \cref@othervariant{#1}{\@other}{\@changecase}% \@ifundefined{\@other @#2@format@first}{% \toksdef\@toksa=0% \@toksa={\def\@tempa##1##2##3}% @@ -1940,19 +1907,7 @@ ##1##2##3##4##5##6{#5}% \expandafter\gdef\csname #1@#2@format@last\endcsname% ##1##2##3##4##5##6{#6}% - \def\@tempa##1##2\@nil{% - \if##1c% - \def\@other{C##2}% - \def\@changecase{\expandafter\MakeUppercase}% - \else% - \def\@other{c##2}% - \if@cref@capitalise% - \def\@changecase{}% - \else% - \def\@changecase{\MakeLowercase}% - \fi% - \fi}% - \@tempa#1\@nil% + \cref@othervariant{#1}{\@other}{\@changecase}% \@ifundefined{\@other @#2@format@first}{% \toksdef\@toksa=0% \@toksa={\def\@tempa##1##2##3##4##5##6}% @@ -2016,82 +1971,37 @@ \protected@xdef\cref@currentlabel{% \expandafter\cref@override@label@type% \cref@currentlabel\@nil{#1}}} - \renewcommand\appendix{% - \cref@old@appendix% - \@ifundefined{chapter}{% - \def\H@refstepcounter##1{% - \cref@old@H@refstepcounter{##1}% - \cref@constructprefix{##1}{\cref@result}% - \ifx\cref@result\@empty% - \def\cref@result{2147483647}% - \else% - \edef\cref@result{2147483647,\cref@result}% - \fi% - \def\@tempa{##1}% - \def\@tempb{section}% - \ifx\@tempa\@tempb% - \protected@xdef\cref@currentlabel{% - [appendix][\arabic{##1}][\cref@result]% - \csname p@##1\endcsname\csname the##1\endcsname}% - \else% - \def\@tempa{##1}% - \def\@tempb{subsection}% - \ifx\@tempa\@tempb% - \protected@xdef\cref@currentlabel{% - [subappendix][\arabic{##1}][\cref@result]% - \csname p@##1\endcsname\csname the##1\endcsname}% + \@ifundefined{appendix}{}{% + \renewcommand\appendix{% + \cref@old@appendix% + \@ifundefined{chapter}{% + \def\H@refstepcounter##1{% + \cref@old@H@refstepcounter{##1}% + \cref@constructprefix{##1}{\cref@result}% + \ifx\cref@result\@empty% + \def\cref@result{2147483647}% \else% - \def\@tempa{##1}% - \def\@tempb{subsubsection}% - \ifx\@tempa\@tempb% - \protected@xdef\cref@currentlabel{% - [subsubappendix][\arabic{##1}][\cref@result]% - \csname p@##1\endcsname\csname the##1\endcsname}% - \else% - \@ifundefined{cref@##1@alias}% - {\def\@tempa{##1}}% - {\def\@tempa{\csname cref@##1@alias\endcsname}}% - \protected@xdef\cref@currentlabel{% - [\@tempa][\arabic{##1}][\cref@result]% - \csname p@##1\endcsname\csname the##1\endcsname} - \fi% + \edef\cref@result{2147483647,\cref@result}% \fi% - \fi}% - }{% - \def\H@refstepcounter##1{% - \cref@old@H@refstepcounter{##1}% - \cref@constructprefix{##1}{\cref@result}% - \ifx\cref@result\@empty% - \def\cref@result{2147483647}% - \else% - \edef\cref@result{2147483647,\cref@result}% - \fi% - \def\@tempa{##1}% - \def\@tempb{chapter}% - \ifx\@tempa\@tempb% - \protected@xdef\cref@currentlabel{% - [appendix][\arabic{##1}][\cref@result]% - \csname p@##1\endcsname\csname the##1\endcsname}% - \else% \def\@tempa{##1}% \def\@tempb{section}% \ifx\@tempa\@tempb% \protected@xdef\cref@currentlabel{% - [subappendix][\arabic{##1}][\cref@result]% + [appendix][\arabic{##1}][\cref@result]% \csname p@##1\endcsname\csname the##1\endcsname}% \else% \def\@tempa{##1}% \def\@tempb{subsection}% \ifx\@tempa\@tempb% \protected@xdef\cref@currentlabel{% - [subsubappendix][\arabic{##1}][\cref@result]% + [subappendix][\arabic{##1}][\cref@result]% \csname p@##1\endcsname\csname the##1\endcsname}% \else% \def\@tempa{##1}% \def\@tempb{subsubsection}% \ifx\@tempa\@tempb% \protected@xdef\cref@currentlabel{% - [subsubsubappendix][\arabic{##1}][\cref@result]% + [subsubappendix][\arabic{##1}][\cref@result]% \csname p@##1\endcsname\csname the##1\endcsname}% \else% \@ifundefined{cref@##1@alias}% @@ -2102,10 +2012,57 @@ \csname p@##1\endcsname\csname the##1\endcsname} \fi% \fi% + \fi}% + }{% + \def\H@refstepcounter##1{% + \cref@old@H@refstepcounter{##1}% + \cref@constructprefix{##1}{\cref@result}% + \ifx\cref@result\@empty% + \def\cref@result{2147483647}% + \else% + \edef\cref@result{2147483647,\cref@result}% \fi% - \fi}% + \def\@tempa{##1}% + \def\@tempb{chapter}% + \ifx\@tempa\@tempb% + \protected@xdef\cref@currentlabel{% + [appendix][\arabic{##1}][\cref@result]% + \csname p@##1\endcsname\csname the##1\endcsname}% + \else% + \def\@tempa{##1}% + \def\@tempb{section}% + \ifx\@tempa\@tempb% + \protected@xdef\cref@currentlabel{% + [subappendix][\arabic{##1}][\cref@result]% + \csname p@##1\endcsname\csname the##1\endcsname}% + \else% + \def\@tempa{##1}% + \def\@tempb{subsection}% + \ifx\@tempa\@tempb% + \protected@xdef\cref@currentlabel{% + [subsubappendix][\arabic{##1}][\cref@result]% + \csname p@##1\endcsname\csname the##1\endcsname}% + \else% + \def\@tempa{##1}% + \def\@tempb{subsubsection}% + \ifx\@tempa\@tempb% + \protected@xdef\cref@currentlabel{% + [subsubsubappendix][\arabic{##1}][\cref@result]% + \csname p@##1\endcsname\csname the##1\endcsname}% + \else% + \@ifundefined{cref@##1@alias}% + {\def\@tempa{##1}}% + {\def\@tempa{\csname cref@##1@alias\endcsname}}% + \protected@xdef\cref@currentlabel{% + [\@tempa][\arabic{##1}][\cref@result]% + \csname p@##1\endcsname\csname the##1\endcsname} + \fi% + \fi% + \fi% + \fi}% + }% }% - } + }% end of \@ifundefined{appendix} \DeclareRobustCommand{\cref}{% \@ifstar{\@crefstar{cref}}{\@crefnostar{cref}}} \DeclareRobustCommand{\Cref}{% @@ -2537,6 +2494,14 @@ \edef\@currentlabel{\the\toks@}% \edef\cref@currentlabel{[equation][2147483647][]\the\toks@}}} }{}% end of \@ifpackageloaded{amsmath} +\@ifpackageloaded{IEEEtrantools}{% + \PackageInfo{cleveref}{`IEEEtrantools' support loaded} + \let\cref@orig@@IEEEeqnarray\@@IEEEeqnarray + \def\@@IEEEeqnarray[#1]#2{% + \refstepcounter{equation}% + \addtocounter{equation}{-1}% + \cref@orig@@IEEEeqnarray[#1]{#2}} +}{}% end of \@ifpackageloaded{IEEEtrantools} \@ifpackageloaded{amsthm}{% \PackageInfo{cleveref}{`amsthm' support loaded} \let\cref@thmnoarg\@thm @@ -3421,7 +3386,7 @@ \let\old@@setnamecref\@@setnamecref \def\@@setnamecref#1#2{% \old@@setnamecref{#1}{#2}% - \edef\@tempa{#1}% + \expandafter\def\expandafter\@tempa\expandafter{#1}% \def\@tempb{#2}% \expandafter\expandafter\expandafter\g@addto@macro% \expandafter\expandafter\expandafter{% -- cgit v1.2.3