diff options
author | Karl Berry <karl@freefriends.org> | 2007-05-31 18:42:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-05-31 18:42:38 +0000 |
commit | e94cc72c57a660f941e255ce8b3854ab00f7c76a (patch) | |
tree | 800fdb5011b46ebc23353d7ce8b37742321c5f4e /Master/texmf-dist/tex/latex | |
parent | 822465c48676ab7654b95171c629204275225d2f (diff) |
new latex package cleveref (26may07)
git-svn-id: svn://tug.org/texlive/trunk@4386 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/cleveref/cleveref.sty | 686 |
1 files changed, 686 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/cleveref/cleveref.sty b/Master/texmf-dist/tex/latex/cleveref/cleveref.sty new file mode 100644 index 00000000000..ef883a856a0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/cleveref/cleveref.sty @@ -0,0 +1,686 @@ +%% +%% This is file `cleveref.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% cleveref.dtx (with options: `package') +%% +%% LaTeX package for automatic cross-referencing text. +%% +%% Copyright (C) 2006 Toby Cubitt +%% See the files README and COPYING. +%% +%% 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. +%% The latest version of this license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{cleveref} + [2007/26/04 v0.4 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 +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +\let\old@refstepcounter\refstepcounter +\def\refstepcounter% + {\@ifnextchar[{\refstepcounter@optarg}{\refstepcounter@noarg}}%] +\def\refstepcounter@noarg#1{% + \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}% + \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@label#1#2{\@result} +\AtBeginDocument{% + \def\ref#1{% + \expandafter\ifx\csname r@#1\endcsname\relax% + \let\@result\relax% + \else% + \cref@getlabel{#1}{\@result}% + \fi% + \expandafter\@setref\csname r@#1\endcsname{\cref@label}{#1}}% +} +\def\cref@getlabel#1#2{% + \expandafter\let\expandafter\@tempa\csname r@#1\endcsname% + \edef\@tempa{\expandafter\@firstoftwo\@tempa}% + \expandafter\@cref@getlabel\@tempa\@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} +\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} +\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} +\def\@cref@getprefix{\@ifnextchar[%] + \@@cref@getprefix{\@@cref@getprefix[][][]}} +\def\@@cref@getprefix[#1][#2][#3]#4\@nil#5{\def#5{#3}} +\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{% + \expandafter\ifx#1\@nil\stackemptytrue% + \else\stackemptyfalse\fi} +\def\isstackfull#1{% + \expandafter\ifx#1\@nil\stackfullfalse% + \else\stackfulltrue\fi} +\newif\ifinresetlist +\def\isinresetlist#1#2{% + \def\@counter{#1}% + \begingroup% + \def\@elt##1{##1,}% + \expandafter\ifx\csname cl@#2\endcsname\relax% + \gdef\@resetstack{,\@nil}% + \else% + \xdef\@resetstack{\csname cl@#2\endcsname\noexpand\@nil}% + \fi% + \endgroup% + \isstackfull{\@resetstack}% + \@whilesw\ifstackfull\fi{% + \edef\@nextcounter{\stack@top{\@resetstack}}% + \ifx\@nextcounter\@counter% + \stackfullfalse% + \else% + \let\@nextcounter\relax% + \stack@pop{\@resetstack}% + \isstackfull{\@resetstack}% + \fi}% + \ifx\@nextcounter\relax% + \inresetlistfalse% + \else% + \inresetlisttrue% + \fi} +\def\reset@by#1#2{% + \isinresetlist{#1}{subsubsubsection}% + \ifinresetlist% + \def#2{subsubsubsection}% + \else% + \isinresetlist{#1}{subsubsection}% + \ifinresetlist% + \def#2{subsubsection}% + \else% + \isinresetlist{#1}{subsection}% + \ifinresetlist% + \def#2{subsection}% + \else% + \isinresetlist{#1}{section}% + \ifinresetlist% + \def#2{section}% + \else% + \isinresetlist{#1}{chapter}% + \ifinresetlist% + \def#2{chapter}% + \else% + \isinresetlist{#1}{part}% + \ifinresetlist% + \def#2{part}% + \else% + \let#2\relax% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi} +\newcommand{\cref}[1]{\@cref{cref}{#1}} +\newcommand{\Cref}[1]{\@cref{Cref}{#1}} +\newcommand{\crefrange}[2]{\@setcrefrange{#1}{#2}{cref}{}} +\newcommand{\Crefrange}[2]{\@setcrefrange{#1}{#2}{Cref}{}} +\def\@cref#1#2{% + \begingroup% + \countdef\count@consecutive=0% + \newif\iffirstgroup% + \stack@init{\@refstack}% + \stack@push{#2}{\@refstack}% + \firstgrouptrue% + \isstackfull{\@refstack}% + \@whilesw\ifstackfull\fi{% + \stack@init{\@refsubstack}% + \edef\@nextref{\stack@top{\@refstack}}% + \expandafter\ifx\csname r@\@nextref\endcsname\relax% + \def\@currenttype{\@undefined}% + \else% + \expandafter\cref@gettype\expandafter{\@nextref}{\@currenttype}% + \fi% + \let\@nexttype\@currenttype% + \@whilesw\ifx\@nexttype\@currenttype\fi{% + \expandafter\stack@pull\expandafter{\@nextref}{\@refsubstack}% + \stack@pop{\@refstack}% + \isstackempty{\@refstack}% + \ifstackempty% + \def\@nexttype{\relax}% + \else% + \edef\@nextref{\stack@top{\@refstack}}% + \expandafter\ifx\csname r@\@nextref\endcsname\relax% + \def\@currenttype{\@undefined}% + \else% + \expandafter\cref@gettype\expandafter{\@nextref}{\@currenttype}% + \fi% + \fi}% + \iffirstgroup% + \else% + \isstackfull{\@refstack}% + \ifstackfull% + \crefmiddleconjunction% + \else% + \creflastconjunction% + \fi% + \fi% + \firstgroupfalse% + \edef\@nextref{\stack@top{\@refsubstack}}% + \stack@pop{\@refsubstack}% + \isstackempty{\@refsubstack}% + \ifstackempty% + \expandafter\@setcref\expandafter{\@nextref}{#1}{}% + \else% + \edef\@beginref{\@nextref}% + \let\@endref\relax% + \edef\@nextref{\stack@top{\@refsubstack}}% + \count@consecutive=1% + \expandafter\ifx\csname r@\@beginref\endcsname\relax% + \refconsecutivefalse% + \else% + \expandafter\ifx\csname r@\@nextref\endcsname\relax% + \refconsecutivefalse% + \else% + \edef\@tmpa{{\@beginref}{\@nextref}}% + \expandafter\isrefconsecutive\@tmpa% + \fi% + \fi% + \@whilesw\ifrefconsecutive\fi{% + \advance\count@consecutive 1% + \let\@endref\@nextref% + \stack@pop{\@refsubstack}% + \isstackempty{\@refsubstack}% + \ifstackempty% + \refconsecutivefalse% + \else% + \edef\@nextref{\stack@top{\@refsubstack}}% + \expandafter\ifx\csname r@\@nextref\endcsname\relax% + \refconsecutivefalse% + \else% + \edef\@tmpa{{\@endref}{\@nextref}}% + \expandafter\isrefconsecutive\@tmpa% + \fi% + \fi}% + \ifx\@endref\relax% + \expandafter\@setcref\expandafter{\@beginref}{#1}{@first}% + \else% + \ifnum\count@consecutive=2% + \expandafter\@setcref\expandafter{\@beginref}{#1}{@first}% + \expandafter\stack@push\expandafter{\@endref}{\@refsubstack}% + \else + \edef\@tmpa{{\@beginref}{\@endref}}% + \ifstackempty% + \expandafter\@setcrefrange\@tmpa{#1}{}% + \else% + \expandafter\@setcrefrange\@tmpa{#1}{@first}% + \fi% + \fi% + \fi% + \isstackfull{\@refsubstack}% + \@whilesw\ifstackfull\fi{% + \edef\@beginref{\stack@top{\@refsubstack}}% + \stack@pop{\@refsubstack}% + \let\@endref\relax% + \isstackempty{\@refsubstack}% + \ifstackempty% + \expandafter\@setcref\expandafter{\@beginref}{#1}{@last}% + \else% + \edef\@nextref{\stack@top{\@refsubstack}}% + \count@consecutive=1% + \expandafter\ifx\csname r@\@nextref\endcsname\relax% + \refconsecutivefalse% + \else% + \edef\@tmpa{{\@beginref}{\@nextref}}% + \expandafter\isrefconsecutive\@tmpa% + \fi% + \@whilesw\ifrefconsecutive\fi{% + \advance\count@consecutive 1% + \let\@endref\@nextref% + \stack@pop{\@refsubstack}% + \isstackempty{\@refsubstack}% + \ifstackempty% + \refconsecutivefalse% + \else% + \edef\@nextref{\stack@top{\@refsubstack}}% + \expandafter\ifx\csname r@\@nextref\endcsname\relax% + \refconsecutivefalse% + \else% + \edef\@tmpa{{\@endref}{\@nextref}}% + \expandafter\isrefconsecutive\@tmpa% + \fi% + \fi}% + \isstackempty{\@refsubstack}% + \ifstackempty% + \def\@pos{@last}% + \else% + \def\@pos{@middle}% + \fi% + \ifx\@endref\relax% + \edef\@tmpa{{\@beginref}{#1}{\@pos}}% + \expandafter\@setcref\@tmpa% + \else% + \ifnum\count@consecutive=2% + \edef\@tmpa{{\@beginref}{#1}{\@pos}}% + \expandafter\@setcref\@tmpa% + \else + \edef\@tmpa{{\@beginref}{\@endref}{#1}{\@pos}}% + \expandafter\@setcrefrange\@tmpa% + \fi% + \fi% + \fi% + \isstackfull{\@refsubstack}% + }% + \fi% + \isstackfull{\@refstack}% + }% + \endgroup} +\def\@setcref#1#2#3{% + \expandafter\ifx\csname r@#1\endcsname\relax% + \protect\G@refundefinedtrue% + \nfss@text{\reset@font\bfseries ??}% + \@latex@warning{Reference `#1' on page \thepage \space undefined}% + \else% + \cref@gettype{#1}{\@temptype}% puts label type in \@temptype + \cref@getlabel{#1}{\@templabel}% puts label in \@templabel + \expandafter\ifx\csname #2@\@temptype @format#3\endcsname\relax% + \protect\G@refundefinedtrue% + \nfss@text{\reset@font\bfseries ??}~\@templabel% + \@latex@warning{\string\Cref \space reference format for label + type `\@temptype' undefined}% + \else% + \expandafter\@@setcref\expandafter% + {\csname #2@\@temptype @format#3\endcsname}{#1}% + \fi% + \fi} +\def\@@setcref#1#2{\cref@getlabel{#2}{\@templabel}#1{\@templabel}{}{}} +\newif\ifrefconsecutive% +\def\isrefconsecutive#1#2{% + \begingroup% + \countdef\refa@counter=1% + \countdef\refb@counter=2% + \cref@getcounter{#1}{\@result}% + \refa@counter=\@result% + \advance\refa@counter 1% + \cref@getcounter{#2}{\@result}% + \refb@counter=\@result% + \cref@getprefix{#1}{\refa@prefix}% + \cref@getprefix{#2}{\refb@prefix}% + \def\@after{\refconsecutivefalse}% + \ifx\refa@prefix\refb@prefix% + \ifnum\refa@counter=\refb@counter% + \def\@after{\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% + \protect\G@refundefinedtrue% + \cref@getlabel{#1}{\@labela}% + \@labela--\nfss@text{\reset@font\bfseries ??}% + \@latex@warning{Reference `#2' on page \thepage \space undefined}% + \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{#3 \space reference format for label + type `\@typea' undefined}% + \else% + \ifx\formata\formatb% + \@@setcrefrange{\@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} +\def\@@setcrefrange#1#2#3{% + \cref@getlabel{#2}{\@labela}% + \cref@getlabel{#3}{\@labelb}% + #1{\@labela}{\@labelb}{}{}{}{}} +\newcommand{\crefformat}[2]{\@crefformat{cref}{#1}{#2}} +\newcommand{\Crefformat}[2]{\@crefformat{Cref}{#1}{#2}} +\newcommand{\crefrangeformat}[2]{\@crefrangeformat{crefrange}{#1}{#2}} +\newcommand{\Crefrangeformat}[2]{\@crefrangeformat{Crefrange}{#1}{#2}} +\newcommand{\crefmultiformat}[4]{% + \@crefmultiformat{cref}{#1}{#2}{#3}{#4}} +\newcommand{\Crefmultiformat}[4]{% + \@crefmultiformat{Cref}{#1}{#2}{#3}{#4}} +\newcommand{\crefrangemultiformat}[4]{% + \@crefrangemultiformat{crefrange}{#1}{#2}{#3}{#4}} +\newcommand{\Crefrangemultiformat}[4]{% + \@crefrangemultiformat{Crefrange}{#1}{#2}{#3}{#4}} +\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}% + \else\def\@other{c##2}\fi}% + \@tmpa#1\@nil% + \def\@tmpa##1##2\@nil{% + \if##1c\def\@changecase{\MakeUppercase}% + \else\def\@changecase{\MakeLowercase}\fi}% + \@tmpa#1\@nil% + \@ifundefined{\@other @#2@format}{% + \expandafter\edef\csname\@other @#2@format\endcsname##1##2##3{% + \expandafter\noexpand\@changecase\csname #1@#2@format\endcsname% + {##1}{##2}{##3}}}{}} +\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}% + \else\def\@other{c##2}\fi}% + \@tmpa#1\@nil% + \def\@tmpa##1##2\@nil{% + \if##1c\def\@changecase{\MakeUppercase}% + \else\def\@changecase{\MakeLowercase}\fi}% + \@tmpa#1\@nil% + \@ifundefined{\@other @#2@format}{% + \expandafter\edef% + \csname\@other @#2@format\endcsname##1##2##3##4##5##6{% + \expandafter\noexpand\@changecase\csname #1@#2@format\endcsname% + {##1}{##2}{##3}{##4}{##5}{##6}}}{}} +\def\@crefmultiformat#1#2#3#4#5{% + \expandafter\def\csname #1@#2@format@first\endcsname##1##2##3{#3}% + \expandafter\def\csname #1@#2@format@middle\endcsname##1##2##3{#4}% + \expandafter\def\csname #1@#2@format@last\endcsname##1##2##3{#5}% + \def\@tmpa##1##2\@nil{% + \if##1c \def\@other{C##2}% + \else\def\@other{c##2}\fi}% + \@tmpa#1\@nil% + \def\@tmpa##1##2\@nil{% + \if##1c\def\@changecase{\MakeUppercase}% + \else\def\@changecase{\MakeLowercase}\fi}% + \@tmpa#1\@nil% + \@ifundefined{\@other @#2@format@first}{% + \expandafter\edef% + \csname\@other @#2@format@first\endcsname##1##2##3{% + \expandafter\noexpand\@changecase% + \csname #1@#2@format@first\endcsname% + {##1}{##2}{##3}}}{}% + \@ifundefined{\@other @#2@format@middle}{% + \expandafter\edef% + \csname\@other @#2@format@middle\endcsname##1##2##3{% + \csname #1@#2@format@middle\endcsname{##1}{##2}{##3}}}{}% + \@ifundefined{\@other @#2@format@last}{% + \expandafter\edef% + \csname\@other @#2@format@last\endcsname##1##2##3{% + \csname #1@#2@format@last\endcsname{##1}{##2}{##3}}}{}} +\def\@crefrangemultiformat#1#2#3#4#5{% + \expandafter\def\csname #1@#2@format@first\endcsname% + ##1##2##3##4##5##6{#3}% + \expandafter\def\csname #1@#2@format@middle\endcsname% + ##1##2##3##4##5##6{#4}% + \expandafter\def\csname #1@#2@format@last\endcsname% + ##1##2##3##4##5##6{#5}% + \def\@tmpa##1##2\@nil{% + \if##1c \def\@other{C##2}% + \else\def\@other{c##2}\fi}% + \@tmpa#1\@nil% + \def\@tmpa##1##2\@nil{% + \if##1c\def\@changecase{\MakeUppercase}% + \else\def\@changecase{\MakeLowercase}\fi}% + \@tmpa#1\@nil% + \@ifundefined{\@other @#2@format@first}{% + \expandafter\edef% + \csname\@other @#2@format@first\endcsname##1##2##3##4##5##6{% + \expandafter\noexpand\@changecase% + \csname #1@#2@format@first\endcsname% + {##1}{##2}{##3}{##4}{##5}{##6}}}{}% + \@ifundefined{\@other @#2@format@middle}{% + \expandafter\edef% + \csname\@other @#2@format@middle\endcsname##1##2##3##4##5##6{% + \csname #1@#2@format@middle\endcsname% + {##1}{##2}{##3}{##4}{##5}{##6}}}{}% + \@ifundefined{\@other @#2@format@last}{% + \expandafter\edef% + \csname\@other @#2@format@last\endcsname##1##2##3##4##5##6{% + \csname #1@#2@format@last\endcsname% + {##1}{##2}{##3}{##4}{##5}{##6}}}{}} +\crefformat{equation}{eq.~#2(#1)#3} +\crefformat{chapter}{chapter~#2#1#3} +\crefformat{section}{section~#2#1#3} +\crefformat{subsection}{section~#2#1#3} +\crefformat{subsubsection}{section~#2#1#3} +\crefformat{subsubsubsection}{section~#2#1#3} +\crefformat{figure}{fig.~#2#1#3} +\crefformat{theorem}{theorem~#2#1#3} +\crefmultiformat{equation}% + {eqs.~#2(#1)#3}{, #2(#1)#3}{ and~#2(#1)#3} +\crefmultiformat{chapter}% + {chapters~#2#1#3}{, #2#1#3}{ and~#2#1#3} +\crefmultiformat{section}% + {sections~#2#1#3}{, #2#1#3}{ and~#2#1#3} +\crefmultiformat{subsection}% + {sections~#2#1#3}{, #2#1#3}{ and~#2#1#3} +\crefmultiformat{subsubsection}% + {sections~#2#1#3}{, #2#1#3}{ and~#2#1#3} +\crefmultiformat{subsubsubsection}% + {sections~#2#1#3}{, #2#1#3}{ and~#2#1#3} +\crefmultiformat{figure}% + {figs.~#2#1#3}{, #2#1#3}{ and~#2#1#3} +\crefmultiformat{theorem}% + {theorems~#2#1#3}{, #2#1#3}{ and~#2#1#3} +\crefrangeformat{equation}{eqs.~#3(#1)#4--#5(#2)#6} +\crefrangeformat{chapter}{chapters~#3#1#4--#5#2#6} +\crefrangeformat{section}{sections~#3#1#4--#5#2#6} +\crefrangeformat{subsection}{sections~#3#1#4--#5#2#6} +\crefrangeformat{subsubsection}{sections~#3#1#4--#5#2#6} +\crefrangeformat{subsubsubsection}{sections~#3#1#4--#5#2#6} +\crefrangeformat{figure}{figs.~#3#1#4--#5#2#6} +\crefrangeformat{theorem}{theorems~#3#1#4--#5#2#6} +\crefrangemultiformat{equation}% + {eqs.~#3(#1)#4--#5(#2)#6}% + {, #3(#1)#4--#5(#2)#6}% + { and~#3(#1)#4--#5(#2)#6} +\crefrangemultiformat{chapter}% + {chapters~#3#1#4--#5#2#6}% + {, #3#1#4--#5#2#6}% + { and~#3#1#4--#5#2#6} +\crefrangemultiformat{section}% + {sections~#3#1#4--#5#2#6}% + {, #3#1#4--#5#2#6}% + { and~#3#1#4--#5#2#6} +\crefrangemultiformat{subsection}% + {sections~#3#1#4--#5#2#6}% + {, #3#1#4--#5#2#6}% + { and~#3#1#4--#5#2#6} +\crefrangemultiformat{subsubsection}% + {sections~#3#1#4--#5#2#6}% + {, #3#1#4--#5#2#6}% + { and~#3#1#4--#5#2#6} +\crefrangemultiformat{subsubsubsection}% + {sections~#3#1#4--#5#2#6}% + {, #3#1#4--#5#2#6}% + { and~#3#1#4--#5#2#6} +\crefrangemultiformat{figure}% + {figs~#3#1#4--#5#2#6}% + {, #3#1#4--#5#2#6}% + { and~#3#1#4--#5#2#6} +\crefrangemultiformat{theorem}% + {theorems~#3#1#4--#5#2#6}% + {, #3#1#4--#5#2#6}% + { and~#3#1#4--#5#2#6} +\def\crefmiddleconjunction{, } +\def\creflastconjunction{, and } +\DeclareOption{hyperref}{% +\PackageInfo{cleveref}{option `hyperref' loaded} +\def\cref@label#1#2#3#4#5{\@result} +\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} +\def\cref@gettype#1#2{% + \expandafter\let\expandafter\@tempa\csname r@#1\endcsname + \edef\@tempa{\expandafter\@firstoffive\@tempa}% + \expandafter\@cref@gettype\@tempa\@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} +\def\cref@getprefix#1#2{% + \expandafter\let\expandafter\@tempa\csname r@#1\endcsname + \edef\@tempa{\expandafter\@firstoffive\@tempa}% + \expandafter\@cref@getprefix\@tempa\@nil#2} +\def\H@refstepcounter#1{% + \stepcounter{#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]% + \csname p@#1\endcsname\csname the#1\endcsname}} +\def\refstepcounter@noarg#1{\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% + \protected@edef\@currentlabel{% + [#1][\arabic{#2}][\@tempreset]\@templabel}} +\def\@@setcref#1#2{% + \cref@getlabel{#2}{\@templabel}% + \edef\@templink{\cref@hyperref{#2}}% + #1{\@templabel}{\hyper@linkstart{link}{\@templink}}{\hyper@linkend}} +\def\@@setcrefrange#1#2#3{% + \cref@getlabel{#2}{\@labela}% + \cref@getlabel{#3}{\@labelb}% + \edef\@linka{\cref@hyperref{#2}}% + \edef\@linkb{\cref@hyperref{#3}}% + #1{\@labela}{\@labelb}{\hyper@linkstart{link}{\@linka}}{\hyper@linkend}% + {\hyper@linkstart{link}{\@linkb}}{\hyper@linkend}} +} % end of hyperref option +\DeclareOption{ntheorem}{% +\PackageInfo{cleveref}{option `ntheorem' loaded} +\gdef\@thm#1#2#3{% + \if@thmmarks + \stepcounter{end\InTheoType ctr}% + \fi + \renewcommand{\InTheoType}{#1}% + \if@thmmarks + \stepcounter{curr#1ctr}% + \setcounter{end#1ctr}{0}% + \fi + \refstepcounter[#1]{#2}% <<<<< + \thm@topsepadd \theorempostskipamount + \ifvmode \advance\thm@topsepadd\partopsep\fi + \trivlist + \@topsep \theorempreskipamount + \@topsepadd \thm@topsepadd + \advance\linewidth -\theorem@indent + \advance\@totalleftmargin \theorem@indent + \parshape \@ne \@totalleftmargin \linewidth + \@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}%] + } +\crefformat{lemma}{lemma~#2#1#3} +\crefformat{corrollary}{corrollary~#2#1#3} +\crefformat{proposition}{proposition~#2#1#3} +\crefformat{definition}{definition~#2#1#3} +\crefformat{result}{result~#2#1#3} +\crefrangeformat{lemma}{lemma~#3#1#4--#5#2#6} +\crefrangeformat{corrollary}{corrollary~#3#1#4--#5#2#6} +\crefrangeformat{proposition}{proposition~#3#1#4--#5#2#6} +\crefrangeformat{definition}{definition~#3#1#4--#5#2#6} +\crefrangeformat{result}{result~#3#1#4--#5#2#6} +\crefmultiformat{lemma}% + {lemmas~#2#1#3}{, #2#1#3}{ and~#2#1#3} +\crefmultiformat{corrollary}% + {corrollaries~#2#1#3}{, #2#1#3}{ and~#2#1#3} +\crefmultiformat{proposition}% + {propositions~#2#1#3}{, #2#1#3}{ and~#2#1#3} +\crefmultiformat{definition}% + {definitions~#2#1#3}{, #2#1#3}{ and~#2#1#3} +\crefmultiformat{result}% + {results~#2#1#3}{, #2#1#3}{ and~#2#1#3} +\crefrangemultiformat{lemma}% + {lemmas~#3#1#4--#5#2#6}{, #3#1#4--#5#2#6}% + { and~#3#1#4--#5#2#6} +\crefrangemultiformat{corrollary}% + {corrollaries~#3#1#4--#5#2#6}{, #3#1#4--#5#2#6}% + { and~#3#1#4--#5#2#6} +\crefrangemultiformat{proposition}% + {propositions~#3#1#4--#5#2#6}{, #3#1#4--#5#2#6}% + { and~#3#1#4--#5#2#6} +\crefrangemultiformat{definition}% + {definitions~#3#1#4--#5#2#6}{, #3#1#4--#5#2#6}% + { and~#3#1#4--#5#2#6} +\crefrangemultiformat{result}% + {results~#3#1#4--#5#2#6}{, #3#1#4--#5#2#6}% + { and~#3#1#4--#5#2#6} +} % end of ntheorem option +\ProcessOptions\relax +\endinput +%% +%% End of file `cleveref.sty'. |