diff options
author | Karl Berry <karl@freefriends.org> | 2013-12-30 23:35:45 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-12-30 23:35:45 +0000 |
commit | 2279674bbd8d121f3242f7d30dbb469770bfc646 (patch) | |
tree | dccccb52caa33ceca60b24bc86e654dc87f231d8 /Master/texmf-dist/source/latex/cleveref | |
parent | ca7bdd33e60da44f422f24d19dfbfe49826b465d (diff) |
cleveref (28dec)
git-svn-id: svn://tug.org/texlive/trunk@32513 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/cleveref')
-rw-r--r-- | Master/texmf-dist/source/latex/cleveref/cleveref.dtx | 3437 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/cleveref/cleveref.ins | 4 |
2 files changed, 1882 insertions, 1559 deletions
diff --git a/Master/texmf-dist/source/latex/cleveref/cleveref.dtx b/Master/texmf-dist/source/latex/cleveref/cleveref.dtx index d2de28b72ce..ca7e6728885 100644 --- a/Master/texmf-dist/source/latex/cleveref/cleveref.dtx +++ b/Master/texmf-dist/source/latex/cleveref/cleveref.dtx @@ -1,5 +1,5 @@ -\def\packagedate{2013/03/22} -\def\packageversion{0.18.9} +\def\packagedate{2013/12/28} +\def\packageversion{0.19} % \iffalse meta-comment % % Package 'cleveref' to use with LaTeX2e @@ -36,17 +36,17 @@ \CodelineIndex \RecordChanges \setcounter{IndexColumns}{2} -%%\newcommand{\package}[1]{\texttt{#1.sty}} -\newcommand{\package}{\texttt} -\newcommand{\file}{\texttt} -\newcommand{\option}{\texttt} +%%\newcommand\package[1]{\texttt{#1.sty}} +\newcommand\package{\texttt} +\newcommand\file{\texttt} +\newcommand\option{\texttt} \begin{document} \DocInput{cleveref.dtx} \end{document} %</driver> % \fi % -% \CheckSum{19291} +% \CheckSum{19622} %% \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 @@ -256,7 +256,7 @@ % \textbackslash{}@currentlabel is set. Fix \package{xr} compatibility % by adding a ``cref'' suffix to \package{cleveref}'s internal label % names, instead of a prefix.} -% \changes{v0.18.5}{2012/03/05}{Fix \package{listings} and +% \changes{v0.18.5}{2012/03/05}{Fixed \package{listings} and % \package{algorithm} package support, broken by change to local rather % than global \textbackslash{}cref@currentlabel definitions. Fixed % compatibility with \package{memoir}'s internal \package{subfig} @@ -273,12 +273,19 @@ % print \textbackslash{}reftextcurrent string for references on the % current page. Fixed regression(?) causing spurious whitespace to be % produced for empty cross-reference names (see v0.17.7).} -% \changes{v0.18.8}{2013/03/22}{Fix automatic \textbackslash{}newtheorem -% definitions in \package{amsthm} support. Add Swedish and Brazilian -% translations. Fix bug in \package{algorithm2e} + \package{hyperref} -% support.} -% \changes{v0.18.9}{2013/03/22}{Fix regression that broke +% \changes{v0.18.8}{2013/03/22}{Fixed automatic +% \textbackslash{}newtheorem definitions in \package{amsthm} support. +% Add Swedish and Brazilian translations. Fix bug in +% \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. +% Remove unwanted spaces in some macros. Added abbreviation for +% ``Abbildung'' to German translations. Added \package{xr-hyperref} +% 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.} % % \GetFileInfo{cleveref.sty} % @@ -319,26 +326,25 @@ % \section{Introduction} % When ``clever'' is used in the name of a computer program, it usually % indicates that the programmer is overly smug about his own -% achievements! But at the heart of the \LaTeX{} philosophy also lies the +% achievements. But at the heart of the \LaTeX{} philosophy also lies the % idea that it is clever to delegate as much of the typesetting as % possible to the computer, in order to achieve a beautiful --- and above % all consistent --- visual appearance. % -% Both of these probably apply to the \package{cleveref} package. Its -% goals are two-fold: to exploit all the information that \LaTeX{} -% inherently already has about labels as intelligently as possible -% (clever processing); and to enable you to produce an attractive, -% consistent formatting of cross-references throughout your document, -% with the minimum of effort (you'd be clever to use it!). +% All of this probably applies to the \package{cleveref} package. Its +% goals are two-fold: to exploit all the information that \LaTeX{} can +% collect about labels as intelligently as possible (clever processing), +% allowing you to produce an attractive, consistent formatting of +% cross-references throughout your document with the minimum of effort +% (you'd be clever to use it!). % % The \package{cleveref} package enhances \LaTeX{}'s cross-referencing -% facilities by allowing cross-references to be formatted automatically -% according to the type of thing they refer to (chapter, section, -% equation, theorem, etc.) and the context in which the cross-reference -% is used. It can automatically format cross-references to multiple -% labels, sort lists of multiple cross-references, compress consecutive -% labels into a reference range, and all kinds of other clever wizardry. -% It also does similar things with page references. +% features by automatically formatting cross-references depending on what +% they refer to (chapter, section, equation, theorem, etc.). It can +% automatically format cross-references to multiple labels, and can sort +% lists of multiple cross-references, compresses consecutive labels into +% a reference range, and all kinds of other clever wizardry. It also does +% similar things with page references. % % In standard \LaTeX{}, you have almost certainly found yourself writing % things like |Eq.~(\ref{eq1})| and |Theorems~\ref{thm1} to~\ref{thm3}| @@ -405,8 +411,8 @@ % you want a page reference, use |\cpageref| (and don't write ``page'' in % front), if you want a page range, use |\cpagerefrange|, and if you want % to refer to multiple pages, simply throw them all into a single -% |\cpageref|, just as with |\cref| (above), and \package{cleveref} will -% sort it all out. +% |\cpageref|. Just as with |\cref| (above), \package{cleveref} will sort +% 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. @@ -434,8 +440,8 @@ % naturally a number of other \LaTeX{} packages with similar goals to % \package{cleveref}, most notably \package{varioref}, % \package{fancyref}, \package{hyperref}'s |\autoref| command, and (for -% theorem-like environments) \package{ntheorem} (with the \option{thref} -% option). (There are many others, but these come closest to providing +% theorem-like environments) \package{ntheorem} with the \option{thref} +% option. (There are many others, but these come closest to providing % similar features to \package{cleveref}.) However, all have certain % deficiencies which \package{cleveref} attempts to overcome. % @@ -444,8 +450,8 @@ % naming convention for labels. This is usually a good idea in any case, % but it can occasionally be inconvenient. For example, if you change a % theorem into a lemma, you have to change the label name, and therefore -% also all cross-references to it. So with \package{varioref}, you will -% at times be back to searching and replacing through the entire +% also all cross-references to it. So with \package{fancyref}, you will +% at times be back to searching and replacing label names throughout your % document. Not to mention missing out on all the other % \package{cleveref} features, such as automatic sorting and compressing % of consecutive references, \package{ntheorem} and \package{amsthm} @@ -455,15 +461,14 @@ % package's\linebreak[4] |\labelformat| command decides how to format % cross-references when the label is \emph{defined}, rather than when it % is \emph{referenced}. Often this isn't a problem. But it makes it -% impossible to format cross-references differently according the context -% in which they are referenced, which can sometimes be very useful. For -% example, if you want cross-references at the beginning of a sentence -% formatted any other way than by capitalising the first letter of the -% cross-reference text, it is impossible using \package{varioref}. E.g.\ -% you may want to use the abbreviation ``eq.'', but revert to -% ``Equation'' at the beginning of sentences (words at the start of -% sentences shouldn't be abbreviated in English). This is not possible -% with \package{varioref}. Perhaps even more significantly, +% impossible to format cross-references according to the context in which +% they are referenced, which can sometimes be very useful. For example, +% you may want cross-references at the beginning of a sentence formatted +% differently to cross-references in the middle of a sentence. E.g.\ you +% may want to use the abbreviation ``eq.'', but revert to ``Equation'' at +% the beginning of sentences (words at the start of sentences shouldn't +% be abbreviated in English). This is not possible with +% \package{varioref}. Perhaps even more significantly, % \package{varioref}'s |\labelformat| implementation makes it impossible % to typeset multiple references automatically; if you want to refer to % equations |eq1| through |eq3|, with \package{varioref} you are back to @@ -485,16 +490,16 @@ % sorted and compressed automatically, etc. % % The \package{ntheorem} package (with the \option{thref} option) does -% things right with regards to how and when the format is defined\ldots -% except that it only works for theorem-like environments. It is possible -% to use it for other environments, but only in a bastardized form, by -% manually supplying an optional argument to every |\label| command, -% specifying the label type. \package{Cleveref} works equally well when -% referencing any type of thing, as well as fully supporting -% \package{ntheorem}. And again, \package{cleveref} provides a number of -% additional features over \package{ntheorem}, such as multi-references, -% automatic sorting and compressing of consecutive cross-references, -% control over the placement of hyperlinks, etc. +% the right thing when it comes to how and when the format is +% defined\ldots except that it only works for theorem-like environments. +% It is possible to use it for other environments, but only in a +% bastardized form, by manually supplying an optional argument to every +% |\label| command to specify the label type. \package{Cleveref} works +% equally well with any type of cross-reference, as well as fully +% supporting \package{ntheorem}. And again, \package{cleveref} provides a +% number of additional features over \package{ntheorem}, such as +% multi-references, automatic sorting and compressing of consecutive +% cross-references, control over the placement of hyperlinks, etc. % % % @@ -701,6 +706,80 @@ % % % +% \section{Overriding the Cross-Reference Type} +% \label{sec:label_type} +% \DescribeMacro\label +% A label's ``type'' is usually determined by the name of the counter it +% refers to, or in the case of \package{ntheorem} and \package{amsthm} +% theorem-like environments by the environment name. However, sometimes +% it is useful to override the type. \package{Cleveref} provides two +% different mechanisms for accomplishing this. +% +% You can alias a counter to a different cross-reference type using the +% |\crefalias| command: +% \begin{quote} +% |\crefalias|\marg{counter}\marg{type} +% \end{quote} +% \meta{counter} will then use the cross-reference formatting of +% \meta{type}. This can be useful if you want multiple counters to use +% the same cross-reference format. +% +% Occasionally, you may want to override the cross-reference type for one +% particular label, one-off. You can do this by supplying the desired +% type as an optional argument to the |\label| command: +% \begin{quote} +% |\label|\oarg{type}\marg{label} +% \end{quote} +% +% One circumstance in which is useful is when you want to define a +% special cross-reference format for certain labels of a given type. By +% supplying a type that doesn't already exist as the optional argument to +% |\label|, you can then define the cross-reference format for that new +% type in whatever way you like, without affecting other cross-references +% of the same type. For example, if a particular equation contains +% multiple expressions and you want it to always be referred to in the +% plural, you could use: +% \begin{quote} +% |\crefname{pluralequation}{eqs.}{eqs.}|\\ +% \dots\\ +% |\label[pluralequation]{eq1}| +% \end{quote} +% You can of course reuse this format for other plural equations, too. +% +% If you need to do this frequently, it can become tedious specifying the +% label explicitly each time. An alternative is to use the +% \package{aliascnt} package. This lets you define one counter to be an +% alias for another, so that effectively the same counter has two names. +% Since \package{cleveref} determines the label type from the counter +% name, the two counter aliases can have different cross-reference +% formats whilst really being the same counter. You have to somehow +% arrange for the correct counter alias to be used depending on which +% cross-reference format you want (probably by defining two variants of +% the environment in question). But the effort involved might be worth +% the convenience of not having to remember to pass an explicit optional +% argument to a large number of labels. +% +% You can use this trick to get different cross-reference formats for +% different theorem-like environments,\footnote{This trick seems to +% belong to \LaTeX{} mythology, and certainly isn't my own idea! But I +% haven't been able to definitively track down who originally came up +% with it.} \emph{without} using the \package{amsthm} or +% \package{ntheorem} package (although using one of those packages is a +% better solution if available). For example, +% \begin{quote} +% |\usepackage{aliascnt}|\\ +% |\usepackage{cleveref}|\\ +% |\newaliascnt{lemma}{theorem}|\\ +% |\newtheorem{lemma}[lemma]{Lemma}|\\ +% |\aliascntresetthe{lemma}|\\ +% |\crefname{lemma}{lemma}{lemmas}| +% \end{quote} +% Note that \package{aliascnt} must be loaded before \package{cleveref}, +% and any \cmd{\newaliascnt} commands \emph{must} come \emph{after} +% \package{cleveref} has been loaded. +% +% +% % \section{Options that Modify the Cross-Reference Format} % % \subsection{Capitalising All Cross-Reference Names} @@ -838,7 +917,7 @@ % will need to |\protect| fragile commands. It can (and almost certainly % should!) contain three arguments, |#1|, |#2| and |#3|. The first % argument is the formatted version of the label counter (e.g.\ -% |\theequation|). The other two are used to mark the beginning and end +% |\thesection|). The other two are used to mark the beginning and end % of the part of the cross-reference that should form the hyperlink when % the \package{hyperref} package is used (see % \cref{sec:other_packages}). For example, if you wanted to surround all @@ -1247,15 +1326,15 @@ % |\Crefrangemultiformat|\marg{type}\marg{first}\marg{second}\marg{middle}\marg{last} % \end{quote} % -% The \meta{type} is, as ever, the counter name, except for appendices, +% The \meta{type} is, as ever, the counter name (except for appendices, % explicitly overridden label types, and theorem-like environments when -% the \package{ntheorem} or \package{amsthm} packages are loaded. The +% the \package{ntheorem} or \package{amsthm} packages are loaded). The % same considerations apply to the formatting arguments \meta{first}, % \meta{second}, \meta{middle} and \meta{last} as for the \meta{format} % argument of |\crefformat| or |\crefrangeformat|, including the meaning % of the arguments that should appear in the formatting code (|#1|, |#2| % and |#3| for |\crefmultiformat| and |\Crefmultiformat|, |#1|--|#6| for -% |\crefmultiformat| and |\Crefmultiformat|). However, when the +% |\crefrangemultiformat| and |\Crefrangemultiformat|). However, when the % corresponding other-capitalisation variant is automatically defined, % only the first letter of the \meta{first} argument is upper- or % lower-cased; the other arguments are defined to be identical for both @@ -1263,11 +1342,11 @@ % % Be careful to get the spaces at the beginning and end of the formatting % code correct: the \meta{first} and \meta{second}, or \meta{first}, -% \meta{middle} and \meta{last}, \LaTeX{} code is typeset one after -% another in a multi-reference, with no space separating them. You may or -% may not want spaces at the beginning and end of the formatting code, -% depending on the formatting you desire. For example, in the default -% equation format: +% \meta{middle} and \meta{last}, \LaTeX{} code snippets are typeset one +% after another in a multi-reference, with no space separating them. You +% may or may not want spaces at the beginning or end of the formatting +% code, depending on the formatting you desire. For example, in the +% default equation format: % \begin{quote} % |\crefmultiformat{equation}{eqs.~(#2#1#3)}%|\\ % | { and~(#2#1#3)}{, (#2#1#3)}{ and~(#2#1#3)}| @@ -1293,8 +1372,43 @@ % % % -% \subsection{Language, \package{babel} and \package{polyglossia} -% support} +% \section{Advanced Cross-Reference Formating} +% When you define a custom cross-reference format using +% |\creflabelformat|, |\creformat| et al.\ (see \cref{sec:customising}), +% you're not merely defining a pattern with placeholders to be filled in. +% You're really defining the body of a LaTeX macro, with the formatted +% labels as arguments. This is a very powerful tool. It means that the +% only limit on how you can process the labels is your ability to code it +% in \TeX{}!\footnote{And since \TeX{} is Turing-complete, that means you +% can do anything you like short of solving the Halting Problem.} Which +% potentially allows for very sophisticated cross-reference formatting. +% +% One example of this is removing common prefixes from reference ranges. +% E.g.\ if you're numbering equations within sections, and |eq1|, |eq2| +% and |eq3| are all in the section 1.2, then you might want to typeset +% |\cref{eq1,eq2,eq3}| as ``eqs.~(1.2.1--3)'' instead of ``eqs.~(1.2.1) +% to~(1.2.3)''. Similarly, if |eq1a|, |eq1b| and |eq1c| are +% \package{amsmath} subequations, you might want to typeset +% |\cref{eq1a,eq1b,eq1c}| as ``eqs.~(1a--c)'' instead of ``eqs.~(1a) +% to~(1c)''. +% +% \package{Cleveref} provides a useful utility macro for this: +% |\crefstripprefix|, which takes two strings as arguments, and returns +% the second one with any common prefix stripped off. (However, the very +% last run of digits or letters in the string is retained in its +% entirety, even if it has a part in common.) With the help of this +% macro, you can produce the desired reference-range formatting with: +% \begin{quote} +% |\crefrangelabelformat{equation}|\\ +% | |\ding{229} |{(#3#1#4--#5\crefstripprefix{#1}{#2}#6)}|\\ +% |\crefrangelabelformat{subequation}|\\ +% | |\ding{229} |{(#3#1#4--#5\crefstripprefix{#1}{#2}#6)}| +% \end{quote} +% +% +% +% \section{Language, \package{babel} and \package{polyglossia} +% support} % \label{sec:language_babel} % \package{Cleveref} supports different languages via package options, in % the usual way, though not all languages are supported @@ -1344,8 +1458,12 @@ % \package{Cleveref} recognises these commands, so you should \emph{not} % pass language options to \package{cleveref} when using % \package{polyglossia}. (Passing language options to \package{cleveref}, -% either as package options of global options, will override the default +% either as package options or global options, will override the default % language set by \package{polyglossia}'s \cmd{\setdefaultlanguage}.) +% Note that the |\setdefaultlanguage| option \emph{must} come before +% \package{cleveref} is loaded, so that \package{cleveref} knows what +% default language you want. (If you don't do this, \package{cleveref} +% will generate a warning message in the log.) % % The \package{babel} and \package{polyglossia} support works by % redefining the cross-reference names and conjunctions for the default @@ -1389,9 +1507,12 @@ % and |\makeatother| to access them.) % % For example, if you wanted to redefine the equation format so that the -% cross-reference name (``equation'') was also part of the hyperlink, but -% you still want to be able to switch language using \package{babel} or -% \package{polyglossia}, you would need something like: +% cross-reference name (``equation'') was also part of the +% hyperlink,\footnote{This is merely as an example. Including names in +% hyperlinks is more easily accomplished by setting the +% \option{nameinlink} package option.} but you still want to be able to +% switch language using \package{babel} or \package{polyglossia}, you +% would need something like: % \begin{quote} % |\makeatletter|\\ % |\crefformat{equation}{#2\cref@equation@name~(#1)#3}|\\ @@ -1410,79 +1531,6 @@ % languages. This is probably what you want anyway. % % -% \section{Overriding the Cross-Reference Type} -% \label{sec:label_type} -% \DescribeMacro\label -% As described previously, a label's ``type'' is usually determined by -% its counter, or in the case of \package{ntheorem} or \package{amsthm} -% theorem-like environments by the environment name. However, sometimes -% it is useful to override the type. \package{Cleveref} provides two -% different mechanisms for accomplishing this. -% -% You can alias a counter to a different cross-reference type using the -% |\crefalias| command: -% \begin{quote} -% |\crefalias|\marg{counter}\marg{type} -% \end{quote} -% \meta{counter} will then use the cross-reference formatting of -% \meta{type}. This can be useful if you want multiple counters to use -% the same cross-reference format. -% -% Occasionally, you may want to override the cross-reference type for one -% particular label, one-off. You can do this by supplying the desired -% type as an optional argument to the |\label| command: -% \begin{quote} -% |\label|\oarg{type}\marg{label} -% \end{quote} -% -% One circumstance in which is useful is when you want to define a -% special cross-reference format for certain labels of a given type. By -% supplying a type that doesn't already exist as the optional argument to -% |\label|, you can then define the cross-reference format for that new -% type in whatever way you like, without affecting other cross-references -% of the same type. For example, if a particular equation contains -% multiple expressions and you want it to always be referred to in the -% plural, you could use: -% \begin{quote} -% |\crefname{pluralequation}{eqs.}{eqs.}|\\ -% \dots\\ -% |\label[pluralequation]{eq1}| -% \end{quote} -% You can of course reuse this format for other plural equations, too. -% -% If you need to do this frequently, it can become tedious specifying the -% label explicitly each time. An alternative is to use the -% \package{aliascnt} package. This lets you define one counter to be an -% alias for another, so that effectively the same counter has two names. -% Since \package{cleveref} determines the label type from the counter -% name, the two counter aliases can have different cross-reference -% formats whilst really being the same counter. You have to somehow -% arrange for the correct counter alias to be used depending on which -% cross-reference format you want (probably by defining two variants of -% the environment in question). But the effort involved might be worth -% the convenience of not having to remember to pass an explicit optional -% argument to a large number of labels. -% -% You can use this trick to get different cross-reference formats for -% different theorem-like environments,\footnote{This trick seems to -% belong to \LaTeX{} mythology, and certainly isn't my own idea! But I -% haven't been able to definitively track down who originally came up -% with it.} \emph{without} using the \package{amsthm} or -% \package{ntheorem} package (although using one of those packages is a -% better solution if available). For example, -% \begin{quote} -% |\usepackage{aliascnt}|\\ -% |\usepackage{cleveref}|\\ -% |\newaliascnt{lemma}{theorem}|\\ -% |\newtheorem{lemma}[lemma]{Lemma}|\\ -% |\aliascntresetthe{lemma}|\\ -% |\crefname{lemma}{lemma}{lemmas}| -% \end{quote} -% Note that \package{aliascnt} must be loaded before \package{cleveref}, -% and any \cmd{\newaliascnt} commands \emph{must} come \emph{after} -% \package{cleveref} has been loaded. -% -% % % \section{The \file{cleveref.cfg} File} % If \package{cleveref} finds a \file{cleveref.cfg} file somewhere in the @@ -1646,7 +1694,7 @@ % % % -% \section{Known Bugs, Non-Bugs, and Possible Future Enhancements} +% \section{Known Bugs, Non-Bugs, and Possible} % \label{sec:known_bugs} % % \subsection{Non-Bugs}\label{sec:non-bugs} @@ -1668,14 +1716,17 @@ % \package{amsthm} package. Also note that all |\newtheorem| % definitions must be placed \emph{after} the \package{cleveref} % package is loaded. -% \item If you are using \package{babel}, you \emph{must still} pass the -% appropriate language option to \package{cleveref}, as well as to -% \package{babel}. Passing it to \package{babel} alone is \emph{not} -% sufficient (you will get the default English cross-reference -% formats). The best way to set the document language is as a global -% option in the |\documentclass| line. (This is standard \LaTeX{} and -% \package{babel} practice -- read up on \LaTeX{}'s option handling for -% more detail.) +% \item Due to the way \TeX{} parses arguments, you have to be a little +% careful when using |\label| inside an optional argument to another +% command. |\label|\marg{label} will work, but trying to pass an +% optional argument |\label|\oarg{type}\marg{label} will fail. If you +% want to pass an optional argument to |\label| whilst already within +% an optional argument to some other command, you must surround the +% entire label command with braces: +% |{\label|\oarg{type}\marg{label}|}|. This crops up e.g.\ when adding +% labels to subfigure subcaptions in the \package{memoir} document +% class. A simpler solution in this particular case is to define the +% label in the subfigure body, instead of in the subcaption. % \item \package{Cleveref} will not work properly with the standard % \LaTeX{} |eqnarray| environment. There is no intention to fix this. % The |eqnarray| environment is poorly implemented, making it difficult @@ -1684,6 +1735,14 @@ % replacements, such as |gather|, |align|, |multline| and |split|, % which \emph{do} work properly with \package{cleveref}. (See % \url{http://www.tug.org/pracjourn/2006-4/madsen/}). +% \item If you are using \package{babel}, you \emph{must still} pass the +% appropriate language option to \package{cleveref}, as well as to +% \package{babel}. Passing it to \package{babel} alone is \emph{not} +% sufficient (you will get the default English cross-reference +% formats). The best way to set the document language is as a global +% option in the |\documentclass| line. (This is standard \LaTeX{} and +% \package{babel} practice -- read up on \LaTeX{}'s option handling for +% more detail.) % \item \package{Cleveref} can't cope with active characters being % present in cross-reference label names. For example, if French % \package{babel} support is loaded, the commonly used ``:'' in label @@ -1729,27 +1788,16 @@ % uses to produce the page references in its enhanced |\vref| command. % (This \emph{might} be improved in a future version by partially % overriding \package{hyperref}.) -% \item Due to the way \TeX{} parses arguments, you have to be a little -% careful when using |\label| inside an optional argument to another -% command. |\label|\marg{label} will work, but trying to pass an -% optional argument |\label|\oarg{type}\marg{label} will fail. If you -% want to pass an optional argument to |\label| whilst already within -% an optional argument to some other command, you must surround the -% entire label command with braces: -% |{\label|\oarg{type}\marg{label}|}|. This crops up e.g.\ when adding -% labels to subfigure subcaptions in the \package{memoir} document -% class. A simpler solution in this particular case is to define the -% label in the subfigure body, instead of in the subcaption. % \item \package{Cleveref} doesn't know about the \package{subfloat} % package, so you have to revert to using |\ref| for cross-references -% to sub-figures. (To be fixed in a future version.) +% to sub-figures. (Might be fixed in a future version.) % \item The \package{beamer} document class redefines the |\label| % command in a particularly devious way that breaks -% \package{cleveref}'s optional argument to that command. (To be fixed -% in a future version.) +% \package{cleveref}'s optional argument to that command. (Might be +% fixed in a future version.) % \item \package{Cleveref} is incompatible with the \option{showonlyrefs} % option of the \package{mathtools} package, though it should be -% compatible with the rest of \package{mathtools}. (To be fixed in a +% compatible with the rest of \package{mathtools}. (Might be fixed in a % future version.) The \package{autonum} package, which provides % similar functionality and \emph{is} designed to be % \package{cleveref}-compatible, is a possible alternative. @@ -1796,10 +1844,10 @@ % 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 +% 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, @@ -1816,10 +1864,10 @@ % % \clearpage % \section{Implementation} -% Essentially, the core of the implementation consists of causing an -% extra piece of information --- the label ``type'' --- to be written to -% the \file{aux} file, and defining \cmd{\cref} commands which use this -% extra information to typeset the cross-reference. +% Essentially, the core of the implementation consists of writing an +% extra piece of information --- the label ``type'' --- to the \file{aux} +% file, and defining \cmd{\cref} commands which use this extra +% information to typeset the cross-reference. % % The least invasive previous implementation of this kind of thing seems % to be that used by the \package{varioref} package. Namely, to redefine @@ -1870,11 +1918,11 @@ % \cmd{\refstepcounter} can also take an optional argument, which % always overrides the type. % \begin{macrocode} -\def\cref@currentlabel{} -\let\cref@old@refstepcounter\refstepcounter +\def\cref@currentlabel{}% +\let\cref@old@refstepcounter\refstepcounter% \def\refstepcounter{% \@ifnextchar[{\refstepcounter@optarg}{\refstepcounter@noarg}%] -} +}% \def\refstepcounter@noarg#1{% \cref@old@refstepcounter{#1}% \cref@constructprefix{#1}{\cref@result}% @@ -1883,13 +1931,16 @@ {\def\@tempa{\csname cref@#1@alias\endcsname}}% \protected@edef\cref@currentlabel{% [\@tempa][\arabic{#1}][\cref@result]% - \csname p@#1\endcsname\csname the#1\endcsname}} + \csname p@#1\endcsname\csname the#1\endcsname}}% \def\refstepcounter@optarg[#1]#2{% \cref@old@refstepcounter{#2}% \cref@constructprefix{#2}{\cref@result}% + \@ifundefined{cref@#1@alias}% + {\def\@tempa{#1}}% + {\def\@tempa{\csname cref@#1@alias\endcsname}}% \protected@edef\cref@currentlabel{% - [#1][\arabic{#2}][\cref@result]% - \csname p@#2\endcsname\csname the#2\endcsname}} + [\@tempa][\arabic{#2}][\cref@result]% + \csname p@#2\endcsname\csname the#2\endcsname}}% % \end{macrocode} % \end{macro} % \end{macro} @@ -1918,9 +1969,9 @@ % redefinitions. % \begin{macrocode} \AtBeginDocument{% - \let\cref@old@label\label + \let\cref@old@label\label% \def\label{\@ifnextchar[\label@optarg\label@noarg}%] - \let\cref@label\label + \let\cref@label\label% \def\label@noarg#1{% \@bsphack% \cref@old@label{#1}% @@ -1935,7 +1986,7 @@ \cref@currentlabel\@nil{#1}}% \protected@write\@auxout{}% {\string\newlabel{#2@cref}{{\cref@currentlabel}{\thepage}}}% - \@esphack} + \@esphack}% }% end of AtBeginDocument % \end{macrocode} % \end{macro} @@ -1955,13 +2006,13 @@ % \cmd{\@makefntext}, which gets called from within \cmd{\insert} by % both \cmd{\@footnotetext} and \cmd{\@mpfootnotentext}. % \begin{macrocode} -\let\cref@old@makefntext\@makefntext +\let\cref@old@makefntext\@makefntext% \long\def\@makefntext{% \cref@constructprefix{footnote}{\cref@result}% \protected@edef\cref@currentlabel{% [footnote][\arabic{footnote}][\cref@result]% \p@footnote\@thefnmark}% - \cref@old@makefntext} + \cref@old@makefntext}% % \end{macrocode} % \end{macro} % @@ -1978,8 +2029,8 @@ % \cmd{\newtheorem}. % % The catch is that, although the \cmd{\newtheorem} command provides -% the singular form, there's no way of reliably deducing the plural -% form from this. Rather than implement some half-baked attempt at this +% the singular form, there's no way of reliably deducing the correct +% plural form. Rather than implement some half-baked attempt at this % which will be wrong more often than it's right (especially in % languages other than English) and generally cause more trouble than % it's worth, we simply define the singular form but leave the plural @@ -2011,7 +2062,7 @@ % effort of getting the automatic definitions to work within the % document body. % \begin{macrocode} -\let\cref@old@othm\@othm +\let\cref@old@othm\@othm% \def\@othm#1[#2]#3{% \edef\@tempa{\expandafter\noexpand% \csname cref@#1@name@preamble\endcsname}% @@ -2033,8 +2084,8 @@ \@tempb\expandafter{\MakeUppercase #3}% \fi% \cref@stack@add{#1}{\cref@label@types}% - \cref@old@othm{#1}[#2]{#3}} -\let\cref@old@xnthm\@xnthm + \cref@old@othm{#1}[#2]{#3}}% +\let\cref@old@xnthm\@xnthm% \def\@xnthm#1#2[#3]{% \edef\@tempa{\expandafter\noexpand% \csname cref@#1@name@preamble\endcsname}% @@ -2056,8 +2107,8 @@ \@tempb\expandafter{\MakeUppercase #2}% \fi% \cref@stack@add{#1}{\cref@label@types}% - \cref@old@xnthm{#1}{#2}[#3]} -\let\cref@old@ynthm\@ynthm + \cref@old@xnthm{#1}{#2}[#3]}% +\let\cref@old@ynthm\@ynthm% \def\@ynthm#1#2{% \edef\@tempa{\expandafter\noexpand% \csname cref@#1@name@preamble\endcsname}% @@ -2079,7 +2130,7 @@ \@tempb\expandafter{\MakeUppercase #2}% \fi% \cref@stack@add{#1}{\cref@label@types}% - \cref@old@ynthm{#1}{#2}} + \cref@old@ynthm{#1}{#2}}% % \end{macrocode} % \end{macro} % \end{macro} @@ -2144,7 +2195,7 @@ {\def\@tempa{\csname cref@#1@alias\endcsname}}% \protected@edef\cref@currentlabel{% [\@tempa][\arabic{#1}][\cref@result]% - \csname p@#1\endcsname\csname the#1\endcsname} + \csname p@#1\endcsname\csname the#1\endcsname}% \fi% \fi% \fi}% @@ -2197,7 +2248,7 @@ {\def\@tempa{\csname cref@#1@alias\endcsname}}% \protected@edef\cref@currentlabel{% [\@tempa][\arabic{#1}][\cref@result]% - \csname p@#1\endcsname\csname the#1\endcsname} + \csname p@#1\endcsname\csname the#1\endcsname}% \fi% \fi% \fi% @@ -2218,8 +2269,8 @@ % optional argument. % \begin{macrocode} \def\@gobble@optarg{\@ifnextchar[\@@gobble@optarg\@gobble@orig}%] -\def\@gobble@orig#1{} -\def\@@gobble@optarg[#1]#2{} +\def\@gobble@orig#1{}% +\def\@@gobble@optarg[#1]#2{}% % \end{macrocode} % \end{macro} % @@ -2258,37 +2309,37 @@ \expandafter\expandafter\expandafter\def% \expandafter\expandafter\expandafter#2% \expandafter\expandafter\expandafter{% - \expandafter\@firstoftwo#2}} + \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}} + \expandafter\@secondoftwo#2}}% \def\cref@getlabel#1#2{% \cref@getref{#1}{\@tempa}% \expandafter\@cref@getlabel\@tempa\@nil#2}% \def\@cref@getlabel{\@ifnextchar[%] - \@@cref@getlabel{\@@cref@getlabel[][][]}} -\def\@@cref@getlabel[#1][#2][#3]#4\@nil#5{\def#5{#4}} + \@@cref@getlabel{\@@cref@getlabel[][][]}}% +\def\@@cref@getlabel[#1][#2][#3]#4\@nil#5{\def#5{#4}}% \def\cref@gettype#1#2{% \cref@getref{#1}{\@tempa}% \expandafter\@cref@gettype\@tempa\@nil#2}% \def\@cref@gettype{\@ifnextchar[%] - \@@cref@gettype{\@@cref@gettype[][][]}} -\def\@@cref@gettype[#1][#2][#3]#4\@nil#5{\def#5{#1}} + \@@cref@gettype{\@@cref@gettype[][][]}}% +\def\@@cref@gettype[#1][#2][#3]#4\@nil#5{\def#5{#1}}% \def\cref@getcounter#1#2{% \cref@getref{#1}{\@tempa}% - \expandafter\@cref@getcounter\@tempa\@nil#2} + \expandafter\@cref@getcounter\@tempa\@nil#2}% \def\@cref@getcounter{\@ifnextchar[%] - \@@cref@getcounter{\@@cref@getcounter[][][]}} -\def\@@cref@getcounter[#1][#2][#3]#4\@nil#5{\def#5{#2}} + \@@cref@getcounter{\@@cref@getcounter[][][]}}% +\def\@@cref@getcounter[#1][#2][#3]#4\@nil#5{\def#5{#2}}% \def\cref@getprefix#1#2{% \cref@getref{#1}{\@tempa}% - \expandafter\@cref@getprefix\@tempa\@nil#2} + \expandafter\@cref@getprefix\@tempa\@nil#2}% \def\@cref@getprefix{\@ifnextchar[%] - \@@cref@getprefix{\@@cref@getprefix[][][]}} -\def\@@cref@getprefix[#1][#2][#3]#4\@nil#5{\def#5{#3}} + \@@cref@getprefix{\@@cref@getprefix[][][]}}% +\def\@@cref@getprefix[#1][#2][#3]#4\@nil#5{\def#5{#3}}% % \end{macrocode} % \end{macro} % \end{macro} @@ -2299,7 +2350,7 @@ % the label type stored in \cmd{\cref@currentlabel}. % \begin{macro}{\cref@override@label@type} % \begin{macrocode} -\def\cref@override@label@type[#1][#2][#3]#4\@nil#5{[#5][#2][#3]#4} +\def\cref@override@label@type[#1][#2][#3]#4\@nil#5{[#5][#2][#3]#4}% % \end{macrocode} % \end{macro} % @@ -2325,13 +2376,13 @@ \cref@stack@init{\@tempstack}% % \end{macrocode} % We fully expand the first argument (the counter name) because sometimes -% a counter name containing a macro gets passed to us. +% we get passed a counter name containing a macro. % \begin{macrocode} \edef\@tempa{\noexpand{#1\noexpand}}% \expandafter\def\expandafter\@tempa\expandafter{\@tempa{#2}}% \expandafter\@cref@constructprefix\@tempa% \cref@stack@to@list{\@tempstack}{\@tempa}% - \expandafter\def\expandafter#2\expandafter{\@tempa}} + \expandafter\def\expandafter#2\expandafter{\@tempa}}% \def\@cref@constructprefix#1#2{% \cref@resetby{#1}{#2}% \ifx#2\relax% @@ -2341,7 +2392,7 @@ \edef\@tempa{{#2}}% \expandafter\expandafter\expandafter\@cref@constructprefix% \expandafter\@tempa\expandafter{\expandafter#2\expandafter}% - \fi} + \fi}% % \end{macrocode} % \end{macro} % @@ -2359,16 +2410,16 @@ % utility macros for manipulating stacks (\cmd{\@nil} is used as an % end-of-stack delimiter). % \begin{macrocode} -\def\cref@stack@init#1{\def#1{\@nil}} -\def\cref@stack@top#1{\expandafter\@cref@stack@top#1} -\def\@cref@stack@top#1,#2\@nil{#1} -\def\cref@stack@pop#1{\expandafter\@cref@stack@pop#1#1} -\def\@cref@stack@pop#1,#2\@nil#3{\def#3{#2\@nil}} +\def\cref@stack@init#1{\def#1{\@nil}}% +\def\cref@stack@top#1{\expandafter\@cref@stack@top#1}% +\def\@cref@stack@top#1,#2\@nil{#1}% +\def\cref@stack@pop#1{\expandafter\@cref@stack@pop#1#1}% +\def\@cref@stack@pop#1,#2\@nil#3{\def#3{#2\@nil}}% \def\cref@stack@push#1#2{% - \expandafter\@cref@stack@push\expandafter{#2}{#1}{#2}} -\def\@cref@stack@push#1#2#3{\def#3{#2,#1}} -\def\cref@stack@pull#1#2{\expandafter\@cref@stack@pull#2{#1}{#2}} -\def\@cref@stack@pull#1\@nil#2#3{\def#3{#1#2,\@nil}} + \expandafter\@cref@stack@push\expandafter{#2}{#1}{#2}}% +\def\@cref@stack@push#1#2#3{\def#3{#2,#1}}% +\def\cref@stack@pull#1#2{\expandafter\@cref@stack@pull#2{#1}{#2}}% +\def\@cref@stack@pull#1\@nil#2#3{\def#3{#1#2,\@nil}}% \def\cref@stack@to@list#1#2{% \cref@isstackfull{#1}% \if@cref@stackfull% @@ -2378,8 +2429,8 @@ \expandafter\@cref@stack@to@list#1}% \else% \def#2{}% - \fi} -\def\@cref@stack@to@list#1,\@nil{#1} + \fi}% +\def\@cref@stack@to@list#1,\@nil{#1}% \def\cref@stack@topandbottom#1#2#3{% \def#2{}% \def#3{}% @@ -2392,7 +2443,7 @@ \edef#3{\cref@stack@top{#1}}% \cref@stack@pop{#1}% \cref@isstackfull{#1}}% - \fi} + \fi}% \def\cref@stack@add#1#2{% \begingroup% \def\@arg1{#1}% @@ -2411,7 +2462,7 @@ \cref@isstackfull{\@tempstack}% \fi}% \expandafter\endgroup% - \if@notthere\cref@stack@push{#1}{#2}\fi} + \if@notthere\cref@stack@push{#1}{#2}\fi}% % \end{macrocode} % \end{macro} % \end{macro} @@ -2430,16 +2481,16 @@ % corresponding conditionals\linebreak[4] |\if@cref@stackempty| and % |\if@cref@stackfull|. % \begin{macrocode} -\newif\if@cref@stackempty -\newif\if@cref@stackfull +\newif\if@cref@stackempty% +\newif\if@cref@stackfull% \def\cref@isstackempty#1{% \def\@tempa{\@nil}% \ifx#1\@tempa\@cref@stackemptytrue% - \else\@cref@stackemptyfalse\fi} + \else\@cref@stackemptyfalse\fi}% \def\cref@isstackfull#1{% \def\@tempa{\@nil}% \ifx#1\@tempa\@cref@stackfullfalse% - \else\@cref@stackfulltrue\fi} + \else\@cref@stackfulltrue\fi}% % \end{macrocode} % \end{macro} % \end{macro} @@ -2453,7 +2504,7 @@ % 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 % more complicated $O(n\log n)$ sorting algorithm will very likely be -% slower anyway in practice. +% slower anyway. % \begin{macrocode} \def\cref@stack@sort#1#2{% \begingroup% @@ -2516,7 +2567,7 @@ \expandafter\cref@stack@insert\@tempa% \cref@isstackfull{#1}}% \expandafter\endgroup\expandafter% - \def\expandafter#1\expandafter{\@sortstack}} + \def\expandafter#1\expandafter{\@sortstack}}% % \end{macrocode} % \end{macro} % @@ -2528,7 +2579,7 @@ \def\cref@stack@insert#1#2#3#4{% \let\@cmp#4% \@cref@stack@insert{}{#1}{#2}{#3}% - \cref@stack@pop{#3}} + \cref@stack@pop{#3}}% % \end{macrocode} % \end{macro} % \begin{macro}{\@cref@stack@insert} @@ -2554,7 +2605,7 @@ {\expandafter\@cref@stack@insert\cref@elem}% \fi% \fi% - \cref@iterate} + \cref@iterate}% % \end{macrocode} % \end{macro} % @@ -2568,8 +2619,8 @@ % if the first comes later than the second. This is used later for % sorting references. % \begin{macrocode} -\def\cref@counter@first#1#2\@nil{#1} -\def\cref@counter@rest#1#2\@nil{#2} +\def\cref@counter@first#1#2\@nil{#1}% +\def\cref@counter@rest#1#2\@nil{#2}% \def\cref@countercmp#1#2#3{% \begingroup% \def\@tempa{#1}% @@ -2622,7 +2673,7 @@ \fi% \fi% \expandafter\endgroup\expandafter% - \chardef\expandafter#3\expandafter=\cref@result\relax} + \chardef\expandafter#3\expandafter=\cref@result\relax}% % \end{macrocode} % \end{macro} % \begin{macro}{\@cref@countercmp} @@ -2660,7 +2711,7 @@ \fi% \fi% \fi% - \@iterate} + \@iterate}% % \end{macrocode} % \end{macro} % @@ -2715,7 +2766,7 @@ \fi% \fi% \expandafter\endgroup\expandafter% - \chardef\expandafter#3\expandafter=\cref@result\relax} + \chardef\expandafter#3\expandafter=\cref@result\relax}% % \end{macrocode} % \end{macro} % @@ -2735,7 +2786,7 @@ % (The value is returned by defining its second argument, which should % be a macro name.) % \begin{macrocode} -\newif\if@cref@inresetlist +\newif\if@cref@inresetlist% \def\cref@isinresetlist#1#2{% \begingroup% \def\@counter{#1}% @@ -2768,7 +2819,7 @@ \fi% \expandafter% \endgroup% - \@next} + \@next}% % \end{macrocode} % % FIXME: We could easily remove the hard-coded search order in @@ -2803,12 +2854,11 @@ % is defined, check if it's reset by that. The |parentequation| counter % is used by \package{amsmath}'s |subequations| environment. Although % \package{amsmath} doesn't implement |subequations| using counter reset -% lists, \package{cleveref}'s \package{amsmath} support (above) tweaks -% the reset lists inside |subequations| environments to hook into this -% mechanism. We should really only check this when \package{amsmath} is -% loaded, but checking it anyway might catch other packages that -% independently implement amsmath's |subequations| environment (are there -% any?). +% lists, \package{cleveref}'s \package{amsmath} support tweaks the reset +% lists inside |subequations| environments to hook into this mechanism. +% We should really only check this when \package{amsmath} is loaded, but +% checking it anyway might catch other packages that independently +% implement amsmath's |subequations| environment (are there any?). % \begin{macrocode} \@ifundefined{cl@parentequation}{}{% \def\@tempa{#1}% @@ -2907,7 +2957,7 @@ \fi% \fi% \fi% - \fi} + \fi}% % \end{macrocode} % \end{macro} % \end{macro} @@ -2946,7 +2996,7 @@ \fi% \fi% \fi% - \expandafter\endgroup\@after} + \expandafter\endgroup\@after}% % \end{macrocode} % \end{macro} % \end{macro} @@ -2973,7 +3023,7 @@ \def\@after{\@cref@refconsecutivetrue}% \fi% \fi% - \expandafter\endgroup\@after} + \expandafter\endgroup\@after}% % \end{macrocode} % \end{macro} % @@ -3034,7 +3084,7 @@ \fi% \fi% \fi}% -} +}% % \end{macrocode} % \end{macro} % @@ -3101,7 +3151,7 @@ \let\@lasttype\@nexttype% \let\@lastformat\@nextformat% \cref@isstackfull{#1}}% - \let#1\@tempstack} + \let#1\@tempstack}% % \end{macrocode} % \end{macro} % @@ -3202,7 +3252,114 @@ \fi% \fi% \fi}% - \fi} + \fi}% +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{Prefix-stripping} +% \begin{macro}{\crefstripprefix} +% The \cmd{\crefstripprefix} utility command is intended for use in +% cross-reference format definitions. It takes two strings of +% characters as arguments, and strips any common prefix from the second +% argument. The common prefix is only stripped up to the last sequence +% of digits or letters in the second argument. +% \begin{macrocode} +\newcommand\crefstripprefix[2]{% + \begingroup% + \edef\@toksa{#1}% + \edef\@toksb{#2}% + \let\cref@acc\@empty% + \@crefstripprefix% + \cref@result% + \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 +% from the second string (plus any accumulated characters of the same +% type) when it encounters the first non-matching character; +% \begin{macrocode} +\def\@crefstripprefix{% + \let\@iterate\relax% + \def\accum@flag{0}% +% \end{macrocode} +% Pop next characters from |\@toksa| and |\@toksb| string into |\@tempa| +% and |\@tempb|, storing previous b-string character in |\@tempc|. +% \begin{macrocode} + \let\@tempc\@tempb% + \cref@poptok{\@toksa}{\@tempa}% + \cref@poptok{\@toksb}{\@tempb}% +% \end{macrocode} +% If characters match, drop character and proceed to next. +% \begin{macrocode} + \ifx\@tempa\@tempb\relax% + \def\@iterate{\@crefstripprefix}% +% \end{macrocode} +% Accumulate popped character if accumulated string is empty\dots +% \begin{macrocode} + \ifx\cref@acc\@empty\relax% + \let\cref@acc\@tempb% + \else% +% \end{macrocode} +% or if it has same catcode as previous character, and is either a +% letter\dots +% \begin{macrocode} + \ifcat\@tempb\@tempc\relax% + \ifcat\@tempb a\relax% + \def\accum@flag{1}% + \else% +% \end{macrocode} +% or a digit. +% \begin{macrocode} + \expandafter\chardef\expandafter\@tempa% + \expandafter=\expandafter`\@tempb\relax% + \ifnum\@tempa>`/\relax% + \expandafter\ifnum\@tempb<`:\relax% + \def\accum@flag{1}% + \fi% + \fi% + \fi% + \fi% + \def\@tempa{1}% + \ifx\accum@flag\@tempa% + \edef\cref@acc{\cref@acc\@tempb}% + \else% + \let\cref@acc\@empty% + \fi% + \fi% +% \end{macrocode} +% If characters don't match, return remaining characters from b-string, +% prepending any accumulated characters. +% \begin{macrocode} + \else% + \ifcat\@tempb\@tempc\relax\else% + \let\cref@acc\@empty% + \fi% + \edef\cref@result{\cref@acc\@tempb\@toksb}% + \fi% + \@iterate} +% \end{macrocode} +% +% \begin{macro}{\cref@poptok} +% The \cmd{\cref@poptok} macro takes two arguments, both macros. It +% defines |#2| to be the first token in |#1|'s expansion, and removes +% that token from |#1|'s definition. +% \begin{macrocode} +\def\cref@poptok#1#2{% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter#2% + \expandafter\expandafter\expandafter{% + \expandafter\@cref@firsttok#1\@nil}% + \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} % \end{macrocode} % \end{macro} % @@ -3217,10 +3374,10 @@ % start-of-sentence variant \cmd{\Cref}, along with the reference range % commands \cmd{\crefrange} and \cmd{\Crefrange}. % \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{\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}{}}% % \end{macrocode} % \end{macro} % \end{macro} @@ -3237,7 +3394,7 @@ % |\if@crefstarred| inside a nested if. % \begin{macrocode} \@ifpackageloaded{hyperref}{\newif\if@crefstarred}{% - \@ifpackageloaded{varioref}{\newif\if@crefstarred}{}} + \@ifpackageloaded{varioref}{\newif\if@crefstarred}{}}% \let\if@crefstarred\iffalse% % \end{macrocode} % \end{macro} @@ -3453,7 +3610,7 @@ \fi% \fi% }% end loop over main reference stack - \endgroup} + \endgroup}% % \end{macrocode} % \end{macro} % @@ -3494,7 +3651,7 @@ \expandafter\@@setcref\expandafter% {\csname #2@\@temptype @format#3\endcsname}{#1}% \fi% - \fi} + \fi}% % \end{macrocode} % \end{macro} % @@ -3503,7 +3660,7 @@ % 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} % @@ -3585,12 +3742,13 @@ \protect\G@refundefinedtrue% \nfss@text{\reset@font\bfseries ??}~\@labela--\@labelb% \@latex@warning{References `#1' and `#2' in reference range - on page \thepage have different types}% + on page \thepage \space have different types + `\@typea' and `\@typeb'}% \fi% \fi% \fi% \fi% - \endgroup} + \endgroup}% % \end{macrocode} % \end{macro} % @@ -3602,7 +3760,7 @@ \def\@@setcrefrange#1#2#3{% \cref@getlabel{#2}{\@labela}% \cref@getlabel{#3}{\@labelb}% - #1{\@labela}{\@labelb}{}{}{}{}} + #1{\@labela}{\@labelb}{}{}{}{}}% % \end{macrocode} % \end{macro} % @@ -3610,9 +3768,9 @@ % The typesetting of conjunctions is also separated out into separate % macros, for the same reason. % \begin{macrocode} -\def\@setcref@pairgroupconjunction{\crefpairgroupconjunction} -\def\@setcref@middlegroupconjunction{\crefmiddlegroupconjunction} -\def\@setcref@lastgroupconjunction{\creflastgroupconjunction} +\def\@setcref@pairgroupconjunction{\crefpairgroupconjunction}% +\def\@setcref@middlegroupconjunction{\crefmiddlegroupconjunction}% +\def\@setcref@lastgroupconjunction{\creflastgroupconjunction}% % \end{macrocode} % % \begin{macro}{\labelcref} @@ -3633,19 +3791,19 @@ % \cmd{\lcnamecrefs} commands which force the reference name to % lowercase, for use when the \option{capitalise} option is enabled. % \begin{macrocode} -\DeclareRobustCommand{\labelcref}[1]{\@cref{labelcref}{#1}} +\DeclareRobustCommand{\labelcref}[1]{\@cref{labelcref}{#1}}% \DeclareRobustCommand{\namecref}[1]{% - \@setnamecref{cref}{#1}{}{}} + \@setnamecref{cref}{#1}{}{}}% \DeclareRobustCommand{\nameCref}[1]{% - \@setnamecref{Cref}{#1}{}{}} + \@setnamecref{Cref}{#1}{}{}}% \DeclareRobustCommand{\lcnamecref}[1]{% - \@setnamecref{Cref}{#1}{}{\MakeLowercase}} + \@setnamecref{Cref}{#1}{}{\MakeLowercase}}% \DeclareRobustCommand{\namecrefs}[1]{% - \@setnamecref{cref}{#1}{@plural}{}} + \@setnamecref{cref}{#1}{@plural}{}}% \DeclareRobustCommand{\nameCrefs}[1]{% - \@setnamecref{Cref}{#1}{@plural}{}} + \@setnamecref{Cref}{#1}{@plural}{}}% \DeclareRobustCommand{\lcnamecrefs}[1]{% - \@setnamecref{Cref}{#1}{@plural}{\MakeLowercase}} + \@setnamecref{Cref}{#1}{@plural}{\MakeLowercase}}% % \end{macrocode} % \end{macro} % \end{macro} @@ -3667,16 +3825,15 @@ \else% \cref@gettype{#2}{\@tempa}% \@ifundefined{#1@\@tempa @name#3}{% - \protect\G@refundefinedtrue%`` + \protect\G@refundefinedtrue% \nfss@text{\reset@font\bfseries ??}% - \@latex@warning{Reference name for - label type `\@tempa' undefined}% + \@latex@warning{Reference name forlabel type `\@tempa' undefined}% }{% \edef\@tempa{% \expandafter\noexpand\csname #1@\@tempa @name#3\endcsname}% \expandafter\@@setnamecref\expandafter{\@tempa}{#4}% }% - \fi} + \fi}% % \end{macrocode} % \end{macro} % @@ -3686,7 +3843,7 @@ % \begin{macrocode} \def\@@setnamecref#1#2{% \expandafter\def\expandafter\@tempa\expandafter{#1}% - \expandafter#2\@tempa} + \expandafter#2\@tempa}% % \end{macrocode} % \end{macro} % @@ -3704,15 +3861,15 @@ % \cmd{\labelcref}). % \begin{macrocode} \DeclareRobustCommand{\cpageref}[1]{% - \@cpageref{cref}{#1}{\@setcpageref}{\@setcpagerefrange}} + \@cpageref{cref}{#1}{\@setcpageref}{\@setcpagerefrange}}% \DeclareRobustCommand{\Cpageref}[1]{% - \@cpageref{Cref}{#1}{\@setcpageref}{\@setcpagerefrange}} + \@cpageref{Cref}{#1}{\@setcpageref}{\@setcpagerefrange}}% \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}} + \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}}% % \end{macrocode} % \end{macro} % \end{macro} @@ -3867,7 +4024,7 @@ \advance\count@group 1% \cref@isstackfull{\@refstack}% }% end loop over reference stack - \endgroup} + \endgroup}% % \end{macrocode} % \end{macro} % @@ -3907,7 +4064,7 @@ \expandafter\@@setcpageref\expandafter% {\csname #2@page@format#3\endcsname}{#1}% \fi% - \fi} + \fi}% % \end{macrocode} % \end{macro} % @@ -3917,7 +4074,7 @@ % them work with the \package{hyperref} package. % \begin{macrocode} \def\@@setcpageref#1#2{% - \cref@getpageref{#2}{\@temppage}#1{\@temppage}{}{}} + \cref@getpageref{#2}{\@temppage}#1{\@temppage}{}{}}% % \end{macrocode} % \end{macro} % @@ -3984,7 +4141,7 @@ \fi% \fi% \fi% - \endgroup} + \endgroup}% % \end{macrocode} % \end{macro} % @@ -3996,7 +4153,7 @@ \def\@@setcpagerefrange#1#2#3{% \cref@getpageref{#2}{\@pagea}% \cref@getpageref{#3}{\@pageb}% - #1{\@pagea}{\@pageb}{}{}{}{}} + #1{\@pagea}{\@pageb}{}{}{}{}}% % \end{macrocode} % \end{macro} % @@ -4017,7 +4174,7 @@ % some formats may needlessly be redefined identically, multiple times. % % \begin{macrocode} -\cref@stack@init{\cref@label@types} +\cref@stack@init{\cref@label@types}% % \end{macrocode} % \end{macro} % @@ -4033,19 +4190,19 @@ % \cmd{\Crefname} define it to be a version with the first letter % capitalised or lower-cased, respectively. % \begin{macrocode} -\newcommand{\crefdefaultlabelformat}[1]{% - \def\cref@default@label##1##2##3{#1}} -\newcommand{\crefname}[3]{% - \@crefname{cref}{#1}{#2}{#3}{}} -\newcommand{\Crefname}[3]{% - \@crefname{Cref}{#1}{#2}{#3}{}} -\newcommand{\creflabelformat}[2]{% +\newcommand\crefdefaultlabelformat[1]{% + \def\cref@default@label##1##2##3{#1}}% +\newcommand\crefname[3]{% + \@crefname{cref}{#1}{#2}{#3}{}}% +\newcommand\Crefname[3]{% + \@crefname{Cref}{#1}{#2}{#3}{}}% +\newcommand\creflabelformat[2]{% \expandafter\def\csname cref@#1@label\endcsname##1##2##3{#2}% - \cref@stack@add{#1}{\cref@label@types}} -\newcommand{\crefrangelabelformat}[2]{% + \cref@stack@add{#1}{\cref@label@types}}% +\newcommand\crefrangelabelformat[2]{% \expandafter\def\csname cref@#1@rangelabel\endcsname% ##1##2##3##4##5##6{#2}% - \cref@stack@add{#1}{\cref@label@types}} + \cref@stack@add{#1}{\cref@label@types}}% % \end{macrocode} % \end{macro} % \end{macro} @@ -4058,8 +4215,8 @@ % cross-reference type, so can be used to make the same cross-reference % format apply to multiple different counters. %\begin{macrocode} -\newcommand{\crefalias}[2]{% - \expandafter\def\csname cref@#1@alias\endcsname{#2}} +\newcommand\crefalias[2]{% + \expandafter\def\csname cref@#1@alias\endcsname{#2}}% % \end{macrocode} % \end{macro} % @@ -4071,10 +4228,10 @@ % They are used when defining the default formats for different % languages (see \cref{sec:code:babel}). %\begin{macrocode} -\newcommand{\crefname@preamble}[3]{% - \@crefname{cref}{#1}{#2}{#3}{@preamble}} -\newcommand{\Crefname@preamble}[3]{% - \@crefname{Cref}{#1}{#2}{#3}{@preamble}} +\newcommand\crefname@preamble[3]{% + \@crefname{cref}{#1}{#2}{#3}{@preamble}}% +\newcommand\Crefname@preamble[3]{% + \@crefname{Cref}{#1}{#2}{#3}{@preamble}}% % \end{macrocode} % \end{macro} % \end{macro} @@ -4089,7 +4246,7 @@ % first character of \#1 is ``c'' for the lower-case variant and ``C'' % for the upper-case one. % \begin{macrocode} -\def\cref@othervariant#1#2#3{\cref@@othervariant#1\@nil#2#3} +\def\cref@othervariant#1#2#3{\cref@@othervariant#1\@nil#2#3}% \def\cref@@othervariant#1#2\@nil#3#4{% \if#1c% \def#3{C#2}% @@ -4101,7 +4258,7 @@ \else% \def#4{\MakeLowercase}% \fi% - \fi} + \fi}% % \end{macrocode} % \end{macro} % @@ -4167,7 +4324,7 @@ % \end{macrocode} % Add label type to list of types that need defining from components. % \begin{macrocode} - \cref@stack@add{#2}{\cref@label@types}} + \cref@stack@add{#2}{\cref@label@types}}% % \end{macrocode} % \end{macro} % @@ -4324,7 +4481,7 @@ \let\@tempnameplural@range\@tempnameplural% \let\@tempNameplural@range\@tempNameplural% \fi% -} +}% % \end{macrocode} % \end{macro} % @@ -4376,7 +4533,7 @@ \@ifundefined{cref@#1@label}{}{% \@toksa={\labelcrefformat{#1}}% \expandafter\the\expandafter\@toksa\expandafter{\@templabel}}% - \endgroup} + \endgroup}% % \end{macrocode} % \end{macro} % @@ -4435,7 +4592,7 @@ \expandafter\the\expandafter\@toksa\expandafter{% \@temprangelabel}% \fi% - \endgroup} + \endgroup}% % \end{macrocode} % \end{macro} % @@ -4529,7 +4686,7 @@ \expandafter{\@templast}}% \@toksa={\labelcrefmultiformat{#1}}% \expandafter\the\expandafter\@toksa\the\@toksb}% - \endgroup} + \endgroup}% % \end{macrocode} % \end{macro} % @@ -4628,7 +4785,7 @@ \@toksa={\labelcrefrangemultiformat{#1}}% \expandafter\the\expandafter\@toksa\the\@toksb% \fi% - \endgroup} + \endgroup}% % \end{macrocode} % \end{macro} % @@ -4719,7 +4876,7 @@ \expandafter{\@temprangelast}}% \@toksa={\labelcrefrangemultiformat{default}}% \expandafter\the\expandafter\@toksa\the\@toksb% - \endgroup} + \endgroup}% % \end{macrocode} % \end{macro} % @@ -4731,7 +4888,7 @@ \@crefdefineformat{#1}% \@crefrangedefineformat{#1}% \@crefdefinemultiformat{#1}% - \@crefrangedefinemultiformat{#1}} + \@crefrangedefinemultiformat{#1}}% % \end{macrocode} % \end{macro} % @@ -4754,24 +4911,24 @@ % \cmd{\crefformat} variant is not already defined, they define it to % be a version with the first letter capitalised or lower-cased. % \begin{macrocode} -\newcommand{\crefformat}[2]{\@crefformat{cref}{#1}{#2}} -\newcommand{\Crefformat}[2]{\@crefformat{Cref}{#1}{#2}} -\newcommand{\crefrangeformat}[2]{\@crefrangeformat{crefrange}{#1}{#2}} -\newcommand{\Crefrangeformat}[2]{\@crefrangeformat{Crefrange}{#1}{#2}} -\newcommand{\crefmultiformat}[5]{% - \@crefmultiformat{cref}{#1}{#2}{#3}{#4}{#5}} -\newcommand{\Crefmultiformat}[5]{% - \@crefmultiformat{Cref}{#1}{#2}{#3}{#4}{#5}} -\newcommand{\crefrangemultiformat}[5]{% - \@crefrangemultiformat{crefrange}{#1}{#2}{#3}{#4}{#5}} -\newcommand{\Crefrangemultiformat}[5]{% - \@crefrangemultiformat{Crefrange}{#1}{#2}{#3}{#4}{#5}} -\newcommand{\labelcrefformat}[2]{% - \expandafter\gdef\csname labelcref@#1@format\endcsname##1##2##3{#2}} -\newcommand{\labelcrefrangeformat}[2]{% +\newcommand\crefformat[2]{\@crefformat{cref}{#1}{#2}}% +\newcommand\Crefformat[2]{\@crefformat{Cref}{#1}{#2}}% +\newcommand\crefrangeformat[2]{\@crefrangeformat{crefrange}{#1}{#2}}% +\newcommand\Crefrangeformat[2]{\@crefrangeformat{Crefrange}{#1}{#2}}% +\newcommand\crefmultiformat[5]{% + \@crefmultiformat{cref}{#1}{#2}{#3}{#4}{#5}}% +\newcommand\Crefmultiformat[5]{% + \@crefmultiformat{Cref}{#1}{#2}{#3}{#4}{#5}}% +\newcommand\crefrangemultiformat[5]{% + \@crefrangemultiformat{crefrange}{#1}{#2}{#3}{#4}{#5}}% +\newcommand\Crefrangemultiformat[5]{% + \@crefrangemultiformat{Crefrange}{#1}{#2}{#3}{#4}{#5}}% +\newcommand\labelcrefformat[2]{% + \expandafter\gdef\csname labelcref@#1@format\endcsname##1##2##3{#2}}% +\newcommand\labelcrefrangeformat[2]{% \expandafter\gdef\csname labelcrefrange@#1@format\endcsname% - ##1##2##3##4##5##6{#2}} -\newcommand{\labelcrefmultiformat}[5]{% + ##1##2##3##4##5##6{#2}}% +\newcommand\labelcrefmultiformat[5]{% \expandafter\gdef\csname labelcref@#1@format@first\endcsname% ##1##2##3{#2}% \expandafter\gdef\csname labelcref@#1@format@second\endcsname% @@ -4779,8 +4936,8 @@ \expandafter\gdef\csname labelcref@#1@format@middle\endcsname% ##1##2##3{#4}% \expandafter\gdef\csname labelcref@#1@format@last\endcsname% - ##1##2##3{#5}} -\newcommand{\labelcrefrangemultiformat}[5]{% + ##1##2##3{#5}}% +\newcommand\labelcrefrangemultiformat[5]{% \expandafter\gdef\csname labelcrefrange@#1@format@first\endcsname% ##1##2##3##4##5##6{#2}% \expandafter\gdef\csname labelcrefrange@#1@format@second\endcsname% @@ -4788,7 +4945,7 @@ \expandafter\gdef\csname labelcrefrange@#1@format@middle\endcsname% ##1##2##3##4##5##6{#4}% \expandafter\gdef\csname labelcrefrange@#1@format@last\endcsname% - ##1##2##3##4##5##6{#5}} + ##1##2##3##4##5##6{#5}}% % \end{macrocode} % \end{macro} % \end{macro} @@ -4841,7 +4998,7 @@ \expandafter\the\expandafter\@toksa\expandafter{% \@tempa{##1}{##2}{##3}}% }{}% - \endgroup} + \endgroup}% % \end{macrocode} % \end{macro} % @@ -4886,7 +5043,7 @@ \expandafter\the\expandafter\@toksa\expandafter{% \@tempa{##1}{##2}{##3}{##4}{##5}{##6}}% }{}% - \endgroup} + \endgroup}% % \end{macrocode} % \end{macro} % @@ -4959,7 +5116,7 @@ \expandafter\the\expandafter\@toksa% \csname #1@#2@format@last\endcsname% }{}% - \endgroup} + \endgroup}% % \end{macrocode} %\end{macro} % @@ -5038,7 +5195,7 @@ \expandafter\the\expandafter\@toksa% \csname #1@#2@format@last\endcsname% }{}% - \endgroup} + \endgroup}% % \end{macrocode} % \end{macro} % @@ -5054,22 +5211,40 @@ % override some of its redefinitions so that they work with % \package{cleveref}. % \begin{macrocode} -\let\if@cref@hyperrefloaded\iffalse +\let\if@cref@hyperrefloaded\iffalse% \@ifpackageloaded{hyperref}{% \@ifpackagewith{hyperref}{implicit=false}{}{% \let\if@cref@hyperrefloaded\iftrue% \PackageInfo{cleveref}{`hyperref' support loaded}% % \end{macrocode} -% \begin{macro}{\cref@hyperref} +% \begin{macro}{\cref@hyperlinkname} +% \begin{macro}{\cref@hyperlinkurl} % We define a utility macro to extract the hyperlink supplied by % \package{hyperref} (via the \file{aux} file). Note that -% \package{hyperref} adds the hyperlink information to the standard +% \package{hyperref} adds the hyperlink info to the standard % \cmd{\newlabel} line in the \file{aux} file, so we have to retrieve % it from the standard \cmd{\r@\meta{label}}, \emph{not} the one % suffixed with |@cref| that we've created ourselves. % \begin{macrocode} - \def\cref@hyperref#1{\expandafter\expandafter\expandafter% - \@fourthoffive\csname r@#1\endcsname} + \def\cref@hyperlinkname#1{\expandafter\expandafter\expandafter% + \@fourthoffive\csname r@#1\endcsname}% + \def\cref@hyperlinkurl#1{\expandafter\expandafter\expandafter% + \@fifthoffive\csname r@#1\endcsname}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cref@hyperlink} +% Because of the way the cross-referencing formatting commands work, we +% will need to use a delimited argument to specify the text to be +% turned into a hyperlink. So we define a variant of +% \package{hyperref}'s \cmd{\hyper@@link} command that takes the +% hyperlink text as an argument delimited by |\@nil|, instead of a +% standard argument. (We only ever need the |link| hyperlink type in +% \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}} % \end{macrocode} % \end{macro} % @@ -5082,7 +5257,7 @@ % \cmd{\H@refstepcounter} itself, in order to ensure that the extra % information we need is stored in \cmd{\cref@currentlabel}. % \begin{macrocode} - \let\cref@old@H@refstepcounter\H@refstepcounter + \let\cref@old@H@refstepcounter\H@refstepcounter% \def\H@refstepcounter#1{% \cref@old@H@refstepcounter{#1}% \cref@constructprefix{#1}{\cref@result}% @@ -5091,7 +5266,7 @@ {\def\@tempa{\csname cref@#1@alias\endcsname}}% \protected@edef\cref@currentlabel{% [\@tempa][\arabic{#1}][\cref@result]% - \csname p@#1\endcsname\csname the#1\endcsname}} + \csname p@#1\endcsname\csname the#1\endcsname}}% % \end{macrocode} % \end{macro} % @@ -5116,7 +5291,7 @@ \cref@old@refstepcounter{#2}% \protected@edef\cref@currentlabel{% \expandafter\cref@override@label@type% - \cref@currentlabel\@nil{#1}}} + \cref@currentlabel\@nil{#1}}}% % \end{macrocode} % \end{macro} % \end{macro} @@ -5172,7 +5347,7 @@ {\def\@tempa{\csname cref@#1@alias\endcsname}}% \protected@edef\cref@currentlabel{% [\@tempa][\arabic{#1}][\cref@result]% - \csname p@#1\endcsname\csname the#1\endcsname} + \csname p@#1\endcsname\csname the#1\endcsname}% \fi% \fi% \fi}% @@ -5225,7 +5400,7 @@ {\def\@tempa{\csname cref@#1@alias\endcsname}}% \protected@edef\cref@currentlabel{% [\@tempa][\arabic{#1}][\cref@result]% - \csname p@#1\endcsname\csname the#1\endcsname} + \csname p@#1\endcsname\csname the#1\endcsname}% \fi% \fi% \fi% @@ -5238,80 +5413,88 @@ % % \begin{macro}{\cref*} % \begin{macro}{\Cref*} -% \begin{macro}{\crefrange*} -% \begin{macro}{\Crefrange*} -% \begin{macro}{\cpageref*} -% \begin{macro}{\Cpageref*} -% \begin{macro}{\cpagerefrange*} -% \begin{macro}{\Cpagerefrange*} -% \begin{macro}{\labelcref*} -% \begin{macro}{\labelcpageref*} % \begin{macro}{\@crefstar} % \begin{macro}{\@crefnostar} -% \begin{macro}{\@crefrangestar} -% \begin{macro}{\@crefrangenostar} -% \begin{macro}{\@cpagerefstar} -% \begin{macro}{\@cpagerefnostar} -% \begin{macro}{\@cpagerefrangestar} -% \begin{macro}{\@cpagerefrangenostar} -% \begin{macro}{\@labelcrefstar} -% \begin{macro}{\@labelcrefnostar} -% \begin{macro}{\@labelcpagerefstar} -% \begin{macro}{\@labelcpagerefnostar} -% Redefine \cmd{\cref} and all the others to allow starred variants, +% 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). % \begin{macrocode} \DeclareRobustCommand{\cref}{% - \@ifstar{\@crefstar{cref}}{\@crefnostar{cref}}} + \@ifstar{\@crefstar{cref}}{\@crefnostar{cref}}}% \DeclareRobustCommand{\Cref}{% - \@ifstar{\@crefstar{Cref}}{\@crefnostar{Cref}}} - \def\@crefnostar#1#2{\@cref{#1}{#2}} + \@ifstar{\@crefstar{Cref}}{\@crefnostar{Cref}}}% + \def\@crefnostar#1#2{\@cref{#1}{#2}}% \def\@crefstar#1#2{% - \@crefstarredtrue\@cref{#1}{#2}\@crefstarredfalse} + \@crefstarredtrue\@cref{#1}{#2}\@crefstarredfalse}% +% \end{macrocode} +% \begin{macro}{\crefrange*} +% \begin{macro}{\Crefrange*} +% \begin{macro}{\@crefrangestar} +% \begin{macro}{\@crefrangenostar} +% \begin{macrocode} \DeclareRobustCommand{\crefrange}{% - \@ifstar{\@crefrangestar{cref}}{\@crefrangenostar{cref}}} + \@ifstar{\@crefrangestar{cref}}{\@crefrangenostar{cref}}}% \DeclareRobustCommand{\Crefrange}{% - \@ifstar{\@crefrangestar{Cref}}{\@crefrangenostar{Cref}}} - \def\@crefrangenostar#1#2#3{\@setcrefrange{#2}{#3}{#1}{}} + \@ifstar{\@crefrangestar{Cref}}{\@crefrangenostar{Cref}}}% + \def\@crefrangenostar#1#2#3{\@setcrefrange{#2}{#3}{#1}{}}% \def\@crefrangestar#1#2#3{% - \@crefstarredtrue\@setcrefrange{#2}{#3}{#1}{}\@crefstarredfalse} + \@crefstarredtrue\@setcrefrange{#2}{#3}{#1}{}\@crefstarredfalse}% +% \end{macrocode} +% \begin{macro}{\cpageref*} +% \begin{macro}{\Cpageref*} +% \begin{macro}{\@cpagerefstar} +% \begin{macro}{\@cpagerefnostar} +% \begin{macrocode} \DeclareRobustCommand{\cpageref}{% - \@ifstar{\@cpagerefstar{cref}}{\@cpagerefnostar{cref}}} + \@ifstar{\@cpagerefstar{cref}}{\@cpagerefnostar{cref}}}% \DeclareRobustCommand{\Cpageref}{% - \@ifstar{\@cpagerefstar{Cref}}{\@cpagerefnostar{Cref}}} + \@ifstar{\@cpagerefstar{Cref}}{\@cpagerefnostar{Cref}}}% \def\@cpagerefnostar#1#2{% - \@cpageref{#1}{#2}{\@setcpageref}{\@setcpagerefrange}} + \@cpageref{#1}{#2}{\@setcpageref}{\@setcpagerefrange}}% \def\@cpagerefstar#1#2{% \@crefstarredtrue% \@cpageref{#1}{#2}{\@setcpageref}{\@setcpagerefrange}% - \@crefstarredfalse} + \@crefstarredfalse}% +% \end{macrocode} +% \begin{macro}{\cpagerefrange*} +% \begin{macro}{\Cpagerefrange*} +% \begin{macro}{\@cpagerefrangestar} +% \begin{macro}{\@cpagerefrangenostar} +% \begin{macrocode} \DeclareRobustCommand{\cpagerefrange}{% - \@ifstar{\@cpagerefrangestar{cref}}{\@cpagerefrangenostar{cref}}} + \@ifstar{\@cpagerefrangestar{cref}}{\@cpagerefrangenostar{cref}}}% \DeclareRobustCommand{\Cpagerefrange}{% - \@ifstar{\@cpagerefrangestar{Cref}}{\@cpagerefrangenostar{Cref}}} - \def\@cpagerefrangenostar#1#2#3{\@setcpagerefrange{#2}{#3}{#1}{}} + \@ifstar{\@cpagerefrangestar{Cref}}{\@cpagerefrangenostar{Cref}}}% + \def\@cpagerefrangenostar#1#2#3{\@setcpagerefrange{#2}{#3}{#1}{}}% \def\@cpagerefrangestar#1#2#3{% \@crefstarredtrue% \@setcpagerefrange{#2}{#3}{#1}{}% - \@crefstarredfalse} + \@crefstarredfalse}% +% \end{macrocode} +% \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}{\@labelcrefnostar}}% + \def\@labelcrefnostar#1{\@cref{labelcref}{#1}}% \def\@labelcrefstar#1{% \@crefstarredtrue% \@cref{labelcref}{#1}% - \@crefstarredfalse} + \@crefstarredfalse}% \DeclareRobustCommand{\labelcpageref}{% - \@ifstar{\@labelcpagerefstar}{\@labelcpagerefnostar}} + \@ifstar{\@labelcpagerefstar}{\@labelcpagerefnostar}}% \def\@labelcpagerefnostar#1{% - \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}} + \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}}% \def\@labelcpagerefstar#1{% \@crefstarredtrue% \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}% - \@crefstarredfalse} + \@crefstarredfalse}% % \end{macrocode} % \end{macro} % \end{macro} @@ -5350,46 +5533,52 @@ \if@crefstarred% #1{\@templabel}{}{}% \else% - \edef\@templink{\cref@hyperref{#2}}% - #1{\@templabel}{\hyper@linkstart{link}{\@templink}}% - {\hyper@linkend}% - \fi} + \edef\@tempname{\cref@hyperlinkname{#2}}% + \edef\@tempurl{\cref@hyperlinkurl{#2}}% + #1{\@templabel}{\cref@hyperlink{\@tempurl}{\@tempname}}{\@nil}% + \fi}% \def\@@setcrefrange#1#2#3{% \cref@getlabel{#2}{\@labela}% \cref@getlabel{#3}{\@labelb}% \if@crefstarred% #1{\@labela}{\@labelb}{}{}{}{}% \else% - \edef\@linka{\cref@hyperref{#2}}% - \edef\@linkb{\cref@hyperref{#3}}% + \edef\@tempnamea{\cref@hyperlinkname{#2}}% + \edef\@tempurlb{\cref@hyperlinkurl{#3}}% + \edef\@tempnameb{\cref@hyperlinkname{#3}}% + \edef\@tempurla{\cref@hyperlinkurl{#2}}% #1{\@labela}{\@labelb}% - {\hyper@linkstart{link}{\@linka}}{\hyper@linkend}% - {\hyper@linkstart{link}{\@linkb}}{\hyper@linkend}% + {\cref@hyperlink{\@tempurla}{\@tempnamea}}{\@nil}% + {\cref@hyperlink{\@tempurlb}{\@tempnameb}}{\@nil}% \fi}% \def\@@setcpageref#1#2{% \cref@getpageref{#2}{\@temppage}% \if@crefstarred% #1{\@temppage}{}{}% \else% - \edef\@templink{\cref@hyperref{#2}}% - #1{\@temppage}{\hyper@linkstart{link}{\@templink}}% - {\hyper@linkend}% - \fi} + \edef\@tempname{\cref@hyperlinkname{#2}}% + \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}% \if@crefstarred% #1{\@pagea}{\@pageb}{}{}{}{}% \else% - \edef\@linka{\cref@hyperref{#2}}% - \edef\@linkb{\cref@hyperref{#3}}% + \edef\@tempnamea{\cref@hyperlinkname{#2}}% + \edef\@tempurlb{\cref@hyperlinkurl{#3}}% + \edef\@tempnameb{\cref@hyperlinkname{#3}}% + \edef\@tempurla{\cref@hyperlinkurl{#2}}% #1{\@pagea}{\@pageb}% - {\hyper@linkstart{link}{\@linka}}{\hyper@linkend}% - {\hyper@linkstart{link}{\@linkb}}{\hyper@linkend}% + {\cref@hyperlink{\@tempurla}{\@tempnamea}}{\@nil}% + {\cref@hyperlink{\@tempurlb}{\@tempnameb}}{\@nil}% \fi}% }% end of false case of \@ifpackagewith{hyperref}{implicit=false} % \end{macrocode} % +% +% \subsubsection{\package{revtex4} and \package{revtex4-1} support} % The \package{revtex4} and \package{revtex4-1} document classes use % |\H@refstepcounter| to increment section counters, even when % \package{hyperref} isn't explicitly loaded. Therefore, for these @@ -5423,675 +5612,6 @@ % % % -% \subsubsection{\package{amsmath} support} -% \begin{macro}{amsmath} -% \begin{macro}{\label} -% \begin{macro}{\label@in@display} -% The \package{amsmath} package redefines the \cmd{\label} command -% within equation environments, so if it is loaded we have to extend -% the behaviour to support the optional argument. With -% \package{amsmath}, the original \cmd{\label} command is stored in -% \cmd{\ltx@label}, and \cmd{\label@in@display} replaces \cmd{\label} -% inside equations. \cmd{\label@in@display} just saves the label for -% later, and defining it is left until the end of the equation, when -% \cmd{\ltx@label} is finally called. -% -% To allow \cmd{\label} within equations to support an optional -% argument, we first store the original \cmd{\label@in@display} and the -% new \cmd{\label} macro we defined above (since \cmd{\label} will be -% clobbered inside equations). Then we redefine \cmd{\label@in@display} -% so that it wraps all its arguments, including any optional argument, -% in an extra set of braces. These are stripped away again by -% \cmd{\ltx@label} before calling the \package{cleveref} \cmd{\label} -% command we defined previously (saved in \cmd{\cref@label}). As -% before, we must postpone the redefinition of \cmd{\label} until the -% beginning of the document, since other packages do so. -% \begin{macrocode} -\@ifpackageloaded{amsmath}{% - \AtBeginDocument{ - \let\cref@old@label@in@display\label@in@display - \def\label@in@display{% - \@ifnextchar[\label@in@display@optarg\label@in@display@noarg}%] - \def\label@in@display@noarg#1{\cref@old@label@in@display{{#1}}} - \def\label@in@display@optarg[#1]#2{% - \cref@old@label@in@display{[#1]{#2}}} - \def\ltx@label#1{\cref@label#1} - }% end of AtBeginDocument -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\measure@} -% \begin{macro}{\gmeasure@} -% The \package{amsmath} multi-line equation environments scan their -% bodies twice: once to measure, once to typeset. In the measure phase, -% the \cmd{\label} command is disabled by letting it to \cmd{\@gobble}. -% 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. -% -% Unfortunately, \package{amsmath} wasn't designed with redefinitions -% of \cmd{\label} in mind, so there appears to be no safe way of doing -% this other than copying the \package{amsmath} definitions and making -% the modification directly in the macro's code. This is a recipe for -% future chaos if these commands are ever modified in a new version of -% \package{amsmath}, but it seems we have no choice. Luckily, -% \package{amsmath} isn't updated too often! -% \begin{macrocode} - \def\measure@#1{% - \begingroup - \measuring@true - \global\eqnshift@\z@ - \global\alignsep@\z@ - \global\let\tag@lengths\@empty - \global\let\field@lengths\@empty - \savecounters@ - \global\setbox0\vbox{% - \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 - \global\row@\z@ - \tabskip\z@ - \halign{\span\align@preamble\crcr - #1% - \math@cr@@@ - \global\column@\z@ - \add@amps\maxfields@\cr - }% - }% - \restorecounters@ - \ifodd\maxfields@ - \global\advance\maxfields@\@ne - \fi - \ifnum\xatlevel@=\tw@ - \ifnum\maxfields@<\thr@@ - \let\xatlevel@\z@ - \fi - \fi - \setbox\z@\vbox{% - \unvbox\z@ \unpenalty \global\setbox\@ne\lastbox - }% - \global\totwidth@\wd\@ne - \if@fleqn \global\advance\totwidth@\@mathmargin \fi - \global\let\maxcolumn@widths\@empty - \begingroup - \let\or\relax - \loop - \global\setbox\@ne\hbox{% - \unhbox\@ne \unskip \global\setbox\thr@@\lastbox - }% - \ifhbox\thr@@ - \xdef\maxcolumn@widths{ \or \the\wd\thr@@ \maxcolumn@widths}% - \repeat - \endgroup - \dimen@\displaywidth - \advance\dimen@-\totwidth@ - \ifcase\xatlevel@ - \global\alignsep@\z@ - \let\minalignsep\z@ - \@tempcntb\z@ - \if@fleqn - \@tempcnta\@ne - \global\eqnshift@\@mathmargin - \else - \@tempcnta\tw@ - \global\eqnshift@\dimen@ - \global\divide\eqnshift@\@tempcnta - \fi - \or - \@tempcntb\maxfields@ - \divide\@tempcntb\tw@ - \@tempcnta\@tempcntb - \advance\@tempcntb\m@ne - \if@fleqn - \global\eqnshift@\@mathmargin - \global\alignsep@\dimen@ - \global\divide\alignsep@\@tempcnta - \else - \global\advance\@tempcnta\@ne - \global\eqnshift@\dimen@ - \global\divide\eqnshift@\@tempcnta - \global\alignsep@\eqnshift@ - \fi - \or - \@tempcntb\maxfields@ - \divide\@tempcntb\tw@ - \global\advance\@tempcntb\m@ne - \global\@tempcnta\@tempcntb - \global\eqnshift@\z@ - \global\alignsep@\dimen@ - \if@fleqn - \global\advance\alignsep@\@mathmargin\relax - \fi - \global\divide\alignsep@\@tempcntb - \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@ - \fi - \fi - \fi - \ifdim\eqnshift@<\z@ - \global\eqnshift@\z@ - \fi - \calc@shift@align - \global\tagshift@\totwidth@ - \global\advance\tagshift@\@tempcntb\alignsep@ - \if@fleqn - \ifnum\xatlevel@=\tw@ - \global\advance\tagshift@-\@mathmargin\relax - \fi - \else - \global\advance\tagshift@\eqnshift@ - \fi - \iftagsleft@ \else - \global\advance\tagshift@-\displaywidth - \fi - \dimen@\minalignsep\relax - \global\advance\totwidth@\@tempcntb\dimen@ - \ifdim\totwidth@>\displaywidth - \global\let\displaywidth@\totwidth@ - \else - \global\let\displaywidth@\displaywidth - \fi - \endgroup - } - \def\gmeasure@#1{% - \begingroup - \measuring@true - \totwidth@\z@ - \global\let\tag@lengths\@empty - \savecounters@ - \setbox\@ne\vbox{% - \everycr{\noalign{\global\tag@false - \global\let\raise@tag\@empty \global\column@\z@}}% - \let\label\@gobble% <<< cleveref modification - \halign{% - \setboxz@h{$\m@th\displaystyle{##}$}% - \ifdim\wdz@>\totwidth@ - \global\totwidth@\wdz@ - \fi - &\setboxz@h{\strut@{##}}% - \savetaglength@ - \crcr - #1% - \math@cr@@@ - }% - }% - \restorecounters@ - \if@fleqn - \global\advance\totwidth@\@mathmargin - \fi - \iftagsleft@ - \ifdim\totwidth@>\displaywidth - \global\let\gdisplaywidth@\totwidth@ - \else - \global\let\gdisplaywidth@\displaywidth - \fi - \fi - \endgroup -} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\multline@} -% \begin{macro}{\mmeasure@} -% \begin{macro}{\label@mmeasure@noarg} -% \begin{macro}{\label@mmeasure@optarg} -% The |multline| environment works a bit differently to the other -% \package{amsmath} environments, in that \cmd{\label} is -% \emph{disabled} during the typesetting phase, and \emph{enabled} -% during the measuring phase. To cope with \package{cleveref}'s -% optional argument, we have to define separate versions of -% \cmd{\label@in@display} specifically for \cmd{\mmeasure@}. -% \begin{macrocode} - \def\multline@#1{% - \Let@ - \@display@init{\global\advance\row@\@ne \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 - \tabskip \if@fleqn \@mathmargin \else \z@skip \fi - \totwidth@\displaywidth - \if@fleqn - \advance\totwidth@-\@mathmargin - \fi - \halign\bgroup - \hbox to\totwidth@{% - \if@fleqn - \hskip \@centering \relax - \else - \hfil - \fi - \strut@ - $\m@th\displaystyle{}##\endmultline@math - \hfil - }% $ - \crcr - \if@fleqn - \hskip-\@mathmargin - \def\multline@indent{\hskip\@mathmargin}% - \else - \hfilneg - \def\multline@indent{\hskip\multlinegap}% - \fi - \iftagsleft@ - \iftag@ - \begingroup - \ifshifttag@ - \rlap{\vbox{% - \normalbaselines - \hbox{% - \strut@ - \make@display@tag - }% - \vbox to\lineht@{}% - \raise@tag - }}% - \multline@indent - \else - \setbox\z@\hbox{\make@display@tag}% - \dimen@\@mathmargin \advance\dimen@-\wd\z@ - \ifdim\dimen@<\multlinetaggap - \dimen@\multlinetaggap - \fi - \box\z@ \hskip\dimen@\relax - \fi - \endgroup - \else - \multline@indent - \fi - \else - \multline@indent - \fi - #1% - } - \def\mmeasure@#1{% - \begingroup - \measuring@true - \def\label{% <<< cleveref modification - \@ifnextchar[\label@in@mmeasure@optarg%] - \label@in@mmeasure@noarg}% - \def\math@cr@@@{\cr}% - \let\shoveleft\@iden \let\shoveright\@iden - \savecounters@ - \global\row@\z@ - \setbox\@ne\vbox{% - \global\let\df@tag\@empty - \halign{% - \setboxz@h{\@lign$\m@th\displaystyle{}##$}% - \iftagsleft@ - \ifnum\row@=\@ne - \global\totwidth@\wdz@ - \global\lineht@\ht\z@ - \fi - \else - \global\totwidth@\wdz@ - \global\lineht@\dp\z@ - \fi - \crcr - #1% - \crcr - }% - }% - \ifx\df@tag\@empty\else\global\tag@true\fi - \if@eqnsw\global\tag@true\fi - \iftag@ - \setboxz@h{% - \if@eqnsw - \stepcounter{equation}% - \tagform@\theequation - \else - \df@tag - \fi - }% - \global\tagwidth@\wdz@ - \dimen@\totwidth@ - \advance\dimen@\tagwidth@ - \advance\dimen@\multlinetaggap - \iftagsleft@\else - \if@fleqn - \advance\dimen@\@mathmargin - \fi - \fi - \ifdim\dimen@>\displaywidth - \global\shifttag@true - \else - \global\shifttag@false - \fi - \fi - \restorecounters@ - \endgroup - } - \def\label@in@mmeasure@noarg#1{% - \begingroup% - \measuring@false% - \cref@old@label@in@display{{#1}}% - \endgroup} - \def\label@in@mmeasure@optarg[#1]#2{% - \begingroup% - \measuring@false% - \cref@old@label@in@display{[#1]{#2}}% - \endgroup} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{subequations} -% In order for |subequations| to be sorted properly, \package{cleveref} -% needs to know that the |equation| counter is effectively reset by the -% |parentequation| counter within the |subequations| environment. This -% isn't how |amsmath| implements subequations (for obvious reasons!), -% but we harmlessly add the |equation| counter to the |parentequation| -% counter's reset list \emph{within} |subequations| environments, so -% that \package{cleveref}'s sorting mechanism can figure things out. We -% also harmlessly make sure |parentequation| is reset by the same -% counter as |equation|. -% \begin{macrocode} - \let\cref@old@subequations\subequations% - \let\cref@old@endsubequations\endsubequations% - \cref@resetby{equation}{\cref@result}% - \ifx\cref@result\relax\else% - \@addtoreset{parentequation}{\cref@result}% - \fi% - \renewenvironment{subequations}{% - \@addtoreset{equation}{parentequation}% - \cref@old@subequations% - }{% - \gdef\cl@parentequation{}% - \cref@old@endsubequations% - \setcounter{parentequation}{0}% - }% -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\make@df@tag@@} -% \begin{macro}{\make@df@tag@@@} -% We override the internals of the \package{amsmath} \cmd{\tag} command -% to add the additional information to the label definition. Since -% labels produced by \cmd{\tag} have no logical ordering when sorting a -% list of references, we give them a large numerical value so that they -% get pushed to the end of sorted cross-reference lists. -% \begin{macrocode} - \def\make@df@tag@@#1{% - \gdef\df@tag{\maketag@@@{#1}\def\@currentlabel{#1}% - \def\cref@currentlabel{[equation][2147483647][]#1}}} - \def\make@df@tag@@@#1{% - \gdef\df@tag{\tagform@{#1}% - \toks@\@xp{\p@equation{#1}}% - \edef\@currentlabel{\the\toks@}% - \edef\cref@currentlabel{[equation][2147483647][]\the\toks@}}} -}{}% end of \@ifpackageloaded{amsmath} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% -% -% \subsubsection{\package{IEEEtrantools} support} -% \begin{macro}{IEEEtrantools} -% The |IEEEeqnarray| environment and \cmd{\IEEEeqnarraccr} command call -% \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 -% this. -% \begin{macrocode} -\@ifpackageloaded{IEEEtrantools}{% - \PackageInfo{cleveref}{`IEEEtrantools' support loaded}% -% \end{macrocode} -% -% \begin{macro}{\@@IEEEeqnarray} -% Rather than copying the whole of \cmd{\@@IEEEeqnarray} just to patch -% the \cmd{\stepcounter} line (which would be fragile and liable to -% breakage), we insert an extra step which calls \cmd{\refstepcounter} -% to set the cross-reference type, then decrements the |equation| -% counter by one, before calling the original \cmd{\@@IEEEeqnarray}. -% \begin{macrocode} - \let\cref@orig@@IEEEeqnarray\@@IEEEeqnarray - \def\@@IEEEeqnarray[#1]#2{% - \refstepcounter{equation}% - \addtocounter{equation}{-1}% - \cref@orig@@IEEEeqnarray[#1]{#2}} -% \end{macrocode} -% \end{macro} -% -% We do the same thing with \cmd{\@IEEEeqnarrayXCR}, the last in the -% chain of macros that gets invoked by |\\| (let to -% \cmd{\IEEEeqnarraycr}) within |IEEEeqnarray| environments. -% \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}% - \fi% - \fi% - \cref@orig@IEEEeqnarrayXCR[#1]} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\IEEEyessubnumber} -% And again for \cmd{\IEEEyessubnumber} (used to turn an equation into a -% subequation). -% \begin{macrocode} - \let\cref@orig@IEEEyessubnumber\IEEEyessubnumber - \def\IEEEyessubnumber{% - \if@IEEEeqnarrayISinner% - \if@IEEElastlinewassubequation\else% - \setcounter{IEEEsubequation}{0}% - \refstepcounter{IEEEsubequation}% - \fi% - \fi% - \cref@orig@IEEEyessubnumber} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{IEEEsubequation} -% 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. -% \begin{macrocode} - \@addtoreset{IEEEsubequation}{equation}% - \crefalias{IEEEsubequation}{equation}% -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} -}{}% end of \@ifpackageloaded{IEEEtrantools} -% \end{macrocode} -% \end{macro} -% -% -% -% \subsubsection{\package{amsthm} support} -% \begin{macro}{amsthm} -% If \package{amsthm} is loaded, we need to modify its theorem -% referencing features so that they work with \package{cleveref}. -% \begin{macrocode} - \@ifpackageloaded{amsthm}{% - \PackageInfo{cleveref}{`amsthm' support loaded}% -% \end{macrocode} -% -% \begin{macro}{\@thm} -% We modify \package{amsthm}'s version of the \cmd{\@thm} macro, to -% have it call \cmd{\refstepcounter} with an optional argument -% containing the theorem type. -% \begin{macrocode} -\let\cref@thmnoarg\@thm -\def\@thm{\@ifnextchar[{\cref@thmoptarg}{\cref@thmnoarg}}%] -\def\cref@thmoptarg[#1]#2#3#4{% - \ifhmode\unskip\unskip\par\fi% - \normalfont% - \trivlist% - \let\thmheadnl\relax% - \let\thm@swap\@gobble% - \thm@notefont{\fontseries\mddefault\upshape}% - \thm@headpunct{.}% add period after heading - \thm@headsep 5\p@ plus\p@ minus\p@\relax% - \thm@space@setup% - #2% style overrides - \@topsep \thm@preskip % used by thm head - \@topsepadd \thm@postskip % used by \@endparenv - \def\@tempa{#3}\ifx\@empty\@tempa% - \def\@tempa{\@oparg{\@begintheorem{#4}{}}[]}% - \else% - \refstepcounter[#1]{#3}% <<< cleveref modification - \def\@tempa{\@oparg{\@begintheorem{#4}{\csname the#3\endcsname}}[]}% - \fi% - \@tempa} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@ynthm} -% We also have to modify \package{amsthm}'s \cmd{\@ynthm} command so -% that it passes the optional argument to \cmd{\@thm}. Since -% \package{amsmath}'s \cmd{\@ynthm} takes a different parameter list to -% the standard \LaTeX{} \cmd{\@ynthm} macro, we deliberately override -% our previous redefinition, and add the code for the automatic -% \cmd{\crefname} definitions directly to this version. -% \begin{macrocode} -\def\@ynthm#1[#2]#3{% -% \end{macrocode} -% Here's the automatic \cmd{\crefname} definition. -% \begin{macrocode} - \edef\@tempa{\expandafter\noexpand% - \csname cref@#1@name@preamble\endcsname}% - \edef\@tempb{\expandafter\noexpand% - \csname Cref@#1@name@preamble\endcsname}% - \def\@tempc{#3}% - \ifx\@tempc\@empty\relax% - \expandafter\gdef\@tempa{}% - \expandafter\gdef\@tempb{}% - \else% - \if@cref@capitalise% - \expandafter\expandafter\expandafter\gdef\expandafter% - \@tempa\expandafter{\MakeUppercase #3}% - \else% - \expandafter\expandafter\expandafter\gdef\expandafter% - \@tempa\expandafter{\MakeLowercase #3}% - \fi% - \expandafter\expandafter\expandafter\gdef\expandafter% - \@tempb\expandafter{\MakeUppercase #3}% - \fi% - \cref@stack@add{#1}{\cref@label@types}% -% \end{macrocode} -% Here's the original \package{amsthm} \cmd{\@ynthm} definition, with -% the \package{cleveref} modification. -% \begin{macrocode} - \ifx\relax#2\relax% - \def\@tempa{\@oparg{\@xthm{#1}{#3}}[]}% - \else% - \@ifundefined{c@#2}{% - \def\@tempa{\@nocounterr{#2}}% - }{% - \@xp\xdef\csname the#1\endcsname{\@xp\@nx\csname the#2\endcsname}% - \toks@{#3}% - \@xp\xdef\csname#1\endcsname{% - \@nx\@thm[#1]{% <<< new optional argument for theorem name - \let\@nx\thm@swap% - \if S\thm@swap\@nx\@firstoftwo\else\@nx\@gobble\fi% - \@xp\@nx\csname th@\the\thm@style\endcsname}% - {#2}{\the\toks@}}% - \let\@tempa\relax% - }% - \fi% - \@tempa} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@xnthm} -% Finally, we have to restore the \package{amsthm} version of -% \cmd{\@xnthm}, which we stored earlier in \cmd{\cref@old@xnthm} and -% redefined. With \package{amsthm}, \cmd{\@xnthm} calls \cmd{\@ynthm}, -% so the automatic \cmd{\crefname} definition is already taken care of. -% \begin{macrocode} - \let\@xnthm\cref@old@xnthm - }{}% end of \@ifpackageloaded{amsthm} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% -% -% \subsubsection{\package{ntheorem} support} -% \begin{macro}{ntheorem} -% \begin{macro}{thref} -% If \package{ntheorem} is loaded, we need to modify its theorem -% referencing features so that they work with \package{cleveref}. -% \begin{macrocode} - \@ifpackageloaded{ntheorem}{% - \PackageInfo{cleveref}{`ntheorem' support loaded}% - \@ifpackagewith{ntheorem}{thref}{% - \PackageWarning{cleveref}{`cleveref' supersedes `ntheorem's `thref' - option}% - \renewcommand{\thref}{\cref}}{} -% \end{macrocode} -% -% \begin{macro}{\theorem@prework} -% Newer versions of \package{ntheorem} require a call to -% \cmd{\theorem@prework} when typesetting theorems. If an older -% version of \package{ntheorem} is being used, we just \cmd{\let} it to -% \cmd{\relax} to make sure it's defined. -% \begin{macrocode} - \@ifundefined{theorem@prework}{\let\theorem@prework\relax}{} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@thm} -% We modify \package{ntheorem}'s version of the \cmd{\@thm} macro very -% slightly, to have it call \cmd{\refstepcounter} with an optional -% argument containing the theorem type. -% \begin{macrocode} - \gdef\@thm#1#2#3{% - \if@thmmarks% - \stepcounter{end\InTheoType ctr}% - \fi% - \renewcommand{\InTheoType}{#1}% - \if@thmmarks% - \stepcounter{curr#1ctr}% - \setcounter{end#1ctr}{0}% - \fi% - \refstepcounter[#1]{#2}% <<< cleveref modification - \theorem@prework% - \thm@topsepadd \theorempostskipamount% - \ifvmode \advance\thm@topsepadd\partopsep\fi% - \trivlist% - \@topsep \theorempreskipamount% - \@topsepadd \thm@topsepadd% - \advance\linewidth -\theorem@indent% - \advance\@totalleftmargin \theorem@indent% - \parshape \@ne \@totalleftmargin \linewidth% - \@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}%] - } - }{}% end of \@ifpackageloaded{ntheorem} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% -% % \subsubsection{\package{varioref} support} % \begin{macro}{varioref} % If \package{varioref} is loaded, we redefine its commands to use @@ -6124,7 +5644,7 @@ % \begin{macrocode} \def\cref@@vpageref#1[#2]#3{% \@cpageref{cref}{#3}% - {\@setvpageref[#1][\vref@space]}{\@setvpagerefrange[#1]}} + {\@setvpageref[#1][\vref@space]}{\@setvpagerefrange[#1]}}% % \end{macrocode} % \end{macro} % @@ -6153,12 +5673,12 @@ \def\reftextcurrent{}% \@cref{#1}{#2}\@setcref@space% \cref@@vpageref{\reftextcurrent}[]{#2}% - \endgroup} + \endgroup}% \def\cref@vrefrange#1#2#3{% - \@setcrefrange{#2}{#3}{#1}{}\@setcref@space\vpagerefrange{#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}} + \@cpageref{cref}{#2}{\@setfullpageref}{\@setfullpagerefrange}}% % \end{macrocode} % \end{macro} % \end{macro} @@ -6185,7 +5705,7 @@ \@setcref@lastconjunction% \fi% \fi% - \fi} + \fi}% % \end{macrocode} % \end{macro} % @@ -6194,7 +5714,7 @@ % cross-reference and page-reference into a separate macro, to make it % easier to implement the \option{poorman} option. % \begin{macrocode} - \def\@setcref@space{ } + \def\@setcref@space{ }% % \end{macrocode} % \end{macro} % @@ -6243,7 +5763,7 @@ \begingroup% \cref@patchreftexts{#5}% \@@setvpageref{#1}[#2]{#3}% - \endgroup} + \endgroup}% % \end{macrocode} % \end{macro} % @@ -6251,7 +5771,7 @@ % 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}} + \def\@@setvpageref#1[#2]#3{\cref@old@@vpageref{#1}[#2]{#3}}% % \end{macrocode} % \end{macro} % @@ -6288,13 +5808,13 @@ \begingroup% \cref@patchreftexts{#5}% \@@setvpagerefrange[#1]{#2}{#3}% - \endgroup} + \endgroup}% % \end{macrocode} % % Again, we separate out the final typesetting step, to aid later % redefinition. % \begin{macrocode} - \def\@@setvpagerefrange[#1]#2#3{\vpagerefrange[#1]{#2}{#3}} + \def\@@setvpagerefrange[#1]#2#3{\vpagerefrange[#1]{#2}{#3}}% % \end{macrocode} % \end{macro} % @@ -6314,12 +5834,12 @@ \begingroup% \cref@patchreftexts{#3}% \@@setfullpageref{#1}% - \endgroup} + \endgroup}% % \end{macrocode} % % Separate out the final typesetting step, as usual. % \begin{macrocode} - \def\@@setfullpageref#1{\reftextfaraway{#1}} + \def\@@setfullpageref#1{\reftextfaraway{#1}}% % \end{macrocode} % \end{macro} % @@ -6339,12 +5859,12 @@ \begingroup% \cref@patchreftexts{#4}% \@@setfullpagerefrange{#1}{#2}% - \endgroup} + \endgroup}% % \end{macrocode} % % Separate out the final typesetting step, as usual. % \begin{macrocode} - \def\@@setfullpagerefrange#1#2{\reftextpagerange{#1}{#2}} + \def\@@setfullpagerefrange#1#2{\reftextpagerange{#1}{#2}}% % \end{macrocode} % \end{macro} % @@ -6371,65 +5891,65 @@ % \begin{macrocode} \def\cref@old@@vpageref#1[#2]#3{% \leavevmode%\unskip <<< - \global\advance\c@vrcnt\@ne + \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 + \ifx\@tempa\@tempb\else% \vref@err{\noexpand\vref or \noexpand\vpageref at page boundary \@tempb-\@tempa\space (may loop)% }% - \fi + \fi% \vrefpagenum\thevpagerefnum{#3}% - \vref@space - \ifx\@tempa\thevpagerefnum + \vref@space% + \ifx\@tempa\thevpagerefnum% \def\@tempc{#1}% - \ifx\@tempc\@empty - \unskip - \else + \ifx\@tempc\@empty% + \unskip% + \else% #1% - \fi - \else + \fi% + \else% #2% - \is@pos@number\thevpagerefnum + \is@pos@number\thevpagerefnum% {% - \is@pos@number\@tempa - {\@tempcnta\@tempa - \advance\@tempcnta\@ne + \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 + \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 + \fi% + \fi% }% {\reftextfaraway{#3}}% - \fi + \fi% \vref@label{\the\c@vrcnt @xvr}% <<< \vref@label{\the\c@vrcnt @vr}% - } + }% % \end{macrocode} % \end{macro} % @@ -6439,13 +5959,13 @@ % These are used if a |\reftext|\meta{x} is redefined to produce an empty % reference, to force a non-empty reference within multi-references. % \begin{macrocode} - \let\creftextcurrent\reftextcurrent - \let\creftextfaceafter\reftextfaceafter - \let\creftextfacebefore\reftextfacebefore - \let\creftextafter\reftextafter - \let\creftextbefore\reftextbefore - \let\creftextfaraway\reftextfaraway - \let\creftextpagerange\reftextpagerange + \let\creftextcurrent\reftextcurrent% + \let\creftextfaceafter\reftextfaceafter% + \let\creftextfacebefore\reftextfacebefore% + \let\creftextafter\reftextafter% + \let\creftextbefore\reftextbefore% + \let\creftextfaraway\reftextfaraway% + \let\creftextpagerange\reftextpagerange% % \end{macrocode} % % \begin{macro}{\cref@patchreftexts} @@ -6459,7 +5979,7 @@ \cref@patchreftext{reftextfaceafter}{#1}% \cref@patchreftext{reftextfacebefore}{#1}% \cref@patchreftext{reftextafter}{#1}% - \cref@patchreftext{reftextbefore}{#1}} + \cref@patchreftext{reftextbefore}{#1}}% % \end{macrocode} % \end{macro} % \end{macro} @@ -6531,7 +6051,7 @@ \fi% \fi% \fi% - \fi} + \fi}% % \end{macrocode} % \end{macro} % @@ -6547,9 +6067,9 @@ % so now we do need macros to separate out the final type setting of % the rest of the conjunctions.) % \begin{macrocode} - \def\@setcref@pairconjunction{\crefpairconjunction} - \def\@setcref@middleconjunction{\crefmiddleconjunction} - \def\@setcref@lastconjunction{\creflastconjunction} + \def\@setcref@pairconjunction{\crefpairconjunction}% + \def\@setcref@middleconjunction{\crefmiddleconjunction}% + \def\@setcref@lastconjunction{\creflastconjunction}% % \end{macrocode} % \end{macro} % \end{macro} @@ -6563,8 +6083,8 @@ % (if loaded). % \begin{macrocode} \AtBeginDocument{% - \def\@@vpageref#1[#2]#3{\cref@@vpageref{#1}[#2]{#3}} - } + \def\@@vpageref#1[#2]#3{\cref@@vpageref{#1}[#2]{#3}}% + }% % \end{macrocode} % % \begin{macro}{\vpageref} @@ -6598,44 +6118,771 @@ % \end{macro} % \end{macro} % \begin{macrocode} - \if@cref@hyperrefloaded\relax% hyperref loaded + \if@cref@hyperrefloaded\relax% hyperref loaded% \DeclareRobustCommand{\vref}{% - \@ifstar{\cref@vrefstar{cref}}{\cref@vref{cref}}} + \@ifstar{\cref@vrefstar{cref}}{\cref@vref{cref}}}% \DeclareRobustCommand{\Vref}{% - \@ifstar{\cref@vrefstar{Cref}}{\cref@vref{Cref}}} + \@ifstar{\cref@vrefstar{Cref}}{\cref@vref{Cref}}}% \DeclareRobustCommand{\vrefrange}{% - \@ifstar{\cref@vrefrangestar{cref}}{\cref@vrefrange{cref}}} + \@ifstar{\cref@vrefrangestar{cref}}{\cref@vrefrange{cref}}}% \DeclareRobustCommand{\Vrefrange}{% - \@ifstar{\cref@vrefrangestar{Cref}}{\cref@vrefrange{Cref}}} + \@ifstar{\cref@vrefrangestar{Cref}}{\cref@vrefrange{Cref}}}% \DeclareRobustCommand{\fullref}{% - \@ifstar{\cref@fullrefstar{cref}}{\cref@fullref{cref}}} + \@ifstar{\cref@fullrefstar{cref}}{\cref@fullref{cref}}}% \DeclareRobustCommand{\Fullref}{% - \@ifstar{\cref@fullrefstar{Cref}}{\cref@fullref{Cref}}} + \@ifstar{\cref@fullrefstar{Cref}}{\cref@fullref{Cref}}}% \def\cref@vrefstar#1#2{% \@crefstarredtrue% \cref@vref{#1}{#2}% - \@crefstarredfalse} + \@crefstarredfalse}% \def\cref@vrefrangestar#1#2#3{% \@crefstarredtrue% \cref@vrefrange{#1}{#2}{#3}% - \@crefstarredfalse} + \@crefstarredfalse}% \def\cref@fullrefstar#1#2{% \@crefstarredtrue% \cref@fullref{#1}{#2}% - \@crefstarredfalse} + \@crefstarredfalse}% \else% - \DeclareRobustCommand{\vref}{\cref@vref{cref}} - \DeclareRobustCommand{\Vref}{\cref@vref{Cref}} - \DeclareRobustCommand{\vrefrange}{\cref@vrefrange{cref}} - \DeclareRobustCommand{\Vrefrange}{\cref@vrefrange{Cref}} - \DeclareRobustCommand{\fullref}{\cref@fullref{cref}} - \DeclareRobustCommand{\Fullref}{\cref@fullref{Cref}} + \DeclareRobustCommand{\vref}{\cref@vref{cref}}% + \DeclareRobustCommand{\Vref}{\cref@vref{Cref}}% + \DeclareRobustCommand{\vrefrange}{\cref@vrefrange{cref}}% + \DeclareRobustCommand{\Vrefrange}{\cref@vrefrange{Cref}}% + \DeclareRobustCommand{\fullref}{\cref@fullref{cref}}% + \DeclareRobustCommand{\Fullref}{\cref@fullref{Cref}}% \fi% end of test for hyperref }{}% end of \@ifpackageloaded{varioref} % \end{macrocode} % % % +% \subsubsection{\package{amsmath} support} +% \begin{macro}{amsmath} +% \begin{macro}{\label} +% \begin{macro}{\label@in@display} +% The \package{amsmath} package redefines the \cmd{\label} command +% within equation environments, so if it is loaded we have to extend +% the behaviour to support the optional argument. With +% \package{amsmath}, the original \cmd{\label} command is stored in +% \cmd{\ltx@label}, and \cmd{\label@in@display} replaces \cmd{\label} +% inside equations. \cmd{\label@in@display} just saves the label for +% later, and defining it is left until the end of the equation, when +% \cmd{\ltx@label} is finally called. +% +% To allow \cmd{\label} within equations to support an optional +% argument, we first store the original \cmd{\label@in@display} and the +% new \cmd{\label} macro we defined above (since \cmd{\label} will be +% clobbered inside equations). Then we redefine \cmd{\label@in@display} +% so that it wraps all its arguments, including any optional argument, +% in an extra set of braces. These are stripped away again by +% \cmd{\ltx@label} before calling the \package{cleveref} \cmd{\label} +% command we defined previously (saved in \cmd{\cref@label}). As +% before, we must postpone the redefinition of \cmd{\label} until the +% beginning of the document, since other packages do so. +% \begin{macrocode} +\@ifpackageloaded{amsmath}{% + \AtBeginDocument{% + \let\cref@old@label@in@display\label@in@display% + \def\label@in@display{% + \@ifnextchar[\label@in@display@optarg\label@in@display@noarg}%] + \def\label@in@display@noarg#1{\cref@old@label@in@display{{#1}}}% + \def\label@in@display@optarg[#1]#2{% + \cref@old@label@in@display{[#1]{#2}}}% + \def\ltx@label#1{\cref@label#1}% + }% end of AtBeginDocument +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\measure@} +% \begin{macro}{\gmeasure@} +% The \package{amsmath} multi-line equation environments scan their +% bodies twice: once to measure, once to typeset. In the measure phase, +% the \cmd{\label} command is disabled by letting it to \cmd{\@gobble}. +% 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. +% +% Unfortunately, \package{amsmath} wasn't designed with redefinitions +% of \cmd{\label} in mind, so there appears to be no safe way of doing +% this other than copying the \package{amsmath} definitions and making +% the modification directly in the macro's code. This is a recipe for +% future chaos if these commands are ever modified in a new version of +% \package{amsmath}, but it seems we have no choice. Luckily, +% \package{amsmath} isn't updated too often! +% \begin{macrocode} + \def\measure@#1{% + \begingroup% + \measuring@true% + \global\eqnshift@\z@% + \global\alignsep@\z@% + \global\let\tag@lengths\@empty% + \global\let\field@lengths\@empty% + \savecounters@% + \global\setbox0\vbox{% + \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 + \global\row@\z@% + \tabskip\z@% + \halign{\span\align@preamble\crcr% + #1% + \math@cr@@@% + \global\column@\z@% + \add@amps\maxfields@\cr% + }% + }% + \restorecounters@% + \ifodd\maxfields@% + \global\advance\maxfields@\@ne% + \fi% + \ifnum\xatlevel@=\tw@% + \ifnum\maxfields@<\thr@@% + \let\xatlevel@\z@% + \fi% + \fi% + \setbox\z@\vbox{% + \unvbox\z@ \unpenalty \global\setbox\@ne\lastbox% + }% + \global\totwidth@\wd\@ne% + \if@fleqn \global\advance\totwidth@\@mathmargin \fi% + \global\let\maxcolumn@widths\@empty% + \begingroup% + \let\or\relax% + \loop% + \global\setbox\@ne\hbox{% + \unhbox\@ne \unskip \global\setbox\thr@@\lastbox% + }% + \ifhbox\thr@@% + \xdef\maxcolumn@widths{ \or \the\wd\thr@@ \maxcolumn@widths}% + \repeat% + \endgroup% + \dimen@\displaywidth% + \advance\dimen@-\totwidth@% + \ifcase\xatlevel@% + \global\alignsep@\z@% + \let\minalignsep\z@% + \@tempcntb\z@% + \if@fleqn% + \@tempcnta\@ne% + \global\eqnshift@\@mathmargin% + \else% + \@tempcnta\tw@% + \global\eqnshift@\dimen@% + \global\divide\eqnshift@\@tempcnta% + \fi% + \or% + \@tempcntb\maxfields@% + \divide\@tempcntb\tw@% + \@tempcnta\@tempcntb% + \advance\@tempcntb\m@ne% + \if@fleqn% + \global\eqnshift@\@mathmargin% + \global\alignsep@\dimen@% + \global\divide\alignsep@\@tempcnta% + \else% + \global\advance\@tempcnta\@ne% + \global\eqnshift@\dimen@% + \global\divide\eqnshift@\@tempcnta% + \global\alignsep@\eqnshift@% + \fi% + \or% + \@tempcntb\maxfields@% + \divide\@tempcntb\tw@% + \global\advance\@tempcntb\m@ne% + \global\@tempcnta\@tempcntb% + \global\eqnshift@\z@% + \global\alignsep@\dimen@% + \if@fleqn% + \global\advance\alignsep@\@mathmargin\relax% + \fi% + \global\divide\alignsep@\@tempcntb% + \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@% + \fi% + \fi% + \fi% + \ifdim\eqnshift@<\z@% + \global\eqnshift@\z@% + \fi% + \calc@shift@align% + \global\tagshift@\totwidth@% + \global\advance\tagshift@\@tempcntb\alignsep@% + \if@fleqn% + \ifnum\xatlevel@=\tw@% + \global\advance\tagshift@-\@mathmargin\relax% + \fi% + \else% + \global\advance\tagshift@\eqnshift@% + \fi% + \iftagsleft@ \else% + \global\advance\tagshift@-\displaywidth% + \fi% + \dimen@\minalignsep\relax% + \global\advance\totwidth@\@tempcntb\dimen@% + \ifdim\totwidth@>\displaywidth% + \global\let\displaywidth@\totwidth@% + \else% + \global\let\displaywidth@\displaywidth% + \fi% + \endgroup% + }% + \def\gmeasure@#1{% + \begingroup% + \measuring@true% + \totwidth@\z@% + \global\let\tag@lengths\@empty% + \savecounters@% + \setbox\@ne\vbox{% + \everycr{\noalign{\global\tag@false% + \global\let\raise@tag\@empty \global\column@\z@}}% + \let\label\@gobble% <<< cleveref modification + \halign{% + \setboxz@h{$\m@th\displaystyle{##}$}% + \ifdim\wdz@>\totwidth@% + \global\totwidth@\wdz@% + \fi% + &\setboxz@h{\strut@{##}}% + \savetaglength@% + \crcr% + #1% + \math@cr@@@% + }% + }% + \restorecounters@% + \if@fleqn% + \global\advance\totwidth@\@mathmargin% + \fi% + \iftagsleft@% + \ifdim\totwidth@>\displaywidth% + \global\let\gdisplaywidth@\totwidth@% + \else% + \global\let\gdisplaywidth@\displaywidth% + \fi% + \fi% + \endgroup% +}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\multline@} +% \begin{macro}{\mmeasure@} +% \begin{macro}{\label@mmeasure@noarg} +% \begin{macro}{\label@mmeasure@optarg} +% The |multline| environment works a bit differently to the other +% \package{amsmath} environments, in that \cmd{\label} is +% \emph{disabled} during the typesetting phase, and \emph{enabled} +% during the measuring phase. To cope with \package{cleveref}'s +% optional argument, we have to define separate versions of +% \cmd{\label@in@display} specifically for \cmd{\mmeasure@}. +% \begin{macrocode} + \def\multline@#1{% + \Let@% + \@display@init{\global\advance\row@\@ne \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 + \tabskip \if@fleqn \@mathmargin \else \z@skip \fi% + \totwidth@\displaywidth% + \if@fleqn% + \advance\totwidth@-\@mathmargin% + \fi% + \halign\bgroup% + \hbox to\totwidth@{% + \if@fleqn% + \hskip \@centering \relax% + \else% + \hfil% + \fi% + \strut@% + $\m@th\displaystyle{}##\endmultline@math% + \hfil% + }% $ + \crcr% + \if@fleqn% + \hskip-\@mathmargin% + \def\multline@indent{\hskip\@mathmargin}% + \else% + \hfilneg% + \def\multline@indent{\hskip\multlinegap}% + \fi% + \iftagsleft@% + \iftag@% + \begingroup% + \ifshifttag@% + \rlap{\vbox{% + \normalbaselines% + \hbox{% + \strut@% + \make@display@tag% + }% + \vbox to\lineht@{}% + \raise@tag% + }}% + \multline@indent% + \else% + \setbox\z@\hbox{\make@display@tag}% + \dimen@\@mathmargin \advance\dimen@-\wd\z@% + \ifdim\dimen@<\multlinetaggap% + \dimen@\multlinetaggap% + \fi% + \box\z@ \hskip\dimen@\relax% + \fi% + \endgroup% + \else% + \multline@indent% + \fi% + \else% + \multline@indent% + \fi% + #1% + }% + \def\mmeasure@#1{% + \begingroup% + \measuring@true% + \def\label{% <<< cleveref modification + \@ifnextchar[\label@in@mmeasure@optarg%] + \label@in@mmeasure@noarg}% + \def\math@cr@@@{\cr}% + \let\shoveleft\@iden \let\shoveright\@iden% + \savecounters@% + \global\row@\z@% + \setbox\@ne\vbox{% + \global\let\df@tag\@empty% + \halign{% + \setboxz@h{\@lign$\m@th\displaystyle{}##$}% + \iftagsleft@% + \ifnum\row@=\@ne% + \global\totwidth@\wdz@% + \global\lineht@\ht\z@% + \fi% + \else% + \global\totwidth@\wdz@% + \global\lineht@\dp\z@% + \fi% + \crcr% + #1% + \crcr% + }% + }% + \ifx\df@tag\@empty\else\global\tag@true\fi% + \if@eqnsw\global\tag@true\fi% + \iftag@% + \setboxz@h{% + \if@eqnsw% + \stepcounter{equation}% + \tagform@\theequation% + \else% + \df@tag% + \fi% + }% + \global\tagwidth@\wdz@% + \dimen@\totwidth@% + \advance\dimen@\tagwidth@% + \advance\dimen@\multlinetaggap% + \iftagsleft@\else% + \if@fleqn% + \advance\dimen@\@mathmargin% + \fi% + \fi% + \ifdim\dimen@>\displaywidth% + \global\shifttag@true% + \else% + \global\shifttag@false% + \fi% + \fi% + \restorecounters@% + \endgroup% + }% + \def\label@in@mmeasure@noarg#1{% + \begingroup% + \measuring@false% + \cref@old@label@in@display{{#1}}% + \endgroup}% + \def\label@in@mmeasure@optarg[#1]#2{% + \begingroup% + \measuring@false% + \cref@old@label@in@display{[#1]{#2}}% + \endgroup}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{subequations} +% In order for |subequations| to be sorted properly, \package{cleveref} +% needs to know that the |equation| counter is effectively reset by the +% |parentequation| counter within the |subequations| environment. This +% isn't how |amsmath| implements subequations (for obvious reasons!), +% but we harmlessly add the |equation| counter to the |parentequation| +% counter's reset list \emph{within} |subequations| environments, so +% that \package{cleveref}'s sorting mechanism can figure things out. We +% also harmlessly make sure |parentequation| is reset by the same +% counter as |equation|. +% +% We also want to treat subequations as a separate cross-reference type +% from equations. However, \package{amsmath} still uses the |equation| +% counter for subequations, not a separate ``subequation'' counter. We +% therefore temporarily alias |equation| to |subequation| within +% subequation environments. +% \begin{macrocode} + \let\cref@old@subequations\subequations% + \let\cref@old@endsubequations\endsubequations% + \cref@resetby{equation}{\cref@result}% + \ifx\cref@result\relax\else% + \@addtoreset{parentequation}{\cref@result}% + \fi% + \renewenvironment{subequations}{% +% \end{macrocode} +% Temporarily declare |equation| counter to be reset by |parentequation|. +% \begin{macrocode} + \@addtoreset{equation}{parentequation}% +% \end{macrocode} +% Temporarily alias |equation| to |subequation|, or to whatever +% |subequation| has been aliased to. +% \begin{macrocode} + \let\cref@orig@equation@alias\cref@equation@alias% + \@ifundefined{cref@subequation@alias}% + {\crefalias{equation}{subequation}}% + {\def\@tempa{{equation}}% + \expandafter\expandafter\expandafter\crefalias% + \expandafter\@tempa\expandafter{\cref@subequation@alias}}% + \cref@old@subequations% + }{% +% \end{macrocode} +% Remove |equation| from |parentequation| counter's reset list. +% \begin{macrocode} + \gdef\cl@parentequation{}% + \cref@old@endsubequations% + \setcounter{parentequation}{0}% +% \end{macrocode} +% Restore original |equation| alias (if any). +% \begin{macrocode} + \@ifundefined{cref@orig@cref@equation@alias}% + {\let\cref@equation@alias\relax}% + {\let\cref@equation@alias\cref@orig@equation@alias\relax}% + \let\cref@orig@equation@alias\relax% + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\make@df@tag@@} +% \begin{macro}{\make@df@tag@@@} +% We override the internals of the \package{amsmath} \cmd{\tag} command +% to add the additional information to the label definition. Since +% labels produced by \cmd{\tag} have no logical ordering when sorting a +% list of references, we give them a large numerical value so that they +% get pushed to the end of sorted cross-reference lists. +% \begin{macrocode} + \let\cref@old@make@df@tag@@\make@df@tag@@% + \def\make@df@tag@@#1{% + \cref@old@make@df@tag@@{#1}% + \let\cref@old@df@tag\df@tag% + \expandafter\gdef\expandafter\df@tag\expandafter{% + \cref@old@df@tag% + \def\cref@currentlabel{[equation][2147483647][]#1}}}% + \let\cref@old@make@df@tag@@@\make@df@tag@@@% + \def\make@df@tag@@@#1{% + \cref@old@make@df@tag@@@{#1}% + \let\cref@old@df@tag\df@tag% + \expandafter\gdef\expandafter\df@tag\expandafter{% + \cref@old@df@tag% + \toks@\@xp{\p@equation{#1}}% + \edef\cref@currentlabel{[equation][2147483647][]\the\toks@}}}% +}{}% end of \@ifpackageloaded{amsmath} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% +% \subsubsection{\package{amsthm} support} +% \begin{macro}{amsthm} +% If \package{amsthm} is loaded, we need to modify its theorem +% referencing features so that they work with \package{cleveref}. +% \begin{macrocode} +\@ifpackageloaded{amsthm}{% + \PackageInfo{cleveref}{`amsthm' support loaded}% +% \end{macrocode} +% +% \begin{macro}{\@thm} +% We modify \package{amsthm}'s version of the \cmd{\@thm} macro, to +% have it call \cmd{\refstepcounter} with an optional argument +% containing the theorem type. +% \begin{macrocode} + \let\cref@thmnoarg\@thm% + \def\@thm{\@ifnextchar[{\cref@thmoptarg}{\cref@thmnoarg}}%] + \def\cref@thmoptarg[#1]#2#3#4{% + \ifhmode\unskip\unskip\par\fi% + \normalfont% + \trivlist% + \let\thmheadnl\relax% + \let\thm@swap\@gobble% + \thm@notefont{\fontseries\mddefault\upshape}% + \thm@headpunct{.}% add period after heading + \thm@headsep 5\p@ plus\p@ minus\p@\relax% + \thm@space@setup% + #2% style overrides + \@topsep \thm@preskip % used by thm head + \@topsepadd \thm@postskip % used by \@endparenv + \def\@tempa{#3}\ifx\@empty\@tempa% + \def\@tempa{\@oparg{\@begintheorem{#4}{}}[]}% + \else% + \refstepcounter[#1]{#3}% <<< cleveref modification + \def\@tempa{\@oparg{\@begintheorem{#4}{\csname the#3\endcsname}}[]}% + \fi% + \@tempa}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@ynthm} +% We also have to modify \package{amsthm}'s \cmd{\@ynthm} command so +% that it passes the optional argument to \cmd{\@thm}. Since +% \package{amsmath}'s \cmd{\@ynthm} takes a different parameter list to +% the standard \LaTeX{} \cmd{\@ynthm} macro, we deliberately override +% our previous redefinition, and add the code for the automatic +% \cmd{\crefname} definitions directly to this version. +% \begin{macrocode} + \def\@ynthm#1[#2]#3{% +% \end{macrocode} +% Here's the automatic \cmd{\crefname} definition. +% \begin{macrocode} + \edef\@tempa{\expandafter\noexpand% + \csname cref@#1@name@preamble\endcsname}% + \edef\@tempb{\expandafter\noexpand% + \csname Cref@#1@name@preamble\endcsname}% + \def\@tempc{#3}% + \ifx\@tempc\@empty\relax% + \expandafter\gdef\@tempa{}% + \expandafter\gdef\@tempb{}% + \else% + \if@cref@capitalise% + \expandafter\expandafter\expandafter\gdef\expandafter% + \@tempa\expandafter{\MakeUppercase #3}% + \else% + \expandafter\expandafter\expandafter\gdef\expandafter% + \@tempa\expandafter{\MakeLowercase #3}% + \fi% + \expandafter\expandafter\expandafter\gdef\expandafter% + \@tempb\expandafter{\MakeUppercase #3}% + \fi% + \cref@stack@add{#1}{\cref@label@types}% +% \end{macrocode} +% Here's the original \package{amsthm} \cmd{\@ynthm} definition, with +% the \package{cleveref} modification. +% \begin{macrocode} + \ifx\relax#2\relax% + \def\@tempa{\@oparg{\@xthm{#1}{#3}}[]}% + \else% + \@ifundefined{c@#2}{% + \def\@tempa{\@nocounterr{#2}}% + }{% + \@xp\xdef\csname the#1\endcsname{\@xp\@nx\csname the#2\endcsname}% + \toks@{#3}% + \@xp\xdef\csname#1\endcsname{% + \@nx\@thm[#1]{% <<< new optional argument for theorem name + \let\@nx\thm@swap% + \if S\thm@swap\@nx\@firstoftwo\else\@nx\@gobble\fi% + \@xp\@nx\csname th@\the\thm@style\endcsname}% + {#2}{\the\toks@}}% + \let\@tempa\relax% + }% + \fi% + \@tempa}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@xnthm} +% Finally, we have to restore the \package{amsthm} version of +% \cmd{\@xnthm}, which we stored earlier in \cmd{\cref@old@xnthm} and +% redefined. With \package{amsthm}, \cmd{\@xnthm} calls \cmd{\@ynthm}, +% so the automatic \cmd{\crefname} definition is already taken care of. +% \begin{macrocode} + \let\@xnthm\cref@old@xnthm% +}{}% end of \@ifpackageloaded{amsthm} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% +% \subsubsection{\package{ntheorem} support} +% \begin{macro}{ntheorem} +% \begin{macro}{thref} +% If \package{ntheorem} is loaded, we need to modify its theorem +% referencing features so that they work with \package{cleveref}. +% \begin{macrocode} +\@ifpackageloaded{ntheorem}{% + \PackageInfo{cleveref}{`ntheorem' support loaded}% + \@ifpackagewith{ntheorem}{thref}{% + \PackageWarning{cleveref}{`cleveref' supersedes `ntheorem's `thref' + option}% + \renewcommand{\thref}{\cref}}{}% +% \end{macrocode} +% +% \begin{macro}{\theorem@prework} +% Newer versions of \package{ntheorem} require a call to +% \cmd{\theorem@prework} when typesetting theorems. If an older +% version of \package{ntheorem} is being used, we just \cmd{\let} it to +% \cmd{\relax} to make sure it's defined. +% \begin{macrocode} + \@ifundefined{theorem@prework}{\let\theorem@prework\relax}{}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@thm} +% We modify \package{ntheorem}'s version of the \cmd{\@thm} macro very +% slightly, to have it call \cmd{\refstepcounter} with an optional +% argument containing the theorem type. +% \begin{macrocode} + \gdef\@thm#1#2#3{% + \if@thmmarks% + \stepcounter{end\InTheoType ctr}% + \fi% + \renewcommand{\InTheoType}{#1}% + \if@thmmarks% + \stepcounter{curr#1ctr}% + \setcounter{end#1ctr}{0}% + \fi% + \refstepcounter[#1]{#2}% <<< cleveref modification + \theorem@prework% + \thm@topsepadd \theorempostskipamount% + \ifvmode \advance\thm@topsepadd\partopsep\fi% + \trivlist% + \@topsep \theorempreskipamount% + \@topsepadd \thm@topsepadd% + \advance\linewidth -\theorem@indent% + \advance\@totalleftmargin \theorem@indent% + \parshape \@ne \@totalleftmargin \linewidth% + \@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}%] + }% +}{}% end of \@ifpackageloaded{ntheorem} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% +% \subsubsection{\package{IEEEtrantools} support} +% \begin{macro}{IEEEtrantools} +% The |IEEEeqnarray| environment and \cmd{\IEEEeqnarraccr} command call +% \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 +% this. +% \begin{macrocode} +\@ifpackageloaded{IEEEtrantools}{% + \PackageInfo{cleveref}{`IEEEtrantools' support loaded}% +% \end{macrocode} +% +% \begin{macro}{\@@IEEEeqnarray} +% Rather than copying the whole of \cmd{\@@IEEEeqnarray} just to patch +% the \cmd{\stepcounter} line (which would be fragile and liable to +% breakage), we insert an extra step which calls \cmd{\refstepcounter} +% to set the cross-reference type, then decrements the |equation| +% counter by one, before calling the original \cmd{\@@IEEEeqnarray}. +% \begin{macrocode} + \let\cref@orig@@IEEEeqnarray\@@IEEEeqnarray% + \def\@@IEEEeqnarray[#1]#2{% + \refstepcounter{equation}% + \addtocounter{equation}{-1}% + \cref@orig@@IEEEeqnarray[#1]{#2}}% +% \end{macrocode} +% \end{macro} +% +% We do the same thing with \cmd{\@IEEEeqnarrayXCR}, the last in the +% chain of macros that gets invoked by |\\| (let to +% \cmd{\IEEEeqnarraycr}) within |IEEEeqnarray| environments. +% \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}% + \fi% + \fi% + \cref@orig@IEEEeqnarrayXCR[#1]}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IEEEyessubnumber} +% And again for \cmd{\IEEEyessubnumber} (used to turn an equation into a +% subequation). +% \begin{macrocode} + \let\cref@orig@IEEEyessubnumber\IEEEyessubnumber% + \def\IEEEyessubnumber{% + \if@IEEEeqnarrayISinner% + \if@IEEElastlinewassubequation\else% + \setcounter{IEEEsubequation}{0}% + \refstepcounter{IEEEsubequation}% + \fi% + \fi% + \cref@orig@IEEEyessubnumber}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{IEEEsubequation} +% 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. +% \begin{macrocode} + \@addtoreset{IEEEsubequation}{equation}% + \crefalias{IEEEsubequation}{equation}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +}{}% end of \@ifpackageloaded{IEEEtrantools} +% \end{macrocode} +% \end{macro} +% +% +% +% \subsubsection{\package{breqn} support} +% \begin{macro}{breqn} +% The \package{breqn} package uses \cmd{\eq@setcounter} instead of +% \cmd{\refstepcounter} to set equation numbers, which as usual breaks +% \package{cleveref}. To fix this, we have to patch +% \cmd{\eq@setcounter} with similar code to that already added to +% \cmd{\refstepcounter}. +% \begin{macrocode} +\@ifpackageloaded{breqn}{% + \PackageInfo{cleveref}{`breqn' support loaded}% + \let\cref@old@eq@setnumber\eq@setnumber% + \def\eq@setnumber{% + \cref@old@eq@setnumber% + \cref@constructprefix{equation}{\cref@result}% + \protected@xdef\cref@currentlabel{% + [equation][\arabic{equation}][\cref@result]\p@equation\theequation}}% +}{}% end of \@ifpackageloaded{breqn} +% \end{macrocode} +% \end{macro} +% +% +% % \subsubsection{\package{algorithmicx} support} % \begin{macro}{algorithmicx} % If \package{algorithmicx} is loaded, we modify its line numbering @@ -6661,7 +6908,7 @@ \addtocounter{ALG@line}{-1}% \refstepcounter{ALG@line}% \expandafter\@cref@getprefix\cref@currentlabel\@nil\cref@currentprefix% - \xdef\cref@currentprefix{\cref@currentprefix}} + \xdef\cref@currentprefix{\cref@currentprefix}}% % \end{macrocode} % \end{macro} % @@ -6678,7 +6925,7 @@ % \begin{macrocode} \g@addto@macro\ALG@beginalgorithmic{% \def\cref@currentlabel{% - [line][\arabic{ALG@line}][\cref@currentprefix]\theALG@line}} + [line][\arabic{ALG@line}][\cref@currentprefix]\theALG@line}}% }{}% end of \@ifpackageloaded{algorithmicx} % \end{macrocode} % \end{macro} @@ -6720,10 +6967,10 @@ % \begin{macrocode} \lst@AddToHook{Init}{% \def\cref@currentlabel{% - [line][\arabic{lstnumber}][\cref@currentprefix]\thelstnumber}} + [line][\arabic{lstnumber}][\cref@currentprefix]\thelstnumber}}% \lst@AddToHook{EveryPar}{% \expandafter\@cref@getprefix\cref@currentlabel\@nil\cref@currentprefix% - \xdef\cref@currentprefix{\cref@currentprefix}} + \xdef\cref@currentprefix{\cref@currentprefix}}% }{}% end of \@ifpackageloaded{listings} % \end{macrocode} % \end{macro} @@ -6799,12 +7046,12 @@ % this redefinition until the beginning of the document because % \package{subfig} does. % \begin{macrocode} - \AtBeginDocument{ - \let\cref@old@refsteponlycounter\refsteponlycounter + \AtBeginDocument{% + \let\cref@old@refsteponlycounter\refsteponlycounter% \def\refsteponlycounter{% \@ifnextchar[\refstepcounter@optarg% \cref@old@refsteponlycounter%] - }} + }}% % \end{macrocode} % \end{macro} % @@ -6851,7 +7098,7 @@ % done its own processing. Oof! % \begin{macrocode} \def\sf@sub@label(#1){% - \ifhyperrefloaded + \ifhyperrefloaded% \protected@edef\@currentlabelname{% \expandafter\strip@period #1\relax.\relax\@@@}% \fi% @@ -6889,13 +7136,13 @@ % \package{memoir} does, too.) % \begin{macrocode} \@ifclassloaded{memoir}{% - \AtBeginDocument{ + \AtBeginDocument{% \def\sf@memsub@label(#1){% \protected@edef\mem@currentlabelname{#1}% \let\@memoldlabel\cref@old@label% \let\cref@old@label\sf@@memsub@label% - \cref@label}} -}{} + \cref@label}}% +}{}% % \end{macrocode} % \end{macro} % \end{macro} @@ -6951,7 +7198,7 @@ % in \cmd{\cref@ORI@old@label}, and make \cmd{\caption@ORI@label} call % that. Oof! % \begin{macrocode} - \let\cref@old@caption@xlabel\caption@xlabel + \let\cref@old@caption@xlabel\caption@xlabel% \def\caption@xlabel{% \let\cref@ORI@label\cref@old@label% \let\cref@old@label\cref@old@caption@xlabel% @@ -6988,13 +7235,13 @@ % \begin{macrocode} \@ifpackageloaded{aliascnt}{% \PackageInfo{cleveref}{`aliascnt' support loaded}% - \let\cref@old@newaliascnt\newaliascnt + \let\cref@old@newaliascnt\newaliascnt% \renewcommand*{\newaliascnt}[2]{% \cref@old@newaliascnt{#1}{#2}% \cref@resetby{#2}{\cref@result}% \ifx\cref@result\relax\else% \@addtoreset{#1}{\cref@result}% - \fi} + \fi}% }{}% end of \@ifpackageloaded{aliascnt} % \end{macrocode} % \end{macro} @@ -7021,10 +7268,10 @@ % produced by the \cmd{\cref} commands, and open an output stream for % writing the script before starting to process the document body. % \begin{macrocode} - \gdef\cref@poorman@text{} + \gdef\cref@poorman@text{}% \AtBeginDocument{% \newwrite\@crefscript% - \immediate\openout\@crefscript=\jobname.sed} + \immediate\openout\@crefscript=\jobname.sed}% % \end{macrocode} % \end{macro} % @@ -7064,21 +7311,21 @@ % language switching command is called. It is checked by % \cmd{\cref@writelanguagerules} when writing substitution rules. % \begin{macrocode} - \newif\if@cref@switched@language + \newif\if@cref@switched@language% \@ifpackageloaded{babel}{% \AtBeginDocument{% - \let\cref@old@select@language\select@language + \let\cref@old@select@language\select@language% \def\select@language{% \@cref@switched@languagetrue% \cref@writelanguagerules% - \cref@old@select@language} - \let\cref@old@foreign@language\foreign@language + \cref@old@select@language}% + \let\cref@old@foreign@language\foreign@language% \def\foreign@language{% \@cref@switched@languagetrue% \cref@writelanguagerules% - \cref@old@foreign@language} + \cref@old@foreign@language}% \edef\cref@inputlineno{\the\inputlineno}}% - }{} + }{}% % \end{macrocode} % \end{macro} % \end{macro} @@ -7090,7 +7337,7 @@ \AtEndDocument{% \let\select@language\cref@old@select@language% \let\foreign@language\cref@old@foreign@language% - \cref@writelanguagerules} + \cref@writelanguagerules}% % \end{macrocode} % % \begin{macro}{\cref@writelanguagerules} @@ -7285,12 +7532,12 @@ % characters and define them to expand to their escaped forms. Change % those of \TeX{} special characters to make them normal letters. % \begin{macrocode} - \catcode`.=13 \catcode`*=13 - \catcode`[=13 \catcode`]=13 + \catcode`.=13 \catcode`*=13% + \catcode`[=13 \catcode`]=13% \catcode`^=13 \catcode`$=13 %$ - \catcode`\=0 \catcode`<=1 \catcode`>=2 - \catcode`\\=13 \catcode`\{=12 \catcode`\}=12 \catcode`_=12 - \lccode`/=92 + \catcode`\=0 \catcode`<=1 \catcode`>=2% + \catcode`\\=13 \catcode`\{=12 \catcode`\}=12 \catcode`_=12% + \lccode`/=92% \lccode`~=92\lowercase{\def~{\string/\string/}}% \lccode`~=42\lowercase{\def~{\string/\string*}}% \lccode`~=46\lowercase{\def~{\string/\string.}}% @@ -7298,7 +7545,7 @@ \lccode`~=93\lowercase{\def~{\string/\string]}}% \lccode`~=94\lowercase{\def~{\string/\string^}}% \lccode`~=36\lowercase{\def~{\string/\string$}}% $ - \lccode`~=0 \lccode`/=0 \catcode`~=12 + \lccode`~=0 \lccode`/=0 \catcode`~=12% % \end{macrocode} % Read lines from the temporary script file, expand them to escape regexp % special characters, and store them in \cmd{\cref@poorman@text}. @@ -7330,9 +7577,9 @@ % \cmd{\lowercase} mood, why not stick with it.) % \begin{macrocode} \begingroup% - \lccode`|=92 \lccode`<=123 \lccode`>=125 \lccode`C=67 + \lccode`|=92 \lccode`<=123 \lccode`>=125 \lccode`C=67% \lowercase{\def\@tempa{%[| - s/||label|[[^]]*|]/||label/g}} + s/||label|[[^]]*|]/||label/g}}% \expandafter\g@addto@macro\expandafter% \cref@poorman@text\expandafter{\@tempa^^J}% \lowercase{\edef\@tempa{s/||usepackage|(|[.*|]|)|<0,1|><cleveref>//g}}% @@ -7412,11 +7659,11 @@ % whilst the substitution text is whatever is currently stored in % \cmd{\cref@poorman@text}. % \begin{macrocode} - \def\cref@getmeaning#1{\expandafter\@cref@getmeaning\meaning#1\@nil} - \def\@cref@getmeaning#1->#2\@nil{#2} + \def\cref@getmeaning#1{\expandafter\@cref@getmeaning\meaning#1\@nil}% + \def\@cref@getmeaning#1->#2\@nil{#2}% \def\cref@writescript#1#2{% \edef\@tempa{\cref@getmeaning{\cref@poorman@text}}% - \immediate\write\@crefscript{#1 s/#2/\@tempa/g}} + \immediate\write\@crefscript{#1 s/#2/\@tempa/g}}% % \end{macrocode} % \end{macro} % @@ -7466,7 +7713,7 @@ \else% \cref@writescript{}{\string\Cref\string{#2\string}}% \fi}% - \@tempa#1\@nil} + \@tempa#1\@nil}% \def\@crefstar#1#2{% \gdef\cref@poorman@text{}% \@crefstarredtrue\@cref{#1}{#2}\@crefstarredfalse% @@ -7476,7 +7723,7 @@ \else% \cref@writescript{}{\string\Cref*\string{#2\string}}% \fi}% - \@tempa#1\@nil} + \@tempa#1\@nil}% \def\@crefrangenostar#1#2#3{% \gdef\cref@poorman@text{}% \@setcrefrange{#2}{#3}{#1}{}% @@ -7488,7 +7735,7 @@ \cref@writescript{}{% \string\Crefrange\string{#2\string}\string{#3\string}}% \fi}% - \@tempa#1\@nil} + \@tempa#1\@nil}% \def\@crefrangestar#1#2#3{% \gdef\cref@poorman@text{}% \@crefstarredtrue\@setcrefrange{#2}{#3}{#1}{}\@crefstarredfalse% @@ -7500,7 +7747,7 @@ \cref@writescript{}{% \string\Crefrange*\string{#2\string}\string{#3\string}}% \fi}% - \@tempa#1\@nil} + \@tempa#1\@nil}% \def\@cpagerefnostar#1#2{% \gdef\cref@poorman@text{}% \@cpageref{#1}{#2}{\@setcpageref}{\@setcpagerefrange}% @@ -7510,7 +7757,7 @@ \else% \cref@writescript{}{\string\Cpageref\string{#2\string}}% \fi}% - \@tempa#1\@nil} + \@tempa#1\@nil}% \def\@cpagerefstar#1#2{% \gdef\cref@poorman@text{}% \@crefstarredtrue% @@ -7522,7 +7769,7 @@ \else% \cref@writescript{}{\string\Cpageref*\string{#2\string}}% \fi}% - \@tempa#1\@nil} + \@tempa#1\@nil}% \def\@cpagerefrangenostar#1#2#3{% \gdef\cref@poorman@text{}% \@setcpagerefrange{#2}{#3}{#1}{}% @@ -7534,7 +7781,7 @@ \cref@writescript{}{% \string\Cpagerefrange\string{#2\string}\string{#3\string}}% \fi}% - \@tempa#1\@nil} + \@tempa#1\@nil}% \def\@cpagerefrangestar#1#2#3{% \gdef\cref@poorman@text{}% \@crefstarredtrue% @@ -7548,73 +7795,73 @@ \cref@writescript{}{% \string\Cpagerefrange*\string{#2\string}\string{#3\string}}% \fi}% - \@tempa#1\@nil} + \@tempa#1\@nil}% \def\@labelcrefnostar#1{% \gdef\cref@poorman@text{}% \@cref{labelcref}{#1}% - \cref@writescript{}{\string\labelcref\string{#1\string}}} + \cref@writescript{}{\string\labelcref\string{#1\string}}}% \def\@labelcrefstar#1{% \gdef\cref@poorman@text{}% \@crefstarredtrue% \@cref{labelcref}{#1}% \@crefstarredfalse% - \cref@writescript{}{\string\labelcref*\string{#1\string}}} + \cref@writescript{}{\string\labelcref*\string{#1\string}}}% \def\@labelcpagerefnostar#1{% \gdef\cref@poorman@text{}% \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}% - \cref@writescript{}{\string\labelcpageref\string{#1\string}}} + \cref@writescript{}{\string\labelcpageref\string{#1\string}}}% \def\@labelcpagerefstar#1{% \gdef\cref@poorman@text{}% \@crefstarredtrue% \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}% \@crefstarredfalse% - \cref@writescript{}{\string\labelcpageref*\string{#1\string}}} + \cref@writescript{}{\string\labelcpageref*\string{#1\string}}}% % \else% hyperref not loaded \DeclareRobustCommand{\cref}[1]{% \gdef\cref@poorman@text{}% \@cref{cref}{#1}% - \cref@writescript{}{\string\cref\string{#1\string}}} + \cref@writescript{}{\string\cref\string{#1\string}}}% \DeclareRobustCommand{\Cref}[1]{% \gdef\cref@poorman@text{}% \@cref{Cref}{#1}% - \cref@writescript{}{\string\Cref\string{#1\string}}} + \cref@writescript{}{\string\Cref\string{#1\string}}}% \DeclareRobustCommand{\crefrange}[2]{% \gdef\cref@poorman@text{}% \@setcrefrange{#1}{#2}{cref}{}% \cref@writescript{}{% - \string\crefrange\string{#1\string}\string{#2\string}}} + \string\crefrange\string{#1\string}\string{#2\string}}}% \DeclareRobustCommand{\Crefrange}[2]{% \gdef\cref@poorman@text{}% \@setcrefrange{#1}{#2}{Cref}{}% \cref@writescript{}{% - \string\Crefrange\string{#1\string}\string{#2\string}}} + \string\Crefrange\string{#1\string}\string{#2\string}}}% \DeclareRobustCommand{\cpageref}[1]{% \gdef\cref@poorman@text{}% \@cpageref{cref}{#1}{\@setcpageref}{\@setcpagerefrange}% - \cref@writescript{}{\string\cpageref\string{#1\string}}} + \cref@writescript{}{\string\cpageref\string{#1\string}}}% \DeclareRobustCommand{\Cpageref}[1]{% \gdef\cref@poorman@text{}% \@cpageref{Cref}{#1}{\@setcpageref}{\@setcpagerefrange}% - \cref@writescript{}{\string\Cpageref\string{#1\string}}} + \cref@writescript{}{\string\Cpageref\string{#1\string}}}% \DeclareRobustCommand{\cpagerefrange}[2]{% \gdef\cref@poorman@text{}% \@setcpagerefrange{#1}{#2}{cref}{}% \cref@writescript{}{% - \string\cpagerefrange\string{#1\string}\string{#2\string}}} + \string\cpagerefrange\string{#1\string}\string{#2\string}}}% \DeclareRobustCommand{\Cpagerefrange}[2]{% \gdef\cref@poorman@text{}% \@setcpagerefrange{#1}{#2}{Cref}{}% \cref@writescript{}{% - \string\Cpagerefrange\string{#1\string}\string{#2\string}}} + \string\Cpagerefrange\string{#1\string}\string{#2\string}}}% \DeclareRobustCommand{\labelcref}[1]{% \gdef\cref@poorman@text{}% \@cref{labelcref}{#1}% - \cref@writescript{}{\string\labelcref\string{#1\string}}} + \cref@writescript{}{\string\labelcref\string{#1\string}}}% \DeclareRobustCommand{\labelcpageref}[1]{% \gdef\cref@poorman@text{}% \@cpageref{labelcref}{#1}{\@setcpageref}{\@setcpagerefrange}% - \cref@writescript{}{\string\labelcpageref\string{#1\string}}} + \cref@writescript{}{\string\labelcpageref\string{#1\string}}}% \fi% end of test for hyperref % \end{macrocode} % \end{macro} @@ -7638,27 +7885,27 @@ \DeclareRobustCommand{\namecref}[1]{% \gdef\cref@poorman@text{}% \@setnamecref{cref}{#1}{}{}% - \cref@writescript{}{\string\namecref\string{#1\string}}} + \cref@writescript{}{\string\namecref\string{#1\string}}}% \DeclareRobustCommand{\nameCref}[1]{% \gdef\cref@poorman@text{}% \@setnamecref{Cref}{#1}{}{}% - \cref@writescript{}{\string\nameCref\string{#1\string}}} + \cref@writescript{}{\string\nameCref\string{#1\string}}}% \DeclareRobustCommand{\lcnamecref}[1]{% \gdef\cref@poorman@text{}% \@setnamecref{Cref}{#1}{}{\MakeLowercase}% - \cref@writescript{}{\string\lcnamecref\string{#1\string}}} + \cref@writescript{}{\string\lcnamecref\string{#1\string}}}% \DeclareRobustCommand{\namecrefs}[1]{% \gdef\cref@poorman@text{}% \@setnamecref{cref}{#1}{@plural}{}% - \cref@writescript{}{\string\namecrefs\string{#1\string}}} + \cref@writescript{}{\string\namecrefs\string{#1\string}}}% \DeclareRobustCommand{\nameCrefs}[1]{% \gdef\cref@poorman@text{}% \@setnamecref{Cref}{#1}{@plural}{}% - \cref@writescript{}{\string\nameCrefs\string{#1\string}}} + \cref@writescript{}{\string\nameCrefs\string{#1\string}}}% \DeclareRobustCommand{\lcnamecrefs}[1]{% \gdef\cref@poorman@text{}% \@setnamecref{Cref}{#1}{@plural}{\MakeLowercase}% - \cref@writescript{}{\string\lcnamecrefs\string{#1\string}}} + \cref@writescript{}{\string\lcnamecrefs\string{#1\string}}}% % \end{macrocode} % \end{macro} % \end{macro} @@ -7683,15 +7930,15 @@ \def\@setcref@pairgroupconjunction{% \crefpairgroupconjunction% \expandafter\g@addto@macro\expandafter\cref@poorman@text% - \expandafter{\crefpairgroupconjunction}} + \expandafter{\crefpairgroupconjunction}}% \def\@setcref@middlegroupconjunction{% \crefmiddlegroupconjunction% \expandafter\g@addto@macro\expandafter\cref@poorman@text% - \expandafter{\crefmiddlegroupconjunction}} + \expandafter{\crefmiddlegroupconjunction}}% \def\@setcref@lastgroupconjunction{% \creflastgroupconjunction% \expandafter\g@addto@macro\expandafter\cref@poorman@text% - \expandafter{\creflastgroupconjunction}} + \expandafter{\creflastgroupconjunction}}% % \end{macrocode} % \end{macro} % \end{macro} @@ -7704,10 +7951,10 @@ % 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}% @@ -7717,7 +7964,7 @@ \else% \expandafter\g@addto@macro\expandafter\cref@poorman@text% \expandafter{#1{\ref{#2}}{}{}}% - \fi} + \fi}% \def\@@setcrefrange#1#2#3{% \old@@setcrefrange{#1}{#2}{#3}% \if@crefstarred% @@ -7726,7 +7973,7 @@ \else% \expandafter\g@addto@macro\expandafter\cref@poorman@text% \expandafter{#1{\ref{#2}}{\ref{#3}}{}{}{}{}}% - \fi} + \fi}% \def\@@setcpageref#1#2{% \old@@setcpageref{#1}{#2}% \if@crefstarred% @@ -7735,7 +7982,7 @@ \else% \expandafter\g@addto@macro\expandafter\cref@poorman@text% \expandafter{#1{\pageref{#2}}{}{}}% - \fi} + \fi}% \def\@@setcpagerefrange#1#2#3{% \old@@setcpagerefrange{#1}{#2}{#3}% \if@crefstarred% @@ -7744,29 +7991,29 @@ \else% \expandafter\g@addto@macro\expandafter\cref@poorman@text% \expandafter{#1{\pageref{#2}}{\pageref{#3}}{}{}{}{}}% - \fi} + \fi}% % \else% hyperref not loaded \def\@@setcref#1#2{% \old@@setcref{#1}{#2}% \expandafter\g@addto@macro\expandafter{% \expandafter\cref@poorman@text\expandafter}% - \expandafter{#1{\ref{#2}}{}{}}} + \expandafter{#1{\ref{#2}}{}{}}}% \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}}{}{}{}{}}} + \expandafter{#1{\ref{#2}}{\ref{#3}}{}{}{}{}}}% \def\@@setcpageref#1#2{% \old@@setcpageref{#1}{#2}% \expandafter\g@addto@macro\expandafter{% \expandafter\cref@poorman@text\expandafter}% - \expandafter{#1{\pageref{#2}}{}{}}} + \expandafter{#1{\pageref{#2}}{}{}}}% \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}}{}{}{}{}}} + \expandafter{#1{\pageref{#2}}{\pageref{#3}}{}{}{}{}}}% \fi% end of hyperref test % \end{macrocode} % \end{macro} @@ -7778,7 +8025,7 @@ % \package{hyperref} is loaded, so we don't need to test for % \package{hyperref} when redefining \cmd{\@@setnamecref}. % \begin{macrocode} - \let\old@@setnamecref\@@setnamecref + \let\old@@setnamecref\@@setnamecref% \def\@@setnamecref#1#2{% \old@@setnamecref{#1}{#2}% \expandafter\def\expandafter\@tempa\expandafter{#1}% @@ -7787,7 +8034,7 @@ \expandafter\expandafter\expandafter{% \expandafter\expandafter\expandafter\cref@poorman@text% \expandafter\expandafter\expandafter}% - \expandafter\expandafter\expandafter{\expandafter\@tempb\@tempa}} + \expandafter\expandafter\expandafter{\expandafter\@tempb\@tempa}}% % \end{macrocode} % \end{macro} % @@ -7807,14 +8054,14 @@ \def\@@vpageref#1[#2]#3{% \gdef\cref@poorman@text{}% \cref@@vpageref{#1}[#2]{#3}% - \cref@writescript{}{\string\vpageref\string{#3\string}}} + \cref@writescript{}{\string\vpageref\string{#3\string}}}% % \end{macrocode} % \end{macro} % % \begin{macro}{\cref@vref} % \cmd{\cref@vref} is similarly redefined to write a substitution rule. % \begin{macrocode} - \let\old@cref@vref\cref@vref + \let\old@cref@vref\cref@vref% \def\cref@vref#1#2{% \gdef\cref@poorman@text{}% \old@cref@vref{#1}{#2}% @@ -7832,7 +8079,7 @@ \cref@writescript{}{\string\Vref\string{#2\string}}% \fi% \fi}% - \@tempa#1\@nil} + \@tempa#1\@nil}% % \end{macrocode} % \end{macro} % @@ -7845,7 +8092,7 @@ % in that case. However, the redundant check does no harm, and avoids % some code duplication. % \begin{macrocode} - \let\old@cref@fullref\cref@fullref + \let\old@cref@fullref\cref@fullref% \def\cref@fullref#1#2{% \gdef\cref@poorman@text{}% \old@cref@fullref{#1}{#2}% @@ -7863,9 +8110,9 @@ \cref@writescript{}{\string\Fullref\string{#2\string}}% \fi% \fi}% - \@tempa#1\@nil} + \@tempa#1\@nil}% % - \let\old@cref@vrefrange\cref@vrefrange + \let\old@cref@vrefrange\cref@vrefrange% \def\cref@vrefrange#1#2#3{% \gdef\cref@poorman@text{}% \old@cref@vrefrange{#1}{#2}{#3}% @@ -7887,7 +8134,7 @@ \string\Vrefrange\string{#2\string}\string{#3\string}}% \fi% \fi}% - \@tempa#1\@nil} + \@tempa#1\@nil}% % \end{macrocode} % \end{macro} % \end{macro} @@ -7903,16 +8150,16 @@ % \begin{macrocode} \def\@@setvpageref#1[#2]#3{% \cref@old@@vpageref{#1}[#2]{#3}% - \g@addto@macro\cref@poorman@text{\vpageref{#3}}} + \g@addto@macro\cref@poorman@text{\vpageref{#3}}}% \def\@@setvpagerefrange[#1]#2#3{% \vpagerefrange[#1]{#2}{#3}% - \g@addto@macro\cref@poorman@text{\vpagerefrange{#2}{#3}}} + \g@addto@macro\cref@poorman@text{\vpagerefrange{#2}{#3}}}% \def\@@setfullpageref#1{% \reftextfaraway{#1}% - \g@addto@macro\cref@poorman@text{\reftextfaraway{#1}}} + \g@addto@macro\cref@poorman@text{\reftextfaraway{#1}}}% \def\@@setfullpagerefrange#1#2{% \reftextpagerange{#1}{#2}% - \g@addto@macro\cref@poorman@text{\reftextpagerange{#1}{#2}}} + \g@addto@macro\cref@poorman@text{\reftextpagerange{#1}{#2}}}% % \end{macrocode} % \end{macro} % \end{macro} @@ -7925,19 +8172,19 @@ % the\linebreak[4] \cmd{\cref@poorman@text} substitution. % \begin{macrocode} \def\@setcref@space{ % space here is deliberate - \g@addto@macro\cref@poorman@text{ }} + \g@addto@macro\cref@poorman@text{ }}% \def\@setcref@pairconjunction{% \crefpairconjunction% \expandafter\g@addto@macro\expandafter\cref@poorman@text% - \expandafter{\crefpairconjunction}} + \expandafter{\crefpairconjunction}}% \def\@setcref@middleconjunction{% \crefmiddleconjunction% \expandafter\g@addto@macro\expandafter\cref@poorman@text% - \expandafter{\crefmiddleconjunction}} + \expandafter{\crefmiddleconjunction}}% \def\@setcref@lastconjunction{% \creflastconjunction% \expandafter\g@addto@macro\expandafter\cref@poorman@text% - \expandafter{\creflastconjunction}} + \expandafter{\creflastconjunction}}% }% end of \AtBeginDocument }{}% end of \@ifpackageloaded{varioref} }% end of poorman option @@ -7961,32 +8208,32 @@ % references (default is to do both). They work simply by setting the % |\if@cref@sort| and |\if@cref@compress| flags appropriately. % \begin{macrocode} -\newif\if@cref@sort -\newif\if@cref@compress +\newif\if@cref@sort% +\newif\if@cref@compress% % \end{macrocode} % Default is to both sort and compress references. % \begin{macrocode} -\@cref@sorttrue -\@cref@compresstrue +\@cref@sorttrue% +\@cref@compresstrue% % \end{macrocode} % Options override default. % \begin{macrocode} \DeclareOption{sort}{% \PackageInfo{cleveref}{sorting but not compressing references}% \@cref@sorttrue% - \@cref@compressfalse} + \@cref@compressfalse}% \DeclareOption{compress}{% \PackageInfo{cleveref}{compressing but not sorting references}% \@cref@sortfalse% - \@cref@compresstrue} + \@cref@compresstrue}% \DeclareOption{sort&compress}{% \PackageInfo{cleveref}{sorting and compressing references}% \@cref@sorttrue% - \@cref@compresstrue} + \@cref@compresstrue}% \DeclareOption{nosort}{% \PackageInfo{cleveref}{neither sorting nor compressing references}% \@cref@sortfalse% - \@cref@compressfalse} + \@cref@compressfalse}% % \end{macrocode} % \end{macro} % \end{macro} @@ -8003,20 +8250,20 @@ % use the |\Cref|* variants for typesetting cross-references, so that % cross-reference names are always capitalised. % \begin{macrocode} -\newif\if@cref@capitalise +\newif\if@cref@capitalise% % \end{macrocode} % Disabled by default. % \begin{macrocode} -\@cref@capitalisefalse +\@cref@capitalisefalse% % \end{macrocode} % Option overrides default. % \begin{macrocode} \DeclareOption{capitalise}{% \PackageInfo{cleveref}{always capitalise cross-reference names}% - \@cref@capitalisetrue} + \@cref@capitalisetrue}% \DeclareOption{capitalize}{% \PackageInfo{cleveref}{always capitalise cross-reference names}% - \@cref@capitalisetrue} + \@cref@capitalisetrue}% % \end{macrocode} % \end{macro} % \end{macro} @@ -8030,17 +8277,17 @@ % the cross-reference name as part of the hyperlink target when the % \package{hyperref} package is used. % \begin{macrocode} -\newif\if@cref@nameinlink +\newif\if@cref@nameinlink% % \end{macrocode} % Disabled by default. % \begin{macrocode} -\@cref@nameinlinkfalse +\@cref@nameinlinkfalse% % \end{macrocode} % Option overrides default. % \begin{macrocode} \DeclareOption{nameinlink}{% \PackageInfo{cleveref}{include cross-reference names in hyperlinks}% - \@cref@nameinlinktrue} + \@cref@nameinlinktrue}% % \end{macrocode} % \end{macro} % \end{macro} @@ -8054,17 +8301,17 @@ % the full cross-reference names, instead of abbreviating some of the % more common names in the middle of sentences. % \begin{macrocode} -\newif\if@cref@abbrev +\newif\if@cref@abbrev% % \end{macrocode} % Enabled by default. % \begin{macrocode} -\@cref@abbrevtrue +\@cref@abbrevtrue% % \end{macrocode} % Option overrides default. % \begin{macrocode} \DeclareOption{noabbrev}{% \PackageInfo{cleveref}{no abbreviation of names}% - \@cref@abbrevfalse} + \@cref@abbrevfalse}% % \end{macrocode} % \end{macro} % \end{macro} @@ -8097,8 +8344,8 @@ \toks@\expandafter{#1}% \edef#1{\the\toks@\the\@temptokena}% \fi% - \@temptokena{}\toks@\@temptokena} -\@onlypreamble\cref@addto + \@temptokena{}\toks@\@temptokena}% +\@onlypreamble\cref@addto% % \end{macrocode} % \end{macro} % @@ -8118,7 +8365,7 @@ \ifin@% \AtBeginDocument{% \expandafter\cref@addto\csname extras#1\endcsname{#2}}% - \fi}{}}} + \fi}{}}}% % \end{macrocode} % \end{macro} % @@ -8412,9 +8659,9 @@ % % \subsubsection{German} % \begin{macro}{german} -% German translations kindly provided by Stefan Pinnow, with a few -% additions by the package author (so you know to blame the latter for -% any errors!). +% German translations kindly provided by Stefan Pinnow, abbreviations +% by Natanael Arndt, and a few additions by the package author (so you +% know to blame the latter for any errors!). % \end{macro} % % Set up the definitions used at the beginning of the document to define @@ -8463,8 +8710,12 @@ \Crefname@preamble{listing}{Listing}{Listings}% \Crefname@preamble{line}{Zeile}{Zeilen}% % + \if@cref@abbrev% + \crefname@preamble{figure}{Abb.}{Abb.}% + \else% + \crefname@preamble{figure}{Abbildung}{Abbildungen}% + \fi% \crefname@preamble{equation}{Gleichung}{Gleichungen}% - \crefname@preamble{figure}{Abbildung}{Abbildungen}% \crefname@preamble{table}{Tabelle}{Tabellen}% \crefname@preamble{page}{Seite}{Seiten}% \crefname@preamble{part}{Teil}{Teile}% @@ -8541,9 +8792,14 @@ \Crefname{listing}{Listing}{Listings}% \Crefname{line}{Zeile}{Zeilen}% % + \if@cref@abbrev% + \crefname{figure}{Abb.}{Abb.}% + \crefname{subfigure}{Abb.}{Abb.}% + \else% + \crefname{figure}{Abbildung}{Abbildungen}% + \crefname{subfigure}{Abbildung}{Abbildungen}% + \fi% \crefname{equation}{Gleichung}{Gleichungen}% - \crefname{figure}{Abbildung}{Abbildungen}% - \crefname{subfigure}{Abbildung}{Abbildungen}% \crefname{table}{Tabelle}{Tabellen}% \crefname{subtable}{Tabelle}{Tabellen}% \crefname{page}{Seite}{Seiten}% @@ -8584,8 +8840,8 @@ % \end{macro} % \begin{macrocode} \DeclareOption{ngerman}{% - \ExecuteOptions{german} - \def\cref@language{ngerman}} + \ExecuteOptions{german}% + \def\cref@language{ngerman}}% % \end{macrocode} % However, we still need to add the definitions to \cmd{\extrasngerman} % (note the ``n'') so that \cmd{\selectlanguage} etc.\ will work. @@ -8636,9 +8892,14 @@ \Crefname{listing}{Listing}{Listings}% \Crefname{line}{Zeile}{Zeilen}% % + \if@cref@abbrev% + \crefname{figure}{Abb.}{Abb.}% + \crefname{subfigure}{Abb.}{Abb.}% + \else% + \crefname{figure}{Abbildung}{Abbildungen}% + \crefname{subfigure}{Abbildung}{Abbildungen}% + \fi% \crefname{equation}{Gleichung}{Gleichungen}% - \crefname{figure}{Abbildung}{Abbildungen}% - \crefname{subfigure}{Abbildung}{Abbildungen}% \crefname{table}{Tabelle}{Tabellen}% \crefname{subtable}{Tabelle}{Tabellen}% \crefname{page}{Seite}{Seiten}% @@ -9965,13 +10226,13 @@ {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}% \Crefname{subappendix}% {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}% - {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya} + {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}% \Crefname{subsubappendix}% {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}% - {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya} + {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}% \Crefname{subsubsubappendix}% {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}% - {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya} + {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}% \Crefname{enumi}% {\CYRP\cyru\cyrn\cyrk\cyrt}% {\CYRP\cyru\cyrn\cyrk\cyrt\cyrery}% @@ -11127,7 +11388,7 @@ % \end{macrocode} % % -% \subsubsection{Norsk} +% \subsubsection{Norwegian} % \begin{macro}{norsk} % Norwegian translations kindly donated by Sveinung Heggen. % \end{macro} @@ -12004,7 +12265,7 @@ % \end{macrocode} % % -% \subsection{Brazilian} +% \subsubsection{Brazilian} % \begin{macro}{brazilian} % Brazilian translations courtesy of Paulo Roberto Massa Cereda. % \end{macro} @@ -12027,24 +12288,24 @@ \def\crefmiddlegroupconjunction@preamble{, }% \def\creflastgroupconjunction@preamble{, e\nobreakspace}% % - \Crefname@preamble{equation}{Equa\cc\~ao}{Equa\cc\~oes}% + \Crefname@preamble{equation}{Equa\c c\~ao}{Equa\c c\~oes}% \Crefname@preamble{figure}{Figura}{Figuras}% \Crefname@preamble{table}{Tabela}{Tabelas}% \Crefname@preamble{page}{P\'agina}{P\'aginas}% \Crefname@preamble{part}{Parte}{Partes}% \Crefname@preamble{chapter}{Cap\'itulo}{Cap\'itulos}% - \Crefname@preamble{section}{Se\cc\~ao}{Se\cc\~oes}% + \Crefname@preamble{section}{Se\c c\~ao}{Se\c c\~oes}% \Crefname@preamble{appendix}{Ap\^endice}{Ap\^endices}% \Crefname@preamble{enumi}{Item}{Itens}% \Crefname@preamble{footnote}{Nota de rodap\'e}{Notas de rodap\'e}% \Crefname@preamble{theorem}{Teorema}{Teoremas}% \Crefname@preamble{lemma}{Lema}{Lemas}% \Crefname@preamble{corollary}{Corol\'ario}{Corol\'arios}% - \Crefname@preamble{proposition}{Proposi\cc\~ao}{Proposi\cc\~oes}% - \Crefname@preamble{definition}{Defini\cc\~ao}{Defini\cc\~oes}% + \Crefname@preamble{proposition}{Proposi\c c\~ao}{Proposi\c c\~oes}% + \Crefname@preamble{definition}{Defini\c c\~ao}{Defini\c c\~oes}% \Crefname@preamble{result}{Resultado}{Resultados}% \Crefname@preamble{example}{Exemplo}{Exemplos}% - \Crefname@preamble{remark}{Observa\cc\~ao}{Observa\cc\~oes}% + \Crefname@preamble{remark}{Observa\c c\~ao}{Observa\c c\~oes}% \Crefname@preamble{note}{Nota}{Notas}% \Crefname@preamble{algorithm}{Algoritmo}{Algoritmos}% \Crefname@preamble{listing}{Listagem}{Listagens}% @@ -12055,25 +12316,25 @@ \crefname@preamble{equation}{Eq.}{Eqs.}% \crefname@preamble{figure}{Fig.}{Figs.}% \else% - \crefname@preamble{equation}{Equa\cc\~ao}{Equa\cc\~oes}% + \crefname@preamble{equation}{Equa\c c\~ao}{Equa\c c\~oes}% \crefname@preamble{figure}{Figura}{Figuras}% \fi% \crefname@preamble{page}{P\'agina}{P\'aginas}% \crefname@preamble{table}{Tabela}{Tabelas}% \crefname@preamble{part}{Parte}{Partes}% \crefname@preamble{chapter}{Cap\'itulo}{Cap\'itulos}% - \crefname@preamble{section}{Se\cc\~ao}{Se\cc\~oes}% + \crefname@preamble{section}{Se\c c\~ao}{Se\c c\~oes}% \crefname@preamble{appendix}{Ap\^endice}{Ap\^endices}% \crefname@preamble{enumi}{Item}{Itens}% \crefname@preamble{footnote}{Nota de rodap\'e}{Notas de rodap\'e}% \crefname@preamble{theorem}{Teorema}{Teoremas}% \crefname@preamble{lemma}{Lema}{Lemas}% \crefname@preamble{corollary}{Corol\'ario}{Corol\'arios}% - \crefname@preamble{proposition}{Proposi\cc\~ao}{Proposi\cc\~oes}% - \crefname@preamble{definition}{Defini\cc\~ao}{Defini\cc\~oes}% + \crefname@preamble{proposition}{Proposi\c c\~ao}{Proposi\c c\~oes}% + \crefname@preamble{definition}{Defini\c c\~ao}{Defini\c c\~oes}% \crefname@preamble{result}{Resultado}{Resultados}% \crefname@preamble{example}{Exemplo}{Exemplos}% - \crefname@preamble{remark}{Observa\cc\~ao}{Observa\cc\~oes}% + \crefname@preamble{remark}{Observa\c c\~ao}{Observa\c c\~oes}% \crefname@preamble{note}{Nota}{Notas}% \crefname@preamble{algorithm}{Algoritmo}{Algoritmos}% \crefname@preamble{listing}{Listagem}{Listagens}% @@ -12084,25 +12345,25 @@ \crefname@preamble{equation}{eq.}{eqs.}% \crefname@preamble{figure}{fig.}{figs.}% \else% - \crefname@preamble{equation}{equa\cc\~ao}{equa\cc\~oes}% + \crefname@preamble{equation}{equa\c c\~ao}{equa\c c\~oes}% \crefname@preamble{figure}{figura}{figuras}% \fi% \crefname@preamble{page}{p\'agina}{p\'aginas}% \crefname@preamble{table}{tabela}{tabelas}% \crefname@preamble{part}{parte}{partes}% \crefname@preamble{chapter}{cap\'itulo}{cap\'itulos}% - \crefname@preamble{section}{se\cc\~ao}{se\cc\~oes}% + \crefname@preamble{section}{se\c c\~ao}{se\c c\~oes}% \crefname@preamble{appendix}{ap\^endice}{ap\^endices}% \crefname@preamble{enumi}{item}{itens}% \crefname@preamble{footnote}{nota de rodap\'e}{notas de rodap\'e}% \crefname@preamble{theorem}{teorema}{teoremas}% \crefname@preamble{lemma}{lema}{lemas}% \crefname@preamble{corollary}{corol\'ario}{corol\'arios}% - \crefname@preamble{proposition}{proposi\cc\~ao}{proposi\cc\~oes}% - \crefname@preamble{definition}{defini\cc\~ao}{defini\cc\~oes}% + \crefname@preamble{proposition}{proposi\c c\~ao}{proposi\c c\~oes}% + \crefname@preamble{definition}{defini\c c\~ao}{defini\c c\~oes}% \crefname@preamble{result}{resultado}{resultados}% \crefname@preamble{example}{exemplo}{exemplos}% - \crefname@preamble{remark}{observa\cc\~ao}{observa\cc\~oes}% + \crefname@preamble{remark}{observa\c c\~ao}{observa\c c\~oes}% \crefname@preamble{note}{nota}{notas}% \crefname@preamble{algorithm}{algoritmo}{algoritmos}% \crefname@preamble{listing}{listagem}{listagens}% @@ -12130,7 +12391,7 @@ \renewcommand{\crefmiddlegroupconjunction}{, }% \renewcommand{\creflastgroupconjunction}{ e\nobreakspace}% % - \Crefname{equation}{Equa\cc\~ao}{Equa\cc\~oes}% + \Crefname{equation}{Equa\c c\~ao}{Equa\c c\~oes}% \Crefname{figure}{Figura}{Figuras}% \Crefname{subfigure}{Figura}{Figuras}% \Crefname{table}{Tabela}{Tabelas}% @@ -12138,9 +12399,9 @@ \Crefname{page}{P\'agina}{P\'aginas}% \Crefname{part}{Parte}{Partes}% \Crefname{chapter}{Cap\'itulo}{Cap\'itulos}% - \Crefname{section}{Se\cc\~ao}{Se\cc\~oes}% - \Crefname{subsection}{Se\cc\~ao}{Se\cc\~oes}% - \Crefname{subsubsection}{Se\cc\~ao}{Se\cc\~oes}% + \Crefname{section}{Se\c c\~ao}{Se\c c\~oes}% + \Crefname{subsection}{Se\c c\~ao}{Se\c c\~oes}% + \Crefname{subsubsection}{Se\c c\~ao}{Se\c c\~oes}% \Crefname{appendix}{Ap\^endice}{Ap\^endices}% \Crefname{subappendix}{Ap\^endice}{Ap\^endices}% \Crefname{subsubappendix}{Ap\^endice}{Ap\^endices}% @@ -12154,11 +12415,11 @@ \Crefname{theorem}{Teorema}{Teoremas}% \Crefname{lemma}{Lema}{Lemas}% \Crefname{corollary}{Corol\'ario}{Corol\'arios}% - \Crefname{proposition}{Proposi\cc\~ao}{Proposi\cc\~oes}% - \Crefname{definition}{Defini\cc\~ao}{Defini\cc\~oes}% + \Crefname{proposition}{Proposi\c c\~ao}{Proposi\c c\~oes}% + \Crefname{definition}{Defini\c c\~ao}{Defini\c c\~oes}% \Crefname{result}{Resultado}{Resultados}% \Crefname{example}{Exemplo}{Exemplos}% - \Crefname{remark}{Observa\cc\~ao}{Observa\cc\~oes}% + \Crefname{remark}{Observa\c c\~ao}{Observa\c c\~oes}% \Crefname{note}{Nota}{Notas}% \Crefname{algorithm}{Algoritmo}{Algoritmos}% \Crefname{listing}{Listagem}{Listagens}% @@ -12170,7 +12431,7 @@ \crefname{figure}{Fig.}{Figs.}% \crefname{subfigure}{Fig.}{Figs.}% \else% - \crefname{equation}{Equa\cc\~ao}{Equa\cc\~oes}% + \crefname{equation}{Equa\c c\~ao}{Equa\c c\~oes}% \crefname{figure}{Figura}{Figuras}% \crefname{subfigure}{Figura}{Figuras}% \fi% @@ -12179,9 +12440,9 @@ \crefname{subtable}{Tabela}{Tabelas}% \crefname{part}{Parte}{Partes}% \crefname{chapter}{Cap\'itulo}{Cap\'itulos}% - \crefname{section}{Se\cc\~ao}{Se\cc\~oes}% - \crefname{subsection}{Se\cc\~ao}{Se\cc\~oes}% - \crefname{subsubsection}{Se\cc\~ao}{Se\cc\~oes}% + \crefname{section}{Se\c c\~ao}{Se\c c\~oes}% + \crefname{subsection}{Se\c c\~ao}{Se\c c\~oes}% + \crefname{subsubsection}{Se\c c\~ao}{Se\c c\~oes}% \crefname{appendix}{Ap\^endice}{Ap\^endices}% \crefname{subappendix}{Ap\^endice}{Ap\^endices}% \crefname{subsubappendix}{Ap\^endice}{Ap\^endices}% @@ -12195,11 +12456,11 @@ \crefname{theorem}{Teorema}{Teoremas}% \crefname{lemma}{Lema}{Lemas}% \crefname{corollary}{Corol\'ario}{Corol\'arios}% - \crefname{proposition}{Proposi\cc\~ao}{Proposi\cc\~oes}% - \crefname{definition}{Defini\cc\~ao}{Defini\cc\~oes}% + \crefname{proposition}{Proposi\c c\~ao}{Proposi\c c\~oes}% + \crefname{definition}{Defini\c c\~ao}{Defini\c c\~oes}% \crefname{result}{Resultado}{Resultados}% \crefname{example}{Exemplo}{Exemplos}% - \crefname{remark}{Observa\cc\~ao}{Observa\cc\~oes}% + \crefname{remark}{Observa\c c\~ao}{Observa\c c\~oes}% \crefname{note}{Nota}{Notas}% \crefname{algorithm}{Algoritmo}{Algoritmos}% \crefname{listing}{Listagem}{Listagens}% @@ -12211,7 +12472,7 @@ \crefname{figure}{fig.}{figs.}% \crefname{subfigure}{fig.}{figs.}% \else% - \crefname{equation}{equa\cc\~ao}{equa\cc\~oes}% + \crefname{equation}{equa\c c\~ao}{equa\c c\~oes}% \crefname{figure}{figura}{figuras}% \crefname{subfigure}{figura}{figuras}% \fi% @@ -12220,9 +12481,9 @@ \crefname{page}{p\'agina}{p\'aginas}% \crefname{part}{parte}{partes}% \crefname{chapter}{cap\'itulo}{cap\'itulos}% - \crefname{section}{se\cc\~ao}{se\cc\~oes}% - \crefname{subsection}{se\cc\~ao}{se\cc\~oes}% - \crefname{subsubsection}{se\cc\~ao}{se\cc\~oes}% + \crefname{section}{se\c c\~ao}{se\c c\~oes}% + \crefname{subsection}{se\c c\~ao}{se\c c\~oes}% + \crefname{subsubsection}{se\c c\~ao}{se\c c\~oes}% \crefname{appendix}{ap\^endice}{ap\^endices}% \crefname{subappendix}{ap\^endice}{ap\^endices}% \crefname{subsubappendix}{ap\^endice}{ap\^endices}% @@ -12236,11 +12497,11 @@ \crefname{theorem}{teorema}{teoremas}% \crefname{lemma}{lema}{lemas}% \crefname{corollary}{corol\'ario}{corol\'arios}% - \crefname{proposition}{proposi\cc\~ao}{proposi\cc\~oes}% - \crefname{definition}{defini\cc\~ao}{defini\cc\~oes}% + \crefname{proposition}{proposi\c c\~ao}{proposi\c c\~oes}% + \crefname{definition}{defini\c c\~ao}{defini\c c\~oes}% \crefname{result}{resultado}{resultados}% \crefname{example}{exemplo}{exemplos}% - \crefname{remark}{observa\cc\~ao}{observa\cc\~oes}% + \crefname{remark}{observa\c c\~ao}{observa\c c\~oes}% \crefname{note}{nota}{notas}% \crefname{algorithm}{algoritmo}{algoritmos}% \crefname{listing}{listagem}{listagens}% @@ -12286,13 +12547,13 @@ % hyperlink must come outside the group or it will cause \LaTeX{} % grouping errors, so we must define it differently in that case. % \begin{macrocode} -\crefdefaultlabelformat{#2#1#3} +\crefdefaultlabelformat{#2#1#3}% \if@cref@nameinlink% \creflabelformat{equation}{#2\textup{(#1)}#3}% \else% \creflabelformat{equation}{\textup{(#2#1#3)}}% -\fi -\@labelcrefdefinedefaultformats +\fi% +\@labelcrefdefinedefaultformats% % \end{macrocode} % \end{macro} % \end{macro} @@ -12308,8 +12569,8 @@ {`polyglossia' loaded but default language not set - defaulting to english}% \ExecuteOptions{english}}}% - {\ExecuteOptions{english}} -\ProcessOptions*\relax + {\ExecuteOptions{english}}% +\ProcessOptions*\relax% % \end{macrocode} % % @@ -12508,12 +12769,11 @@ % \cmd{\cref\meta{type}@name@plural}. Though \cmd{\crefname} and % \cmd{\Crefname} always define both the singular and plural forms % together, cross-reference names can also be defined automatically by -% \cmd{\newtheorem}, which can only define the singular form. In this -% case, the singular form might be defined whilst the plural form is -% undefined. For symmetry, we apply the same logic to the normal -% cross-reference format definition (only defining it if -% \cmd{\cref\meta{type}@name} is defined), though currently this should -% always be the case. +% \cmd{\newtheorem}, which can only define the singular form. For +% symmetry, we apply the same logic to the normal cross-reference format +% definition (only defining it if the singular form of the name is +% defined in \cmd{\cref\meta{type}@name}), though this should always be +% the case. % \begin{macrocode} \@ifundefined{cref@\@tempa @format}{% \@ifundefined{cref@\@tempa @name}{}{% @@ -12537,135 +12797,135 @@ % \begin{macrocode} \@ifundefined{cref@subsection@name}{% \let\cref@subsection@name\cref@section@name% - \let\cref@subsection@name@plural\cref@section@name@plural}{}% + \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}{}% + \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}{}% + \crefrange@section@format}{}% \@ifundefined{Crefrange@subsection@format}{% \let\Crefrange@subsection@format% - \Crefrange@section@format}{}% + \Crefrange@section@format}{}% \@ifundefined{cref@subsection@format@first}{% \let\cref@subsection@format@first% - \cref@section@format@first}{}% + \cref@section@format@first}{}% \@ifundefined{Cref@subsection@format@first}{% \let\Cref@subsection@format@first% - \Cref@section@format@first}{}% + \Cref@section@format@first}{}% \@ifundefined{cref@subsection@format@second}{% \let\cref@subsection@format@second% - \cref@section@format@second}{}% + \cref@section@format@second}{}% \@ifundefined{Cref@subsection@format@second}{% \let\Cref@subsection@format@second% - \Cref@section@format@second}{}% + \Cref@section@format@second}{}% \@ifundefined{cref@subsection@format@middle}{% \let\cref@subsection@format@middle% - \cref@section@format@middle}{}% + \cref@section@format@middle}{}% \@ifundefined{Cref@subsection@format@middle}{% \let\Cref@subsection@format@middle% - \Cref@section@format@middle}{}% + \Cref@section@format@middle}{}% \@ifundefined{cref@subsection@format@last}{% \let\cref@subsection@format@last% - \cref@section@format@last}{}% + \cref@section@format@last}{}% \@ifundefined{Cref@subsection@format@last}{% \let\Cref@subsection@format@last% - \Cref@section@format@last}{}% + \Cref@section@format@last}{}% \@ifundefined{crefrange@subsection@format@first}{% \let\crefrange@subsection@format@first% - \crefrange@section@format@first}{}% + \crefrange@section@format@first}{}% \@ifundefined{Crefrange@subsection@format@first}{% \let\Crefrange@subsection@format@first% - \Crefrange@section@format@first}{}% + \Crefrange@section@format@first}{}% \@ifundefined{crefrange@subsection@format@second}{% \let\crefrange@subsection@format@second% - \crefrange@section@format@second}{}% + \crefrange@section@format@second}{}% \@ifundefined{Crefrange@subsection@format@second}{% \let\Crefrange@subsection@format@second% - \Crefrange@section@format@second}{}% + \Crefrange@section@format@second}{}% \@ifundefined{crefrange@subsection@format@middle}{% \let\crefrange@subsection@format@middle% - \crefrange@section@format@middle}{}% + \crefrange@section@format@middle}{}% \@ifundefined{Crefrange@subsection@format@middle}{% \let\Crefrange@subsection@format@middle% - \Crefrange@section@format@middle}{}% + \Crefrange@section@format@middle}{}% \@ifundefined{crefrange@subsection@format@last}{% \let\crefrange@subsection@format@last% - \crefrange@section@format@last}{}% + \crefrange@section@format@last}{}% \@ifundefined{Crefrange@subsection@format@last}{% \let\Crefrange@subsection@format@last% - \Crefrange@section@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}{}% + \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}{}% + \let\Cref@subsection@name@plural\Cref@section@name@plural}{}% \@ifundefined{cref@subsubsection@format}{% \let\cref@subsubsection@format% - \cref@subsection@format}{}% + \cref@subsection@format}{}% \@ifundefined{Cref@subsubsection@format}{% \let\Cref@subsubsection@format% - \Cref@subsection@format}{}% + \Cref@subsection@format}{}% \@ifundefined{crefrange@subsubsection@format}{% \let\crefrange@subsubsection@format% - \crefrange@subsection@format}{}% + \crefrange@subsection@format}{}% \@ifundefined{Crefrange@subsubsection@format}{% \let\Crefrange@subsubsection@format% - \Crefrange@subsection@format}{}% + \Crefrange@subsection@format}{}% \@ifundefined{cref@subsubsection@format@first}{% \let\cref@subsubsection@format@first% - \cref@subsection@format@first}{}% + \cref@subsection@format@first}{}% \@ifundefined{Cref@subsubsection@format@first}{% \let\Cref@subsubsection@format@first% - \Cref@subsection@format@first}{}% + \Cref@subsection@format@first}{}% \@ifundefined{cref@subsubsection@format@second}{% \let\cref@subsubsection@format@second% - \cref@subsection@format@second}{}% + \cref@subsection@format@second}{}% \@ifundefined{Cref@subsubsection@format@second}{% \let\Cref@subsubsection@format@second% - \Cref@subsection@format@second}{}% + \Cref@subsection@format@second}{}% \@ifundefined{cref@subsubsection@format@middle}{% \let\cref@subsubsection@format@middle% - \cref@subsection@format@middle}{}% + \cref@subsection@format@middle}{}% \@ifundefined{Cref@subsubsection@format@middle}{% \let\Cref@subsubsection@format@middle% - \Cref@subsection@format@middle}{}% + \Cref@subsection@format@middle}{}% \@ifundefined{cref@subsubsection@format@last}{% \let\cref@subsubsection@format@last% - \cref@subsection@format@last}{}% + \cref@subsection@format@last}{}% \@ifundefined{Cref@subsubsection@format@last}{% \let\Cref@subsubsection@format@last% - \Cref@subsection@format@last}{}% + \Cref@subsection@format@last}{}% \@ifundefined{crefrange@subsubsection@format@first}{% \let\crefrange@subsubsection@format@first% - \crefrange@subsection@format@first}{}% + \crefrange@subsection@format@first}{}% \@ifundefined{Crefrange@subsubsection@format@first}{% \let\Crefrange@subsubsection@format@first% - \Crefrange@subsection@format@first}{}% + \Crefrange@subsection@format@first}{}% \@ifundefined{crefrange@subsubsection@format@second}{% \let\crefrange@subsubsection@format@second% - \crefrange@subsection@format@second}{}% + \crefrange@subsection@format@second}{}% \@ifundefined{Crefrange@subsubsection@format@second}{% \let\Crefrange@subsubsection@format@second% - \Crefrange@subsection@format@second}{}% + \Crefrange@subsection@format@second}{}% \@ifundefined{crefrange@subsubsection@format@middle}{% \let\crefrange@subsubsection@format@middle% - \crefrange@subsection@format@middle}{}% + \crefrange@subsection@format@middle}{}% \@ifundefined{Crefrange@subsubsection@format@middle}{% \let\Crefrange@subsubsection@format@middle% - \Crefrange@subsection@format@middle}{}% + \Crefrange@subsection@format@middle}{}% \@ifundefined{crefrange@subsubsection@format@last}{% \let\crefrange@subsubsection@format@last% - \crefrange@subsection@format@last}{}% + \crefrange@subsection@format@last}{}% \@ifundefined{Crefrange@subsubsection@format@last}{% \let\Crefrange@subsubsection@format@last% - \Crefrange@subsection@format@last}{}% + \Crefrange@subsection@format@last}{}% % \end{macrocode} % Similarly for subsections within appendices. % \begin{macrocode} @@ -12683,58 +12943,58 @@ \let\Cref@subappendix@format\Cref@appendix@format}{}% \@ifundefined{crefrange@subappendix@format}{% \let\crefrange@subappendix@format% - \crefrange@appendix@format}{}% + \crefrange@appendix@format}{}% \@ifundefined{Crefrange@subappendix@format}{% \let\Crefrange@subappendix@format% - \Crefrange@appendix@format}{}% + \Crefrange@appendix@format}{}% \@ifundefined{cref@subappendix@format@first}{% \let\cref@subappendix@format@first% - \cref@appendix@format@first}{}% + \cref@appendix@format@first}{}% \@ifundefined{Cref@subappendix@format@first}{% \let\Cref@subappendix@format@first% - \Cref@appendix@format@first}{}% + \Cref@appendix@format@first}{}% \@ifundefined{cref@subappendix@format@second}{% \let\cref@subappendix@format@second% - \cref@appendix@format@second}{}% + \cref@appendix@format@second}{}% \@ifundefined{Cref@subappendix@format@second}{% \let\Cref@subappendix@format@second% - \Cref@appendix@format@second}{}% + \Cref@appendix@format@second}{}% \@ifundefined{cref@subappendix@format@middle}{% \let\cref@subappendix@format@middle% - \cref@appendix@format@middle}{}% + \cref@appendix@format@middle}{}% \@ifundefined{Cref@subappendix@format@middle}{% \let\Cref@subappendix@format@middle% - \Cref@appendix@format@middle}{}% + \Cref@appendix@format@middle}{}% \@ifundefined{cref@subappendix@format@last}{% \let\cref@subappendix@format@last% - \cref@appendix@format@last}{}% + \cref@appendix@format@last}{}% \@ifundefined{Cref@subappendix@format@last}{% \let\Cref@subappendix@format@last% - \Cref@appendix@format@last}{}% + \Cref@appendix@format@last}{}% \@ifundefined{crefrange@subappendix@format@first}{% \let\crefrange@subappendix@format@first% - \crefrange@appendix@format@first}{}% + \crefrange@appendix@format@first}{}% \@ifundefined{Crefrange@subappendix@format@first}{% \let\Crefrange@subappendix@format@first% - \Crefrange@appendix@format@first}{}% + \Crefrange@appendix@format@first}{}% \@ifundefined{crefrange@subappendix@format@second}{% \let\crefrange@subappendix@format@second% - \crefrange@appendix@format@second}{}% + \crefrange@appendix@format@second}{}% \@ifundefined{Crefrange@subappendix@format@second}{% \let\Crefrange@subappendix@format@second% - \Crefrange@appendix@format@second}{}% + \Crefrange@appendix@format@second}{}% \@ifundefined{crefrange@subappendix@format@middle}{% \let\crefrange@subappendix@format@middle% - \crefrange@appendix@format@middle}{}% + \crefrange@appendix@format@middle}{}% \@ifundefined{Crefrange@subappendix@format@middle}{% \let\Crefrange@subappendix@format@middle% - \Crefrange@appendix@format@middle}{}% + \Crefrange@appendix@format@middle}{}% \@ifundefined{crefrange@subappendix@format@last}{% \let\crefrange@subappendix@format@last% - \crefrange@appendix@format@last}{}% + \crefrange@appendix@format@last}{}% \@ifundefined{Crefrange@subappendix@format@last}{% \let\Crefrange@subappendix@format@last% - \Crefrange@appendix@format@last}{}% + \Crefrange@appendix@format@last}{}% % \@ifundefined{cref@subsubappendix@name}{% \let\cref@subsubappendix@name\cref@appendix@name% @@ -12746,495 +13006,558 @@ \Cref@appendix@name@plural}{}% \@ifundefined{cref@subsubappendix@format}{% \let\cref@subsubappendix@format% - \cref@subappendix@format}{}% + \cref@subappendix@format}{}% \@ifundefined{Cref@subsubappendix@format}{% \let\Cref@subsubappendix@format% - \Cref@subappendix@format}{}% + \Cref@subappendix@format}{}% \@ifundefined{crefrange@subsubappendix@format}{% \let\crefrange@subsubappendix@format% - \crefrange@subappendix@format}{}% + \crefrange@subappendix@format}{}% \@ifundefined{Crefrange@subsubappendix@format}{% \let\Crefrange@subsubappendix@format% - \Crefrange@subappendix@format}{}% + \Crefrange@subappendix@format}{}% \@ifundefined{cref@subsubappendix@format@first}{% \let\cref@subsubappendix@format@first% - \cref@subappendix@format@first}{}% + \cref@subappendix@format@first}{}% \@ifundefined{Cref@subsubappendix@format@first}{% \let\Cref@subsubappendix@format@first% - \Cref@subappendix@format@first}{}% + \Cref@subappendix@format@first}{}% \@ifundefined{cref@subsubappendix@format@second}{% \let\cref@subsubappendix@format@second% - \cref@subappendix@format@second}{}% + \cref@subappendix@format@second}{}% \@ifundefined{Cref@subsubappendix@format@second}{% \let\Cref@subsubappendix@format@second% - \Cref@subappendix@format@second}{}% + \Cref@subappendix@format@second}{}% \@ifundefined{cref@subsubappendix@format@middle}{% \let\cref@subsubappendix@format@middle% - \cref@subappendix@format@middle}{}% + \cref@subappendix@format@middle}{}% \@ifundefined{Cref@subsubappendix@format@middle}{% \let\Cref@subsubappendix@format@middle% - \Cref@subappendix@format@middle}{}% + \Cref@subappendix@format@middle}{}% \@ifundefined{cref@subsubappendix@format@last}{% \let\cref@subsubappendix@format@last% - \cref@subappendix@format@last}{}% + \cref@subappendix@format@last}{}% \@ifundefined{Cref@subsubappendix@format@last}{% \let\Cref@subsubappendix@format@last% - \Cref@subappendix@format@last}{}% + \Cref@subappendix@format@last}{}% \@ifundefined{crefrange@subsubappendix@format@first}{% \let\crefrange@subsubappendix@format@first% - \crefrange@subappendix@format@first}{}% + \crefrange@subappendix@format@first}{}% \@ifundefined{Crefrange@subsubappendix@format@first}{% \let\Crefrange@subsubappendix@format@first% - \Crefrange@subappendix@format@first}{}% + \Crefrange@subappendix@format@first}{}% \@ifundefined{crefrange@subsubappendix@format@second}{% \let\crefrange@subsubappendix@format@second% - \crefrange@subappendix@format@second}{}% + \crefrange@subappendix@format@second}{}% \@ifundefined{Crefrange@subsubappendix@format@second}{% \let\Crefrange@subsubappendix@format@second% - \Crefrange@subappendix@format@second}{}% + \Crefrange@subappendix@format@second}{}% \@ifundefined{crefrange@subsubappendix@format@middle}{% \let\crefrange@subsubappendix@format@middle% - \crefrange@subappendix@format@middle}{}% + \crefrange@subappendix@format@middle}{}% \@ifundefined{Crefrange@subsubappendix@format@middle}{% \let\Crefrange@subsubappendix@format@middle% - \Crefrange@subappendix@format@middle}{}% + \Crefrange@subappendix@format@middle}{}% \@ifundefined{crefrange@subsubappendix@format@last}{% \let\crefrange@subsubappendix@format@last% - \crefrange@subappendix@format@last}{}% + \crefrange@subappendix@format@last}{}% \@ifundefined{Crefrange@subsubappendix@format@last}{% \let\Crefrange@subsubappendix@format@last% - \Crefrange@subappendix@format@last}{}% + \Crefrange@subappendix@format@last}{}% % \@ifundefined{cref@subsubsubappendix@format}{% \let\cref@subsubsubappendix@format% - \cref@subsubappendix@format}{}% + \cref@subsubappendix@format}{}% \@ifundefined{Cref@subsubsubappendix@format}{% \let\Cref@subsubsubappendix@format% - \Cref@subsubappendix@format}{}% + \Cref@subsubappendix@format}{}% \@ifundefined{crefrange@subsubsubappendix@format}{% \let\crefrange@subsubsubappendix@format% - \crefrange@subsubappendix@format}{}% + \crefrange@subsubappendix@format}{}% \@ifundefined{Crefrange@subsubsubappendix@format}{% \let\Crefrange@subsubsubappendix@format% - \Crefrange@subsubappendix@format}{}% + \Crefrange@subsubappendix@format}{}% \@ifundefined{cref@subsubsubappendix@format@first}{% \let\cref@subsubsubappendix@format@first% - \cref@subsubappendix@format@first}{}% + \cref@subsubappendix@format@first}{}% \@ifundefined{Cref@subsubsubappendix@format@first}{% \let\Cref@subsubsubappendix@format@first% - \Cref@subsubappendix@format@first}{}% + \Cref@subsubappendix@format@first}{}% \@ifundefined{cref@subsubsubappendix@format@second}{% \let\cref@subsubsubappendix@format@second% - \cref@subsubappendix@format@second}{}% + \cref@subsubappendix@format@second}{}% \@ifundefined{Cref@subsubsubappendix@format@second}{% \let\Cref@subsubsubappendix@format@second% - \Cref@subsubappendix@format@second}{}% + \Cref@subsubappendix@format@second}{}% \@ifundefined{cref@subsubsubappendix@format@middle}{% \let\cref@subsubsubappendix@format@middle% - \cref@subsubappendix@format@middle}{}% + \cref@subsubappendix@format@middle}{}% \@ifundefined{Cref@subsubsubappendix@format@middle}{% \let\Cref@subsubsubappendix@format@middle% - \Cref@subsubappendix@format@middle}{}% + \Cref@subsubappendix@format@middle}{}% \@ifundefined{cref@subsubsubappendix@format@last}{% \let\cref@subsubsubappendix@format@last% - \cref@subsubappendix@format@last}{}% + \cref@subsubappendix@format@last}{}% \@ifundefined{Cref@subsubsubappendix@format@last}{% \let\Cref@subsubsubappendix@format@last% - \Cref@subsubappendix@format@last}{}% + \Cref@subsubappendix@format@last}{}% \@ifundefined{crefrange@subsubsubappendix@format@first}{% \let\crefrange@subsubsubappendix@format@first% - \crefrange@subsubappendix@format@first}{}% + \crefrange@subsubappendix@format@first}{}% \@ifundefined{Crefrange@subsubsubappendix@format@first}{% \let\Crefrange@subsubsubappendix@format@first% - \Crefrange@subsubappendix@format@first}{}% + \Crefrange@subsubappendix@format@first}{}% \@ifundefined{crefrange@subsubsubappendix@format@second}{% \let\crefrange@subsubsubappendix@format@second% - \crefrange@subsubappendix@format@second}{}% + \crefrange@subsubappendix@format@second}{}% \@ifundefined{Crefrange@subsubsubappendix@format@second}{% \let\Crefrange@subsubsubappendix@format@second% - \Crefrange@subsubappendix@format@second}{}% + \Crefrange@subsubappendix@format@second}{}% \@ifundefined{crefrange@subsubsubappendix@format@middle}{% \let\crefrange@subsubsubappendix@format@middle% - \crefrange@subsubappendix@format@middle}{}% + \crefrange@subsubappendix@format@middle}{}% \@ifundefined{Crefrange@subsubsubappendix@format@middle}{% \let\Crefrange@subsubsubappendix@format@middle% - \Crefrange@subsubappendix@format@middle}{}% + \Crefrange@subsubappendix@format@middle}{}% \@ifundefined{crefrange@subsubsubappendix@format@last}{% \let\crefrange@subsubsubappendix@format@last% - \crefrange@subsubappendix@format@last}{}% + \crefrange@subsubappendix@format@last}{}% \@ifundefined{Crefrange@subsubsubappendix@format@last}{% \let\Crefrange@subsubsubappendix@format@last% - \Crefrange@subsubappendix@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}{}% + \cref@figure@format}{}% \@ifundefined{Cref@subfigure@format}{% \let\Cref@subfigure@format% - \Cref@figure@format}{}% + \Cref@figure@format}{}% \@ifundefined{crefrange@subfigure@format}{% \let\crefrange@subfigure@format% - \crefrange@figure@format}{}% + \crefrange@figure@format}{}% \@ifundefined{Crefrange@subfigure@format}{% \let\Crefrange@subfigure@format% - \Crefrange@figure@format}{}% + \Crefrange@figure@format}{}% \@ifundefined{cref@subfigure@format@first}{% \let\cref@subfigure@format@first% - \cref@figure@format@first}{}% + \cref@figure@format@first}{}% \@ifundefined{Cref@subfigure@format@first}{% \let\Cref@subfigure@format@first% - \Cref@figure@format@first}{}% + \Cref@figure@format@first}{}% \@ifundefined{cref@subfigure@format@second}{% \let\cref@subfigure@format@second% - \cref@figure@format@second}{}% + \cref@figure@format@second}{}% \@ifundefined{Cref@subfigure@format@second}{% \let\Cref@subfigure@format@second% - \Cref@figure@format@second}{}% + \Cref@figure@format@second}{}% \@ifundefined{cref@subfigure@format@middle}{% \let\cref@subfigure@format@middle% - \cref@figure@format@middle}{}% + \cref@figure@format@middle}{}% \@ifundefined{Cref@subfigure@format@middle}{% \let\Cref@subfigure@format@middle% - \Cref@figure@format@middle}{}% + \Cref@figure@format@middle}{}% \@ifundefined{cref@subfigure@format@last}{% \let\cref@subfigure@format@last% - \cref@figure@format@last}{}% + \cref@figure@format@last}{}% \@ifundefined{Cref@subfigure@format@last}{% \let\Cref@subfigure@format@last% - \Cref@figure@format@last}{}% + \Cref@figure@format@last}{}% \@ifundefined{crefrange@subfigure@format@first}{% \let\crefrange@subfigure@format@first% - \crefrange@figure@format@first}{}% + \crefrange@figure@format@first}{}% \@ifundefined{Crefrange@subfigure@format@first}{% \let\Crefrange@subfigure@format@first% - \Crefrange@figure@format@first}{}% + \Crefrange@figure@format@first}{}% \@ifundefined{crefrange@subfigure@format@second}{% \let\crefrange@subfigure@format@second% - \crefrange@figure@format@second}{}% + \crefrange@figure@format@second}{}% \@ifundefined{Crefrange@subfigure@format@second}{% \let\Crefrange@subfigure@format@second% - \Crefrange@figure@format@second}{}% + \Crefrange@figure@format@second}{}% \@ifundefined{crefrange@subfigure@format@middle}{% \let\crefrange@subfigure@format@middle% - \crefrange@figure@format@middle}{}% + \crefrange@figure@format@middle}{}% \@ifundefined{Crefrange@subfigure@format@middle}{% \let\Crefrange@subfigure@format@middle% - \Crefrange@figure@format@middle}{}% + \Crefrange@figure@format@middle}{}% \@ifundefined{crefrange@subfigure@format@last}{% \let\crefrange@subfigure@format@last% - \crefrange@figure@format@last}{}% + \crefrange@figure@format@last}{}% \@ifundefined{Crefrange@subfigure@format@last}{% \let\Crefrange@subfigure@format@last% - \Crefrange@figure@format@last}{}% + \Crefrange@figure@format@last}{}% % \@ifundefined{cref@subtable@format}{% \let\cref@subtable@format% - \cref@table@format}{}% + \cref@table@format}{}% \@ifundefined{Cref@subtable@format}{% \let\Cref@subtable@format% - \Cref@table@format}{}% + \Cref@table@format}{}% \@ifundefined{crefrange@subtable@format}{% \let\crefrange@subtable@format% - \crefrange@table@format}{}% + \crefrange@table@format}{}% \@ifundefined{Crefrange@subtable@format}{% \let\Crefrange@subtable@format% - \Crefrange@table@format}{}% + \Crefrange@table@format}{}% \@ifundefined{cref@subtable@format@first}{% \let\cref@subtable@format@first% - \cref@table@format@first}{}% + \cref@table@format@first}{}% \@ifundefined{Cref@subtable@format@first}{% \let\Cref@subtable@format@first% - \Cref@table@format@first}{}% + \Cref@table@format@first}{}% \@ifundefined{cref@subtable@format@second}{% \let\cref@subtable@format@second% - \cref@table@format@second}{}% + \cref@table@format@second}{}% \@ifundefined{Cref@subtable@format@second}{% \let\Cref@subtable@format@second% - \Cref@table@format@second}{}% + \Cref@table@format@second}{}% \@ifundefined{cref@subtable@format@middle}{% \let\cref@subtable@format@middle% - \cref@table@format@middle}{}% + \cref@table@format@middle}{}% \@ifundefined{Cref@subtable@format@middle}{% \let\Cref@subtable@format@middle% - \Cref@table@format@middle}{}% + \Cref@table@format@middle}{}% \@ifundefined{cref@subtable@format@last}{% \let\cref@subtable@format@last% - \cref@table@format@last}{}% + \cref@table@format@last}{}% \@ifundefined{Cref@subtable@format@last}{% \let\Cref@subtable@format@last% - \Cref@table@format@last}{}% + \Cref@table@format@last}{}% \@ifundefined{crefrange@subtable@format@first}{% \let\crefrange@subtable@format@first% - \crefrange@table@format@first}{}% + \crefrange@table@format@first}{}% \@ifundefined{Crefrange@subtable@format@first}{% \let\Crefrange@subtable@format@first% - \Crefrange@table@format@first}{}% + \Crefrange@table@format@first}{}% \@ifundefined{crefrange@subtable@format@second}{% \let\crefrange@subtable@format@second% - \crefrange@table@format@second}{}% + \crefrange@table@format@second}{}% \@ifundefined{Crefrange@subtable@format@second}{% \let\Crefrange@subtable@format@second% - \Crefrange@table@format@second}{}% + \Crefrange@table@format@second}{}% \@ifundefined{crefrange@subtable@format@middle}{% \let\crefrange@subtable@format@middle% - \crefrange@table@format@middle}{}% + \crefrange@table@format@middle}{}% \@ifundefined{Crefrange@subtable@format@middle}{% \let\Crefrange@subtable@format@middle% - \Crefrange@table@format@middle}{}% + \Crefrange@table@format@middle}{}% \@ifundefined{crefrange@subtable@format@last}{% \let\crefrange@subtable@format@last% - \crefrange@table@format@last}{}% + \crefrange@table@format@last}{}% \@ifundefined{Crefrange@subtable@format@last}{% \let\Crefrange@subtable@format@last% - \Crefrange@table@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}{}% + \cref@enumi@format}{}% \@ifundefined{Cref@enumii@format}{% \let\Cref@enumii@format% - \Cref@enumi@format}{}% + \Cref@enumi@format}{}% \@ifundefined{crefrange@enumii@format}{% \let\crefrange@enumii@format% - \crefrange@enumi@format}{}% + \crefrange@enumi@format}{}% \@ifundefined{Crefrange@enumii@format}{% \let\Crefrange@enumii@format% - \Crefrange@enumi@format}{}% + \Crefrange@enumi@format}{}% \@ifundefined{cref@enumii@format@first}{% \let\cref@enumii@format@first% - \cref@enumi@format@first}{}% + \cref@enumi@format@first}{}% \@ifundefined{Cref@enumii@format@first}{% \let\Cref@enumii@format@first% - \Cref@enumi@format@first}{}% + \Cref@enumi@format@first}{}% \@ifundefined{cref@enumii@format@second}{% \let\cref@enumii@format@second% - \cref@enumi@format@second}{}% + \cref@enumi@format@second}{}% \@ifundefined{Cref@enumii@format@second}{% \let\Cref@enumii@format@second% - \Cref@enumi@format@second}{}% + \Cref@enumi@format@second}{}% \@ifundefined{cref@enumii@format@middle}{% \let\cref@enumii@format@middle% - \cref@enumi@format@middle}{}% + \cref@enumi@format@middle}{}% \@ifundefined{Cref@enumii@format@middle}{% \let\Cref@enumii@format@middle% - \Cref@enumi@format@middle}{}% + \Cref@enumi@format@middle}{}% \@ifundefined{cref@enumii@format@last}{% \let\cref@enumii@format@last% - \cref@enumi@format@last}{}% + \cref@enumi@format@last}{}% \@ifundefined{Cref@enumii@format@last}{% \let\Cref@enumii@format@last% - \Cref@enumi@format@last}{}% + \Cref@enumi@format@last}{}% \@ifundefined{crefrange@enumii@format@first}{% \let\crefrange@enumii@format@first% - \crefrange@enumi@format@first}{}% + \crefrange@enumi@format@first}{}% \@ifundefined{Crefrange@enumii@format@first}{% \let\Crefrange@enumii@format@first% - \Crefrange@enumi@format@first}{}% + \Crefrange@enumi@format@first}{}% \@ifundefined{crefrange@enumii@format@second}{% \let\crefrange@enumii@format@second% - \crefrange@enumi@format@second}{}% + \crefrange@enumi@format@second}{}% \@ifundefined{Crefrange@enumii@format@second}{% \let\Crefrange@enumii@format@second% - \Crefrange@enumi@format@second}{}% + \Crefrange@enumi@format@second}{}% \@ifundefined{crefrange@enumii@format@middle}{% \let\crefrange@enumii@format@middle% - \crefrange@enumi@format@middle}{}% + \crefrange@enumi@format@middle}{}% \@ifundefined{Crefrange@enumii@format@middle}{% \let\Crefrange@enumii@format@middle% - \Crefrange@enumi@format@middle}{}% + \Crefrange@enumi@format@middle}{}% \@ifundefined{crefrange@enumii@format@last}{% \let\crefrange@enumii@format@last% - \crefrange@enumi@format@last}{}% + \crefrange@enumi@format@last}{}% \@ifundefined{Crefrange@enumii@format@last}{% \let\Crefrange@enumii@format@last% - \Crefrange@enumi@format@last}{}% + \Crefrange@enumi@format@last}{}% % \@ifundefined{cref@enumiii@format}{% \let\cref@enumiii@format% - \cref@enumii@format}{}% + \cref@enumii@format}{}% \@ifundefined{Cref@enumiii@format}{% \let\Cref@enumiii@format% - \Cref@enumii@format}{}% + \Cref@enumii@format}{}% \@ifundefined{crefrange@enumiii@format}{% \let\crefrange@enumiii@format% - \crefrange@enumii@format}{}% + \crefrange@enumii@format}{}% \@ifundefined{Crefrange@enumiii@format}{% \let\Crefrange@enumiii@format% - \Crefrange@enumii@format}{}% + \Crefrange@enumii@format}{}% \@ifundefined{cref@enumiii@format@first}{% \let\cref@enumiii@format@first% - \cref@enumii@format@first}{}% + \cref@enumii@format@first}{}% \@ifundefined{Cref@enumiii@format@first}{% \let\Cref@enumiii@format@first% - \Cref@enumii@format@first}{}% + \Cref@enumii@format@first}{}% \@ifundefined{cref@enumiii@format@second}{% \let\cref@enumiii@format@second% - \cref@enumii@format@second}{}% + \cref@enumii@format@second}{}% \@ifundefined{Cref@enumiii@format@second}{% \let\Cref@enumiii@format@second% - \Cref@enumii@format@second}{}% + \Cref@enumii@format@second}{}% \@ifundefined{cref@enumiii@format@middle}{% \let\cref@enumiii@format@middle% - \cref@enumii@format@middle}{}% + \cref@enumii@format@middle}{}% \@ifundefined{Cref@enumiii@format@middle}{% \let\Cref@enumiii@format@middle% - \Cref@enumii@format@middle}{}% + \Cref@enumii@format@middle}{}% \@ifundefined{cref@enumiii@format@last}{% \let\cref@enumiii@format@last% - \cref@enumii@format@last}{}% + \cref@enumii@format@last}{}% \@ifundefined{Cref@enumiii@format@last}{% \let\Cref@enumiii@format@last% - \Cref@enumii@format@last}{}% + \Cref@enumii@format@last}{}% \@ifundefined{crefrange@enumiii@format@first}{% \let\crefrange@enumiii@format@first% - \crefrange@enumii@format@first}{}% + \crefrange@enumii@format@first}{}% \@ifundefined{Crefrange@enumiii@format@first}{% \let\Crefrange@enumiii@format@first% - \Crefrange@enumii@format@first}{}% + \Crefrange@enumii@format@first}{}% \@ifundefined{crefrange@enumiii@format@second}{% \let\crefrange@enumiii@format@second% - \crefrange@enumii@format@second}{}% + \crefrange@enumii@format@second}{}% \@ifundefined{Crefrange@enumiii@format@second}{% \let\Crefrange@enumiii@format@second% - \Crefrange@enumii@format@second}{}% + \Crefrange@enumii@format@second}{}% \@ifundefined{crefrange@enumiii@format@middle}{% \let\crefrange@enumiii@format@middle% - \crefrange@enumii@format@middle}{}% + \crefrange@enumii@format@middle}{}% \@ifundefined{Crefrange@enumiii@format@middle}{% \let\Crefrange@enumiii@format@middle% - \Crefrange@enumii@format@middle}{}% + \Crefrange@enumii@format@middle}{}% \@ifundefined{crefrange@enumiii@format@last}{% \let\crefrange@enumiii@format@last% - \crefrange@enumii@format@last}{}% + \crefrange@enumii@format@last}{}% \@ifundefined{Crefrange@enumiii@format@last}{% \let\Crefrange@enumiii@format@last% - \Crefrange@enumii@format@last}{}% + \Crefrange@enumii@format@last}{}% % \@ifundefined{cref@enumiv@format}{% \let\cref@enumiv@format% - \cref@enumiii@format}{}% + \cref@enumiii@format}{}% \@ifundefined{Cref@enumiv@format}{% \let\Cref@enumiv@format% - \Cref@enumiii@format}{}% + \Cref@enumiii@format}{}% \@ifundefined{crefrange@enumiv@format}{% \let\crefrange@enumiv@format% - \crefrange@enumiii@format}{}% + \crefrange@enumiii@format}{}% \@ifundefined{Crefrange@enumiv@format}{% \let\Crefrange@enumiv@format% - \Crefrange@enumiii@format}{}% + \Crefrange@enumiii@format}{}% \@ifundefined{cref@enumiv@format@first}{% \let\cref@enumiv@format@first% - \cref@enumiii@format@first}{}% + \cref@enumiii@format@first}{}% \@ifundefined{Cref@enumiv@format@first}{% \let\Cref@enumiv@format@first% - \Cref@enumiii@format@first}{}% + \Cref@enumiii@format@first}{}% \@ifundefined{cref@enumiv@format@second}{% \let\cref@enumiv@format@second% - \cref@enumiii@format@second}{}% + \cref@enumiii@format@second}{}% \@ifundefined{Cref@enumiv@format@second}{% \let\Cref@enumiv@format@second% - \Cref@enumiii@format@second}{}% + \Cref@enumiii@format@second}{}% \@ifundefined{cref@enumiv@format@middle}{% \let\cref@enumiv@format@middle% - \cref@enumiii@format@middle}{}% + \cref@enumiii@format@middle}{}% \@ifundefined{Cref@enumiv@format@middle}{% \let\Cref@enumiv@format@middle% - \Cref@enumiii@format@middle}{}% + \Cref@enumiii@format@middle}{}% \@ifundefined{cref@enumiv@format@last}{% \let\cref@enumiv@format@last% - \cref@enumiii@format@last}{}% + \cref@enumiii@format@last}{}% \@ifundefined{Cref@enumiv@format@last}{% \let\Cref@enumiv@format@last% - \Cref@enumiii@format@last}{}% + \Cref@enumiii@format@last}{}% \@ifundefined{crefrange@enumiv@format@first}{% \let\crefrange@enumiv@format@first% - \crefrange@enumiii@format@first}{}% + \crefrange@enumiii@format@first}{}% \@ifundefined{Crefrange@enumiv@format@first}{% \let\Crefrange@enumiv@format@first% - \Crefrange@enumiii@format@first}{}% + \Crefrange@enumiii@format@first}{}% \@ifundefined{crefrange@enumiv@format@second}{% \let\crefrange@enumiv@format@second% - \crefrange@enumiii@format@second}{}% + \crefrange@enumiii@format@second}{}% \@ifundefined{Crefrange@enumiv@format@second}{% \let\Crefrange@enumiv@format@second% - \Crefrange@enumiii@format@second}{}% + \Crefrange@enumiii@format@second}{}% \@ifundefined{crefrange@enumiv@format@middle}{% \let\crefrange@enumiv@format@middle% - \crefrange@enumiii@format@middle}{}% + \crefrange@enumiii@format@middle}{}% \@ifundefined{Crefrange@enumiv@format@middle}{% \let\Crefrange@enumiv@format@middle% - \Crefrange@enumiii@format@middle}{}% + \Crefrange@enumiii@format@middle}{}% \@ifundefined{crefrange@enumiv@format@last}{% \let\crefrange@enumiv@format@last% - \crefrange@enumiii@format@last}{}% + \crefrange@enumiii@format@last}{}% \@ifundefined{Crefrange@enumiv@format@last}{% \let\Crefrange@enumiv@format@last% - \Crefrange@enumiii@format@last}{}% + \Crefrange@enumiii@format@last}{}% % \@ifundefined{cref@enumv@format}{% \let\cref@enumv@format% - \cref@enumiv@format}{}% + \cref@enumiv@format}{}% \@ifundefined{Cref@enumv@format}{% \let\Cref@enumv@format% - \Cref@enumiv@format}{}% + \Cref@enumiv@format}{}% \@ifundefined{crefrange@enumv@format}{% \let\crefrange@enumv@format% - \crefrange@enumiv@format}{}% + \crefrange@enumiv@format}{}% \@ifundefined{Crefrange@enumv@format}{% \let\Crefrange@enumv@format% - \Crefrange@enumiv@format}{}% + \Crefrange@enumiv@format}{}% \@ifundefined{cref@enumv@format@first}{% \let\cref@enumv@format@first% - \cref@enumiv@format@first}{}% + \cref@enumiv@format@first}{}% \@ifundefined{Cref@enumv@format@first}{% \let\Cref@enumv@format@first% - \Cref@enumiv@format@first}{}% + \Cref@enumiv@format@first}{}% \@ifundefined{cref@enumv@format@second}{% \let\cref@enumv@format@second% - \cref@enumiv@format@second}{}% + \cref@enumiv@format@second}{}% \@ifundefined{Cref@enumv@format@second}{% \let\Cref@enumv@format@second% - \Cref@enumiv@format@second}{}% + \Cref@enumiv@format@second}{}% \@ifundefined{cref@enumv@format@middle}{% \let\cref@enumv@format@middle% - \cref@enumiv@format@middle}{}% + \cref@enumiv@format@middle}{}% \@ifundefined{Cref@enumv@format@middle}{% \let\Cref@enumv@format@middle% - \Cref@enumiv@format@middle}{}% + \Cref@enumiv@format@middle}{}% \@ifundefined{cref@enumv@format@last}{% \let\cref@enumv@format@last% - \cref@enumiv@format@last}{}% + \cref@enumiv@format@last}{}% \@ifundefined{Cref@enumv@format@last}{% \let\Cref@enumv@format@last% - \Cref@enumiv@format@last}{}% + \Cref@enumiv@format@last}{}% \@ifundefined{crefrange@enumv@format@first}{% \let\crefrange@enumv@format@first% - \crefrange@enumiv@format@first}{}% + \crefrange@enumiv@format@first}{}% \@ifundefined{Crefrange@enumv@format@first}{% \let\Crefrange@enumv@format@first% - \Crefrange@enumiv@format@first}{}% + \Crefrange@enumiv@format@first}{}% \@ifundefined{crefrange@enumv@format@second}{% \let\crefrange@enumv@format@second% - \crefrange@enumiv@format@second}{}% + \crefrange@enumiv@format@second}{}% \@ifundefined{Crefrange@enumv@format@second}{% \let\Crefrange@enumv@format@second% - \Crefrange@enumiv@format@second}{}% + \Crefrange@enumiv@format@second}{}% \@ifundefined{crefrange@enumv@format@middle}{% \let\crefrange@enumv@format@middle% - \crefrange@enumiv@format@middle}{}% + \crefrange@enumiv@format@middle}{}% \@ifundefined{Crefrange@enumv@format@middle}{% \let\Crefrange@enumv@format@middle% - \Crefrange@enumiv@format@middle}{}% + \Crefrange@enumiv@format@middle}{}% \@ifundefined{crefrange@enumv@format@last}{% \let\crefrange@enumv@format@last% - \crefrange@enumiv@format@last}{}% + \crefrange@enumiv@format@last}{}% \@ifundefined{Crefrange@enumv@format@last}{% \let\Crefrange@enumv@format@last% - \Crefrange@enumiv@format@last}{}% + \Crefrange@enumiv@format@last}{}% % \let\cref@language\relax% }% end of \AtBeginDocument @@ -13254,7 +13577,7 @@ % \package{cleveref} has loaded. % \begin{macrocode} \InputIfFileExists{cleveref.cfg}% - {\PackageInfo{cleveref}{reading definitions from cleveref.cfg}}{} + {\PackageInfo{cleveref}{reading definitions from cleveref.cfg}}{}% % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/cleveref/cleveref.ins b/Master/texmf-dist/source/latex/cleveref/cleveref.ins index 32cf6b63de9..082250c02da 100644 --- a/Master/texmf-dist/source/latex/cleveref/cleveref.ins +++ b/Master/texmf-dist/source/latex/cleveref/cleveref.ins @@ -2,7 +2,7 @@ %% cleveref.ins %% Batch file, run through LaTeX. %% -%% Copyright (C) 2006, 2012 Toby Cubitt +%% Copyright (C) 2006--2013 Toby Cubitt %% See the files README and COPYING. %% \def\batchfile{cleveref.ins} @@ -11,7 +11,7 @@ LaTeX package for intelligent cross-referencing. -Copyright (C) 2006--2012 Toby Cubitt +Copyright (C) 2006--2013 Toby Cubitt See the files README and COPYING. \endpreamble |