summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-02-05 21:55:39 +0000
committerKarl Berry <karl@freefriends.org>2018-02-05 21:55:39 +0000
commit8b4451636905feb26dd54d7ad87238ccb6ea9b43 (patch)
tree07b7c2d079f41917b0c533ab06bf51f3499896d2 /Master
parent2ef422c944ed60d619037098bbea4a734f86d6e0 (diff)
cleveref (5feb18)
git-svn-id: svn://tug.org/texlive/trunk@46549 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/cleveref/cleveref.pdfbin382222 -> 385645 bytes
-rw-r--r--Master/texmf-dist/source/latex/cleveref/cleveref.dtx3634
-rw-r--r--Master/texmf-dist/source/latex/cleveref/cleveref.ins2
-rw-r--r--Master/texmf-dist/tex/latex/cleveref/cleveref.sty2756
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds1
5 files changed, 2816 insertions, 3577 deletions
diff --git a/Master/texmf-dist/doc/latex/cleveref/cleveref.pdf b/Master/texmf-dist/doc/latex/cleveref/cleveref.pdf
index c049f39a7b4..90ca7534841 100644
--- a/Master/texmf-dist/doc/latex/cleveref/cleveref.pdf
+++ b/Master/texmf-dist/doc/latex/cleveref/cleveref.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/cleveref/cleveref.dtx b/Master/texmf-dist/source/latex/cleveref/cleveref.dtx
index ca7e6728885..32eee6e034f 100644
--- a/Master/texmf-dist/source/latex/cleveref/cleveref.dtx
+++ b/Master/texmf-dist/source/latex/cleveref/cleveref.dtx
@@ -1,9 +1,9 @@
-\def\packagedate{2013/12/28}
-\def\packageversion{0.19}
+\def\packagedate{2017/07/10}
+\def\packageversion{0.21}
% \iffalse meta-comment
%
% Package 'cleveref' to use with LaTeX2e
-% Copyright 2006--2013 Toby Cubitt
+% Copyright 2006--2017 Toby Cubitt
%
% Written and maintained by Toby Cubitt
%
@@ -46,7 +46,7 @@
%</driver>
% \fi
%
-% \CheckSum{19622}
+% \CheckSum{19606}
%% \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
@@ -279,13 +279,47 @@
% \package{algorithm2e} + \package{hyperref} support.}
% \changes{v0.18.9}{2013/03/22}{Fixed regression that broke
% \option{nameinlink} option.}
-% \changes{v0.19}{2013/12/28}{Added \package{breqn} package support.
+% \changes{v0.19}{2013/12/28}{Added \package{breqn} package support.
% Remove unwanted spaces in some macros. Added abbreviation for
-% ``Abbildung'' to German translations. Added \package{xr-hyperref}
+% ``Abbildung'' to German translations. Added \package{xr-hyper}
% package support. Fixed bug in \package{amsmath} \textbackslash{}tag
% support. Added \textbackslash{}crefstripprefix utility macro and
% example usage. Added separate \texttt{subequation} cross-reference
% type.}
+% \changes{v0.19.1}{2014/08/14}{Fixed bug in \textbackslash{}labelcref
+% format customization. Fixed subtle \textbackslash{}varioref bug
+% caused by a stray \%. Fixed typo in Swedish translations. Fix
+% \textbackslash{}setcrefrange to use same test for matching reference
+% types \textbackslash{}cref@processgroup and
+% \textbackslash{}cref@processgroupall.}
+% \changes{v0.19.2}{2015/11/18}{Fixed compatibility with REFTeX
+% \textbackslash{}appendix* command. Added catalan language support.
+% Fix \textbackslash{}@bsphack/\textbackslash{}@esphack spacing issues
+% in \textbackslash{}label refefinitions. Fix \textbackslash{}crefalias
+% mechanism in \package{hyperref} support. Fix bugs in \package{breqn}
+% and \package{varioref} support. Ensure any undefined
+% \textbackslash{}labelcref formats for sub-types (subsections,
+% subequations etc.) are copied from parent types. (This fixes missing
+% brackets around \textbackslash{}labelcref subequation references.)}
+% \changes{v0.20}{2016/08/10}{Fix erroneous \%'s after
+% \textbackslash{}advance which broke \package{varioref} support.
+% Add \textbackslash{}cref@ifstreq utility macro for
+% catcode-independent string comparison.
+% Fix sorting of enum\meta{x} labels.}
+% \changes{v0.21}{2017/07/10}{Add \texttt{cref@} prefix to
+% \textbackslash{}gobble@optarg to avoid conflicts with other packages.
+% Compress away duplicate references in \textbackslash{}cref etc.\ just
+% as we already did for \textbackslash{}cpageref. Fix
+% \textbackslash{}cpageref error on non-arabic page numbers. Fix bug
+% that disabled warning on more than one reference type within a
+% \textbackslash{}labelcref. Refactor \textbackslash{}cpageref to use
+% same machinery as \textbackslash{}cref, treating different page
+% numbering schemes within a document as different page number
+% ``types''. Refactor and simplify main \textbackslash{}@cref macro.
+% Fix compatibility with newer IEEEtrantools versions. Fix subtle
+% bug in \package{amsmath}$+$\package{hyperref} subequations support,
+% which made hyperlinks point to wrong location in \emph{all} equations
+% following the first use of subequations in a document.}
%
% \GetFileInfo{cleveref.sty}
%
@@ -415,21 +449,21 @@
% it all out for you automaticaly.
%
% \package{Cleveref} supports a number of languages other than English,
-% and also supports the \package{babel} package for those languages.
-% Either pass the desired language as an option to \package{cleveref}, or
-% pass it as a global option to |\documentclass|. Note that if you're
-% writing in a language in which nouns decline, the |\cref| and
-% |\cpageref| commands may be less useful, as they always produce the
-% cross-reference name in the nominative case.\footnote{Providing
-% separate variants of the \package{cleveref} commands for each noun case
-% quickly becomes more cumbersome than just typing the cross-reference
-% name by hand. Trying to determine the appropriate case automatically
-% would be tantamount to solving the full natural-language processing
-% problem in \package{cleveref}. Check back in a century or so for this
-% feature.} In such languages, you may instead prefer to use the
-% |\labelcref| and |\labelcpageref| commands. Unlike |\cref| and
-% |\cpageref|, these don't produce the name in front of the
-% cross-reference, so you must supply it (in the appropriate case)
+% and also supports the \package{babel} and \package{polyglossia}
+% packages for those languages. Either pass the desired language as an
+% option to \package{cleveref}, or pass it as a global option to
+% |\documentclass|. Note that if you're writing in a language in which
+% nouns decline, the |\cref| and |\cpageref| commands may be less useful,
+% as they always produce the cross-reference name in the nominative
+% case.\footnote{Providing separate variants of the \package{cleveref}
+% commands for each noun case quickly becomes more cumbersome than just
+% typing the cross-reference name by hand. Trying to determine the
+% appropriate case automatically would be tantamount to solving the full
+% natural-language processing problem in \package{cleveref}. Check back
+% in a century or so for this feature.} In such languages, you may
+% instead prefer to use the |\labelcref| and |\labelcpageref| commands.
+% Unlike |\cref| and |\cpageref|, these don't produce the name in front
+% of the cross-reference, so you must supply it (in the appropriate case)
% yourself. But they do still cope with multi-references, so you still
% gain some benefit from using \package{cleveref}.
%
@@ -837,7 +871,7 @@
% hyperlink target than the others.
%
%
-% \subsection{Avoiding Abbreviations in Cross-Reference Names}
+% \subsection{Abbreviations in Cross-Reference Names}
% \label{sec:noabbrev}
% \DescribeMacro{noabbrev}
% The default cross-reference names for some languages use common
@@ -848,6 +882,16 @@
% abbreviations in the default cross-reference names, pass the
% \option{noabbrev} option to the \package{cleveref} package.
%
+% Note that the default names \emph{never} use abbreviations for the
+% start-of-sentence variants (|\Cref| etc.)
+% This is because in good written English (and likely other languages
+% too), abbreviations should never be used at the beginning of a
+% sentence. Many of \TeX{}'s default settings (e.g.\ page margins) are
+% specifically chosen to encourage good typesetting style.
+% \package{Cleveref} tried to follow the same philosophy. If despite this
+% you insist on using abbreviations at the start of sentences, you will
+% need to customise the start-of-sentence formats yourself.
+%
%
%
%
@@ -1414,11 +1458,16 @@
% the usual way, though not all languages are supported
% yet.\footnote{Contributions of translations for missing languages are
% very welcome! See \cref{sec:new-features} for information on how to
-% contribute translations.} The \package{babel} package is also supported
-% when it is loaded, allowing you to change the language used in
-% cross-references using the \package{babel} language switching commands,
-% such as |\selectlanguage| and |\foreignlanguage|. Similar support is
-% provided for the \package{polyglossia} babel replacement package.
+% contribute translations.} Basic \package{cleveref} language support
+% will work even if \package{babel} or \package{polyglossia} are not
+% loaded. The only exception currently is Catalan (which requires the
+% |\lgem| command provided by these packages).
+%
+% The \package{babel} package is fully supported if it is loaded,
+% allowing you to change the language used in cross-references using the
+% \package{babel} language switching commands, such as |\selectlanguage|
+% and |\foreignlanguage|. Similar support is provided for the
+% \package{polyglossia} babel replacement package.
%
% Note that when using \package{babel}, you still need to tell
% \package{cleveref} which language it should use for the default
@@ -1502,7 +1551,7 @@
% cross-reference names are stored in macros called
% |\cref@|\meta{type}|@name|, |\Cref@|\meta{type}|@name|,
% |\cref@|\meta{type}|@name@plural|, and
-% |\Cref@|\meta{type}|@name@plural|.\linebreak[4] (Note that since these
+% |\Cref@|\meta{type}|@name@plural|. (Note that since these
% macro names contain the ``@'' character, you must use |\makeatletter|
% and |\makeatother| to access them.)
%
@@ -1694,7 +1743,7 @@
%
%
%
-% \section{Known Bugs, Non-Bugs, and Possible}
+% \section{Known Bugs, Non-Bugs, and Possible Improvements}
% \label{sec:known_bugs}
%
% \subsection{Non-Bugs}\label{sec:non-bugs}
@@ -1842,21 +1891,26 @@
% contributing the \package{amsthm} support code, and to Stefan Pinnow,
% Gonzalo Medina, Massimo Redaelli, Philip H\"olzenspies, Aleksander
% Gorohovski, Benjamin H{\o}yer, Johannes Mueller, Paulo Roberto Massa
-% Cereda and Simon Sigurdhsson for contributing translations. Thanks also
-% to Susanna Goldschmidt for additional help with the translations. Many
-% people have suggested improvements or reported bugs -- indeed, many
-% have put significant effort into helping investigate and fix them. So
-% thanks (in alphabetical order) to: Adrian Knoth, Akim Demaille, Alan
-% Munn, Aleksander Gorohovski, Anand Deopurkar, Andreas Haselbacher, Arne
-% Meier, Bas Ploeger, Dan Luecking, David Gleich, Denis Bitouz\'e,
-% Domenic Denicola, Donald Ars\-en\-eau, Hendrik Maryns, Iain Cunningham,
-% James Sharam, Jens Mueller, Joel C. Salomon, Jonas Nyrup, Joris Pinkse,
-% Kristian Debrabant, Leo Shidai Liu, Lev Bishop, Mak Trifkovic, Matej
-% Batic, Matt Gately, Matthew Skala, Michael Barber, Michael Gorven,
-% Michal Kaut, Mico Loretan, Nicolas Dudebout, Olivier Roy, Patrick
-% H\"acker, Paul Gomme, Ricardo de Aldama S\'anchez, Robert Fischer,
-% Stefan Pinnow, Steve Dower, Ted Pavlic, Thomas Arildsen, and Uwe L\"uck
-% for their help. (If I missed you out, please let me know!)
+% Cereda, Simon Sigurdhsson, Rafel Jaume Dey\`a and Eva Bosch Roura for
+% contributing translations. Thanks also to Susanna Goldschmidt for
+% additional help with the translations.
+%
+% Many people have suggested improvements or reported bugs -- indeed,
+% many have put significant effort into helping investigate and fix them.
+% So thanks (in alphabetical order) to: Adrian Knoth, Akim Demaille, Alan
+% Munn, Aleksander Gorohovski, Amar Ghaisas, Anand Deopurkar, Andreas
+% Haselbacher, Arne Meier, Bas Ploeger, Christian Tuma, Dan Luecking,
+% David Gleich, Denis Bitouz\'e, Domenic Denicola, Donald Ars\-en\-eau,
+% Eric Ahlberg, Frank Mittlebach, Hendrik Maryns, Iain Cunningham, Ingolf
+% Becker, James Sharam, Jens Mueller, Joel C.
+% Salomon, Jonas Nyrup, Joris Pinkse, Kristian Debrabant, Leo Shidai Liu,
+% Lev Bishop, Mak Trifkovic, Matej Batic, Matt Gately, Matthew Skala,
+% Michael Barber, Michael Gorven, Michal Kaut, Mico Loretan, Milania,
+% Nicolas Dudebout, Olivier Roy, Patrick H\"acker, Paul Gomme, Ricardo de
+% Aldama S\'anchez, Robert Fischer, Sebastian \O{}rsted, Stefan Pinnow,
+% Steve Dower, Ted Pavlic, Thomas Arildsen, Tobias Jores, Uwe L\"uck and
+% Vadim Makarov for their help.
+% (If I inadvertently missed you out, please let me know!)
%
%
% \StopEventually{\clearpage\PrintChanges\clearpage\PrintIndex}
@@ -1973,19 +2027,31 @@
\def\label{\@ifnextchar[\label@optarg\label@noarg}%]
\let\cref@label\label%
\def\label@noarg#1{%
- \@bsphack%
\cref@old@label{#1}%
+ \@bsphack%
+ \edef\@tempa{{page}{\the\c@page}}%
+ \setcounter{page}{1}%
+ \edef\@tempb{\thepage}%
+ \expandafter\setcounter\@tempa%
+ \cref@constructprefix{page}{\cref@result}%
\protected@write\@auxout{}%
- {\string\newlabel{#1@cref}{{\cref@currentlabel}{\thepage}}}%
+ {\string\newlabel{#1@cref}{{\cref@currentlabel}%
+ {[\@tempb][\arabic{page}][\cref@result]\thepage}}}%
\@esphack}%
\def\label@optarg[#1]#2{%
- \@bsphack%
\cref@old@label{#2}%
+ \@bsphack%
+ \edef\@tempa{{page}{\the\c@page}}%
+ \setcounter{page}{1}%
+ \edef\@tempb{\thepage}%
+ \expandafter\setcounter\@tempa%
+ \cref@constructprefix{page}{\cref@result}%
\protected@edef\cref@currentlabel{%
\expandafter\cref@override@label@type%
\cref@currentlabel\@nil{#1}}%
\protected@write\@auxout{}%
- {\string\newlabel{#2@cref}{{\cref@currentlabel}{\thepage}}}%
+ {\string\newlabel{#2@cref}{{\cref@currentlabel}%
+ {[\@tempb][\arabic{page}][\cref@result]\thepage}}}%
\@esphack}%
}% end of AtBeginDocument
% \end{macrocode}
@@ -2151,11 +2217,12 @@
% ``chapter'' fulfils that role.
% \begin{macrocode}
\@ifundefined{appendix}{}{%
- \g@addto@macro\appendix{%
+ \let\cref@old@appendix\appendix%
+ \def\appendix{%
\@ifundefined{chapter}{%
- \gdef\refstepcounter@noarg#1{%
- \cref@old@refstepcounter{#1}%
- \cref@constructprefix{#1}{\cref@result}%
+ \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
@@ -2169,40 +2236,41 @@
% \end{macrocode}
% Override the cross-reference type of sectioning commands.
% \begin{macrocode}
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{section}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [appendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [appendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{subsection}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [subappendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{subsubsection}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subsubappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [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}}%
+ \@ifundefined{cref@##1@alias}%
+ {\def\@tempa{##1}}%
+ {\def\@tempa{\csname cref@##1@alias\endcsname}}%
\protected@edef\cref@currentlabel{%
- [\@tempa][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [\@tempa][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\fi%
\fi%
\fi}%
+ \cref@old@appendix%
}{%
- \def\refstepcounter@noarg#1{%
- \cref@old@refstepcounter{#1}%
- \cref@constructprefix{#1}{\cref@result}%
+ \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.
@@ -2215,45 +2283,45 @@
% \end{macrocode}
% Override the cross-reference type of sectioning commands.
% \begin{macrocode}
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{chapter}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [appendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [appendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{section}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [subappendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{subsection}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subsubappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [subsubappendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{subsubsection}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subsubsubappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [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}}%
+ \@ifundefined{cref@##1@alias}%
+ {\def\@tempa{##1}}%
+ {\def\@tempa{\csname cref@##1@alias\endcsname}}%
\protected@edef\cref@currentlabel{%
- [\@tempa][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [\@tempa][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\fi%
\fi%
\fi%
\fi}%
- }%
+ \cref@old@appendix}%
}%
}% end of \@ifundefined{appendix}
% \end{macrocode}
@@ -2264,13 +2332,13 @@
% \subsection{Utility Macros}
%
% \subsubsection{miscellaneous}
-% \begin{macro}{\@gobble@optarg}
+% \begin{macro}{\cref@gobble@optarg}
% A basic macro that gobbles one argument plus, if present, one
% optional argument.
% \begin{macrocode}
-\def\@gobble@optarg{\@ifnextchar[\@@gobble@optarg\@gobble@orig}%]
-\def\@gobble@orig#1{}%
-\def\@@gobble@optarg[#1]#2{}%
+\def\cref@gobble@optarg{\@ifnextchar[\@cref@gobble@optarg\cref@gobble}%]
+\def\cref@gobble#1{}%
+\def\@cref@gobble@optarg[#1]#2{}%
% \end{macrocode}
% \end{macro}
%
@@ -2283,6 +2351,29 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\cref@ifstreq}
+% A utility macro to test string equality in a catcode-independent
+% fashion. Assumes both arguments are fully expandable. Note: using the
+% |\pdfstrcmp| primitive from |pdftex| would be more robust, but we don't
+% want to depend on |pdftex|. This macro suffices for our purposes.
+% \begin{macrocode}
+\def\cref@ifstreq#1#2#3#4{%
+ \begingroup%
+ \edef\@tempa{#1}%
+ \edef\@tempb{#2}%
+ \expandafter\def\expandafter\@tempa\expandafter{\csname\@tempa\endcsname}%
+ \expandafter\def\expandafter\@tempb\expandafter{\csname\@tempb\endcsname}%
+ \ifx\@tempa\@tempb%
+ \let\@tempc\@firstoftwo%
+ \else%
+ \let\@tempc\@secondoftwo%
+ \fi%
+ \expandafter%
+ \endgroup%
+ \@tempc{#3}{#4}}%
+% \end{macrocode}
+% \end{macro}
+%
%
% \subsubsection{\file{aux} file information}
% \begin{macro}{\cref@getlabel}
@@ -2310,12 +2401,6 @@
\expandafter\expandafter\expandafter#2%
\expandafter\expandafter\expandafter{%
\expandafter\@firstoftwo#2}}%
-\def\cref@getpageref#1#2{%
- \expandafter\let\expandafter#2\csname r@#1@cref\endcsname%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter#2%
- \expandafter\expandafter\expandafter{%
- \expandafter\@secondoftwo#2}}%
\def\cref@getlabel#1#2{%
\cref@getref{#1}{\@tempa}%
\expandafter\@cref@getlabel\@tempa\@nil#2}%
@@ -2345,6 +2430,49 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \begin{macro}{\cpageref@getlabel}
+% \begin{macro}{\cpageref@gettype}
+% \begin{macro}{\cpageref@getcounter}
+% Similarly for the page number information. Here, the information we
+% store in addition to the page label is the page label ``type'' (used
+% to distinguish different page numbering sequences, e.g.\ roman in the
+% front-matter and arabic in the main text), and the numerical value of
+% the page counter.
+% \begin{macrocode}
+\def\cpageref@getref#1#2{%
+ \expandafter\let\expandafter#2\csname r@#1@cref\endcsname%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter#2%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@secondoftwo#2}}%
+\def\cpageref@getlabel#1#2{%
+ \cpageref@getref{#1}{\@tempa}%
+ \expandafter\@cpageref@getlabel\@tempa\@nil#2}%
+\def\@cpageref@getlabel{\@ifnextchar[%]
+ \@@cpageref@getlabel{\@@cpageref@getlabel[][][]}}%
+\def\@@cpageref@getlabel[#1][#2][#3]#4\@nil#5{\def#5{#4}}%
+\def\cpageref@gettype#1#2{%
+ \cpageref@getref{#1}{\@tempa}%
+ \expandafter\@cpageref@gettype\@tempa\@nil#2}%
+\def\@cpageref@gettype{\@ifnextchar[%]
+ \@@cpageref@gettype{\@@cpageref@gettype[][][]}}%
+\def\@@cpageref@gettype[#1][#2][#3]#4\@nil#5{\def#5{#1}}%
+\def\cpageref@getcounter#1#2{%
+ \cpageref@getref{#1}{\@tempa}%
+ \expandafter\@cpageref@getcounter\@tempa\@nil#2}%
+\def\@cpageref@getcounter{\@ifnextchar[%]
+ \@@cpageref@getcounter{\@@cpageref@getcounter[][][]}}%
+\def\@@cpageref@getcounter[#1][#2][#3]#4\@nil#5{\def#5{#2}}%
+\def\cpageref@getprefix#1#2{%
+ \cpageref@getref{#1}{\@tempa}%
+ \expandafter\@cpageref@getprefix\@tempa\@nil#2}%
+\def\@cpageref@getprefix{\@ifnextchar[%]
+ \@@cpageref@getprefix{\@@cpageref@getprefix[][][]}}%
+\def\@@cpageref@getprefix[#1][#2][#3]#4\@nil#5{\def#5{#3}}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \cmd{\cref@override@label@type} is a convenience macro for overriding
% the label type stored in \cmd{\cref@currentlabel}.
@@ -2497,9 +2625,25 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\cref@stack@dropempty}
+% Drop any empty references from head of a stack.
+% \begin{macrocode}
+\def\cref@stack@dropempty#1{%
+ \edef\@tempa{\cref@stack@top{#1}}%
+ \@whilesw\ifx\@tempa\@empty\fi{%
+ \cref@stack@pop{#1}%
+ \cref@isstackempty{#1}%
+ \if@cref@stackempty%
+ \let\@tempa\relax%
+ \else%
+ \edef\@tempa{\cref@stack@top{#1}}%
+ \fi}}%
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\cref@stack@sort}
-% The \cmd{\cref@stack@sort} macro sorts a stack, using the comparison
-% macro passed in the second argument, which we use later to sort lists
+% The \cmd{\cref@stack@sort} macro sorts a stack passed in |#2|, using
+% the comparison macro passed in |#1|, which we use later to sort lists
% of references. We use insertion sort despite its $O(n^2)$ scaling
% because it's simpler to code, and because we're very unlikely to
% encounter lists of more than ten or so references, so in practice a
@@ -2512,49 +2656,49 @@
% \end{macrocode}
% Push first element into sorted stack.
% \begin{macrocode}
- \edef\@element{\cref@stack@top{#1}}%
+ \edef\@element{\cref@stack@top{#2}}%
\expandafter\cref@stack@push\expandafter{\@element}{\@sortstack}%
- \cref@stack@pop{#1}%
+ \cref@stack@pop{#2}%
% \end{macrocode}
% If empty elements follow first one, need to add them after it in sorted
% stack.
% \begin{macrocode}
- \cref@isstackfull{#1}%
+ \cref@isstackfull{#2}%
\if@cref@stackfull%
- \edef\@tempa{\cref@stack@top{#1}}%
+ \edef\@tempa{\cref@stack@top{#2}}%
\@whilesw\ifx\@tempa\@empty\fi{%
\cref@stack@pull{}{\@sortstack}%
- \cref@stack@pop{#1}%
- \cref@isstackempty{#1}%
+ \cref@stack@pop{#2}%
+ \cref@isstackempty{#2}%
\if@cref@stackempty%
\let\@tempa\relax%
\else%
- \edef\@tempa{\cref@stack@top{#1}}%
+ \edef\@tempa{\cref@stack@top{#2}}%
\fi}%
\fi%
% \end{macrocode}
% Process elements from stack.
% \begin{macrocode}
- \cref@isstackfull{#1}%
+ \cref@isstackfull{#2}%
\@whilesw\if@cref@stackfull\fi{%
- \edef\@element{\cref@stack@top{#1}}%
- \cref@stack@pop{#1}%
+ \edef\@element{\cref@stack@top{#2}}%
+ \cref@stack@pop{#2}%
% \end{macrocode}
% If empty elements follow current one, need to add them to sorted stack,
% right after element we're currently dealing with.
% \begin{macrocode}
\def\@empties{}%
- \cref@isstackfull{#1}%
+ \cref@isstackfull{#2}%
\if@cref@stackfull%
- \edef\@tempa{\cref@stack@top{#1}}%
+ \edef\@tempa{\cref@stack@top{#2}}%
\@whilesw\ifx\@tempa\@empty\fi{%
\edef\@empties{\@empties,}%
- \cref@stack@pop{#1}%
- \cref@isstackempty{#1}%
+ \cref@stack@pop{#2}%
+ \cref@isstackempty{#2}%
\if@cref@stackempty%
\let\@tempa\relax%
\else%
- \edef\@tempa{\cref@stack@top{#1}}%
+ \edef\@tempa{\cref@stack@top{#2}}%
\fi}%
\fi%
% \end{macrocode}
@@ -2563,11 +2707,11 @@
% \begin{macrocode}
\edef\@tempa{{\expandafter\noexpand\@element}%
{\expandafter\noexpand\@empties}%
- {\noexpand\@sortstack}{\noexpand#2}}%
+ {\noexpand\@sortstack}{\noexpand#1}}%
\expandafter\cref@stack@insert\@tempa%
- \cref@isstackfull{#1}}%
+ \cref@isstackfull{#2}}%
\expandafter\endgroup\expandafter%
- \def\expandafter#1\expandafter{\@sortstack}}%
+ \def\expandafter#2\expandafter{\@sortstack}}%
% \end{macrocode}
% \end{macro}
%
@@ -2610,20 +2754,110 @@
% \end{macro}
%
%
-% \subsubsection{Sorting and comparison of counters}
+% \subsubsection{Reference comparison and sorting}
+% \begin{macro}{\cref@isrefsametype}
+% \begin{macro}{\if@cref@sametype}
+% Test if two references have same type, and set |\if@cref@sametype|
+% conditional accordingly.
+% \begin{macrocode}
+\newif\if@cref@sametype%
+\def\cref@isrefsametype#1#2{%
+ \begingroup%
+% \end{macrocode}
+% Undefined references are treated as different from any other type, but
+% the same type as each other.
+% \begin{macrocode}
+ \expandafter\ifx\csname r@#1@cref\endcsname\relax%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax%
+ \def\@after{\@cref@sametypetrue}%
+ \else%
+ \def\@after{\@cref@sametypefalse}%
+ \fi%
+ \else%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax%
+ \def\@after{\@cref@sametypefalse}%
+% \end{macrocode}
+% To test if two references have the same type, we actually compare the
+% expansion of |\cref@|\meta{type}|@format| rather than the \meta{type}
+% per se. This allows references with different counters but identical
+% formatting (e.g.\ equations and subequations with the default
+% formatting) to be typeset as part of the same reference group, which is
+% almost always what we want.
+% \begin{macrocode}
+ \else%
+ \cref@gettype{#1}{\@type}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@formata%
+ \expandafter\expandafter\expandafter{%
+ \csname cref@\@type @format\endcsname%
+ {\@dummya}{\@dummyb}{\@dummyc}}%
+ \cref@gettype{#2}{\@type}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@formatb%
+ \expandafter\expandafter\expandafter{%
+ \csname cref@\@type @format\endcsname%
+ {\@dummya}{\@dummyb}{\@dummyc}}%
+ \ifx\@formata\@formatb%
+ \def\@after{\@cref@sametypetrue}%
+ \else%
+ \def\@after{\@cref@sametypefalse}%
+ \fi%
+ \fi%
+ \fi%
+ \expandafter\endgroup\@after}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\cpageref@isrefsametype}
+% Test if two page references have same ``type'', and set
+% |\if@cref@sametype| conditional accordingly.
+% \begin{macrocode}
+\def\cpageref@isrefsametype#1#2{%
+ \begingroup%
+% \end{macrocode}
+% Undefined references are treated as different from any other type, but
+% the same type as each other.
+% \begin{macrocode}
+ \expandafter\ifx\csname r@#1@cref\endcsname\relax%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax%
+ \def\@after{\@cref@sametypetrue}%
+ \else%
+ \def\@after{\@cref@sametypefalse}%
+ \fi%
+ \else%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax%
+ \def\@after{\@cref@sametypefalse}%
+ \else%
+ \cpageref@gettype{#1}{\@typea}%
+ \cpageref@gettype{#2}{\@typeb}%
+ \ifx\@typea\@typeb%
+ \def\@after{\@cref@sametypetrue}%
+ \else%
+ \def\@after{\@cref@sametypefalse}%
+ \fi%
+ \fi%
+ \fi%
+ \expandafter\endgroup\@after}%
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\cref@countercmp}
-% The \cmd{\cref@countercmp} macro compares two references according to
-% their respective sets of counter data, as returned by
-% \cmd{\cref@getcounter}. It \cmd{\chardef}'s its third argument to 0
-% if they're equal, 1 if the first comes earlier than the second, or 2
-% if the first comes later than the second. This is used later for
-% sorting references.
+% The \cmd{\cref@countercmp} macro compares references |#1| and |#2|
+% according to their respective sets of counter data (stored in the
+% \file{aux} file). It \cmd{\chardef}'s |#3| to 0 if they're equal, 1
+% if the first comes earlier than the second, or 2 if the first
+% reference comes later than the second. This is used later for sorting
+% references. \cmd{\cref@countercmp} compares the references
+% themselves, \cmd{\cpageref@countercmp} compares their page numbers.
% \begin{macrocode}
\def\cref@counter@first#1#2\@nil{#1}%
\def\cref@counter@rest#1#2\@nil{#2}%
-\def\cref@countercmp#1#2#3{%
+\def\cref@countercmp{\@cref@countercmp{cref}}%
+\def\cpageref@countercmp{\@cref@countercmp{cpageref}}%
+\def\@cref@countercmp#1#2#3#4{%
\begingroup%
- \def\@tempa{#1}%
+ \def\@tempa{#2}%
% \end{macrocode}
% In order to ensure empty references end up in the right place when
% sorting lists of multiple references, we make the comparison macro
@@ -2632,27 +2866,27 @@
\ifx\@tempa\@empty%
\def\cref@result{1}%
\else%
- \def\@tempa{#2}%
+ \def\@tempa{#3}%
\ifx\@tempa\@empty%
\def\cref@result{2}%
\else%
% \end{macrocode}
% Conversely, undefined references come after everything else.
% \begin{macrocode}
- \expandafter\ifx\csname r@#1@cref\endcsname\relax%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax%
\def\cref@result{2}%
\else%
- \expandafter\ifx\csname r@#2@cref\endcsname\relax%
+ \expandafter\ifx\csname r@#3@cref\endcsname\relax%
\def\cref@result{1}%
\else%
% \end{macrocode}
% The real work of comparing two references is done by
-% \cmd{\@cref@countercmp}.
+% \cmd{\@@cref@countercmp}.
% \begin{macrocode}
- \cref@getcounter{#1}{\@countera}%
- \cref@getprefix{#1}{\@prefixa}%
- \cref@getcounter{#2}{\@counterb}%
- \cref@getprefix{#2}{\@prefixb}%
+ \csname #1@getcounter\endcsname{#2}{\@countera}%
+ \csname #1@getprefix\endcsname{#2}{\@prefixa}%
+ \csname #1@getcounter\endcsname{#3}{\@counterb}%
+ \csname #1@getprefix\endcsname{#3}{\@prefixb}%
\cref@stack@init{\@countstacka}%
\expandafter\cref@stack@push\expandafter%
{\@countera}{\@countstacka}%
@@ -2667,21 +2901,21 @@
\expandafter\cref@stack@push\expandafter%
{\@prefixb}{\@countstackb}%
\fi%
- \@cref@countercmp%
+ \@@cref@countercmp%
\fi%
\fi%
\fi%
\fi%
\expandafter\endgroup\expandafter%
- \chardef\expandafter#3\expandafter=\cref@result\relax}%
+ \chardef\expandafter#4\expandafter=\cref@result\relax}%
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\@cref@countercmp}
-% The \cmd{\@cref@countercmp} macro recursively compares counter
+% \begin{macro}{\@@cref@countercmp}
+% The \cmd{\@@cref@countercmp} macro recursively compares counter
% components until it runs out of components for one of the references,
% or finds two corresponding components that are unequal.
% \begin{macrocode}
-\def\@cref@countercmp{%
+\def\@@cref@countercmp{%
\let\@iterate\relax%
\cref@isstackempty{\@countstacka}%
\if@cref@stackempty%
@@ -2706,7 +2940,7 @@
\ifnum\@tempa>\@tempb\relax%
\def\cref@result{2}%
\else%
- \def\@iterate{\@cref@countercmp}%
+ \def\@iterate{\@@cref@countercmp}%
\fi%
\fi%
\fi%
@@ -2715,60 +2949,6 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\cref@pagecmp}
-% The \cmd{\cref@pagecmp} macro compares two references according to
-% their page numbers, as returned by \cmd{\cref@getpage}. It
-% \cmd{\chardef}'s its third argument to 0 if they're equal, 1 if the
-% first comes earlier than the second, or 2 if the first comes later
-% than the second. This is used later for sorting page references.
-% \begin{macrocode}
-\def\cref@pagecmp#1#2#3{%
- \begingroup%
- \def\@tempa{#1}%
-% \end{macrocode}
-% In order to ensure empty references end up in the right place when
-% sorting lists of multiple references, we make the comparison macro
-% sort them before a non-empty reference.
-% \begin{macrocode}
- \ifx\@tempa\@empty%
- \def\cref@result{1}%
- \else%
- \def\@tempa{#2}%
- \ifx\@tempa\@empty%
- \def\cref@result{2}%
- \else%
-% \end{macrocode}
-% Conversely, undefined references come after everything else.
-% \begin{macrocode}
- \expandafter\ifx\csname r@#1@cref\endcsname\relax%
- \def\cref@result{2}%
- \else%
- \expandafter\ifx\csname r@#2@cref\endcsname\relax%
- \def\cref@result{1}%
- \else%
-% \end{macrocode}
-% If both references are non-empty and are defined, we compare their page
-% numbers.
-% \begin{macrocode}
- \cref@getpageref{#1}{\@tempa}%
- \cref@getpageref{#2}{\@tempb}%
- \ifnum\@tempa<\@tempb\relax%
- \def\cref@result{1}\relax%
- \else%
- \ifnum\@tempa>\@tempb\relax%
- \def\cref@result{2}\relax%
- \else%
- \def\cref@result{0}\relax%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \expandafter\endgroup\expandafter%
- \chardef\expandafter#3\expandafter=\cref@result\relax}%
-% \end{macrocode}
-% \end{macro}
%
% \begin{macro}{\if@cref@inresetlist}
% \begin{macro}{\cref@isinresetlist}
@@ -2833,22 +3013,18 @@
% If counter in question is |subfigure| or |subtable|, check if it's
% reset by |figure| or |table|, respectively.
% \begin{macrocode}
- \def\@tempa{#1}%
- \def\@tempb{subfigure}%
- \ifx\@tempa\@tempb%
+ \cref@ifstreq{#1}{subfigure}{%
\cref@isinresetlist{#1}{figure}%
\if@cref@inresetlist%
\def#2{figure}%
\fi%
- \fi%
- \def\@tempa{#1}%
- \def\@tempb{subtable}%
- \ifx\@tempa\@tempb%
+ }{}%
+ \cref@ifstreq{#1}{subtable}{%
\cref@isinresetlist{#1}{table}%
\if@cref@inresetlist%
\def#2{table}%
\fi%
- \fi%
+ }{}%
% \end{macrocode}
% If counter in question is |equation|, and the counter |parentequation|
% is defined, check if it's reset by that. The |parentequation| counter
@@ -2861,66 +3037,30 @@
% implement amsmath's |subequations| environment (are there any?).
% \begin{macrocode}
\@ifundefined{cl@parentequation}{}{%
- \def\@tempa{#1}%
- \def\@tempb{equation}%
- \ifx\@tempa\@tempb%
+ \cref@ifstreq{#1}{equation}{%
\cref@isinresetlist{#1}{parentequation}%
\if@cref@inresetlist%
\expandafter\ifnum\c@parentequation=0\else%
\def#2{parentequation}%
\fi%
\fi%
- \fi}%
+ }{}}%
% \end{macrocode}
-% If counter in question is |enum|\meta{x}, check if it's reset by a
-% higher-level |enum|\meta{x}.
+% \LaTeX{} hard-codes resetting of |enum|\meta{x} counters by
+% higher-level |enum|\meta{x} counters, so we hard-code the results for
+% these cases.
% \begin{macrocode}
- \def\@tempa{#1}%
- \def\@tempb{enumii}%
- \ifx\@tempa\@tempb%
- \def#2{enum}%
- \fi%
- \def\@tempb{enumiii}%
- \ifx\@tempa\@tempb%
- \def#2{enum}%
- \fi%
- \def\@tempb{enumiv}%
- \ifx\@tempa\@tempb%
- \def#2{enum}%
- \fi%
- \def\@tempb{enumv}%
- \ifx\@tempa\@tempb%
- \def#2{enum}%
- \fi%
- \def\@tempb{enum}%
- \ifx#2\@tempb%
- \cref@isinresetlist{#1}{enumiv}%
- \if@cref@inresetlist%
- \def#2{enumiv}%
- \else%
- \cref@isinresetlist{#1}{enumiii}%
- \if@cref@inresetlist%
+ \cref@ifstreq{#1}{enumii}{%
+ \def#2{enumi}%
+ }{%
+ \cref@ifstreq{#1}{enumiii}{%
+ \def#2{enumii}%
+ }{%
+ \cref@ifstreq{#1}{enumiv}{%
\def#2{enumiii}%
- \else%
- \cref@isinresetlist{#1}{enumii}%
- \if@cref@inresetlist%
- \def#2{enumii}%
- \else%
- \cref@isinresetlist{#1}{enumi}%
- \if@cref@inresetlist%
- \def#2{enumi}%
- \else%
- \cref@isinresetlist{#1}{part}%
- \if@cref@inresetlist%
- \def#2{part}%
- \else%
- \let#2\relax%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
+ }{}%
+ }%
+ }%
% \end{macrocode}
% If we haven't found anything so far, check if it's reset by a
% sectioning command.
@@ -2965,252 +3105,158 @@
%
% \begin{macro}{\if@cref@refconsecutive}
% \begin{macro}{\cref@isrefconsecutive}
+% \begin{macro}{\cpageref@isrefconsecutive}
% Define a new conditional to test whether two references are
-% consecutive (needed when typesetting reference ranges). This uses
-% the counter and prefix (i.e.\ formatted version of the counter that
-% resets the label's counter) information provided by
+% consecutive (needed when compressing references and typesetting
+% reference ranges). This uses the counter and prefix (i.e.\ chain of
+% counters that reset the reference's counter) information provided by
% \cmd{\r@\meta{label}@cref} (via the \file{aux} file) to check if the
% prefixes are identical (i.e.\ the references come from the same
% chapter, section or whatever), and that the label counters differ
-% by~0 or~1.
+% by~0 or~1. \cmd{\cref@isrefconsecutive} tests the references
+% themselves, \cmd{\cpageref@isrefconsecutve} tests their page numbers.
% \begin{macrocode}
\newif\if@cref@refconsecutive%
-\def\cref@isrefconsecutive#1#2{%
+\def\cref@isrefconsecutive{\@cref@isrefconsecutive{cref}}%
+\def\cpageref@isrefconsecutive{\@cref@isrefconsecutive{cpageref}}%
+\def\@cref@isrefconsecutive#1#2#3{%
\begingroup%
- \countdef\refa@counter=0%
- \countdef\refb@counter=1%
- \cref@getcounter{#1}{\cref@result}%
- \refa@counter=\cref@result%
- \cref@getcounter{#2}{\cref@result}%
- \refb@counter=\cref@result%
- \cref@getprefix{#1}{\refa@prefix}%
- \cref@getprefix{#2}{\refb@prefix}%
- \def\@after{\@cref@refconsecutivefalse}%
- \ifx\refa@prefix\refb@prefix%
- \ifnum\refa@counter=\refb@counter\relax%
- \def\@after{\@cref@refconsecutivetrue}%
- \else%
- \advance\refa@counter 1\relax%
+ \def\@after{\@cref@refconsecutivefalse}%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax\else%
+ \expandafter\ifx\csname r@#3@cref\endcsname\relax\else%
+ \countdef\refa@counter=0%
+ \countdef\refb@counter=1%
+ \csname #1@getcounter\endcsname{#2}{\cref@result}%
+ \refa@counter=\cref@result%
+ \csname #1@getcounter\endcsname{#3}{\cref@result}%
+ \refb@counter=\cref@result%
+ \csname #1@getprefix\endcsname{#2}{\refa@prefix}%
+ \csname #1@getprefix\endcsname{#3}{\refb@prefix}%
+ \ifx\refa@prefix\refb@prefix%
\ifnum\refa@counter=\refb@counter\relax%
\def\@after{\@cref@refconsecutivetrue}%
+ \else%
+ \advance\refa@counter 1\relax%
+ \ifnum\refa@counter=\refb@counter\relax%
+ \def\@after{\@cref@refconsecutivetrue}%
+ \fi%
\fi%
\fi%
\fi%
+ \fi%
\expandafter\endgroup\@after}%
% \end{macrocode}
% \end{macro}
% \end{macro}
-%
-% \begin{macro}{\cref@ispagerefconsecutive}
-% Similarly, define a test for whether two page references are
-% consecutive (needed when typesetting page ranges). We use the same
-% |\if@cref@refconsecutive| conditional as above.
-% \begin{macrocode}
-\def\cref@ispagerefconsecutive#1#2{%
- \begingroup%
- \countdef\refa@counter=0%
- \countdef\refb@counter=1%
- \cref@getpageref{#1}{\cref@result}%
- \refa@counter=\cref@result%
- \cref@getpageref{#2}{\cref@result}%
- \refb@counter=\cref@result%
- \def\@after{\@cref@refconsecutivefalse}%
- \ifnum\refa@counter=\refb@counter\relax%
- \def\@after{\@cref@refconsecutivetrue}%
- \else%
- \advance\refa@counter 1\relax%
- \ifnum\refa@counter=\refb@counter\relax%
- \def\@after{\@cref@refconsecutivetrue}%
- \fi%
- \fi%
- \expandafter\endgroup\@after}%
-% \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Reference stack processing}
% \begin{macro}{\cref@processgroup}
% \cmd{\cref@processgroup} processes the first group of references from
-% the stack passed in argument |#1|, by moving references to the stack
-% passed in argument |#2| until it encounters a reference that has a
+% the stack passed in argument |#2|, by moving references to the stack
+% passed in argument |#3| until it encounters a reference that has a
% different type to those that came before. Note that empty references
-% are treated as having the same type as the preceding one.
-% \begin{macrocode}
-\def\cref@processgroup#1#2{%
- \edef\@nextref{\cref@stack@top{#1}}%
- \expandafter\ifx\csname r@\@nextref @cref\endcsname\relax%
- \def\@grouptype{\@undefined}%
- \def\@groupformat{\@undefined}%
- \else%
- \expandafter\cref@gettype\expandafter{\@nextref}{\@grouptype}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@groupformat%
- \expandafter\expandafter\expandafter{%
- \csname cref@\@grouptype @format\endcsname%
- {\@dummya}{\@dummyb}{\@dummyc}}%
- \fi%
- \let\@nexttype\@grouptype%
- \let\@nextformat\@groupformat%
-%
- \@whilesw\ifx\@nextformat\@groupformat\fi{%
- \expandafter\cref@stack@pull\expandafter{\@nextref}{#2}%
- \cref@stack@pop{#1}%
- \cref@isstackempty{#1}%
+% are treated as having the same type as the preceding one. If argument
+% |#1| is |cref| it processes references, it it's |cpageref| it
+% processes page references.
+% \begin{macrocode}
+\def\cref@processgroup#1#2#3{%
+ \cref@stack@dropempty{#2}%
+ \edef\@firstref{\cref@stack@top{#2}}%
+ \let\@nextref\@firstref%
+ \cref@isrefsametypetrue%
+ \@whilesw\if@cref@sametype\fi{%
+ \expandafter\cref@stack@pull\expandafter{\@nextref}{#3}%
+ \cref@stack@pop{#2}%
+ \cref@isstackempty{#2}%
\if@cref@stackempty%
- \let\@nexttype\relax%
- \let\@nextformat\relax%
+ \@cref@sametypefalse%
\else%
- \edef\@nextref{\cref@stack@top{#1}}%
+ \edef\@nextref{\cref@stack@top{#2}}%
\ifx\@nextref\@empty%
- \let\@nexttype\@grouptype%
- \let\@nextforamt\@groupformat%
+ \@cref@sametypetrue%
\else%
- \expandafter\ifx\csname r@\@nextref @cref\endcsname\relax%
- \def\@nexttype{\@undefined}%
- \def\@nextformat{\@undefined}%
- \else%
- \expandafter\cref@gettype\expandafter%
- {\@nextref}{\@nexttype}%
- \def\@tempa{\@undefined}%
- \ifx\@nexttype\@tempa%
- \def\@nextformat{\@undefined}%
- \else%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@nextformat%
- \expandafter\expandafter\expandafter{%
- \csname cref@\@nexttype @format\endcsname%
- {\@dummya}{\@dummyb}{\@dummyc}}%
- \fi%
- \fi%
+ \csname #1@isrefsametype\endcsname{\@firstref}{\@nextref}%
\fi%
- \fi}%
-}%
+ \fi}}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cref@processgroupall}
% \cmd{\cref@processgroupall} processes the first group of references
-% from the stack passed in argument |#1|, by moving all references with
+% from the stack passed in argument |#2|, by moving all references with
% the same type as the first one into the stack passed in argument
-% |#2|.
+% |#3|. If argument |#1| is |cref| it processes references, if it's
+% |cpageref| it processes page references.
% \begin{macrocode}
-\def\cref@processgroupall#1#2{%
+\def\cref@processgroupall#1#2#3{%
\cref@stack@init{\@tempstack}%
- \edef\@nextref{\cref@stack@top{#1}}%
- \expandafter\ifx\csname r@\@nextref @cref\endcsname\relax%
- \def\@grouptype{\@undefined}%
- \def\@groupformat{\@undefined}%
- \else%
- \expandafter\cref@gettype\expandafter{\@nextref}{\@grouptype}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@groupformat%
- \expandafter\expandafter\expandafter{%
- \csname cref@\@grouptype @format\endcsname%
- {\@dummya}{\@dummyb}{\@dummyc}}%
- \fi%
- \let\@lasttype\@grouptype%
- \let\@lastformat\@groupformat%
- \cref@isstackfull{#1}%
-%
+ \cref@stack@dropempty{#2}%
+ \edef\@firstref{\cref@stack@top{#2}}%
+ \cref@isstackfull{#2}%
\@whilesw\if@cref@stackfull\fi{%
- \edef\@nextref{\cref@stack@top{#1}}%
+ \edef\@nextref{\cref@stack@top{#2}}%
\ifx\@nextref\@empty%
- \ifx\@lastformat\@groupformat%
- \let\@nexttype\@grouptype%
- \let\@nextformat\@groupformat%
- \else%
- \let\@nexttype\relax%
- \let\@nextformat\relax%
- \fi%
+ \expandafter\cref@stack@pull\expandafter{\@nextref}{#3}%
\else%
- \expandafter\ifx\csname r@\@nextref @cref\endcsname\relax%
- \def\@nexttype{\@undefined}%
- \def\@nextformat{\@undefined}%
+ \edef\@tempa{{\@firstref}{\@nextref}}%
+ \csname #1@isrefsametype\expandafter\endcsname\@tempa%
+ \if@cref@sametype%
+ \expandafter\cref@stack@pull\expandafter{\@nextref}{#3}%
\else%
- \expandafter\cref@gettype\expandafter%
- {\@nextref}{\@nexttype}%
- \def\@tempa{\@undefined}%
- \ifx\@nexttype\@tempa%
- \def\@nextformat{\@undefined}%
- \else%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@nextformat%
- \expandafter\expandafter\expandafter{%
- \csname cref@\@nexttype @format\endcsname%
- {\@dummya}{\@dummyb}{\@dummyc}}%
- \fi%
+ \expandafter\cref@stack@pull\expandafter{\@nextref}{\@tempstack}%
\fi%
\fi%
-%
- \ifx\@nextformat\@groupformat%
- \expandafter\cref@stack@pull\expandafter{\@nextref}{#2}%
- \else%
- \expandafter\cref@stack@pull\expandafter{\@nextref}{\@tempstack}%
- \fi%
- \cref@stack@pop{#1}%
- \let\@lasttype\@nexttype%
- \let\@lastformat\@nextformat%
- \cref@isstackfull{#1}}%
- \let#1\@tempstack}%
+ \cref@stack@pop{#2}%
+ \cref@isstackfull{#2}}%
+ \let#2\@tempstack}%
% \end{macrocode}
% \end{macro}
%
+%
% \begin{macro}{\cref@processconsecutive}
% \cmd{\cref@processconsecutive} processes the first sequence of
-% consecutive references from the stack passed in |#1|, sets the macro
-% passed as |#2| to the first reference in the sequence, sets |#3| to
-% the last reference, and sets the counter passed in |#4| to the number
-% of consecutive references in the sequence.
+% consecutive references from the stack passed in |#2|, sets the macro
+% passed as |#3| to the first reference in the sequence, sets |#4| to
+% the last reference, and sets the counter passed in |#5| to the number
+% of consecutive references in the sequence. If argument |#1| is |cref|
+% it processes references, if it's |cpageref| it processes page
+% references.
% \begin{macrocode}
\def\cref@processconsecutive#1#2#3#4#5{%
- #4=0%
- \edef\@nextref{\cref@stack@top{#1}}%
- \cref@stack@pop{#1}%
% \end{macrocode}
-% If stack only contains one reference, set appropriate return values.
+% Initialise return values to those appropriate for a single reference.
% \begin{macrocode}
- \cref@isstackempty{#1}%
- \if@cref@stackempty%
- \edef#2{\@nextref}%
- \let#3\relax%
- #4=1\relax%
+ \let#4\relax%
+ #5=1\relax%
+ \edef\@nextref{\cref@stack@top{#2}}%
+ \edef#3{\@nextref}%
+ \cref@stack@pop{#2}%
+ \cref@isstackfull{#2}%
% \end{macrocode}
% If stack contains multiple references, find end of consecutive references.
% \begin{macrocode}
- \else%
- \edef#2{\@nextref}%
- \let#3\relax%
- \edef\@nextref{\cref@stack@top{#1}}%
- #4=1\relax%
- \expandafter\ifx\csname r@#2@cref\endcsname\relax%
+ \if@cref@stackfull%
+ \edef\@nextref{\cref@stack@top{#2}}%
+ \expandafter\ifx\csname r@#3@cref\endcsname\relax%
\@cref@refconsecutivefalse%
\else%
% \end{macrocode}
-% If next reference in substack is empty, it indicates that no
+% If next reference in stack is empty, it indicates that no
% further compression should take place. Having served its purpose,
% the empty reference and any consecutive empty references are
% removed from the stack.
% \begin{macrocode}
\ifx\@nextref\@empty%
\@cref@refconsecutivefalse%
- \@whilesw\ifx\@nextref\@empty\fi{%
- \cref@stack@pop{#1}%
- \cref@isstackempty{#1}%
- \if@cref@stackempty%
- \let\@nextref\relax%
- \else%
- \edef\@nextref{\cref@stack@top{#1}}%
- \fi}%
+ \cref@stack@dropempty{#2}%
% \end{macrocode}
% Otherwise, test whether next reference is consecutive or not.
% \begin{macrocode}
\else%
- \expandafter\ifx\csname r@\@nextref @cref\endcsname\relax%
- \@cref@refconsecutivefalse%
- \else%
- \edef\@tempa{{#2}{\@nextref}}%
- \expandafter#5\@tempa%
- \fi%
+ \edef\@tempa{{#3}{\@nextref}}%
+ \csname #1@isrefconsecutive\expandafter\endcsname\@tempa%
\fi%
\fi%
% \end{macrocode}
@@ -3218,14 +3264,14 @@
% sequence.
% \begin{macrocode}
\@whilesw\if@cref@refconsecutive\fi{%
- \advance#4 1%
- \let#3\@nextref%
- \cref@stack@pop{#1}%
- \cref@isstackempty{#1}%
+ \advance#5 1\relax%
+ \let#4\@nextref%
+ \cref@stack@pop{#2}%
+ \cref@isstackempty{#2}%
\if@cref@stackempty%
\@cref@refconsecutivefalse%
\else%
- \edef\@nextref{\cref@stack@top{#1}}%
+ \edef\@nextref{\cref@stack@top{#2}}%
% \end{macrocode}
% If next reference is empty, remove any consecutive empty
% references and we're done.
@@ -3233,23 +3279,19 @@
\ifx\@nextref\@empty%
\@cref@refconsecutivefalse%
\@whilesw\ifx\@nextref\@empty\fi{%
- \cref@stack@pop{#1}%
- \cref@isstackempty{#1}%
+ \cref@stack@pop{#2}%
+ \cref@isstackempty{#2}%
\if@cref@stackempty%
\let\@nextref\relax%
\else%
- \edef\@nextref{\cref@stack@top{#1}}%
+ \edef\@nextref{\cref@stack@top{#2}}%
\fi}%
% \end{macrocode}
% Otherwise, test whether next reference is consecutive or not.
% \begin{macrocode}
\else%
- \expandafter\ifx\csname r@\@nextref @cref\endcsname\relax%
- \@cref@refconsecutivefalse%
- \else%
- \edef\@tempa{{#3}{\@nextref}}%
- \expandafter#5\@tempa%
- \fi%
+ \edef\@tempa{{#4}{\@nextref}}%
+ \csname #1@isrefconsecutive\expandafter\endcsname\@tempa%
\fi%
\fi}%
\fi}%
@@ -3272,14 +3314,14 @@
\let\cref@acc\@empty%
\@crefstripprefix%
\cref@result%
- \endgroup}
+ \endgroup}%
% \end{macrocode}
% \end{macro}
%
% The real work is done by the recursive \cmd{\@crefstripprefix} macro,
% which compares characters one-by-one (accumulating runs of the same
% type of character -- digit or letter as it goes). It removes matching
-% characters them from the strings, and outputs the remaining characters
+% characters from the strings, and outputs the remaining characters
% from the second string (plus any accumulated characters of the same
% type) when it encounters the first non-matching character;
% \begin{macrocode}
@@ -3341,7 +3383,7 @@
\fi%
\edef\cref@result{\cref@acc\@tempb\@toksb}%
\fi%
- \@iterate}
+ \@iterate}%
% \end{macrocode}
%
% \begin{macro}{\cref@poptok}
@@ -3357,9 +3399,9 @@
\expandafter\expandafter\expandafter\def%
\expandafter\expandafter\expandafter#1%
\expandafter\expandafter\expandafter{%
- \expandafter\@cref@poptok#1\@nil}}
-\def\@cref@firsttok#1#2\@nil{#1}
-\def\@cref@poptok#1#2\@nil{#2}
+ \expandafter\@cref@poptok#1\@nil}}%
+\def\@cref@firsttok#1#2\@nil{#1}%
+\def\@cref@poptok#1#2\@nil{#2}%
% \end{macrocode}
% \end{macro}
%
@@ -3376,8 +3418,8 @@
% \begin{macrocode}
\DeclareRobustCommand{\cref}[1]{\@cref{cref}{#1}}%
\DeclareRobustCommand{\Cref}[1]{\@cref{Cref}{#1}}%
-\DeclareRobustCommand{\crefrange}[2]{\@setcrefrange{#1}{#2}{cref}{}}%
-\DeclareRobustCommand{\Crefrange}[2]{\@setcrefrange{#1}{#2}{Cref}{}}%
+\DeclareRobustCommand{\crefrange}[2]{\@setcrefrange{#1}{#2}{}}%
+\DeclareRobustCommand{\Crefrange}[2]{\@setCrefrange{#1}{#2}{}}%
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -3411,6 +3453,14 @@
\def\@cref#1#2{%
\leavevmode%
\begingroup%
+ \def\cref@variant{#1}%
+ \def\@tempa{\in@{page}}%
+ \expandafter\@tempa\expandafter{\cref@variant}%
+ \ifin@%
+ \def\cref@variant@get{cpageref}%
+ \else%
+ \def\cref@variant@get{cref}%
+ \fi%
% \end{macrocode}
% Initialise some things, and put all the references into a stack called
% \cmd{\@refstack}. Note that we fully expand the second argument, in
@@ -3420,13 +3470,13 @@
\countdef\count@consecutive=0%
\countdef\count@group=1%
\count@group=1%
- \def\cref@variant{#1}%
- \newif\if@secondref%
+ \countdef\count@subgroup=2%
\cref@stack@init{\@refstack}%
\edef\@tempa{#2}%
\expandafter\cref@stack@push\expandafter{\@tempa}{\@refstack}%
\cref@isstackfull{\@refstack}%
% \end{macrocode}
+%
% Loop until the reference stack is empty.
% \begin{macrocode}
\@whilesw\if@cref@stackfull\fi{%
@@ -3435,17 +3485,20 @@
% \begin{macrocode}
\cref@stack@init{\@refsubstack}%
\if@cref@sort%
- \cref@processgroupall{\@refstack}{\@refsubstack}%
- \cref@stack@sort{\@refsubstack}{\cref@countercmp}%
+ \expandafter\cref@processgroupall\expandafter%
+ {\cref@variant@get}{\@refstack}{\@refsubstack}%
+ \expandafter\cref@stack@sort\expandafter%
+ {\csname\cref@variant@get @countercmp\endcsname}{\@refsubstack}%
\else%
- \cref@processgroup{\@refstack}{\@refsubstack}%
+ \expandafter\cref@processgroup\expandafter%
+ {\cref@variant@get}{\@refstack}{\@refsubstack}%
\fi%
% \end{macrocode}
%
-% typeset appropriate conjunction between groups of reference types.
+% Typeset appropriate conjunction between groups of reference types.
% \begin{macrocode}
\ifnum\count@group=1\relax%
- \advance\count@group 1%
+ \advance\count@group 1\relax%
\else%
\cref@isstackfull{\@refstack}%
\if@cref@stackfull%
@@ -3457,151 +3510,99 @@
\@setcref@lastgroupconjunction%
\fi%
\fi%
- \advance\count@group 1%
- \def\cref@variant{cref}%
+ \advance\count@group 1\relax%
+ \lowercase{\def\cref@variant{#1}}%
\fi%
% \end{macrocode}
%
-% Process first group of consecutive references.
+% Process groups of consecutive references until substack is empty.
% \begin{macrocode}
- \if@cref@compress%
- \cref@processconsecutive%
- {\@refsubstack}{\@beginref}{\@endref}{\count@consecutive}%
- {\cref@isrefconsecutive}%
- \else%
- \edef\@beginref{\cref@stack@top{\@refsubstack}}%
- \cref@stack@pop{\@refsubstack}%
-% \end{macrocode}
-% Empty references serve no purpose when we're not compressing
-% consecutive references, so we simply remove them.
-% \begin{macrocode}
- \@whilesw\ifx\@beginref\@empty\fi{%
- \cref@stack@pop{\@refsubstack}%
- \cref@isstackempty{\@refsubstack}%
- \if@cref@stackempty%
- \let\@beginref\relax%
- \else%
- \edef\@beginref{\cref@stack@top{\@refsubstack}}%
- \fi}%
- \let\@endref\relax%
- \count@consecutive=1\relax%
- \fi%
+ \count@subgroup=1%
+ \cref@isstackfull{\@refsubstack}%
+ \@whilesw\if@cref@stackfull\fi{%
+ \if@cref@compress%
+ \expandafter\cref@processconsecutive\expandafter{\cref@variant@get}%
+ {\@refsubstack}{\@beginref}{\@endref}{\count@consecutive}%
% \end{macrocode}
-% If there were no consecutive references, typeset the first reference;
+% Empty references serve no purpose when we're not compressing, so we
+% simply remove them and process the first non-empty reference..
% \begin{macrocode}
- \ifnum\count@consecutive=1\relax%
- \cref@isstackfull{\@refsubstack}%
- \if@cref@stackfull%
- \expandafter\@setcref%
- \expandafter{\@beginref}{\cref@variant}{@first}%
\else%
- \expandafter\@setcref%
- \expandafter{\@beginref}{\cref@variant}{}%
+ \cref@stack@dropempty{\@refsubstack}%
+ \edef\@beginref{\cref@stack@top{\@refsubstack}}%
+ \cref@stack@pop{\@refsubstack}%
+ \let\@endref\relax%
+ \count@consecutive=1\relax%
\fi%
% \end{macrocode}
-% if there were only two consecutive references, typeset the first one
-% and return the second to the substack (we add an empty reference
-% after it just to make sure there's no further compression);
-% \begin{macrocode}
- \else%
- \ifnum\count@consecutive=2\relax%
- \expandafter\@setcref%
- \expandafter{\@beginref}{\cref@variant}{@first}%
- \expandafter\cref@stack@push\expandafter%
- {\@endref,}{\@refsubstack}%
-% \end{macrocode}
-% otherwise, typeset a reference range.
+% If the start and end labels are identical, treat it as a single
+% reference instead of a range
% \begin{macrocode}
- \else%
- \edef\@tempa{{\@beginref}{\@endref}}%
- \if@cref@stackempty%
- \expandafter\@setcrefrange\@tempa{\cref@variant}{}%
- \else%
- \expandafter\@setcrefrange\@tempa{\cref@variant}{@first}%
+ \ifnum\count@consecutive>1\relax%
+ \csname\cref@variant@get @getlabel\endcsname{\@beginref}{\@labela}%
+ \csname\cref@variant@get @getlabel\endcsname{\@endref}{\@labelb}%
+ \ifx\@labela\@labelb%
+ \let\@endref\relax%
+ \count@consecutive=1\relax%
\fi%
\fi%
- \fi%
% \end{macrocode}
-%
-% Process further groups of consecutive references, until substack is
-% empty.
+% If there were only two consecutive references, keep the first one and
+% return the second one to the substack. (We add an empty reference after
+% it just to make sure there's no further compression.)
% \begin{macrocode}
- \@secondreftrue%
- \cref@isstackfull{\@refsubstack}%
- \@whilesw\if@cref@stackfull\fi{%
- \if@cref@compress%
- \cref@processconsecutive%
- {\@refsubstack}{\@beginref}{\@endref}{\count@consecutive}%
- {\cref@isrefconsecutive}%
- \else%
- \edef\@beginref{\cref@stack@top{\@refsubstack}}%
- \cref@stack@pop{\@refsubstack}%
-% \end{macrocode}
-% Empty references serve no purpose when we're not compressing
-% consecutive references, so we simply remove them.
-% \begin{macrocode}
- \@whilesw\ifx\@beginref\@empty\fi{%
- \cref@stack@pop{\@refsubstack}%
- \cref@isstackempty{\@refsubstack}%
- \if@cref@stackempty%
- \let\@beginref\relax%
- \else%
- \edef\@beginref{\cref@stack@top{\@refsubstack}}%
- \fi}%
+ \ifnum\count@consecutive=2\relax%
+ \expandafter\cref@stack@push\expandafter{\@endref,}{\@refsubstack}%
\let\@endref\relax%
\count@consecutive=1\relax%
\fi%
% \end{macrocode}
-% If the substack is now empty, we will need to typeset an ``end''
-% reference, otherwise we will need to typeset a ``middle''
-% reference.
+% Work out which type of reference we need to typeset.
% \begin{macrocode}
- \cref@isstackempty{\@refsubstack}%
- \if@cref@stackempty%
- \if@secondref%
- \def\@pos{@second}%
+ \cref@isstackfull{\@refsubstack}%
+ \if@cref@stackfull%
+ \ifnum\count@subgroup=1\relax%
+ \def\@pos{@first}%
\else%
- \def\@pos{@last}%
+ \def\@pos{@middle}%
\fi%
\else%
- \def\@pos{@middle}%
+ \ifnum\count@subgroup=1\relax%
+ \def\@pos{}%
+ \else%
+ \ifnum\count@subgroup=2\relax%
+ \def\@pos{@second}%
+ \else%
+ \def\@pos{@last}%
+ \fi%
+ \fi%
\fi%
% \end{macrocode}
-% If there were no consecutive references, just typeset the next
-% reference;
+% If there were no consecutive references, just typeset the next
+% reference;
% \begin{macrocode}
\ifnum\count@consecutive=1\relax%
- \edef\@tempa{{\@beginref}{cref}{\@pos}}%
- \expandafter\@setcref\@tempa%
- \else%
+ \edef\@tempa{{\@beginref}{\@pos}}%
+ \csname @set\cref@variant\expandafter\endcsname\@tempa%
% \end{macrocode}
-% if there were only two consecutive references, typeset the first
-% one, and return the second one to the substack,
+% otherwise, typeset a reference range.
% \begin{macrocode}
- \ifnum\count@consecutive=2\relax%
- \expandafter\@setcref\expandafter%
- {\@beginref}{cref}{@middle}%
- \expandafter\cref@stack@push\expandafter%
- {\@endref}{\@refsubstack}%
-% \end{macrocode}
-% otherwise, typeset a reference range.
-% \begin{macrocode}
- \else%
- \edef\@tempa{{\@beginref}{\@endref}{cref}{\@pos}}%
- \expandafter\@setcrefrange\@tempa%
- \fi%
+ \else%
+ \edef\@tempa{{\@beginref}{\@endref}{\@pos}}%
+ \csname @set\cref@variant range\expandafter\endcsname\@tempa%
\fi%
- \@secondreffalse%
+ \advance\count@subgroup 1\relax%
\cref@isstackfull{\@refsubstack}%
}% end loop over reference substack
\cref@isstackfull{\@refstack}%
% \end{macrocode}
-% If we're typesetting a \cmd{\labelcref} reference and references in
-% stack have different types, throw a warning and stop processing.
+%
+% If we're typesetting a \cmd{\labelcref} reference and references in
+% stack have different types, throw a warning and stop processing.
% \begin{macrocode}
\if@cref@stackfull%
- \def\@tempa{#1}\def\@tempb{labelcref}%
- \ifx\@tempa\@tempb\relax%
+ \def\@tempa{labelcref}%
+ \ifx\cref@variant\@tempa%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries\space ??}%
\@latex@warning{References in label reference on page \thepage
@@ -3616,116 +3617,139 @@
%
%
% \begin{macro}{\@setcref}
-% The internal \cmd{\@setcref} macro deals with actually typesetting
-% the reference, by calling the appropriate type-dependent formatting
-% macro defined by \cmd{\crefformat} etc. |#1| contains the reference
-% itself, |#2| is either ``cref'' or ``Cref'' and determines the
-% capitalisation variant, and |#3| is either empty or one of
-% ``@second'', ``@middle'' or ``@last'', determining the type of
-% reference group to typeset.
-% \begin{macrocode}
-\def\@setcref#1#2#3{%
- \expandafter\ifx\csname r@#1@cref\endcsname\relax%
+% \begin{macro}{\@setCref}
+% \begin{macro}{\@setlavelcref}
+% \begin{macro}{\@@setcref}
+% The \cmd{\@setcref}, \cmd{\@setCref} and \cmd{\@setlabelcref} macros
+% are called as appropriate by \cmd{\@cref} to typeset a reference.
+% These macros just turn the |cref|, |Cref| or |labelcref| variant into
+% a macro argument and pass it along to \cmd{\@@setcref}, which deals
+% with actually typesetting the reference by calling the appropriate
+% type-dependent formatting macro defined by \cmd{\crefformat} etc.
+% \cmd{\@@setcref} takes three arguments. |#1| is the variant passed
+% along by |\@set|\meta{x}|ref|. |#2| contains the reference itself.
+% |#3| is either empty or one of ``@second'', ``@middle'' or ``@last'',
+% determining the type of reference group to typeset.
+% \begin{macrocode}
+\def\@setcref{\@@setcref{cref}}%
+\def\@setCref{\@@setcref{Cref}}%
+\def\@setlabelcref{\@@setcref{labelcref}}%
+\def\@@setcref#1#2#3{%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries ??}%
- \@latex@warning{Reference `#1' on page \thepage \space undefined}%
+ \@latex@warning{Reference `#2' 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%
+ \cref@gettype{#2}{\@temptype}% puts label type in \@temptype
+ \cref@getlabel{#2}{\@templabel}% puts label in \@templabel
+ \expandafter\ifx\csname #1@\@temptype @format#3\endcsname\relax%
% \end{macrocode}
% If reference format is undefined, but we're typesetting a
% \cmd{\labelcref}, fall back to default \cmd{\labelcref} format.
% \begin{macrocode}
- \edef\@tempa{#2}\def\@tempb{labelcref}%
+ \edef\@tempa{#1}\def\@tempb{labelcref}%
\ifx\@tempa\@tempb\relax%
- \expandafter\@@setcref\expandafter%
- {\csname #2@default@format#3\endcsname}{#1}%
+ \expandafter\@@@setcref\expandafter%
+ {\csname #1@default@format#3\endcsname}{#2}%
\else%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries ??}~\@templabel%
- \@latex@warning{#2 \space reference format for label type
+ \@latex@warning{#1\space reference format for label type
`\@temptype' undefined}%
\fi%
\else%
- \expandafter\@@setcref\expandafter%
- {\csname #2@\@temptype @format#3\endcsname}{#1}%
+ \expandafter\@@@setcref\expandafter%
+ {\csname #1@\@temptype @format#3\endcsname}{#2}%
\fi%
\fi}%
% \end{macrocode}
% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
-% \begin{macro}{\@@setcref}
+% \begin{macro}{\@@@setcref}
% We separate out the very final typesetting step into a separate
% macro, in order to make it easier to redefine things later to make
% them work with the \package{hyperref} package.
% \begin{macrocode}
-\def\@@setcref#1#2{\cref@getlabel{#2}{\@templabel}#1{\@templabel}{}{}}%
+\def\@@@setcref#1#2{\cref@getlabel{#2}{\@templabel}#1{\@templabel}{}{}}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@setcrefrange}
-% The internal \cmd{\@setcrefrange} macro deals with typesetting
-% reference ranges, just as \cmd{\@setcref} does for normal
-% references. The actual typesetting is no more complicated in the
-% range case; it's the error checking that makes the code so much
+% \begin{macro}{\@setCrefrange}
+% \begin{macro}{\@setlabelcrefrange}
+% \begin{macro}{\@@setcrefrange}
+% The \cmd{\@setcrefrange}, \cmd{\@setCrefrange} and
+% \cmd{\@setlabelrefrange} macros are called as appropriate by
+% \cmd{\@cref} to typeset a reference. The internal
+% \cmd{\@@setcrefrange} macro deals with actually typesetting reference
+% ranges, and takes four arguments. |#1| is the variant passed along by
+% |\@set|\meta{x}|ref|. |#2| and |#3| contains the references
+% themselves. |#4| is either empty or one of ``@second'', ``@middle''
+% or ``@last'', determining the type of reference group to typeset.
+%
+% The actual typesetting is no more complicated than in the
+% \cmd{\@@setcref} case; it's the error checking that makes the code
% longer. We now have to check whether \emph{two} references are
% undefined, whether \emph{two} reference formats are undefined,
% whether the reference types are consistent, and also combinations of
% these various errors.
% \begin{macrocode}
-\def\@setcrefrange#1#2#3#4{%
+\def\@setcrefrange{\@@setcrefrange{cref}}%
+\def\@setCrefrange{\@@setcrefrange{Cref}}%
+\def\@setlabelcrefrange{\@@setcrefrange{labelcref}}%
+\def\@@setcrefrange#1#2#3#4{%
\begingroup%
% \end{macrocode}
% Check if both references are defined.
% \begin{macrocode}
- \expandafter\ifx\csname r@#1@cref\endcsname\relax%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax%
\protect\G@refundefinedtrue%
- \@latex@warning{Reference `#1' on page \thepage \space%
+ \@latex@warning{Reference `#2' on page \thepage \space%
undefined}%
- \expandafter\ifx\csname r@#2@cref\endcsname\relax%
+ \expandafter\ifx\csname r@#3@cref\endcsname\relax%
\nfss@text{\reset@font\bfseries ??}--%
\nfss@text{\reset@font\bfseries ??}%
- \@latex@warning{Reference `#2' on page \thepage \space%
+ \@latex@warning{Reference `#3' on page \thepage \space%
undefined}%
\else%
- \cref@getlabel{#2}{\@labelb}%
+ \cref@getlabel{#3}{\@labelb}%
\nfss@text{\reset@font\bfseries ??}--\@labelb%
\fi%
\else%
- \expandafter\ifx\csname r@#2@cref\endcsname\relax%
+ \expandafter\ifx\csname r@#3@cref\endcsname\relax%
\protect\G@refundefinedtrue%
- \cref@getlabel{#1}{\@labela}%
+ \cref@getlabel{#2}{\@labela}%
\@labela--\nfss@text{\reset@font\bfseries ??}%
- \@latex@warning{Reference `#2' on page \thepage %
+ \@latex@warning{Reference `#3' on page \thepage %
\space undefined}%
% \end{macrocode}
% If both references are defined, check that the reference format is
% defined.
% \begin{macrocode}
\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%
+ \cref@gettype{#2}{\@typea}%
+ \cref@gettype{#3}{\@typeb}%
+ \cref@getlabel{#2}{\@labela}%
+ \cref@getlabel{#3}{\@labelb}%
+ \edef\@format{\expandafter\noexpand%
+ \csname #1range@\@typea @format#4\endcsname}%
+ \expandafter\ifx\@format\relax%
% \end{macrocode}
% If reference format is undefined, but we're typesetting a
% \cmd{\labelcref}, fall back to default \cmd{\labelcref}
% formats.
% \begin{macrocode}
- \edef\@tempa{#3}\def\@tempb{labelcref}%
+ \edef\@tempa{#1}\def\@tempb{labelcref}%
\ifx\@tempa\@tempb\relax%
- \expandafter\@@setcrefrange\expandafter%
- {\csname #3range@default@format#4\endcsname}{#1}{#2}%
+ \expandafter\@@@setcrefrange\expandafter%
+ {\csname #1range@default@format#4\endcsname}{#2}{#3}%
\else%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries ??}~\@labela--\@labelb%
- \@latex@warning{#3\space reference range format for label
+ \@latex@warning{#1 reference range format for label
type `\@typea' undefined}%
\fi%
\else%
@@ -3736,12 +3760,22 @@
% is defined, since if it isn't it will be caught here as a
% non-identical type.)
% \begin{macrocode}
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@formata%
+ \expandafter\expandafter\expandafter{%
+ \csname #1range@\@typea @format#4\endcsname%
+ {\@dummya}{\@dummyb}{\@dummyc}{\@dummyd}{\@dummye}{\@dummyf}}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@formatb%
+ \expandafter\expandafter\expandafter{%
+ \csname #1range@\@typeb @format#4\endcsname%
+ {\@dummya}{\@dummyb}{\@dummyc}{\@dummyd}{\@dummye}{\@dummyf}}%
\ifx\@formata\@formatb%
- \expandafter\@@setcrefrange\expandafter{\@formata}{#1}{#2}%
+ \expandafter\@@@setcrefrange\expandafter{\@format}{#2}{#3}%
\else%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries ??}~\@labela--\@labelb%
- \@latex@warning{References `#1' and `#2' in reference range
+ \@latex@warning{References `#2' and `#3' in reference range
on page \thepage \space have different types
`\@typea' and `\@typeb'}%
\fi%
@@ -3751,13 +3785,16 @@
\endgroup}%
% \end{macrocode}
% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
-% \begin{macro}{\@@setcrefrange}
+% \begin{macro}{\@@@setcrefrange}
% We again separate out the very final typesetting step into a
% separate macro, in order to make it easier to redefine things later
% to make them work with the \package{hyperref} package.
% \begin{macrocode}
-\def\@@setcrefrange#1#2#3{%
+\def\@@@setcrefrange#1#2#3{%
\cref@getlabel{#2}{\@labela}%
\cref@getlabel{#3}{\@labelb}%
#1{\@labela}{\@labelb}{}{}{}{}}%
@@ -3815,7 +3852,10 @@
%
% \begin{macro}{\@setnamecref}
% \cmd{\@setnamecref} is the real macro underlying all the
-% \cmd{\namecref} commands.
+% \cmd{\namecref} commands. |#1| is the capitalisation variant, |#2|
+% the reference, |#3| is either empty or |@plural| if the plural name
+% should be generated, and |#4| is either empty or contains
+% \cmd{\MakeLowercase} if a lower-cased name should be generated.
% \begin{macrocode}
\def\@setnamecref#1#2#3#4{%
\expandafter\ifx\csname r@#2@cref\endcsname\relax%
@@ -3831,17 +3871,17 @@
}{%
\edef\@tempa{%
\expandafter\noexpand\csname #1@\@tempa @name#3\endcsname}%
- \expandafter\@@setnamecref\expandafter{\@tempa}{#4}%
+ \expandafter\@@@setnamecref\expandafter{\@tempa}{#4}%
}%
\fi}%
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@setnamecref}
+% \begin{macro}{\@@@setnamecref}
% We again separate out the final typesetting step of the
% \cmd{\namecref} commands.
% \begin{macrocode}
-\def\@@setnamecref#1#2{%
+\def\@@@setnamecref#1#2{%
\expandafter\def\expandafter\@tempa\expandafter{#1}%
\expandafter#2\@tempa}%
% \end{macrocode}
@@ -3860,230 +3900,94 @@
% commands, and \cmd{\labelcpageref} (the counterpart to
% \cmd{\labelcref}).
% \begin{macrocode}
-\DeclareRobustCommand{\cpageref}[1]{%
- \@cpageref{cref}{#1}{\@setcpageref}{\@setcpagerefrange}}%
-\DeclareRobustCommand{\Cpageref}[1]{%
- \@cpageref{Cref}{#1}{\@setcpageref}{\@setcpagerefrange}}%
+\DeclareRobustCommand{\cpageref}[1]{\@cref{cpageref}{#1}}%
+\DeclareRobustCommand{\Cpageref}[1]{\@cref{Cpageref}{#1}}%
\DeclareRobustCommand{\cpagerefrange}[2]{%
- \@setcpagerefrange{#1}{#2}{cref}{}}%
+ \@@setcpagerefrange{#1}{#2}{cref}{}}%
\DeclareRobustCommand{\Cpagerefrange}[2]{%
- \@setcpagerefrange{#1}{#2}{Cref}{}}%
+ \@@setcpagerefrange{#1}{#2}{Cref}{}}%
\DeclareRobustCommand{\labelcpageref}[1]{%
- \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}}%
+ \@cref{labelcpageref}{#1}}%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\@cpageref}
-% The \cmd{\@cpageref} macro is the work-horse of the clever page
-% referencing features (analogous to the role of \cmd{\@cref} for
-% cross-references, though slightly simpler as it does not have to deal
-% with grouping references by type, all page references being
-% references to pages!). It deals with typesetting the conjunctions
-% between groups of page references, and any sorting and compressing of
-% the page references. |#1| contains the list of references, |#2| is
-% ``cref'' or ``Cref'' and determines the capitalisation variant, |#3|
-% and |#4| are the macros to use for typesetting page references and
-% page range references, respectively. (The \cmd{\cpageref} and
-% \cmd{\Cpageref} commands always set these to \cmd{\@setcpageref} and
-% \cmd{\@setcpagerangeref}; the \package{varioref} package support uses
-% these arguments to integrate the \package{cleveref} and
-% \package{varioref} page referencing features.)
-% \begin{macrocode}
-\def\@cpageref#1#2#3#4{%
- \leavevmode%
- \begingroup%
-% \end{macrocode}
-% Initialise some things, and put all the references into a stack called
-% \cmd{\@refstack}. Note that we fully expand the second argument, in
-% case it contains commands that \emph{expand to} label names, rather
-% than label names per se.
-% \begin{macrocode}
- \countdef\count@consecutive=0%
- \countdef\count@group=1%
- \countdef\@counta=2%
- \countdef\@countb=3%
- \count@group=0%
- \cref@stack@init{\@refstack}%
- \edef\@tempa{#2}%
- \expandafter\cref@stack@push\expandafter{\@tempa}{\@refstack}%
- \if@cref@sort%
- \cref@stack@sort{\@refstack}{\cref@pagecmp}%
- \fi%
-% \end{macrocode}
-% Loop until the reference stack is empty.
-% \begin{macrocode}
- \cref@isstackfull{\@refstack}%
- \@whilesw\if@cref@stackfull\fi{%
- \if@cref@compress%
- \cref@processconsecutive%
- {\@refstack}{\@beginref}{\@endref}{\count@consecutive}%
- {\cref@ispagerefconsecutive}%
- \else%
- \edef\@beginref{\cref@stack@top{\@refstack}}%
- \cref@stack@pop{\@refstack}%
-% \end{macrocode}
-% Empty references serve no purpose when we're not compressing
-% consecutive references, so we simply remove them.
-% \begin{macrocode}
- \@whilesw\ifx\@beginref\@empty\fi{%
- \cref@stack@pop{\@refstack}%
- \cref@isstackempty{\@refstack}%
- \if@cref@stackempty%
- \let\@beginref\relax%
- \else%
- \edef\@beginref{\cref@stack@top{\@refstack}}%
- \fi}%
- \let\@endref\relax%
- \count@consecutive=1\relax%
- \fi%
-% \end{macrocode}
-% If the start and end pages of a reference range are the same, treat it as
-% a single page reference instead of a page range. If start and end pages
-% of a reference range differ by 1, treat it as a pair of page references
-% instead of a range.
-% \begin{macrocode}
- \ifx\@endref\relax\else%
- \expandafter\ifx\csname r@\@beginref @cref\endcsname\relax\else%
- \expandafter\ifx\csname r@\@endref @cref\endcsname\relax\else%
- \cref@getpageref{\@beginref}{\@tempa}%
- \cref@getpageref{\@endref}{\@tempb}%
- \ifx\@tempa\@tempb\relax%
- \count@consecutive=1%
- \let\@endref\relax%
- \else%
- \@counta=\@tempa\relax%
- \@countb=\@tempb\relax%
- \advance\@counta 1\relax%
- \ifnum\@counta=\@countb\relax%
- \count@consecutive=2%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
-% \end{macrocode}
-% Determine whereabouts the current group of page references comes in the
-% overall list of page references.
-% \begin{macrocode}
- \cref@isstackempty{\@refstack}%
- \if@cref@stackempty%
- \ifcase\count@group\relax%
- \ifnum\count@consecutive=2\relax%
- \def\@pos{@first}%
- \else%
- \def\@pos{}%
- \fi%
- \or%
- \ifnum\count@consecutive=2\relax%
- \def\@pos{@middle}%
- \else%
- \def\@pos{@second}%
- \fi%
- \else%
- \def\@pos{@last}%
- \fi%
- \else%
- \ifnum\count@group=0\relax%
- \def\@pos{@first}%
- \else%
- \def\@pos{@middle}%
- \fi%
- \fi%
-% \end{macrocode}
-% If there were no consecutive references, just typeset the next
-% reference;
-% \begin{macrocode}
- \ifnum\count@consecutive=1\relax%
- \def\@tempa{#3}%
- \edef\@tempb{{\@beginref}{#1}{\@pos}}%
- \expandafter\@tempa\@tempb%
- \else%
-% \end{macrocode}
-% if there were only two consecutive references, typeset the first one
-% and return the second to the substack (we add an empty reference
-% after it just to make sure there's no further compression);
-% \begin{macrocode}
- \ifnum\count@consecutive=2\relax%
- \def\@tempa{#3}%
- \edef\@tempb{{\@beginref}{#1}{\@pos}}%
- \expandafter\@tempa\@tempb%
- \expandafter\cref@stack@push\expandafter%
- {\@endref,}{\@refstack}%
-% \end{macrocode}
-% otherwise, typeset a reference range.
-% \begin{macrocode}
- \else%
- \def\@tempa{#4}%
- \edef\@tempb{{\@beginref}{\@endref}{#1}{\@pos}}%
- \expandafter\@tempa\@tempb%
- \fi%
- \fi%
- \advance\count@group 1%
- \cref@isstackfull{\@refstack}%
- }% end loop over reference stack
- \endgroup}%
-% \end{macrocode}
-% \end{macro}
-%
-%
% \begin{macro}{\@setcpageref}
-% The internal \cmd{\@setcpageref} macro deals with actually typesetting
-% the page reference, by calling the appropriate type-dependent
-% formatting macro defined by \cmd{\crefformat} etc. |#1| contains the
-% reference itself, |#2| is either ``cref'' or ``Cref'' and determines
-% the capitalisation variant, and |#3| is either empty or one of
-% ``@second'', ``@middle'' or ``@last'', determining the type of
-% reference group to typeset.
-% \begin{macrocode}
-\def\@setcpageref#1#2#3{%
- \expandafter\ifx\csname r@#1@cref\endcsname\relax%
+% \begin{macro}{\@setCpageref}
+% \begin{macro}{\@setlabelcpageref}
+% \begin{macro}{\@@setcpageref}
+% The \cmd{\@setcpageref}, \cmd{\@setCpageref} and
+% \cmd{\@setlabelcpageref} macros are called as appropriate by
+% \cmd{\@cref} to typeset a page reference. These macros just turn the
+% |cref|, |Cref| or |labelcref| variant into a macro argument and pass
+% it along to \cmd{\@@setcpageref}, which deals with actually
+% typesetting the page reference by calling the appropriate page
+% reference formatting macro defined by \cmd{\crefformat}|{page}| etc.
+% \cmd{\@@setcpageref} takes four arguments. |#1| is the variant passed
+% along by |\@set|\meta{x}|pageref|. |#2| contains the reference
+% itself. |#3| is either empty or one of ``@second'', ``@middle'' or
+% ``@last'', determining the type of page reference group to typeset.
+% \begin{macrocode}
+\def\@setcpageref{\@@setcpageref{cref}}
+\def\@setCpageref{\@@setcpageref{Cref}}
+\def\@setlabelcpageref{\@@setcpageref{labelcref}}
+\def\@@setcpageref#1#2#3{%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries ??}%
- \@latex@warning{Reference `#1' on page \thepage \space undefined}%
+ \@latex@warning{Reference `#2' on page \thepage \space undefined}%
\else%
- \cref@getpageref{#1}{\@temppage}%
- \expandafter\ifx\csname #2@page@format#3\endcsname\relax%
+ \cpageref@getlabel{#2}{\@temppage}%
+ \expandafter\ifx\csname #1@page@format#3\endcsname\relax%
% \end{macrocode}
% If reference format is undefined, but we're typesetting a
% \cmd{\labelcpageref}, fall back to default \cmd{\labelcref} format.
% \begin{macrocode}
- \edef\@tempa{#2}\def\@tempb{labelcref}%
+ \edef\@tempa{#1}\def\@tempb{labelcref}%
\ifx\@tempa\@tempb\relax%
- \expandafter\@@setcpageref\expandafter%
- {\csname #2@default@format#3\endcsname}{#1}%
+ \expandafter\@@@setcpageref\expandafter%
+ {\csname #1@default@format#3\endcsname}{#2}%
\else%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries ??}~\@temppage%
- \@latex@warning{#2 \space reference format for
+ \@latex@warning{ #1 reference format for
page references undefined}%
\fi%
\else%
- \expandafter\@@setcpageref\expandafter%
- {\csname #2@page@format#3\endcsname}{#1}%
+ \expandafter\@@@setcpageref\expandafter%
+ {\csname #1@page@format#3\endcsname}{#2}%
\fi%
\fi}%
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@setcpageref}
+% \begin{macro}{\@@@setcpageref}
% We separate out the very final typesetting step into a separate
% macro, in order to make it easier to redefine things later to make
% them work with the \package{hyperref} package.
% \begin{macrocode}
-\def\@@setcpageref#1#2{%
- \cref@getpageref{#2}{\@temppage}#1{\@temppage}{}{}}%
+\def\@@@setcpageref#1#2{%
+ \cpageref@getlabel{#2}{\@temppage}#1{\@temppage}{}{}}%
% \end{macrocode}
% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \begin{macro}{\@setcpagerefrange}
-% The internal \cmd{\@setcpagerefrange} macro deals with typesetting
-% page range references, just as \cmd{\@setcpageref} does for normal
-% page references.
+% \begin{macro}{\@setCpagerefrange}
+% \begin{macro}{\@setlabelcpagerefrange}
+% \begin{macro}{\@@setcpagerefrange}
+% The \cmd{\@@setcpagerefrange} macro deals with typesetting page range
+% references, just as \cmd{\@@setcpageref} does for normal page
+% references.
% \begin{macrocode}
-\def\@setcpagerefrange#1#2#3#4{%
+\def\@setcpagerefrange#1#2#3{\@@setcpagerefrange{#1}{#2}{cref}{#3}}%
+\def\@setCpagerefrange#1#2#3{\@@setcpagerefrange{#1}{#2}{Cref}{#3}}%
+\def\@setlabelcpagerefrange#1#2#3{\@@setcpagerefrange{#1}{#2}{labelcref}{#3}}%
+\def\@@setcpagerefrange#1#2#3#4{%
\begingroup%
% \end{macrocode}
% Check if both references are defined.
@@ -4098,13 +4002,13 @@
\@latex@warning{Reference `#2' on page \thepage \space%
undefined}%
\else%
- \cref@getpageref{#2}{\@pageb}%
+ \cpageref@getlabel{#2}{\@pageb}%
\nfss@text{\reset@font\bfseries ??}--\@pageb%
\fi%
\else%
\expandafter\ifx\csname r@#2@cref\endcsname\relax%
\protect\G@refundefinedtrue%
- \cref@getpageref{#1}{\@pagea}%
+ \cpageref@getlabel{#1}{\@pagea}%
\@pagea--\nfss@text{\reset@font\bfseries ??}%
\@latex@warning{Reference `#2' on page \thepage %
\space undefined}%
@@ -4113,10 +4017,10 @@
% defined.
% \begin{macrocode}
\else%
- \cref@getpageref{#1}{\@pagea}%
- \cref@getpageref{#2}{\@pageb}%
+ \cpageref@getlabel{#1}{\@pagea}%
+ \cpageref@getlabel{#2}{\@pageb}%
\edef\@format{\expandafter\noexpand%
- \csname #3range@page@format#4\endcsname}%
+ \csname#3range@page@format#4\endcsname}%
\expandafter\ifx\@format\relax%
% \end{macrocode}
% If page reference format is undefined, but we're typesetting a
@@ -4125,34 +4029,37 @@
% \begin{macrocode}
\edef\@tempa{#3}\def\@tempb{labelcref}%
\ifx\@tempa\@tempb\relax%
- \expandafter\@@setcpagerefrange\expandafter%
- {\csname #3range@default@format#4\endcsname}{#1}{#2}%
+ \expandafter\@@@setcpagerefrange\expandafter%
+ {\csname#3range@default@format#4\endcsname}{#1}{#2}%
\else%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries ??}~\@pagea--\@pageb%
- \@latex@warning{#3\space reference range format for page
+ \@latex@warning{#3 reference range format for page
references undefined}%
\fi%
\else%
% \end{macrocode}
% typeset page reference range,
% \begin{macrocode}
- \expandafter\@@setcpagerefrange\expandafter{\@format}{#1}{#2}%
+ \expandafter\@@@setcpagerefrange\expandafter{\@format}{#1}{#2}%
\fi%
\fi%
\fi%
\endgroup}%
% \end{macrocode}
% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
-% \begin{macro}{\@@setcpagerefrange}
+% \begin{macro}{\@@@setcpagerefrange}
% We again separate out the very final typesetting step into a
% separate macro, in order to make it easier to redefine things later
% to make them work with the \package{hyperref} package.
% \begin{macrocode}
-\def\@@setcpagerefrange#1#2#3{%
- \cref@getpageref{#2}{\@pagea}%
- \cref@getpageref{#3}{\@pageb}%
+\def\@@@setcpagerefrange#1#2#3{%
+ \cpageref@getlabel{#2}{\@pagea}%
+ \cpageref@getlabel{#3}{\@pageb}%
#1{\@pagea}{\@pageb}{}{}{}{}}%
% \end{macrocode}
% \end{macro}
@@ -4485,6 +4392,7 @@
% \end{macrocode}
% \end{macro}
%
+%
% \begin{macro}{\@crefdefineformat}
% The \cmd{\@crefdefineformat} et al.\ macros construct calls to
% \cmd{\crefformat} et al.\ for the supplied reference type, which
@@ -4537,6 +4445,7 @@
% \end{macrocode}
% \end{macro}
%
+%
% \begin{macro}{\@crefrangedefineformat}
% Construct call to \cmd{\crefrangeformat}.
% \begin{macrocode}
@@ -4596,6 +4505,7 @@
% \end{macrocode}
% \end{macro}
%
+%
% \begin{macro}{\@crefdefinemultiformat}
% Construct call to \cmd{\crefmultiformat}.
% \begin{macrocode}
@@ -4690,6 +4600,7 @@
% \end{macrocode}
% \end{macro}
%
+%
% \begin{macro}{\@crefrangedefinemultiformat}
% Construct call to \cmd{\crefrangemultiformat}.
% \begin{macrocode}
@@ -4789,6 +4700,7 @@
% \end{macrocode}
% \end{macro}
%
+%
% \begin{macro}{\@labelcrefdefinedefaultformats}
% \cmd{\@labelcrefdefinedefaultformats} defines the default formats for
% the\linebreak[4] \cmd{\labelcref} command, which are used when no
@@ -4880,6 +4792,7 @@
% \end{macrocode}
% \end{macro}
%
+%
% \begin{macro}{\@crefdefineallformats}
% \cmd{\@crefdefineallformats} calls each of the above, to define all
% formats for the given type from the corresponding components.
@@ -4893,6 +4806,153 @@
% \end{macro}
%
%
+% \begin{macro}{\@crefcopyformats}
+% \cmd{\@crefcopyformats} copies any undefined formats for type |#2|
+% from those for type |#1|.
+% \begin{macrocode}
+\def\@crefcopyformats#1#2{%
+ \@ifundefined{cref@#2@name}{%
+ \edef\@tempa{\expandafter\noexpand\csname cref@#2@name\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname cref@#1@name\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb%
+ \edef\@tempa{\expandafter\noexpand\csname cref@#2@name@plural\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname cref@#1@name@plural\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{cref@#2@format}{%
+ \edef\@tempa{\expandafter\noexpand\csname cref@#2@format\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname cref@#1@format\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{crefrange@#2@format}{%
+ \edef\@tempa{\expandafter\noexpand\csname crefrange@#2@format\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname crefrange@#1@format\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{cref@#2@format@first}{%
+ \edef\@tempa{\expandafter\noexpand\csname cref@#2@format@first\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname cref@#1@format@first\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{cref@#2@format@second}{%
+ \edef\@tempa{\expandafter\noexpand\csname cref@#2@format@second\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname cref@#1@format@second\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{cref@#2@format@middle}{%
+ \edef\@tempa{\expandafter\noexpand\csname cref@#2@format@middle\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname cref@#1@format@middle\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{cref@#2@format@last}{%
+ \edef\@tempa{\expandafter\noexpand\csname cref@#2@format@last\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname cref@#1@format@last\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{crefrange@#2@format@first}{%
+ \edef\@tempa{\expandafter\noexpand\csname crefrange@#2@format@first\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname crefrange@#1@format@first\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{crefrange@#2@format@second}{%
+ \edef\@tempa{\expandafter\noexpand\csname crefrange@#2@format@second\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname crefrange@#1@format@second\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{crefrange@#2@format@middle}{%
+ \edef\@tempa{\expandafter\noexpand\csname crefrange@#2@format@middle\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname crefrange@#1@format@middle\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{crefrange@#2@format@last}{%
+ \edef\@tempa{\expandafter\noexpand\csname crefrange@#2@format@last\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname crefrange@#1@format@last\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+%
+ \@ifundefined{Cref@#2@name}{%
+ \edef\@tempa{\expandafter\noexpand\csname Cref@#2@name\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Cref@#1@name\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb%
+ \edef\@tempa{\expandafter\noexpand\csname Cref@#2@name@plural\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Cref@#1@name@plural\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Cref@#2@format}{%
+ \edef\@tempa{\expandafter\noexpand\csname Cref@#2@format\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Cref@#1@format\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Crefrange@#2@format}{%
+ \edef\@tempa{\expandafter\noexpand\csname Crefrange@#2@format\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Crefrange@#1@format\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Cref@#2@format@first}{%
+ \edef\@tempa{\expandafter\noexpand\csname Cref@#2@format@first\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Cref@#1@format@first\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Cref@#2@format@second}{%
+ \edef\@tempa{\expandafter\noexpand\csname Cref@#2@format@second\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Cref@#1@format@second\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Cref@#2@format@middle}{%
+ \edef\@tempa{\expandafter\noexpand\csname Cref@#2@format@middle\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Cref@#1@format@middle\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Cref@#2@format@last}{%
+ \edef\@tempa{\expandafter\noexpand\csname Cref@#2@format@last\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Cref@#1@format@last\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Crefrange@#2@format@first}{%
+ \edef\@tempa{\expandafter\noexpand\csname Crefrange@#2@format@first\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Crefrange@#1@format@first\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Crefrange@#2@format@second}{%
+ \edef\@tempa{\expandafter\noexpand\csname Crefrange@#2@format@second\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Crefrange@#1@format@second\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Crefrange@#2@format@middle}{%
+ \edef\@tempa{\expandafter\noexpand\csname Crefrange@#2@format@middle\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Crefrange@#1@format@middle\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Crefrange@#2@format@last}{%
+ \edef\@tempa{\expandafter\noexpand\csname Crefrange@#2@format@last\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Crefrange@#1@format@last\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+%
+ \@ifundefined{labelcref@#2@format}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcref@#2@format\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcref@#1@format\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcrefrange@#2@format}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcrefrange@#2@format\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcrefrange@#1@format\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcref@#2@format@first}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcref@#2@format@first\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcref@#1@format@first\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcref@#2@format@second}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcref@#2@format@second\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcref@#1@format@second\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcref@#2@format@middle}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcref@#2@format@middle\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcref@#1@format@middle\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcref@#2@format@last}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcref@#2@format@last\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcref@#1@format@last\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcrefrange@#2@format@first}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcrefrange@#2@format@first\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcrefrange@#1@format@first\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcrefrange@#2@format@second}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcrefrange@#2@format@second\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcrefrange@#1@format@second\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcrefrange@#2@format@middle}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcrefrange@#2@format@middle\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcrefrange@#1@format@middle\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcrefrange@#2@format@last}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcrefrange@#2@format@last\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcrefrange@#1@format@last\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
% \subsubsection{Format definition commands}
% \label{sec:crefformat}
% \begin{macro}{\crefformat}
@@ -4907,7 +4967,7 @@
% control over the format of different reference types. They override
% the component-based formats, simply using the supplied arguments to
% define appropriately named formatting macros, which are called by
-% \cmd{\@setcref} etc. If the corresponding \cmd{\Crefformat} or
+% \cmd{\@@setcref} etc. If the corresponding \cmd{\Crefformat} or
% \cmd{\crefformat} variant is not already defined, they define it to
% be a version with the first letter capitalised or lower-cased.
% \begin{macrocode}
@@ -5212,11 +5272,21 @@
% \package{cleveref}.
% \begin{macrocode}
\let\if@cref@hyperrefloaded\iffalse%
+\let\cref@addtoreset\@addtoreset%
\@ifpackageloaded{hyperref}{%
\@ifpackagewith{hyperref}{implicit=false}{}{%
\let\if@cref@hyperrefloaded\iftrue%
\PackageInfo{cleveref}{`hyperref' support loaded}%
% \end{macrocode}
+% \package{hyperref} redefines the \LaTeX{} kernel \cmd{\@addtoreset}
+% macro (sigh), but we sometimes need the vanilla version without the
+% \package{hyperref} shennanigans. \package{hyperref} saves the
+% original in \cmd{\HyOrg@addtoreset}. So we create yet
+% \emph{another} version called \cmd{\cref@addtotreset}, which is always
+% let to the original \cmd{\@addtoreset}, whereever that's found.
+% \begin{macrocode}
+ \let\cref@addtoreset\HyOrg@addtoreset%
+% \end{macrocode}
% \begin{macro}{\cref@hyperlinkname}
% \begin{macro}{\cref@hyperlinkurl}
% We define a utility macro to extract the hyperlink supplied by
@@ -5244,7 +5314,7 @@
% \package{cleveref}, so we don't bother providing \cmd{\hyper@@link}'s
% optional argument.)
% \begin{macrocode}
- \def\cref@hyperlink#1#2#3\@nil{\hyper@@link[link]{#1}{#2}{#3}}
+ \def\cref@hyperlink#1#2#3\@nil{\hyper@@link[link]{#1}{#2}{#3}}%
% \end{macrocode}
% \end{macro}
%
@@ -5289,9 +5359,12 @@
\let\refstepcounter@noarg\cref@old@refstepcounter%
\def\refstepcounter@optarg[#1]#2{%
\cref@old@refstepcounter{#2}%
+ \@ifundefined{cref@#1@alias}%
+ {\def\@tempa{#1}}%
+ {\def\@tempa{\csname cref@#1@alias\endcsname}}%
\protected@edef\cref@currentlabel{%
\expandafter\cref@override@label@type%
- \cref@currentlabel\@nil{#1}}}%
+ \cref@currentlabel\@nil{\@tempa}}}%
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -5303,11 +5376,11 @@
% that needs to be redefined.
% \begin{macrocode}
\@ifundefined{appendix}{}{%
- \g@addto@macro\appendix{%
+ \def\appendix{%
\@ifundefined{chapter}{%
- \def\H@refstepcounter#1{%
- \cref@old@H@refstepcounter{#1}%
- \cref@constructprefix{#1}{\cref@result}%
+ \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
@@ -5321,40 +5394,41 @@
% \end{macrocode}
% Override the cross-reference type of sectioning commands.
% \begin{macrocode}
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{section}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [appendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [appendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{subsection}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [subappendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{subsubsection}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subsubappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [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}}%
+ \@ifundefined{cref@##1@alias}%
+ {\def\@tempa{##1}}%
+ {\def\@tempa{\csname cref@##1@alias\endcsname}}%
\protected@edef\cref@currentlabel{%
- [\@tempa][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [\@tempa][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\fi%
\fi%
\fi}%
+ \cref@old@appendix%
}{%
- \def\H@refstepcounter#1{%
- \cref@old@H@refstepcounter{#1}%
- \cref@constructprefix{#1}{\cref@result}%
+ \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.
@@ -5367,45 +5441,45 @@
% \end{macrocode}
% Override the cross-reference type of sectioning commands.
% \begin{macrocode}
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{chapter}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [appendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [appendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{section}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [subappendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{subsection}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subsubappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [subsubappendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{subsubsection}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subsubsubappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [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}}%
+ \@ifundefined{cref@##1@alias}%
+ {\def\@tempa{##1}}%
+ {\def\@tempa{\csname cref@##1@alias\endcsname}}%
\protected@edef\cref@currentlabel{%
- [\@tempa][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [\@tempa][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\fi%
\fi%
\fi%
\fi}%
- }%
+ \cref@old@appendix}%
}%
}% end of \@ifundefined{appendix}
% \end{macrocode}
@@ -5414,21 +5488,23 @@
% \begin{macro}{\cref*}
% \begin{macro}{\Cref*}
% \begin{macro}{\@crefstar}
-% \begin{macro}{\@crefnostar}
% We redefine \cmd{\cref} and all the others to allow starred variants,
% which don't create hyperlinks. The starred variants simply set a
% flag, which is tested in the very final stage of reference
-% typesetting in \cmd{\@@setcref}, \cmd{\@@setcrefrange},
-% \cmd{\@@setcpageref} and \cmd{\@@setcpagerefrange} (below).
+% typesetting in \cmd{\@@@setcref}, \cmd{\@@@setcrefrange},
+% \cmd{\@@@setcpageref} and \cmd{\@@@setcpagerefrange} (below).
% \begin{macrocode}
\DeclareRobustCommand{\cref}{%
- \@ifstar{\@crefstar{cref}}{\@crefnostar{cref}}}%
+ \@ifstar{\@crefstar{cref}}{\@cref{cref}}}%
\DeclareRobustCommand{\Cref}{%
- \@ifstar{\@crefstar{Cref}}{\@crefnostar{Cref}}}%
- \def\@crefnostar#1#2{\@cref{#1}{#2}}%
+ \@ifstar{\@crefstar{Cref}}{\@cref{Cref}}}%
\def\@crefstar#1#2{%
\@crefstarredtrue\@cref{#1}{#2}\@crefstarredfalse}%
% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
% \begin{macro}{\crefrange*}
% \begin{macro}{\Crefrange*}
% \begin{macro}{\@crefrangestar}
@@ -5438,97 +5514,75 @@
\@ifstar{\@crefrangestar{cref}}{\@crefrangenostar{cref}}}%
\DeclareRobustCommand{\Crefrange}{%
\@ifstar{\@crefrangestar{Cref}}{\@crefrangenostar{Cref}}}%
- \def\@crefrangenostar#1#2#3{\@setcrefrange{#2}{#3}{#1}{}}%
+ \def\@crefrangenostar#1#2#3{\@@setcrefrange{#1}{#2}{#3}{}}
\def\@crefrangestar#1#2#3{%
- \@crefstarredtrue\@setcrefrange{#2}{#3}{#1}{}\@crefstarredfalse}%
+ \@crefstarredtrue\@@setcrefrange{#1}{#2}{#3}{}\@crefstarredfalse}%
% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
% \begin{macro}{\cpageref*}
% \begin{macro}{\Cpageref*}
-% \begin{macro}{\@cpagerefstar}
-% \begin{macro}{\@cpagerefnostar}
% \begin{macrocode}
\DeclareRobustCommand{\cpageref}{%
- \@ifstar{\@cpagerefstar{cref}}{\@cpagerefnostar{cref}}}%
+ \@ifstar{\@crefstar{cpageref}}{\@cref{cpageref}}}%
\DeclareRobustCommand{\Cpageref}{%
- \@ifstar{\@cpagerefstar{Cref}}{\@cpagerefnostar{Cref}}}%
- \def\@cpagerefnostar#1#2{%
- \@cpageref{#1}{#2}{\@setcpageref}{\@setcpagerefrange}}%
- \def\@cpagerefstar#1#2{%
- \@crefstarredtrue%
- \@cpageref{#1}{#2}{\@setcpageref}{\@setcpagerefrange}%
- \@crefstarredfalse}%
+ \@ifstar{\@crefstar{Cpageref}}{\@cref{Cpageref}}}%
% \end{macrocode}
+% \end{macro}
+% \end{macro}
% \begin{macro}{\cpagerefrange*}
% \begin{macro}{\Cpagerefrange*}
% \begin{macro}{\@cpagerefrangestar}
-% \begin{macro}{\@cpagerefrangenostar}
% \begin{macrocode}
\DeclareRobustCommand{\cpagerefrange}{%
- \@ifstar{\@cpagerefrangestar{cref}}{\@cpagerefrangenostar{cref}}}%
+ \@ifstar{\@cpagerefrangestar{cpageref}}{\@setcpagerefrange}}%
\DeclareRobustCommand{\Cpagerefrange}{%
- \@ifstar{\@cpagerefrangestar{Cref}}{\@cpagerefrangenostar{Cref}}}%
- \def\@cpagerefrangenostar#1#2#3{\@setcpagerefrange{#2}{#3}{#1}{}}%
+ \@ifstar{\@cpagerefrangestar{Cpageref}}{\@setCpagerefrange}}%
\def\@cpagerefrangestar#1#2#3{%
\@crefstarredtrue%
- \@setcpagerefrange{#2}{#3}{#1}{}%
+ \@@setcpagerefrange{#1}{#2}{#3}{}%
\@crefstarredfalse}%
% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
% \begin{macro}{\labelcref*}
% \begin{macro}{\labelcpageref*}
% \begin{macro}{\@labelcrefstar}
-% \begin{macro}{\@labelcrefnostar}
% \begin{macro}{\@labelcpagerefstar}
-% \begin{macro}{\@labelcpagerefnostar}
% \begin{macrocode}
\DeclareRobustCommand{\labelcref}{%
- \@ifstar{\@labelcrefstar}{\@labelcrefnostar}}%
- \def\@labelcrefnostar#1{\@cref{labelcref}{#1}}%
+ \@ifstar{\@labelcrefstar}{\@cref{labelcref}}}%
\def\@labelcrefstar#1{%
\@crefstarredtrue%
\@cref{labelcref}{#1}%
\@crefstarredfalse}%
\DeclareRobustCommand{\labelcpageref}{%
- \@ifstar{\@labelcpagerefstar}{\@labelcpagerefnostar}}%
- \def\@labelcpagerefnostar#1{%
- \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}}%
+ \@ifstar{\@labelcpagerefstar}{\@cref{labelcpageref}}}%
\def\@labelcpagerefstar#1{%
\@crefstarredtrue%
- \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}%
+ \@cref{labelcpageref}{#1}%
\@crefstarredfalse}%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
%
-% \begin{macro}{\@@setcref}
-% \begin{macro}{\@@setcrefrange}
-% \begin{macro}{\@@setcpageref}
-% \begin{macro}{\@@setcpagerefrange}
+% \begin{macro}{\@@@setcref}
+% \begin{macro}{\@@@setcrefrange}
+% \begin{macro}{\@@@setcpageref}
+% \begin{macro}{\@@@setcpagerefrange}
% Redefine the final reference typesetting macros to create hyperlinks
% (unless the starred flag is set), using the extra arguments supplied
% in \cmd{\r@\meta{label}} (via the \file{aux} file) by
% \package{hyperref}.
% \begin{macrocode}
- \def\@@setcref#1#2{%
+ \def\@@@setcref#1#2{%
\cref@getlabel{#2}{\@templabel}%
\if@crefstarred%
#1{\@templabel}{}{}%
@@ -5537,7 +5591,7 @@
\edef\@tempurl{\cref@hyperlinkurl{#2}}%
#1{\@templabel}{\cref@hyperlink{\@tempurl}{\@tempname}}{\@nil}%
\fi}%
- \def\@@setcrefrange#1#2#3{%
+ \def\@@@setcrefrange#1#2#3{%
\cref@getlabel{#2}{\@labela}%
\cref@getlabel{#3}{\@labelb}%
\if@crefstarred%
@@ -5551,8 +5605,8 @@
{\cref@hyperlink{\@tempurla}{\@tempnamea}}{\@nil}%
{\cref@hyperlink{\@tempurlb}{\@tempnameb}}{\@nil}%
\fi}%
- \def\@@setcpageref#1#2{%
- \cref@getpageref{#2}{\@temppage}%
+ \def\@@@setcpageref#1#2{%
+ \cpageref@getlabel{#2}{\@temppage}%
\if@crefstarred%
#1{\@temppage}{}{}%
\else%
@@ -5560,9 +5614,9 @@
\edef\@tempurl{\cref@hyperlinkurl{#2}}%
#1{\@temppage}{\cref@hyperlink{\@tempurl}{\@tempname}}{\@nil}%
\fi}%
- \def\@@setcpagerefrange#1#2#3{%
- \cref@getpageref{#2}{\@pagea}%
- \cref@getpageref{#3}{\@pageb}%
+ \def\@@@setcpagerefrange#1#2#3{%
+ \cpageref@getlabel{#2}{\@pagea}%
+ \cpageref@getlabel{#3}{\@pageb}%
\if@crefstarred%
#1{\@pagea}{\@pageb}{}{}{}{}%
\else%
@@ -5599,10 +5653,131 @@
\protected@edef\cref@currentlabel{%
[\@tempa][\arabic{#1}][\cref@result]%
\csname p@#1\endcsname\csname the#1\endcsname}}%
- \fi%
+% \end{macrocode}
+% We also need to redefine |\appendix| to use
+% \begin{macrocode}
+ \@ifundefined{appendix}{}{%
+ \def\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%
+% \end{macrocode}
+% Override the cross-reference type of sectioning commands.
+% \begin{macrocode}
+ \def\@tempa{##1}%
+ \def\@tempb{section}%
+ \ifx\@tempa\@tempb%
+ \protected@edef\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@edef\cref@currentlabel{%
+ [subappendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
+ \else%
+ \def\@tempa{##1}%
+ \def\@tempb{subsubsection}%
+ \ifx\@tempa\@tempb%
+ \protected@edef\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@edef\cref@currentlabel{%
+ [\@tempa][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
+ \fi%
+ \fi%
+ \fi}%
+ \cref@old@appendix%
+ }{%
+ \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%
+% \end{macrocode}
+% Override the cross-reference type of sectioning commands.
+% \begin{macrocode}
+ \def\@tempa{##1}%
+ \def\@tempb{chapter}%
+ \ifx\@tempa\@tempb%
+ \protected@edef\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@edef\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@edef\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@edef\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@edef\cref@currentlabel{%
+ [\@tempa][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
+ \fi%
+ \fi%
+ \fi%
+ \fi}%
+ \cref@old@appendix}%
+ }%
+ }% end of \@ifundefined{appendix}
+ \fi% end of \if@cref@hyperrefloaded
\let\if@cref@hyperrefloaded\iffalse%
}% end of \@ifpackageloaded{hyperref}
% \end{macrocode}
+% Add check to AtBeginDocument to throw error if \package{hyperref} was
+% loaded after cleveref.
+% \begin{macrocode}
+\AtBeginDocument{%
+ \if@cref@hyperrefloaded\else%
+ \@ifpackageloaded{hyperref}{%
+ \PackageError{cleveref}{cleveref must be loaded after hyperref!}%
+ {Package load order is wrong: load cleveref *after* hyperref.}
+ }{}%
+ \fi}
+% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
@@ -5618,20 +5793,107 @@
% \cmd{\cref} instead of \cmd{\ref} to produce the reference. Since
% \cmd{\cref} can cope with multiple references, we extend the page
% referencing magic of \cmd{\vref} et al.\ to use \cmd{\cpageref}
-% instead, assisted by \cmd{\@setvpageref} and \cmd{\@vpagerefrange}
+% instead, assisted by \cmd{\@@setvpageref} and \cmd{\@vpagerefrange}
% (which typeset page references using \package{varioref} commands).
% The former takes care of multi-references, the latter take care of
% the \package{varioref} page referencing magic.
% \end{macro}
%
% \begin{macrocode}
+\let\if@cref@variorefloaded\iffalse%
\@ifpackageloaded{varioref}{%
+ \let\if@cref@variorefloaded\iftrue%
\PackageInfo{cleveref}{`varioref' support loaded}%
\PackageInfo{cleveref}{`cleveref' supersedes `varioref's
\string\labelformat command}%
% \end{macrocode}
%
%
+% \begin{macro}{\cref@old@@vpageref}
+% Unfortunately, \package{varioref}'s |\@@vpageref| macro calls a
+% |\vref@label| \emph{before} it typesets the page reference. The
+% |\protected@write| within |\vref@label| seems to prevent an |\unskip|
+% command coming after the |\vref@label| from removing any space that
+% was inserted before the |\vref@label|. This means that setting a
+% |\reftext|\meta{x} command to |\unskip| won't work; it won't properly
+% remove any preceding space in the event that an empty page reference
+% is typeset.
+%
+% This didn't matter in the original \package{varioref} implementation,
+% because it \emph{always} removed any preceding space, then inserted
+% its own space \emph{after} the |\vref@label|, which the |\unskip|
+% could then gobble. But we want to get rid of this irritating
+% always-space-gobbling behaviour here. So we have to redefine
+% |\@@vpageref| (here renamed |\cref@old@@vpageref|) in order to move
+% the |\vref@label| to the end of the macro, after the page reference
+% has been typeset. We also remove the |\unskip| from the start of
+% |\@@vpageref|.
+% \begin{macrocode}
+ \def\cref@old@@vpageref#1[#2]#3{%
+ \leavevmode%\unskip <<<
+ \global\advance\c@vrcnt\@ne\relax%
+ \vref@pagenum\@tempa{\the\c@vrcnt @vr}%
+ \vref@pagenum\@tempb{\the\c@vrcnt @xvr}%
+ %\vref@label{\the\c@vrcnt @xvr}% <<<
+ \ifx\@tempa\@tempb\else%
+ \vref@err{\noexpand\vref or \noexpand\vpageref at page boundary
+ \@tempb-\@tempa\space (may loop)%
+ }%
+ \fi%
+ \vrefpagenum\thevpagerefnum{#3}%
+ \vref@space%
+ \ifx\@tempa\thevpagerefnum%
+ \def\@tempc{#1}%
+ \ifx\@tempc\@empty%
+ \unskip%
+ \else%
+ #1%
+ \fi%
+ \else%
+ #2%
+ \is@pos@number\thevpagerefnum%
+ {%
+ \is@pos@number\@tempa%
+ {\@tempcnta\@tempa%
+ \advance\@tempcnta\@ne\relax%
+ }%
+ {\@tempcnta\maxdimen}%
+ \ifnum \thevpagerefnum =\@tempcnta%
+ \ifodd\@tempcnta%
+ \if@twoside%
+ \reftextfaceafter%
+ \else%
+ \reftextafter%
+ \fi%
+ \else%
+ \reftextafter%
+ \fi%
+ \else%
+ \advance\@tempcnta-2\relax%
+ \ifnum \thevpagerefnum =\@tempcnta%
+ \ifodd\@tempcnta%
+ \reftextbefore%
+ \else%
+ \if@twoside%
+ \reftextfacebefore%
+ \else%
+ \reftextbefore%
+ \fi%
+ \fi%
+ \else%
+ \reftextfaraway{#3}%
+ \fi%
+ \fi%
+ }%
+ {\reftextfaraway{#3}}%
+ \fi%
+ \vref@label{\the\c@vrcnt @xvr}% <<<
+ \vref@label{\the\c@vrcnt @vr}%
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+%
% \begin{macro}{\cref@@vpageref}
% We first enhance the core \package{varioref} |\vpageref| macro to
% allow it to cope with lists of page references. This is done by
@@ -5641,10 +5903,18 @@
% \package{varioref}'s own page-referencing commands. (The alternative
% version of \cmd{\vpagerefrange} is there to facilitate later
% redefinitions.)
+%
+% Most of the work is done by defining suitable |\@setvpageref| etc.\
+% commands (below), called as appropriate by our ever-faithful
+% \cmd{\@cref} work-horse. We only make use of one of the optional
+% arguments to the original \package{varioref} |\@@vpageref| macro,
+% which we store here in \cmd{\cref@@vpageref} for later.
% \begin{macrocode}
\def\cref@@vpageref#1[#2]#3{%
- \@cpageref{cref}{#3}%
- {\@setvpageref[#1][\vref@space]}{\@setvpagerefrange[#1]}}%
+ \begingroup%
+ \def\cref@@vpageref@arg{#1}%
+ \@cref{vpageref}{#3}%
+ \endgroup}%
% \end{macrocode}
% \end{macro}
%
@@ -5675,10 +5945,9 @@
\cref@@vpageref{\reftextcurrent}[]{#2}%
\endgroup}%
\def\cref@vrefrange#1#2#3{%
- \@setcrefrange{#2}{#3}{#1}{}\@setcref@space\vpagerefrange{#2}{#3}}%
+ \@@setcrefrange{#1}{#2}{#3}{}\@setcref@space\vpagerefrange{#2}{#3}}%
\def\cref@fullref#1#2{%
- \@cref{#1}{#2}\@setcref@space%
- \@cpageref{cref}{#2}{\@setfullpageref}{\@setfullpagerefrange}}%
+ \@cref{#1}{#2}\@setcref@space\@cref{fullpageref}{#2}}%
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -5720,29 +5989,22 @@
%
%
% \begin{macro}{\@setvpageref}
-% The \cmd{\@setvpageref} and \cmd{\@setvpagerefrange} macros typeset
+% The \cmd{\@setvpageref} macro is called by \cmd{\@cref} to typeset
% page references using \package{varioref} commands, tweaked to work
-% with the enhanced \package{cleveref} page-referencing features. They
-% are passed to \cmd{\@cpageref} by the \package{cleveref}-enhanced
-% \cmd{\vpageref} command, thereby combining the \package{cleveref} and
-% \package{varioref} page-referencing features.
-%
-% |#1| and |#2| are \package{varioref} arguments that get passed
-% straight through to the (original) \package{varioref} |\@@vpageref|
-% macro. |#3| is the reference label itself. |#4| is either |cref| or
-% |Cref|, identifying the capitalisation variant, and |#5| is either
-% empty if we're typesetting a single page reference, or one of
-% |@first|, |@second|, |@middle| or |@end|, identifying where the page
-% reference comes in a multi-reference. The arguments in square
-% brackets are passed all the way through from the
-% \package{cleveref}-enhanced \package{varioref} commands. The others
-% are added by |\@cpageref| when it calls |\@setvpageref|.
-% \begin{macrocode}
- \def\@setvpageref[#1][#2]#3#4#5{%
+% with the enhanced \package{cleveref} page-referencing features.
+% |#1| is the reference itself. |#2| is either empty if we're
+% typesetting a single page reference, or one of |@first|, |@second|,
+% |@middle| or |@end|, identifying where the page reference comes in a
+% multi-reference. We only make use of one of the optional arguments to
+% the original \package{varioref} |\@@vpageref| macro, available here
+% as \cmd{\cref@@vpageref@arg} (stored there by \cmd{\cref@@vpageref},
+% above).
+% \begin{macrocode}
+ \def\@setvpageref#1#2{%
% \end{macrocode}
% Add the appropriate conjunction before the page reference.
% \begin{macrocode}
- \cref@vpagerefconjunction{#5}%
+ \cref@vpagerefconjunction{#2}%
% \end{macrocode}
% Undefining |\vref@space| prevents the original \package{varioref}
% |\@@vpageref| macro from |\unskip|ing any preceding space and
@@ -5761,39 +6023,37 @@
% typeset the page reference.
% \begin{macrocode}
\begingroup%
- \cref@patchreftexts{#5}%
- \@@setvpageref{#1}[#2]{#3}%
+ \cref@patchreftexts{#2}%
+ \expandafter\@@@setvpageref\expandafter%
+ {\cref@@vpageref@arg}[\vref@space]{#1}%
\endgroup}%
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@setvpageref}
+% \begin{macro}{\@@@setvpageref}
% We separate out the final type setting step, as always, to make it
% easier to redefine things later.
% \begin{macrocode}
- \def\@@setvpageref#1[#2]#3{\cref@old@@vpageref{#1}[#2]{#3}}%
+ \let\@@@setvpageref\cref@old@@vpageref%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@setvpagerefrange}
% |\@setvpagerefrange| is similar to |\@setvpageref|, but typesets page
-% ranges. |#1| is a \package{varioref} spacing argument that get passed
-% straight through to the \package{varioref} |\vpagerefrange| macro.
-% |#2| and |#3| are the labels themselves. |#4| is either |cref| or
-% |Cref|, identifying the capitalisation variant, and |#5| is either
-% empty if we're typesetting a single page range, or one of |@first|,
+% ranges. |#1| and |#2| are the labels themselves. |#3| is either empty
+% if we're typesetting a single page range, or one of |@first|,
% |@second|, |@middle| or |@end|, identifying where the page reference
-% comes in a multi-reference. The arguments in square brackets are
-% passed all the way through from the \package{cleveref}-enhanced
-% \package{varioref} commands. The others are added by |\@cpageref|
-% when it calls |\@setvpagerefrange|.
+% comes in a multi-reference. We only make use of one of the optional
+% arguments to the original \package{varioref} |\@@vpageref| macro,
+% available here as \cmd{\cref@@vpageref@arg} (stored there by
+% \cmd{\cref@@vpageref}, above).
% \begin{macrocode}
- \def\@setvpagerefrange[#1]#2#3#4#5{%
+ \def\@setvpagerefrange#1#2#3{%
% \end{macrocode}
% Add the appropriate conjunction before the page range reference.
% \begin{macrocode}
- \cref@vpagerefconjunction{#5}%
+ \cref@vpagerefconjunction{#3}%
% \end{macrocode}
% Unlike |\vpageref|, \package{varioref}'s |\vpagerefrange| command
% \emph{doesn't} go in for quite the same space-mangling behaviour. We
@@ -5806,150 +6066,76 @@
% typeset the page range.
% \begin{macrocode}
\begingroup%
- \cref@patchreftexts{#5}%
- \@@setvpagerefrange[#1]{#2}{#3}%
+ \cref@patchreftexts{#3}%
+ \expandafter\@@@setvpagerefrange\expandafter%
+ [\cref@@vpageref@arg]{#1}{#2}%
\endgroup}%
% \end{macrocode}
+% \end{macro}
%
+% \begin{macro}{\@@@setvpagerefrange}
% Again, we separate out the final typesetting step, to aid later
% redefinition.
% \begin{macrocode}
- \def\@@setvpagerefrange[#1]#2#3{\vpagerefrange[#1]{#2}{#3}}%
+ \let\@@@setvpagerefrange\vpagerefrange
% \end{macrocode}
% \end{macro}
%
-%
% \begin{macro}{\@setfullpageref}
+% Ditto for \cmd{\@setfullpageref}, with |#1| the reference, |#2|
+% either empty, |@first|, |@second|, |@middle| or |@end|.
% \begin{macrocode}
- \def\@setfullpageref#1#2#3{%
+ \def\@setfullpageref#1#2{%
% \end{macrocode}
% Add the appropriate conjunction before the page reference.
% \begin{macrocode}
- \cref@vpagerefconjunction{#3}%
+ \cref@vpagerefconjunction{#2}%
% \end{macrocode}
% Modify the \package{varioref} |\reftext|\meta{x} commands as
% appropriate for the page reference we're currently typesetting, then
% typeset the page reference.
% \begin{macrocode}
\begingroup%
- \cref@patchreftexts{#3}%
- \@@setfullpageref{#1}%
+ \cref@patchreftexts{#2}%
+ \@@@setfullpageref{#1}%
\endgroup}%
% \end{macrocode}
+% \end{macro}
%
-% Separate out the final typesetting step, as usual.
+% \begin{macro}{\@@@setfullpageref}
+% Separate out the final typesetting step, as usual.
% \begin{macrocode}
- \def\@@setfullpageref#1{\reftextfaraway{#1}}%
+ \let\@@@setfullpageref\reftextfaraway%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@setfullpagerefrange}
+% Ditto for \cmd{\@setfullpagerefrange}, with |#1| and |#2| the
+% references, |#3| either empty, |@first|, |@second|, |@middle| or
+% |@end|.
% \begin{macrocode}
- \def\@setfullpagerefrange#1#2#3#4{%
+ \def\@setfullpagerefrange#1#2#3{%
% \end{macrocode}
% Add the appropriate conjunction before the page reference.
% \begin{macrocode}
- \cref@vpagerefconjunction{#4}%
+ \cref@vpagerefconjunction{#3}%
% \end{macrocode}
% Modify the \package{varioref} |\reftext|\meta{x} commands as
% appropriate for the page reference we're currently typesetting, then
% typeset the page reference.
% \begin{macrocode}
\begingroup%
- \cref@patchreftexts{#4}%
- \@@setfullpagerefrange{#1}{#2}%
+ \cref@patchreftexts{#3}%
+ \@@@setfullpagerefrange{#1}{#2}%
\endgroup}%
% \end{macrocode}
-%
-% Separate out the final typesetting step, as usual.
-% \begin{macrocode}
- \def\@@setfullpagerefrange#1#2{\reftextpagerange{#1}{#2}}%
-% \end{macrocode}
% \end{macro}
%
-%
-% \begin{macro}{\cref@old@@vpageref}
-% Unfortunately, \package{varioref}'s |\@@vpageref| macro calls a
-% |\vref@label| \emph{before} it typesets the page reference. The
-% |\protected@write| within |\vref@label| seems to prevent an |\unskip|
-% command coming after the |\vref@label| from removing any space that
-% was inserted before the |\vref@label|. This means that setting a
-% |\reftext|\meta{x} command to |\unskip| won't work; it won't properly
-% remove any preceding space in the event that the an empty page
-% reference is typeset.
-%
-% This didn't matter in the original \package{varioref} implementation,
-% because it \emph{always} removed any preceding space, then inserted
-% its own space \emph{after} the |\vref@label|, which the |\unskip|
-% could then gobble. But we want to get rid of this irritating
-% always-space-gobbling behaviour here. So we have to redefine
-% |\@@vpageref| (here renamed |\cref@old@@vpageref|) in order to move
-% the |\vref@label| to the end of the macro, after the page reference
-% has been typeset. We also remove the |\unskip| from the start of
-% |\@@vpageref|.
+% \begin{macro}{\@@@setfullpagerefrange}
+% Separate out the final typesetting step, as usual.
% \begin{macrocode}
- \def\cref@old@@vpageref#1[#2]#3{%
- \leavevmode%\unskip <<<
- \global\advance\c@vrcnt\@ne%
- \vref@pagenum\@tempa{\the\c@vrcnt @vr}%
- \vref@pagenum\@tempb{\the\c@vrcnt @xvr}%
- %\vref@label{\the\c@vrcnt @xvr}% <<<
- \ifx\@tempa\@tempb\else%
- \vref@err{\noexpand\vref or \noexpand\vpageref at page boundary
- \@tempb-\@tempa\space (may loop)%
- }%
- \fi%
- \vrefpagenum\thevpagerefnum{#3}%
- \vref@space%
- \ifx\@tempa\thevpagerefnum%
- \def\@tempc{#1}%
- \ifx\@tempc\@empty%
- \unskip%
- \else%
- #1%
- \fi%
- \else%
- #2%
- \is@pos@number\thevpagerefnum%
- {%
- \is@pos@number\@tempa%
- {\@tempcnta\@tempa%
- \advance\@tempcnta\@ne%
- }%
- {\@tempcnta\maxdimen}%
- \ifnum \thevpagerefnum =\@tempcnta%
- \ifodd\@tempcnta%
- \if@twoside%
- \reftextfaceafter%
- \else%
- \reftextafter%
- \fi%
- \else%
- \reftextafter%
- \fi%
- \else%
- \advance\@tempcnta-2%
- \ifnum \thevpagerefnum =\@tempcnta%
- \ifodd\@tempcnta%
- \reftextbefore%
- \else%
- \if@twoside%
- \reftextfacebefore%
- \else%
- \reftextbefore%
- \fi%
- \fi%
- \else%
- \reftextfaraway{#3}%
- \fi%
- \fi%
- }%
- {\reftextfaraway{#3}}%
- \fi%
- \vref@label{\the\c@vrcnt @xvr}% <<<
- \vref@label{\the\c@vrcnt @vr}%
- }%
+ \let\@@@setfullpagerefrange\reftextpagerange%
% \end{macrocode}
% \end{macro}
%
@@ -5971,8 +6157,8 @@
% \begin{macro}{\cref@patchreftexts}
% \begin{macro}{\cref@restorereftexts}
% The |\cref@patchreftexts| command modifies \package{varioref}
-% |\reftext|\meta{x} commands, for use within |\@setvpageref| and
-% |\@setvpagerefrange|.
+% |\reftext|\meta{x} commands, for use within |\@@setvpageref| and
+% |\@@setvpagerefrange|.
% \begin{macrocode}
\def\cref@patchreftexts#1{%
\cref@patchreftext{reftextcurrent}{#1}%
@@ -5988,8 +6174,8 @@
% |\cref@patchreftext| does the hard work of modifying the
% |\reftext|\meta{x} command given in |#1| as appropriate for the
% |\@setvpageref| or |\@setvpagerefrange| command that it's called
-% from. (It can only be called from within one of those commands.) |#2|
-% is empty if we're typesetting a single page reference, or one of
+% from. (It can only be called from within one of those commands.)
+% |#2| is empty if we're typesetting a single page reference, or one of
% |@first|, |@second|, |@middle| or |@end| when typesetting a
% multi-reference.
% \begin{macrocode}
@@ -6006,12 +6192,12 @@
\def\@tempc{}%
\expandafter\ifx\csname #1\endcsname\@tempc\relax%
\expandafter\def\csname #1\endcsname{\unskip}%
- %{\advance\count@group -1\reftextcurrent@orig}%
+ %{\advance\count@group -1\relax\reftextcurrent@orig}%
\else%
\long\def\@tempc{}%
\expandafter\ifx\csname #1\endcsname\@tempc\relax%
\expandafter\def\csname #1\endcsname{\unskip}%
- %{\advance\count@group -1\reftextcurrent@orig}%
+ %{\advance\count@group -1\relax\reftextcurrent@orig}%
\fi%
\fi%
% \end{macrocode}
@@ -6083,11 +6269,10 @@
% (if loaded).
% \begin{macrocode}
\AtBeginDocument{%
- \def\@@vpageref#1[#2]#3{\cref@@vpageref{#1}[#2]{#3}}%
+ \let\@@vpageref\cref@@vpageref%
}%
% \end{macrocode}
%
-% \begin{macro}{\vpageref}
% \begin{macro}{\vref}
% \begin{macro}{\vref*}
% \begin{macro}{\Vref}
@@ -6116,7 +6301,6 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
% \begin{macrocode}
\if@cref@hyperrefloaded\relax% hyperref loaded%
\DeclareRobustCommand{\vref}{%
@@ -6151,7 +6335,18 @@
\DeclareRobustCommand{\fullref}{\cref@fullref{cref}}%
\DeclareRobustCommand{\Fullref}{\cref@fullref{Cref}}%
\fi% end of test for hyperref
-}{}% end of \@ifpackageloaded{varioref}
+}{\let\if@cref@variorefloaded\iffalse}% end of \@ifpackageloaded{varioref}
+% \end{macrocode}
+% Add check to AtBeginDocument to throw error if \package{varioref} was
+% loaded after cleveref.
+% \begin{macrocode}
+\AtBeginDocument{%
+ \if@cref@variorefloaded\relax\else%
+ \@ifpackageloaded{varioref}{%
+ \PackageError{cleveref}{cleveref must be loaded after varioref!}%
+ {Package load order is wrong: load cleveref *after* varioref.}
+ }{}%
+ \fi}
% \end{macrocode}
%
%
@@ -6180,7 +6375,9 @@
% before, we must postpone the redefinition of \cmd{\label} until the
% beginning of the document, since other packages do so.
% \begin{macrocode}
+\let\if@cref@amsmathloaded\iffalse%
\@ifpackageloaded{amsmath}{%
+ \let\if@cref@amsmathloaded\iftrue%
\AtBeginDocument{%
\let\cref@old@label@in@display\label@in@display%
\def\label@in@display{%
@@ -6203,7 +6400,7 @@
% But this isn't sufficient to gobble all the arguments any more if an
% optional argument is supplied to our new \cmd{\label}, so we have to
% modify the \package{amsmath} measuring commands so that they let
-% \cmd{\label} to \cmd{\@gobble@optarg} instead.
+% \cmd{\label} to \cmd{\cref@gobble@optarg} instead.
%
% Unfortunately, \package{amsmath} wasn't designed with redefinitions
% of \cmd{\label} in mind, so there appears to be no safe way of doing
@@ -6225,7 +6422,7 @@
\let\math@cr@@@\math@cr@@@align@measure%
\everycr{\noalign{\global\tag@false%
\global\let\raise@tag\@empty \global\column@\z@}}%
- \let\label\@gobble@optarg% <<< cleveref modification
+ \let\label\cref@gobble@optarg% <<< cleveref modification
\global\row@\z@%
\tabskip\z@%
\halign{\span\align@preamble\crcr%
@@ -6237,7 +6434,7 @@
}%
\restorecounters@%
\ifodd\maxfields@%
- \global\advance\maxfields@\@ne%
+ \global\advance\maxfields@\@ne\relax%
\fi%
\ifnum\xatlevel@=\tw@%
\ifnum\maxfields@<\thr@@%
@@ -6248,7 +6445,7 @@
\unvbox\z@ \unpenalty \global\setbox\@ne\lastbox%
}%
\global\totwidth@\wd\@ne%
- \if@fleqn \global\advance\totwidth@\@mathmargin \fi%
+ \if@fleqn \global\advance\totwidth@\@mathmargin\relax\fi%
\global\let\maxcolumn@widths\@empty%
\begingroup%
\let\or\relax%
@@ -6261,7 +6458,7 @@
\repeat%
\endgroup%
\dimen@\displaywidth%
- \advance\dimen@-\totwidth@%
+ \advance\dimen@-\totwidth@\relax%
\ifcase\xatlevel@%
\global\alignsep@\z@%
\let\minalignsep\z@%
@@ -6272,43 +6469,43 @@
\else%
\@tempcnta\tw@%
\global\eqnshift@\dimen@%
- \global\divide\eqnshift@\@tempcnta%
+ \global\divide\eqnshift@\@tempcnta\relax%
\fi%
\or%
\@tempcntb\maxfields@%
- \divide\@tempcntb\tw@%
+ \divide\@tempcntb\tw@\relax%
\@tempcnta\@tempcntb%
- \advance\@tempcntb\m@ne%
+ \advance\@tempcntb\m@ne\relax%
\if@fleqn%
\global\eqnshift@\@mathmargin%
\global\alignsep@\dimen@%
- \global\divide\alignsep@\@tempcnta%
+ \global\divide\alignsep@\@tempcnta\relax%
\else%
- \global\advance\@tempcnta\@ne%
+ \global\advance\@tempcnta\@ne\relax%
\global\eqnshift@\dimen@%
- \global\divide\eqnshift@\@tempcnta%
+ \global\divide\eqnshift@\@tempcnta\relax%
\global\alignsep@\eqnshift@%
\fi%
\or%
\@tempcntb\maxfields@%
- \divide\@tempcntb\tw@%
- \global\advance\@tempcntb\m@ne%
- \global\@tempcnta\@tempcntb%
+ \divide\@tempcntb\tw@\relax%
+ \global\advance\@tempcntb\m@ne\relax%
+ \global\@tempcnta\@tempcntb\relax%
\global\eqnshift@\z@%
\global\alignsep@\dimen@%
\if@fleqn%
\global\advance\alignsep@\@mathmargin\relax%
\fi%
- \global\divide\alignsep@\@tempcntb%
+ \global\divide\alignsep@\@tempcntb\relax%
\fi%
\ifdim\alignsep@<\minalignsep\relax%
\global\alignsep@\minalignsep\relax%
\ifdim\eqnshift@>\z@%
\if@fleqn\else%
\global\eqnshift@\displaywidth%
- \global\advance\eqnshift@-\totwidth@%
- \global\advance\eqnshift@-\@tempcntb\alignsep@%
- \global\divide\eqnshift@\tw@%
+ \global\advance\eqnshift@-\totwidth@\relax%
+ \global\advance\eqnshift@-\@tempcntb\alignsep@\relax%
+ \global\divide\eqnshift@\tw@\relax%
\fi%
\fi%
\fi%
@@ -6317,19 +6514,19 @@
\fi%
\calc@shift@align%
\global\tagshift@\totwidth@%
- \global\advance\tagshift@\@tempcntb\alignsep@%
+ \global\advance\tagshift@\@tempcntb\alignsep@\relax%
\if@fleqn%
\ifnum\xatlevel@=\tw@%
\global\advance\tagshift@-\@mathmargin\relax%
\fi%
\else%
- \global\advance\tagshift@\eqnshift@%
+ \global\advance\tagshift@\eqnshift@\relax%
\fi%
\iftagsleft@ \else%
- \global\advance\tagshift@-\displaywidth%
+ \global\advance\tagshift@-\displaywidth\relax%
\fi%
\dimen@\minalignsep\relax%
- \global\advance\totwidth@\@tempcntb\dimen@%
+ \global\advance\totwidth@\@tempcntb\dimen@\relax%
\ifdim\totwidth@>\displaywidth%
\global\let\displaywidth@\totwidth@%
\else%
@@ -6361,7 +6558,7 @@
}%
\restorecounters@%
\if@fleqn%
- \global\advance\totwidth@\@mathmargin%
+ \global\advance\totwidth@\@mathmargin\relax%
\fi%
\iftagsleft@%
\ifdim\totwidth@>\displaywidth%
@@ -6389,17 +6586,17 @@
% \begin{macrocode}
\def\multline@#1{%
\Let@%
- \@display@init{\global\advance\row@\@ne \global\dspbrk@lvl\m@ne}%
+ \@display@init{\global\advance\row@\@ne\relax\global\dspbrk@lvl\m@ne}%
\chardef\dspbrk@context\z@%
\restore@math@cr%
\let\tag\tag@in@align%
\global\tag@false \global\let\raise@tag\@empty%
\mmeasure@{#1}%
- \let\tag\gobble@tag \let\label\@gobble@optarg% <<< cleveref modification
+ \let\tag\gobble@tag \let\label\cref@gobble@optarg% <<< cleveref modification
\tabskip \if@fleqn \@mathmargin \else \z@skip \fi%
\totwidth@\displaywidth%
\if@fleqn%
- \advance\totwidth@-\@mathmargin%
+ \advance\totwidth@-\@mathmargin\relax%
\fi%
\halign\bgroup%
\hbox to\totwidth@{%
@@ -6436,7 +6633,7 @@
\multline@indent%
\else%
\setbox\z@\hbox{\make@display@tag}%
- \dimen@\@mathmargin \advance\dimen@-\wd\z@%
+ \dimen@\@mathmargin \advance\dimen@-\wd\z@\relax%
\ifdim\dimen@<\multlinetaggap%
\dimen@\multlinetaggap%
\fi%
@@ -6492,11 +6689,11 @@
}%
\global\tagwidth@\wdz@%
\dimen@\totwidth@%
- \advance\dimen@\tagwidth@%
- \advance\dimen@\multlinetaggap%
+ \advance\dimen@\tagwidth@\relax%
+ \advance\dimen@\multlinetaggap\relax%
\iftagsleft@\else%
\if@fleqn%
- \advance\dimen@\@mathmargin%
+ \advance\dimen@\@mathmargin\relax%
\fi%
\fi%
\ifdim\dimen@>\displaywidth%
@@ -6545,13 +6742,13 @@
\let\cref@old@endsubequations\endsubequations%
\cref@resetby{equation}{\cref@result}%
\ifx\cref@result\relax\else%
- \@addtoreset{parentequation}{\cref@result}%
+ \cref@addtoreset{parentequation}{\cref@result}%
\fi%
\renewenvironment{subequations}{%
% \end{macrocode}
% Temporarily declare |equation| counter to be reset by |parentequation|.
% \begin{macrocode}
- \@addtoreset{equation}{parentequation}%
+ \cref@addtoreset{equation}{parentequation}%
% \end{macrocode}
% Temporarily alias |equation| to |subequation|, or to whatever
% |subequation| has been aliased to.
@@ -6609,6 +6806,17 @@
% \end{macro}
% \end{macro}
%
+% Add check to AtBeginDocument to throw error if \package{amsmath} was
+% loaded after cleveref.
+% \begin{macrocode}
+\AtBeginDocument{%
+ \if@cref@amsmathloaded\else%
+ \@ifpackageloaded{amsmath}{%
+ \PackageError{cleveref}{cleveref must be loaded after amsmath!}%
+ {Package load order is wrong: load cleveref *after* amsmath.}
+ }{}%
+ \fi}
+%
%
%
% \subsubsection{\package{amsthm} support}
@@ -6717,7 +6925,6 @@
}{}% end of \@ifpackageloaded{amsthm}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
%
%
@@ -6762,12 +6969,12 @@
\refstepcounter[#1]{#2}% <<< cleveref modification
\theorem@prework%
\thm@topsepadd \theorempostskipamount%
- \ifvmode \advance\thm@topsepadd\partopsep\fi%
+ \ifvmode \advance\thm@topsepadd\partopsep\relax\fi%
\trivlist%
\@topsep \theorempreskipamount%
\@topsepadd \thm@topsepadd%
- \advance\linewidth -\theorem@indent%
- \advance\@totalleftmargin \theorem@indent%
+ \advance\linewidth -\theorem@indent\relax%
+ \advance\@totalleftmargin \theorem@indent\relax%
\parshape \@ne \@totalleftmargin \linewidth%
\@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}%]
}%
@@ -6781,7 +6988,7 @@
%
% \subsubsection{\package{IEEEtrantools} support}
% \begin{macro}{IEEEtrantools}
-% The |IEEEeqnarray| environment and \cmd{\IEEEeqnarraccr} command call
+% The |IEEEeqnarray| environment and \cmd{\IEEEeqnarraccr} command calls
% \cmd{\stepcounter} instead of \cmd{\refstepcounter} to increment the
% equation counters, so they fail to set the cross-reference type for
% \package{cleveref}. We patch in calls to \cmd{\refstepcounter} to fix
@@ -6812,18 +7019,36 @@
% \begin{macro}{\@IEEEeqnarrayXCR}
% \begin{macrocode}
\let\cref@orig@IEEEeqnarrayXCR\@IEEEeqnarrayXCR%
- \def\@IEEEeqnarrayXCR[#1]{%
- \if@eqnsw%
- \if@IEEEissubequation%
- %\addtocounter{equation}{1}%
- \refstepcounter{IEEEsubequation}%
- \addtocounter{IEEEsubequation}{-1}%
- \else%
- \refstepcounter{equation}%
- \addtocounter{equation}{-1}%
+% \end{macrocode}
+% Newer versions of \package{IEEEtrantools} replace
+% |\if@IEEEissubequation| conditional with a counter |\c@IEEEsubequation|
+% that is $>0$ in subequations.
+% \begin{macrocode}
+ \@ifundefined{c@IEEEsubequation}{%
+ \def\@IEEEeqnarrayXCR[#1]{%
+ \if@eqnsw%
+ \if@IEEEissubequation%
+ \refstepcounter{IEEEsubequation}%
+ \addtocounter{IEEEsubequation}{-1}%
+ \else%
+ \refstepcounter{equation}%
+ \addtocounter{equation}{-1}%
+ \fi%
\fi%
- \fi%
- \cref@orig@IEEEeqnarrayXCR[#1]}%
+ \cref@orig@IEEEeqnarrayXCR[#1]}%
+ }{
+ \def\@IEEEeqnarrayXCR[#1]{%
+ \if@eqnsw%
+ \ifnum\c@IEEEsubequation>0\relax%
+ \refstepcounter{IEEEsubequation}%
+ \addtocounter{IEEEsubequation}{-1}%
+ \else%
+ \refstepcounter{equation}%
+ \addtocounter{equation}{-1}%
+ \fi%
+ \fi%
+ \cref@orig@IEEEeqnarrayXCR[#1]}%
+ }% end of \@ifundefined{c@IEEEsubequation}
% \end{macrocode}
% \end{macro}
%
@@ -6847,10 +7072,10 @@
% To get the subequation formatting right, we harmlessly add the
% |IEEEsubequation| counter to the |equation| counter reset list so
% that \package{cleveref} can figure out the subnumbering relationship,
-% and define |IEEEsubequation| to be an alias of the |equation| format.
+% and define |IEEEsubequation| to be an alias of the |subequation| format.
% \begin{macrocode}
- \@addtoreset{IEEEsubequation}{equation}%
- \crefalias{IEEEsubequation}{equation}%
+ \cref@addtoreset{IEEEsubequation}{subequation}%
+ \crefalias{IEEEsubequation}{subequation}%
% \end{macrocode}
% \end{macro}
%
@@ -6876,7 +7101,7 @@
\cref@old@eq@setnumber%
\cref@constructprefix{equation}{\cref@result}%
\protected@xdef\cref@currentlabel{%
- [equation][\arabic{equation}][\cref@result]\p@equation\theequation}}%
+ [equation][\arabic{equation}][\cref@result]\p@equation\eq@number}}%
}{}% end of \@ifpackageloaded{breqn}
% \end{macrocode}
% \end{macro}
@@ -7240,7 +7465,7 @@
\cref@old@newaliascnt{#1}{#2}%
\cref@resetby{#2}{\cref@result}%
\ifx\cref@result\relax\else%
- \@addtoreset{#1}{\cref@result}%
+ \cref@addtoreset{#1}{\cref@result}%
\fi}%
}{}% end of \@ifpackageloaded{aliascnt}
% \end{macrocode}
@@ -7726,19 +7951,19 @@
\@tempa#1\@nil}%
\def\@crefrangenostar#1#2#3{%
\gdef\cref@poorman@text{}%
- \@setcrefrange{#2}{#3}{#1}{}%
+ \@@setcrefrange{#2}{#3}{#1}{}%
\def\@tempa##1##2\@nil{%
\if##1c%
\cref@writescript{}{%
\string\crefrange\string{#2\string}\string{#3\string}}%
\else%
\cref@writescript{}{%
- \string\Crefrange\string{#2\string}\string{#3\string}}%
+ \strinsg\Crefrange\string{#2\string}\string{#3\string}}%
\fi}%
\@tempa#1\@nil}%
\def\@crefrangestar#1#2#3{%
\gdef\cref@poorman@text{}%
- \@crefstarredtrue\@setcrefrange{#2}{#3}{#1}{}\@crefstarredfalse%
+ \@crefstarredtrue\@@setcrefrange{#2}{#3}{#1}{}\@crefstarredfalse%
\def\@tempa##1##2\@nil{%
\if##1c%
\cref@writescript{}{%
@@ -7748,31 +7973,9 @@
\string\Crefrange*\string{#2\string}\string{#3\string}}%
\fi}%
\@tempa#1\@nil}%
- \def\@cpagerefnostar#1#2{%
- \gdef\cref@poorman@text{}%
- \@cpageref{#1}{#2}{\@setcpageref}{\@setcpagerefrange}%
- \def\@tempa##1##2\@nil{%
- \if##1c%
- \cref@writescript{}{\string\cpageref\string{#2\string}}%
- \else%
- \cref@writescript{}{\string\Cpageref\string{#2\string}}%
- \fi}%
- \@tempa#1\@nil}%
- \def\@cpagerefstar#1#2{%
- \gdef\cref@poorman@text{}%
- \@crefstarredtrue%
- \@cpageref{#1}{#2}{\@setcpageref}{\@setcpagerefrange}%
- \@crefstarredfalse%
- \def\@tempa##1##2\@nil{%
- \if##1c%
- \cref@writescript{}{\string\cpageref*\string{#2\string}}%
- \else%
- \cref@writescript{}{\string\Cpageref*\string{#2\string}}%
- \fi}%
- \@tempa#1\@nil}%
\def\@cpagerefrangenostar#1#2#3{%
\gdef\cref@poorman@text{}%
- \@setcpagerefrange{#2}{#3}{#1}{}%
+ \@@setcpagerefrange{#2}{#3}{#1}{}%
\def\@tempa##1##2\@nil{%
\if##1c%
\cref@writescript{}{%
@@ -7785,7 +7988,7 @@
\def\@cpagerefrangestar#1#2#3{%
\gdef\cref@poorman@text{}%
\@crefstarredtrue%
- \@setcpagerefrange{#2}{#3}{#1}{}%
+ \@@setcpagerefrange{#2}{#3}{#1}{}%
\@crefstarredfalse%
\def\@tempa##1##2\@nil{%
\if##1c%
@@ -7808,12 +8011,12 @@
\cref@writescript{}{\string\labelcref*\string{#1\string}}}%
\def\@labelcpagerefnostar#1{%
\gdef\cref@poorman@text{}%
- \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}%
+ \@cref{labelcpageref}{#1}%
\cref@writescript{}{\string\labelcpageref\string{#1\string}}}%
\def\@labelcpagerefstar#1{%
\gdef\cref@poorman@text{}%
\@crefstarredtrue%
- \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}%
+ \@cref{labelcpageref}{#1}%
\@crefstarredfalse%
\cref@writescript{}{\string\labelcpageref*\string{#1\string}}}%
%
@@ -7828,30 +8031,30 @@
\cref@writescript{}{\string\Cref\string{#1\string}}}%
\DeclareRobustCommand{\crefrange}[2]{%
\gdef\cref@poorman@text{}%
- \@setcrefrange{#1}{#2}{cref}{}%
+ \@@setcrefrange{#1}{#2}{cref}{}%
\cref@writescript{}{%
\string\crefrange\string{#1\string}\string{#2\string}}}%
\DeclareRobustCommand{\Crefrange}[2]{%
\gdef\cref@poorman@text{}%
- \@setcrefrange{#1}{#2}{Cref}{}%
+ \@@setcrefrange{#1}{#2}{Cref}{}%
\cref@writescript{}{%
\string\Crefrange\string{#1\string}\string{#2\string}}}%
\DeclareRobustCommand{\cpageref}[1]{%
\gdef\cref@poorman@text{}%
- \@cpageref{cref}{#1}{\@setcpageref}{\@setcpagerefrange}%
+ \@cref{cpageref}{#1}%
\cref@writescript{}{\string\cpageref\string{#1\string}}}%
\DeclareRobustCommand{\Cpageref}[1]{%
\gdef\cref@poorman@text{}%
- \@cpageref{Cref}{#1}{\@setcpageref}{\@setcpagerefrange}%
+ \@cref{Cpageref}{#1}%
\cref@writescript{}{\string\Cpageref\string{#1\string}}}%
\DeclareRobustCommand{\cpagerefrange}[2]{%
\gdef\cref@poorman@text{}%
- \@setcpagerefrange{#1}{#2}{cref}{}%
+ \@@setcpagerefrange{#1}{#2}{cref}{}%
\cref@writescript{}{%
\string\cpagerefrange\string{#1\string}\string{#2\string}}}%
\DeclareRobustCommand{\Cpagerefrange}[2]{%
\gdef\cref@poorman@text{}%
- \@setcpagerefrange{#1}{#2}{Cref}{}%
+ \@@setcpagerefrange{#1}{#2}{Cref}{}%
\cref@writescript{}{%
\string\Cpagerefrange\string{#1\string}\string{#2\string}}}%
\DeclareRobustCommand{\labelcref}[1]{%
@@ -7860,7 +8063,7 @@
\cref@writescript{}{\string\labelcref\string{#1\string}}}%
\DeclareRobustCommand{\labelcpageref}[1]{%
\gdef\cref@poorman@text{}%
- \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}%
+ \@cref{labelcpageref}{#1}%
\cref@writescript{}{\string\labelcpageref\string{#1\string}}}%
\fi% end of test for hyperref
% \end{macrocode}
@@ -7918,8 +8121,8 @@
% \begin{macro}{\@setcref@pairgroupconjunction}
% \begin{macro}{\@setcref@middlegroupconjunction}
% \begin{macro}{\@setcref@lastgroupconjunction}
-% Redefine \cmd{\@@setcref}, \cmd{\@@setcrefrange},
-% \cmd{\@@setcpageref} and\linebreak[4] \cmd{\@@setcpagerefrange}, as
+% Redefine \cmd{\@@@setcref}, \cmd{\@@@setcrefrange},
+% \cmd{\@@@setcpageref} and\linebreak[4] \cmd{\@@@setcpagerefrange}, as
% well as the conjunction macros\linebreak[4]
% \cmd{\@setcref@middlegroupconjunction},
% \cmd{\@setcref@lastgroupconjunction} and
@@ -7943,21 +8146,21 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \begin{macro}{\@@setcref}
-% \begin{macro}{\@@setcrefrange}
-% \begin{macro}{\@@setcpageref}
-% \begin{macro}{\@@setcpagerefrange}
+% \begin{macro}{\@@@setcref}
+% \begin{macro}{\@@@setcrefrange}
+% \begin{macro}{\@@@setcpageref}
+% \begin{macro}{\@@@setcpagerefrange}
% The necessary redefinitions of most of the cross-referencing commands
% differ slightly depending on whether \package{hyperref} is loaded or
% not.
% \begin{macrocode}
- \let\old@@setcref\@@setcref%
- \let\old@@setcrefrange\@@setcrefrange%
- \let\old@@setcpageref\@@setcpageref%
- \let\old@@setcpagerefrange\@@setcpagerefrange%
+ \let\old@@@setcref\@@@setcref%
+ \let\old@@@setcrefrange\@@@setcrefrange%
+ \let\old@@@setcpageref\@@@setcpageref%
+ \let\old@@@setcpagerefrange\@@@setcpagerefrange%
\if@cref@hyperrefloaded\relax% hyperref loaded
- \def\@@setcref#1#2{%
- \old@@setcref{#1}{#2}%
+ \def\@@@setcref#1#2{%
+ \old@@@setcref{#1}{#2}%
\if@crefstarred%
\expandafter\g@addto@macro\expandafter\cref@poorman@text%
\expandafter{#1{\ref*{#2}}{}{}}%
@@ -7965,8 +8168,8 @@
\expandafter\g@addto@macro\expandafter\cref@poorman@text%
\expandafter{#1{\ref{#2}}{}{}}%
\fi}%
- \def\@@setcrefrange#1#2#3{%
- \old@@setcrefrange{#1}{#2}{#3}%
+ \def\@@@setcrefrange#1#2#3{%
+ \old@@@setcrefrange{#1}{#2}{#3}%
\if@crefstarred%
\expandafter\g@addto@macro\expandafter\cref@poorman@text%
\expandafter{#1{\ref*{#2}}{\ref*{#3}}{}{}{}{}}%
@@ -7974,8 +8177,8 @@
\expandafter\g@addto@macro\expandafter\cref@poorman@text%
\expandafter{#1{\ref{#2}}{\ref{#3}}{}{}{}{}}%
\fi}%
- \def\@@setcpageref#1#2{%
- \old@@setcpageref{#1}{#2}%
+ \def\@@@setcpageref#1#2{%
+ \old@@@setcpageref{#1}{#2}%
\if@crefstarred%
\expandafter\g@addto@macro\expandafter\cref@poorman@text%
\expandafter{#1{\pageref*{#2}}{}{}}%
@@ -7983,8 +8186,8 @@
\expandafter\g@addto@macro\expandafter\cref@poorman@text%
\expandafter{#1{\pageref{#2}}{}{}}%
\fi}%
- \def\@@setcpagerefrange#1#2#3{%
- \old@@setcpagerefrange{#1}{#2}{#3}%
+ \def\@@@setcpagerefrange#1#2#3{%
+ \old@@@setcpagerefrange{#1}{#2}{#3}%
\if@crefstarred%
\expandafter\g@addto@macro\expandafter\cref@poorman@text%
\expandafter{#1{\pageref*{#2}}{\pageref*{#3}}{}{}{}{}}%
@@ -7994,23 +8197,23 @@
\fi}%
%
\else% hyperref not loaded
- \def\@@setcref#1#2{%
- \old@@setcref{#1}{#2}%
+ \def\@@@setcref#1#2{%
+ \old@@@setcref{#1}{#2}%
\expandafter\g@addto@macro\expandafter{%
\expandafter\cref@poorman@text\expandafter}%
\expandafter{#1{\ref{#2}}{}{}}}%
- \def\@@setcrefrange#1#2#3{%
- \old@@setcrefrange{#1}{#2}{#3}%
+ \def\@@@setcrefrange#1#2#3{%
+ \old@@@setcrefrange{#1}{#2}{#3}%
\expandafter\g@addto@macro%
\expandafter{\expandafter\cref@poorman@text\expandafter}%
\expandafter{#1{\ref{#2}}{\ref{#3}}{}{}{}{}}}%
- \def\@@setcpageref#1#2{%
- \old@@setcpageref{#1}{#2}%
+ \def\@@@setcpageref#1#2{%
+ \old@@@setcpageref{#1}{#2}%
\expandafter\g@addto@macro\expandafter{%
\expandafter\cref@poorman@text\expandafter}%
\expandafter{#1{\pageref{#2}}{}{}}}%
- \def\@@setcpagerefrange#1#2#3{%
- \old@@setcpagerefrange{#1}{#2}{#3}%
+ \def\@@@setcpagerefrange#1#2#3{%
+ \old@@@setcpagerefrange{#1}{#2}{#3}%
\expandafter\g@addto@macro%
\expandafter{\expandafter\cref@poorman@text\expandafter}%
\expandafter{#1{\pageref{#2}}{\pageref{#3}}{}{}{}{}}}%
@@ -8020,14 +8223,14 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \begin{macro}{\@@setnamecref}
+% \begin{macro}{\@@@setnamecref}
% The \cmd{\namecref} et al.\ commands don't do anything different when
% \package{hyperref} is loaded, so we don't need to test for
-% \package{hyperref} when redefining \cmd{\@@setnamecref}.
+% \package{hyperref} when redefining \cmd{\@@@setnamecref}.
% \begin{macrocode}
- \let\old@@setnamecref\@@setnamecref%
- \def\@@setnamecref#1#2{%
- \old@@setnamecref{#1}{#2}%
+ \let\old@@@setnamecref\@@@setnamecref%
+ \def\@@@setnamecref#1#2{%
+ \old@@@setnamecref{#1}{#2}%
\expandafter\def\expandafter\@tempa\expandafter{#1}%
\def\@tempb{#2}%
\expandafter\expandafter\expandafter\g@addto@macro%
@@ -8139,25 +8342,25 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\@@setvpageref}
-% \begin{macro}{\@@setvpagerefrange}
+% \begin{macro}{\@@@setvpageref}
+% \begin{macro}{\@@@setvpagerefrange}
% In order to get the appropriate substitution for \package{varioref}
% commands appended to \cmd{\cref@poorman@text}, we have to redefine
-% \cmd{\@@setvpageref} and\linebreak[4] \cmd{\@@setvpagerefrange},
+% \cmd{\@@@setvpageref} and\linebreak[4] \cmd{\@@@setvpagerefrange},
% which perform the final typesetting of \package{varioref} page
% references, so that they append an appropriate substitution for the
% page reference they're typesetting.
% \begin{macrocode}
- \def\@@setvpageref#1[#2]#3{%
+ \def\@@@setvpageref#1[#2]#3{%
\cref@old@@vpageref{#1}[#2]{#3}%
\g@addto@macro\cref@poorman@text{\vpageref{#3}}}%
- \def\@@setvpagerefrange[#1]#2#3{%
+ \def\@@@setvpagerefrange[#1]#2#3{%
\vpagerefrange[#1]{#2}{#3}%
\g@addto@macro\cref@poorman@text{\vpagerefrange{#2}{#3}}}%
- \def\@@setfullpageref#1{%
+ \def\@@@setfullpageref#1{%
\reftextfaraway{#1}%
\g@addto@macro\cref@poorman@text{\reftextfaraway{#1}}}%
- \def\@@setfullpagerefrange#1#2{%
+ \def\@@@setfullpagerefrange#1#2{%
\reftextpagerange{#1}{#2}%
\g@addto@macro\cref@poorman@text{\reftextpagerange{#1}{#2}}}%
% \end{macrocode}
@@ -12190,7 +12393,7 @@
\crefname{subfigure}{Figur}{Figur}%
\fi%
\crefname{page}{Sida}{Sida}%
- \crefname{table}{Tablell}{Tabell}%
+ \crefname{table}{Tabell}{Tabell}%
\crefname{subtable}{Tabell}{Tabell}%
\crefname{part}{Del}{Del}%
\crefname{chapter}{Kapitel}{Kapitel}%
@@ -12232,7 +12435,7 @@
\crefname{subfigure}{figur}{figur}%
\crefname{page}{sida}{sida}%
\fi%
- \crefname{table}{tablell}{tabell}%
+ \crefname{table}{tabell}{tabell}%
\crefname{subtable}{tabell}{tabell}%
\crefname{part}{del}{del}%
\crefname{chapter}{kapitel}{kapitel}%
@@ -12510,6 +12713,232 @@
% \end{macrocode}
%
%
+% \subsubsection{Catalan}
+% \begin{macro}{catalan}
+% Catalan definitions thanks to Rafel Jaume Deya and Eva Bosch Roura.
+% \end{macro}
+%
+% Set up the definitions used at the beginning of the document to define
+% the formats created by the document preamble.
+% \begin{macrocode}
+\DeclareOption{catalan}{%
+ \AtBeginDocument{%
+ \def\crefrangeconjunction@preamble{ a\nobreakspace}%
+ \def\crefrangepreconjunction@preamble{}%
+ \def\crefrangepostconjunction@preamble{}%
+ \def\crefpairconjunction@preamble{ i\nobreakspace}%
+ \def\crefmiddleconjunction@preamble{, }%
+ \def\creflastconjunction@preamble{ i\nobreakspace}%
+% \end{macrocode}
+% We have to define the group conjunctions explicitly here, rather than
+% relying on fall-back definitions in terms of the above conjunctions
+% (see \cref{sec:code:default_formats}), in case any other language
+% option defines them explicitly and we need to override those.
+% \begin{macrocode}
+ \def\crefpairgroupconjunction@preamble{ i\nobreakspace}%
+ \def\crefmiddlegroupconjunction@preamble{, }%
+ \def\creflastgroupconjunction@preamble{ i\nobreakspace}%
+ %
+ \Crefname@preamble{equation}{Equaci\'o}{Equacions}%
+ \Crefname@preamble{figure}{Gr\`afic}{Gr\`afics}%
+ \Crefname@preamble{table}{Taula}{Taules}%
+ \Crefname@preamble{page}{P\`agina}{P\`agines}%
+ \Crefname@preamble{part}{Part}{Parts}%
+ \Crefname@preamble{chapter}{Cap\'itol}{Cap\'itols}%
+ \Crefname@preamble{section}{Secci\'o}{Seccions}%
+ \Crefname@preamble{appendix}{Ap\`endix}{Ap\`endixs}%
+ \Crefname@preamble{enumi}{Punt}{Punts}%
+ \Crefname@preamble{footnote}{Nota}{Notes}%
+ \Crefname@preamble{theorem}{Teorema}{Teoremes}%
+ \Crefname@preamble{lemma}{Lema}{Lemes}%
+ \Crefname@preamble{corollary}{Coro\lgem ari}{Coro\lgem aris}%
+ \Crefname@preamble{proposition}{Proposici\'o}{Proposicions}%
+ \Crefname@preamble{definition}{Definici\'o}{Definicions}%
+ \Crefname@preamble{result}{Resultat}{Resultats}%
+ \Crefname@preamble{example}{Exemple}{Exemples}%
+ \Crefname@preamble{remark}{Observaci\'o}{Observacions}%
+ \Crefname@preamble{note}{Nota}{Notes}%
+ \Crefname@preamble{algorithm}{Algorisme}{Algorismes}%
+ \Crefname@preamble{listing}{Llistat}{Llistats}%
+ \Crefname@preamble{line}{L\'inia}{L\'inies}%
+ %
+ \if@cref@capitalise% capitalise set
+ \crefname@preamble{equation}{Equaci\'o}{Equacions}%
+ \crefname@preamble{figure}{Gr\`afic}{Gr\`afics}%
+ \crefname@preamble{table}{Taula}{Taules}%
+ \crefname@preamble{page}{P\`agina}{P\`agines}%
+ \crefname@preamble{part}{Part}{Parts}%
+ \crefname@preamble{chapter}{Cap\'itol}{Cap\'itols}%
+ \crefname@preamble{section}{Secci\'o}{Seccions}%
+ \crefname@preamble{appendix}{Ap\`endix}{Ap\`endixs}%
+ \crefname@preamble{enumi}{Punt}{Punts}%
+ \crefname@preamble{footnote}{Nota}{Notes}%
+ \crefname@preamble{theorem}{Teorema}{Teoremes}%
+ \crefname@preamble{lemma}{Lema}{Lemes}%
+ \crefname@preamble{corollary}{Coro\lgem ari}{Coro\lgem aris}%
+ \crefname@preamble{proposition}{Proposici\'o}{Proposicions}%
+ \crefname@preamble{definition}{Definici\'o}{Definicions}%
+ \crefname@preamble{result}{Resultat}{Resultats}%
+ \crefname@preamble{example}{Exemple}{Exemples}%
+ \crefname@preamble{remark}{Observaci\'o}{Observacions}%
+ \crefname@preamble{note}{Nota}{Notes}%
+ \crefname@preamble{algorithm}{Algorisme}{Algorismes}%
+ \crefname@preamble{listing}{Llistat}{Llistats}%
+ \crefname@preamble{line}{L\'inia}{L\'inies}%
+ %
+ \else% capitalise unset
+ \crefname@preamble{equation}{equaci\'o}{equacions}%
+ \crefname@preamble{figure}{gr\`afic}{gr\`afics}%
+ \crefname@preamble{table}{taula}{taules}%
+ \crefname@preamble{page}{p\`agina}{p\`agines}%
+ \crefname@preamble{part}{part}{parts}%
+ \crefname@preamble{chapter}{cap\'itol}{cap\'itols}%
+ \crefname@preamble{section}{secci\'o}{seccions}%
+ \crefname@preamble{appendix}{ap\`endix}{ap\`endixs}%
+ \crefname@preamble{enumi}{punt}{punts}%
+ \crefname@preamble{footnote}{nota}{notes}%
+ \crefname@preamble{theorem}{teorema}{teoremes}%
+ \crefname@preamble{lemma}{lema}{lemes}%
+ \crefname@preamble{corollary}{coro\lgem ari}{coro\lgem aris}%
+ \crefname@preamble{proposition}{proposici\'o}{proposicions}%
+ \crefname@preamble{definition}{definici\'o}{definicions}%
+ \crefname@preamble{result}{resultat}{resultats}%
+ \crefname@preamble{example}{exemple}{exemples}%
+ \crefname@preamble{remark}{observaci\'o}{observacions}%
+ \crefname@preamble{note}{nota}{notes}%
+ \crefname@preamble{algorithm}{algorisme}{algorismes}%
+ \crefname@preamble{listing}{llistat}{llistats}%
+ \crefname@preamble{line}{l\'inia}{l\'inies}%
+ \fi%
+ \def\cref@language{catalan}%
+ }}% end \AtBeginDocument and \DeclareOption
+% \end{macrocode}
+%
+% If using \package{babel} and the corresponding option is set, or if
+% using \package{polyglossia} and the language has been loaded, add
+% format definition commands to \cmd{\extras}\meta{language} or
+% \cmd{\captions}\meta{language} so that language switching commands will
+% change the cross-reference formats appropriately.
+% \begin{macrocode}
+\cref@addlanguagedefs{catalan}{%
+ \PackageInfo{cleveref}{loaded `catalan language definitions}%
+ \renewcommand{\crefrangeconjunction}{ a\nobreakspace}%
+ \renewcommand{\crefrangepreconjunction}{}%
+ \renewcommand{\crefrangepostconjunction}{}%
+ \renewcommand{\crefpairconjunction}{ i\nobreakspace}%
+ \renewcommand{\crefmiddleconjunction}{, }%
+ \renewcommand{\creflastconjunction}{ i\nobreakspace}%
+ \renewcommand{\crefpairgroupconjunction}{ i\nobreakspace}%
+ \renewcommand{\crefmiddlegroupconjunction}{, }%
+ \renewcommand{\creflastgroupconjunction}{ i\nobreakspace}%
+ %
+ \Crefname{equation}{Equaci\'o}{Equacions}%
+ \Crefname{figure}{Gr\`afic}{Gr\`afics}%
+ \Crefname{subfigure}{Gr\`afic}{Gr\`afics}%
+ \Crefname{table}{Taula}{Taules}%
+ \Crefname{subtable}{Taula}{Taules}%
+ \Crefname{page}{P\`agina}{P\`aginas}%
+ \Crefname{part}{Part}{Parts}%
+ \Crefname{chapter}{Cap\'itol}{Cap\'itols}%
+ \Crefname{section}{Secci\'o}{Seccions}%
+ \Crefname{subsection}{Secci\'o}{Seccions}%
+ \Crefname{subsubsection}{Secci\'o}{Seccions}%
+ \Crefname{appendix}{Ap\`endix}{Ap\`endixs}%
+ \Crefname{subappendix}{Ap\`endix}{Ap\`endixs}%
+ \Crefname{subsubappendix}{Ap\`endix}{Ap\`endixs}%
+ \Crefname{subsubsubappendix}{Ap\`endix}{Ap\`endixs}%
+ \Crefname{enumi}{Punt}{Punts}%
+ \Crefname{enumii}{Punt}{Punts}%
+ \Crefname{enumiii}{Punt}{Punts}%
+ \Crefname{enumiv}{Punt}{Punts}%
+ \Crefname{enumv}{Punt}{Punts}%
+ \Crefname{footnote}{Nota}{Notes}%
+ \Crefname{theorem}{Teorema}{Teoremes}%
+ \Crefname{lemma}{Lema}{Lemes}%
+ \Crefname{corollary}{Coro\lgem ari}{Coro\lgem aris}%
+ \Crefname{proposition}{Proposici\'o}{Proposicions}%
+ \Crefname{definition}{Definici\'o}{Definicions}%
+ \Crefname{result}{Resultat}{Resultats}%
+ \Crefname{example}{Exemple}{Exemples}%
+ \Crefname{remark}{Observaci\'o}{Observacions}%
+ \Crefname{note}{Nota}{Notes}%
+ \Crefname{algorithm}{Algorisme}{Algorismes}%
+ \Crefname{listing}{Llistat}{Llistats}%
+ \Crefname{line}{L\'inia}{L\'inies}%
+ %
+ \if@cref@capitalise% capitalise set
+ \crefname{equation}{Equaci\'o}{Equacions}%
+ \crefname{figure}{Gr\`afic}{Gr\`afics}%
+ \crefname{subfigure}{Gr\`afic}{Gr\`afics}%
+ \crefname{table}{Taula}{Taules}%
+ \crefname{subtable}{Taula}{Taules}%
+ \crefname{page}{P\`agina}{P\`aginas}%
+ \crefname{part}{Part}{Parts}%
+ \crefname{chapter}{Cap\'itol}{Cap\'itols}%
+ \crefname{section}{Secci\'o}{Seccions}%
+ \crefname{subsection}{Secci\'o}{Seccions}%
+ \crefname{subsubsection}{Secci\'o}{Seccions}%
+ \crefname{appendix}{Ap\`endix}{Ap\`endixs}%
+ \crefname{subappendix}{Ap\`endix}{Ap\`endixs}%
+ \crefname{subsubappendix}{Ap\`endix}{Ap\`endixs}%
+ \crefname{subsubsubappendix}{Ap\`endix}{Ap\`endixs}%
+ \crefname{enumi}{Punt}{Punts}%
+ \crefname{enumii}{Punt}{Punts}%
+ \crefname{enumiii}{Punt}{Punts}%
+ \crefname{enumiv}{Punt}{Punts}%
+ \crefname{enumv}{Punt}{Punts}%
+ \crefname{footnote}{Nota}{Notes}%
+ \crefname{theorem}{Teorema}{Teoremes}%
+ \crefname{lemma}{Lema}{Lemes}%
+ \crefname{corollary}{Coro\lgem ari}{Coro\lgem aris}%
+ \crefname{proposition}{Proposici\'o}{Proposicions}%
+ \crefname{definition}{Definici\'o}{Definicions}%
+ \crefname{result}{Resultat}{Resultats}%
+ \crefname{example}{Exemple}{Exemples}%
+ \crefname{remark}{Observaci\'o}{Observacions}%
+ \crefname{note}{Nota}{Notes}%
+ \crefname{algorithm}{Algorisme}{Algorismes}%
+ \crefname{listing}{Llistat}{Llistats}%
+ \crefname{line}{L\'inia}{L\'inies}%
+ %
+ \else% capitalise unset
+ \crefname{equation}{equaci\'o}{equacions}%
+ \crefname{figure}{gr\`afic}{gr\`afics}%
+ \crefname{subfigure}{gr\`afic}{gr\`afics}%
+ \crefname{table}{taula}{taules}%
+ \crefname{subtable}{taula}{taules}%
+ \crefname{page}{p\`agina}{p\`aginas}%
+ \crefname{part}{part}{parts}%
+ \crefname{chapter}{cap\'itol}{cap\'itols}%
+ \crefname{section}{secci\'o}{seccions}%
+ \crefname{subsection}{secci\'o}{seccions}%
+ \crefname{subsubsection}{secci\'o}{seccions}%
+ \crefname{appendix}{ap\`endix}{ap\`endixs}%
+ \crefname{subappendix}{ap\`endix}{ap\`endixs}%
+ \crefname{subsubappendix}{ap\`endix}{ap\`endixs}%
+ \crefname{subsubsubappendix}{ap\`endix}{ap\`endixs}%
+ \crefname{enumi}{punt}{punts}%
+ \crefname{enumii}{punt}{punts}%
+ \crefname{enumiii}{punt}{punts}%
+ \crefname{enumiv}{punt}{punts}%
+ \crefname{enumv}{punt}{punts}%
+ \crefname{footnote}{nota}{notes}%
+ \crefname{theorem}{teorema}{teoremes}%
+ \crefname{lemma}{lema}{lemes}%
+ \crefname{corollary}{coro\lgem ari}{coro\lgem aris}%
+ \crefname{proposition}{proposici\'o}{proposicions}%
+ \crefname{definition}{definici\'o}{definicions}%
+ \crefname{result}{resultat}{resultats}%
+ \crefname{example}{exemple}{exemples}%
+ \crefname{remark}{observaci\'o}{observacions}%
+ \crefname{note}{nota}{notes}%
+ \crefname{algorithm}{algorisme}{algorismes}%
+ \crefname{listing}{llistat}{llistats}%
+ \crefname{line}{l\'inia}{l\'inies}%
+ \fi}% end \cref@loadlanguagedefs
+% \end{macrocode}
+%
+%
% \subsection{Default Cross-Reference Formats}
% \label{sec:code:default_formats}
% The \option{capitalise} and \option{nameinlink} options must be
@@ -12553,7 +12982,6 @@
\else%
\creflabelformat{equation}{\textup{(#2#1#3)}}%
\fi%
-\@labelcrefdefinedefaultformats%
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -12793,772 +13221,28 @@
% \end{macrocode}
%
% If formats for subsections are undefined, define them to be identical
-% to the formats for sections.
-% \begin{macrocode}
- \@ifundefined{cref@subsection@name}{%
- \let\cref@subsection@name\cref@section@name%
- \let\cref@subsection@name@plural\cref@section@name@plural}{}%
- \@ifundefined{Cref@subsection@name}{%
- \let\Cref@subsection@name\Cref@section@name%
- \let\Cref@subsection@name@plural\Cref@section@name@plural}{}%
- \@ifundefined{cref@subsection@format}{%
- \let\cref@subsection@format\cref@section@format}{}%
- \@ifundefined{Cref@subsection@format}{%
- \let\Cref@subsection@format\Cref@section@format}{}%
- \@ifundefined{crefrange@subsection@format}{%
- \let\crefrange@subsection@format%
- \crefrange@section@format}{}%
- \@ifundefined{Crefrange@subsection@format}{%
- \let\Crefrange@subsection@format%
- \Crefrange@section@format}{}%
- \@ifundefined{cref@subsection@format@first}{%
- \let\cref@subsection@format@first%
- \cref@section@format@first}{}%
- \@ifundefined{Cref@subsection@format@first}{%
- \let\Cref@subsection@format@first%
- \Cref@section@format@first}{}%
- \@ifundefined{cref@subsection@format@second}{%
- \let\cref@subsection@format@second%
- \cref@section@format@second}{}%
- \@ifundefined{Cref@subsection@format@second}{%
- \let\Cref@subsection@format@second%
- \Cref@section@format@second}{}%
- \@ifundefined{cref@subsection@format@middle}{%
- \let\cref@subsection@format@middle%
- \cref@section@format@middle}{}%
- \@ifundefined{Cref@subsection@format@middle}{%
- \let\Cref@subsection@format@middle%
- \Cref@section@format@middle}{}%
- \@ifundefined{cref@subsection@format@last}{%
- \let\cref@subsection@format@last%
- \cref@section@format@last}{}%
- \@ifundefined{Cref@subsection@format@last}{%
- \let\Cref@subsection@format@last%
- \Cref@section@format@last}{}%
- \@ifundefined{crefrange@subsection@format@first}{%
- \let\crefrange@subsection@format@first%
- \crefrange@section@format@first}{}%
- \@ifundefined{Crefrange@subsection@format@first}{%
- \let\Crefrange@subsection@format@first%
- \Crefrange@section@format@first}{}%
- \@ifundefined{crefrange@subsection@format@second}{%
- \let\crefrange@subsection@format@second%
- \crefrange@section@format@second}{}%
- \@ifundefined{Crefrange@subsection@format@second}{%
- \let\Crefrange@subsection@format@second%
- \Crefrange@section@format@second}{}%
- \@ifundefined{crefrange@subsection@format@middle}{%
- \let\crefrange@subsection@format@middle%
- \crefrange@section@format@middle}{}%
- \@ifundefined{Crefrange@subsection@format@middle}{%
- \let\Crefrange@subsection@format@middle%
- \Crefrange@section@format@middle}{}%
- \@ifundefined{crefrange@subsection@format@last}{%
- \let\crefrange@subsection@format@last%
- \crefrange@section@format@last}{}%
- \@ifundefined{Crefrange@subsection@format@last}{%
- \let\Crefrange@subsection@format@last%
- \Crefrange@section@format@last}{}%
-%
- \@ifundefined{cref@subsubsection@name}{%
- \let\cref@subsubsection@name\cref@section@name%
- \let\cref@subsubsection@name@plural\cref@section@name@plural}{}%
- \@ifundefined{Cref@subsection@name}{%
- \let\Cref@subsection@name\Cref@section@name%
- \let\Cref@subsection@name@plural\Cref@section@name@plural}{}%
- \@ifundefined{cref@subsubsection@format}{%
- \let\cref@subsubsection@format%
- \cref@subsection@format}{}%
- \@ifundefined{Cref@subsubsection@format}{%
- \let\Cref@subsubsection@format%
- \Cref@subsection@format}{}%
- \@ifundefined{crefrange@subsubsection@format}{%
- \let\crefrange@subsubsection@format%
- \crefrange@subsection@format}{}%
- \@ifundefined{Crefrange@subsubsection@format}{%
- \let\Crefrange@subsubsection@format%
- \Crefrange@subsection@format}{}%
- \@ifundefined{cref@subsubsection@format@first}{%
- \let\cref@subsubsection@format@first%
- \cref@subsection@format@first}{}%
- \@ifundefined{Cref@subsubsection@format@first}{%
- \let\Cref@subsubsection@format@first%
- \Cref@subsection@format@first}{}%
- \@ifundefined{cref@subsubsection@format@second}{%
- \let\cref@subsubsection@format@second%
- \cref@subsection@format@second}{}%
- \@ifundefined{Cref@subsubsection@format@second}{%
- \let\Cref@subsubsection@format@second%
- \Cref@subsection@format@second}{}%
- \@ifundefined{cref@subsubsection@format@middle}{%
- \let\cref@subsubsection@format@middle%
- \cref@subsection@format@middle}{}%
- \@ifundefined{Cref@subsubsection@format@middle}{%
- \let\Cref@subsubsection@format@middle%
- \Cref@subsection@format@middle}{}%
- \@ifundefined{cref@subsubsection@format@last}{%
- \let\cref@subsubsection@format@last%
- \cref@subsection@format@last}{}%
- \@ifundefined{Cref@subsubsection@format@last}{%
- \let\Cref@subsubsection@format@last%
- \Cref@subsection@format@last}{}%
- \@ifundefined{crefrange@subsubsection@format@first}{%
- \let\crefrange@subsubsection@format@first%
- \crefrange@subsection@format@first}{}%
- \@ifundefined{Crefrange@subsubsection@format@first}{%
- \let\Crefrange@subsubsection@format@first%
- \Crefrange@subsection@format@first}{}%
- \@ifundefined{crefrange@subsubsection@format@second}{%
- \let\crefrange@subsubsection@format@second%
- \crefrange@subsection@format@second}{}%
- \@ifundefined{Crefrange@subsubsection@format@second}{%
- \let\Crefrange@subsubsection@format@second%
- \Crefrange@subsection@format@second}{}%
- \@ifundefined{crefrange@subsubsection@format@middle}{%
- \let\crefrange@subsubsection@format@middle%
- \crefrange@subsection@format@middle}{}%
- \@ifundefined{Crefrange@subsubsection@format@middle}{%
- \let\Crefrange@subsubsection@format@middle%
- \Crefrange@subsection@format@middle}{}%
- \@ifundefined{crefrange@subsubsection@format@last}{%
- \let\crefrange@subsubsection@format@last%
- \crefrange@subsection@format@last}{}%
- \@ifundefined{Crefrange@subsubsection@format@last}{%
- \let\Crefrange@subsubsection@format@last%
- \Crefrange@subsection@format@last}{}%
-% \end{macrocode}
-% Similarly for subsections within appendices.
-% \begin{macrocode}
- \@ifundefined{cref@subappendix@name}{%
- \let\cref@subappendix@name\cref@appendix@name%
- \let\cref@subappendix@name@plural%
- \cref@appendix@name@plural}{}%
- \@ifundefined{Cref@subappendix@name}{%
- \let\Cref@subappendix@name\Cref@section@name%
- \let\Cref@subappendixsection@name@plural%
- \Cref@appendix@name@plural}{}%
- \@ifundefined{cref@subappendix@format}{%
- \let\cref@subappendix@format\cref@appendix@format}{}%
- \@ifundefined{Cref@subappendix@format}{%
- \let\Cref@subappendix@format\Cref@appendix@format}{}%
- \@ifundefined{crefrange@subappendix@format}{%
- \let\crefrange@subappendix@format%
- \crefrange@appendix@format}{}%
- \@ifundefined{Crefrange@subappendix@format}{%
- \let\Crefrange@subappendix@format%
- \Crefrange@appendix@format}{}%
- \@ifundefined{cref@subappendix@format@first}{%
- \let\cref@subappendix@format@first%
- \cref@appendix@format@first}{}%
- \@ifundefined{Cref@subappendix@format@first}{%
- \let\Cref@subappendix@format@first%
- \Cref@appendix@format@first}{}%
- \@ifundefined{cref@subappendix@format@second}{%
- \let\cref@subappendix@format@second%
- \cref@appendix@format@second}{}%
- \@ifundefined{Cref@subappendix@format@second}{%
- \let\Cref@subappendix@format@second%
- \Cref@appendix@format@second}{}%
- \@ifundefined{cref@subappendix@format@middle}{%
- \let\cref@subappendix@format@middle%
- \cref@appendix@format@middle}{}%
- \@ifundefined{Cref@subappendix@format@middle}{%
- \let\Cref@subappendix@format@middle%
- \Cref@appendix@format@middle}{}%
- \@ifundefined{cref@subappendix@format@last}{%
- \let\cref@subappendix@format@last%
- \cref@appendix@format@last}{}%
- \@ifundefined{Cref@subappendix@format@last}{%
- \let\Cref@subappendix@format@last%
- \Cref@appendix@format@last}{}%
- \@ifundefined{crefrange@subappendix@format@first}{%
- \let\crefrange@subappendix@format@first%
- \crefrange@appendix@format@first}{}%
- \@ifundefined{Crefrange@subappendix@format@first}{%
- \let\Crefrange@subappendix@format@first%
- \Crefrange@appendix@format@first}{}%
- \@ifundefined{crefrange@subappendix@format@second}{%
- \let\crefrange@subappendix@format@second%
- \crefrange@appendix@format@second}{}%
- \@ifundefined{Crefrange@subappendix@format@second}{%
- \let\Crefrange@subappendix@format@second%
- \Crefrange@appendix@format@second}{}%
- \@ifundefined{crefrange@subappendix@format@middle}{%
- \let\crefrange@subappendix@format@middle%
- \crefrange@appendix@format@middle}{}%
- \@ifundefined{Crefrange@subappendix@format@middle}{%
- \let\Crefrange@subappendix@format@middle%
- \Crefrange@appendix@format@middle}{}%
- \@ifundefined{crefrange@subappendix@format@last}{%
- \let\crefrange@subappendix@format@last%
- \crefrange@appendix@format@last}{}%
- \@ifundefined{Crefrange@subappendix@format@last}{%
- \let\Crefrange@subappendix@format@last%
- \Crefrange@appendix@format@last}{}%
-%
- \@ifundefined{cref@subsubappendix@name}{%
- \let\cref@subsubappendix@name\cref@appendix@name%
- \let\cref@subsubappendix@name@plural%
- \cref@appendix@name@plural}{}%
- \@ifundefined{Cref@subsubappendix@name}{%
- \let\Cref@subsubappendix@name\Cref@section@name%
- \let\Cref@subsubappendixsection@name@plural%
- \Cref@appendix@name@plural}{}%
- \@ifundefined{cref@subsubappendix@format}{%
- \let\cref@subsubappendix@format%
- \cref@subappendix@format}{}%
- \@ifundefined{Cref@subsubappendix@format}{%
- \let\Cref@subsubappendix@format%
- \Cref@subappendix@format}{}%
- \@ifundefined{crefrange@subsubappendix@format}{%
- \let\crefrange@subsubappendix@format%
- \crefrange@subappendix@format}{}%
- \@ifundefined{Crefrange@subsubappendix@format}{%
- \let\Crefrange@subsubappendix@format%
- \Crefrange@subappendix@format}{}%
- \@ifundefined{cref@subsubappendix@format@first}{%
- \let\cref@subsubappendix@format@first%
- \cref@subappendix@format@first}{}%
- \@ifundefined{Cref@subsubappendix@format@first}{%
- \let\Cref@subsubappendix@format@first%
- \Cref@subappendix@format@first}{}%
- \@ifundefined{cref@subsubappendix@format@second}{%
- \let\cref@subsubappendix@format@second%
- \cref@subappendix@format@second}{}%
- \@ifundefined{Cref@subsubappendix@format@second}{%
- \let\Cref@subsubappendix@format@second%
- \Cref@subappendix@format@second}{}%
- \@ifundefined{cref@subsubappendix@format@middle}{%
- \let\cref@subsubappendix@format@middle%
- \cref@subappendix@format@middle}{}%
- \@ifundefined{Cref@subsubappendix@format@middle}{%
- \let\Cref@subsubappendix@format@middle%
- \Cref@subappendix@format@middle}{}%
- \@ifundefined{cref@subsubappendix@format@last}{%
- \let\cref@subsubappendix@format@last%
- \cref@subappendix@format@last}{}%
- \@ifundefined{Cref@subsubappendix@format@last}{%
- \let\Cref@subsubappendix@format@last%
- \Cref@subappendix@format@last}{}%
- \@ifundefined{crefrange@subsubappendix@format@first}{%
- \let\crefrange@subsubappendix@format@first%
- \crefrange@subappendix@format@first}{}%
- \@ifundefined{Crefrange@subsubappendix@format@first}{%
- \let\Crefrange@subsubappendix@format@first%
- \Crefrange@subappendix@format@first}{}%
- \@ifundefined{crefrange@subsubappendix@format@second}{%
- \let\crefrange@subsubappendix@format@second%
- \crefrange@subappendix@format@second}{}%
- \@ifundefined{Crefrange@subsubappendix@format@second}{%
- \let\Crefrange@subsubappendix@format@second%
- \Crefrange@subappendix@format@second}{}%
- \@ifundefined{crefrange@subsubappendix@format@middle}{%
- \let\crefrange@subsubappendix@format@middle%
- \crefrange@subappendix@format@middle}{}%
- \@ifundefined{Crefrange@subsubappendix@format@middle}{%
- \let\Crefrange@subsubappendix@format@middle%
- \Crefrange@subappendix@format@middle}{}%
- \@ifundefined{crefrange@subsubappendix@format@last}{%
- \let\crefrange@subsubappendix@format@last%
- \crefrange@subappendix@format@last}{}%
- \@ifundefined{Crefrange@subsubappendix@format@last}{%
- \let\Crefrange@subsubappendix@format@last%
- \Crefrange@subappendix@format@last}{}%
-%
- \@ifundefined{cref@subsubsubappendix@format}{%
- \let\cref@subsubsubappendix@format%
- \cref@subsubappendix@format}{}%
- \@ifundefined{Cref@subsubsubappendix@format}{%
- \let\Cref@subsubsubappendix@format%
- \Cref@subsubappendix@format}{}%
- \@ifundefined{crefrange@subsubsubappendix@format}{%
- \let\crefrange@subsubsubappendix@format%
- \crefrange@subsubappendix@format}{}%
- \@ifundefined{Crefrange@subsubsubappendix@format}{%
- \let\Crefrange@subsubsubappendix@format%
- \Crefrange@subsubappendix@format}{}%
- \@ifundefined{cref@subsubsubappendix@format@first}{%
- \let\cref@subsubsubappendix@format@first%
- \cref@subsubappendix@format@first}{}%
- \@ifundefined{Cref@subsubsubappendix@format@first}{%
- \let\Cref@subsubsubappendix@format@first%
- \Cref@subsubappendix@format@first}{}%
- \@ifundefined{cref@subsubsubappendix@format@second}{%
- \let\cref@subsubsubappendix@format@second%
- \cref@subsubappendix@format@second}{}%
- \@ifundefined{Cref@subsubsubappendix@format@second}{%
- \let\Cref@subsubsubappendix@format@second%
- \Cref@subsubappendix@format@second}{}%
- \@ifundefined{cref@subsubsubappendix@format@middle}{%
- \let\cref@subsubsubappendix@format@middle%
- \cref@subsubappendix@format@middle}{}%
- \@ifundefined{Cref@subsubsubappendix@format@middle}{%
- \let\Cref@subsubsubappendix@format@middle%
- \Cref@subsubappendix@format@middle}{}%
- \@ifundefined{cref@subsubsubappendix@format@last}{%
- \let\cref@subsubsubappendix@format@last%
- \cref@subsubappendix@format@last}{}%
- \@ifundefined{Cref@subsubsubappendix@format@last}{%
- \let\Cref@subsubsubappendix@format@last%
- \Cref@subsubappendix@format@last}{}%
- \@ifundefined{crefrange@subsubsubappendix@format@first}{%
- \let\crefrange@subsubsubappendix@format@first%
- \crefrange@subsubappendix@format@first}{}%
- \@ifundefined{Crefrange@subsubsubappendix@format@first}{%
- \let\Crefrange@subsubsubappendix@format@first%
- \Crefrange@subsubappendix@format@first}{}%
- \@ifundefined{crefrange@subsubsubappendix@format@second}{%
- \let\crefrange@subsubsubappendix@format@second%
- \crefrange@subsubappendix@format@second}{}%
- \@ifundefined{Crefrange@subsubsubappendix@format@second}{%
- \let\Crefrange@subsubsubappendix@format@second%
- \Crefrange@subsubappendix@format@second}{}%
- \@ifundefined{crefrange@subsubsubappendix@format@middle}{%
- \let\crefrange@subsubsubappendix@format@middle%
- \crefrange@subsubappendix@format@middle}{}%
- \@ifundefined{Crefrange@subsubsubappendix@format@middle}{%
- \let\Crefrange@subsubsubappendix@format@middle%
- \Crefrange@subsubappendix@format@middle}{}%
- \@ifundefined{crefrange@subsubsubappendix@format@last}{%
- \let\crefrange@subsubsubappendix@format@last%
- \crefrange@subsubappendix@format@last}{}%
- \@ifundefined{Crefrange@subsubsubappendix@format@last}{%
- \let\Crefrange@subsubsubappendix@format@last%
- \Crefrange@subsubappendix@format@last}{}%
-% \end{macrocode}
-% Ditto for subfigures and subtables.
-% \begin{macrocode}
- \@ifundefined{cref@subfigure@format}{%
- \let\cref@subfigure@format%
- \cref@figure@format}{}%
- \@ifundefined{Cref@subfigure@format}{%
- \let\Cref@subfigure@format%
- \Cref@figure@format}{}%
- \@ifundefined{crefrange@subfigure@format}{%
- \let\crefrange@subfigure@format%
- \crefrange@figure@format}{}%
- \@ifundefined{Crefrange@subfigure@format}{%
- \let\Crefrange@subfigure@format%
- \Crefrange@figure@format}{}%
- \@ifundefined{cref@subfigure@format@first}{%
- \let\cref@subfigure@format@first%
- \cref@figure@format@first}{}%
- \@ifundefined{Cref@subfigure@format@first}{%
- \let\Cref@subfigure@format@first%
- \Cref@figure@format@first}{}%
- \@ifundefined{cref@subfigure@format@second}{%
- \let\cref@subfigure@format@second%
- \cref@figure@format@second}{}%
- \@ifundefined{Cref@subfigure@format@second}{%
- \let\Cref@subfigure@format@second%
- \Cref@figure@format@second}{}%
- \@ifundefined{cref@subfigure@format@middle}{%
- \let\cref@subfigure@format@middle%
- \cref@figure@format@middle}{}%
- \@ifundefined{Cref@subfigure@format@middle}{%
- \let\Cref@subfigure@format@middle%
- \Cref@figure@format@middle}{}%
- \@ifundefined{cref@subfigure@format@last}{%
- \let\cref@subfigure@format@last%
- \cref@figure@format@last}{}%
- \@ifundefined{Cref@subfigure@format@last}{%
- \let\Cref@subfigure@format@last%
- \Cref@figure@format@last}{}%
- \@ifundefined{crefrange@subfigure@format@first}{%
- \let\crefrange@subfigure@format@first%
- \crefrange@figure@format@first}{}%
- \@ifundefined{Crefrange@subfigure@format@first}{%
- \let\Crefrange@subfigure@format@first%
- \Crefrange@figure@format@first}{}%
- \@ifundefined{crefrange@subfigure@format@second}{%
- \let\crefrange@subfigure@format@second%
- \crefrange@figure@format@second}{}%
- \@ifundefined{Crefrange@subfigure@format@second}{%
- \let\Crefrange@subfigure@format@second%
- \Crefrange@figure@format@second}{}%
- \@ifundefined{crefrange@subfigure@format@middle}{%
- \let\crefrange@subfigure@format@middle%
- \crefrange@figure@format@middle}{}%
- \@ifundefined{Crefrange@subfigure@format@middle}{%
- \let\Crefrange@subfigure@format@middle%
- \Crefrange@figure@format@middle}{}%
- \@ifundefined{crefrange@subfigure@format@last}{%
- \let\crefrange@subfigure@format@last%
- \crefrange@figure@format@last}{}%
- \@ifundefined{Crefrange@subfigure@format@last}{%
- \let\Crefrange@subfigure@format@last%
- \Crefrange@figure@format@last}{}%
-%
- \@ifundefined{cref@subtable@format}{%
- \let\cref@subtable@format%
- \cref@table@format}{}%
- \@ifundefined{Cref@subtable@format}{%
- \let\Cref@subtable@format%
- \Cref@table@format}{}%
- \@ifundefined{crefrange@subtable@format}{%
- \let\crefrange@subtable@format%
- \crefrange@table@format}{}%
- \@ifundefined{Crefrange@subtable@format}{%
- \let\Crefrange@subtable@format%
- \Crefrange@table@format}{}%
- \@ifundefined{cref@subtable@format@first}{%
- \let\cref@subtable@format@first%
- \cref@table@format@first}{}%
- \@ifundefined{Cref@subtable@format@first}{%
- \let\Cref@subtable@format@first%
- \Cref@table@format@first}{}%
- \@ifundefined{cref@subtable@format@second}{%
- \let\cref@subtable@format@second%
- \cref@table@format@second}{}%
- \@ifundefined{Cref@subtable@format@second}{%
- \let\Cref@subtable@format@second%
- \Cref@table@format@second}{}%
- \@ifundefined{cref@subtable@format@middle}{%
- \let\cref@subtable@format@middle%
- \cref@table@format@middle}{}%
- \@ifundefined{Cref@subtable@format@middle}{%
- \let\Cref@subtable@format@middle%
- \Cref@table@format@middle}{}%
- \@ifundefined{cref@subtable@format@last}{%
- \let\cref@subtable@format@last%
- \cref@table@format@last}{}%
- \@ifundefined{Cref@subtable@format@last}{%
- \let\Cref@subtable@format@last%
- \Cref@table@format@last}{}%
- \@ifundefined{crefrange@subtable@format@first}{%
- \let\crefrange@subtable@format@first%
- \crefrange@table@format@first}{}%
- \@ifundefined{Crefrange@subtable@format@first}{%
- \let\Crefrange@subtable@format@first%
- \Crefrange@table@format@first}{}%
- \@ifundefined{crefrange@subtable@format@second}{%
- \let\crefrange@subtable@format@second%
- \crefrange@table@format@second}{}%
- \@ifundefined{Crefrange@subtable@format@second}{%
- \let\Crefrange@subtable@format@second%
- \Crefrange@table@format@second}{}%
- \@ifundefined{crefrange@subtable@format@middle}{%
- \let\crefrange@subtable@format@middle%
- \crefrange@table@format@middle}{}%
- \@ifundefined{Crefrange@subtable@format@middle}{%
- \let\Crefrange@subtable@format@middle%
- \Crefrange@table@format@middle}{}%
- \@ifundefined{crefrange@subtable@format@last}{%
- \let\crefrange@subtable@format@last%
- \crefrange@table@format@last}{}%
- \@ifundefined{Crefrange@subtable@format@last}{%
- \let\Crefrange@subtable@format@last%
- \Crefrange@table@format@last}{}%
-% \end{macrocode}
-% Ditto for subequations.
-% \begin{macrocode}
- \@ifundefined{cref@subequation@format}{%
- \let\cref@subequation@format%
- \cref@equation@format}{}%
- \@ifundefined{Cref@subequation@format}{%
- \let\Cref@subequation@format%
- \Cref@equation@format}{}%
- \@ifundefined{crefrange@subequation@format}{%
- \let\crefrange@subequation@format%
- \crefrange@equation@format}{}%
- \@ifundefined{Crefrange@subequation@format}{%
- \let\Crefrange@subequation@format%
- \Crefrange@equation@format}{}%
- \@ifundefined{cref@subequation@format@first}{%
- \let\cref@subequation@format@first%
- \cref@equation@format@first}{}%
- \@ifundefined{Cref@subequation@format@first}{%
- \let\Cref@subequation@format@first%
- \Cref@equation@format@first}{}%
- \@ifundefined{cref@subequation@format@second}{%
- \let\cref@subequation@format@second%
- \cref@equation@format@second}{}%
- \@ifundefined{Cref@subequation@format@second}{%
- \let\Cref@subequation@format@second%
- \Cref@equation@format@second}{}%
- \@ifundefined{cref@subequation@format@middle}{%
- \let\cref@subequation@format@middle%
- \cref@equation@format@middle}{}%
- \@ifundefined{Cref@subequation@format@middle}{%
- \let\Cref@subequation@format@middle%
- \Cref@equation@format@middle}{}%
- \@ifundefined{cref@subequation@format@last}{%
- \let\cref@subequation@format@last%
- \cref@equation@format@last}{}%
- \@ifundefined{Cref@subequation@format@last}{%
- \let\Cref@subequation@format@last%
- \Cref@equation@format@last}{}%
- \@ifundefined{crefrange@subequation@format@first}{%
- \let\crefrange@subequation@format@first%
- \crefrange@equation@format@first}{}%
- \@ifundefined{Crefrange@subequation@format@first}{%
- \let\Crefrange@subequation@format@first%
- \Crefrange@equation@format@first}{}%
- \@ifundefined{crefrange@subequation@format@second}{%
- \let\crefrange@subequation@format@second%
- \crefrange@equation@format@second}{}%
- \@ifundefined{Crefrange@subequation@format@second}{%
- \let\Crefrange@subequation@format@second%
- \Crefrange@equation@format@second}{}%
- \@ifundefined{crefrange@subequation@format@middle}{%
- \let\crefrange@subequation@format@middle%
- \crefrange@equation@format@middle}{}%
- \@ifundefined{Crefrange@subequation@format@middle}{%
- \let\Crefrange@subequation@format@middle%
- \Crefrange@equation@format@middle}{}%
- \@ifundefined{crefrange@subequation@format@last}{%
- \let\crefrange@subequation@format@last%
- \crefrange@equation@format@last}{}%
- \@ifundefined{Crefrange@subequation@format@last}{%
- \let\Crefrange@subequation@format@last%
- \Crefrange@equation@format@last}{}%
-% \end{macrocode}
-% Ditto for enums.
-% \begin{macrocode}
- \@ifundefined{cref@enumii@format}{%
- \let\cref@enumii@format%
- \cref@enumi@format}{}%
- \@ifundefined{Cref@enumii@format}{%
- \let\Cref@enumii@format%
- \Cref@enumi@format}{}%
- \@ifundefined{crefrange@enumii@format}{%
- \let\crefrange@enumii@format%
- \crefrange@enumi@format}{}%
- \@ifundefined{Crefrange@enumii@format}{%
- \let\Crefrange@enumii@format%
- \Crefrange@enumi@format}{}%
- \@ifundefined{cref@enumii@format@first}{%
- \let\cref@enumii@format@first%
- \cref@enumi@format@first}{}%
- \@ifundefined{Cref@enumii@format@first}{%
- \let\Cref@enumii@format@first%
- \Cref@enumi@format@first}{}%
- \@ifundefined{cref@enumii@format@second}{%
- \let\cref@enumii@format@second%
- \cref@enumi@format@second}{}%
- \@ifundefined{Cref@enumii@format@second}{%
- \let\Cref@enumii@format@second%
- \Cref@enumi@format@second}{}%
- \@ifundefined{cref@enumii@format@middle}{%
- \let\cref@enumii@format@middle%
- \cref@enumi@format@middle}{}%
- \@ifundefined{Cref@enumii@format@middle}{%
- \let\Cref@enumii@format@middle%
- \Cref@enumi@format@middle}{}%
- \@ifundefined{cref@enumii@format@last}{%
- \let\cref@enumii@format@last%
- \cref@enumi@format@last}{}%
- \@ifundefined{Cref@enumii@format@last}{%
- \let\Cref@enumii@format@last%
- \Cref@enumi@format@last}{}%
- \@ifundefined{crefrange@enumii@format@first}{%
- \let\crefrange@enumii@format@first%
- \crefrange@enumi@format@first}{}%
- \@ifundefined{Crefrange@enumii@format@first}{%
- \let\Crefrange@enumii@format@first%
- \Crefrange@enumi@format@first}{}%
- \@ifundefined{crefrange@enumii@format@second}{%
- \let\crefrange@enumii@format@second%
- \crefrange@enumi@format@second}{}%
- \@ifundefined{Crefrange@enumii@format@second}{%
- \let\Crefrange@enumii@format@second%
- \Crefrange@enumi@format@second}{}%
- \@ifundefined{crefrange@enumii@format@middle}{%
- \let\crefrange@enumii@format@middle%
- \crefrange@enumi@format@middle}{}%
- \@ifundefined{Crefrange@enumii@format@middle}{%
- \let\Crefrange@enumii@format@middle%
- \Crefrange@enumi@format@middle}{}%
- \@ifundefined{crefrange@enumii@format@last}{%
- \let\crefrange@enumii@format@last%
- \crefrange@enumi@format@last}{}%
- \@ifundefined{Crefrange@enumii@format@last}{%
- \let\Crefrange@enumii@format@last%
- \Crefrange@enumi@format@last}{}%
-%
- \@ifundefined{cref@enumiii@format}{%
- \let\cref@enumiii@format%
- \cref@enumii@format}{}%
- \@ifundefined{Cref@enumiii@format}{%
- \let\Cref@enumiii@format%
- \Cref@enumii@format}{}%
- \@ifundefined{crefrange@enumiii@format}{%
- \let\crefrange@enumiii@format%
- \crefrange@enumii@format}{}%
- \@ifundefined{Crefrange@enumiii@format}{%
- \let\Crefrange@enumiii@format%
- \Crefrange@enumii@format}{}%
- \@ifundefined{cref@enumiii@format@first}{%
- \let\cref@enumiii@format@first%
- \cref@enumii@format@first}{}%
- \@ifundefined{Cref@enumiii@format@first}{%
- \let\Cref@enumiii@format@first%
- \Cref@enumii@format@first}{}%
- \@ifundefined{cref@enumiii@format@second}{%
- \let\cref@enumiii@format@second%
- \cref@enumii@format@second}{}%
- \@ifundefined{Cref@enumiii@format@second}{%
- \let\Cref@enumiii@format@second%
- \Cref@enumii@format@second}{}%
- \@ifundefined{cref@enumiii@format@middle}{%
- \let\cref@enumiii@format@middle%
- \cref@enumii@format@middle}{}%
- \@ifundefined{Cref@enumiii@format@middle}{%
- \let\Cref@enumiii@format@middle%
- \Cref@enumii@format@middle}{}%
- \@ifundefined{cref@enumiii@format@last}{%
- \let\cref@enumiii@format@last%
- \cref@enumii@format@last}{}%
- \@ifundefined{Cref@enumiii@format@last}{%
- \let\Cref@enumiii@format@last%
- \Cref@enumii@format@last}{}%
- \@ifundefined{crefrange@enumiii@format@first}{%
- \let\crefrange@enumiii@format@first%
- \crefrange@enumii@format@first}{}%
- \@ifundefined{Crefrange@enumiii@format@first}{%
- \let\Crefrange@enumiii@format@first%
- \Crefrange@enumii@format@first}{}%
- \@ifundefined{crefrange@enumiii@format@second}{%
- \let\crefrange@enumiii@format@second%
- \crefrange@enumii@format@second}{}%
- \@ifundefined{Crefrange@enumiii@format@second}{%
- \let\Crefrange@enumiii@format@second%
- \Crefrange@enumii@format@second}{}%
- \@ifundefined{crefrange@enumiii@format@middle}{%
- \let\crefrange@enumiii@format@middle%
- \crefrange@enumii@format@middle}{}%
- \@ifundefined{Crefrange@enumiii@format@middle}{%
- \let\Crefrange@enumiii@format@middle%
- \Crefrange@enumii@format@middle}{}%
- \@ifundefined{crefrange@enumiii@format@last}{%
- \let\crefrange@enumiii@format@last%
- \crefrange@enumii@format@last}{}%
- \@ifundefined{Crefrange@enumiii@format@last}{%
- \let\Crefrange@enumiii@format@last%
- \Crefrange@enumii@format@last}{}%
-%
- \@ifundefined{cref@enumiv@format}{%
- \let\cref@enumiv@format%
- \cref@enumiii@format}{}%
- \@ifundefined{Cref@enumiv@format}{%
- \let\Cref@enumiv@format%
- \Cref@enumiii@format}{}%
- \@ifundefined{crefrange@enumiv@format}{%
- \let\crefrange@enumiv@format%
- \crefrange@enumiii@format}{}%
- \@ifundefined{Crefrange@enumiv@format}{%
- \let\Crefrange@enumiv@format%
- \Crefrange@enumiii@format}{}%
- \@ifundefined{cref@enumiv@format@first}{%
- \let\cref@enumiv@format@first%
- \cref@enumiii@format@first}{}%
- \@ifundefined{Cref@enumiv@format@first}{%
- \let\Cref@enumiv@format@first%
- \Cref@enumiii@format@first}{}%
- \@ifundefined{cref@enumiv@format@second}{%
- \let\cref@enumiv@format@second%
- \cref@enumiii@format@second}{}%
- \@ifundefined{Cref@enumiv@format@second}{%
- \let\Cref@enumiv@format@second%
- \Cref@enumiii@format@second}{}%
- \@ifundefined{cref@enumiv@format@middle}{%
- \let\cref@enumiv@format@middle%
- \cref@enumiii@format@middle}{}%
- \@ifundefined{Cref@enumiv@format@middle}{%
- \let\Cref@enumiv@format@middle%
- \Cref@enumiii@format@middle}{}%
- \@ifundefined{cref@enumiv@format@last}{%
- \let\cref@enumiv@format@last%
- \cref@enumiii@format@last}{}%
- \@ifundefined{Cref@enumiv@format@last}{%
- \let\Cref@enumiv@format@last%
- \Cref@enumiii@format@last}{}%
- \@ifundefined{crefrange@enumiv@format@first}{%
- \let\crefrange@enumiv@format@first%
- \crefrange@enumiii@format@first}{}%
- \@ifundefined{Crefrange@enumiv@format@first}{%
- \let\Crefrange@enumiv@format@first%
- \Crefrange@enumiii@format@first}{}%
- \@ifundefined{crefrange@enumiv@format@second}{%
- \let\crefrange@enumiv@format@second%
- \crefrange@enumiii@format@second}{}%
- \@ifundefined{Crefrange@enumiv@format@second}{%
- \let\Crefrange@enumiv@format@second%
- \Crefrange@enumiii@format@second}{}%
- \@ifundefined{crefrange@enumiv@format@middle}{%
- \let\crefrange@enumiv@format@middle%
- \crefrange@enumiii@format@middle}{}%
- \@ifundefined{Crefrange@enumiv@format@middle}{%
- \let\Crefrange@enumiv@format@middle%
- \Crefrange@enumiii@format@middle}{}%
- \@ifundefined{crefrange@enumiv@format@last}{%
- \let\crefrange@enumiv@format@last%
- \crefrange@enumiii@format@last}{}%
- \@ifundefined{Crefrange@enumiv@format@last}{%
- \let\Crefrange@enumiv@format@last%
- \Crefrange@enumiii@format@last}{}%
-%
- \@ifundefined{cref@enumv@format}{%
- \let\cref@enumv@format%
- \cref@enumiv@format}{}%
- \@ifundefined{Cref@enumv@format}{%
- \let\Cref@enumv@format%
- \Cref@enumiv@format}{}%
- \@ifundefined{crefrange@enumv@format}{%
- \let\crefrange@enumv@format%
- \crefrange@enumiv@format}{}%
- \@ifundefined{Crefrange@enumv@format}{%
- \let\Crefrange@enumv@format%
- \Crefrange@enumiv@format}{}%
- \@ifundefined{cref@enumv@format@first}{%
- \let\cref@enumv@format@first%
- \cref@enumiv@format@first}{}%
- \@ifundefined{Cref@enumv@format@first}{%
- \let\Cref@enumv@format@first%
- \Cref@enumiv@format@first}{}%
- \@ifundefined{cref@enumv@format@second}{%
- \let\cref@enumv@format@second%
- \cref@enumiv@format@second}{}%
- \@ifundefined{Cref@enumv@format@second}{%
- \let\Cref@enumv@format@second%
- \Cref@enumiv@format@second}{}%
- \@ifundefined{cref@enumv@format@middle}{%
- \let\cref@enumv@format@middle%
- \cref@enumiv@format@middle}{}%
- \@ifundefined{Cref@enumv@format@middle}{%
- \let\Cref@enumv@format@middle%
- \Cref@enumiv@format@middle}{}%
- \@ifundefined{cref@enumv@format@last}{%
- \let\cref@enumv@format@last%
- \cref@enumiv@format@last}{}%
- \@ifundefined{Cref@enumv@format@last}{%
- \let\Cref@enumv@format@last%
- \Cref@enumiv@format@last}{}%
- \@ifundefined{crefrange@enumv@format@first}{%
- \let\crefrange@enumv@format@first%
- \crefrange@enumiv@format@first}{}%
- \@ifundefined{Crefrange@enumv@format@first}{%
- \let\Crefrange@enumv@format@first%
- \Crefrange@enumiv@format@first}{}%
- \@ifundefined{crefrange@enumv@format@second}{%
- \let\crefrange@enumv@format@second%
- \crefrange@enumiv@format@second}{}%
- \@ifundefined{Crefrange@enumv@format@second}{%
- \let\Crefrange@enumv@format@second%
- \Crefrange@enumiv@format@second}{}%
- \@ifundefined{crefrange@enumv@format@middle}{%
- \let\crefrange@enumv@format@middle%
- \crefrange@enumiv@format@middle}{}%
- \@ifundefined{Crefrange@enumv@format@middle}{%
- \let\Crefrange@enumv@format@middle%
- \Crefrange@enumiv@format@middle}{}%
- \@ifundefined{crefrange@enumv@format@last}{%
- \let\crefrange@enumv@format@last%
- \crefrange@enumiv@format@last}{}%
- \@ifundefined{Crefrange@enumv@format@last}{%
- \let\Crefrange@enumv@format@last%
- \Crefrange@enumiv@format@last}{}%
-%
+% to the formats for sections. Similarly for subsections within
+% appendices, subfigures, subtables, subequations and enums.
+% \begin{macrocode}
+ \@crefcopyformats{section}{subsection}%
+ \@crefcopyformats{section}{subsubsection}%
+ \@crefcopyformats{appendix}{subappendix}%
+ \@crefcopyformats{appendix}{subsubappendix}%
+ \@crefcopyformats{figure}{subfigure}%
+ \@crefcopyformats{table}{subtable}%
+ \@crefcopyformats{equation}{subequation}%
+%
+ \@crefcopyformats{enumi}{enumii}%
+ \@crefcopyformats{enumii}{enumiii}%
+ \@crefcopyformats{enumiii}{enumiv}%
+ \@crefcopyformats{enumiv}{enumv}%
+% \end{macrocode}
+% Definition of default |\labelcref| formats also needs to be postponed
+% until beginning of document, in case |\crefdefaultlabelformat| has been
+% modified.
+% \begin{macrocode}
+ \@labelcrefdefinedefaultformats%
+ %
\let\cref@language\relax%
}% end of \AtBeginDocument
% \end{macrocode}
diff --git a/Master/texmf-dist/source/latex/cleveref/cleveref.ins b/Master/texmf-dist/source/latex/cleveref/cleveref.ins
index 082250c02da..2a9bc3a0ce5 100644
--- a/Master/texmf-dist/source/latex/cleveref/cleveref.ins
+++ b/Master/texmf-dist/source/latex/cleveref/cleveref.ins
@@ -11,7 +11,7 @@
LaTeX package for intelligent cross-referencing.
-Copyright (C) 2006--2013 Toby Cubitt
+Copyright (C) 2006--2016 Toby Cubitt
See the files README and COPYING.
\endpreamble
diff --git a/Master/texmf-dist/tex/latex/cleveref/cleveref.sty b/Master/texmf-dist/tex/latex/cleveref/cleveref.sty
index 0522c48433c..026390ca0d3 100644
--- a/Master/texmf-dist/tex/latex/cleveref/cleveref.sty
+++ b/Master/texmf-dist/tex/latex/cleveref/cleveref.sty
@@ -8,11 +8,11 @@
%%
%% LaTeX package for intelligent cross-referencing.
%%
-%% Copyright (C) 2006--2013 Toby Cubitt
+%% Copyright (C) 2006--2016 Toby Cubitt
%% See the files README and COPYING.
%%
-\def\packagedate{2013/12/28}
-\def\packageversion{0.19}
+\def\packagedate{2017/07/10}
+\def\packageversion{0.21}
%% 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.
@@ -68,19 +68,31 @@
\def\label{\@ifnextchar[\label@optarg\label@noarg}%]
\let\cref@label\label%
\def\label@noarg#1{%
- \@bsphack%
\cref@old@label{#1}%
+ \@bsphack%
+ \edef\@tempa{{page}{\the\c@page}}%
+ \setcounter{page}{1}%
+ \edef\@tempb{\thepage}%
+ \expandafter\setcounter\@tempa%
+ \cref@constructprefix{page}{\cref@result}%
\protected@write\@auxout{}%
- {\string\newlabel{#1@cref}{{\cref@currentlabel}{\thepage}}}%
+ {\string\newlabel{#1@cref}{{\cref@currentlabel}%
+ {[\@tempb][\arabic{page}][\cref@result]\thepage}}}%
\@esphack}%
\def\label@optarg[#1]#2{%
- \@bsphack%
\cref@old@label{#2}%
+ \@bsphack%
+ \edef\@tempa{{page}{\the\c@page}}%
+ \setcounter{page}{1}%
+ \edef\@tempb{\thepage}%
+ \expandafter\setcounter\@tempa%
+ \cref@constructprefix{page}{\cref@result}%
\protected@edef\cref@currentlabel{%
\expandafter\cref@override@label@type%
\cref@currentlabel\@nil{#1}}%
\protected@write\@auxout{}%
- {\string\newlabel{#2@cref}{{\cref@currentlabel}{\thepage}}}%
+ {\string\newlabel{#2@cref}{{\cref@currentlabel}%
+ {[\@tempb][\arabic{page}][\cref@result]\thepage}}}%
\@esphack}%
}% end of AtBeginDocument
\let\cref@old@makefntext\@makefntext%
@@ -160,114 +172,124 @@
\cref@stack@add{#1}{\cref@label@types}%
\cref@old@ynthm{#1}{#2}}%
\@ifundefined{appendix}{}{%
- \g@addto@macro\appendix{%
+ \let\cref@old@appendix\appendix%
+ \def\appendix{%
\@ifundefined{chapter}{%
- \gdef\refstepcounter@noarg#1{%
- \cref@old@refstepcounter{#1}%
- \cref@constructprefix{#1}{\cref@result}%
+ \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\@tempa{##1}%
\def\@tempb{section}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [appendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [appendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{subsection}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [subappendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{subsubsection}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subsubappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [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}}%
+ \@ifundefined{cref@##1@alias}%
+ {\def\@tempa{##1}}%
+ {\def\@tempa{\csname cref@##1@alias\endcsname}}%
\protected@edef\cref@currentlabel{%
- [\@tempa][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [\@tempa][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\fi%
\fi%
\fi}%
+ \cref@old@appendix%
}{%
- \def\refstepcounter@noarg#1{%
- \cref@old@refstepcounter{#1}%
- \cref@constructprefix{#1}{\cref@result}%
+ \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\@tempa{##1}%
\def\@tempb{chapter}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [appendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [appendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{section}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [subappendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{subsection}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subsubappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [subsubappendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{subsubsection}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subsubsubappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [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}}%
+ \@ifundefined{cref@##1@alias}%
+ {\def\@tempa{##1}}%
+ {\def\@tempa{\csname cref@##1@alias\endcsname}}%
\protected@edef\cref@currentlabel{%
- [\@tempa][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [\@tempa][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\fi%
\fi%
\fi%
\fi}%
- }%
+ \cref@old@appendix}%
}%
}% end of \@ifundefined{appendix}
-\def\@gobble@optarg{\@ifnextchar[\@@gobble@optarg\@gobble@orig}%]
-\def\@gobble@orig#1{}%
-\def\@@gobble@optarg[#1]#2{}%
+\def\cref@gobble@optarg{\@ifnextchar[\@cref@gobble@optarg\cref@gobble}%]
+\def\cref@gobble#1{}%
+\def\@cref@gobble@optarg[#1]#2{}%
\def\cref@append@toks#1#2{\toks0={#2}%
\edef\act{\noexpand#1={\the#1\the\toks0}}%
\act}%
+\def\cref@ifstreq#1#2#3#4{%
+ \begingroup%
+ \edef\@tempa{#1}%
+ \edef\@tempb{#2}%
+ \expandafter\def\expandafter\@tempa\expandafter{\csname\@tempa\endcsname}%
+ \expandafter\def\expandafter\@tempb\expandafter{\csname\@tempb\endcsname}%
+ \ifx\@tempa\@tempb%
+ \let\@tempc\@firstoftwo%
+ \else%
+ \let\@tempc\@secondoftwo%
+ \fi%
+ \expandafter%
+ \endgroup%
+ \@tempc{#3}{#4}}%
\def\cref@getref#1#2{%
\expandafter\let\expandafter#2\csname r@#1@cref\endcsname%
\expandafter\expandafter\expandafter\def%
\expandafter\expandafter\expandafter#2%
\expandafter\expandafter\expandafter{%
\expandafter\@firstoftwo#2}}%
-\def\cref@getpageref#1#2{%
- \expandafter\let\expandafter#2\csname r@#1@cref\endcsname%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter#2%
- \expandafter\expandafter\expandafter{%
- \expandafter\@secondoftwo#2}}%
\def\cref@getlabel#1#2{%
\cref@getref{#1}{\@tempa}%
\expandafter\@cref@getlabel\@tempa\@nil#2}%
@@ -292,6 +314,36 @@
\def\@cref@getprefix{\@ifnextchar[%]
\@@cref@getprefix{\@@cref@getprefix[][][]}}%
\def\@@cref@getprefix[#1][#2][#3]#4\@nil#5{\def#5{#3}}%
+\def\cpageref@getref#1#2{%
+ \expandafter\let\expandafter#2\csname r@#1@cref\endcsname%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter#2%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@secondoftwo#2}}%
+\def\cpageref@getlabel#1#2{%
+ \cpageref@getref{#1}{\@tempa}%
+ \expandafter\@cpageref@getlabel\@tempa\@nil#2}%
+\def\@cpageref@getlabel{\@ifnextchar[%]
+ \@@cpageref@getlabel{\@@cpageref@getlabel[][][]}}%
+\def\@@cpageref@getlabel[#1][#2][#3]#4\@nil#5{\def#5{#4}}%
+\def\cpageref@gettype#1#2{%
+ \cpageref@getref{#1}{\@tempa}%
+ \expandafter\@cpageref@gettype\@tempa\@nil#2}%
+\def\@cpageref@gettype{\@ifnextchar[%]
+ \@@cpageref@gettype{\@@cpageref@gettype[][][]}}%
+\def\@@cpageref@gettype[#1][#2][#3]#4\@nil#5{\def#5{#1}}%
+\def\cpageref@getcounter#1#2{%
+ \cpageref@getref{#1}{\@tempa}%
+ \expandafter\@cpageref@getcounter\@tempa\@nil#2}%
+\def\@cpageref@getcounter{\@ifnextchar[%]
+ \@@cpageref@getcounter{\@@cpageref@getcounter[][][]}}%
+\def\@@cpageref@getcounter[#1][#2][#3]#4\@nil#5{\def#5{#2}}%
+\def\cpageref@getprefix#1#2{%
+ \cpageref@getref{#1}{\@tempa}%
+ \expandafter\@cpageref@getprefix\@tempa\@nil#2}%
+\def\@cpageref@getprefix{\@ifnextchar[%]
+ \@@cpageref@getprefix{\@@cpageref@getprefix[][][]}}%
+\def\@@cpageref@getprefix[#1][#2][#3]#4\@nil#5{\def#5{#3}}%
\def\cref@override@label@type[#1][#2][#3]#4\@nil#5{[#5][#2][#3]#4}%
\def\cref@constructprefix#1#2{%
\cref@stack@init{\@tempstack}%
@@ -373,50 +425,60 @@
\def\@tempa{\@nil}%
\ifx#1\@tempa\@cref@stackfullfalse%
\else\@cref@stackfulltrue\fi}%
+\def\cref@stack@dropempty#1{%
+ \edef\@tempa{\cref@stack@top{#1}}%
+ \@whilesw\ifx\@tempa\@empty\fi{%
+ \cref@stack@pop{#1}%
+ \cref@isstackempty{#1}%
+ \if@cref@stackempty%
+ \let\@tempa\relax%
+ \else%
+ \edef\@tempa{\cref@stack@top{#1}}%
+ \fi}}%
\def\cref@stack@sort#1#2{%
\begingroup%
\cref@stack@init{\@sortstack}%
- \edef\@element{\cref@stack@top{#1}}%
+ \edef\@element{\cref@stack@top{#2}}%
\expandafter\cref@stack@push\expandafter{\@element}{\@sortstack}%
- \cref@stack@pop{#1}%
- \cref@isstackfull{#1}%
+ \cref@stack@pop{#2}%
+ \cref@isstackfull{#2}%
\if@cref@stackfull%
- \edef\@tempa{\cref@stack@top{#1}}%
+ \edef\@tempa{\cref@stack@top{#2}}%
\@whilesw\ifx\@tempa\@empty\fi{%
\cref@stack@pull{}{\@sortstack}%
- \cref@stack@pop{#1}%
- \cref@isstackempty{#1}%
+ \cref@stack@pop{#2}%
+ \cref@isstackempty{#2}%
\if@cref@stackempty%
\let\@tempa\relax%
\else%
- \edef\@tempa{\cref@stack@top{#1}}%
+ \edef\@tempa{\cref@stack@top{#2}}%
\fi}%
\fi%
- \cref@isstackfull{#1}%
+ \cref@isstackfull{#2}%
\@whilesw\if@cref@stackfull\fi{%
- \edef\@element{\cref@stack@top{#1}}%
- \cref@stack@pop{#1}%
+ \edef\@element{\cref@stack@top{#2}}%
+ \cref@stack@pop{#2}%
\def\@empties{}%
- \cref@isstackfull{#1}%
+ \cref@isstackfull{#2}%
\if@cref@stackfull%
- \edef\@tempa{\cref@stack@top{#1}}%
+ \edef\@tempa{\cref@stack@top{#2}}%
\@whilesw\ifx\@tempa\@empty\fi{%
\edef\@empties{\@empties,}%
- \cref@stack@pop{#1}%
- \cref@isstackempty{#1}%
+ \cref@stack@pop{#2}%
+ \cref@isstackempty{#2}%
\if@cref@stackempty%
\let\@tempa\relax%
\else%
- \edef\@tempa{\cref@stack@top{#1}}%
+ \edef\@tempa{\cref@stack@top{#2}}%
\fi}%
\fi%
\edef\@tempa{{\expandafter\noexpand\@element}%
{\expandafter\noexpand\@empties}%
- {\noexpand\@sortstack}{\noexpand#2}}%
+ {\noexpand\@sortstack}{\noexpand#1}}%
\expandafter\cref@stack@insert\@tempa%
- \cref@isstackfull{#1}}%
+ \cref@isstackfull{#2}}%
\expandafter\endgroup\expandafter%
- \def\expandafter#1\expandafter{\@sortstack}}%
+ \def\expandafter#2\expandafter{\@sortstack}}%
\def\cref@stack@insert#1#2#3#4{%
\let\@cmp#4%
\@cref@stack@insert{}{#1}{#2}{#3}%
@@ -440,28 +502,85 @@
\fi%
\fi%
\cref@iterate}%
+\newif\if@cref@sametype%
+\def\cref@isrefsametype#1#2{%
+ \begingroup%
+ \expandafter\ifx\csname r@#1@cref\endcsname\relax%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax%
+ \def\@after{\@cref@sametypetrue}%
+ \else%
+ \def\@after{\@cref@sametypefalse}%
+ \fi%
+ \else%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax%
+ \def\@after{\@cref@sametypefalse}%
+ \else%
+ \cref@gettype{#1}{\@type}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@formata%
+ \expandafter\expandafter\expandafter{%
+ \csname cref@\@type @format\endcsname%
+ {\@dummya}{\@dummyb}{\@dummyc}}%
+ \cref@gettype{#2}{\@type}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@formatb%
+ \expandafter\expandafter\expandafter{%
+ \csname cref@\@type @format\endcsname%
+ {\@dummya}{\@dummyb}{\@dummyc}}%
+ \ifx\@formata\@formatb%
+ \def\@after{\@cref@sametypetrue}%
+ \else%
+ \def\@after{\@cref@sametypefalse}%
+ \fi%
+ \fi%
+ \fi%
+ \expandafter\endgroup\@after}%
+\def\cpageref@isrefsametype#1#2{%
+ \begingroup%
+ \expandafter\ifx\csname r@#1@cref\endcsname\relax%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax%
+ \def\@after{\@cref@sametypetrue}%
+ \else%
+ \def\@after{\@cref@sametypefalse}%
+ \fi%
+ \else%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax%
+ \def\@after{\@cref@sametypefalse}%
+ \else%
+ \cpageref@gettype{#1}{\@typea}%
+ \cpageref@gettype{#2}{\@typeb}%
+ \ifx\@typea\@typeb%
+ \def\@after{\@cref@sametypetrue}%
+ \else%
+ \def\@after{\@cref@sametypefalse}%
+ \fi%
+ \fi%
+ \fi%
+ \expandafter\endgroup\@after}%
\def\cref@counter@first#1#2\@nil{#1}%
\def\cref@counter@rest#1#2\@nil{#2}%
-\def\cref@countercmp#1#2#3{%
+\def\cref@countercmp{\@cref@countercmp{cref}}%
+\def\cpageref@countercmp{\@cref@countercmp{cpageref}}%
+\def\@cref@countercmp#1#2#3#4{%
\begingroup%
- \def\@tempa{#1}%
+ \def\@tempa{#2}%
\ifx\@tempa\@empty%
\def\cref@result{1}%
\else%
- \def\@tempa{#2}%
+ \def\@tempa{#3}%
\ifx\@tempa\@empty%
\def\cref@result{2}%
\else%
- \expandafter\ifx\csname r@#1@cref\endcsname\relax%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax%
\def\cref@result{2}%
\else%
- \expandafter\ifx\csname r@#2@cref\endcsname\relax%
+ \expandafter\ifx\csname r@#3@cref\endcsname\relax%
\def\cref@result{1}%
\else%
- \cref@getcounter{#1}{\@countera}%
- \cref@getprefix{#1}{\@prefixa}%
- \cref@getcounter{#2}{\@counterb}%
- \cref@getprefix{#2}{\@prefixb}%
+ \csname #1@getcounter\endcsname{#2}{\@countera}%
+ \csname #1@getprefix\endcsname{#2}{\@prefixa}%
+ \csname #1@getcounter\endcsname{#3}{\@counterb}%
+ \csname #1@getprefix\endcsname{#3}{\@prefixb}%
\cref@stack@init{\@countstacka}%
\expandafter\cref@stack@push\expandafter%
{\@countera}{\@countstacka}%
@@ -476,14 +595,14 @@
\expandafter\cref@stack@push\expandafter%
{\@prefixb}{\@countstackb}%
\fi%
- \@cref@countercmp%
+ \@@cref@countercmp%
\fi%
\fi%
\fi%
\fi%
\expandafter\endgroup\expandafter%
- \chardef\expandafter#3\expandafter=\cref@result\relax}%
-\def\@cref@countercmp{%
+ \chardef\expandafter#4\expandafter=\cref@result\relax}%
+\def\@@cref@countercmp{%
\let\@iterate\relax%
\cref@isstackempty{\@countstacka}%
\if@cref@stackempty%
@@ -508,45 +627,12 @@
\ifnum\@tempa>\@tempb\relax%
\def\cref@result{2}%
\else%
- \def\@iterate{\@cref@countercmp}%
+ \def\@iterate{\@@cref@countercmp}%
\fi%
\fi%
\fi%
\fi%
\@iterate}%
-\def\cref@pagecmp#1#2#3{%
- \begingroup%
- \def\@tempa{#1}%
- \ifx\@tempa\@empty%
- \def\cref@result{1}%
- \else%
- \def\@tempa{#2}%
- \ifx\@tempa\@empty%
- \def\cref@result{2}%
- \else%
- \expandafter\ifx\csname r@#1@cref\endcsname\relax%
- \def\cref@result{2}%
- \else%
- \expandafter\ifx\csname r@#2@cref\endcsname\relax%
- \def\cref@result{1}%
- \else%
- \cref@getpageref{#1}{\@tempa}%
- \cref@getpageref{#2}{\@tempb}%
- \ifnum\@tempa<\@tempb\relax%
- \def\cref@result{1}\relax%
- \else%
- \ifnum\@tempa>\@tempb\relax%
- \def\cref@result{2}\relax%
- \else%
- \def\cref@result{0}\relax%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \expandafter\endgroup\expandafter%
- \chardef\expandafter#3\expandafter=\cref@result\relax}%
\newif\if@cref@inresetlist%
\def\cref@isinresetlist#1#2{%
\begingroup%
@@ -578,79 +664,38 @@
\@next}%
\def\cref@resetby#1#2{%
\let#2\relax%
- \def\@tempa{#1}%
- \def\@tempb{subfigure}%
- \ifx\@tempa\@tempb%
+ \cref@ifstreq{#1}{subfigure}{%
\cref@isinresetlist{#1}{figure}%
\if@cref@inresetlist%
\def#2{figure}%
\fi%
- \fi%
- \def\@tempa{#1}%
- \def\@tempb{subtable}%
- \ifx\@tempa\@tempb%
+ }{}%
+ \cref@ifstreq{#1}{subtable}{%
\cref@isinresetlist{#1}{table}%
\if@cref@inresetlist%
\def#2{table}%
\fi%
- \fi%
+ }{}%
\@ifundefined{cl@parentequation}{}{%
- \def\@tempa{#1}%
- \def\@tempb{equation}%
- \ifx\@tempa\@tempb%
+ \cref@ifstreq{#1}{equation}{%
\cref@isinresetlist{#1}{parentequation}%
\if@cref@inresetlist%
\expandafter\ifnum\c@parentequation=0\else%
\def#2{parentequation}%
\fi%
\fi%
- \fi}%
- \def\@tempa{#1}%
- \def\@tempb{enumii}%
- \ifx\@tempa\@tempb%
- \def#2{enum}%
- \fi%
- \def\@tempb{enumiii}%
- \ifx\@tempa\@tempb%
- \def#2{enum}%
- \fi%
- \def\@tempb{enumiv}%
- \ifx\@tempa\@tempb%
- \def#2{enum}%
- \fi%
- \def\@tempb{enumv}%
- \ifx\@tempa\@tempb%
- \def#2{enum}%
- \fi%
- \def\@tempb{enum}%
- \ifx#2\@tempb%
- \cref@isinresetlist{#1}{enumiv}%
- \if@cref@inresetlist%
- \def#2{enumiv}%
- \else%
- \cref@isinresetlist{#1}{enumiii}%
- \if@cref@inresetlist%
+ }{}}%
+ \cref@ifstreq{#1}{enumii}{%
+ \def#2{enumi}%
+ }{%
+ \cref@ifstreq{#1}{enumiii}{%
+ \def#2{enumii}%
+ }{%
+ \cref@ifstreq{#1}{enumiv}{%
\def#2{enumiii}%
- \else%
- \cref@isinresetlist{#1}{enumii}%
- \if@cref@inresetlist%
- \def#2{enumii}%
- \else%
- \cref@isinresetlist{#1}{enumi}%
- \if@cref@inresetlist%
- \def#2{enumi}%
- \else%
- \cref@isinresetlist{#1}{part}%
- \if@cref@inresetlist%
- \def#2{part}%
- \else%
- \let#2\relax%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
+ }{}%
+ }%
+ }%
\ifx#2\relax%
\cref@isinresetlist{#1}{table}%
\if@cref@inresetlist%
@@ -685,212 +730,116 @@
\fi%
\fi}%
\newif\if@cref@refconsecutive%
-\def\cref@isrefconsecutive#1#2{%
+\def\cref@isrefconsecutive{\@cref@isrefconsecutive{cref}}%
+\def\cpageref@isrefconsecutive{\@cref@isrefconsecutive{cpageref}}%
+\def\@cref@isrefconsecutive#1#2#3{%
\begingroup%
- \countdef\refa@counter=0%
- \countdef\refb@counter=1%
- \cref@getcounter{#1}{\cref@result}%
- \refa@counter=\cref@result%
- \cref@getcounter{#2}{\cref@result}%
- \refb@counter=\cref@result%
- \cref@getprefix{#1}{\refa@prefix}%
- \cref@getprefix{#2}{\refb@prefix}%
- \def\@after{\@cref@refconsecutivefalse}%
- \ifx\refa@prefix\refb@prefix%
- \ifnum\refa@counter=\refb@counter\relax%
- \def\@after{\@cref@refconsecutivetrue}%
- \else%
- \advance\refa@counter 1\relax%
+ \def\@after{\@cref@refconsecutivefalse}%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax\else%
+ \expandafter\ifx\csname r@#3@cref\endcsname\relax\else%
+ \countdef\refa@counter=0%
+ \countdef\refb@counter=1%
+ \csname #1@getcounter\endcsname{#2}{\cref@result}%
+ \refa@counter=\cref@result%
+ \csname #1@getcounter\endcsname{#3}{\cref@result}%
+ \refb@counter=\cref@result%
+ \csname #1@getprefix\endcsname{#2}{\refa@prefix}%
+ \csname #1@getprefix\endcsname{#3}{\refb@prefix}%
+ \ifx\refa@prefix\refb@prefix%
\ifnum\refa@counter=\refb@counter\relax%
\def\@after{\@cref@refconsecutivetrue}%
+ \else%
+ \advance\refa@counter 1\relax%
+ \ifnum\refa@counter=\refb@counter\relax%
+ \def\@after{\@cref@refconsecutivetrue}%
+ \fi%
\fi%
\fi%
\fi%
- \expandafter\endgroup\@after}%
-\def\cref@ispagerefconsecutive#1#2{%
- \begingroup%
- \countdef\refa@counter=0%
- \countdef\refb@counter=1%
- \cref@getpageref{#1}{\cref@result}%
- \refa@counter=\cref@result%
- \cref@getpageref{#2}{\cref@result}%
- \refb@counter=\cref@result%
- \def\@after{\@cref@refconsecutivefalse}%
- \ifnum\refa@counter=\refb@counter\relax%
- \def\@after{\@cref@refconsecutivetrue}%
- \else%
- \advance\refa@counter 1\relax%
- \ifnum\refa@counter=\refb@counter\relax%
- \def\@after{\@cref@refconsecutivetrue}%
- \fi%
\fi%
\expandafter\endgroup\@after}%
-\def\cref@processgroup#1#2{%
- \edef\@nextref{\cref@stack@top{#1}}%
- \expandafter\ifx\csname r@\@nextref @cref\endcsname\relax%
- \def\@grouptype{\@undefined}%
- \def\@groupformat{\@undefined}%
- \else%
- \expandafter\cref@gettype\expandafter{\@nextref}{\@grouptype}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@groupformat%
- \expandafter\expandafter\expandafter{%
- \csname cref@\@grouptype @format\endcsname%
- {\@dummya}{\@dummyb}{\@dummyc}}%
- \fi%
- \let\@nexttype\@grouptype%
- \let\@nextformat\@groupformat%
- \@whilesw\ifx\@nextformat\@groupformat\fi{%
- \expandafter\cref@stack@pull\expandafter{\@nextref}{#2}%
- \cref@stack@pop{#1}%
- \cref@isstackempty{#1}%
+\def\cref@processgroup#1#2#3{%
+ \cref@stack@dropempty{#2}%
+ \edef\@firstref{\cref@stack@top{#2}}%
+ \let\@nextref\@firstref%
+ \cref@isrefsametypetrue%
+ \@whilesw\if@cref@sametype\fi{%
+ \expandafter\cref@stack@pull\expandafter{\@nextref}{#3}%
+ \cref@stack@pop{#2}%
+ \cref@isstackempty{#2}%
\if@cref@stackempty%
- \let\@nexttype\relax%
- \let\@nextformat\relax%
+ \@cref@sametypefalse%
\else%
- \edef\@nextref{\cref@stack@top{#1}}%
+ \edef\@nextref{\cref@stack@top{#2}}%
\ifx\@nextref\@empty%
- \let\@nexttype\@grouptype%
- \let\@nextforamt\@groupformat%
+ \@cref@sametypetrue%
\else%
- \expandafter\ifx\csname r@\@nextref @cref\endcsname\relax%
- \def\@nexttype{\@undefined}%
- \def\@nextformat{\@undefined}%
- \else%
- \expandafter\cref@gettype\expandafter%
- {\@nextref}{\@nexttype}%
- \def\@tempa{\@undefined}%
- \ifx\@nexttype\@tempa%
- \def\@nextformat{\@undefined}%
- \else%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@nextformat%
- \expandafter\expandafter\expandafter{%
- \csname cref@\@nexttype @format\endcsname%
- {\@dummya}{\@dummyb}{\@dummyc}}%
- \fi%
- \fi%
+ \csname #1@isrefsametype\endcsname{\@firstref}{\@nextref}%
\fi%
- \fi}%
-}%
-\def\cref@processgroupall#1#2{%
+ \fi}}%
+\def\cref@processgroupall#1#2#3{%
\cref@stack@init{\@tempstack}%
- \edef\@nextref{\cref@stack@top{#1}}%
- \expandafter\ifx\csname r@\@nextref @cref\endcsname\relax%
- \def\@grouptype{\@undefined}%
- \def\@groupformat{\@undefined}%
- \else%
- \expandafter\cref@gettype\expandafter{\@nextref}{\@grouptype}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@groupformat%
- \expandafter\expandafter\expandafter{%
- \csname cref@\@grouptype @format\endcsname%
- {\@dummya}{\@dummyb}{\@dummyc}}%
- \fi%
- \let\@lasttype\@grouptype%
- \let\@lastformat\@groupformat%
- \cref@isstackfull{#1}%
+ \cref@stack@dropempty{#2}%
+ \edef\@firstref{\cref@stack@top{#2}}%
+ \cref@isstackfull{#2}%
\@whilesw\if@cref@stackfull\fi{%
- \edef\@nextref{\cref@stack@top{#1}}%
+ \edef\@nextref{\cref@stack@top{#2}}%
\ifx\@nextref\@empty%
- \ifx\@lastformat\@groupformat%
- \let\@nexttype\@grouptype%
- \let\@nextformat\@groupformat%
- \else%
- \let\@nexttype\relax%
- \let\@nextformat\relax%
- \fi%
+ \expandafter\cref@stack@pull\expandafter{\@nextref}{#3}%
\else%
- \expandafter\ifx\csname r@\@nextref @cref\endcsname\relax%
- \def\@nexttype{\@undefined}%
- \def\@nextformat{\@undefined}%
+ \edef\@tempa{{\@firstref}{\@nextref}}%
+ \csname #1@isrefsametype\expandafter\endcsname\@tempa%
+ \if@cref@sametype%
+ \expandafter\cref@stack@pull\expandafter{\@nextref}{#3}%
\else%
- \expandafter\cref@gettype\expandafter%
- {\@nextref}{\@nexttype}%
- \def\@tempa{\@undefined}%
- \ifx\@nexttype\@tempa%
- \def\@nextformat{\@undefined}%
- \else%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@nextformat%
- \expandafter\expandafter\expandafter{%
- \csname cref@\@nexttype @format\endcsname%
- {\@dummya}{\@dummyb}{\@dummyc}}%
- \fi%
+ \expandafter\cref@stack@pull\expandafter{\@nextref}{\@tempstack}%
\fi%
\fi%
- \ifx\@nextformat\@groupformat%
- \expandafter\cref@stack@pull\expandafter{\@nextref}{#2}%
- \else%
- \expandafter\cref@stack@pull\expandafter{\@nextref}{\@tempstack}%
- \fi%
- \cref@stack@pop{#1}%
- \let\@lasttype\@nexttype%
- \let\@lastformat\@nextformat%
- \cref@isstackfull{#1}}%
- \let#1\@tempstack}%
+ \cref@stack@pop{#2}%
+ \cref@isstackfull{#2}}%
+ \let#2\@tempstack}%
\def\cref@processconsecutive#1#2#3#4#5{%
- #4=0%
- \edef\@nextref{\cref@stack@top{#1}}%
- \cref@stack@pop{#1}%
- \cref@isstackempty{#1}%
- \if@cref@stackempty%
- \edef#2{\@nextref}%
- \let#3\relax%
- #4=1\relax%
- \else%
- \edef#2{\@nextref}%
- \let#3\relax%
- \edef\@nextref{\cref@stack@top{#1}}%
- #4=1\relax%
- \expandafter\ifx\csname r@#2@cref\endcsname\relax%
+ \let#4\relax%
+ #5=1\relax%
+ \edef\@nextref{\cref@stack@top{#2}}%
+ \edef#3{\@nextref}%
+ \cref@stack@pop{#2}%
+ \cref@isstackfull{#2}%
+ \if@cref@stackfull%
+ \edef\@nextref{\cref@stack@top{#2}}%
+ \expandafter\ifx\csname r@#3@cref\endcsname\relax%
\@cref@refconsecutivefalse%
\else%
\ifx\@nextref\@empty%
\@cref@refconsecutivefalse%
- \@whilesw\ifx\@nextref\@empty\fi{%
- \cref@stack@pop{#1}%
- \cref@isstackempty{#1}%
- \if@cref@stackempty%
- \let\@nextref\relax%
- \else%
- \edef\@nextref{\cref@stack@top{#1}}%
- \fi}%
+ \cref@stack@dropempty{#2}%
\else%
- \expandafter\ifx\csname r@\@nextref @cref\endcsname\relax%
- \@cref@refconsecutivefalse%
- \else%
- \edef\@tempa{{#2}{\@nextref}}%
- \expandafter#5\@tempa%
- \fi%
+ \edef\@tempa{{#3}{\@nextref}}%
+ \csname #1@isrefconsecutive\expandafter\endcsname\@tempa%
\fi%
\fi%
\@whilesw\if@cref@refconsecutive\fi{%
- \advance#4 1%
- \let#3\@nextref%
- \cref@stack@pop{#1}%
- \cref@isstackempty{#1}%
+ \advance#5 1\relax%
+ \let#4\@nextref%
+ \cref@stack@pop{#2}%
+ \cref@isstackempty{#2}%
\if@cref@stackempty%
\@cref@refconsecutivefalse%
\else%
- \edef\@nextref{\cref@stack@top{#1}}%
+ \edef\@nextref{\cref@stack@top{#2}}%
\ifx\@nextref\@empty%
\@cref@refconsecutivefalse%
\@whilesw\ifx\@nextref\@empty\fi{%
- \cref@stack@pop{#1}%
- \cref@isstackempty{#1}%
+ \cref@stack@pop{#2}%
+ \cref@isstackempty{#2}%
\if@cref@stackempty%
\let\@nextref\relax%
\else%
- \edef\@nextref{\cref@stack@top{#1}}%
+ \edef\@nextref{\cref@stack@top{#2}}%
\fi}%
\else%
- \expandafter\ifx\csname r@\@nextref @cref\endcsname\relax%
- \@cref@refconsecutivefalse%
- \else%
- \edef\@tempa{{#3}{\@nextref}}%
- \expandafter#5\@tempa%
- \fi%
+ \edef\@tempa{{#4}{\@nextref}}%
+ \csname #1@isrefconsecutive\expandafter\endcsname\@tempa%
\fi%
\fi}%
\fi}%
@@ -901,7 +850,7 @@
\let\cref@acc\@empty%
\@crefstripprefix%
\cref@result%
- \endgroup}
+ \endgroup}%
\def\@crefstripprefix{%
\let\@iterate\relax%
\def\accum@flag{0}%
@@ -939,7 +888,7 @@
\fi%
\edef\cref@result{\cref@acc\@tempb\@toksb}%
\fi%
- \@iterate}
+ \@iterate}%
\def\cref@poptok#1#2{%
\expandafter\expandafter\expandafter\def%
\expandafter\expandafter\expandafter#2%
@@ -948,24 +897,31 @@
\expandafter\expandafter\expandafter\def%
\expandafter\expandafter\expandafter#1%
\expandafter\expandafter\expandafter{%
- \expandafter\@cref@poptok#1\@nil}}
-\def\@cref@firsttok#1#2\@nil{#1}
-\def\@cref@poptok#1#2\@nil{#2}
+ \expandafter\@cref@poptok#1\@nil}}%
+\def\@cref@firsttok#1#2\@nil{#1}%
+\def\@cref@poptok#1#2\@nil{#2}%
\DeclareRobustCommand{\cref}[1]{\@cref{cref}{#1}}%
\DeclareRobustCommand{\Cref}[1]{\@cref{Cref}{#1}}%
-\DeclareRobustCommand{\crefrange}[2]{\@setcrefrange{#1}{#2}{cref}{}}%
-\DeclareRobustCommand{\Crefrange}[2]{\@setcrefrange{#1}{#2}{Cref}{}}%
+\DeclareRobustCommand{\crefrange}[2]{\@setcrefrange{#1}{#2}{}}%
+\DeclareRobustCommand{\Crefrange}[2]{\@setCrefrange{#1}{#2}{}}%
\@ifpackageloaded{hyperref}{\newif\if@crefstarred}{%
\@ifpackageloaded{varioref}{\newif\if@crefstarred}{}}%
\let\if@crefstarred\iffalse%
\def\@cref#1#2{%
\leavevmode%
\begingroup%
+ \def\cref@variant{#1}%
+ \def\@tempa{\in@{page}}%
+ \expandafter\@tempa\expandafter{\cref@variant}%
+ \ifin@%
+ \def\cref@variant@get{cpageref}%
+ \else%
+ \def\cref@variant@get{cref}%
+ \fi%
\countdef\count@consecutive=0%
\countdef\count@group=1%
\count@group=1%
- \def\cref@variant{#1}%
- \newif\if@secondref%
+ \countdef\count@subgroup=2%
\cref@stack@init{\@refstack}%
\edef\@tempa{#2}%
\expandafter\cref@stack@push\expandafter{\@tempa}{\@refstack}%
@@ -973,13 +929,16 @@
\@whilesw\if@cref@stackfull\fi{%
\cref@stack@init{\@refsubstack}%
\if@cref@sort%
- \cref@processgroupall{\@refstack}{\@refsubstack}%
- \cref@stack@sort{\@refsubstack}{\cref@countercmp}%
+ \expandafter\cref@processgroupall\expandafter%
+ {\cref@variant@get}{\@refstack}{\@refsubstack}%
+ \expandafter\cref@stack@sort\expandafter%
+ {\csname\cref@variant@get @countercmp\endcsname}{\@refsubstack}%
\else%
- \cref@processgroup{\@refstack}{\@refsubstack}%
+ \expandafter\cref@processgroup\expandafter%
+ {\cref@variant@get}{\@refstack}{\@refsubstack}%
\fi%
\ifnum\count@group=1\relax%
- \advance\count@group 1%
+ \advance\count@group 1\relax%
\else%
\cref@isstackfull{\@refstack}%
\if@cref@stackfull%
@@ -991,103 +950,67 @@
\@setcref@lastgroupconjunction%
\fi%
\fi%
- \advance\count@group 1%
- \def\cref@variant{cref}%
- \fi%
- \if@cref@compress%
- \cref@processconsecutive%
- {\@refsubstack}{\@beginref}{\@endref}{\count@consecutive}%
- {\cref@isrefconsecutive}%
- \else%
- \edef\@beginref{\cref@stack@top{\@refsubstack}}%
- \cref@stack@pop{\@refsubstack}%
- \@whilesw\ifx\@beginref\@empty\fi{%
- \cref@stack@pop{\@refsubstack}%
- \cref@isstackempty{\@refsubstack}%
- \if@cref@stackempty%
- \let\@beginref\relax%
- \else%
- \edef\@beginref{\cref@stack@top{\@refsubstack}}%
- \fi}%
- \let\@endref\relax%
- \count@consecutive=1\relax%
- \fi%
- \ifnum\count@consecutive=1\relax%
- \cref@isstackfull{\@refsubstack}%
- \if@cref@stackfull%
- \expandafter\@setcref%
- \expandafter{\@beginref}{\cref@variant}{@first}%
- \else%
- \expandafter\@setcref%
- \expandafter{\@beginref}{\cref@variant}{}%
- \fi%
- \else%
- \ifnum\count@consecutive=2\relax%
- \expandafter\@setcref%
- \expandafter{\@beginref}{\cref@variant}{@first}%
- \expandafter\cref@stack@push\expandafter%
- {\@endref,}{\@refsubstack}%
- \else%
- \edef\@tempa{{\@beginref}{\@endref}}%
- \if@cref@stackempty%
- \expandafter\@setcrefrange\@tempa{\cref@variant}{}%
- \else%
- \expandafter\@setcrefrange\@tempa{\cref@variant}{@first}%
- \fi%
- \fi%
+ \advance\count@group 1\relax%
+ \lowercase{\def\cref@variant{#1}}%
\fi%
- \@secondreftrue%
+ \count@subgroup=1%
\cref@isstackfull{\@refsubstack}%
\@whilesw\if@cref@stackfull\fi{%
\if@cref@compress%
- \cref@processconsecutive%
+ \expandafter\cref@processconsecutive\expandafter{\cref@variant@get}%
{\@refsubstack}{\@beginref}{\@endref}{\count@consecutive}%
- {\cref@isrefconsecutive}%
\else%
+ \cref@stack@dropempty{\@refsubstack}%
\edef\@beginref{\cref@stack@top{\@refsubstack}}%
\cref@stack@pop{\@refsubstack}%
- \@whilesw\ifx\@beginref\@empty\fi{%
- \cref@stack@pop{\@refsubstack}%
- \cref@isstackempty{\@refsubstack}%
- \if@cref@stackempty%
- \let\@beginref\relax%
- \else%
- \edef\@beginref{\cref@stack@top{\@refsubstack}}%
- \fi}%
\let\@endref\relax%
\count@consecutive=1\relax%
\fi%
- \cref@isstackempty{\@refsubstack}%
- \if@cref@stackempty%
- \if@secondref%
- \def\@pos{@second}%
+ \ifnum\count@consecutive>1\relax%
+ \csname\cref@variant@get @getlabel\endcsname{\@beginref}{\@labela}%
+ \csname\cref@variant@get @getlabel\endcsname{\@endref}{\@labelb}%
+ \ifx\@labela\@labelb%
+ \let\@endref\relax%
+ \count@consecutive=1\relax%
+ \fi%
+ \fi%
+ \ifnum\count@consecutive=2\relax%
+ \expandafter\cref@stack@push\expandafter{\@endref,}{\@refsubstack}%
+ \let\@endref\relax%
+ \count@consecutive=1\relax%
+ \fi%
+ \cref@isstackfull{\@refsubstack}%
+ \if@cref@stackfull%
+ \ifnum\count@subgroup=1\relax%
+ \def\@pos{@first}%
\else%
- \def\@pos{@last}%
+ \def\@pos{@middle}%
\fi%
\else%
- \def\@pos{@middle}%
+ \ifnum\count@subgroup=1\relax%
+ \def\@pos{}%
+ \else%
+ \ifnum\count@subgroup=2\relax%
+ \def\@pos{@second}%
+ \else%
+ \def\@pos{@last}%
+ \fi%
+ \fi%
\fi%
\ifnum\count@consecutive=1\relax%
- \edef\@tempa{{\@beginref}{cref}{\@pos}}%
- \expandafter\@setcref\@tempa%
+ \edef\@tempa{{\@beginref}{\@pos}}%
+ \csname @set\cref@variant\expandafter\endcsname\@tempa%
\else%
- \ifnum\count@consecutive=2\relax%
- \expandafter\@setcref\expandafter%
- {\@beginref}{cref}{@middle}%
- \expandafter\cref@stack@push\expandafter%
- {\@endref}{\@refsubstack}%
- \else%
- \edef\@tempa{{\@beginref}{\@endref}{cref}{\@pos}}%
- \expandafter\@setcrefrange\@tempa%
- \fi%
+ \edef\@tempa{{\@beginref}{\@endref}{\@pos}}%
+ \csname @set\cref@variant range\expandafter\endcsname\@tempa%
\fi%
- \@secondreffalse%
+ \advance\count@subgroup 1\relax%
\cref@isstackfull{\@refsubstack}%
}% end loop over reference substack
\cref@isstackfull{\@refstack}%
\if@cref@stackfull%
- \def\@tempa{#1}\def\@tempb{labelcref}%
- \ifx\@tempa\@tempb\relax%
+ \def\@tempa{labelcref}%
+ \ifx\cref@variant\@tempa%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries\space ??}%
\@latex@warning{References in label reference on page \thepage
@@ -1097,80 +1020,94 @@
\fi%
}% end loop over main reference stack
\endgroup}%
-\def\@setcref#1#2#3{%
- \expandafter\ifx\csname r@#1@cref\endcsname\relax%
+\def\@setcref{\@@setcref{cref}}%
+\def\@setCref{\@@setcref{Cref}}%
+\def\@setlabelcref{\@@setcref{labelcref}}%
+\def\@@setcref#1#2#3{%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries ??}%
- \@latex@warning{Reference `#1' on page \thepage \space undefined}%
+ \@latex@warning{Reference `#2' 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%
- \edef\@tempa{#2}\def\@tempb{labelcref}%
+ \cref@gettype{#2}{\@temptype}% puts label type in \@temptype
+ \cref@getlabel{#2}{\@templabel}% puts label in \@templabel
+ \expandafter\ifx\csname #1@\@temptype @format#3\endcsname\relax%
+ \edef\@tempa{#1}\def\@tempb{labelcref}%
\ifx\@tempa\@tempb\relax%
- \expandafter\@@setcref\expandafter%
- {\csname #2@default@format#3\endcsname}{#1}%
+ \expandafter\@@@setcref\expandafter%
+ {\csname #1@default@format#3\endcsname}{#2}%
\else%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries ??}~\@templabel%
- \@latex@warning{#2 \space reference format for label type
+ \@latex@warning{#1\space reference format for label type
`\@temptype' undefined}%
\fi%
\else%
- \expandafter\@@setcref\expandafter%
- {\csname #2@\@temptype @format#3\endcsname}{#1}%
+ \expandafter\@@@setcref\expandafter%
+ {\csname #1@\@temptype @format#3\endcsname}{#2}%
\fi%
\fi}%
-\def\@@setcref#1#2{\cref@getlabel{#2}{\@templabel}#1{\@templabel}{}{}}%
-\def\@setcrefrange#1#2#3#4{%
+\def\@@@setcref#1#2{\cref@getlabel{#2}{\@templabel}#1{\@templabel}{}{}}%
+\def\@setcrefrange{\@@setcrefrange{cref}}%
+\def\@setCrefrange{\@@setcrefrange{Cref}}%
+\def\@setlabelcrefrange{\@@setcrefrange{labelcref}}%
+\def\@@setcrefrange#1#2#3#4{%
\begingroup%
- \expandafter\ifx\csname r@#1@cref\endcsname\relax%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax%
\protect\G@refundefinedtrue%
- \@latex@warning{Reference `#1' on page \thepage \space%
+ \@latex@warning{Reference `#2' on page \thepage \space%
undefined}%
- \expandafter\ifx\csname r@#2@cref\endcsname\relax%
+ \expandafter\ifx\csname r@#3@cref\endcsname\relax%
\nfss@text{\reset@font\bfseries ??}--%
\nfss@text{\reset@font\bfseries ??}%
- \@latex@warning{Reference `#2' on page \thepage \space%
+ \@latex@warning{Reference `#3' on page \thepage \space%
undefined}%
\else%
- \cref@getlabel{#2}{\@labelb}%
+ \cref@getlabel{#3}{\@labelb}%
\nfss@text{\reset@font\bfseries ??}--\@labelb%
\fi%
\else%
- \expandafter\ifx\csname r@#2@cref\endcsname\relax%
+ \expandafter\ifx\csname r@#3@cref\endcsname\relax%
\protect\G@refundefinedtrue%
- \cref@getlabel{#1}{\@labela}%
+ \cref@getlabel{#2}{\@labela}%
\@labela--\nfss@text{\reset@font\bfseries ??}%
- \@latex@warning{Reference `#2' on page \thepage %
+ \@latex@warning{Reference `#3' 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%
- \edef\@tempa{#3}\def\@tempb{labelcref}%
+ \cref@gettype{#2}{\@typea}%
+ \cref@gettype{#3}{\@typeb}%
+ \cref@getlabel{#2}{\@labela}%
+ \cref@getlabel{#3}{\@labelb}%
+ \edef\@format{\expandafter\noexpand%
+ \csname #1range@\@typea @format#4\endcsname}%
+ \expandafter\ifx\@format\relax%
+ \edef\@tempa{#1}\def\@tempb{labelcref}%
\ifx\@tempa\@tempb\relax%
- \expandafter\@@setcrefrange\expandafter%
- {\csname #3range@default@format#4\endcsname}{#1}{#2}%
+ \expandafter\@@@setcrefrange\expandafter%
+ {\csname #1range@default@format#4\endcsname}{#2}{#3}%
\else%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries ??}~\@labela--\@labelb%
- \@latex@warning{#3\space reference range format for label
+ \@latex@warning{#1 reference range format for label
type `\@typea' undefined}%
\fi%
\else%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@formata%
+ \expandafter\expandafter\expandafter{%
+ \csname #1range@\@typea @format#4\endcsname%
+ {\@dummya}{\@dummyb}{\@dummyc}{\@dummyd}{\@dummye}{\@dummyf}}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@formatb%
+ \expandafter\expandafter\expandafter{%
+ \csname #1range@\@typeb @format#4\endcsname%
+ {\@dummya}{\@dummyb}{\@dummyc}{\@dummyd}{\@dummye}{\@dummyf}}%
\ifx\@formata\@formatb%
- \expandafter\@@setcrefrange\expandafter{\@formata}{#1}{#2}%
+ \expandafter\@@@setcrefrange\expandafter{\@format}{#2}{#3}%
\else%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries ??}~\@labela--\@labelb%
- \@latex@warning{References `#1' and `#2' in reference range
+ \@latex@warning{References `#2' and `#3' in reference range
on page \thepage \space have different types
`\@typea' and `\@typeb'}%
\fi%
@@ -1178,7 +1115,7 @@
\fi%
\fi%
\endgroup}%
-\def\@@setcrefrange#1#2#3{%
+\def\@@@setcrefrange#1#2#3{%
\cref@getlabel{#2}{\@labela}%
\cref@getlabel{#3}{\@labelb}%
#1{\@labela}{\@labelb}{}{}{}{}}%
@@ -1212,146 +1149,52 @@
}{%
\edef\@tempa{%
\expandafter\noexpand\csname #1@\@tempa @name#3\endcsname}%
- \expandafter\@@setnamecref\expandafter{\@tempa}{#4}%
+ \expandafter\@@@setnamecref\expandafter{\@tempa}{#4}%
}%
\fi}%
-\def\@@setnamecref#1#2{%
+\def\@@@setnamecref#1#2{%
\expandafter\def\expandafter\@tempa\expandafter{#1}%
\expandafter#2\@tempa}%
-\DeclareRobustCommand{\cpageref}[1]{%
- \@cpageref{cref}{#1}{\@setcpageref}{\@setcpagerefrange}}%
-\DeclareRobustCommand{\Cpageref}[1]{%
- \@cpageref{Cref}{#1}{\@setcpageref}{\@setcpagerefrange}}%
+\DeclareRobustCommand{\cpageref}[1]{\@cref{cpageref}{#1}}%
+\DeclareRobustCommand{\Cpageref}[1]{\@cref{Cpageref}{#1}}%
\DeclareRobustCommand{\cpagerefrange}[2]{%
- \@setcpagerefrange{#1}{#2}{cref}{}}%
+ \@@setcpagerefrange{#1}{#2}{cref}{}}%
\DeclareRobustCommand{\Cpagerefrange}[2]{%
- \@setcpagerefrange{#1}{#2}{Cref}{}}%
+ \@@setcpagerefrange{#1}{#2}{Cref}{}}%
\DeclareRobustCommand{\labelcpageref}[1]{%
- \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}}%
-\def\@cpageref#1#2#3#4{%
- \leavevmode%
- \begingroup%
- \countdef\count@consecutive=0%
- \countdef\count@group=1%
- \countdef\@counta=2%
- \countdef\@countb=3%
- \count@group=0%
- \cref@stack@init{\@refstack}%
- \edef\@tempa{#2}%
- \expandafter\cref@stack@push\expandafter{\@tempa}{\@refstack}%
- \if@cref@sort%
- \cref@stack@sort{\@refstack}{\cref@pagecmp}%
- \fi%
- \cref@isstackfull{\@refstack}%
- \@whilesw\if@cref@stackfull\fi{%
- \if@cref@compress%
- \cref@processconsecutive%
- {\@refstack}{\@beginref}{\@endref}{\count@consecutive}%
- {\cref@ispagerefconsecutive}%
- \else%
- \edef\@beginref{\cref@stack@top{\@refstack}}%
- \cref@stack@pop{\@refstack}%
- \@whilesw\ifx\@beginref\@empty\fi{%
- \cref@stack@pop{\@refstack}%
- \cref@isstackempty{\@refstack}%
- \if@cref@stackempty%
- \let\@beginref\relax%
- \else%
- \edef\@beginref{\cref@stack@top{\@refstack}}%
- \fi}%
- \let\@endref\relax%
- \count@consecutive=1\relax%
- \fi%
- \ifx\@endref\relax\else%
- \expandafter\ifx\csname r@\@beginref @cref\endcsname\relax\else%
- \expandafter\ifx\csname r@\@endref @cref\endcsname\relax\else%
- \cref@getpageref{\@beginref}{\@tempa}%
- \cref@getpageref{\@endref}{\@tempb}%
- \ifx\@tempa\@tempb\relax%
- \count@consecutive=1%
- \let\@endref\relax%
- \else%
- \@counta=\@tempa\relax%
- \@countb=\@tempb\relax%
- \advance\@counta 1\relax%
- \ifnum\@counta=\@countb\relax%
- \count@consecutive=2%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \cref@isstackempty{\@refstack}%
- \if@cref@stackempty%
- \ifcase\count@group\relax%
- \ifnum\count@consecutive=2\relax%
- \def\@pos{@first}%
- \else%
- \def\@pos{}%
- \fi%
- \or%
- \ifnum\count@consecutive=2\relax%
- \def\@pos{@middle}%
- \else%
- \def\@pos{@second}%
- \fi%
- \else%
- \def\@pos{@last}%
- \fi%
- \else%
- \ifnum\count@group=0\relax%
- \def\@pos{@first}%
- \else%
- \def\@pos{@middle}%
- \fi%
- \fi%
- \ifnum\count@consecutive=1\relax%
- \def\@tempa{#3}%
- \edef\@tempb{{\@beginref}{#1}{\@pos}}%
- \expandafter\@tempa\@tempb%
- \else%
- \ifnum\count@consecutive=2\relax%
- \def\@tempa{#3}%
- \edef\@tempb{{\@beginref}{#1}{\@pos}}%
- \expandafter\@tempa\@tempb%
- \expandafter\cref@stack@push\expandafter%
- {\@endref,}{\@refstack}%
- \else%
- \def\@tempa{#4}%
- \edef\@tempb{{\@beginref}{\@endref}{#1}{\@pos}}%
- \expandafter\@tempa\@tempb%
- \fi%
- \fi%
- \advance\count@group 1%
- \cref@isstackfull{\@refstack}%
- }% end loop over reference stack
- \endgroup}%
-\def\@setcpageref#1#2#3{%
- \expandafter\ifx\csname r@#1@cref\endcsname\relax%
+ \@cref{labelcpageref}{#1}}%
+\def\@setcpageref{\@@setcpageref{cref}}
+\def\@setCpageref{\@@setcpageref{Cref}}
+\def\@setlabelcpageref{\@@setcpageref{labelcref}}
+\def\@@setcpageref#1#2#3{%
+ \expandafter\ifx\csname r@#2@cref\endcsname\relax%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries ??}%
- \@latex@warning{Reference `#1' on page \thepage \space undefined}%
+ \@latex@warning{Reference `#2' on page \thepage \space undefined}%
\else%
- \cref@getpageref{#1}{\@temppage}%
- \expandafter\ifx\csname #2@page@format#3\endcsname\relax%
- \edef\@tempa{#2}\def\@tempb{labelcref}%
+ \cpageref@getlabel{#2}{\@temppage}%
+ \expandafter\ifx\csname #1@page@format#3\endcsname\relax%
+ \edef\@tempa{#1}\def\@tempb{labelcref}%
\ifx\@tempa\@tempb\relax%
- \expandafter\@@setcpageref\expandafter%
- {\csname #2@default@format#3\endcsname}{#1}%
+ \expandafter\@@@setcpageref\expandafter%
+ {\csname #1@default@format#3\endcsname}{#2}%
\else%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries ??}~\@temppage%
- \@latex@warning{#2 \space reference format for
+ \@latex@warning{ #1 reference format for
page references undefined}%
\fi%
\else%
- \expandafter\@@setcpageref\expandafter%
- {\csname #2@page@format#3\endcsname}{#1}%
+ \expandafter\@@@setcpageref\expandafter%
+ {\csname #1@page@format#3\endcsname}{#2}%
\fi%
\fi}%
-\def\@@setcpageref#1#2{%
- \cref@getpageref{#2}{\@temppage}#1{\@temppage}{}{}}%
-\def\@setcpagerefrange#1#2#3#4{%
+\def\@@@setcpageref#1#2{%
+ \cpageref@getlabel{#2}{\@temppage}#1{\@temppage}{}{}}%
+\def\@setcpagerefrange#1#2#3{\@@setcpagerefrange{#1}{#2}{cref}{#3}}%
+\def\@setCpagerefrange#1#2#3{\@@setcpagerefrange{#1}{#2}{Cref}{#3}}%
+\def\@setlabelcpagerefrange#1#2#3{\@@setcpagerefrange{#1}{#2}{labelcref}{#3}}%
+\def\@@setcpagerefrange#1#2#3#4{%
\begingroup%
\expandafter\ifx\csname r@#1@cref\endcsname\relax%
\protect\G@refundefinedtrue%
@@ -1363,41 +1206,41 @@
\@latex@warning{Reference `#2' on page \thepage \space%
undefined}%
\else%
- \cref@getpageref{#2}{\@pageb}%
+ \cpageref@getlabel{#2}{\@pageb}%
\nfss@text{\reset@font\bfseries ??}--\@pageb%
\fi%
\else%
\expandafter\ifx\csname r@#2@cref\endcsname\relax%
\protect\G@refundefinedtrue%
- \cref@getpageref{#1}{\@pagea}%
+ \cpageref@getlabel{#1}{\@pagea}%
\@pagea--\nfss@text{\reset@font\bfseries ??}%
\@latex@warning{Reference `#2' on page \thepage %
\space undefined}%
\else%
- \cref@getpageref{#1}{\@pagea}%
- \cref@getpageref{#2}{\@pageb}%
+ \cpageref@getlabel{#1}{\@pagea}%
+ \cpageref@getlabel{#2}{\@pageb}%
\edef\@format{\expandafter\noexpand%
- \csname #3range@page@format#4\endcsname}%
+ \csname#3range@page@format#4\endcsname}%
\expandafter\ifx\@format\relax%
\edef\@tempa{#3}\def\@tempb{labelcref}%
\ifx\@tempa\@tempb\relax%
- \expandafter\@@setcpagerefrange\expandafter%
- {\csname #3range@default@format#4\endcsname}{#1}{#2}%
+ \expandafter\@@@setcpagerefrange\expandafter%
+ {\csname#3range@default@format#4\endcsname}{#1}{#2}%
\else%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries ??}~\@pagea--\@pageb%
- \@latex@warning{#3\space reference range format for page
+ \@latex@warning{#3 reference range format for page
references undefined}%
\fi%
\else%
- \expandafter\@@setcpagerefrange\expandafter{\@format}{#1}{#2}%
+ \expandafter\@@@setcpagerefrange\expandafter{\@format}{#1}{#2}%
\fi%
\fi%
\fi%
\endgroup}%
-\def\@@setcpagerefrange#1#2#3{%
- \cref@getpageref{#2}{\@pagea}%
- \cref@getpageref{#3}{\@pageb}%
+\def\@@@setcpagerefrange#1#2#3{%
+ \cpageref@getlabel{#2}{\@pagea}%
+ \cpageref@getlabel{#3}{\@pageb}%
#1{\@pagea}{\@pageb}{}{}{}{}}%
\cref@stack@init{\cref@label@types}%
\newcommand\crefdefaultlabelformat[1]{%
@@ -1824,6 +1667,142 @@
\@crefrangedefineformat{#1}%
\@crefdefinemultiformat{#1}%
\@crefrangedefinemultiformat{#1}}%
+\def\@crefcopyformats#1#2{%
+ \@ifundefined{cref@#2@name}{%
+ \edef\@tempa{\expandafter\noexpand\csname cref@#2@name\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname cref@#1@name\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb%
+ \edef\@tempa{\expandafter\noexpand\csname cref@#2@name@plural\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname cref@#1@name@plural\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{cref@#2@format}{%
+ \edef\@tempa{\expandafter\noexpand\csname cref@#2@format\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname cref@#1@format\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{crefrange@#2@format}{%
+ \edef\@tempa{\expandafter\noexpand\csname crefrange@#2@format\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname crefrange@#1@format\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{cref@#2@format@first}{%
+ \edef\@tempa{\expandafter\noexpand\csname cref@#2@format@first\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname cref@#1@format@first\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{cref@#2@format@second}{%
+ \edef\@tempa{\expandafter\noexpand\csname cref@#2@format@second\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname cref@#1@format@second\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{cref@#2@format@middle}{%
+ \edef\@tempa{\expandafter\noexpand\csname cref@#2@format@middle\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname cref@#1@format@middle\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{cref@#2@format@last}{%
+ \edef\@tempa{\expandafter\noexpand\csname cref@#2@format@last\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname cref@#1@format@last\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{crefrange@#2@format@first}{%
+ \edef\@tempa{\expandafter\noexpand\csname crefrange@#2@format@first\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname crefrange@#1@format@first\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{crefrange@#2@format@second}{%
+ \edef\@tempa{\expandafter\noexpand\csname crefrange@#2@format@second\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname crefrange@#1@format@second\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{crefrange@#2@format@middle}{%
+ \edef\@tempa{\expandafter\noexpand\csname crefrange@#2@format@middle\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname crefrange@#1@format@middle\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{crefrange@#2@format@last}{%
+ \edef\@tempa{\expandafter\noexpand\csname crefrange@#2@format@last\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname crefrange@#1@format@last\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Cref@#2@name}{%
+ \edef\@tempa{\expandafter\noexpand\csname Cref@#2@name\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Cref@#1@name\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb%
+ \edef\@tempa{\expandafter\noexpand\csname Cref@#2@name@plural\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Cref@#1@name@plural\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Cref@#2@format}{%
+ \edef\@tempa{\expandafter\noexpand\csname Cref@#2@format\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Cref@#1@format\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Crefrange@#2@format}{%
+ \edef\@tempa{\expandafter\noexpand\csname Crefrange@#2@format\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Crefrange@#1@format\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Cref@#2@format@first}{%
+ \edef\@tempa{\expandafter\noexpand\csname Cref@#2@format@first\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Cref@#1@format@first\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Cref@#2@format@second}{%
+ \edef\@tempa{\expandafter\noexpand\csname Cref@#2@format@second\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Cref@#1@format@second\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Cref@#2@format@middle}{%
+ \edef\@tempa{\expandafter\noexpand\csname Cref@#2@format@middle\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Cref@#1@format@middle\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Cref@#2@format@last}{%
+ \edef\@tempa{\expandafter\noexpand\csname Cref@#2@format@last\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Cref@#1@format@last\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Crefrange@#2@format@first}{%
+ \edef\@tempa{\expandafter\noexpand\csname Crefrange@#2@format@first\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Crefrange@#1@format@first\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Crefrange@#2@format@second}{%
+ \edef\@tempa{\expandafter\noexpand\csname Crefrange@#2@format@second\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Crefrange@#1@format@second\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Crefrange@#2@format@middle}{%
+ \edef\@tempa{\expandafter\noexpand\csname Crefrange@#2@format@middle\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Crefrange@#1@format@middle\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{Crefrange@#2@format@last}{%
+ \edef\@tempa{\expandafter\noexpand\csname Crefrange@#2@format@last\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname Crefrange@#1@format@last\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcref@#2@format}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcref@#2@format\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcref@#1@format\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcrefrange@#2@format}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcrefrange@#2@format\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcrefrange@#1@format\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcref@#2@format@first}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcref@#2@format@first\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcref@#1@format@first\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcref@#2@format@second}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcref@#2@format@second\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcref@#1@format@second\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcref@#2@format@middle}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcref@#2@format@middle\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcref@#1@format@middle\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcref@#2@format@last}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcref@#2@format@last\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcref@#1@format@last\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcrefrange@#2@format@first}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcrefrange@#2@format@first\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcrefrange@#1@format@first\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcrefrange@#2@format@second}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcrefrange@#2@format@second\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcrefrange@#1@format@second\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcrefrange@#2@format@middle}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcrefrange@#2@format@middle\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcrefrange@#1@format@middle\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+ \@ifundefined{labelcrefrange@#2@format@last}{%
+ \edef\@tempa{\expandafter\noexpand\csname labelcrefrange@#2@format@last\endcsname}%
+ \edef\@tempb{\expandafter\noexpand\csname labelcrefrange@#1@format@last\endcsname}%
+ \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
+}
\newcommand\crefformat[2]{\@crefformat{cref}{#1}{#2}}%
\newcommand\Crefformat[2]{\@crefformat{Cref}{#1}{#2}}%
\newcommand\crefrangeformat[2]{\@crefrangeformat{crefrange}{#1}{#2}}%
@@ -2000,15 +1979,17 @@
}{}%
\endgroup}%
\let\if@cref@hyperrefloaded\iffalse%
+\let\cref@addtoreset\@addtoreset%
\@ifpackageloaded{hyperref}{%
\@ifpackagewith{hyperref}{implicit=false}{}{%
\let\if@cref@hyperrefloaded\iftrue%
\PackageInfo{cleveref}{`hyperref' support loaded}%
+ \let\cref@addtoreset\HyOrg@addtoreset%
\def\cref@hyperlinkname#1{\expandafter\expandafter\expandafter%
\@fourthoffive\csname r@#1\endcsname}%
\def\cref@hyperlinkurl#1{\expandafter\expandafter\expandafter%
\@fifthoffive\csname r@#1\endcsname}%
- \def\cref@hyperlink#1#2#3\@nil{\hyper@@link[link]{#1}{#2}{#3}}
+ \def\cref@hyperlink#1#2#3\@nil{\hyper@@link[link]{#1}{#2}{#3}}%
\let\cref@old@H@refstepcounter\H@refstepcounter%
\def\H@refstepcounter#1{%
\cref@old@H@refstepcounter{#1}%
@@ -2022,149 +2003,142 @@
\let\refstepcounter@noarg\cref@old@refstepcounter%
\def\refstepcounter@optarg[#1]#2{%
\cref@old@refstepcounter{#2}%
+ \@ifundefined{cref@#1@alias}%
+ {\def\@tempa{#1}}%
+ {\def\@tempa{\csname cref@#1@alias\endcsname}}%
\protected@edef\cref@currentlabel{%
\expandafter\cref@override@label@type%
- \cref@currentlabel\@nil{#1}}}%
+ \cref@currentlabel\@nil{\@tempa}}}%
\@ifundefined{appendix}{}{%
- \g@addto@macro\appendix{%
+ \def\appendix{%
\@ifundefined{chapter}{%
- \def\H@refstepcounter#1{%
- \cref@old@H@refstepcounter{#1}%
- \cref@constructprefix{#1}{\cref@result}%
+ \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\@tempa{##1}%
\def\@tempb{section}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [appendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [appendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{subsection}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [subappendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{subsubsection}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subsubappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [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}}%
+ \@ifundefined{cref@##1@alias}%
+ {\def\@tempa{##1}}%
+ {\def\@tempa{\csname cref@##1@alias\endcsname}}%
\protected@edef\cref@currentlabel{%
- [\@tempa][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [\@tempa][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\fi%
\fi%
\fi}%
+ \cref@old@appendix%
}{%
- \def\H@refstepcounter#1{%
- \cref@old@H@refstepcounter{#1}%
- \cref@constructprefix{#1}{\cref@result}%
+ \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\@tempa{##1}%
\def\@tempb{chapter}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [appendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [appendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{section}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [subappendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{subsection}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subsubappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [subsubappendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\else%
- \def\@tempa{#1}%
+ \def\@tempa{##1}%
\def\@tempb{subsubsection}%
\ifx\@tempa\@tempb%
\protected@edef\cref@currentlabel{%
- [subsubsubappendix][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [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}}%
+ \@ifundefined{cref@##1@alias}%
+ {\def\@tempa{##1}}%
+ {\def\@tempa{\csname cref@##1@alias\endcsname}}%
\protected@edef\cref@currentlabel{%
- [\@tempa][\arabic{#1}][\cref@result]%
- \csname p@#1\endcsname\csname the#1\endcsname}%
+ [\@tempa][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
\fi%
\fi%
\fi%
\fi}%
- }%
+ \cref@old@appendix}%
}%
}% end of \@ifundefined{appendix}
\DeclareRobustCommand{\cref}{%
- \@ifstar{\@crefstar{cref}}{\@crefnostar{cref}}}%
+ \@ifstar{\@crefstar{cref}}{\@cref{cref}}}%
\DeclareRobustCommand{\Cref}{%
- \@ifstar{\@crefstar{Cref}}{\@crefnostar{Cref}}}%
- \def\@crefnostar#1#2{\@cref{#1}{#2}}%
+ \@ifstar{\@crefstar{Cref}}{\@cref{Cref}}}%
\def\@crefstar#1#2{%
\@crefstarredtrue\@cref{#1}{#2}\@crefstarredfalse}%
\DeclareRobustCommand{\crefrange}{%
\@ifstar{\@crefrangestar{cref}}{\@crefrangenostar{cref}}}%
\DeclareRobustCommand{\Crefrange}{%
\@ifstar{\@crefrangestar{Cref}}{\@crefrangenostar{Cref}}}%
- \def\@crefrangenostar#1#2#3{\@setcrefrange{#2}{#3}{#1}{}}%
+ \def\@crefrangenostar#1#2#3{\@@setcrefrange{#1}{#2}{#3}{}}
\def\@crefrangestar#1#2#3{%
- \@crefstarredtrue\@setcrefrange{#2}{#3}{#1}{}\@crefstarredfalse}%
+ \@crefstarredtrue\@@setcrefrange{#1}{#2}{#3}{}\@crefstarredfalse}%
\DeclareRobustCommand{\cpageref}{%
- \@ifstar{\@cpagerefstar{cref}}{\@cpagerefnostar{cref}}}%
+ \@ifstar{\@crefstar{cpageref}}{\@cref{cpageref}}}%
\DeclareRobustCommand{\Cpageref}{%
- \@ifstar{\@cpagerefstar{Cref}}{\@cpagerefnostar{Cref}}}%
- \def\@cpagerefnostar#1#2{%
- \@cpageref{#1}{#2}{\@setcpageref}{\@setcpagerefrange}}%
- \def\@cpagerefstar#1#2{%
- \@crefstarredtrue%
- \@cpageref{#1}{#2}{\@setcpageref}{\@setcpagerefrange}%
- \@crefstarredfalse}%
+ \@ifstar{\@crefstar{Cpageref}}{\@cref{Cpageref}}}%
\DeclareRobustCommand{\cpagerefrange}{%
- \@ifstar{\@cpagerefrangestar{cref}}{\@cpagerefrangenostar{cref}}}%
+ \@ifstar{\@cpagerefrangestar{cpageref}}{\@setcpagerefrange}}%
\DeclareRobustCommand{\Cpagerefrange}{%
- \@ifstar{\@cpagerefrangestar{Cref}}{\@cpagerefrangenostar{Cref}}}%
- \def\@cpagerefrangenostar#1#2#3{\@setcpagerefrange{#2}{#3}{#1}{}}%
+ \@ifstar{\@cpagerefrangestar{Cpageref}}{\@setCpagerefrange}}%
\def\@cpagerefrangestar#1#2#3{%
\@crefstarredtrue%
- \@setcpagerefrange{#2}{#3}{#1}{}%
+ \@@setcpagerefrange{#1}{#2}{#3}{}%
\@crefstarredfalse}%
\DeclareRobustCommand{\labelcref}{%
- \@ifstar{\@labelcrefstar}{\@labelcrefnostar}}%
- \def\@labelcrefnostar#1{\@cref{labelcref}{#1}}%
+ \@ifstar{\@labelcrefstar}{\@cref{labelcref}}}%
\def\@labelcrefstar#1{%
\@crefstarredtrue%
\@cref{labelcref}{#1}%
\@crefstarredfalse}%
\DeclareRobustCommand{\labelcpageref}{%
- \@ifstar{\@labelcpagerefstar}{\@labelcpagerefnostar}}%
- \def\@labelcpagerefnostar#1{%
- \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}}%
+ \@ifstar{\@labelcpagerefstar}{\@cref{labelcpageref}}}%
\def\@labelcpagerefstar#1{%
\@crefstarredtrue%
- \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}%
+ \@cref{labelcpageref}{#1}%
\@crefstarredfalse}%
- \def\@@setcref#1#2{%
+ \def\@@@setcref#1#2{%
\cref@getlabel{#2}{\@templabel}%
\if@crefstarred%
#1{\@templabel}{}{}%
@@ -2173,7 +2147,7 @@
\edef\@tempurl{\cref@hyperlinkurl{#2}}%
#1{\@templabel}{\cref@hyperlink{\@tempurl}{\@tempname}}{\@nil}%
\fi}%
- \def\@@setcrefrange#1#2#3{%
+ \def\@@@setcrefrange#1#2#3{%
\cref@getlabel{#2}{\@labela}%
\cref@getlabel{#3}{\@labelb}%
\if@crefstarred%
@@ -2187,8 +2161,8 @@
{\cref@hyperlink{\@tempurla}{\@tempnamea}}{\@nil}%
{\cref@hyperlink{\@tempurlb}{\@tempnameb}}{\@nil}%
\fi}%
- \def\@@setcpageref#1#2{%
- \cref@getpageref{#2}{\@temppage}%
+ \def\@@@setcpageref#1#2{%
+ \cpageref@getlabel{#2}{\@temppage}%
\if@crefstarred%
#1{\@temppage}{}{}%
\else%
@@ -2196,9 +2170,9 @@
\edef\@tempurl{\cref@hyperlinkurl{#2}}%
#1{\@temppage}{\cref@hyperlink{\@tempurl}{\@tempname}}{\@nil}%
\fi}%
- \def\@@setcpagerefrange#1#2#3{%
- \cref@getpageref{#2}{\@pagea}%
- \cref@getpageref{#3}{\@pageb}%
+ \def\@@@setcpagerefrange#1#2#3{%
+ \cpageref@getlabel{#2}{\@pagea}%
+ \cpageref@getlabel{#3}{\@pageb}%
\if@crefstarred%
#1{\@pagea}{\@pageb}{}{}{}{}%
\else%
@@ -2225,78 +2199,117 @@
\protected@edef\cref@currentlabel{%
[\@tempa][\arabic{#1}][\cref@result]%
\csname p@#1\endcsname\csname the#1\endcsname}}%
- \fi%
+ \@ifundefined{appendix}{}{%
+ \def\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@edef\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@edef\cref@currentlabel{%
+ [subappendix][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
+ \else%
+ \def\@tempa{##1}%
+ \def\@tempb{subsubsection}%
+ \ifx\@tempa\@tempb%
+ \protected@edef\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@edef\cref@currentlabel{%
+ [\@tempa][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
+ \fi%
+ \fi%
+ \fi}%
+ \cref@old@appendix%
+ }{%
+ \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@edef\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@edef\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@edef\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@edef\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@edef\cref@currentlabel{%
+ [\@tempa][\arabic{##1}][\cref@result]%
+ \csname p@##1\endcsname\csname the##1\endcsname}%
+ \fi%
+ \fi%
+ \fi%
+ \fi}%
+ \cref@old@appendix}%
+ }%
+ }% end of \@ifundefined{appendix}
+ \fi% end of \if@cref@hyperrefloaded
\let\if@cref@hyperrefloaded\iffalse%
}% end of \@ifpackageloaded{hyperref}
+\AtBeginDocument{%
+ \if@cref@hyperrefloaded\else%
+ \@ifpackageloaded{hyperref}{%
+ \PackageError{cleveref}{cleveref must be loaded after hyperref!}%
+ {Package load order is wrong: load cleveref *after* hyperref.}
+ }{}%
+ \fi}
+\let\if@cref@variorefloaded\iffalse%
\@ifpackageloaded{varioref}{%
+ \let\if@cref@variorefloaded\iftrue%
\PackageInfo{cleveref}{`varioref' support loaded}%
\PackageInfo{cleveref}{`cleveref' supersedes `varioref's
\string\labelformat command}%
- \def\cref@@vpageref#1[#2]#3{%
- \@cpageref{cref}{#3}%
- {\@setvpageref[#1][\vref@space]}{\@setvpagerefrange[#1]}}%
- \def\cref@vref#1#2{%
- \leavevmode%
- \begingroup%
- \def\reftextcurrent{}%
- \@cref{#1}{#2}\@setcref@space%
- \cref@@vpageref{\reftextcurrent}[]{#2}%
- \endgroup}%
- \def\cref@vrefrange#1#2#3{%
- \@setcrefrange{#2}{#3}{#1}{}\@setcref@space\vpagerefrange{#2}{#3}}%
- \def\cref@fullref#1#2{%
- \@cref{#1}{#2}\@setcref@space%
- \@cpageref{cref}{#2}{\@setfullpageref}{\@setfullpagerefrange}}%
- \def\cref@vpagerefconjunction#1{%
- \def\@tempa{#1}%
- \def\@tempb{@second}%
- \ifx\@tempa\@tempb\relax%
- \@setcref@pairconjunction%
- \else%
- \def\@tempb{@middle}%
- \ifx\@tempa\@tempb\relax%
- \@setcref@middleconjunction%
- \else%
- \def\@tempb{@last}%
- \ifx\@tempa\@tempb\relax%
- \@setcref@lastconjunction%
- \fi%
- \fi%
- \fi}%
- \def\@setcref@space{ }%
- \def\@setvpageref[#1][#2]#3#4#5{%
- \cref@vpagerefconjunction{#5}%
- \def\vref@space{}%
- \begingroup%
- \cref@patchreftexts{#5}%
- \@@setvpageref{#1}[#2]{#3}%
- \endgroup}%
- \def\@@setvpageref#1[#2]#3{\cref@old@@vpageref{#1}[#2]{#3}}%
- \def\@setvpagerefrange[#1]#2#3#4#5{%
- \cref@vpagerefconjunction{#5}%
- \let\vref@space\relax%
- \begingroup%
- \cref@patchreftexts{#5}%
- \@@setvpagerefrange[#1]{#2}{#3}%
- \endgroup}%
- \def\@@setvpagerefrange[#1]#2#3{\vpagerefrange[#1]{#2}{#3}}%
- \def\@setfullpageref#1#2#3{%
- \cref@vpagerefconjunction{#3}%
- \begingroup%
- \cref@patchreftexts{#3}%
- \@@setfullpageref{#1}%
- \endgroup}%
- \def\@@setfullpageref#1{\reftextfaraway{#1}}%
- \def\@setfullpagerefrange#1#2#3#4{%
- \cref@vpagerefconjunction{#4}%
- \begingroup%
- \cref@patchreftexts{#4}%
- \@@setfullpagerefrange{#1}{#2}%
- \endgroup}%
- \def\@@setfullpagerefrange#1#2{\reftextpagerange{#1}{#2}}%
\def\cref@old@@vpageref#1[#2]#3{%
\leavevmode%\unskip <<<
- \global\advance\c@vrcnt\@ne%
+ \global\advance\c@vrcnt\@ne\relax%
\vref@pagenum\@tempa{\the\c@vrcnt @vr}%
\vref@pagenum\@tempb{\the\c@vrcnt @xvr}%
%\vref@label{\the\c@vrcnt @xvr}% <<<
@@ -2320,7 +2333,7 @@
{%
\is@pos@number\@tempa%
{\@tempcnta\@tempa%
- \advance\@tempcnta\@ne%
+ \advance\@tempcnta\@ne\relax%
}%
{\@tempcnta\maxdimen}%
\ifnum \thevpagerefnum =\@tempcnta%
@@ -2334,7 +2347,7 @@
\reftextafter%
\fi%
\else%
- \advance\@tempcnta-2%
+ \advance\@tempcnta-2\relax%
\ifnum \thevpagerefnum =\@tempcnta%
\ifodd\@tempcnta%
\reftextbefore%
@@ -2355,6 +2368,71 @@
\vref@label{\the\c@vrcnt @xvr}% <<<
\vref@label{\the\c@vrcnt @vr}%
}%
+ \def\cref@@vpageref#1[#2]#3{%
+ \begingroup%
+ \def\cref@@vpageref@arg{#1}%
+ \@cref{vpageref}{#3}%
+ \endgroup}%
+ \def\cref@vref#1#2{%
+ \leavevmode%
+ \begingroup%
+ \def\reftextcurrent{}%
+ \@cref{#1}{#2}\@setcref@space%
+ \cref@@vpageref{\reftextcurrent}[]{#2}%
+ \endgroup}%
+ \def\cref@vrefrange#1#2#3{%
+ \@@setcrefrange{#1}{#2}{#3}{}\@setcref@space\vpagerefrange{#2}{#3}}%
+ \def\cref@fullref#1#2{%
+ \@cref{#1}{#2}\@setcref@space\@cref{fullpageref}{#2}}%
+ \def\cref@vpagerefconjunction#1{%
+ \def\@tempa{#1}%
+ \def\@tempb{@second}%
+ \ifx\@tempa\@tempb\relax%
+ \@setcref@pairconjunction%
+ \else%
+ \def\@tempb{@middle}%
+ \ifx\@tempa\@tempb\relax%
+ \@setcref@middleconjunction%
+ \else%
+ \def\@tempb{@last}%
+ \ifx\@tempa\@tempb\relax%
+ \@setcref@lastconjunction%
+ \fi%
+ \fi%
+ \fi}%
+ \def\@setcref@space{ }%
+ \def\@setvpageref#1#2{%
+ \cref@vpagerefconjunction{#2}%
+ \def\vref@space{}%
+ \begingroup%
+ \cref@patchreftexts{#2}%
+ \expandafter\@@@setvpageref\expandafter%
+ {\cref@@vpageref@arg}[\vref@space]{#1}%
+ \endgroup}%
+ \let\@@@setvpageref\cref@old@@vpageref%
+ \def\@setvpagerefrange#1#2#3{%
+ \cref@vpagerefconjunction{#3}%
+ \let\vref@space\relax%
+ \begingroup%
+ \cref@patchreftexts{#3}%
+ \expandafter\@@@setvpagerefrange\expandafter%
+ [\cref@@vpageref@arg]{#1}{#2}%
+ \endgroup}%
+ \let\@@@setvpagerefrange\vpagerefrange
+ \def\@setfullpageref#1#2{%
+ \cref@vpagerefconjunction{#2}%
+ \begingroup%
+ \cref@patchreftexts{#2}%
+ \@@@setfullpageref{#1}%
+ \endgroup}%
+ \let\@@@setfullpageref\reftextfaraway%
+ \def\@setfullpagerefrange#1#2#3{%
+ \cref@vpagerefconjunction{#3}%
+ \begingroup%
+ \cref@patchreftexts{#3}%
+ \@@@setfullpagerefrange{#1}{#2}%
+ \endgroup}%
+ \let\@@@setfullpagerefrange\reftextpagerange%
\let\creftextcurrent\reftextcurrent%
\let\creftextfaceafter\reftextfaceafter%
\let\creftextfacebefore\reftextfacebefore%
@@ -2374,12 +2452,12 @@
\def\@tempc{}%
\expandafter\ifx\csname #1\endcsname\@tempc\relax%
\expandafter\def\csname #1\endcsname{\unskip}%
- %{\advance\count@group -1\reftextcurrent@orig}%
+ %{\advance\count@group -1\relax\reftextcurrent@orig}%
\else%
\long\def\@tempc{}%
\expandafter\ifx\csname #1\endcsname\@tempc\relax%
\expandafter\def\csname #1\endcsname{\unskip}%
- %{\advance\count@group -1\reftextcurrent@orig}%
+ %{\advance\count@group -1\relax\reftextcurrent@orig}%
\fi%
\fi%
\else%
@@ -2415,7 +2493,7 @@
\def\@setcref@middleconjunction{\crefmiddleconjunction}%
\def\@setcref@lastconjunction{\creflastconjunction}%
\AtBeginDocument{%
- \def\@@vpageref#1[#2]#3{\cref@@vpageref{#1}[#2]{#3}}%
+ \let\@@vpageref\cref@@vpageref%
}%
\if@cref@hyperrefloaded\relax% hyperref loaded%
\DeclareRobustCommand{\vref}{%
@@ -2450,8 +2528,17 @@
\DeclareRobustCommand{\fullref}{\cref@fullref{cref}}%
\DeclareRobustCommand{\Fullref}{\cref@fullref{Cref}}%
\fi% end of test for hyperref
-}{}% end of \@ifpackageloaded{varioref}
+}{\let\if@cref@variorefloaded\iffalse}% end of \@ifpackageloaded{varioref}
+\AtBeginDocument{%
+ \if@cref@variorefloaded\relax\else%
+ \@ifpackageloaded{varioref}{%
+ \PackageError{cleveref}{cleveref must be loaded after varioref!}%
+ {Package load order is wrong: load cleveref *after* varioref.}
+ }{}%
+ \fi}
+\let\if@cref@amsmathloaded\iffalse%
\@ifpackageloaded{amsmath}{%
+ \let\if@cref@amsmathloaded\iftrue%
\AtBeginDocument{%
\let\cref@old@label@in@display\label@in@display%
\def\label@in@display{%
@@ -2473,7 +2560,7 @@
\let\math@cr@@@\math@cr@@@align@measure%
\everycr{\noalign{\global\tag@false%
\global\let\raise@tag\@empty \global\column@\z@}}%
- \let\label\@gobble@optarg% <<< cleveref modification
+ \let\label\cref@gobble@optarg% <<< cleveref modification
\global\row@\z@%
\tabskip\z@%
\halign{\span\align@preamble\crcr%
@@ -2485,7 +2572,7 @@
}%
\restorecounters@%
\ifodd\maxfields@%
- \global\advance\maxfields@\@ne%
+ \global\advance\maxfields@\@ne\relax%
\fi%
\ifnum\xatlevel@=\tw@%
\ifnum\maxfields@<\thr@@%
@@ -2496,7 +2583,7 @@
\unvbox\z@ \unpenalty \global\setbox\@ne\lastbox%
}%
\global\totwidth@\wd\@ne%
- \if@fleqn \global\advance\totwidth@\@mathmargin \fi%
+ \if@fleqn \global\advance\totwidth@\@mathmargin\relax\fi%
\global\let\maxcolumn@widths\@empty%
\begingroup%
\let\or\relax%
@@ -2509,7 +2596,7 @@
\repeat%
\endgroup%
\dimen@\displaywidth%
- \advance\dimen@-\totwidth@%
+ \advance\dimen@-\totwidth@\relax%
\ifcase\xatlevel@%
\global\alignsep@\z@%
\let\minalignsep\z@%
@@ -2520,43 +2607,43 @@
\else%
\@tempcnta\tw@%
\global\eqnshift@\dimen@%
- \global\divide\eqnshift@\@tempcnta%
+ \global\divide\eqnshift@\@tempcnta\relax%
\fi%
\or%
\@tempcntb\maxfields@%
- \divide\@tempcntb\tw@%
+ \divide\@tempcntb\tw@\relax%
\@tempcnta\@tempcntb%
- \advance\@tempcntb\m@ne%
+ \advance\@tempcntb\m@ne\relax%
\if@fleqn%
\global\eqnshift@\@mathmargin%
\global\alignsep@\dimen@%
- \global\divide\alignsep@\@tempcnta%
+ \global\divide\alignsep@\@tempcnta\relax%
\else%
- \global\advance\@tempcnta\@ne%
+ \global\advance\@tempcnta\@ne\relax%
\global\eqnshift@\dimen@%
- \global\divide\eqnshift@\@tempcnta%
+ \global\divide\eqnshift@\@tempcnta\relax%
\global\alignsep@\eqnshift@%
\fi%
\or%
\@tempcntb\maxfields@%
- \divide\@tempcntb\tw@%
- \global\advance\@tempcntb\m@ne%
- \global\@tempcnta\@tempcntb%
+ \divide\@tempcntb\tw@\relax%
+ \global\advance\@tempcntb\m@ne\relax%
+ \global\@tempcnta\@tempcntb\relax%
\global\eqnshift@\z@%
\global\alignsep@\dimen@%
\if@fleqn%
\global\advance\alignsep@\@mathmargin\relax%
\fi%
- \global\divide\alignsep@\@tempcntb%
+ \global\divide\alignsep@\@tempcntb\relax%
\fi%
\ifdim\alignsep@<\minalignsep\relax%
\global\alignsep@\minalignsep\relax%
\ifdim\eqnshift@>\z@%
\if@fleqn\else%
\global\eqnshift@\displaywidth%
- \global\advance\eqnshift@-\totwidth@%
- \global\advance\eqnshift@-\@tempcntb\alignsep@%
- \global\divide\eqnshift@\tw@%
+ \global\advance\eqnshift@-\totwidth@\relax%
+ \global\advance\eqnshift@-\@tempcntb\alignsep@\relax%
+ \global\divide\eqnshift@\tw@\relax%
\fi%
\fi%
\fi%
@@ -2565,19 +2652,19 @@
\fi%
\calc@shift@align%
\global\tagshift@\totwidth@%
- \global\advance\tagshift@\@tempcntb\alignsep@%
+ \global\advance\tagshift@\@tempcntb\alignsep@\relax%
\if@fleqn%
\ifnum\xatlevel@=\tw@%
\global\advance\tagshift@-\@mathmargin\relax%
\fi%
\else%
- \global\advance\tagshift@\eqnshift@%
+ \global\advance\tagshift@\eqnshift@\relax%
\fi%
\iftagsleft@ \else%
- \global\advance\tagshift@-\displaywidth%
+ \global\advance\tagshift@-\displaywidth\relax%
\fi%
\dimen@\minalignsep\relax%
- \global\advance\totwidth@\@tempcntb\dimen@%
+ \global\advance\totwidth@\@tempcntb\dimen@\relax%
\ifdim\totwidth@>\displaywidth%
\global\let\displaywidth@\totwidth@%
\else%
@@ -2609,7 +2696,7 @@
}%
\restorecounters@%
\if@fleqn%
- \global\advance\totwidth@\@mathmargin%
+ \global\advance\totwidth@\@mathmargin\relax%
\fi%
\iftagsleft@%
\ifdim\totwidth@>\displaywidth%
@@ -2622,17 +2709,17 @@
}%
\def\multline@#1{%
\Let@%
- \@display@init{\global\advance\row@\@ne \global\dspbrk@lvl\m@ne}%
+ \@display@init{\global\advance\row@\@ne\relax\global\dspbrk@lvl\m@ne}%
\chardef\dspbrk@context\z@%
\restore@math@cr%
\let\tag\tag@in@align%
\global\tag@false \global\let\raise@tag\@empty%
\mmeasure@{#1}%
- \let\tag\gobble@tag \let\label\@gobble@optarg% <<< cleveref modification
+ \let\tag\gobble@tag \let\label\cref@gobble@optarg% <<< cleveref modification
\tabskip \if@fleqn \@mathmargin \else \z@skip \fi%
\totwidth@\displaywidth%
\if@fleqn%
- \advance\totwidth@-\@mathmargin%
+ \advance\totwidth@-\@mathmargin\relax%
\fi%
\halign\bgroup%
\hbox to\totwidth@{%
@@ -2669,7 +2756,7 @@
\multline@indent%
\else%
\setbox\z@\hbox{\make@display@tag}%
- \dimen@\@mathmargin \advance\dimen@-\wd\z@%
+ \dimen@\@mathmargin \advance\dimen@-\wd\z@\relax%
\ifdim\dimen@<\multlinetaggap%
\dimen@\multlinetaggap%
\fi%
@@ -2725,11 +2812,11 @@
}%
\global\tagwidth@\wdz@%
\dimen@\totwidth@%
- \advance\dimen@\tagwidth@%
- \advance\dimen@\multlinetaggap%
+ \advance\dimen@\tagwidth@\relax%
+ \advance\dimen@\multlinetaggap\relax%
\iftagsleft@\else%
\if@fleqn%
- \advance\dimen@\@mathmargin%
+ \advance\dimen@\@mathmargin\relax%
\fi%
\fi%
\ifdim\dimen@>\displaywidth%
@@ -2755,10 +2842,10 @@
\let\cref@old@endsubequations\endsubequations%
\cref@resetby{equation}{\cref@result}%
\ifx\cref@result\relax\else%
- \@addtoreset{parentequation}{\cref@result}%
+ \cref@addtoreset{parentequation}{\cref@result}%
\fi%
\renewenvironment{subequations}{%
- \@addtoreset{equation}{parentequation}%
+ \cref@addtoreset{equation}{parentequation}%
\let\cref@orig@equation@alias\cref@equation@alias%
\@ifundefined{cref@subequation@alias}%
{\crefalias{equation}{subequation}}%
@@ -2791,6 +2878,13 @@
\toks@\@xp{\p@equation{#1}}%
\edef\cref@currentlabel{[equation][2147483647][]\the\toks@}}}%
}{}% end of \@ifpackageloaded{amsmath}
+\AtBeginDocument{%
+ \if@cref@amsmathloaded\else%
+ \@ifpackageloaded{amsmath}{%
+ \PackageError{cleveref}{cleveref must be loaded after amsmath!}%
+ {Package load order is wrong: load cleveref *after* amsmath.}
+ }{}%
+ \fi}
\@ifpackageloaded{amsthm}{%
\PackageInfo{cleveref}{`amsthm' support loaded}%
\let\cref@thmnoarg\@thm%
@@ -2875,12 +2969,12 @@
\refstepcounter[#1]{#2}% <<< cleveref modification
\theorem@prework%
\thm@topsepadd \theorempostskipamount%
- \ifvmode \advance\thm@topsepadd\partopsep\fi%
+ \ifvmode \advance\thm@topsepadd\partopsep\relax\fi%
\trivlist%
\@topsep \theorempreskipamount%
\@topsepadd \thm@topsepadd%
- \advance\linewidth -\theorem@indent%
- \advance\@totalleftmargin \theorem@indent%
+ \advance\linewidth -\theorem@indent\relax%
+ \advance\@totalleftmargin \theorem@indent\relax%
\parshape \@ne \@totalleftmargin \linewidth%
\@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}%]
}%
@@ -2893,18 +2987,31 @@
\addtocounter{equation}{-1}%
\cref@orig@@IEEEeqnarray[#1]{#2}}%
\let\cref@orig@IEEEeqnarrayXCR\@IEEEeqnarrayXCR%
- \def\@IEEEeqnarrayXCR[#1]{%
- \if@eqnsw%
- \if@IEEEissubequation%
- %\addtocounter{equation}{1}%
- \refstepcounter{IEEEsubequation}%
- \addtocounter{IEEEsubequation}{-1}%
- \else%
- \refstepcounter{equation}%
- \addtocounter{equation}{-1}%
+ \@ifundefined{c@IEEEsubequation}{%
+ \def\@IEEEeqnarrayXCR[#1]{%
+ \if@eqnsw%
+ \if@IEEEissubequation%
+ \refstepcounter{IEEEsubequation}%
+ \addtocounter{IEEEsubequation}{-1}%
+ \else%
+ \refstepcounter{equation}%
+ \addtocounter{equation}{-1}%
+ \fi%
\fi%
- \fi%
- \cref@orig@IEEEeqnarrayXCR[#1]}%
+ \cref@orig@IEEEeqnarrayXCR[#1]}%
+ }{
+ \def\@IEEEeqnarrayXCR[#1]{%
+ \if@eqnsw%
+ \ifnum\c@IEEEsubequation>0\relax%
+ \refstepcounter{IEEEsubequation}%
+ \addtocounter{IEEEsubequation}{-1}%
+ \else%
+ \refstepcounter{equation}%
+ \addtocounter{equation}{-1}%
+ \fi%
+ \fi%
+ \cref@orig@IEEEeqnarrayXCR[#1]}%
+ }% end of \@ifundefined{c@IEEEsubequation}
\let\cref@orig@IEEEyessubnumber\IEEEyessubnumber%
\def\IEEEyessubnumber{%
\if@IEEEeqnarrayISinner%
@@ -2914,8 +3021,8 @@
\fi%
\fi%
\cref@orig@IEEEyessubnumber}%
- \@addtoreset{IEEEsubequation}{equation}%
- \crefalias{IEEEsubequation}{equation}%
+ \cref@addtoreset{IEEEsubequation}{subequation}%
+ \crefalias{IEEEsubequation}{subequation}%
}{}% end of \@ifpackageloaded{IEEEtrantools}
\@ifpackageloaded{breqn}{%
\PackageInfo{cleveref}{`breqn' support loaded}%
@@ -2924,7 +3031,7 @@
\cref@old@eq@setnumber%
\cref@constructprefix{equation}{\cref@result}%
\protected@xdef\cref@currentlabel{%
- [equation][\arabic{equation}][\cref@result]\p@equation\theequation}}%
+ [equation][\arabic{equation}][\cref@result]\p@equation\eq@number}}%
}{}% end of \@ifpackageloaded{breqn}
\@ifpackageloaded{algorithmicx}{%
\PackageInfo{cleveref}{`algorithmicx' support loaded}%
@@ -3007,7 +3114,7 @@
\cref@old@newaliascnt{#1}{#2}%
\cref@resetby{#2}{\cref@result}%
\ifx\cref@result\relax\else%
- \@addtoreset{#1}{\cref@result}%
+ \cref@addtoreset{#1}{\cref@result}%
\fi}%
}{}% end of \@ifpackageloaded{aliascnt}
\DeclareOption{poorman}{%
@@ -3291,19 +3398,19 @@
\@tempa#1\@nil}%
\def\@crefrangenostar#1#2#3{%
\gdef\cref@poorman@text{}%
- \@setcrefrange{#2}{#3}{#1}{}%
+ \@@setcrefrange{#2}{#3}{#1}{}%
\def\@tempa##1##2\@nil{%
\if##1c%
\cref@writescript{}{%
\string\crefrange\string{#2\string}\string{#3\string}}%
\else%
\cref@writescript{}{%
- \string\Crefrange\string{#2\string}\string{#3\string}}%
+ \strinsg\Crefrange\string{#2\string}\string{#3\string}}%
\fi}%
\@tempa#1\@nil}%
\def\@crefrangestar#1#2#3{%
\gdef\cref@poorman@text{}%
- \@crefstarredtrue\@setcrefrange{#2}{#3}{#1}{}\@crefstarredfalse%
+ \@crefstarredtrue\@@setcrefrange{#2}{#3}{#1}{}\@crefstarredfalse%
\def\@tempa##1##2\@nil{%
\if##1c%
\cref@writescript{}{%
@@ -3313,31 +3420,9 @@
\string\Crefrange*\string{#2\string}\string{#3\string}}%
\fi}%
\@tempa#1\@nil}%
- \def\@cpagerefnostar#1#2{%
- \gdef\cref@poorman@text{}%
- \@cpageref{#1}{#2}{\@setcpageref}{\@setcpagerefrange}%
- \def\@tempa##1##2\@nil{%
- \if##1c%
- \cref@writescript{}{\string\cpageref\string{#2\string}}%
- \else%
- \cref@writescript{}{\string\Cpageref\string{#2\string}}%
- \fi}%
- \@tempa#1\@nil}%
- \def\@cpagerefstar#1#2{%
- \gdef\cref@poorman@text{}%
- \@crefstarredtrue%
- \@cpageref{#1}{#2}{\@setcpageref}{\@setcpagerefrange}%
- \@crefstarredfalse%
- \def\@tempa##1##2\@nil{%
- \if##1c%
- \cref@writescript{}{\string\cpageref*\string{#2\string}}%
- \else%
- \cref@writescript{}{\string\Cpageref*\string{#2\string}}%
- \fi}%
- \@tempa#1\@nil}%
\def\@cpagerefrangenostar#1#2#3{%
\gdef\cref@poorman@text{}%
- \@setcpagerefrange{#2}{#3}{#1}{}%
+ \@@setcpagerefrange{#2}{#3}{#1}{}%
\def\@tempa##1##2\@nil{%
\if##1c%
\cref@writescript{}{%
@@ -3350,7 +3435,7 @@
\def\@cpagerefrangestar#1#2#3{%
\gdef\cref@poorman@text{}%
\@crefstarredtrue%
- \@setcpagerefrange{#2}{#3}{#1}{}%
+ \@@setcpagerefrange{#2}{#3}{#1}{}%
\@crefstarredfalse%
\def\@tempa##1##2\@nil{%
\if##1c%
@@ -3373,12 +3458,12 @@
\cref@writescript{}{\string\labelcref*\string{#1\string}}}%
\def\@labelcpagerefnostar#1{%
\gdef\cref@poorman@text{}%
- \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}%
+ \@cref{labelcpageref}{#1}%
\cref@writescript{}{\string\labelcpageref\string{#1\string}}}%
\def\@labelcpagerefstar#1{%
\gdef\cref@poorman@text{}%
\@crefstarredtrue%
- \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}%
+ \@cref{labelcpageref}{#1}%
\@crefstarredfalse%
\cref@writescript{}{\string\labelcpageref*\string{#1\string}}}%
\else% hyperref not loaded
@@ -3392,30 +3477,30 @@
\cref@writescript{}{\string\Cref\string{#1\string}}}%
\DeclareRobustCommand{\crefrange}[2]{%
\gdef\cref@poorman@text{}%
- \@setcrefrange{#1}{#2}{cref}{}%
+ \@@setcrefrange{#1}{#2}{cref}{}%
\cref@writescript{}{%
\string\crefrange\string{#1\string}\string{#2\string}}}%
\DeclareRobustCommand{\Crefrange}[2]{%
\gdef\cref@poorman@text{}%
- \@setcrefrange{#1}{#2}{Cref}{}%
+ \@@setcrefrange{#1}{#2}{Cref}{}%
\cref@writescript{}{%
\string\Crefrange\string{#1\string}\string{#2\string}}}%
\DeclareRobustCommand{\cpageref}[1]{%
\gdef\cref@poorman@text{}%
- \@cpageref{cref}{#1}{\@setcpageref}{\@setcpagerefrange}%
+ \@cref{cpageref}{#1}%
\cref@writescript{}{\string\cpageref\string{#1\string}}}%
\DeclareRobustCommand{\Cpageref}[1]{%
\gdef\cref@poorman@text{}%
- \@cpageref{Cref}{#1}{\@setcpageref}{\@setcpagerefrange}%
+ \@cref{Cpageref}{#1}%
\cref@writescript{}{\string\Cpageref\string{#1\string}}}%
\DeclareRobustCommand{\cpagerefrange}[2]{%
\gdef\cref@poorman@text{}%
- \@setcpagerefrange{#1}{#2}{cref}{}%
+ \@@setcpagerefrange{#1}{#2}{cref}{}%
\cref@writescript{}{%
\string\cpagerefrange\string{#1\string}\string{#2\string}}}%
\DeclareRobustCommand{\Cpagerefrange}[2]{%
\gdef\cref@poorman@text{}%
- \@setcpagerefrange{#1}{#2}{Cref}{}%
+ \@@setcpagerefrange{#1}{#2}{Cref}{}%
\cref@writescript{}{%
\string\Cpagerefrange\string{#1\string}\string{#2\string}}}%
\DeclareRobustCommand{\labelcref}[1]{%
@@ -3424,7 +3509,7 @@
\cref@writescript{}{\string\labelcref\string{#1\string}}}%
\DeclareRobustCommand{\labelcpageref}[1]{%
\gdef\cref@poorman@text{}%
- \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}%
+ \@cref{labelcpageref}{#1}%
\cref@writescript{}{\string\labelcpageref\string{#1\string}}}%
\fi% end of test for hyperref
\DeclareRobustCommand{\namecref}[1]{%
@@ -3463,13 +3548,13 @@
\creflastgroupconjunction%
\expandafter\g@addto@macro\expandafter\cref@poorman@text%
\expandafter{\creflastgroupconjunction}}%
- \let\old@@setcref\@@setcref%
- \let\old@@setcrefrange\@@setcrefrange%
- \let\old@@setcpageref\@@setcpageref%
- \let\old@@setcpagerefrange\@@setcpagerefrange%
+ \let\old@@@setcref\@@@setcref%
+ \let\old@@@setcrefrange\@@@setcrefrange%
+ \let\old@@@setcpageref\@@@setcpageref%
+ \let\old@@@setcpagerefrange\@@@setcpagerefrange%
\if@cref@hyperrefloaded\relax% hyperref loaded
- \def\@@setcref#1#2{%
- \old@@setcref{#1}{#2}%
+ \def\@@@setcref#1#2{%
+ \old@@@setcref{#1}{#2}%
\if@crefstarred%
\expandafter\g@addto@macro\expandafter\cref@poorman@text%
\expandafter{#1{\ref*{#2}}{}{}}%
@@ -3477,8 +3562,8 @@
\expandafter\g@addto@macro\expandafter\cref@poorman@text%
\expandafter{#1{\ref{#2}}{}{}}%
\fi}%
- \def\@@setcrefrange#1#2#3{%
- \old@@setcrefrange{#1}{#2}{#3}%
+ \def\@@@setcrefrange#1#2#3{%
+ \old@@@setcrefrange{#1}{#2}{#3}%
\if@crefstarred%
\expandafter\g@addto@macro\expandafter\cref@poorman@text%
\expandafter{#1{\ref*{#2}}{\ref*{#3}}{}{}{}{}}%
@@ -3486,8 +3571,8 @@
\expandafter\g@addto@macro\expandafter\cref@poorman@text%
\expandafter{#1{\ref{#2}}{\ref{#3}}{}{}{}{}}%
\fi}%
- \def\@@setcpageref#1#2{%
- \old@@setcpageref{#1}{#2}%
+ \def\@@@setcpageref#1#2{%
+ \old@@@setcpageref{#1}{#2}%
\if@crefstarred%
\expandafter\g@addto@macro\expandafter\cref@poorman@text%
\expandafter{#1{\pageref*{#2}}{}{}}%
@@ -3495,8 +3580,8 @@
\expandafter\g@addto@macro\expandafter\cref@poorman@text%
\expandafter{#1{\pageref{#2}}{}{}}%
\fi}%
- \def\@@setcpagerefrange#1#2#3{%
- \old@@setcpagerefrange{#1}{#2}{#3}%
+ \def\@@@setcpagerefrange#1#2#3{%
+ \old@@@setcpagerefrange{#1}{#2}{#3}%
\if@crefstarred%
\expandafter\g@addto@macro\expandafter\cref@poorman@text%
\expandafter{#1{\pageref*{#2}}{\pageref*{#3}}{}{}{}{}}%
@@ -3505,30 +3590,30 @@
\expandafter{#1{\pageref{#2}}{\pageref{#3}}{}{}{}{}}%
\fi}%
\else% hyperref not loaded
- \def\@@setcref#1#2{%
- \old@@setcref{#1}{#2}%
+ \def\@@@setcref#1#2{%
+ \old@@@setcref{#1}{#2}%
\expandafter\g@addto@macro\expandafter{%
\expandafter\cref@poorman@text\expandafter}%
\expandafter{#1{\ref{#2}}{}{}}}%
- \def\@@setcrefrange#1#2#3{%
- \old@@setcrefrange{#1}{#2}{#3}%
+ \def\@@@setcrefrange#1#2#3{%
+ \old@@@setcrefrange{#1}{#2}{#3}%
\expandafter\g@addto@macro%
\expandafter{\expandafter\cref@poorman@text\expandafter}%
\expandafter{#1{\ref{#2}}{\ref{#3}}{}{}{}{}}}%
- \def\@@setcpageref#1#2{%
- \old@@setcpageref{#1}{#2}%
+ \def\@@@setcpageref#1#2{%
+ \old@@@setcpageref{#1}{#2}%
\expandafter\g@addto@macro\expandafter{%
\expandafter\cref@poorman@text\expandafter}%
\expandafter{#1{\pageref{#2}}{}{}}}%
- \def\@@setcpagerefrange#1#2#3{%
- \old@@setcpagerefrange{#1}{#2}{#3}%
+ \def\@@@setcpagerefrange#1#2#3{%
+ \old@@@setcpagerefrange{#1}{#2}{#3}%
\expandafter\g@addto@macro%
\expandafter{\expandafter\cref@poorman@text\expandafter}%
\expandafter{#1{\pageref{#2}}{\pageref{#3}}{}{}{}{}}}%
\fi% end of hyperref test
- \let\old@@setnamecref\@@setnamecref%
- \def\@@setnamecref#1#2{%
- \old@@setnamecref{#1}{#2}%
+ \let\old@@@setnamecref\@@@setnamecref%
+ \def\@@@setnamecref#1#2{%
+ \old@@@setnamecref{#1}{#2}%
\expandafter\def\expandafter\@tempa\expandafter{#1}%
\def\@tempb{#2}%
\expandafter\expandafter\expandafter\g@addto@macro%
@@ -3603,16 +3688,16 @@
\fi%
\fi}%
\@tempa#1\@nil}%
- \def\@@setvpageref#1[#2]#3{%
+ \def\@@@setvpageref#1[#2]#3{%
\cref@old@@vpageref{#1}[#2]{#3}%
\g@addto@macro\cref@poorman@text{\vpageref{#3}}}%
- \def\@@setvpagerefrange[#1]#2#3{%
+ \def\@@@setvpagerefrange[#1]#2#3{%
\vpagerefrange[#1]{#2}{#3}%
\g@addto@macro\cref@poorman@text{\vpagerefrange{#2}{#3}}}%
- \def\@@setfullpageref#1{%
+ \def\@@@setfullpageref#1{%
\reftextfaraway{#1}%
\g@addto@macro\cref@poorman@text{\reftextfaraway{#1}}}%
- \def\@@setfullpagerefrange#1#2{%
+ \def\@@@setfullpagerefrange#1#2{%
\reftextpagerange{#1}{#2}%
\g@addto@macro\cref@poorman@text{\reftextpagerange{#1}{#2}}}%
\def\@setcref@space{ % space here is deliberate
@@ -7163,7 +7248,7 @@
\crefname{subfigure}{Figur}{Figur}%
\fi%
\crefname{page}{Sida}{Sida}%
- \crefname{table}{Tablell}{Tabell}%
+ \crefname{table}{Tabell}{Tabell}%
\crefname{subtable}{Tabell}{Tabell}%
\crefname{part}{Del}{Del}%
\crefname{chapter}{Kapitel}{Kapitel}%
@@ -7205,7 +7290,7 @@
\crefname{subfigure}{figur}{figur}%
\crefname{page}{sida}{sida}%
\fi%
- \crefname{table}{tablell}{tabell}%
+ \crefname{table}{tabell}{tabell}%
\crefname{subtable}{tabell}{tabell}%
\crefname{part}{del}{del}%
\crefname{chapter}{kapitel}{kapitel}%
@@ -7458,6 +7543,207 @@
\crefname{listing}{listagem}{listagens}%
\crefname{line}{linha}{linhas}%
\fi}% end \cref@addlangagedefs
+\DeclareOption{catalan}{%
+ \AtBeginDocument{%
+ \def\crefrangeconjunction@preamble{ a\nobreakspace}%
+ \def\crefrangepreconjunction@preamble{}%
+ \def\crefrangepostconjunction@preamble{}%
+ \def\crefpairconjunction@preamble{ i\nobreakspace}%
+ \def\crefmiddleconjunction@preamble{, }%
+ \def\creflastconjunction@preamble{ i\nobreakspace}%
+ \def\crefpairgroupconjunction@preamble{ i\nobreakspace}%
+ \def\crefmiddlegroupconjunction@preamble{, }%
+ \def\creflastgroupconjunction@preamble{ i\nobreakspace}%
+ %
+ \Crefname@preamble{equation}{Equaci\'o}{Equacions}%
+ \Crefname@preamble{figure}{Gr\`afic}{Gr\`afics}%
+ \Crefname@preamble{table}{Taula}{Taules}%
+ \Crefname@preamble{page}{P\`agina}{P\`agines}%
+ \Crefname@preamble{part}{Part}{Parts}%
+ \Crefname@preamble{chapter}{Cap\'itol}{Cap\'itols}%
+ \Crefname@preamble{section}{Secci\'o}{Seccions}%
+ \Crefname@preamble{appendix}{Ap\`endix}{Ap\`endixs}%
+ \Crefname@preamble{enumi}{Punt}{Punts}%
+ \Crefname@preamble{footnote}{Nota}{Notes}%
+ \Crefname@preamble{theorem}{Teorema}{Teoremes}%
+ \Crefname@preamble{lemma}{Lema}{Lemes}%
+ \Crefname@preamble{corollary}{Coro\lgem ari}{Coro\lgem aris}%
+ \Crefname@preamble{proposition}{Proposici\'o}{Proposicions}%
+ \Crefname@preamble{definition}{Definici\'o}{Definicions}%
+ \Crefname@preamble{result}{Resultat}{Resultats}%
+ \Crefname@preamble{example}{Exemple}{Exemples}%
+ \Crefname@preamble{remark}{Observaci\'o}{Observacions}%
+ \Crefname@preamble{note}{Nota}{Notes}%
+ \Crefname@preamble{algorithm}{Algorisme}{Algorismes}%
+ \Crefname@preamble{listing}{Llistat}{Llistats}%
+ \Crefname@preamble{line}{L\'inia}{L\'inies}%
+ %
+ \if@cref@capitalise% capitalise set
+ \crefname@preamble{equation}{Equaci\'o}{Equacions}%
+ \crefname@preamble{figure}{Gr\`afic}{Gr\`afics}%
+ \crefname@preamble{table}{Taula}{Taules}%
+ \crefname@preamble{page}{P\`agina}{P\`agines}%
+ \crefname@preamble{part}{Part}{Parts}%
+ \crefname@preamble{chapter}{Cap\'itol}{Cap\'itols}%
+ \crefname@preamble{section}{Secci\'o}{Seccions}%
+ \crefname@preamble{appendix}{Ap\`endix}{Ap\`endixs}%
+ \crefname@preamble{enumi}{Punt}{Punts}%
+ \crefname@preamble{footnote}{Nota}{Notes}%
+ \crefname@preamble{theorem}{Teorema}{Teoremes}%
+ \crefname@preamble{lemma}{Lema}{Lemes}%
+ \crefname@preamble{corollary}{Coro\lgem ari}{Coro\lgem aris}%
+ \crefname@preamble{proposition}{Proposici\'o}{Proposicions}%
+ \crefname@preamble{definition}{Definici\'o}{Definicions}%
+ \crefname@preamble{result}{Resultat}{Resultats}%
+ \crefname@preamble{example}{Exemple}{Exemples}%
+ \crefname@preamble{remark}{Observaci\'o}{Observacions}%
+ \crefname@preamble{note}{Nota}{Notes}%
+ \crefname@preamble{algorithm}{Algorisme}{Algorismes}%
+ \crefname@preamble{listing}{Llistat}{Llistats}%
+ \crefname@preamble{line}{L\'inia}{L\'inies}%
+ %
+ \else% capitalise unset
+ \crefname@preamble{equation}{equaci\'o}{equacions}%
+ \crefname@preamble{figure}{gr\`afic}{gr\`afics}%
+ \crefname@preamble{table}{taula}{taules}%
+ \crefname@preamble{page}{p\`agina}{p\`agines}%
+ \crefname@preamble{part}{part}{parts}%
+ \crefname@preamble{chapter}{cap\'itol}{cap\'itols}%
+ \crefname@preamble{section}{secci\'o}{seccions}%
+ \crefname@preamble{appendix}{ap\`endix}{ap\`endixs}%
+ \crefname@preamble{enumi}{punt}{punts}%
+ \crefname@preamble{footnote}{nota}{notes}%
+ \crefname@preamble{theorem}{teorema}{teoremes}%
+ \crefname@preamble{lemma}{lema}{lemes}%
+ \crefname@preamble{corollary}{coro\lgem ari}{coro\lgem aris}%
+ \crefname@preamble{proposition}{proposici\'o}{proposicions}%
+ \crefname@preamble{definition}{definici\'o}{definicions}%
+ \crefname@preamble{result}{resultat}{resultats}%
+ \crefname@preamble{example}{exemple}{exemples}%
+ \crefname@preamble{remark}{observaci\'o}{observacions}%
+ \crefname@preamble{note}{nota}{notes}%
+ \crefname@preamble{algorithm}{algorisme}{algorismes}%
+ \crefname@preamble{listing}{llistat}{llistats}%
+ \crefname@preamble{line}{l\'inia}{l\'inies}%
+ \fi%
+ \def\cref@language{catalan}%
+ }}% end \AtBeginDocument and \DeclareOption
+\cref@addlanguagedefs{catalan}{%
+ \PackageInfo{cleveref}{loaded `catalan language definitions}%
+ \renewcommand{\crefrangeconjunction}{ a\nobreakspace}%
+ \renewcommand{\crefrangepreconjunction}{}%
+ \renewcommand{\crefrangepostconjunction}{}%
+ \renewcommand{\crefpairconjunction}{ i\nobreakspace}%
+ \renewcommand{\crefmiddleconjunction}{, }%
+ \renewcommand{\creflastconjunction}{ i\nobreakspace}%
+ \renewcommand{\crefpairgroupconjunction}{ i\nobreakspace}%
+ \renewcommand{\crefmiddlegroupconjunction}{, }%
+ \renewcommand{\creflastgroupconjunction}{ i\nobreakspace}%
+ %
+ \Crefname{equation}{Equaci\'o}{Equacions}%
+ \Crefname{figure}{Gr\`afic}{Gr\`afics}%
+ \Crefname{subfigure}{Gr\`afic}{Gr\`afics}%
+ \Crefname{table}{Taula}{Taules}%
+ \Crefname{subtable}{Taula}{Taules}%
+ \Crefname{page}{P\`agina}{P\`aginas}%
+ \Crefname{part}{Part}{Parts}%
+ \Crefname{chapter}{Cap\'itol}{Cap\'itols}%
+ \Crefname{section}{Secci\'o}{Seccions}%
+ \Crefname{subsection}{Secci\'o}{Seccions}%
+ \Crefname{subsubsection}{Secci\'o}{Seccions}%
+ \Crefname{appendix}{Ap\`endix}{Ap\`endixs}%
+ \Crefname{subappendix}{Ap\`endix}{Ap\`endixs}%
+ \Crefname{subsubappendix}{Ap\`endix}{Ap\`endixs}%
+ \Crefname{subsubsubappendix}{Ap\`endix}{Ap\`endixs}%
+ \Crefname{enumi}{Punt}{Punts}%
+ \Crefname{enumii}{Punt}{Punts}%
+ \Crefname{enumiii}{Punt}{Punts}%
+ \Crefname{enumiv}{Punt}{Punts}%
+ \Crefname{enumv}{Punt}{Punts}%
+ \Crefname{footnote}{Nota}{Notes}%
+ \Crefname{theorem}{Teorema}{Teoremes}%
+ \Crefname{lemma}{Lema}{Lemes}%
+ \Crefname{corollary}{Coro\lgem ari}{Coro\lgem aris}%
+ \Crefname{proposition}{Proposici\'o}{Proposicions}%
+ \Crefname{definition}{Definici\'o}{Definicions}%
+ \Crefname{result}{Resultat}{Resultats}%
+ \Crefname{example}{Exemple}{Exemples}%
+ \Crefname{remark}{Observaci\'o}{Observacions}%
+ \Crefname{note}{Nota}{Notes}%
+ \Crefname{algorithm}{Algorisme}{Algorismes}%
+ \Crefname{listing}{Llistat}{Llistats}%
+ \Crefname{line}{L\'inia}{L\'inies}%
+ %
+ \if@cref@capitalise% capitalise set
+ \crefname{equation}{Equaci\'o}{Equacions}%
+ \crefname{figure}{Gr\`afic}{Gr\`afics}%
+ \crefname{subfigure}{Gr\`afic}{Gr\`afics}%
+ \crefname{table}{Taula}{Taules}%
+ \crefname{subtable}{Taula}{Taules}%
+ \crefname{page}{P\`agina}{P\`aginas}%
+ \crefname{part}{Part}{Parts}%
+ \crefname{chapter}{Cap\'itol}{Cap\'itols}%
+ \crefname{section}{Secci\'o}{Seccions}%
+ \crefname{subsection}{Secci\'o}{Seccions}%
+ \crefname{subsubsection}{Secci\'o}{Seccions}%
+ \crefname{appendix}{Ap\`endix}{Ap\`endixs}%
+ \crefname{subappendix}{Ap\`endix}{Ap\`endixs}%
+ \crefname{subsubappendix}{Ap\`endix}{Ap\`endixs}%
+ \crefname{subsubsubappendix}{Ap\`endix}{Ap\`endixs}%
+ \crefname{enumi}{Punt}{Punts}%
+ \crefname{enumii}{Punt}{Punts}%
+ \crefname{enumiii}{Punt}{Punts}%
+ \crefname{enumiv}{Punt}{Punts}%
+ \crefname{enumv}{Punt}{Punts}%
+ \crefname{footnote}{Nota}{Notes}%
+ \crefname{theorem}{Teorema}{Teoremes}%
+ \crefname{lemma}{Lema}{Lemes}%
+ \crefname{corollary}{Coro\lgem ari}{Coro\lgem aris}%
+ \crefname{proposition}{Proposici\'o}{Proposicions}%
+ \crefname{definition}{Definici\'o}{Definicions}%
+ \crefname{result}{Resultat}{Resultats}%
+ \crefname{example}{Exemple}{Exemples}%
+ \crefname{remark}{Observaci\'o}{Observacions}%
+ \crefname{note}{Nota}{Notes}%
+ \crefname{algorithm}{Algorisme}{Algorismes}%
+ \crefname{listing}{Llistat}{Llistats}%
+ \crefname{line}{L\'inia}{L\'inies}%
+ %
+ \else% capitalise unset
+ \crefname{equation}{equaci\'o}{equacions}%
+ \crefname{figure}{gr\`afic}{gr\`afics}%
+ \crefname{subfigure}{gr\`afic}{gr\`afics}%
+ \crefname{table}{taula}{taules}%
+ \crefname{subtable}{taula}{taules}%
+ \crefname{page}{p\`agina}{p\`aginas}%
+ \crefname{part}{part}{parts}%
+ \crefname{chapter}{cap\'itol}{cap\'itols}%
+ \crefname{section}{secci\'o}{seccions}%
+ \crefname{subsection}{secci\'o}{seccions}%
+ \crefname{subsubsection}{secci\'o}{seccions}%
+ \crefname{appendix}{ap\`endix}{ap\`endixs}%
+ \crefname{subappendix}{ap\`endix}{ap\`endixs}%
+ \crefname{subsubappendix}{ap\`endix}{ap\`endixs}%
+ \crefname{subsubsubappendix}{ap\`endix}{ap\`endixs}%
+ \crefname{enumi}{punt}{punts}%
+ \crefname{enumii}{punt}{punts}%
+ \crefname{enumiii}{punt}{punts}%
+ \crefname{enumiv}{punt}{punts}%
+ \crefname{enumv}{punt}{punts}%
+ \crefname{footnote}{nota}{notes}%
+ \crefname{theorem}{teorema}{teoremes}%
+ \crefname{lemma}{lema}{lemes}%
+ \crefname{corollary}{coro\lgem ari}{coro\lgem aris}%
+ \crefname{proposition}{proposici\'o}{proposicions}%
+ \crefname{definition}{definici\'o}{definicions}%
+ \crefname{result}{resultat}{resultats}%
+ \crefname{example}{exemple}{exemples}%
+ \crefname{remark}{observaci\'o}{observacions}%
+ \crefname{note}{nota}{notes}%
+ \crefname{algorithm}{algorisme}{algorismes}%
+ \crefname{listing}{llistat}{llistats}%
+ \crefname{line}{l\'inia}{l\'inies}%
+ \fi}% end \cref@loadlanguagedefs
\edef\@curroptions{\@ptionlist{\@currname.\@currext}}%
\@expandtwoargs\in@{,capitalise,}{%
,\@classoptionslist,\@curroptions,}%
@@ -7481,7 +7767,6 @@
\else%
\creflabelformat{equation}{\textup{(#2#1#3)}}%
\fi%
-\@labelcrefdefinedefaultformats%
\@ifpackageloaded{polyglossia}%
{\ifcsdef{languagename}%
{\ExecuteOptions{\languagename}}%
@@ -7674,750 +7959,19 @@
\expandafter{\@tempa}}}{}%
\cref@stack@pop{\@tempstack}%
\cref@isstackfull{\@tempstack}}%
- \@ifundefined{cref@subsection@name}{%
- \let\cref@subsection@name\cref@section@name%
- \let\cref@subsection@name@plural\cref@section@name@plural}{}%
- \@ifundefined{Cref@subsection@name}{%
- \let\Cref@subsection@name\Cref@section@name%
- \let\Cref@subsection@name@plural\Cref@section@name@plural}{}%
- \@ifundefined{cref@subsection@format}{%
- \let\cref@subsection@format\cref@section@format}{}%
- \@ifundefined{Cref@subsection@format}{%
- \let\Cref@subsection@format\Cref@section@format}{}%
- \@ifundefined{crefrange@subsection@format}{%
- \let\crefrange@subsection@format%
- \crefrange@section@format}{}%
- \@ifundefined{Crefrange@subsection@format}{%
- \let\Crefrange@subsection@format%
- \Crefrange@section@format}{}%
- \@ifundefined{cref@subsection@format@first}{%
- \let\cref@subsection@format@first%
- \cref@section@format@first}{}%
- \@ifundefined{Cref@subsection@format@first}{%
- \let\Cref@subsection@format@first%
- \Cref@section@format@first}{}%
- \@ifundefined{cref@subsection@format@second}{%
- \let\cref@subsection@format@second%
- \cref@section@format@second}{}%
- \@ifundefined{Cref@subsection@format@second}{%
- \let\Cref@subsection@format@second%
- \Cref@section@format@second}{}%
- \@ifundefined{cref@subsection@format@middle}{%
- \let\cref@subsection@format@middle%
- \cref@section@format@middle}{}%
- \@ifundefined{Cref@subsection@format@middle}{%
- \let\Cref@subsection@format@middle%
- \Cref@section@format@middle}{}%
- \@ifundefined{cref@subsection@format@last}{%
- \let\cref@subsection@format@last%
- \cref@section@format@last}{}%
- \@ifundefined{Cref@subsection@format@last}{%
- \let\Cref@subsection@format@last%
- \Cref@section@format@last}{}%
- \@ifundefined{crefrange@subsection@format@first}{%
- \let\crefrange@subsection@format@first%
- \crefrange@section@format@first}{}%
- \@ifundefined{Crefrange@subsection@format@first}{%
- \let\Crefrange@subsection@format@first%
- \Crefrange@section@format@first}{}%
- \@ifundefined{crefrange@subsection@format@second}{%
- \let\crefrange@subsection@format@second%
- \crefrange@section@format@second}{}%
- \@ifundefined{Crefrange@subsection@format@second}{%
- \let\Crefrange@subsection@format@second%
- \Crefrange@section@format@second}{}%
- \@ifundefined{crefrange@subsection@format@middle}{%
- \let\crefrange@subsection@format@middle%
- \crefrange@section@format@middle}{}%
- \@ifundefined{Crefrange@subsection@format@middle}{%
- \let\Crefrange@subsection@format@middle%
- \Crefrange@section@format@middle}{}%
- \@ifundefined{crefrange@subsection@format@last}{%
- \let\crefrange@subsection@format@last%
- \crefrange@section@format@last}{}%
- \@ifundefined{Crefrange@subsection@format@last}{%
- \let\Crefrange@subsection@format@last%
- \Crefrange@section@format@last}{}%
- \@ifundefined{cref@subsubsection@name}{%
- \let\cref@subsubsection@name\cref@section@name%
- \let\cref@subsubsection@name@plural\cref@section@name@plural}{}%
- \@ifundefined{Cref@subsection@name}{%
- \let\Cref@subsection@name\Cref@section@name%
- \let\Cref@subsection@name@plural\Cref@section@name@plural}{}%
- \@ifundefined{cref@subsubsection@format}{%
- \let\cref@subsubsection@format%
- \cref@subsection@format}{}%
- \@ifundefined{Cref@subsubsection@format}{%
- \let\Cref@subsubsection@format%
- \Cref@subsection@format}{}%
- \@ifundefined{crefrange@subsubsection@format}{%
- \let\crefrange@subsubsection@format%
- \crefrange@subsection@format}{}%
- \@ifundefined{Crefrange@subsubsection@format}{%
- \let\Crefrange@subsubsection@format%
- \Crefrange@subsection@format}{}%
- \@ifundefined{cref@subsubsection@format@first}{%
- \let\cref@subsubsection@format@first%
- \cref@subsection@format@first}{}%
- \@ifundefined{Cref@subsubsection@format@first}{%
- \let\Cref@subsubsection@format@first%
- \Cref@subsection@format@first}{}%
- \@ifundefined{cref@subsubsection@format@second}{%
- \let\cref@subsubsection@format@second%
- \cref@subsection@format@second}{}%
- \@ifundefined{Cref@subsubsection@format@second}{%
- \let\Cref@subsubsection@format@second%
- \Cref@subsection@format@second}{}%
- \@ifundefined{cref@subsubsection@format@middle}{%
- \let\cref@subsubsection@format@middle%
- \cref@subsection@format@middle}{}%
- \@ifundefined{Cref@subsubsection@format@middle}{%
- \let\Cref@subsubsection@format@middle%
- \Cref@subsection@format@middle}{}%
- \@ifundefined{cref@subsubsection@format@last}{%
- \let\cref@subsubsection@format@last%
- \cref@subsection@format@last}{}%
- \@ifundefined{Cref@subsubsection@format@last}{%
- \let\Cref@subsubsection@format@last%
- \Cref@subsection@format@last}{}%
- \@ifundefined{crefrange@subsubsection@format@first}{%
- \let\crefrange@subsubsection@format@first%
- \crefrange@subsection@format@first}{}%
- \@ifundefined{Crefrange@subsubsection@format@first}{%
- \let\Crefrange@subsubsection@format@first%
- \Crefrange@subsection@format@first}{}%
- \@ifundefined{crefrange@subsubsection@format@second}{%
- \let\crefrange@subsubsection@format@second%
- \crefrange@subsection@format@second}{}%
- \@ifundefined{Crefrange@subsubsection@format@second}{%
- \let\Crefrange@subsubsection@format@second%
- \Crefrange@subsection@format@second}{}%
- \@ifundefined{crefrange@subsubsection@format@middle}{%
- \let\crefrange@subsubsection@format@middle%
- \crefrange@subsection@format@middle}{}%
- \@ifundefined{Crefrange@subsubsection@format@middle}{%
- \let\Crefrange@subsubsection@format@middle%
- \Crefrange@subsection@format@middle}{}%
- \@ifundefined{crefrange@subsubsection@format@last}{%
- \let\crefrange@subsubsection@format@last%
- \crefrange@subsection@format@last}{}%
- \@ifundefined{Crefrange@subsubsection@format@last}{%
- \let\Crefrange@subsubsection@format@last%
- \Crefrange@subsection@format@last}{}%
- \@ifundefined{cref@subappendix@name}{%
- \let\cref@subappendix@name\cref@appendix@name%
- \let\cref@subappendix@name@plural%
- \cref@appendix@name@plural}{}%
- \@ifundefined{Cref@subappendix@name}{%
- \let\Cref@subappendix@name\Cref@section@name%
- \let\Cref@subappendixsection@name@plural%
- \Cref@appendix@name@plural}{}%
- \@ifundefined{cref@subappendix@format}{%
- \let\cref@subappendix@format\cref@appendix@format}{}%
- \@ifundefined{Cref@subappendix@format}{%
- \let\Cref@subappendix@format\Cref@appendix@format}{}%
- \@ifundefined{crefrange@subappendix@format}{%
- \let\crefrange@subappendix@format%
- \crefrange@appendix@format}{}%
- \@ifundefined{Crefrange@subappendix@format}{%
- \let\Crefrange@subappendix@format%
- \Crefrange@appendix@format}{}%
- \@ifundefined{cref@subappendix@format@first}{%
- \let\cref@subappendix@format@first%
- \cref@appendix@format@first}{}%
- \@ifundefined{Cref@subappendix@format@first}{%
- \let\Cref@subappendix@format@first%
- \Cref@appendix@format@first}{}%
- \@ifundefined{cref@subappendix@format@second}{%
- \let\cref@subappendix@format@second%
- \cref@appendix@format@second}{}%
- \@ifundefined{Cref@subappendix@format@second}{%
- \let\Cref@subappendix@format@second%
- \Cref@appendix@format@second}{}%
- \@ifundefined{cref@subappendix@format@middle}{%
- \let\cref@subappendix@format@middle%
- \cref@appendix@format@middle}{}%
- \@ifundefined{Cref@subappendix@format@middle}{%
- \let\Cref@subappendix@format@middle%
- \Cref@appendix@format@middle}{}%
- \@ifundefined{cref@subappendix@format@last}{%
- \let\cref@subappendix@format@last%
- \cref@appendix@format@last}{}%
- \@ifundefined{Cref@subappendix@format@last}{%
- \let\Cref@subappendix@format@last%
- \Cref@appendix@format@last}{}%
- \@ifundefined{crefrange@subappendix@format@first}{%
- \let\crefrange@subappendix@format@first%
- \crefrange@appendix@format@first}{}%
- \@ifundefined{Crefrange@subappendix@format@first}{%
- \let\Crefrange@subappendix@format@first%
- \Crefrange@appendix@format@first}{}%
- \@ifundefined{crefrange@subappendix@format@second}{%
- \let\crefrange@subappendix@format@second%
- \crefrange@appendix@format@second}{}%
- \@ifundefined{Crefrange@subappendix@format@second}{%
- \let\Crefrange@subappendix@format@second%
- \Crefrange@appendix@format@second}{}%
- \@ifundefined{crefrange@subappendix@format@middle}{%
- \let\crefrange@subappendix@format@middle%
- \crefrange@appendix@format@middle}{}%
- \@ifundefined{Crefrange@subappendix@format@middle}{%
- \let\Crefrange@subappendix@format@middle%
- \Crefrange@appendix@format@middle}{}%
- \@ifundefined{crefrange@subappendix@format@last}{%
- \let\crefrange@subappendix@format@last%
- \crefrange@appendix@format@last}{}%
- \@ifundefined{Crefrange@subappendix@format@last}{%
- \let\Crefrange@subappendix@format@last%
- \Crefrange@appendix@format@last}{}%
- \@ifundefined{cref@subsubappendix@name}{%
- \let\cref@subsubappendix@name\cref@appendix@name%
- \let\cref@subsubappendix@name@plural%
- \cref@appendix@name@plural}{}%
- \@ifundefined{Cref@subsubappendix@name}{%
- \let\Cref@subsubappendix@name\Cref@section@name%
- \let\Cref@subsubappendixsection@name@plural%
- \Cref@appendix@name@plural}{}%
- \@ifundefined{cref@subsubappendix@format}{%
- \let\cref@subsubappendix@format%
- \cref@subappendix@format}{}%
- \@ifundefined{Cref@subsubappendix@format}{%
- \let\Cref@subsubappendix@format%
- \Cref@subappendix@format}{}%
- \@ifundefined{crefrange@subsubappendix@format}{%
- \let\crefrange@subsubappendix@format%
- \crefrange@subappendix@format}{}%
- \@ifundefined{Crefrange@subsubappendix@format}{%
- \let\Crefrange@subsubappendix@format%
- \Crefrange@subappendix@format}{}%
- \@ifundefined{cref@subsubappendix@format@first}{%
- \let\cref@subsubappendix@format@first%
- \cref@subappendix@format@first}{}%
- \@ifundefined{Cref@subsubappendix@format@first}{%
- \let\Cref@subsubappendix@format@first%
- \Cref@subappendix@format@first}{}%
- \@ifundefined{cref@subsubappendix@format@second}{%
- \let\cref@subsubappendix@format@second%
- \cref@subappendix@format@second}{}%
- \@ifundefined{Cref@subsubappendix@format@second}{%
- \let\Cref@subsubappendix@format@second%
- \Cref@subappendix@format@second}{}%
- \@ifundefined{cref@subsubappendix@format@middle}{%
- \let\cref@subsubappendix@format@middle%
- \cref@subappendix@format@middle}{}%
- \@ifundefined{Cref@subsubappendix@format@middle}{%
- \let\Cref@subsubappendix@format@middle%
- \Cref@subappendix@format@middle}{}%
- \@ifundefined{cref@subsubappendix@format@last}{%
- \let\cref@subsubappendix@format@last%
- \cref@subappendix@format@last}{}%
- \@ifundefined{Cref@subsubappendix@format@last}{%
- \let\Cref@subsubappendix@format@last%
- \Cref@subappendix@format@last}{}%
- \@ifundefined{crefrange@subsubappendix@format@first}{%
- \let\crefrange@subsubappendix@format@first%
- \crefrange@subappendix@format@first}{}%
- \@ifundefined{Crefrange@subsubappendix@format@first}{%
- \let\Crefrange@subsubappendix@format@first%
- \Crefrange@subappendix@format@first}{}%
- \@ifundefined{crefrange@subsubappendix@format@second}{%
- \let\crefrange@subsubappendix@format@second%
- \crefrange@subappendix@format@second}{}%
- \@ifundefined{Crefrange@subsubappendix@format@second}{%
- \let\Crefrange@subsubappendix@format@second%
- \Crefrange@subappendix@format@second}{}%
- \@ifundefined{crefrange@subsubappendix@format@middle}{%
- \let\crefrange@subsubappendix@format@middle%
- \crefrange@subappendix@format@middle}{}%
- \@ifundefined{Crefrange@subsubappendix@format@middle}{%
- \let\Crefrange@subsubappendix@format@middle%
- \Crefrange@subappendix@format@middle}{}%
- \@ifundefined{crefrange@subsubappendix@format@last}{%
- \let\crefrange@subsubappendix@format@last%
- \crefrange@subappendix@format@last}{}%
- \@ifundefined{Crefrange@subsubappendix@format@last}{%
- \let\Crefrange@subsubappendix@format@last%
- \Crefrange@subappendix@format@last}{}%
- \@ifundefined{cref@subsubsubappendix@format}{%
- \let\cref@subsubsubappendix@format%
- \cref@subsubappendix@format}{}%
- \@ifundefined{Cref@subsubsubappendix@format}{%
- \let\Cref@subsubsubappendix@format%
- \Cref@subsubappendix@format}{}%
- \@ifundefined{crefrange@subsubsubappendix@format}{%
- \let\crefrange@subsubsubappendix@format%
- \crefrange@subsubappendix@format}{}%
- \@ifundefined{Crefrange@subsubsubappendix@format}{%
- \let\Crefrange@subsubsubappendix@format%
- \Crefrange@subsubappendix@format}{}%
- \@ifundefined{cref@subsubsubappendix@format@first}{%
- \let\cref@subsubsubappendix@format@first%
- \cref@subsubappendix@format@first}{}%
- \@ifundefined{Cref@subsubsubappendix@format@first}{%
- \let\Cref@subsubsubappendix@format@first%
- \Cref@subsubappendix@format@first}{}%
- \@ifundefined{cref@subsubsubappendix@format@second}{%
- \let\cref@subsubsubappendix@format@second%
- \cref@subsubappendix@format@second}{}%
- \@ifundefined{Cref@subsubsubappendix@format@second}{%
- \let\Cref@subsubsubappendix@format@second%
- \Cref@subsubappendix@format@second}{}%
- \@ifundefined{cref@subsubsubappendix@format@middle}{%
- \let\cref@subsubsubappendix@format@middle%
- \cref@subsubappendix@format@middle}{}%
- \@ifundefined{Cref@subsubsubappendix@format@middle}{%
- \let\Cref@subsubsubappendix@format@middle%
- \Cref@subsubappendix@format@middle}{}%
- \@ifundefined{cref@subsubsubappendix@format@last}{%
- \let\cref@subsubsubappendix@format@last%
- \cref@subsubappendix@format@last}{}%
- \@ifundefined{Cref@subsubsubappendix@format@last}{%
- \let\Cref@subsubsubappendix@format@last%
- \Cref@subsubappendix@format@last}{}%
- \@ifundefined{crefrange@subsubsubappendix@format@first}{%
- \let\crefrange@subsubsubappendix@format@first%
- \crefrange@subsubappendix@format@first}{}%
- \@ifundefined{Crefrange@subsubsubappendix@format@first}{%
- \let\Crefrange@subsubsubappendix@format@first%
- \Crefrange@subsubappendix@format@first}{}%
- \@ifundefined{crefrange@subsubsubappendix@format@second}{%
- \let\crefrange@subsubsubappendix@format@second%
- \crefrange@subsubappendix@format@second}{}%
- \@ifundefined{Crefrange@subsubsubappendix@format@second}{%
- \let\Crefrange@subsubsubappendix@format@second%
- \Crefrange@subsubappendix@format@second}{}%
- \@ifundefined{crefrange@subsubsubappendix@format@middle}{%
- \let\crefrange@subsubsubappendix@format@middle%
- \crefrange@subsubappendix@format@middle}{}%
- \@ifundefined{Crefrange@subsubsubappendix@format@middle}{%
- \let\Crefrange@subsubsubappendix@format@middle%
- \Crefrange@subsubappendix@format@middle}{}%
- \@ifundefined{crefrange@subsubsubappendix@format@last}{%
- \let\crefrange@subsubsubappendix@format@last%
- \crefrange@subsubappendix@format@last}{}%
- \@ifundefined{Crefrange@subsubsubappendix@format@last}{%
- \let\Crefrange@subsubsubappendix@format@last%
- \Crefrange@subsubappendix@format@last}{}%
- \@ifundefined{cref@subfigure@format}{%
- \let\cref@subfigure@format%
- \cref@figure@format}{}%
- \@ifundefined{Cref@subfigure@format}{%
- \let\Cref@subfigure@format%
- \Cref@figure@format}{}%
- \@ifundefined{crefrange@subfigure@format}{%
- \let\crefrange@subfigure@format%
- \crefrange@figure@format}{}%
- \@ifundefined{Crefrange@subfigure@format}{%
- \let\Crefrange@subfigure@format%
- \Crefrange@figure@format}{}%
- \@ifundefined{cref@subfigure@format@first}{%
- \let\cref@subfigure@format@first%
- \cref@figure@format@first}{}%
- \@ifundefined{Cref@subfigure@format@first}{%
- \let\Cref@subfigure@format@first%
- \Cref@figure@format@first}{}%
- \@ifundefined{cref@subfigure@format@second}{%
- \let\cref@subfigure@format@second%
- \cref@figure@format@second}{}%
- \@ifundefined{Cref@subfigure@format@second}{%
- \let\Cref@subfigure@format@second%
- \Cref@figure@format@second}{}%
- \@ifundefined{cref@subfigure@format@middle}{%
- \let\cref@subfigure@format@middle%
- \cref@figure@format@middle}{}%
- \@ifundefined{Cref@subfigure@format@middle}{%
- \let\Cref@subfigure@format@middle%
- \Cref@figure@format@middle}{}%
- \@ifundefined{cref@subfigure@format@last}{%
- \let\cref@subfigure@format@last%
- \cref@figure@format@last}{}%
- \@ifundefined{Cref@subfigure@format@last}{%
- \let\Cref@subfigure@format@last%
- \Cref@figure@format@last}{}%
- \@ifundefined{crefrange@subfigure@format@first}{%
- \let\crefrange@subfigure@format@first%
- \crefrange@figure@format@first}{}%
- \@ifundefined{Crefrange@subfigure@format@first}{%
- \let\Crefrange@subfigure@format@first%
- \Crefrange@figure@format@first}{}%
- \@ifundefined{crefrange@subfigure@format@second}{%
- \let\crefrange@subfigure@format@second%
- \crefrange@figure@format@second}{}%
- \@ifundefined{Crefrange@subfigure@format@second}{%
- \let\Crefrange@subfigure@format@second%
- \Crefrange@figure@format@second}{}%
- \@ifundefined{crefrange@subfigure@format@middle}{%
- \let\crefrange@subfigure@format@middle%
- \crefrange@figure@format@middle}{}%
- \@ifundefined{Crefrange@subfigure@format@middle}{%
- \let\Crefrange@subfigure@format@middle%
- \Crefrange@figure@format@middle}{}%
- \@ifundefined{crefrange@subfigure@format@last}{%
- \let\crefrange@subfigure@format@last%
- \crefrange@figure@format@last}{}%
- \@ifundefined{Crefrange@subfigure@format@last}{%
- \let\Crefrange@subfigure@format@last%
- \Crefrange@figure@format@last}{}%
- \@ifundefined{cref@subtable@format}{%
- \let\cref@subtable@format%
- \cref@table@format}{}%
- \@ifundefined{Cref@subtable@format}{%
- \let\Cref@subtable@format%
- \Cref@table@format}{}%
- \@ifundefined{crefrange@subtable@format}{%
- \let\crefrange@subtable@format%
- \crefrange@table@format}{}%
- \@ifundefined{Crefrange@subtable@format}{%
- \let\Crefrange@subtable@format%
- \Crefrange@table@format}{}%
- \@ifundefined{cref@subtable@format@first}{%
- \let\cref@subtable@format@first%
- \cref@table@format@first}{}%
- \@ifundefined{Cref@subtable@format@first}{%
- \let\Cref@subtable@format@first%
- \Cref@table@format@first}{}%
- \@ifundefined{cref@subtable@format@second}{%
- \let\cref@subtable@format@second%
- \cref@table@format@second}{}%
- \@ifundefined{Cref@subtable@format@second}{%
- \let\Cref@subtable@format@second%
- \Cref@table@format@second}{}%
- \@ifundefined{cref@subtable@format@middle}{%
- \let\cref@subtable@format@middle%
- \cref@table@format@middle}{}%
- \@ifundefined{Cref@subtable@format@middle}{%
- \let\Cref@subtable@format@middle%
- \Cref@table@format@middle}{}%
- \@ifundefined{cref@subtable@format@last}{%
- \let\cref@subtable@format@last%
- \cref@table@format@last}{}%
- \@ifundefined{Cref@subtable@format@last}{%
- \let\Cref@subtable@format@last%
- \Cref@table@format@last}{}%
- \@ifundefined{crefrange@subtable@format@first}{%
- \let\crefrange@subtable@format@first%
- \crefrange@table@format@first}{}%
- \@ifundefined{Crefrange@subtable@format@first}{%
- \let\Crefrange@subtable@format@first%
- \Crefrange@table@format@first}{}%
- \@ifundefined{crefrange@subtable@format@second}{%
- \let\crefrange@subtable@format@second%
- \crefrange@table@format@second}{}%
- \@ifundefined{Crefrange@subtable@format@second}{%
- \let\Crefrange@subtable@format@second%
- \Crefrange@table@format@second}{}%
- \@ifundefined{crefrange@subtable@format@middle}{%
- \let\crefrange@subtable@format@middle%
- \crefrange@table@format@middle}{}%
- \@ifundefined{Crefrange@subtable@format@middle}{%
- \let\Crefrange@subtable@format@middle%
- \Crefrange@table@format@middle}{}%
- \@ifundefined{crefrange@subtable@format@last}{%
- \let\crefrange@subtable@format@last%
- \crefrange@table@format@last}{}%
- \@ifundefined{Crefrange@subtable@format@last}{%
- \let\Crefrange@subtable@format@last%
- \Crefrange@table@format@last}{}%
- \@ifundefined{cref@subequation@format}{%
- \let\cref@subequation@format%
- \cref@equation@format}{}%
- \@ifundefined{Cref@subequation@format}{%
- \let\Cref@subequation@format%
- \Cref@equation@format}{}%
- \@ifundefined{crefrange@subequation@format}{%
- \let\crefrange@subequation@format%
- \crefrange@equation@format}{}%
- \@ifundefined{Crefrange@subequation@format}{%
- \let\Crefrange@subequation@format%
- \Crefrange@equation@format}{}%
- \@ifundefined{cref@subequation@format@first}{%
- \let\cref@subequation@format@first%
- \cref@equation@format@first}{}%
- \@ifundefined{Cref@subequation@format@first}{%
- \let\Cref@subequation@format@first%
- \Cref@equation@format@first}{}%
- \@ifundefined{cref@subequation@format@second}{%
- \let\cref@subequation@format@second%
- \cref@equation@format@second}{}%
- \@ifundefined{Cref@subequation@format@second}{%
- \let\Cref@subequation@format@second%
- \Cref@equation@format@second}{}%
- \@ifundefined{cref@subequation@format@middle}{%
- \let\cref@subequation@format@middle%
- \cref@equation@format@middle}{}%
- \@ifundefined{Cref@subequation@format@middle}{%
- \let\Cref@subequation@format@middle%
- \Cref@equation@format@middle}{}%
- \@ifundefined{cref@subequation@format@last}{%
- \let\cref@subequation@format@last%
- \cref@equation@format@last}{}%
- \@ifundefined{Cref@subequation@format@last}{%
- \let\Cref@subequation@format@last%
- \Cref@equation@format@last}{}%
- \@ifundefined{crefrange@subequation@format@first}{%
- \let\crefrange@subequation@format@first%
- \crefrange@equation@format@first}{}%
- \@ifundefined{Crefrange@subequation@format@first}{%
- \let\Crefrange@subequation@format@first%
- \Crefrange@equation@format@first}{}%
- \@ifundefined{crefrange@subequation@format@second}{%
- \let\crefrange@subequation@format@second%
- \crefrange@equation@format@second}{}%
- \@ifundefined{Crefrange@subequation@format@second}{%
- \let\Crefrange@subequation@format@second%
- \Crefrange@equation@format@second}{}%
- \@ifundefined{crefrange@subequation@format@middle}{%
- \let\crefrange@subequation@format@middle%
- \crefrange@equation@format@middle}{}%
- \@ifundefined{Crefrange@subequation@format@middle}{%
- \let\Crefrange@subequation@format@middle%
- \Crefrange@equation@format@middle}{}%
- \@ifundefined{crefrange@subequation@format@last}{%
- \let\crefrange@subequation@format@last%
- \crefrange@equation@format@last}{}%
- \@ifundefined{Crefrange@subequation@format@last}{%
- \let\Crefrange@subequation@format@last%
- \Crefrange@equation@format@last}{}%
- \@ifundefined{cref@enumii@format}{%
- \let\cref@enumii@format%
- \cref@enumi@format}{}%
- \@ifundefined{Cref@enumii@format}{%
- \let\Cref@enumii@format%
- \Cref@enumi@format}{}%
- \@ifundefined{crefrange@enumii@format}{%
- \let\crefrange@enumii@format%
- \crefrange@enumi@format}{}%
- \@ifundefined{Crefrange@enumii@format}{%
- \let\Crefrange@enumii@format%
- \Crefrange@enumi@format}{}%
- \@ifundefined{cref@enumii@format@first}{%
- \let\cref@enumii@format@first%
- \cref@enumi@format@first}{}%
- \@ifundefined{Cref@enumii@format@first}{%
- \let\Cref@enumii@format@first%
- \Cref@enumi@format@first}{}%
- \@ifundefined{cref@enumii@format@second}{%
- \let\cref@enumii@format@second%
- \cref@enumi@format@second}{}%
- \@ifundefined{Cref@enumii@format@second}{%
- \let\Cref@enumii@format@second%
- \Cref@enumi@format@second}{}%
- \@ifundefined{cref@enumii@format@middle}{%
- \let\cref@enumii@format@middle%
- \cref@enumi@format@middle}{}%
- \@ifundefined{Cref@enumii@format@middle}{%
- \let\Cref@enumii@format@middle%
- \Cref@enumi@format@middle}{}%
- \@ifundefined{cref@enumii@format@last}{%
- \let\cref@enumii@format@last%
- \cref@enumi@format@last}{}%
- \@ifundefined{Cref@enumii@format@last}{%
- \let\Cref@enumii@format@last%
- \Cref@enumi@format@last}{}%
- \@ifundefined{crefrange@enumii@format@first}{%
- \let\crefrange@enumii@format@first%
- \crefrange@enumi@format@first}{}%
- \@ifundefined{Crefrange@enumii@format@first}{%
- \let\Crefrange@enumii@format@first%
- \Crefrange@enumi@format@first}{}%
- \@ifundefined{crefrange@enumii@format@second}{%
- \let\crefrange@enumii@format@second%
- \crefrange@enumi@format@second}{}%
- \@ifundefined{Crefrange@enumii@format@second}{%
- \let\Crefrange@enumii@format@second%
- \Crefrange@enumi@format@second}{}%
- \@ifundefined{crefrange@enumii@format@middle}{%
- \let\crefrange@enumii@format@middle%
- \crefrange@enumi@format@middle}{}%
- \@ifundefined{Crefrange@enumii@format@middle}{%
- \let\Crefrange@enumii@format@middle%
- \Crefrange@enumi@format@middle}{}%
- \@ifundefined{crefrange@enumii@format@last}{%
- \let\crefrange@enumii@format@last%
- \crefrange@enumi@format@last}{}%
- \@ifundefined{Crefrange@enumii@format@last}{%
- \let\Crefrange@enumii@format@last%
- \Crefrange@enumi@format@last}{}%
- \@ifundefined{cref@enumiii@format}{%
- \let\cref@enumiii@format%
- \cref@enumii@format}{}%
- \@ifundefined{Cref@enumiii@format}{%
- \let\Cref@enumiii@format%
- \Cref@enumii@format}{}%
- \@ifundefined{crefrange@enumiii@format}{%
- \let\crefrange@enumiii@format%
- \crefrange@enumii@format}{}%
- \@ifundefined{Crefrange@enumiii@format}{%
- \let\Crefrange@enumiii@format%
- \Crefrange@enumii@format}{}%
- \@ifundefined{cref@enumiii@format@first}{%
- \let\cref@enumiii@format@first%
- \cref@enumii@format@first}{}%
- \@ifundefined{Cref@enumiii@format@first}{%
- \let\Cref@enumiii@format@first%
- \Cref@enumii@format@first}{}%
- \@ifundefined{cref@enumiii@format@second}{%
- \let\cref@enumiii@format@second%
- \cref@enumii@format@second}{}%
- \@ifundefined{Cref@enumiii@format@second}{%
- \let\Cref@enumiii@format@second%
- \Cref@enumii@format@second}{}%
- \@ifundefined{cref@enumiii@format@middle}{%
- \let\cref@enumiii@format@middle%
- \cref@enumii@format@middle}{}%
- \@ifundefined{Cref@enumiii@format@middle}{%
- \let\Cref@enumiii@format@middle%
- \Cref@enumii@format@middle}{}%
- \@ifundefined{cref@enumiii@format@last}{%
- \let\cref@enumiii@format@last%
- \cref@enumii@format@last}{}%
- \@ifundefined{Cref@enumiii@format@last}{%
- \let\Cref@enumiii@format@last%
- \Cref@enumii@format@last}{}%
- \@ifundefined{crefrange@enumiii@format@first}{%
- \let\crefrange@enumiii@format@first%
- \crefrange@enumii@format@first}{}%
- \@ifundefined{Crefrange@enumiii@format@first}{%
- \let\Crefrange@enumiii@format@first%
- \Crefrange@enumii@format@first}{}%
- \@ifundefined{crefrange@enumiii@format@second}{%
- \let\crefrange@enumiii@format@second%
- \crefrange@enumii@format@second}{}%
- \@ifundefined{Crefrange@enumiii@format@second}{%
- \let\Crefrange@enumiii@format@second%
- \Crefrange@enumii@format@second}{}%
- \@ifundefined{crefrange@enumiii@format@middle}{%
- \let\crefrange@enumiii@format@middle%
- \crefrange@enumii@format@middle}{}%
- \@ifundefined{Crefrange@enumiii@format@middle}{%
- \let\Crefrange@enumiii@format@middle%
- \Crefrange@enumii@format@middle}{}%
- \@ifundefined{crefrange@enumiii@format@last}{%
- \let\crefrange@enumiii@format@last%
- \crefrange@enumii@format@last}{}%
- \@ifundefined{Crefrange@enumiii@format@last}{%
- \let\Crefrange@enumiii@format@last%
- \Crefrange@enumii@format@last}{}%
- \@ifundefined{cref@enumiv@format}{%
- \let\cref@enumiv@format%
- \cref@enumiii@format}{}%
- \@ifundefined{Cref@enumiv@format}{%
- \let\Cref@enumiv@format%
- \Cref@enumiii@format}{}%
- \@ifundefined{crefrange@enumiv@format}{%
- \let\crefrange@enumiv@format%
- \crefrange@enumiii@format}{}%
- \@ifundefined{Crefrange@enumiv@format}{%
- \let\Crefrange@enumiv@format%
- \Crefrange@enumiii@format}{}%
- \@ifundefined{cref@enumiv@format@first}{%
- \let\cref@enumiv@format@first%
- \cref@enumiii@format@first}{}%
- \@ifundefined{Cref@enumiv@format@first}{%
- \let\Cref@enumiv@format@first%
- \Cref@enumiii@format@first}{}%
- \@ifundefined{cref@enumiv@format@second}{%
- \let\cref@enumiv@format@second%
- \cref@enumiii@format@second}{}%
- \@ifundefined{Cref@enumiv@format@second}{%
- \let\Cref@enumiv@format@second%
- \Cref@enumiii@format@second}{}%
- \@ifundefined{cref@enumiv@format@middle}{%
- \let\cref@enumiv@format@middle%
- \cref@enumiii@format@middle}{}%
- \@ifundefined{Cref@enumiv@format@middle}{%
- \let\Cref@enumiv@format@middle%
- \Cref@enumiii@format@middle}{}%
- \@ifundefined{cref@enumiv@format@last}{%
- \let\cref@enumiv@format@last%
- \cref@enumiii@format@last}{}%
- \@ifundefined{Cref@enumiv@format@last}{%
- \let\Cref@enumiv@format@last%
- \Cref@enumiii@format@last}{}%
- \@ifundefined{crefrange@enumiv@format@first}{%
- \let\crefrange@enumiv@format@first%
- \crefrange@enumiii@format@first}{}%
- \@ifundefined{Crefrange@enumiv@format@first}{%
- \let\Crefrange@enumiv@format@first%
- \Crefrange@enumiii@format@first}{}%
- \@ifundefined{crefrange@enumiv@format@second}{%
- \let\crefrange@enumiv@format@second%
- \crefrange@enumiii@format@second}{}%
- \@ifundefined{Crefrange@enumiv@format@second}{%
- \let\Crefrange@enumiv@format@second%
- \Crefrange@enumiii@format@second}{}%
- \@ifundefined{crefrange@enumiv@format@middle}{%
- \let\crefrange@enumiv@format@middle%
- \crefrange@enumiii@format@middle}{}%
- \@ifundefined{Crefrange@enumiv@format@middle}{%
- \let\Crefrange@enumiv@format@middle%
- \Crefrange@enumiii@format@middle}{}%
- \@ifundefined{crefrange@enumiv@format@last}{%
- \let\crefrange@enumiv@format@last%
- \crefrange@enumiii@format@last}{}%
- \@ifundefined{Crefrange@enumiv@format@last}{%
- \let\Crefrange@enumiv@format@last%
- \Crefrange@enumiii@format@last}{}%
- \@ifundefined{cref@enumv@format}{%
- \let\cref@enumv@format%
- \cref@enumiv@format}{}%
- \@ifundefined{Cref@enumv@format}{%
- \let\Cref@enumv@format%
- \Cref@enumiv@format}{}%
- \@ifundefined{crefrange@enumv@format}{%
- \let\crefrange@enumv@format%
- \crefrange@enumiv@format}{}%
- \@ifundefined{Crefrange@enumv@format}{%
- \let\Crefrange@enumv@format%
- \Crefrange@enumiv@format}{}%
- \@ifundefined{cref@enumv@format@first}{%
- \let\cref@enumv@format@first%
- \cref@enumiv@format@first}{}%
- \@ifundefined{Cref@enumv@format@first}{%
- \let\Cref@enumv@format@first%
- \Cref@enumiv@format@first}{}%
- \@ifundefined{cref@enumv@format@second}{%
- \let\cref@enumv@format@second%
- \cref@enumiv@format@second}{}%
- \@ifundefined{Cref@enumv@format@second}{%
- \let\Cref@enumv@format@second%
- \Cref@enumiv@format@second}{}%
- \@ifundefined{cref@enumv@format@middle}{%
- \let\cref@enumv@format@middle%
- \cref@enumiv@format@middle}{}%
- \@ifundefined{Cref@enumv@format@middle}{%
- \let\Cref@enumv@format@middle%
- \Cref@enumiv@format@middle}{}%
- \@ifundefined{cref@enumv@format@last}{%
- \let\cref@enumv@format@last%
- \cref@enumiv@format@last}{}%
- \@ifundefined{Cref@enumv@format@last}{%
- \let\Cref@enumv@format@last%
- \Cref@enumiv@format@last}{}%
- \@ifundefined{crefrange@enumv@format@first}{%
- \let\crefrange@enumv@format@first%
- \crefrange@enumiv@format@first}{}%
- \@ifundefined{Crefrange@enumv@format@first}{%
- \let\Crefrange@enumv@format@first%
- \Crefrange@enumiv@format@first}{}%
- \@ifundefined{crefrange@enumv@format@second}{%
- \let\crefrange@enumv@format@second%
- \crefrange@enumiv@format@second}{}%
- \@ifundefined{Crefrange@enumv@format@second}{%
- \let\Crefrange@enumv@format@second%
- \Crefrange@enumiv@format@second}{}%
- \@ifundefined{crefrange@enumv@format@middle}{%
- \let\crefrange@enumv@format@middle%
- \crefrange@enumiv@format@middle}{}%
- \@ifundefined{Crefrange@enumv@format@middle}{%
- \let\Crefrange@enumv@format@middle%
- \Crefrange@enumiv@format@middle}{}%
- \@ifundefined{crefrange@enumv@format@last}{%
- \let\crefrange@enumv@format@last%
- \crefrange@enumiv@format@last}{}%
- \@ifundefined{Crefrange@enumv@format@last}{%
- \let\Crefrange@enumv@format@last%
- \Crefrange@enumiv@format@last}{}%
+ \@crefcopyformats{section}{subsection}%
+ \@crefcopyformats{section}{subsubsection}%
+ \@crefcopyformats{appendix}{subappendix}%
+ \@crefcopyformats{appendix}{subsubappendix}%
+ \@crefcopyformats{figure}{subfigure}%
+ \@crefcopyformats{table}{subtable}%
+ \@crefcopyformats{equation}{subequation}%
+ \@crefcopyformats{enumi}{enumii}%
+ \@crefcopyformats{enumii}{enumiii}%
+ \@crefcopyformats{enumiii}{enumiv}%
+ \@crefcopyformats{enumiv}{enumv}%
+ \@labelcrefdefinedefaultformats%
+ %
\let\cref@language\relax%
}% end of \AtBeginDocument
\InputIfFileExists{cleveref.cfg}%
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index 3036ff6de8d..05946b09f9e 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -255,6 +255,7 @@ chomp ($Build = `cd $Master/../Build/source && pwd`);
'cmcyr', "&MAKEflatten",
'cmcyralt', "die 'skipping, noinfo license",
'cmexb', "&MAKEflatten",
+ 'cmsrb', "&MAKEflatten",
'cnbwp', "&MAKEflatten",
'cntdwn', "die 'skipping, author (dps) request",
'comicsans', "die 'skipping, Comic Sans is nonfree'",