diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/cleveref')
-rw-r--r-- | Master/texmf-dist/tex/latex/cleveref/cleveref.sty | 391 |
1 files changed, 333 insertions, 58 deletions
diff --git a/Master/texmf-dist/tex/latex/cleveref/cleveref.sty b/Master/texmf-dist/tex/latex/cleveref/cleveref.sty index ef883a856a0..78b6f2f0e5d 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/26/04 v0.4 Automatic cross-reference formatting] + [2007/11/06 v0.6 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 @@ -175,10 +175,10 @@ \def\@cref#1#2{% \begingroup% \countdef\count@consecutive=0% - \newif\iffirstgroup% + \newif\if@firstgroup% \stack@init{\@refstack}% \stack@push{#2}{\@refstack}% - \firstgrouptrue% + \@firstgrouptrue% \isstackfull{\@refstack}% \@whilesw\ifstackfull\fi{% \stack@init{\@refsubstack}% @@ -200,19 +200,20 @@ \expandafter\ifx\csname r@\@nextref\endcsname\relax% \def\@currenttype{\@undefined}% \else% - \expandafter\cref@gettype\expandafter{\@nextref}{\@currenttype}% + \expandafter\cref@gettype\expandafter% + {\@nextref}{\@currenttype}% \fi% \fi}% - \iffirstgroup% + \if@firstgroup% \else% \isstackfull{\@refstack}% \ifstackfull% - \crefmiddleconjunction% + \@setcref@middleconjunction% \else% - \creflastconjunction% + \@setcref@lastconjunction% \fi% \fi% - \firstgroupfalse% + \@firstgroupfalse% \edef\@nextref{\stack@top{\@refsubstack}}% \stack@pop{\@refsubstack}% \isstackempty{\@refsubstack}% @@ -317,10 +318,10 @@ \fi% \fi% \isstackfull{\@refsubstack}% - }% + }% end loop over reference substack \fi% \isstackfull{\@refstack}% - }% + }% end loop over main reference stack \endgroup} \def\@setcref#1#2#3{% \expandafter\ifx\csname r@#1\endcsname\relax% @@ -394,7 +395,7 @@ type `\@typea' undefined}% \else% \ifx\formata\formatb% - \@@setcrefrange{\@formata}{#1}{#2}% + \expandafter\@@setcrefrange\expandafter{\@formata}{#1}{#2}% \else% \protect\G@refundefinedtrue% \nfss@text{\reset@font\bfseries ??}~\@labela--\@labelb% @@ -408,6 +409,8 @@ \cref@getlabel{#2}{\@labela}% \cref@getlabel{#3}{\@labelb}% #1{\@labela}{\@labelb}{}{}{}{}} +\def\@setcref@middleconjunction{\crefmiddleconjunction} +\def\@setcref@lastconjunction{\creflastconjunction} \newcommand{\crefformat}[2]{\@crefformat{cref}{#1}{#2}} \newcommand{\Crefformat}[2]{\@crefformat{Cref}{#1}{#2}} \newcommand{\crefrangeformat}[2]{\@crefrangeformat{crefrange}{#1}{#2}} @@ -426,55 +429,91 @@ \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\@tmpa##1##2\@nil{% + \if##1c\def\@changecase{\MakeUppercase}% + \else\def\@changecase{\Makelowercase}\fi}% + \@tmpa#1\@nil% + \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\the\expandafter\@toksa\expandafter{% + \expandafter\MakeUppercase\@tmpa{##1}{##2}{##3}}% + \@toksa={% + \expandafter\def\csname\@other @#2@format\endcsname##1##2##3}% + \expandafter\the\expandafter\@toksa\expandafter{% + \@tmpa{##1}{##2}{##3}}% + }{}% +} \def\@crefrangeformat#1#2#3{% - \expandafter\def\csname #1@#2@format\endcsname##1##2##3##4##5##6{#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\@tmpa##1##2\@nil{% + \if##1c\def\@changecase{\MakeUppercase}% + \else\def\@changecase{\Makelowercase}\fi}% + \@tmpa#1\@nil% + \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\the\expandafter\@toksa\expandafter{% + \expandafter\MakeUppercase\@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}}% + }{}% +} \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}% + \newtoks\@toksa% \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}}}{}% + \def\@tmpa##1##2\@nil{% + \if##1c\def\@changecase{\MakeUppercase}% + \else\def\@changecase{\Makelowercase}\fi}% + \@tmpa#1\@nil% + \@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\the\expandafter\@toksa\expandafter{% + \expandafter\MakeUppercase\@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@middle}{% - \expandafter\edef% - \csname\@other @#2@format@middle\endcsname##1##2##3{% - \csname #1@#2@format@middle\endcsname{##1}{##2}{##3}}}{}% + \@toksa={% + \expandafter\let\csname\@other @#2@format@middle\endcsname}% + \expandafter\the\expandafter\@toksa% + \csname #1@#2@format@middle\endcsname% + }{}% \@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}}}{}} + \@toksa={% + \expandafter\let\csname\@other @#2@format@last\endcsname}% + \expandafter\the\expandafter\@toksa% + \csname #1@#2@format@last\endcsname% + }{}% +} \def\@crefrangemultiformat#1#2#3#4#5{% \expandafter\def\csname #1@#2@format@first\endcsname% ##1##2##3##4##5##6{#3}% @@ -486,90 +525,166 @@ \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}}}{}% + \def\@tmpa##1##2\@nil{% + \if##1c\def\@changecase{\MakeUppercase}% + \else\def\@changecase{\MakeLowercase}\fi}% + \@tmpa#1\@nil% + \@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\the\expandafter\@toksa\expandafter{% + \expandafter\MakeUppercase\@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@middle}{% - \expandafter\edef% - \csname\@other @#2@format@middle\endcsname##1##2##3##4##5##6{% + \@toksa={% + \expandafter\let\csname\@other @#2@format@middle\endcsname}% + \expandafter\the\expandafter\@toksa% \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{% + \@toksa={% + \expandafter\let\csname\@other @#2@format@last\endcsname}% + \expandafter\the\expandafter\@toksa% \csname #1@#2@format@last\endcsname% - {##1}{##2}{##3}{##4}{##5}{##6}}}{}} + }{}% +} \crefformat{equation}{eq.~#2(#1)#3} +\Crefformat{equation}{Eq.~#2(#1)#3} \crefformat{chapter}{chapter~#2#1#3} +\Crefformat{chapter}{Chapter~#2#1#3} \crefformat{section}{section~#2#1#3} +\Crefformat{section}{Section~#2#1#3} \crefformat{subsection}{section~#2#1#3} +\Crefformat{subsection}{Section~#2#1#3} \crefformat{subsubsection}{section~#2#1#3} +\Crefformat{subsubsection}{Section~#2#1#3} \crefformat{subsubsubsection}{section~#2#1#3} +\Crefformat{subsubsubsection}{Section~#2#1#3} \crefformat{figure}{fig.~#2#1#3} +\Crefformat{figure}{Fig.~#2#1#3} \crefformat{theorem}{theorem~#2#1#3} +\Crefformat{theorem}{Theorem~#2#1#3} \crefmultiformat{equation}% {eqs.~#2(#1)#3}{, #2(#1)#3}{ and~#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{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{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{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{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{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{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} +\Crefmultiformat{theorem}% + {Theorems~#2#1#3}{, #2#1#3}{ and~#2#1#3} \crefrangeformat{equation}{eqs.~#3(#1)#4--#5(#2)#6} +\Crefrangeformat{equation}{Eqs.~#3(#1)#4--#5(#2)#6} \crefrangeformat{chapter}{chapters~#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{section}{Sections~#3#1#4--#5#2#6} \crefrangeformat{subsection}{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{subsubsection}{Sections~#3#1#4--#5#2#6} \crefrangeformat{subsubsubsection}{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{figure}{Figs.~#3#1#4--#5#2#6} \crefrangeformat{theorem}{theorems~#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{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{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{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{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{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{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{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} +\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}{% @@ -619,7 +734,8 @@ \cref@getlabel{#3}{\@labelb}% \edef\@linka{\cref@hyperref{#2}}% \edef\@linkb{\cref@hyperref{#3}}% - #1{\@labela}{\@labelb}{\hyper@linkstart{link}{\@linka}}{\hyper@linkend}% + #1{\@labela}{\@labelb}% + {\hyper@linkstart{link}{\@linka}}{\hyper@linkend}% {\hyper@linkstart{link}{\@linkb}}{\hyper@linkend}} } % end of hyperref option \DeclareOption{ntheorem}{% @@ -645,41 +761,200 @@ \@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}%] } \crefformat{lemma}{lemma~#2#1#3} +\Crefformat{lemma}{Lemma~#2#1#3} \crefformat{corrollary}{corrollary~#2#1#3} +\Crefformat{corrollary}{Corrollary~#2#1#3} \crefformat{proposition}{proposition~#2#1#3} +\Crefformat{proposition}{Proposition~#2#1#3} \crefformat{definition}{definition~#2#1#3} +\Crefformat{definition}{Definition~#2#1#3} \crefformat{result}{result~#2#1#3} +\Crefformat{result}{Result~#2#1#3} \crefrangeformat{lemma}{lemma~#3#1#4--#5#2#6} +\Crefrangeformat{lemma}{Lemma~#3#1#4--#5#2#6} \crefrangeformat{corrollary}{corrollary~#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{proposition}{Proposition~#3#1#4--#5#2#6} \crefrangeformat{definition}{definition~#3#1#4--#5#2#6} +\Crefrangeformat{definition}{Definition~#3#1#4--#5#2#6} \crefrangeformat{result}{result~#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{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{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{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{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} +\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{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{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{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{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} +\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 +\DeclareOption{poorman}{% +\PackageInfo{cleveref}{option `poorman' loaded} +\edef\cref@text{} +\AtBeginDocument{% + \newwrite\@crefscript% + \immediate\openout\@crefscript=\jobname.sed% +} +\AtEndDocument{% + \immediate\closeout\@crefscript% + \newread\@crefscript% + \immediate\openin\@crefscript=\jobname.sed% + \begingroup% + \newif\if@not@eof% + \def\@eof{\par }% + \catcode`.=13 \catcode`[=13 \catcode`]=13 + \catcode`^=13 \catcode`$=13 %$ + \catcode`\=0 \catcode`<=1 \catcode`>=2 + \catcode`\\=13 \catcode`\{=12 \catcode`\}=12 \catcode`_=12 + \lccode`/=92 + \lccode`~=92\lowercase{\def~{\string/\string/}}% + \lccode`~=46\lowercase{\def~{\string/\string.}}% + \lccode`~=91\lowercase{\def~{\string/\string[}}% + \lccode`~=93\lowercase{\def~{\string/\string]}}% + \lccode`~=94\lowercase{\def~{\string/\string^}}% + \lccode`~=36\lowercase{\def~{\string/\string$}}% $ + \lccode`~=0 \lccode`/=0 \catcode`~=12 + \def\cref@text{}% + \immediate\read\@crefscript to \@tmpa% + \edef\@tmpa{\@tmpa}% + \ifx\@tmpa\@eof% + \@not@eoffalse% + \else% + \@not@eoftrue% + \fi% + \@whilesw\if@not@eof\fi{% + \expandafter\g@addto@macro\expandafter\cref@text\expandafter{% + \@tmpa^^J}% + \show\cref@text% + \immediate\read\@crefscript to \@tmpa% + \edef\@tmpa{\@tmpa}% + \ifx\@tmpa\@eof% + \@not@eoffalse% + \else% + \@not@eoftrue% + \fi}% + \endgroup% + \immediate\closein\@crefscript% + \begingroup% + \lccode`|=92 \lccode`<=123 \lccode`>=125 \lccode`C=67 + \lowercase{\edef\@tmpa{s/||usepackage|(|[.*|]|)|?<cleveref>//g}}% + \expandafter\g@addto@macro\expandafter\cref@text\expandafter{% + \@tmpa^^J} + \lowercase{\edef\@tmpa{s/||[cC]refformat<.*><.*>//g}}% + \expandafter\g@addto@macro\expandafter\cref@text\expandafter{% + \@tmpa^^J} + \lowercase{\edef\@tmpa{s/||[cC]refrangeformat<.*><.*>//g}}% + \expandafter\g@addto@macro\expandafter\cref@text\expandafter{% + \@tmpa^^J} + \lowercase{\edef\@tmpa{s/||[cC]refmultiformat<.*><.*><.*><.*>//g}}% + \expandafter\g@addto@macro\expandafter\cref@text\expandafter{% + \@tmpa^^J} + \lowercase{\edef\@tmpa{% + s/||[cC]refrangemultiformat<.*><.*><.*><.*>//g}}% + \expandafter\g@addto@macro\expandafter\cref@text\expandafter{% + \@tmpa^^J} + \lowercase{\edef\@tmpa{s/||renewcommand<||[cC]ref><.*>//g}}% + \expandafter\g@addto@macro\expandafter\cref@text\expandafter{% + \@tmpa^^J} + \lowercase{\edef\@tmpa{s/||renewcommand<||[cC]refrange><.*>//g}}% + \expandafter\g@addto@macro\expandafter\cref@text\% + expandafter{\@tmpa} + \endgroup + \newwrite\@crefscript% + \immediate\openout\@crefscript=\jobname.sed% + \immediate\write\@crefscript{\cref@text}% + \immediate\closeout\@crefscript% +}% +\renewcommand{\cref}[1]{% + \edef\cref@text{}% + \@cref{cref}{#1}% + \cref@writescript{\string\cref\string{#1\string}}} +\renewcommand{\Cref}[1]{% + \edef\cref@text{}% + \@cref{Cref}{#1}% + \cref@writescript{\string\Cref\string{#1\string}}} +\renewcommand{\crefrange}[2]{% + \edef\cref@text{}% + \@setcrefrange{#1}{#2}{cref}{}% + \cref@writescript{% + \string\crefrange\string{#1\string}\string{#2\string}}} +\renewcommand{\Crefrange}[2]{% + \edef\cref@text{}% + \@setcrefrange{#1}{#2}{Cref}{}% + \cref@writescript{% + \string\Crefrange\string{#1\string}\string{#2\string}}} +\def\cref@writescript#1{% + \edef\@tmpa{\cref@getmeaning{\cref@text}}% + \immediate\write\@crefscript{s/#1/\@tmpa/g}% +} +\let\old@@setcref\@@setcref +\let\old@@setcrefrange\@@setcrefrange +\def\cref@getmeaning#1{\expandafter\@cref@getmeaning\meaning#1\@nil} +\def\@cref@getmeaning#1->#2\@nil{#2} +\def\@@setcref#1#2{% + \old@@setcref{#1}{#2}% + \expandafter\g@addto@macro\expandafter{% + \expandafter\cref@text\expandafter}\expandafter{% + #1{\ref{#2}}{}{}}} +\def\@@setcrefrange#1#2#3{% + \old@@setcrefrange{#1}{#2}{#3}% + \expandafter\g@addto@macro + \expandafter{\expandafter\cref@text\expandafter}% + \expandafter{#1{\ref{#2}}{\ref{#3}}{}{}{}{}}} +\def\@setcref@middleconjunction{% + \crefmiddleconjunction% + \expandafter\g@addto@macro + \expandafter{\expandafter\cref@text\expandafter}% + \expandafter{\crefmiddleconjunction}} +\def\@setcref@lastconjunction{% + \creflastconjunction% + \expandafter\g@addto@macro + \expandafter{\expandafter\cref@text\expandafter}% + \expandafter{\creflastconjunction}} +} % end of poorman option \ProcessOptions\relax \endinput %% |