summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-06-24 23:35:21 +0000
committerKarl Berry <karl@freefriends.org>2010-06-24 23:35:21 +0000
commite2f9be67491d459d2e361029e5df9da8c0f17ee9 (patch)
treead6b3eb14941756b2f1ac1b21d08bdd01b1cb10b /Master/texmf-dist/source/latex
parentf794e99605085b9f6cef922ba918d6f87cbb76f3 (diff)
cleveref 0.17.1 (24jun10)
git-svn-id: svn://tug.org/texlive/trunk@19140 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r--Master/texmf-dist/source/latex/cleveref/cleveref.dtx809
1 files changed, 562 insertions, 247 deletions
diff --git a/Master/texmf-dist/source/latex/cleveref/cleveref.dtx b/Master/texmf-dist/source/latex/cleveref/cleveref.dtx
index c429b43cc5f..e1a64bc900c 100644
--- a/Master/texmf-dist/source/latex/cleveref/cleveref.dtx
+++ b/Master/texmf-dist/source/latex/cleveref/cleveref.dtx
@@ -21,7 +21,7 @@
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{cleveref}
-%<package> [2010/06/07 v0.17 Intelligent cross-referencing]
+%<package> [2010/06/24 v0.17.1 Intelligent cross-referencing]
%
%<*driver>
\documentclass{ltxdoc}
@@ -62,7 +62,7 @@
%</driver>
% \fi
%
-% \CheckSum{13168}
+% \CheckSum{13523}
%% \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
@@ -189,12 +189,20 @@
% \textbackslash{}tag command when used with \option{sort} option, and
% in the \package{amsmath} multline environment's support for the
% optional argument to \textbackslash{}label.}
+% \changes{v0.17.1}{2010/06/24}{Modified \textbackslash{}@crefname macro
+% so that it no longer makes global definitions, to fix support for
+% \package{babel}'s \textbackslash{}otherlanguage and
+% \textbackslash{}foreignlanguage commands. Fixed typos in
+% \option{poorman} \textbackslash{}foreignlanguage code. Fixed bug in
+% the \package{amsmath} multline environment's support for the optional
+% argument to \textbackslash{}label\dots again. Added
+% \textbackslash{}labelcref command.}
%
%
% \GetFileInfo{cleveref.sty}
%
-% \def\fileversion{0.17}
-% \def\filedate{07/06/2010}
+% \def\fileversion{0.17.1}
+% \def\filedate{24/06/2010}
%
% \title{The \package{cleveref} package\thanks{This document
% corresponds to \textsf{cleveref}~\fileversion, dated
@@ -431,10 +439,21 @@
% |\namecref{sec1}|
% \end{quote}
% is type-set as ``section'' (assuming |sec1| labels a section). The
-% \cmd{\namecres} and \cmd{\nameCrefs} commands produce the plural forms.
+% |\namecref| and |\nameCrefs| commands produce the plural forms.
+%
+% \DescribeMacro{\labelcref}
+% Conversely, it is occasionally useful to produce just the label part of
+% a reference, without the cross-reference name. For example, this could
+% be useful when type-setting cross-references in a language for which
+% the ending of the cross-reference name changes depending on where it is
+% used in a sentence. The |\labelcref| command does exactly this, and can
+% also cope with multi-references, processing them just as |\cref| does.
+% However, since it type-sets a multi-reference without any name,
+% \emph{all} labels in a |\labelcref| multi-reference \emph{must} be of
+% the same type.
%
% There is a slight pitfall that you should be aware of when using the
-% \cmd{\namecref} commands. They get the reference name from the names
+% |\namecref| commands. They get the reference name from the names
% defined for the label's reference type using |\crefname| or |\Crefname|
% (see \cref{sec:individual_customisation}). The default reference
% formats provide these definitions. However, it is possible to customise
@@ -445,6 +464,16 @@
% that type. You can fix the error by adding explicit |\crefname|
% definitions for these types.
%
+% The |\labelcref| command will type-set cross-reference labels using the
+% default label format if no type-specific format is defined using
+% |\creflabelformat| (see
+% \cref{sec:global_customisation,sec:individual_customisation}). However,
+% if you customise reference formats using the lower-level commands, you
+% may want to also explicitly define the |\labelcref| formats to match,
+% using the |\labelcrefformat| etc.\ commands (see
+% \cref{sec:low-level_customisation}).
+%
+%
%
%
% \section{Sorting and Compressing}
@@ -530,8 +559,8 @@
% You should \emph{still} use the |\Cref| variants at the beginning of
% sentences, for one thing, because abbreviations should not be used at
% the beginning of a sentence,\footnote{At least in English; I'm not sure
-% about other languages.} and for another, in case you later change
-% your mind and remove the \option{capitalise} option.
+% about other languages.} and for another, in case you later change your
+% mind and remove the \option{capitalise} option.
%
%
%
@@ -606,7 +635,7 @@
% this. See \cref{sec:typesetting,sec:other_packages}.)
%
% Note that the default format for equation cross-references already
-% overrides \cmd{\crefdefaultlabelformat} in order to surround the label
+% overrides |\crefdefaultlabelformat| in order to surround the label
% by brackets, so the redefining |\crefdefaultlabelformat| will have no
% effect on equations. The label format for equations must be customised
% separately if you want to change it (see
@@ -744,10 +773,10 @@
% environments share a common counter, which \package{cleveref} makes use
% of to distinguish between them automatically.) In the case of
% appendices, the \meta{type} is ``appendix'' for the top-level
-% sectioning command (\cmd{\chapter} or \cmd{\section}, depending on the
-% document class), ``subappendix'' for the sectioning command one level
-% below (\cmd{\section} or \cmd{\subsection}), ``subsubappendix'' for the
-% next level of sectioning command, etc.
+% sectioning command (|\chapter| or |\section|, depending on the document
+% class), ``subappendix'' for the sectioning command one level below
+% (|\section| or |\subsection|), ``subsubappendix'' for the next level of
+% sectioning command, etc.
%
% For convenience, if they have not been otherwise customised by the end
% of the preamble, the cross-reference name (and label format) for
@@ -812,13 +841,13 @@
% cross-reference name, it doesn't provide the plural form. And there is
% no reliable way of constructing the plural form from the
% singular.\footnote{If you're a native English-speaker, you might think
-% that just adding an `s' would work, though a moment's thought will
-% provide examples of words where this will fail. If you're a
-% non-English speaker, it probably won't even occur to you to claim
-% that plurals can reliably be constructed automatically!} Therefore,
-% if the plural form is ever required, \package{cleveref} will produce a
-% ``reference type undefined'' warning, and type-set the cross-reference
-% where the plural form is required as:
+% that just adding an `s' would work, though a moment's thought will
+% provide examples of words where this will fail. If you're a non-English
+% speaker, it probably won't even occur to you to claim that plurals can
+% reliably be constructed automatically!} Therefore, if the plural form
+% is ever required, \package{cleveref} will produce a ``reference type
+% undefined'' warning, and type-set the cross-reference where the plural
+% form is required as:
% \begin{quote}
% {\bf ??}~|\ref{|\meta{label}|}| \dots
% \end{quote}
@@ -843,7 +872,7 @@
% something slightly more complicated than simply checking whether the
% reference types match. In fact, it checks whether the reference
% \emph{formats} match.\footnote{To be precise, \package{cleveref} checks
-% whether the $\backslash$|crefformat| definitions match.} This will
+% whether the $\backslash$|crefformat| definitions match.} This will
% always be the case for cross-references of the same type. But it could
% also be the case for cross-references that have different types, if the
% cross-reference formats happen to be identical.
@@ -859,20 +888,19 @@
% format definitions must contain identical \LaTeX{} code.)
%
% Note that if you use the low-level customisation commands, you might
-% still want to provide \cmd{\crefname} and \cmd{\Crefname} definitions
-% too, so that the \cmd{\namecref} commands will work (see
-% \cref{sec:typesetting}).
+% still want to provide |\crefname| and |\Crefname| definitions too, so
+% that the |\namecref| commands will work (see \cref{sec:typesetting}).
%
%
% \subsubsection{Single Cross-References}
% \label{sec:ref_format}
% \DescribeMacro\crefformat
% \DescribeMacro\Crefformat
-% Cross-reference formats for \emph{single} cross-references are defined or
-% redefined using the\linebreak[4] |\crefformat| and |\Crefformat|
+% Cross-reference formats for \emph{single} cross-references are defined
+% or redefined using the\linebreak[4] |\crefformat| and |\Crefformat|
% commands, which are used by the |\cref| and |\Cref| commands
-% respectively. These take two arguments: the cross-reference type, and the
-% formatting code:
+% respectively. These take two arguments: the cross-reference type, and
+% the formatting code:
% \begin{quote}
% |\crefformat{|\meta{type}|}{|\meta{format}|}|\\
% |\Crefformat{|\meta{type}|}{|\meta{format}|}|
@@ -882,10 +910,10 @@
% theorem-like environments when \package{ntheorem} is loaded, in which
% case it is the environment name, and appendices. For the latter, the
% \meta{type} is ``appendix'' for the top-level sectioning command
-% (\cmd{\chapter} or \cmd{\section}, depending on the document class),
-% ``subappendix'' for the sectioning command one level below
-% (\cmd{\section} or \cmd{subsection}), ``subsubappendix'' for the next
-% level of sectioning command, etc.
+% (|\chapter| or |\section|, depending on the document class),
+% ``subappendix'' for the sectioning command one level below (|\section|
+% or |subsection|), ``subsubappendix'' for the next level of sectioning
+% command, etc.
%
% As in the case of the |\crefname| and |\Crefname| commands, if the
% corresponding |\Crefformat| is undefined when |\crefformat| is called,
@@ -919,8 +947,8 @@
% Note that the hyper-link arguments are \emph{not} letters, so if |#2|
% appears at the beginning of \meta{format}, \package{cleveref} will not
% be able to automatically define the other capitalisation variant
-% automatically using |\MakeUppercase| or |\MakeLowercase|. In this case, you
-% will have to define both variants separately. For example, if you
+% automatically using |\MakeUppercase| or |\MakeLowercase|. In this case,
+% you will have to define both variants separately. For example, if you
% wanted to the ``Eq.'' to be part of the hyper-link, you would have to
% define:
% \begin{quote}
@@ -995,12 +1023,12 @@
%
% The \meta{type} is, as ever, the counter name, except for appendices,
% explicitly overridden label types, and theorem-like environments then
-% the \package{ntheorem} package is 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
+% 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
% corresponding other-capitalisation variant is automatically defined,
% only the first letter of the \meta{first} argument is upper- or
@@ -1023,31 +1051,45 @@
% \emph{should} have a space.
%
%
+% \subsubsection{Label Cross-References}
+% If you define the format for a particular cross-reference type using
+% the low-level customisation commands, and still want to use the
+% |\labelcref| command to produce just the label part of the
+% cross-reference, then you must also define the appropriate |\labelcref|
+% formats for that type. This is done using the |\labelcrefformat|,
+% |\labelcrefrangeformat|, |\labelcrefmultiformat| and
+% |\labelcrefrangemultiformat| commands. Their syntax is identical to
+% that of the corresponding |\crefformat|, |\crefrangmeformat|,
+% |\crefmultiformat| or |\crefrangemultiformat| command. Typically, the
+% |\labelcref| formats should be defined identically to the standard
+% |\cref| formats, except for the \meta{first} part, which should leave
+% off the cross-reference name.
+%
+%
%
% \subsection{Language and \package{babel} support}
% \label{sec:language_babel}
% \package{cleveref} supports different languages via package options, in
% the usual way, though not all languages are supported
% yet.\footnote{Contributions of translations for missing languages are
-% very welcome! See \cref{sec:code:babel} for information on how to
-% contribute translations.} The \package{babel} package is also
-% supported when it is loaded, allowing you to change language using the
-% \package{babel} language switching commands such as
-% \cmd{\selectlanguage} and \cmd{\foreignlanguage}.
+% very welcome! See \cref{sec:code:babel} for information on how to
+% contribute translations.} The \package{babel} package is also supported
+% when it is loaded, allowing you to change language using the
+% \package{babel} language switching commands such as |\selectlanguage|
+% and |\foreignlanguage|.
%
% The \package{babel} support works by redefining the cross-reference
% names and conjunctions for the default cross-reference types. Any
% customisations you make to the default cross-reference names and
% conjunctions \emph{in the preamble} apply to the main language (i.e.\
-% the last language listed in the options). A \cmd{\selectlanguage}
-% command or similar will override these customisations, replacing them
-% with the defaults for the new language. If you later use
-% \cmd{\selectlanguage} to switch back to the main language, your
-% customisations will be restored. If you want to customise
-% cross-reference names or conjunctions for any language other than the
-% main one, you either have to explicitly redefine them after every
-% language switching command, or hook the redefinitions into
-% \package{babel}'s language switching mechanism. (See
+% the last language listed in the options). A |\selectlanguage| command
+% or similar will override these customisations, replacing them with the
+% defaults for the new language. If you later use |\selectlanguage| to
+% switch back to the main language, your customisations will be restored.
+% If you want to customise cross-reference names or conjunctions for any
+% language other than the main one, you either have to explicitly
+% redefine them after every language switching command, or hook the
+% redefinitions into \package{babel}'s language switching mechanism. (See
% \cref{sec:code:babel} and the \package{babel} package documentation.)
%
% If you have defined formats for new cross-reference types for which no
@@ -1068,8 +1110,8 @@
% macros called |\cref@\meta{type}@name|, |\Cref@\meta{type}@name|,
% |\cref@\meta{type}@name@plural|, and
% |\Cref@\meta{type}@name@plural|.\linebreak[4] (Note that since these
-% macro names contain the ``@'' character, you must use
-% \cmd{\makeatletter} and \cmd{\makeatother} to access them.)
+% macro names contain the ``@'' character, you must use |\makeatletter|
+% and |\makeatother| to access them.)
%
% \enlargethispage{\baselineskip}
% For example, if you wanted to redefine the equation format so that the
@@ -1082,8 +1124,8 @@
% \dots\\
% |\makeatother|
% \end{quote}
-% and similarly for \cmd{\crefrangeformat}, \cmd{\crefmultiformat},
-% \cmd{\Crefformat}, etc.
+% and similarly for |\crefrangeformat|, |\crefmultiformat|,
+% |\Crefformat|, etc.
%
%
%
@@ -1130,22 +1172,22 @@
% 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.
+% 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, \emph{without} using the
% \package{ntheorem} package.\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.}
-% For example,
+% \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.} For
+% example,
% \begin{quote}
% |\usepackage{aliascnt}|\\
% |\usepackage{cleveref}|\\
@@ -1167,11 +1209,11 @@
%
% When the \option{poorman} option is supplied, your document will be
% processed as normal. But in addition, a |sed| script will automatically
-% be written, containing rules for replacing all the \cmd{\cref} commands
+% be written, containing rules for replacing all the |\cref| commands
% with the \LaTeX{} code that they would produce, and using the standard
-% \cmd{\ref} command to produce the cross-references themselves. I.e.\
-% the script rewrites your document as you would have done if you had had
-% to do it manually!
+% |\ref| command to produce the cross-references themselves. I.e.\ the
+% script rewrites your document as you would have done if you had had to
+% do it manually!
%
% The advantage, of course, is that you \emph{don't} have to do it
% manually. Instead, you can use all the features of \package{cleveref},
@@ -1211,12 +1253,11 @@
% Note that the \option{poorman} script cannot fully reproduce the
% type-setting of the original \package{cleveref} cross-references in all
% cases.\footnote{At least, not without resorting to inserting low-level
-% \LaTeX{} code in your document, which would somewhat defeat the
-% purpose of the \option{poorman} option.} In particular, any
-% customisation of hyper-links will be lost, and if you're using
-% \package{varioref} with the \option{legacyvarioref} option (see
-% \cref{sec:other_packages}, the spacing before the \cmd{\vref} command
-% will not be correct.
+% \LaTeX{} code in your document, which would somewhat defeat the purpose
+% of the \option{poorman} option.} In particular, any customisation of
+% hyper-links will be lost, and if you're using \package{varioref} with
+% the \option{legacyvarioref} option (see \cref{sec:other_packages}, the
+% spacing before the |\vref| command will not be correct.
%
%
%
@@ -1224,7 +1265,7 @@
% \label{sec:other_packages}
% The \package{cleveref} package \emph{must} be loaded \emph{after} all
% other packages that don't specifically support it,\footnote{At the time
-% of writing, I'm not aware of any that do.} i.e.\ the
+% of writing, I'm not aware of any that do.} i.e.\ the
% \begin{quote}
% |\usepackage{cleveref}|
% \end{quote}
@@ -1270,14 +1311,14 @@
% \DescribeMacro{\Fullref*}
% Note that, whilst in the business of redefining the \package{varioref}
% commands, \package{cleveref} seizes the opportunity to get rid of the
-% irritating spacing behaviour of the \cmd{\vref} and \cmd{\Vref}
-% commands, instead making it consistent with the other
-% \package{cleveref} cross-referencing commands. This also frees up the
-% starred variants to be used to suppress hyper-links when the
-% \package{hyperref} package is loaded, as usual. (Unfortunately, due to
-% lack of support for this in \package{varioref}, the page references
-% will still be hyper-links, even when using the starred variants. Go bug
-% the \package{varioref} maintainer about this if you don't like it.)
+% irritating spacing behaviour of the |\vref| and |\Vref| commands,
+% instead making it consistent with the other \package{cleveref}
+% cross-referencing commands. This also frees up the starred variants to
+% be used to suppress hyper-links when the \package{hyperref} package is
+% loaded, as usual. (Unfortunately, due to lack of support for this in
+% \package{varioref}, the page references will still be hyper-links, even
+% when using the starred variants. Go bug the \package{varioref}
+% maintainer about this if you don't like it.)
%
% \DescribeMacro{legacyvarioref}
% However, the \package{cleveref} redefinitions break strict
@@ -1314,17 +1355,17 @@
% use |\ref| within section titles when your document uses both
% \package{amsmath} and \package{hyperref}.
% \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 to get it to work properly with \package{cleveref}. You're
-% better off using the \package{amsmath} replacements in any case, such
-% as |gather|, |align|, |multline| and |split|, which \emph{do} work
+% \LaTeX{} |eqnarray| environment. There is no intention to fix this.
+% The |eqnarray| environment is poorly implemented, making it difficult
+% to get it to work properly with \package{cleveref}. You're better off
+% using the \package{amsmath} replacements in any case, 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 \package{cleveref} doesn't include support for all languages yet.
% Please contribute translations for missing languages!\footnote{See
-% \cref{sec:code:babel} for information on how to contribute
-% translations.}
+% \cref{sec:code:babel} for information on how to contribute
+% translations.}
% \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
@@ -1340,22 +1381,21 @@
% more flexible would be a simple task, but so far there doesn't seem
% to be much need for it.
% \item \package{cleveref} doesn't know about the \package{subfloat}
-% package, so you have to revert to using \cmd{\ref} for
-% cross-references to sub-figures. (This should be fixed in a future
-% version.)
+% package, so you have to revert to using |\ref| for cross-references
+% to sub-figures. (This should be fixed in a future version.)
% \item The \option{poorman} |sed| script loses any custom
% \package{cleveref} hyper-link formatting you might have defined, and
-% does not reproduce the original spacing around the \cmd{\vref}
-% command when \package{varioref} is used with the
-% \option{legacyvarioref} option. This is not a bug; it is a
-% side-effect of the intended purpose of the \option{poorman}
-% option. The philosophy behind \option{poorman} is to replace
-% \package{cleveref}'s enhanced cross-referencing with standard
-% \LaTeX{} cross-reference commands that are guaranteed to work with
-% any standard \LaTeX{} installation. Although it would be simple to
-% fix these ``bugs'', it's almost certainly impossible without using
-% low-level \LaTeX{} code that is unlikely to be supported by journals,
-% thereby defeating the whole purpose of the \option{poorman} option.
+% does not reproduce the original spacing around the |\vref| command
+% when \package{varioref} is used with the \option{legacyvarioref}
+% option. This is not a bug; it is a side-effect of the intended
+% purpose of the \option{poorman} option. The philosophy behind
+% \option{poorman} is to replace \package{cleveref}'s enhanced
+% cross-referencing with standard \LaTeX{} cross-reference commands
+% that are guaranteed to work with any standard \LaTeX{} installation.
+% Although it would be simple to fix these ``bugs'', it's almost
+% certainly impossible without using low-level \LaTeX{} code that is
+% unlikely to be supported by journals, thereby defeating the whole
+% purpose of the \option{poorman} option.
% \end{itemize}
%
%
@@ -1368,8 +1408,8 @@
% complain about the use of |sed|. The portable option would be to
% output a \TeX{} ``script'', but this would be \emph{much} more
% work\footnote{\LaTeX{} \emph{really} isn't suited to that kind of
-% pattern matching task -- just take a look at the code for escaping
-% regexp special characters in this package!} than I'm prepared to
+% pattern matching task -- just take a look at the code for escaping
+% regexp special characters in this package!} than I'm prepared to
% invest.
% \end{itemize}
%
@@ -1576,7 +1616,6 @@
%
% \begin{macro}{\measure@}
% \begin{macro}{\gmeasure@}
-% \begin{macro}{\multline@}
% The \package{amsmath} multi-line equation environments scan their
% bodies twice: once to measure, once to type-set. In the measure
% phase, the \cmd{\label} command is disabled by letting it to
@@ -1752,6 +1791,21 @@
\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 type-setting 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}%
@@ -1780,7 +1834,7 @@
\crcr
\if@fleqn
\hskip-\@mathmargin
- \def\multline@indent{\hskip\@mathmargin}% put it back
+ \def\multline@indent{\hskip\@mathmargin}%
\else
\hfilneg
\def\multline@indent{\hskip\multlinegap}%
@@ -1816,10 +1870,78 @@
\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}
@@ -3142,6 +3264,20 @@
\cref@isstackfull{\@refsubstack}%
}% end loop over reference substack
\cref@isstackfull{\@refstack}%
+% \end{macrocode}
+% if we're type-setting a \cmd{\labelcref} reference and references in
+% stack have different types, throw a warning and stop processing
+% \begin{macrocode}
+ \if@cref@stackfull%
+ \def\@tmpa{#1}\def\@tmpb{labelcref}%
+ \ifx\@tmpa\@tmpb\relax%
+ \protect\G@refundefinedtrue%
+ \nfss@text{\reset@font\bfseries\space ??}%
+ \@latex@warning{References in label reference on page \thepage
+ \space have different types}%
+ \@cref@stackfullfalse%
+ \fi%
+ \fi%
}% end loop over main reference stack
\endgroup}
% \end{macrocode}
@@ -3162,10 +3298,20 @@
\cref@gettype{#1}{\@temptype}% puts label type in \@temptype
\cref@getlabel{#1}{\@templabel}% puts label in \@templabel
\expandafter\ifx\csname #2@\@temptype @format#3\endcsname\relax%
- \protect\G@refundefinedtrue%
- \nfss@text{\reset@font\bfseries ??}~\@templabel%
- \@latex@warning{\string\Cref \space reference format for label
- type `\@temptype' undefined}%
+% \end{macrocode}
+% If reference format is undefined, but we're type-setting a
+% \cmd{\labelcref}, fall back to default \cmd{\labelcref} formats.
+% \begin{macrocode}
+ \edef\@tmpa{#2}\def\@tmpb{labelcref}%
+ \ifx\@tmpa\@tmpb\relax%
+ \expandafter\@@setcref\expandafter%
+ {\csname #2@default@format#3\endcsname}{#1}%
+ \else%
+ \protect\G@refundefinedtrue%
+ \nfss@text{\reset@font\bfseries ??}~\@templabel%
+ \@latex@warning{#2 \space reference format for label type
+ `\@temptype' undefined}%
+ \fi%
\else%
\expandafter\@@setcref\expandafter%
{\csname #2@\@temptype @format#3\endcsname}{#1}%
@@ -3232,10 +3378,21 @@
\edef\@formatb{\expandafter\noexpand%
\csname #3range@\@typeb @format#4\endcsname}%
\expandafter\ifx\@formata\relax%
- \protect\G@refundefinedtrue%
- \nfss@text{\reset@font\bfseries ??}~\@labela--\@labelb%
- \@latex@warning{#3\space reference range format for label
- type `\@typea' undefined}%
+% \end{macrocode}
+% If reference format is undefined, but we're type-setting a
+% \cmd{\labelcref}, fall back to default \cmd{\labelcref}
+% formats.
+% \begin{macrocode}
+ \edef\@tmpa{#3}\def\@tmpb{labelcref}%
+ \ifx\@tmpa\@tmpb\relax%
+ \expandafter\@@setcrefrange\expandafter%
+ {\csname #3range@default@format#4\endcsname}{#1}{#2}%
+ \else%
+ \protect\G@refundefinedtrue%
+ \nfss@text{\reset@font\bfseries ??}~\@labela--\@labelb%
+ \@latex@warning{#3\space reference range format for label
+ type `\@typea' undefined}%
+ \fi%
\else%
% \end{macrocode}
% If reference types are identical, type-set reference range,
@@ -3249,8 +3406,8 @@
\else%
\protect\G@refundefinedtrue%
\nfss@text{\reset@font\bfseries ??}~\@labela--\@labelb%
- \@latex@warning{Types inconsistent in reference range for
- references `#1' and `#2' on page \thepage}%
+ \@latex@warning{References `#1' and `#2' in reference range
+ on page \thepage have different types}%
\fi%
\fi%
\fi%
@@ -3280,16 +3437,21 @@
\def\@setcref@lastgroupconjunction{\creflastgroupconjunction}
% \end{macrocode}
%
+% \begin{macro}{\labelcref}
% \begin{macro}{\namecref}
% \begin{macro}{\nameCref}
% \begin{macro}{\namecrefs}
% \begin{macro}{\nameCrefs}
-% Finally, we define \cmd{\namecref}, \cmd{\nameCref}, \cmd{\namecrefs}
-% and \cmd{\nameCrefs} commands that return just the type-set name of a
-% reference, without the reference label, which is occasionally useful.
-% They retrieves the reference name from the corresponding
-% \cmd{\crefname} or \cmd{\Crefname} definition, if these exist.
+% Finally, we define a \cmd{\labelcref} that returns just the type-set
+% label part of a (multi-)reference, without the reference name, and
+% conversely \cmd{\namecref}, \cmd{\nameCref}, \cmd{\namecrefs} and
+% \cmd{\nameCrefs} commands that return just the type-set name of a
+% reference, without the reference label. The latter four retrieve the
+% reference name from the corresponding \cmd{\crefname} or
+% \cmd{\Crefname} definition, so they only work when this has been
+% defined.
% \begin{macrocode}
+\DeclareRobustCommand{\labelcref}[1]{\@cref{labelcref}{#1}}
\DeclareRobustCommand{\namecref}[1]{%
\expandafter\ifx\csname r@cref@#1\endcsname\relax%
\protect\G@refundefinedtrue%
@@ -3347,6 +3509,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
%
%
@@ -3433,74 +3596,75 @@
% the format component, and using the additional first argument
% (``cref'' or ``Cref'') to determine how to define the corresponding
% command with the other capitalisation. The extra fifth argument gets
-% tagged onto the end of the generated macro names.
+% tagged onto the end of the generated macro names. Note that
+% \cmd{\@crefname} \emph{must not} create global definitions, or else
+% it will break \package{babel}'s \cmd{\otherlanguage},
+% \cmd{\otherlanguage*} and \cmd{\foreignlanguage} commands.
% \begin{macrocode}
\def\@crefname#1#2#3#4#5{%
- \begingroup%
- \expandafter\gdef\csname #1@#2@name#5\endcsname{#3}%
- \expandafter\gdef\csname #1@#2@name@plural#5\endcsname{#4}%
+ \expandafter\def\csname #1@#2@name#5\endcsname{#3}%
+ \expandafter\def\csname #1@#2@name@plural#5\endcsname{#4}%
% \end{macrocode}
% The following \cmd{\@tmpa} macro makes use of the fact that the first
% character of \#1 is ``c'' for lower-case and ``C'' for upper-case, in
% order to wrap the capitalisation-dependent parts in macros so that the
% rest of the code can be capitalisation-variant agnostic.
% \begin{macrocode}
- \def\@tmpa##1##2\@nil{%
- \if##1c%
- \def\@other{C##2}%
- \def\@changecase{\expandafter\MakeUppercase}%
+ \def\@tmpa##1##2\@nil{%
+ \if##1c%
+ \def\@other{C##2}%
+ \def\@tmpc{\expandafter\MakeUppercase}%
+ \else%
+ \def\@other{c##2}%
+ \if@cref@capitalise%
+ \def\@tmpc{}%
\else%
- \def\@other{c##2}%
- \if@cref@capitalise%
- \def\@changecase{}%
- \else%
- \def\@changecase{\MakeLowercase}%
- \fi%
- \fi}%
- \@tmpa#1\@nil%
+ \def\@tmpc{\MakeLowercase}%
+ \fi%
+ \fi}%
+ \@tmpa#1\@nil%
% \end{macrocode}
% If the other capitalisation variant is not already defined...
% \begin{macrocode}
- \@ifundefined{\@other @#2@name#5}{%
+ \@ifundefined{\@other @#2@name#5}{%
% \end{macrocode}
% Define \cmd{\@tmpa} and \cmd{@tmpb} to be partial expansions (expanded
% just once) of the macros for the capitalisation variant we've just
% defined above.
% \begin{macrocode}
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpa%
- \expandafter\expandafter\expandafter{%
- \csname#1@#2@name\endcsname}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpb%
- \expandafter\expandafter\expandafter{%
- \csname#1@#2@name@plural\endcsname}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpa%
+ \expandafter\expandafter\expandafter{%
+ \csname#1@#2@name\endcsname}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpb%
+ \expandafter\expandafter\expandafter{%
+ \csname#1@#2@name@plural\endcsname}%
% \end{macrocode}
-% Add the \cmd{\@changecase} command to the front of the definitions of
-% \cmd{\@tmpa} and \cmd{\@tmpb}.
+% Add the case-change command stored in \cmd{\@tmpc} to the front of the
+% definitions of \cmd{\@tmpa} and \cmd{\@tmpb}.
% \begin{macrocode}
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpa%
- \expandafter\expandafter\expandafter{%
- \expandafter\@changecase\@tmpa}%
- \expandafter\expandafter\expandafter\def%
- \expandafter\expandafter\expandafter\@tmpb%
- \expandafter\expandafter\expandafter{%
- \expandafter\@changecase\@tmpb}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpa%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@tmpc\@tmpa}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\@tmpb%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@tmpc\@tmpb}%
% \end{macrocode}
% Define the other capitalisation variants to be the partial expansions
% (expanded just once) of \cmd{\@tmpa} and \cmd{\@tmpb}. The
% \cmd{\@toksa} token register just makes the code less verbose.
% \begin{macrocode}
- \toksdef\@toksa=0%
- \@toksa={%
- \expandafter\gdef\csname\@other @#2@name#5\endcsname}%
- \expandafter\the\expandafter\@toksa\expandafter{\@tmpa}%
- \@toksa={%
- \expandafter\gdef\csname\@other @#2@name@plural#5\endcsname}%
- \expandafter\the\expandafter\@toksa\expandafter{\@tmpb}%
- }{}%
- \endgroup%
+ \toksdef\@toksa=0%
+ \@toksa={%
+ \expandafter\def\csname\@other @#2@name#5\endcsname}%
+ \expandafter\the\expandafter\@toksa\expandafter{\@tmpa}%
+ \@toksa={%
+ \expandafter\def\csname\@other @#2@name@plural#5\endcsname}%
+ \expandafter\the\expandafter\@toksa\expandafter{\@tmpb}%
+ }{}%
% \end{macrocode}
% Add label type to list of types that need defining from components.
% \begin{macrocode}
@@ -3558,19 +3722,11 @@
% \end{macrocode}
% Lower-case singular cross-reference name.
% \begin{macrocode}
- % \expandafter\expandafter\expandafter\def%
- % \expandafter\expandafter\expandafter\@tmpname%
- % \expandafter\expandafter\expandafter{%
- % \csname cref@#1@name\endcsname}%
\expandafter\def\expandafter\@tmpname\expandafter{%
\csname cref@#1@name\endcsname}%
% \end{macrocode}
% Upper-case singular cross-reference name.
% \begin{macrocode}
- % \expandafter\expandafter\expandafter\def%
- % \expandafter\expandafter\expandafter\@tmpName%
- % \expandafter\expandafter\expandafter{%
- % \csname Cref@#1@name\endcsname}%
\expandafter\def\expandafter\@tmpName\expandafter{%
\csname Cref@#1@name\endcsname}%
% \end{macrocode}
@@ -3600,8 +3756,8 @@
% \begin{macrocode}
\@crefconstructcomponents{#1}%
% \end{macrocode}
-% Assemble the arguments for \cmd{\crefformat} and \cmd{\Crefformat} from
-% the components.
+% Assemble the arguments for \cmd{\crefformat}, \cmd{\Crefformat} and
+% \cmd{\labelcrefformat} from the components.
% \begin{macrocode}
\expandafter\expandafter\expandafter\def%
\expandafter\expandafter\expandafter\@tmpfirst%
@@ -3611,6 +3767,7 @@
\expandafter\expandafter\expandafter\@tmpFirst%
\expandafter\expandafter\expandafter{%
\expandafter\@tmpName\expandafter~\@tmplabel}%
+ \expandafter\def\expandafter\@tmplabel\expandafter{\@tmplabel}%
% \end{macrocode}
% Define \cmd{\crefformat} and \cmd{\Crefformat}.
% \begin{macrocode}
@@ -3619,6 +3776,12 @@
\expandafter\the\expandafter\@toksa\expandafter{\@tmpfirst}%
\@toksa={\Crefformat{#1}}%
\expandafter\the\expandafter\@toksa\expandafter{\@tmpFirst}%
+% \end{macrocode}
+% Define \cmd{\labelcrefformat} if type has custom label format.
+% \begin{macrocode}
+ \@ifundefined{cref@#1@label}{}{%
+ \@toksa={\labelcrefformat{#1}}%
+ \expandafter\the\expandafter\@toksa\expandafter{\@tmplabel}}%
\endgroup}
% \end{macrocode}
% \end{macro}
@@ -3633,8 +3796,9 @@
% \begin{macrocode}
\@crefconstructcomponents{#1}%
% \end{macrocode}
-% Assemble the arguments for \cmd{\crefrangeformat} and
-% \cmd{\Crefrangeformat} from the components.
+% Assemble the arguments for \cmd{\crefrangeformat},
+% \cmd{\Crefrangeformat} and\linebreak[4] \cmd{\labelcrefrangeformat}
+% from the components.
% \begin{macrocode}
\expandafter\expandafter\expandafter\def%
\expandafter\expandafter\expandafter\@tmpfirst%
@@ -3644,6 +3808,8 @@
\expandafter\expandafter\expandafter\@tmpFirst%
\expandafter\expandafter\expandafter{%
\expandafter\@tmpNameplural\expandafter~\@tmprangelabel}%
+ \expandafter\def\expandafter\@tmprangelabel%
+ \expandafter{\@tmprangelabel}%
% \end{macrocode}
% Define \cmd{\crefrangeformat} and \cmd{\Crefrangeformat}.
% \begin{macrocode}
@@ -3652,6 +3818,17 @@
\expandafter\the\expandafter\@toksa\expandafter{\@tmpfirst}%
\@toksa={\Crefrangeformat{#1}}%
\expandafter\the\expandafter\@toksa\expandafter{\@tmpFirst}%
+% \end{macrocode}
+% Define \cmd{\labelcrefrangeformat} if type has custom label format.
+% \begin{macrocode}
+ \@ifundefined{cref@#1@rangelabel}{%
+ \@ifundefined{cref@#1@label}{\let\@tmpa\relax}{\def\@tmpa{}}}%
+ {\def\@tmpa{}}%
+ \ifx\@tmpa\@empty\relax%
+ \@toksa={\labelcrefrangeformat{#1}}%
+ \expandafter\the\expandafter\@toksa\expandafter{%
+ \@tmprangelabel}%
+ \fi%
\endgroup}
% \end{macrocode}
% \end{macro}
@@ -3666,8 +3843,9 @@
% \begin{macrocode}
\@crefconstructcomponents{#1}%
% \end{macrocode}
-% Assemble the arguments for \cmd{\crefmultiformat} and
-% \cmd{\Crefmultiformat} from the components.
+% Assemble the arguments for \cmd{\crefmultiformat},
+% \cmd{\Crefmultiformat} and\linebreak[4] \cmd{\labelcrefmultiformat}
+% from the components.
% \begin{macrocode}
\expandafter\expandafter\expandafter\def%
\expandafter\expandafter\expandafter\@tmpfirst%
@@ -3677,24 +3855,13 @@
\expandafter\expandafter\expandafter\@tmpFirst%
\expandafter\expandafter\expandafter{%
\expandafter\@tmpNameplural\expandafter~\@tmplabel}%
- % \expandafter\expandafter\expandafter\def%
- % \expandafter\expandafter\expandafter\@tmpsecond%
- % \expandafter\expandafter\expandafter{%
- % \expandafter\crefpairconjunction\@tmplabel}%
\expandafter\def\expandafter\@tmpsecond\expandafter{%
\expandafter\crefpairconjunction\@tmplabel}%
- % \expandafter\expandafter\expandafter\def%
- % \expandafter\expandafter\expandafter\@tmpmiddle%
- % \expandafter\expandafter\expandafter{%
- % \expandafter\crefmiddleconjunction\@tmplabel}%
\expandafter\def\expandafter\@tmpmiddle\expandafter{%
\expandafter\crefmiddleconjunction\@tmplabel}%
- % \expandafter\expandafter\expandafter\def%
- % \expandafter\expandafter\expandafter\@tmplast%
- % \expandafter\expandafter\expandafter{%
- % \expandafter\creflastconjunction\@tmplabel}%
\expandafter\def\expandafter\@tmplast\expandafter{%
\expandafter\creflastconjunction\@tmplabel}%
+ \expandafter\def\expandafter\@tmplabel\expandafter{\@tmplabel}%
% \end{macrocode}
% Bundle all four arguments for \cmd{\crefmultiformat} in token register
% \cmd{\@toksb}, then call it.
@@ -3727,6 +3894,23 @@
\expandafter{\@tmplast}}%
\@toksa={\Crefmultiformat{#1}}%
\expandafter\the\expandafter\@toksa\the\@toksb%
+% \end{macrocode}
+% If type has custom label format, bundle all four arguments
+% for\linebreak[4] \cmd{\labelcrefmultiformat} in token register
+% \cmd{\@toksb}, then call it.
+% \begin{macrocode}
+ \@ifundefined{cref@#1@label}{}{%
+ \@toksb={}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmplabel}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpsecond}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpmiddle}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmplast}}%
+ \@toksa={\labelcrefmultiformat{#1}}%
+ \expandafter\the\expandafter\@toksa\the\@toksb}%
\endgroup}
% \end{macrocode}
% \end{macro}
@@ -3742,8 +3926,8 @@
\@crefconstructcomponents{#1}%
% \end{macrocode}
% Assemble the arguments that need to be passed to
-% \cmd{\crefrangemultiformat} and \cmd{\Crefrangemultiformat} from the
-% reference components.
+% \cmd{\crefrangemultiformat}, \cmd{\Crefrangemultiformat} and
+% \cmd{\labelcrefrangemultiformat} from the reference components.
% \begin{macrocode}
\expandafter\expandafter\expandafter\def%
\expandafter\expandafter\expandafter\@tmpfirst%
@@ -3753,24 +3937,14 @@
\expandafter\expandafter\expandafter\@tmpFirst%
\expandafter\expandafter\expandafter{%
\expandafter\@tmpNameplural\expandafter~\@tmprangelabel}%
- % \expandafter\expandafter\expandafter\def%
- % \expandafter\expandafter\expandafter\@tmpsecond%
- % \expandafter\expandafter\expandafter{%
- % \expandafter\crefpairconjunction\@tmprangelabel}%
\expandafter\def\expandafter\@tmpsecond\expandafter{%
\expandafter\crefpairconjunction\@tmprangelabel}%
- % \expandafter\expandafter\expandafter\def%
- % \expandafter\expandafter\expandafter\@tmpmiddle%
- % \expandafter\expandafter\expandafter{%
- % \expandafter\crefmiddleconjunction\@tmprangelabel}%
\expandafter\def\expandafter\@tmpmiddle\expandafter{%
\expandafter\crefmiddleconjunction\@tmprangelabel}%
- % \expandafter\expandafter\expandafter\def%
- % \expandafter\expandafter\expandafter\@tmplast%
- % \expandafter\expandafter\expandafter{%
- % \expandafter\creflastconjunction\@tmprangelabel}%
\expandafter\def\expandafter\@tmplast\expandafter{%
\expandafter\creflastconjunction\@tmprangelabel}%
+ \expandafter\def\expandafter\@tmprangelabel%
+ \expandafter{\@tmprangelabel}%
% \end{macrocode}
% Bundle all four arguments for \cmd{\crefrangemultiformat} in token
% register \cmd{\@toksb}, then call it.
@@ -3803,6 +3977,118 @@
\expandafter{\@tmplast}}%
\@toksa={\Crefrangemultiformat{#1}}%
\expandafter\the\expandafter\@toksa\the\@toksb%
+% \end{macrocode}
+% If type has custom label format, bundle all four arguments
+% for\linebreak[4] \cmd{\labelcrefrangemultiformat} in token register
+% \cmd{\@toksb}, then call it.
+% \begin{macrocode}
+ \@ifundefined{cref@#1@rangelabel}{%
+ \@ifundefined{cref@#1@label}{\let\@tmpa\relax}{\def\@tmpa{}}}%
+ {\def\@tmpa{}}%
+ \ifx\@tmpa\@empty\relax%
+ \@toksb={}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmprangelabel}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpsecond}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpmiddle}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmplast}}%
+ \@toksa={\labelcrefrangemultiformat{#1}}%
+ \expandafter\the\expandafter\@toksa\the\@toksb%
+ \fi%
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@labelcrefdefinedefaultformats}
+% \cmd{\@labelcrefdefinedefaultformats} defines the default formats for
+% the\linebreak[4] \cmd{\labelcref} command, which are used when no
+% type-specific formats are defined.
+% \begin{macrocode}
+\def\@labelcrefdefinedefaultformats{%
+ \begingroup%
+ \toksdef\@toksa=0%
+ \toksdef\@toksb=1%
+% \end{macrocode}
+% Assemble the arguments that need to be passed to
+% \cmd{\labelcrefformat},\linebreak[4] \cmd{\labelcrefrangeformat},
+% \cmd{\labelcrefmultiformat} and\linebreak[4]
+% \cmd{\labelcrefrangemultiformat}.
+% \begin{macrocode}
+ \let\@tmplabel\cref@default@label%
+ \expandafter\def\expandafter\@tmpa\expandafter{%
+ \@tmplabel{####1}{####3}{####4}}%
+ \expandafter\def\expandafter\@tmpb\expandafter{%
+ \@tmplabel{####2}{####5}{####6}}%
+ \@toksa={\def\@tmprangelabel##1##2##3##4##5##6}%
+ \expandafter\expandafter\expandafter\the%
+ \expandafter\expandafter\expandafter\@toksa%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\expandafter\expandafter\crefrangepreconjunction%
+ \expandafter\@tmpa\expandafter\crefrangeconjunction\@tmpb%
+ \crefrangepostconjunction}%
+ \expandafter\def\expandafter\@tmplabel\expandafter{%
+ \@tmplabel{########1}{########2}{########3}}%
+ \expandafter\def\expandafter\@tmprangelabel\expandafter{%
+ \@tmprangelabel{########1}{########2}{########3}%
+ {########4}{########5}{########6}}%
+ \expandafter\def\expandafter\@tmpsecond\expandafter{%
+ \expandafter\crefpairconjunction\@tmplabel}%
+ \expandafter\def\expandafter\@tmpmiddle\expandafter{%
+ \expandafter\crefmiddleconjunction\@tmplabel}%
+ \expandafter\def\expandafter\@tmplast\expandafter{%
+ \expandafter\creflastconjunction\@tmplabel}%
+ \expandafter\def\expandafter\@tmprangesecond\expandafter{%
+ \expandafter\crefpairconjunction\@tmprangelabel}%
+ \expandafter\def\expandafter\@tmprangemiddle\expandafter{%
+ \expandafter\crefmiddleconjunction\@tmprangelabel}%
+ \expandafter\def\expandafter\@tmprangelast\expandafter{%
+ \expandafter\creflastconjunction\@tmprangelabel}%
+ \expandafter\def\expandafter\@tmplabel\expandafter{\@tmplabel}%
+ \expandafter\def\expandafter\@tmprangelabel%
+ \expandafter{\@tmprangelabel}%
+% \end{macrocode}
+% Define default \cmd{\labelcrefformat}.
+% \begin{macrocode}
+ \@toksa={\labelcrefformat{default}}%
+ \expandafter\the\expandafter\@toksa\expandafter{\@tmplabel}%
+% \end{macrocode}
+% Define default \cmd{\labelcrefrangeformat}.
+% \begin{macrocode}
+ \@toksa={\labelcrefrangeformat{default}}%
+ \expandafter\the\expandafter\@toksa\expandafter{\@tmprangelabel}%
+% \end{macrocode}
+% Bundle all four arguments for \cmd{\labelcrefmultiformat} in token
+% register \cmd{\@toksb}, then call it to define default formats.
+% \begin{macrocode}
+ \@toksb={}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmplabel}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpsecond}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpmiddle}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmplast}}%
+ \@toksa={\labelcrefmultiformat{default}}%
+ \expandafter\the\expandafter\@toksa\the\@toksb%
+% \end{macrocode}
+% Bundle all four arguments for \cmd{\labelcrefrangemultiformat} in token
+% register \cmd{\@toksb}, then call it to define default formats.
+% \begin{macrocode}
+ \@toksb={}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmprangelabel}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpsecond}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmpmiddle}}%
+ \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
+ \expandafter{\@tmplast}}%
+ \@toksa={\labelcrefrangemultiformat{default}}%
+ \expandafter\the\expandafter\@toksa\the\@toksb%
\endgroup}
% \end{macrocode}
% \end{macro}
@@ -3850,6 +4136,29 @@
\@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]{%
+ \expandafter\gdef\csname labelcref@#1@format@first\endcsname%
+ ##1##2##3{#2}%
+ \expandafter\gdef\csname labelcref@#1@format@second\endcsname%
+ ##1##2##3{#3}%
+ \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]{%
+ \expandafter\gdef\csname labelcrefrange@#1@format@first\endcsname%
+ ##1##2##3##4##5##6{#2}%
+ \expandafter\gdef\csname labelcrefrange@#1@format@second\endcsname%
+ ##1##2##3##4##5##6{#3}%
+ \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}}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -4778,7 +5087,7 @@
\@ifpackageloaded{varioref}{%
\PackageInfo{cleveref}{`varioref' support loaded}
\PackageInfo{cleveref}{`cleveref' supersedes `varioref's %
- $\backslash$labelformat command, which will not work}
+ \string\labelformat command}
\AtBeginDocument{%
\def\cref@vref#1#2{%
% \end{macrocode}
@@ -4962,9 +5271,9 @@
%
%
% \begin{macro}{select@language}
-% \begin{macro}{forreign@language}
+% \begin{macro}{foreign@language}
% If \package{babel} is loaded, we add to the \cmd{\select@language}
-% and \cmd{\forreign@language} commands to make them write substitution
+% and \cmd{\foreign@language} commands to make them write substitution
% rules to the script that replace the cross-reference name and
% conjunction component macros with the appropriate language-dependent
% names. We use |sed| line-number addresses in the rules to ensure they
@@ -5004,11 +5313,11 @@
\@cref@switched@languagetrue%
\cref@writelanguagerules%
\cref@old@select@language}
- \let\cref@old@forreign@language\forreign@language
- \def\forreign@language{%
+ \let\cref@old@foreign@language\foreign@language
+ \def\foreign@language{%
\@cref@switched@languagetrue%
\cref@writelanguagerules%
- \cref@old@forreign@language}
+ \cref@old@foreign@language}
\edef\cref@inputlineno{\the\inputlineno}}%
}{}
% \end{macrocode}
@@ -5021,7 +5330,7 @@
% \begin{macrocode}
\AtEndDocument{%
\let\select@language\cref@old@select@language%
- \let\forreign@language\cref@old@forreign@language%
+ \let\foreign@language\cref@old@foreign@language%
\cref@writelanguagerules}
% \end{macrocode}
%
@@ -5527,7 +5836,8 @@
\def\cref@vrefrange#1#2#3{%
\gdef\cref@poorman@text{}%
\@setcrefrange{#2}{#3}{#1}{} \vpagerefrange[\unskip]{#2}{#3}%
- \g@addto@macro\cref@poorman@text{ \vpagerefrange[\unskip]{#2}{#3}}%
+ \g@addto@macro\cref@poorman@text%
+ { \vpagerefrange[\unskip]{#2}{#3}}%
\def\@tmpa##1##2\@nil{%
\if##1c%
\if@crefstarred%
@@ -5777,6 +6087,7 @@
% \begin{macrocode}
\crefdefaultlabelformat{#2#1#3}
\creflabelformat{equation}{\textup{(#2#1#3)}}
+\@labelcrefdefinedefaultformats
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -7358,11 +7669,11 @@
{\CYRR\cyra\cyrz\cyrd\cyre\cyrl}%
{\CYRR\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
\Crefname{subsection}%
- {\CYRP\cyro\cyrd\cyrr\cyra\cyrz\cyrd\cyre\cyrl}%
- {\CYRP\cyro\cyrd\cyrr\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
+ {\CYRR\cyra\cyrz\cyrd\cyre\cyrl}%
+ {\CYRR\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
\Crefname{subsubsection}%
- {\CYRP\cyro\cyrd\cyrp\cyro\cyrd\cyrr\cyra\cyrz\cyrd\cyre\cyrl}%
- {\CYRP\cyro\cyrd\cyrp\cyro\cyrd\cyrr\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
+ {\CYRR\cyra\cyrz\cyrd\cyre\cyrl}%
+ {\CYRR\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
\Crefname{appendix}%
{\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
{\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
@@ -7447,11 +7758,11 @@
{\CYRR\cyra\cyrz\cyrd\cyre\cyrl}%
{\CYRR\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
\crefname{subsection}%
- {\CYRP\cyro\cyrd\cyrr\cyra\cyrz\cyrd\cyre\cyrl}%
- {\CYRP\cyro\cyrd\cyrr\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
+ {\CYRR\cyra\cyrz\cyrd\cyre\cyrl}%
+ {\CYRR\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
\crefname{subsubsection}%
- {\CYRP\cyro\cyrd\cyrp\cyro\cyrd\cyrr\cyra\cyrz\cyrd\cyre\cyrl}%
- {\CYRP\cyro\cyrd\cyrp\cyro\cyrd\cyrr\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
+ {\CYRR\cyra\cyrz\cyrd\cyre\cyrl}%
+ {\CYRR\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
\crefname{appendix}%
{\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
{\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
@@ -7519,16 +7830,18 @@
{\CYRS\cyrt\cyrr\cyro\cyrk\cyri}%
\else%
\crefname{equation}{\cyrf-\cyrl.}{\cyrf-\cyrl.}%
- \crefname{chapter}{\cyrg\cyrl\cyra\cyrv.}{\cyrg\cyrl\cyra\cyrv.}%
+ \crefname{chapter}%
+ {\cyrg\cyrl\cyra\cyrv.}%
+ {\cyrg\cyrl\cyra\cyrv.}%
\crefname{section}%
{\cyrr\cyra\cyrz\cyrd.}%
{\cyrr\cyra\cyrz\cyrd\cyre\cyrl.}%
\crefname{subsection}%
- {\cyrp\cyro\cyrd\cyrr\cyra\cyrz\cyrd.}%
- {\cyrp\cyro\cyrd\cyrr\cyra\cyrz\cyrd\cyre\cyrl.}%
+ {\cyrr\cyra\cyrz\cyrd.}%
+ {\cyrr\cyra\cyrz\cyrd\cyre\cyrl.}%
\crefname{subsubsection}%
- {\cyrp\cyro\cyrd\cyrp\cyro\cyrd\cyrr\cyra\cyrz\cyrd.}%
- {\cyrp\cyro\cyrd\cyrp\cyro\cyrd\cyrr\cyra\cyrz\cyrd\cyre\cyrl.}%
+ {\cyrr\cyra\cyrz\cyrd.}%
+ {\cyrr\cyra\cyrz\cyrd\cyre\cyrl.}%
\crefname{appendix}%
{\cyrp\cyrr\cyri\cyrl\cyro\cyrzh.}%
{\cyrp\cyrr\cyri\cyrl\cyro\cyrzh.}%
@@ -7821,11 +8134,11 @@
{\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}%
{\CYRR\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
\Crefname{subsection}%
- {\CYRP\cyrii\cyrd\cyrr\cyro\cyrz\cyrd\cyrii\cyrl}%
- {\CYRP\cyrii\cyrd\cyrr\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
+ {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}%
+ {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
\Crefname{subsubsection}%
- {\CYRP\cyrii\cyrd\cyrp\cyrii\cyrd\cyrr\cyro\cyrz\cyrd\cyrii\cyrl}%
- {\CYRP\cyrii\cyrd\cyrp\cyrii\cyrd\cyrr\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
+ {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}%
+ {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
\Crefname{appendix}%
{\CYRD\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
{\CYRD\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
@@ -7910,11 +8223,11 @@
{\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}%
{\CYRR\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
\crefname{subsection}%
- {\CYRP\cyrii\cyrd\cyrr\cyro\cyrz\cyrd\cyrii\cyrl}%
- {\CYRP\cyrii\cyrd\cyrr\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
+ {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}%
+ {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
\crefname{subsubsection}%
- {\CYRP\cyrii\cyrd\cyrp\cyrii\cyrd\cyrr\cyro\cyrz\cyrd\cyrii\cyrl}%
- {\CYRP\cyrii\cyrd\cyrp\cyrii\cyrd\cyrr\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
+ {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}%
+ {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
\crefname{appendix}%
{\CYRD\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
{\CYRD\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
@@ -7989,11 +8302,11 @@
{\cyrr\cyro\cyrz\cyrd.}%
{\cyrr\cyro\cyrz\cyrd\cyrii\cyrl.}%
\crefname{subsection}%
- {\cyrp\cyrii\cyrd\cyrr\cyro\cyrz\cyrd.}%
- {\cyrp\cyrii\cyrd\cyrr\cyro\cyrz\cyrd\cyrii\cyrl.}%
+ {\cyrr\cyro\cyrz\cyrd.}%
+ {\cyrr\cyro\cyrz\cyrd\cyrii\cyrl.}%
\crefname{subsubsection}%
- {\cyrp\cyrii\cyrd\cyrp\cyrii\cyrd\cyrr\cyro\cyrz\cyrd.}%
- {\cyrp\cyrii\cyrd\cyrp\cyrii\cyrd\cyrr\cyro\cyrz\cyrd\cyrii\cyrl.}%
+ {\cyrr\cyro\cyrz\cyrd.}%
+ {\cyrr\cyro\cyrz\cyrd\cyrii\cyrl.}%
\crefname{appendix}%
{\cyrd\cyro\cyrd\cyra\cyrt.}%
{\cyrd\cyro\cyrd\cyra\cyrt\cyrk.}%
@@ -8298,7 +8611,8 @@
\expandafter\@crefdefinemultiformat\expandafter{\@tmpa}}}{}%
\@ifundefined{crefrange@\@tmpa @format@first}{%
\@ifundefined{cref@\@tmpa @name@plural}{}{%
- \expandafter\@crefrangedefinemultiformat\expandafter{\@tmpa}}}{}%
+ \expandafter\@crefrangedefinemultiformat%
+ \expandafter{\@tmpa}}}{}%
\cref@stack@pop{\@tmpstack}%
\cref@isstackfull{\@tmpstack}}%
% \end{macrocode}
@@ -9019,6 +9333,7 @@
%%% Local Variables:
%%% mode: doctex
+%%% TeX-command-default: "Make"
%%% fill-column: 73
%%% TeX-master: t
%%% End: