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/doc/latex/cleveref/README | 2 +- Master/texmf-dist/doc/latex/cleveref/cleveref.pdf | Bin 364803 -> 365626 bytes .../texmf-dist/source/latex/cleveref/cleveref.dtx | 433 ++++++++++----------- Master/texmf-dist/tex/latex/cleveref/cleveref.sty | 355 ++++++++--------- 4 files changed, 365 insertions(+), 425 deletions(-) diff --git a/Master/texmf-dist/doc/latex/cleveref/README b/Master/texmf-dist/doc/latex/cleveref/README index 191208be2d6..1ff188e7e5c 100644 --- a/Master/texmf-dist/doc/latex/cleveref/README +++ b/Master/texmf-dist/doc/latex/cleveref/README @@ -1,5 +1,5 @@ cleveref, a LaTeX package for intelligent cross-referencing -Copyright (C) 2007--2010 Toby Cubitt +Copyright (C) 2007--2012 Toby Cubitt Files: cleveref.ins Batch file, run through LaTeX diff --git a/Master/texmf-dist/doc/latex/cleveref/cleveref.pdf b/Master/texmf-dist/doc/latex/cleveref/cleveref.pdf index 4219c90b95e..3e922e456a6 100644 Binary files a/Master/texmf-dist/doc/latex/cleveref/cleveref.pdf and b/Master/texmf-dist/doc/latex/cleveref/cleveref.pdf differ diff --git a/Master/texmf-dist/source/latex/cleveref/cleveref.dtx b/Master/texmf-dist/source/latex/cleveref/cleveref.dtx index f977a23fd89..24201299088 100644 --- a/Master/texmf-dist/source/latex/cleveref/cleveref.dtx +++ b/Master/texmf-dist/source/latex/cleveref/cleveref.dtx @@ -1,5 +1,5 @@ -\def\packagedate{2011/12/24} -\def\packageversion{0.18.1} +\def\packagedate{2012/01/17} +\def\packageversion{0.18.2} % \iffalse meta-comment % % Package 'cleveref' to use with LaTeX2e @@ -56,7 +56,7 @@ % % \fi % -% \CheckSum{18240} +% \CheckSum{18176} %% \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 @@ -253,6 +253,12 @@ % \textbackslash{}label.} % \changes{v0.18.1}{2011/12/24}{Fixed compatibility with newer versions % of \package{caption} package.} +% \changes{v0.18.2}{2012/01/17}{Don't try to redefine +% \textbackslash{}appendix if it's not defined in current document +% class. Fixed bug in \textbackslash{}\@setnamecref. Refactored common +% code in format-definition macros into separate +% \textbackslash{}\cref@othervariant macro. Added +% \package{IEEEtrantools} support.} % % \GetFileInfo{cleveref.sty} % @@ -2005,112 +2011,114 @@ % ``section'' is the top-level sectioning command, and one if % ``chapter'' fulfils that role. % \begin{macrocode} -\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}% +\@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}% % \end{macrocode} % We add a large value to the front of the counter data, to force % references to anything in appendices to be sorted after everything % else. % \begin{macrocode} - \ifx\cref@result\@empty% - \def\cref@result{2147483647}% - \else% - \edef\cref@result{2147483647,\cref@result}% - \fi% + \ifx\cref@result\@empty% + \def\cref@result{2147483647}% + \else% + \edef\cref@result{2147483647,\cref@result}% + \fi% % \end{macrocode} % Override the cross-reference type of sectioning commands. % \begin{macrocode} - \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}% + \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{subsubsection}% + \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% - \@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} + \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% \fi% - \fi% - \fi}% - }{% - \def\refstepcounter@noarg##1{% - \cref@old@refstepcounter{##1}% - \cref@constructprefix{##1}{\cref@result}% + \fi}% + }{% + \def\refstepcounter@noarg##1{% + \cref@old@refstepcounter{##1}% + \cref@constructprefix{##1}{\cref@result}% % \end{macrocode} % Again, the large value added to the front of the counter data forces % references to appendix items to be sorted last. % \begin{macrocode} - \ifx\cref@result\@empty% - \def\cref@result{2147483647}% - \else% - \edef\cref@result{2147483647,\cref@result}% - \fi% + \ifx\cref@result\@empty% + \def\cref@result{2147483647}% + \else% + \edef\cref@result{2147483647,\cref@result}% + \fi% % \end{macrocode} % Override the cross-reference type of sectioning commands. % \begin{macrocode} - \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}% + \def\@tempb{chapter}% \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}% + \def\@tempb{section}% \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}% + \def\@tempb{subsection}% \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}% - {\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} + \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% - \fi}% + \fi}% + }% }% -} +}% end of \@ifundefined{appendix} % \end{macrocode} % \end{macro} % \end{macro} @@ -3592,7 +3600,7 @@ % \cmd{\namecref} commands. % \begin{macrocode} \def\@@setnamecref#1#2{% - \edef\@tempa{#1}% + \expandafter\def\expandafter\@tempa\expandafter{#1}% \expandafter#2\@tempa} % \end{macrocode} % \end{macro} @@ -3986,6 +3994,32 @@ % \end{macro} % \end{macro} % +% +% \begin{macro}{cref@othervariant} +% The following utility macro sets up the appropriate definitions for +% the other capitalisation variant. It defines the macro passed in |#2| +% to be the other variant (``cref'' or ``Cref'') to the one specified +% in |#1|, and defines |#3| to be the appropriate +% capitalisation-changing command. It makes use of the fact that the +% first character of \#1 is ``c'' for the lower-case variant and ``C'' +% for the upper-case one. +% \begin{macrocode} +\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} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@crefname} % The \cmd{\@crefname} utility macro does the real work of defining % format names, by defining an appropriately named command to contain @@ -4001,28 +4035,10 @@ \expandafter\def\csname #1@#2@name#5\endcsname{#3}% \expandafter\def\csname #1@#2@name@plural#5\endcsname{#4}% % \end{macrocode} -% The following \cmd{\@tempa} macro makes use of the fact that the first -% character of \#1 is ``c'' for lower-case and ``C'' for upper-case, in -% order to wrap the capitalisation-dependent parts in macros so that the -% rest of the code can be capitalisation-variant agnostic. -% \begin{macrocode} - \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% -% \end{macrocode} % If the other capitalisation variant is not already defined\dots % \begin{macrocode} - \@ifundefined{\@other @#2@name#5}{% + \cref@othervariant{#1}{\@tempc}{\@tempd}% + \@ifundefined{\@tempc @#2@name#5}{% % \end{macrocode} % Define \cmd{\@tempa} and \cmd{@tmpb} to be partial expansions (expanded % just once) of the macros for the capitalisation variant we've just @@ -4037,18 +4053,18 @@ \expandafter\expandafter\expandafter{% \csname#1@#2@name@plural\endcsname}% % \end{macrocode} -% Add the case-change command stored in \cmd{\@tempc} to the front of the +% Add the case-change command stored in \cmd{\@tempd} to the front of the % definitions of \cmd{\@tempa} and \cmd{\@tempb}. % \begin{macrocode} \expandafter\ifx\@tempa\@empty\else% \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% % \end{macrocode} % Define the other capitalisation variants to be the partial expansions @@ -4057,10 +4073,10 @@ % \begin{macrocode} \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}% }{}% % \end{macrocode} @@ -4708,27 +4724,9 @@ \begingroup% \expandafter\gdef\csname #1@#2@format\endcsname##1##2##3{#3}% % \end{macrocode} -% The following \cmd{\@tempa} macro makes use of the fact that the first -% character of \#1 is ``c'' for lower-case and ``C'' for upper-case, in -% order to wrap the capitalisation-dependent parts in macros so that the -% rest of the code can be capitalisation-variant agnostic. -% \begin{macrocode} - \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% -% \end{macrocode} % If the other capitalisation variant is not already defined\dots % \begin{macrocode} + \cref@othervariant{#1}{\@other}{\@changecase}% \@ifundefined{\@other @#2@format}{% % \end{macrocode} % Define \cmd{\@tempa} to be a partial expansion (expanded just once) of @@ -4771,27 +4769,9 @@ \expandafter\gdef\csname #1@#2@format\endcsname% ##1##2##3##4##5##6{#3}% % \end{macrocode} -% The following \cmd{\@tempa} macro makes use of the fact that the first -% character of \#1 is ``c'' for lower-case and ``C'' for upper-case, in -% order to wrap the capitalisation-dependent parts in macros so that the -% rest of the code can be capitalisation-variant agnostic. -% \begin{macrocode} - \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% -% \end{macrocode} % If the other capitalisation variant is not already defined\dots % \begin{macrocode} + \cref@othervariant{#1}{\@other}{\@changecase}% \@ifundefined{\@other @#2@format}{% % \end{macrocode} % Define \cmd{\@tempa} to be a partial expansion (expanded just once) of @@ -4835,28 +4815,10 @@ \expandafter\gdef\csname #1@#2@format@middle\endcsname##1##2##3{#5}% \expandafter\gdef\csname #1@#2@format@last\endcsname##1##2##3{#6}% % \end{macrocode} -% The following \cmd{\@tempa} macro makes use of the fact that the first -% character of \#1 is ``c'' for lower-case and ``C'' for upper-case, in -% order to wrap the capitalisation-dependent parts in macros so that the -% rest of the code can be capitalisation-variant agnostic. -% \begin{macrocode} - \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% -% \end{macrocode} % If the other capitalisation variant of the first part of the % multi-format definition is not already defined\dots % \begin{macrocode} + \cref@othervariant{#1}{\@other}{\@changecase}% \@ifundefined{\@other @#2@format@first}{% % \end{macrocode} % Define \cmd{\@tempa} to be a partial expansion (expanded just once) of @@ -4931,28 +4893,10 @@ \expandafter\gdef\csname #1@#2@format@last\endcsname% ##1##2##3##4##5##6{#6}% % \end{macrocode} -% The following \cmd{\@tempa} macro makes use of the fact that the first -% character of \#1 is ``c'' for lower-case and ``C'' for upper-case, in -% order to wrap the capitalisation-dependent parts in macros so that the -% rest of the code can be capitalisation-variant agnostic. -% \begin{macrocode} - \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% -% \end{macrocode} % If the other capitalisation variant of the first part of the % multi-format definition is not already defined\dots % \begin{macrocode} + \cref@othervariant{#1}{\@other}{\@changecase}% \@ifundefined{\@other @#2@format@first}{% % \end{macrocode} % Define \cmd{\@tempa} to be a partial expansion (expanded just once) of @@ -5098,111 +5042,113 @@ % ``appendix'' instead. But this time, it is \cmd{\H@refstepcounter} % that needs to be redefined. % \begin{macrocode} - \renewcommand\appendix{% - \cref@old@appendix% - \@ifundefined{chapter}{% - \def\H@refstepcounter##1{% - \cref@old@H@refstepcounter{##1}% - \cref@constructprefix{##1}{\cref@result}% + \@ifundefined{appendix}{}{% + \renewcommand\appendix{% + \cref@old@appendix% + \@ifundefined{chapter}{% + \def\H@refstepcounter##1{% + \cref@old@H@refstepcounter{##1}% + \cref@constructprefix{##1}{\cref@result}% % \end{macrocode} % We add a large value to the front of the counter data, to force % references to anything in appendices to be sorted after % everything else. % \begin{macrocode} - \ifx\cref@result\@empty% - \def\cref@result{2147483647}% - \else% - \edef\cref@result{2147483647,\cref@result}% - \fi% + \ifx\cref@result\@empty% + \def\cref@result{2147483647}% + \else% + \edef\cref@result{2147483647,\cref@result}% + \fi% % \end{macrocode} % Override the cross-reference type of sectioning commands. % \begin{macrocode} - \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}% + \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{subsubsection}% + \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% - \@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} + \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% \fi% - \fi% - \fi}% - }{% - \def\H@refstepcounter##1{% - \cref@old@H@refstepcounter{##1}% - \cref@constructprefix{##1}{\cref@result}% + \fi}% + }{% + \def\H@refstepcounter##1{% + \cref@old@H@refstepcounter{##1}% + \cref@constructprefix{##1}{\cref@result}% % \end{macrocode} % Again, the large value added to the front of the counter data % forces references to appendix items to be sorted last. % \begin{macrocode} - \ifx\cref@result\@empty% - \def\cref@result{2147483647}% - \else% - \edef\cref@result{2147483647,\cref@result}% - \fi% + \ifx\cref@result\@empty% + \def\cref@result{2147483647}% + \else% + \edef\cref@result{2147483647,\cref@result}% + \fi% % \end{macrocode} % Override the cross-reference type of sectioning commands. % \begin{macrocode} - \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}% + \def\@tempb{chapter}% \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}% + \def\@tempb{section}% \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}% + \def\@tempb{subsection}% \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}% - {\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} + \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% - \fi}% + \fi}% + }% }% - } + }% end of \@ifundefined{appendix} % \end{macrocode} % \end{macro} % @@ -5812,6 +5758,35 @@ % % % +% \subsubsection{\package{IEEEtrantools} support} +% \begin{macro}{IEEEtrantools} +% The \cmd{IEEEeqnarray} environment calls \cmd{\stepcounter} instead +% of \cmd{\refstepcounter} to increment the |equation| counter, so it +% fails to set the cross-reference type for \package{cleveref}. +% \begin{macrocode} +\@ifpackageloaded{IEEEtrantools}{% + \PackageInfo{cleveref}{`IEEEtrantools' support loaded} +% \end{macrocode} +% +% \begin{macro}{\@@IEEEeqnarray} +% Rather than copying the whole of \cmd{\@@IEEEeqnarray} just to patch +% one line (which would be liable to breakage), we insert an extra step +% which calls \cmd{\refstepcounter} to set the cross-reference type, +% then decrements the |equation| counter by one, before calling the +% original \cmd{\@@IEEEeqnarray}. +% \begin{macrocode} + \let\cref@orig@@IEEEeqnarray\@@IEEEeqnarray + \def\@@IEEEeqnarray[#1]#2{% + \refstepcounter{equation}% + \addtocounter{equation}{-1}% + \cref@orig@@IEEEeqnarray[#1]{#2}} +}{}% end of \@ifpackageloaded{IEEEtrantools} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% % \subsubsection{\package{amsthm} support} % \begin{macro}{amsthm} % If \package{amsthm} is loaded, we need to modify its theorem @@ -7547,7 +7522,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{% 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