Debian Codegraph @

texmf-dist/source/latex/cleveref/cleveref.dtx

raw
1 \def\packagedate{2018/03/27}
2 \def\packageversion{0.21.4}
3 % \iffalse meta-comment
4 %
5 % Package 'cleveref' to use with LaTeX2e
6 % Copyright 2006--2018 Toby Cubitt
7 %
8 % Written and maintained by Toby Cubitt
9 %
10 %% This file may be distributed and/or modified under the
11 %% conditions of the LaTeX Project Public License, either version 1.2
12 %% of this license or (at your option) any later version.
13 %% The latest version of this license is in:
14 %%
15 %% http://www.latex-project.org/lppl.txt
16 %%
17 %% and version 1.2 or later is part of all distributions of LaTeX
18 %% version 1999/12/01 or later.
19 %
20 % Please send bug reports and suggestions to [email protected]
21 % \fi
22 %
23 % \iffalse
24 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
25 %<package>\ProvidesPackage{cleveref}
26 %<package> [\packagedate\space v\packageversion\space Intelligent cross-referencing]
27 %
28 %<*driver>
29 \documentclass{ltxdoc}
30 %\documentclass[draft]{ltxdoc}
31 \usepackage{url}
32 \usepackage{pifont} % FIXME: find nicer line-continuation symbol than \ding{229}
33 \usepackage[colorlinks=true,linktocpage=true]{hyperref}
34 \usepackage[capitalise]{cleveref}
35 \DisableCrossrefs
36 \CodelineIndex
37 \RecordChanges
38 \setcounter{IndexColumns}{2}
39 %%\newcommand\package[1]{\texttt{#1.sty}}
40 \newcommand\package{\texttt}
41 \newcommand\file{\texttt}
42 \newcommand\option{\texttt}
43 \begin{document}
44 \DocInput{cleveref.dtx}
45 \end{document}
46 %</driver>
47 % \fi
48 %
49 % \CheckSum{19764}
50 %% \CharacterTable
51 %% {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
52 %% 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
53 %% Digits \0\1\2\3\4\5\6\7\8\9
54 %% Exclamation \! Double quote \" Hash (number) \#
55 %% Dollar \$ Percent \% Ampersand \&
56 %% Acute accent \' Left paren \( Right paren \)
57 %% Asterisk \* Plus \+ Comma \,
58 %% Minus \- Point \. Solidus \/
59 %% Colon \: Semicolon \; Less than \<
60 %% Equals \= Greater than \> Question mark \?
61 %% Commercial at \@ Left bracket \[ Backslash \\
62 %% Right bracket \] Circumflex \^ Underscore \_
63 %% Grave accent \` Left brace \{ Vertical bar \|
64 %% Right brace \} Tilde \~}
65 %
66 % \changes{v0.01}{2006/06/29}{Initial version}
67 % \changes{v0.02}{2007/04/18}{Complete rewrite}
68 % \changes{v0.03}{2007/04/26}{Added reference ranges}
69 % \changes{v0.04}{2007/05/26}{Renamed "cleveref" -- first public release}
70 % \changes{v0.05}{2007/05/31}{Added \option{poorman} option}
71 % \changes{v0.06}{2007/06/11}{\option{poorman} no longer writes extra
72 % .tmp file}
73 % \changes{v0.07}{2007/06/21}{Allow prevention of reference range
74 % collapsing}
75 % \changes{v0.08}{2007/07/10}%
76 % {Made referencing commands robust, improved default formats, made
77 % starred versions of referencing commands for hyperref, allowed
78 % multiple consecutive empty references in list to prevent range
79 % collapsing, and fixed bugs. Phew.}
80 % \changes{v0.08.1}{2007/08/08}{Bug fixes.}
81 % \changes{v0.09}{2007/10/29}%
82 % {Added an extra conjunction and format component, used when a list
83 % only contains a single pair of references or reference
84 % sub-lists. Formats are now constructed from customisable
85 % components, unless overridden using the old format definition
86 % commands.}
87 % \changes{v0.10}{2007/10/30}%
88 % {Allow optional argument to \textbackslash{}label to override
89 % reference type. Removed \option{hyperref} and \option{ntheorem}
90 % options; support for these and \package{amsmath} is enabled
91 % automatically if those packages are loaded.}
92 % \changes{v0.11}{2007/11/21}{Made referencing aware of appendices.}
93 % \changes{v0.11.1}{2007/11/29}{Bug fixes.}
94 % \changes{v0.12}{2009/02/11}{Restore working \textbackslash{}ref* when
95 % hyperref is loaded -- first release mirrored on www.dr-qubit.org}
96 % \changes{v0.13}{2009/04/17}{Finally implemented \option{sort} and
97 % \option{compress} package options. Support \package{amsmath}
98 % \textbackslash{}tag command. Added \package{babel} support for
99 % English, German and French. Added \package{varioref} support.}
100 % \changes{v0.13.1}{2009/07/01}{Bug fix to \textbackslash{}cref@get*
101 % commands to allow fragile and non-expandable commands in label tags.}
102 % \changes{v0.13.2}{2009/07/26}{Added\newline
103 % \textbackslash{}crefrangepreconjunction and
104 % \textbackslash{}crefrangepostconjunction commands, needed by some
105 % languages (such as Italian). Added \package{babel} support for
106 % Spanish and Italian. Added notes about \package{memoir}
107 % (in)compatibility.}
108 % \changes{v0.14}{2009/08/07}{Fixed bug that caused labels containing
109 % components with values of 10 or higher to be sorted
110 % incorrectly. Fixed \textbackslash{}Cref to no longer capitalise all
111 % cross-reference names in a multi-reference, just the first one. Added
112 % \option{capitalise} option to force capitalisation everywhere.}
113 % \changes{v0.14.1}{2009/08/18}{Added support for \package{amsmath}'s
114 % subequations environment}
115 % \changes{v0.14.2}{2009/09/22}{Fixed subequations sorting bug. Fixed bug
116 % in \option{poorman} when used without babel. \option{capitalise}
117 % option no longer uses \textbackslash{}Cref variant everywhere; it now
118 % redefines the \textbackslash{}cref variants instead.}
119 % \changes{v0.14.3}{2009/10/17}{Bug-fix in \textbackslash{}appendix
120 % code.}
121 % \changes{v0.15}{2009/11/26}{Added \package{amsthm} support, contributed
122 % by Michael Ummels. Added \textbackslash{}leavevmode before
123 % \textbackslash{}begingroup in \textbackslash{}@cref to avoid subtle
124 % bug that caused page count to be reset if the output routine was
125 % triggered within \textbackslash{}@cref.}
126 % \changes{v0.15.1}{2009/12/02}{Fixed regression introduced in v0.13 in
127 % non-\package{hyperref} \option{poorman} code. Fixed bug in
128 % \package{varioref} support that caused \textbackslash{}vref to print
129 % \textbackslash{}reftextcurrent string for references on the current
130 % page, breaking \package{varioref} backwards-compatibility. Added
131 % \package{babel} support for Dutch.}
132 % \changes{v0.15.2}{2009/12/07}{Fixed bug in \textbackslash{}appendix
133 % that produced badly formed prefix data for labels that aren't reset
134 % by other counters (e.g.\ tables and figures in most document
135 % classes). Fixed bug in \package{hyperref} \option{poorman} code that
136 % caused all label names to be lower-cased in the sed script. Fixed
137 % spacing bugs in the \package{cleveref} versions of the
138 % \package{varioref} commands.}
139 % \changes{v0.15.3}{2009/12/11}{Fixed bug in \package{varioref} support.
140 % Changed \option{poorman} \textbackslash{}usepackage sed substitution
141 % rule to use POSIX regexp syntax.}
142 % \changes{v0.16}{2010/04/19}{Major changes to the low-level
143 % implementation! \package{cleveref} now stores the extra information
144 % it requires in its own \textbackslash{}cref@currentlabel and its own
145 % parallel series of labels in the aux file, staying out of the way of
146 % the standard cross-reference mechanism and \textbackslash{}ref
147 % command. Also added \textbackslash{}namecref and
148 % \textbackslash{}nameCref commands, fixed a serious bug in the
149 % \package{amsmath} support affecting spacing of multi-line equation
150 % environments, added support for footnotes, and made
151 % \textbackslash{}newtheorem automatically define the singular form of
152 % the cross-reference name for new theorem-like environments.}
153 % \changes{v0.16.1}{2010/04/30}{Fixed bugs in \package{amsmath} spacing
154 % fix and \package{amsthm} support.}
155 % \changes{v0.16.2}{2010/05/12}{Fixed bugs in \textbackslash{}appendix
156 % version used with \package{hyperref}, and in \textbackslash{}footnote
157 % support.}
158 % \changes{v0.16.3}{2010/05/25}{Added missing \textbackslash{}namecrefs
159 % and \textbackslash{}nameCrefs commands. Fixed bug in
160 % \textbackslash{}AtBeginDocument code used to define
161 % \textbackslash{}cref<x>groupconjunction macros. Added missing
162 % \textbackslash{}crefname definitions for subsection, subsubsection
163 % etc. in terms of those for section, so that \textbackslash{}namecref
164 % works for those (and also switching language in the middle of a
165 % document). Added \package{babel} support for Russian and Ukrainian.
166 % Fixed bug in \textbackslash{}refstepcounter@optarg.}
167 % \changes{v0.17}{2010/06/07}{Fixed bug in non-\package{hyperref}
168 % version of \textbackslash{}refstepcounter. Added
169 % \textbackslash{}crefalias command for aliasing a counter to a
170 % different cross-reference type. Added support for \package{algorithm}
171 % package. Improved support for \package{subfig} package. Added support
172 % for \package{listings} package. Fixed bugs in \package{amsmath}
173 % \textbackslash{}tag command when used with \option{sort} option, and
174 % in the \package{amsmath} multline environment's support for the
175 % optional argument to \textbackslash{}label.}
176 % \changes{v0.17.1}{2010/06/24}{Modified \textbackslash{}@crefname macro
177 % so that it no longer makes global definitions, to fix support for
178 % \package{babel}'s \textbackslash{}otherlanguage and
179 % \textbackslash{}foreignlanguage commands. Fixed typos in
180 % \option{poorman} \textbackslash{}foreignlanguage code. Fixed bug in
181 % the \package{amsmath} multline environment's support for the optional
182 % argument to \textbackslash{}label\dots{} again. Added
183 % \textbackslash{}labelcref command.}
184 % \changes{v0.17.2}{2010/07/24}{Removed unneeded argument from
185 % \textbackslash{}@footnotetext redefinition, to improve compatibility
186 % with other packages that redefine footnotes.}
187 % \changes{v0.17.3}{2010/08/30}{Added missing default format definitions
188 % for ``part''. Fixed bad active character interaction between
189 % \package{cleveref} and some \package{babel} languages (in particular
190 % Spanish). Fixed \package{hyperref} support code so
191 % that it is only enabled if \package{hyperref} was loaded with the
192 % \option{implicit} option set to \option{true} (the default).}
193 % \changes{v0.17.4}{2010/09/04}{Added automatic support for
194 % \package{aliascnt} counters whose parent counter gets reset. Fixed
195 % serious bug in the test for \package{hyperref}'s \option{implicit}
196 % options.}
197 % \changes{v0.17.5}{2010/09/15}{Fixed bug that broke compilation of
198 % documents that didn't use \package{hyperref}, because
199 % \textbackslash{}if@cref@hyperrefloaded was not defined.}
200 % \changes{v0.17.6}{2011/01/05}{Added \package{babel} support for
201 % Norwegian. Replaced ``appendice'' with ``annexe'' in French default
202 % cross-reference names, to match \package{babel} names. Replaced
203 % ``Linie'' with ``Zeile'' in the German default cross-reference names.
204 % Added \textbackslash{}lcnamecref and \textbackslash{}lcnamecrefs
205 % commands to force lowercase reference names, useful with the
206 % \option{capitalise} option.}
207 % \changes{v0.17.7}{2011/01/10}{Fixed \textbackslash{}crefname to work
208 % with empty reference names.}
209 % \changes{v0.17.8}{2011/01/19}{Fixed automatic
210 % \textbackslash{}newtheorem name definitions to work with empty
211 % names.}
212 % \changes{v0.17.9}{2011/03/22}{Added support for \package{algorithm2e}
213 % package. Added missing \textbackslash{}crefname definitions for
214 % `listing'. Changed case used in plural forms in Norwegian. Fixed bug
215 % in redefinition of \package{amsmath} \textbackslash{}tag command.
216 % Added \package{babel} support for Danish. Renamed internal
217 % \textbackslash{}@result macro to \textbackslash{}cref@result to avoid
218 % conflict with \package{tikz-qtree} package. Also renamed internal
219 % \textbackslash{}@temp<x> macros to \textbackslash{}@temp<x>, which
220 % seems to be more standard for temporary macros, to mitigate against
221 % similar (though less likely) conflicts, and also save a minuscule
222 % amount of \TeX{} memory.}
223 % \changes{v0.17.10}{2011/04/16}{Fixed bug in
224 % \textbackslash{}@cref@stack@insert caused by a temporary macro name
225 % clash.}
226 % \changes{v0.18}{2011/10/24}{Implemented clever page referencing via
227 % \textbackslash{}cpageref et al.\ commands, which supports
228 % multi-references, including sorting and page range collapsing.
229 % Improved \package{varioref} support, combining \package{varioref} and
230 % (new) \package{cleveref} page-referencing features. Removed
231 % \option{legacyvarioref} option. Fixed bug in
232 % \textbackslash{}newtheorem support. Documented \package{mathtools}
233 % \option{showonlyrefs} incompatibility. Fixed some of the Spanish and
234 % German translations. Implemented \option{nameinlink} option, to
235 % include cross-reference names in hyperlinks when using
236 % \package{hyperref}. Implemented \option{noabbrev} option to disable
237 % all use of abbreviations in default cross-reference names. Added
238 % support for a \file{cleveref.cfg} file, which is loaded after the
239 % rest of \package{cleveref} has loaded. Made cross-references to
240 % sections work correctly when using the \package{revtex4} or
241 % \package{revtex4-1} docclasses. Fixed \package{subfig} and
242 % \package{caption} compatibility with optional argument to
243 % \textbackslash{}label.}
244 % \changes{v0.18.1}{2011/12/24}{Fixed compatibility with newer versions
245 % of \package{caption} package.}
246 % \changes{v0.18.2}{2012/01/17}{Don't try to redefine
247 % \textbackslash{}appendix if it's not defined in current document
248 % class. Fixed bug in \textbackslash{}@setnamecref. Refactored common
249 % code in format-definition macros into separate
250 % \textbackslash{}cref@othervariant macro. Added
251 % \package{IEEEtrantools} support.}
252 % \changes{v0.18.3}{2012/01/18}{Fixed bugs with multiple equations and
253 % subequations in an \textbackslash{}IEEEeqnarray.}
254 % \changes{v0.18.4}{2012/01/23}{Set \textbackslash{}cref@currentlabel
255 % locally instead of globally, to match how
256 % \textbackslash{}@currentlabel is set. Fix \package{xr} compatibility
257 % by adding a ``cref'' suffix to \package{cleveref}'s internal label
258 % names, instead of a prefix.}
259 % \changes{v0.18.5}{2012/03/05}{Fixed \package{listings} and
260 % \package{algorithm} package support, broken by change to local rather
261 % than global \textbackslash{}cref@currentlabel definitions. Fixed
262 % compatibility with \package{memoir}'s internal \package{subfig}
263 % re-implementation.}
264 % \changes{v0.18.6}{2012/09/25}{Sorted out \package{algorithm} and
265 % \package{algorithmicx} package support. Note: \package{algorithmic}
266 % package is \emph{not} supported. Fixed compatibility with
267 % \package{bigfoot} package. Added support for \package{polyglossia}
268 % package. Mentioned \package{autonum} as a possible replacement for
269 % (incompatible) \option{showonlyrefs} option to \package{mathtools}
270 % package.}
271 % \changes{v0.18.7}{2012/10/04}{Fixed regression in \package{varioref}
272 % support that once again (see v0.15.1) caused \textbackslash{}vref to
273 % print \textbackslash{}reftextcurrent string for references on the
274 % current page. Fixed regression(?) causing spurious whitespace to be
275 % produced for empty cross-reference names (see v0.17.7).}
276 % \changes{v0.18.8}{2013/03/22}{Fixed automatic
277 % \textbackslash{}newtheorem definitions in \package{amsthm} support.
278 % Add Swedish and Brazilian translations. Fix bug in
279 % \package{algorithm2e} + \package{hyperref} support.}
280 % \changes{v0.18.9}{2013/03/22}{Fixed regression that broke
281 % \option{nameinlink} option.}
282 % \changes{v0.19}{2013/12/28}{Added \package{breqn} package support.
283 % Remove unwanted spaces in some macros. Added abbreviation for
284 % ``Abbildung'' to German translations. Added \package{xr-hyper}
285 % package support. Fixed bug in \package{amsmath} \textbackslash{}tag
286 % support. Added \textbackslash{}crefstripprefix utility macro and
287 % example usage. Added separate \texttt{subequation} cross-reference
288 % type.}
289 % \changes{v0.19.1}{2014/08/14}{Fixed bug in \textbackslash{}labelcref
290 % format customization. Fixed subtle \textbackslash{}varioref bug
291 % caused by a stray \%. Fixed typo in Swedish translations. Fix
292 % \textbackslash{}setcrefrange to use same test for matching reference
293 % types \textbackslash{}cref@processgroup and
294 % \textbackslash{}cref@processgroupall.}
295 % \changes{v0.19.2}{2015/11/18}{Fixed compatibility with REFTeX
296 % \textbackslash{}appendix* command. Added catalan language support.
297 % Fix \textbackslash{}@bsphack/\textbackslash{}@esphack spacing issues
298 % in \textbackslash{}label refefinitions. Fix \textbackslash{}crefalias
299 % mechanism in \package{hyperref} support. Fix bugs in \package{breqn}
300 % and \package{varioref} support. Ensure any undefined
301 % \textbackslash{}labelcref formats for sub-types (subsections,
302 % subequations etc.) are copied from parent types. (This fixes missing
303 % brackets around \textbackslash{}labelcref subequation references.)}
304 % \changes{v0.20}{2016/08/10}{Fix erroneous \%'s after
305 % \textbackslash{}advance which broke \package{varioref} support.
306 % Add \textbackslash{}cref@ifstreq utility macro for
307 % catcode-independent string comparison.
308 % Fix sorting of enum\meta{x} labels.}
309 % \changes{v0.21}{2017/07/10}{Add \texttt{cref@} prefix to
310 % \textbackslash{}gobble@optarg to avoid conflicts with other packages.
311 % Compress away duplicate references in \textbackslash{}cref etc.\ just
312 % as we already did for \textbackslash{}cpageref. Fix
313 % \textbackslash{}cpageref error on non-arabic page numbers. Fix bug
314 % that disabled warning on more than one reference type within a
315 % \textbackslash{}labelcref. Refactor \textbackslash{}cpageref to use
316 % same machinery as \textbackslash{}cref, treating different page
317 % numbering schemes within a document as different page number
318 % ``types''. Refactor and simplify main \textbackslash{}@cref macro.
319 % Fix compatibility with newer IEEEtrantools versions. Fix subtle
320 % bug in \package{amsmath}$+$\package{hyperref} subequations support,
321 % which made hyperlinks point to wrong location in \emph{all} equations
322 % following the first use of subequations in a document.}
323 % \changes{v0.21.1}{2018/02/08}{Fix bug in \package{hyperref}
324 % \textbackslash{}cpagerefrange support. Disable \package{hyperref}
325 % support when \package{hyperref} is loaded with implicit=false option,
326 % and generate a warning that this situation is unsupported. Fix bug
327 % that broke \texttt{compress} option.}
328 % \changes{v0.21.2}{2018/02/09}{Fix bug in undefined reference warning
329 % message printed by \textbackslash{}namecref etc., and note in the
330 % documentation that these commands only accept a single reference.
331 % Add support for \textbackslash{}crefalias'ing of appendix reference
332 % types.}
333 % \changes{v0.21.3}{2018/03/03}{Fix bug in \package{hyperref}-support
334 % version of \textbackslash{}cpageref. Fix spelling mistakes in Dutch
335 % translations. Add additional advanced cross-reference formatting
336 % example to manual. Modify \textbackslash{}@crefcopyformats so it
337 % copys over format \emph{components}, rather than copying over the
338 % low-level format definitions.}
339 % \changes{v0.21.4}{2018/03/27}{Make subsubsection/subsubappendix formats
340 % inherit from subsection/subappendix rather than section/appendix.
341 % Modify \textbackslash{}@crefcopyformats to copy over low-level
342 % formats again \emph{if} no components have have been customised.
343 % Improve explanation of sub-format inheritance in the manual.}
344 %
345 % \GetFileInfo{cleveref.sty}
346 %
347 %
348 % \title{The \package{cleveref} package\thanks{This document
349 % corresponds to \textsf{cleveref}~\packageversion, dated
350 % \packagedate.}}
351 % \author{Toby Cubitt \\
352 % \href{mailto:[email protected]}{[email protected]}}
353 % \date{\packagedate}
354 %
355 % \maketitle
356 %
357 % \begin{abstract}
358 % The \package{cleveref} package enhances \LaTeX{}'s cross-referencing
359 % features,\linebreak[4] allowing the format of cross-references to be
360 % determined automatically according to the ``type'' of cross-reference
361 % (equation, section, etc.) and the context in which the
362 % cross-reference is used. The formatting for each cross-reference type
363 % can be fully customised in the preamble of your document. In
364 % addition, \package{cleveref} can typeset cross-references to lists
365 % of multiple labels, automatically formatting them according to their
366 % types, sorting them, and compressing sequences of numerically
367 % consecutive labels. Again, the multiple-reference formatting is fully
368 % customisable.
369 %
370 % Normally, the latest version of the \package{cleveref} package is
371 % available via CTAN.\ Occasionally, slightly newer ``pre-release''
372 % versions are available at \url{www.dr-qubit.org/latex.php#cleveref} a
373 % little before they make their way onto CTAN.
374 % \end{abstract}
375 %
376 % \clearpage
377 % \tableofcontents
378 % \clearpage
379 %
380 %
381 % \section{Introduction}
382 % When ``clever'' is used in the name of a computer program, it usually
383 % indicates that the programmer is overly smug about his own
384 % achievements. But at the heart of the \LaTeX{} philosophy also lies the
385 % idea that it is clever to delegate as much of the typesetting as
386 % possible to the computer, in order to achieve a beautiful --- and above
387 % all consistent --- visual appearance.
388 %
389 % All of this probably applies to the \package{cleveref} package. Its
390 % goals are two-fold: to exploit all the information that \LaTeX{} can
391 % collect about labels as intelligently as possible (clever processing),
392 % allowing you to produce an attractive, consistent formatting of
393 % cross-references throughout your document with the minimum of effort
394 % (you'd be clever to use it!).
395 %
396 % The \package{cleveref} package enhances \LaTeX{}'s cross-referencing
397 % features by automatically formatting cross-references depending on what
398 % they refer to (chapter, section, equation, theorem, etc.). It can
399 % automatically format cross-references to multiple labels, and can sort
400 % lists of multiple cross-references, compresses consecutive labels into
401 % a reference range, and all kinds of other clever wizardry. It also does
402 % similar things with page references.
403 %
404 % In standard \LaTeX{}, you have almost certainly found yourself writing
405 % things like |Eq.~(\ref{eq1})| and |Theorems~\ref{thm1} to~\ref{thm3}|
406 % over and over again. Tedium isn't the only downside to this. What
407 % happens if you later decide you want equation references to be typeset
408 % as |Equation~\ref{eq1}| instead (i.e.\ without the abbreviation and
409 % without the parentheses)? What happens if you decide to change the
410 % theorem labelled |thm1| into a lemma?\footnote{Note that to allow
411 % \package{cleveref} to automatically infer the type of theorem, you need
412 % to load either the \package{ntheorem} or the \package{amsthm} package.
413 % See \cref{sec:non-bugs} for more details.} What if you move |thm3| so
414 % that it appears (and is numbered) before |thm1|, meaning that
415 % references to the sequence of theorems 1 through 3 should now be
416 % ordered |Theorems~\ref{thm3} to~\ref{thm1}| (i.e.\ the other way
417 % around)? What if you decide you prefer references to multiple theorems
418 % to be written as |Theorems~\ref{thm1}--\ref{thm3}|? Any such change
419 % requires you to search through the entire \LaTeX{} source of your
420 % document, modifying all references to equations, updating all
421 % references to |thm1|, re-ordering all references to |thm1| and |thm3|,
422 % and changing all the formatting of references to multiple theorems.
423 %
424 % The \package{cleveref} package allows you to define the format for the
425 % different types of cross-references once-and-for-all in the preamble of
426 % your document. (Of course, sane default formats are provided, so you
427 % only have to redefine the format if you don't like the default for a
428 % particular cross-reference type.) If you later decide to change the
429 % format of equation references, you only have to change one preamble
430 % definition. If you change a theorem into a lemma, you don't need to
431 % change any cross-references at all, because \package{cleveref} will
432 % automatically use the appropriate name when typesetting any
433 % cross-references to it. This makes it far easier to typeset
434 % cross-references uniformly across your whole document, as well as
435 % avoiding repetitively typing similar text for each and every
436 % cross-reference.
437 %
438 %
439 %
440 % \section{Usage}
441 % The \package{cleveref} package is loaded in the usual way, by putting
442 % the line
443 % \begin{quote}
444 % |\usepackage{cleveref}|
445 % \end{quote}
446 % in your document's preamble. However, care must be taken when using
447 % \package{cleveref} in conjunction with other packages that modify
448 % \LaTeX{}'s referencing system (see
449 % \cref{sec:other_packages}). Basically, \package{cleveref} must be
450 % loaded \emph{last}.
451 %
452 % If you just want to get going quickly with \package{cleveref}, and come
453 % back later to read up on all the features it provides in more detail,
454 % here's what you need to do. Wherever you would previously have used
455 % |\ref|, use |\cref| instead. (Except at the beginning of a sentence,
456 % where you should use |\Cref|.) You no longer need to put the name of
457 % the thing you're referencing in front of the |\cref| command, because
458 % \package{cleveref} will sort that out for you: i.e.\ use |\cref{eq1}|
459 % instead of |eq.~(\ref{eq1})|. If you want to refer to a range of
460 % labels, use the |\crefrange| command: |\crefrange{eq1}{eq5}| produces
461 % |eqs.~(1) to~(5)|. If you want to refer to multiple things at once, you
462 % can simply throw them all into one cross-reference and leave
463 % \package{cleveref} to sort it out: e.g.\
464 % |\cref{eq2,eq1,eq3,eq5,thm2,def1}| produces%
465 % |eqs.~(1) to~(3) and~(5),| |theorem~5, and definition~1|. Finally, if
466 % you want a page reference, use |\cpageref| (and don't write ``page'' in
467 % front), if you want a page range, use |\cpagerefrange|, and if you want
468 % to refer to multiple pages, simply throw them all into a single
469 % |\cpageref|. Just as with |\cref| (above), \package{cleveref} will sort
470 % it all out for you automaticaly.
471 %
472 % \package{Cleveref} supports a number of languages other than English,
473 % and also supports the \package{babel} and \package{polyglossia}
474 % packages for those languages. Either pass the desired language as an
475 % option to \package{cleveref}, or pass it as a global option to
476 % |\documentclass|. Note that if you're writing in a language in which
477 % nouns decline, the |\cref| and |\cpageref| commands may be less useful,
478 % as they always produce the cross-reference name in the nominative
479 % case.\footnote{Providing separate variants of the \package{cleveref}
480 % commands for each noun case quickly becomes more cumbersome than just
481 % typing the cross-reference name by hand. Trying to determine the
482 % appropriate case automatically would be tantamount to solving the full
483 % natural-language processing problem in \package{cleveref}. Check back
484 % in a century or so for this feature.} In such languages, you may
485 % instead prefer to use the |\labelcref| and |\labelcpageref| commands.
486 % Unlike |\cref| and |\cpageref|, these don't produce the name in front
487 % of the cross-reference, so you must supply it (in the appropriate case)
488 % yourself. But they do still cope with multi-references, so you still
489 % gain some benefit from using \package{cleveref}.
490 %
491 %
492 %
493 % \section{Comparison with Other Packages}
494 % Given how useful automated cross-reference typesetting is, there are
495 % naturally a number of other \LaTeX{} packages with similar goals to
496 % \package{cleveref}, most notably \package{varioref},
497 % \package{fancyref}, \package{hyperref}'s |\autoref| command, and (for
498 % theorem-like environments) \package{ntheorem} with the \option{thref}
499 % option. (There are many others, but these come closest to providing
500 % similar features to \package{cleveref}.) However, all have certain
501 % deficiencies which \package{cleveref} attempts to overcome.
502 %
503 % The \package{fancyref} package doesn't automatically determine the type
504 % of thing being referred to. Instead, it relies on you adhering to a
505 % naming convention for labels. This is usually a good idea in any case,
506 % but it can occasionally be inconvenient. For example, if you change a
507 % theorem into a lemma, you have to change the label name, and therefore
508 % also all cross-references to it. So with \package{fancyref}, you will
509 % at times be back to searching and replacing label names throughout your
510 % document. Not to mention missing out on all the other
511 % \package{cleveref} features, such as automatic sorting and compressing
512 % of consecutive references, \package{ntheorem} and \package{amsthm}
513 % support, precise control over hyperlinks, etc.
514 %
515 % The enhanced referencing feature provided by the \package{varioref}
516 % package's\linebreak[4] |\labelformat| command decides how to format
517 % cross-references when the label is \emph{defined}, rather than when it
518 % is \emph{referenced}. Often this isn't a problem. But it makes it
519 % impossible to format cross-references according to the context in which
520 % they are referenced, which can sometimes be very useful. For example,
521 % you may want cross-references at the beginning of a sentence formatted
522 % differently to cross-references in the middle of a sentence. E.g.\ you
523 % may want to use the abbreviation ``eq.'', but revert to ``Equation'' at
524 % the beginning of sentences (words at the start of sentences shouldn't
525 % be abbreviated in English). This is not possible with
526 % \package{varioref}. Perhaps even more significantly,
527 % \package{varioref}'s |\labelformat| implementation makes it impossible
528 % to typeset multiple references automatically; if you want to refer to
529 % equations |eq1| through |eq3|, with \package{varioref} you are back to
530 % typing |Eqs.~(\ref{eq1}) to~(\ref{eq3})| by hand. Not to mention
531 % missing out on all the other \package{cleveref} features. In fact,
532 % \package{cleveref} fully supports \package{varioref}, taking over
533 % responsibility for typesetting cross-references, whilst retaining (and
534 % even enhancing) all the \package{varioref} page-referencing magic.
535 %
536 % The \package{hyperref} package's |\autoref| command typesets a name
537 % before a cross-reference, determined by the cross-reference type. This
538 % is less flexible than \package{cleveref}'s fully customisable
539 % cross-reference formatting, but, when combined with \package{varioref},
540 % the two packages working together come pretty close. But surprisingly,
541 % even with \package{hyperref}, it is impossible to customise precisely
542 % which part of the cross-reference is made into a hyperlink in PDF
543 % documents; this is simple with \package{cleveref}. And it still remains
544 % impossible to typeset multiple references, have consecutive references
545 % sorted and compressed automatically, etc.
546 %
547 % The \package{ntheorem} package (with the \option{thref} option) does
548 % the right thing when it comes to how and when the format is
549 % defined\ldots except that it only works for theorem-like environments.
550 % It is possible to use it for other environments, but only in a
551 % bastardized form, by manually supplying an optional argument to every
552 % |\label| command to specify the label type. \package{Cleveref} works
553 % equally well with any type of cross-reference, as well as fully
554 % supporting \package{ntheorem}. And again, \package{cleveref} provides a
555 % number of additional features over \package{ntheorem}, such as
556 % multi-references, automatic sorting and compressing of consecutive
557 % cross-references, control over the placement of hyperlinks, etc.
558 %
559 %
560 %
561 % \section{Typesetting Cross-References}
562 % \label{sec:typesetting}
563 % \DescribeMacro\cref
564 % To automatically typeset a cross-reference according to the type of
565 % thing referred to, simply refer to it using |\cref|\marg{label}.
566 % \package{Cleveref} imposes just one extra restriction on the names of
567 % labels: they are no longer allowed to contain commas ``,''. These are
568 % instead used to typeset multiple cross-references (see below).
569 %
570 % \DescribeMacro\Cref
571 % As it is very difficult\footnote{Actually, very likely impossible!} for
572 % \LaTeX{} to determine whether a cross-reference appears at the
573 % beginning of a sentence or not, a beginning-of-sentence variant exists:
574 % |\Cref|\marg{label}. By default, this typesets the cross-reference with
575 % the first letter capitalised, and without using an abbreviation in
576 % those cases where the standard variant does use one. (However, the
577 % formatting of the |\cref| and |\Cref| forms can be fully and
578 % independently customised, see \cref{sec:customising}.)
579 %
580 % \DescribeMacro\crefrange
581 % \DescribeMacro\Crefrange
582 % To typeset a cross-reference range, e.g.\ |Eqs.~(1.1) to~(1.5)|,
583 % use\linebreak[4] |\crefrange| or |\Crefrange| (depending on the
584 % capitalisation you require), which take the beginning and end of the
585 % range as arguments:
586 % \begin{quote}
587 % |\crefrange|\marg{label1}\marg{label2}
588 % \end{quote}
589 %
590 % \DescribeMacro\cref
591 % \DescribeMacro\Cref
592 % To typeset multiple cross-references, simply list the labels inside
593 % the |\cref| or |\Cref| command, separated by commas (recall that you
594 % are not allowed to use commas in label names when using
595 % \package{cleveref}):
596 % \begin{quote}
597 % |\cref{|\meta{label1}|,|\meta{label2}|,|\meta{label3}|,|\dots|}|
598 % \end{quote}
599 %
600 % \DescribeMacro{\cref*}
601 % \DescribeMacro{\Cref*}
602 % \DescribeMacro{\crefrange*}
603 % \DescribeMacro{\Crefrange*}
604 % When \package{cleveref} is used along with the \package{hyperref}
605 % package (see \cref{sec:customising,sec:other_packages}), additional
606 % starred variants of all the referencing commands are available. The
607 % standard referencing commands will make cross-references into
608 % hyperlinks; the starred variants prevent this, producing the same
609 % typeset text but without creating hyperlinks.
610 %
611 % \DescribeMacro\cpageref
612 % \DescribeMacro\Cpageref
613 % To typeset a page reference, use |\cpageref|\marg{label}, which is
614 % typeset e.g.\ as ``page~3''. At the beginning of a sentence, use
615 % |\Cpageref| instead. Since page references are always references to,
616 % well\dots pages, this doesn't gain you so much over |\pageref|. Where
617 % |\cpageref| comes into its own is in referring to multiple pages:
618 % \begin{quote}
619 % |\cpageref{|\meta{label1}|,|\meta{label2}|,|\meta{label3}|,|\dots|}|
620 % \end{quote}
621 % \DescribeMacro\cpagerefrange
622 % \DescribeMacro\Cpagerefrange
623 % Predictably enough, |\cpagerefrange| and |\Cpagerefrange| are used to
624 % typeset references to page ranges:
625 % \begin{quote}
626 % |\cpagerefrange|\marg{label1}\marg{label2}
627 % \end{quote}
628 %
629 % \DescribeMacro\ref
630 % \DescribeMacro\pageref
631 % \package{Cleveref} does \emph{not} modify the standard |\ref| or
632 % |\pageref| commands, so you can still use them to typeset the
633 % formatted label counter or page number alone, without any additional
634 % text or formatting.
635 %
636 % \DescribeMacro{\namecref}
637 % \DescribeMacro{\nameCref}
638 % \DescribeMacro{\lcnamecref}
639 % \DescribeMacro{\namecrefs}
640 % \DescribeMacro{\nameCrefs}
641 % \DescribeMacro{\lcnamecrefs}
642 % Occasionally, it's useful to produce just the name of a reference,
643 % without the label itself. For example, if you want to refer to ``this
644 % section'', but you're not sure whether you might later change the
645 % section into a chapter, it might be useful to produce just the name
646 % ``section'' associated with the section's label. If you later change
647 % the section into a chapter, the text will then automatically change to
648 % ``this chapter''. The |\namecref| and |\nameCref| do exactly this:
649 % \begin{quote}
650 % |\namecref{sec1}|
651 % \end{quote}
652 % is typeset as ``section'' (assuming |sec1| labels a section). The
653 % |\namecrefs| and |\nameCrefs| commands produce the plural forms. The
654 % |\lcnamecref| and |\lcnamecrefs| commands force the reference name to
655 % lowercase, for use when the \option{capitalise} option is enabled (see
656 % \cref{sec:capitalise}). (When that option is set, |\namecref| produces
657 % an uppercase reference name.)
658 %
659 % Note that all these commands can only be passed a \emph{single}
660 % reference name; they do \emph{not} accept multi-references like
661 % |\cref|. (Passing multiple references to these commands would make
662 % little sense if the references had different types, and is redundant if
663 % they have the same type.)
664 %
665 % There is a slight pitfall that you should be aware of when using the
666 % |\namecref| commands. They get the reference name from the names
667 % defined for the label's reference type using |\crefname| or |\Crefname|
668 % (see \cref{sec:individual_customisation}). The default reference
669 % formats provide these definitions. However, it is possible to customise
670 % reference formats using lower-level commands that do not create
671 % |\crefname| definitions (see \cref{sec:low-level_customisation}). If
672 % the |\crefname| definitions are missing for a particular reference
673 % type, |\namecref| and |\nameCref| will produce errors for labels of
674 % that type. You can fix the error by adding explicit |\crefname|
675 % definitions for these types.
676 %
677 % \DescribeMacro{\labelcref}
678 % Conversely, it is occasionally convenient to produce just the label
679 % part of a reference, without the cross-reference name. For example,
680 % this can be useful when writing in a language in which nouns decline.
681 % The |\labelcref| command does exactly this, and can also cope with
682 % multi-references, processing them just as |\cref| does. However, since
683 % it typesets a multi-reference without any name, \emph{all} labels in a
684 % |\labelcref| multi-reference \emph{must} be of the same type.
685 %
686 % The |\labelcref| command will typeset cross-reference labels using the
687 % default label format if no type-specific format is defined using
688 % |\creflabelformat| (see
689 % \cref{sec:global_customisation,sec:individual_customisation}). Note
690 % that, if you customise reference formats using the low-level commands,
691 % you may want to also explicitly define the |\labelcref| formats to
692 % match, using the |\labelcrefformat| etc.\ commands (see
693 % \cref{sec:low-level_customisation}).
694 %
695 % \DescribeMacro{\labelcpageref}
696 % Similarly, |\labelcpageref| typesets the page numbers alone, without
697 % inserting ``page'' in front. Like |\cpageref|, it also handles
698 % multi-references. Like |\labelcref|, by default |\labelcpageref|
699 % typesets the page numbers using the default label format, customised
700 % using |\crefdefaultlabelformat|. If you want to define a separate
701 % format for |\labelcpageref|, use |\creflabelformat| to customise the
702 % label format for the ``page'' cross-reference type. (see
703 % \cref{sec:low-level_customisation}).
704 %
705 %
706 %
707 % \section{Sorting and Compressing}
708 % \label{sec:sort&compress}
709 % When \package{cleveref} typesets lists of multiple cross-references or
710 % page-references, the default behaviour is to automatically sort the
711 % list and compress sequences of consecutive cross-references or page
712 % numbers into a reference range. You can change this behaviour by
713 % supplying one of the following package options:
714 % \begin{description}
715 % \item[\option{sort}] Sort lists of cross-references, but don't compress
716 % consecutive references.
717 % \item[\option{compress}] Compress sequences of consecutive references
718 % into a reference range, but don't sort the list of cross-references.
719 % \item[\option{nosort}] Neither sort lists of cross-references,
720 % \emph{nor} compress consecutive references.
721 % \item[\option{sort\&compress}] Sort lists of cross-references, and
722 % compress sequences of consecutive references into a reference
723 % range (this is the default).
724 % \end{description}
725 %
726 % Occasionally, you may want to prevent a particular sequence of
727 % consecutive cross-references from being compressed to a reference
728 % range, without disabling this feature globally. To achieve this, you
729 % can separate the cross-references in the list by one or more empty
730 % references, at the point at which you want to prevent compression. For
731 % example,
732 % \begin{quote}
733 % |\cref{eq1,eq2,eq3,,eq4}|
734 % \end{quote}
735 % will be typeset as
736 % \begin{quote}
737 % eqs.~(1) to~(3) and (4)
738 % \end{quote}
739 % or
740 % \begin{quote}
741 % |\cref{eq1,eq2,,eq3,eq4,eq5,,eq6,eq7,eq8}|
742 % \end{quote}
743 % will be typeset as
744 % \begin{quote}
745 % eqs.~(1), (2), (3) to~(5) and (6) to~(8)
746 % \end{quote}
747 % You can safely put an empty reference between cross-references that
748 % would never be compressed anyway; it will simply be ignored.
749 %
750 % If lists of cross-references are also being sorted (the default), it
751 % can be a little confusing to work out where the empty reference should
752 % go in order to prevent compression of a particular consecutive
753 % sequence. It's best to think of the empty reference as being
754 % ``attached'' to the cross-reference preceding it. When the list is
755 % sorted, the empty reference will still appear after the same preceding
756 % reference, and will prevent it being compressed with any subsequent
757 % consecutive cross-references. In other words, an empty reference
758 % ensures that the preceding reference will appear explicitly in the
759 % final, typeset cross-reference:
760 % \begin{quote}
761 % |\cref{eq3,,eq2,eq1,eq6,eq4,eq5}|
762 % \end{quote}
763 % will be typeset as
764 % \begin{quote}
765 % eqs.~(1) to~(3) and (4) to~(6)
766 % \end{quote}
767 %
768 %
769 %
770 % \section{Overriding the Cross-Reference Type}
771 % \label{sec:label_type}
772 % \DescribeMacro\label
773 % A label's ``type'' is usually determined by the name of the counter it
774 % refers to, or in the case of \package{ntheorem} and \package{amsthm}
775 % theorem-like environments by the environment name. However, sometimes
776 % it is useful to override the type. \package{Cleveref} provides two
777 % different mechanisms for accomplishing this.
778 %
779 % You can alias a counter to a different cross-reference type using the
780 % |\crefalias| command:
781 % \begin{quote}
782 % |\crefalias|\marg{counter}\marg{type}
783 % \end{quote}
784 % \meta{counter} will then use the cross-reference formatting of
785 % \meta{type}. This can be useful if you want multiple counters to use
786 % the same cross-reference format.
787 %
788 % Occasionally, you may want to override the cross-reference type for one
789 % particular label, one-off. You can do this by supplying the desired
790 % type as an optional argument to the |\label| command:
791 % \begin{quote}
792 % |\label|\oarg{type}\marg{label}
793 % \end{quote}
794 %
795 % One circumstance in which is useful is when you want to define a
796 % special cross-reference format for certain labels of a given type. By
797 % supplying a type that doesn't already exist as the optional argument to
798 % |\label|, you can then define the cross-reference format for that new
799 % type in whatever way you like, without affecting other cross-references
800 % of the same type. For example, if a particular equation contains
801 % multiple expressions and you want it to always be referred to in the
802 % plural, you could use:
803 % \begin{quote}
804 % |\crefname{pluralequation}{eqs.}{eqs.}|\\
805 % \dots\\
806 % |\label[pluralequation]{eq1}|
807 % \end{quote}
808 % You can of course reuse this format for other plural equations, too.
809 %
810 % If you need to do this frequently, it can become tedious specifying the
811 % label explicitly each time. An alternative is to use the
812 % \package{aliascnt} package. This lets you define one counter to be an
813 % alias for another, so that effectively the same counter has two names.
814 % Since \package{cleveref} determines the label type from the counter
815 % name, the two counter aliases can have different cross-reference
816 % formats whilst really being the same counter. You have to somehow
817 % arrange for the correct counter alias to be used depending on which
818 % cross-reference format you want (probably by defining two variants of
819 % the environment in question). But the effort involved might be worth
820 % the convenience of not having to remember to pass an explicit optional
821 % argument to a large number of labels.
822 %
823 % You can use this trick to get different cross-reference formats for
824 % different theorem-like environments,\footnote{This trick seems to
825 % belong to \LaTeX{} mythology, and certainly isn't my own idea! But I
826 % haven't been able to definitively track down who originally came up
827 % with it.} \emph{without} using the \package{amsthm} or
828 % \package{ntheorem} package (although using one of those packages is a
829 % better solution if available). For example,
830 % \begin{quote}
831 % |\usepackage{aliascnt}|\\
832 % |\usepackage{cleveref}|\\
833 % |\newaliascnt{lemma}{theorem}|\\
834 % |\newtheorem{lemma}[lemma]{Lemma}|\\
835 % |\aliascntresetthe{lemma}|\\
836 % |\crefname{lemma}{lemma}{lemmas}|
837 % \end{quote}
838 % Note that \package{aliascnt} must be loaded before \package{cleveref},
839 % and any \cmd{\newaliascnt} commands \emph{must} come \emph{after}
840 % \package{cleveref} has been loaded.
841 %
842 %
843 %
844 % \section{Options that Modify the Cross-Reference Format}
845 %
846 % \subsection{Capitalising All Cross-Reference Names}
847 % \label{sec:capitalise}
848 % \DescribeMacro{capitalise}
849 % Many authors prefer to always capitalise cross-reference names,
850 % regardless of where they appear in the sentence, writing Theorem~1 and
851 % Equation~3 (as opposed to theorem~1 and equation~3). If you count
852 % yourself among this group, you can pass the \option{capitalise} option
853 % to the \package{cleveref} package (\option{capitalize} also works).
854 %
855 % All the default cross-reference formats will then have the first letter
856 % capitalised, as will the automatically generated |\cref| variants (see
857 % \cref{sec:individual_customisation,sec:low-level_customisation}).
858 % (However, if you explicitly define a |\cref| variant to \emph{not} be
859 % capitalised, \package{cleveref} will still honour your definition. In
860 % other words, you're responsible for defining the capitalisation
861 % correctly in your own format definitions.)
862 %
863 % You should \emph{still} use the |\Cref| variants at the beginning of
864 % sentences, for one thing, because abbreviations should not be used at
865 % the beginning of a sentence,\footnote{At least in English; I'm not sure
866 % about other languages.} and for another, in case you later change your
867 % mind and remove the \option{capitalise} option.
868 %
869 %
870 % \subsection{Including Names in Hyperlink Targets}
871 % \label{sec:nameinlink}
872 % \DescribeMacro{nameinlink}
873 % When using the \package{hyperref} package, \package{cleveref}
874 % automatically makes all cross-references into hyperlinks to the
875 % corresponding reference. By default, only the label itself forms part
876 % of the hyperlink target (i.e.\ the text you can click on to navigate to
877 % the cross-reference). The cross-reference name is not part of the
878 % hyperlink. By contrast, \package{hyperref}'s |\autoref| command
879 % \emph{does} includes the name as part of the hyperlink. If you prefer
880 % to include the names in the hyperlinks when using \package{cleveref},
881 % you can pass the \option{nameinlink} option to the \package{cleveref}
882 % package. (For even more control over the placement of the hyperlink
883 % target, use the commands for customising the cross-reference format.
884 % See \cref{sec:customising}.)
885 %
886 % However, use of this option is discouraged on stylistic grounds.
887 % Firstly, when producing PDF output \package{hyperref} by default
888 % surrounds hyperlinks with red boxes, which looks particularly ugly when
889 % the entire cross-reference name is surrounded by a red box (though this
890 % unfortunate default can be changed using \package{hyperref} package
891 % options; see the \package{hyperref} documentation for details).
892 % Secondly, and more significantly, when using multi-references only the
893 % first reference in a group can include the cross-reference name as part
894 % of its hyperlink target, for obvious reasons. The hyperlink targets for
895 % the other references in the group will necessarily be just the labels.
896 % This makes for somewhat non-uniform typesetting of hyperlinks, with the
897 % first cross-reference in a multi-reference having a much larger
898 % hyperlink target than the others.
899 %
900 %
901 % \subsection{Abbreviations in Cross-Reference Names}
902 % \label{sec:noabbrev}
903 % \DescribeMacro{noabbrev}
904 % The default cross-reference names for some languages use common
905 % abbreviations for some of the names (e.g.\ in the default English
906 % format, |\cref{eq1}| will be typeset as |eq.~(1)|). Some authors may
907 % prefer to always use the full name, rather than an abbreviation
908 % (|equation~(1)| instead of |eq.~(1)|). To disable all use of
909 % abbreviations in the default cross-reference names, pass the
910 % \option{noabbrev} option to the \package{cleveref} package.
911 %
912 % Note that the default names \emph{never} use abbreviations for the
913 % start-of-sentence variants (|\Cref| etc.)
914 % This is because in good written English (and likely other languages
915 % too), abbreviations should never be used at the beginning of a
916 % sentence. Many of \TeX{}'s default settings (e.g.\ page margins) are
917 % specifically chosen to encourage good typesetting style.
918 % \package{Cleveref} tried to follow the same philosophy. If despite this
919 % you insist on using abbreviations at the start of sentences, you will
920 % need to customise the start-of-sentence formats yourself.
921 %
922 %
923 %
924 %
925 % \section{Customising the Cross-Reference Formats}
926 % \label{sec:customising}
927 % The \package{cleveref} package allows you to take full control of the
928 % typesetting of cross-references, by allowing the formatting to be
929 % customised. Defaults appropriate for English documents are provided for
930 % the standard label types,\footnote{For any pedantic classics scholars
931 % out there: ``lemmas'' is recognised as a valid plural form of ``lemma''
932 % in all current versions of the Oxford English Dictionary. ``Lemmata''
933 % was last heard in a mathematical debate that took place in a pub just
934 % around the corner from Hadrian's wall\dots a few years before the
935 % Romans pulled out of Britain. \package{Cleveref} might have ``clever''
936 % in its name, but even that doesn't make it pretentious enough to use
937 % ``lemmata'' for the plural of ``lemma''.} and support for a number of
938 % languages is provided via package options (see
939 % \cref{sec:language_babel}). But if you don't like the defaults, or are
940 % writing in a language that is not supported yet,\footnote{Any
941 % contributions of translations for missing languages are very welcome!
942 % See \cref{sec:new-features} for information on how to contribute
943 % translations.} or you need to refer to something for which no default
944 % format is defined, then you can take charge and define your own
945 % formats.
946 %
947 % If \package{cleveref} encounters a cross-reference to a type it does
948 % not know, it will produce a ``reference type undefined'' warning, and
949 % typeset the cross-reference as
950 % \begin{quote}
951 % {\bf ??}~|\ref|\marg{label}
952 % \end{quote}
953 % i.e.\ the label counter preceded by a double question mark. The error
954 % message indicates the name of the unknown cross-reference type, which
955 % you will then probably want to define. (References to undefined labels
956 % still produce a ``reference undefined'' warning and appear as a double
957 % question mark, as usual.)
958 %
959 % The cross-reference formats are usually constructed out of components:
960 % the cross-reference name (different for each type of cross-reference),
961 % the format for the label itself, and the conjunctions used in reference
962 % ranges and lists of multiple cross-references. There are two levels of
963 % customisation: you can either customise the components, or you can take
964 % full control and override the component-derived format entirely.
965 %
966 % \package{Cleveref} treats page references, as produced e.g.\ by
967 % |\cpageref|, as cross-references with the type ``page''. Therefore, all
968 % of the mechanisms for customising cross-references apply equally well
969 % to page references, simply by using ``page'' as the cross-reference
970 % type.
971 %
972 %
973 % \subsection{Customising the Cross-Reference Components}
974 % \label{sec:component_customisation}
975 %
976 % \subsubsection{Global Customisation}
977 % \label{sec:global_customisation}
978 % The global customisation commands affect all cross-reference formats,
979 % unless they are overridden by lower-level customisation commands.
980 %
981 % \DescribeMacro\crefdefaultlabelformat
982 % The format for the label counter itself can be customised globally
983 % using
984 % \begin{quote}
985 % |\crefdefaultlabelformat|\marg{format}
986 % \end{quote}
987 % The \meta{format} argument can be any valid \LaTeX{} code, though you
988 % will need to |\protect| fragile commands. It can (and almost certainly
989 % should!) contain three arguments, |#1|, |#2| and |#3|. The first
990 % argument is the formatted version of the label counter (e.g.\
991 % |\thesection|). The other two are used to mark the beginning and end
992 % of the part of the cross-reference that should form the hyperlink when
993 % the \package{hyperref} package is used (see
994 % \cref{sec:other_packages}). For example, if you wanted to surround all
995 % labels with square brackets, without the square brackets themselves
996 % being part of the hyperlink, you would need:
997 % \begin{quote}
998 % |\crefdefaultlabelformat{[#2#1#3]}|
999 % \end{quote}
1000 % The hyperlink arguments |#2| and |#3| \emph{must} appear in that
1001 % order. (Leaving them out completely will not cause an error, but in
1002 % that case no hyperlink will be created when \package{hyperref} is
1003 % used, and there are better ways to achieve this. See
1004 % \cref{sec:typesetting,sec:other_packages}.)
1005 %
1006 % Note that the default format for equation cross-references already
1007 % overrides |\crefdefaultlabelformat| in order to surround the label with
1008 % parentheses, so the redefining |\crefdefaultlabelformat| will have no
1009 % effect on equations. The label format for equations must be customised
1010 % separately if you want to change it (see
1011 % \cref{sec:individual_customisation}).
1012 %
1013 % \DescribeMacro\crefrangeconjunction
1014 % The conjunction used in a reference range can be customised by
1015 % defining |\crefrangeconjunction|:
1016 % \begin{quote}
1017 % |\newcommand{\crefrangeconjunction}|\marg{conjunction}
1018 % \end{quote}
1019 % It does not have to be an actual conjunction in the linguistic sense,
1020 % e.g.\ it is perfectly reasonable to define it to be an endash
1021 % ``|--|''. |\crefrangeconjunction| is used directly between the start
1022 % and end references in a reference range, without any additional space
1023 % surrounding it, e.g.\ |\crefrange{thm1}{thm2}| is typeset as
1024 % \begin{quote}
1025 % |theorems~\ref{thm1}\crefrangeconjunction\ref{thm2}|
1026 % \end{quote}
1027 % so you may or may not want to include surrounding space, depending on
1028 % the formatting you desire. For example,
1029 % \begin{quote}
1030 % |\newcommand{\crefrangeconjunction}{ and~}|
1031 % \end{quote}
1032 % does require surrounding space, whereas
1033 % \begin{quote}
1034 % |\newcommand{\crefrangeconjunction}{--}|
1035 % \end{quote}
1036 % does not.
1037 %
1038 % \DescribeMacro\crefrangepreconjunction
1039 % \DescribeMacro\crefrangepostconjunction
1040 % There are two other ``conjunction'' commands available for customizing
1041 % the formatting for reference ranges. These are
1042 % |\crefrangepreconjunction| and |\crefrangepostconjunction|, which
1043 % insert text before the first label defining the range, and after the
1044 % second label, respectively. For example, when these commands are
1045 % defined, |\crefrange{thm1}{thm2}| is typeset as
1046 % \begin{quote}
1047 % |theorems~\crefrangepreconjunction\ref{thm1}|\\
1048 % | |\ding{229} |\crefrangeconjunction\ref{thm2}\crefrangepostconjunction|
1049 % \end{quote}
1050 % These commands are not used in the default English format definitions,
1051 % but they are needed in some languages to correctly express a range. For
1052 % example, the Italian format defines |\crefrangepreconjunction| to be
1053 % ``da'', so that |\crefrange{thm1}{thm2}| produces
1054 % \begin{quote}
1055 % |teorema da~\ref{thm1} a~\ref{thm2}|
1056 % \end{quote}
1057 %
1058 % \DescribeMacro\crefpairconjunction
1059 % \DescribeMacro\crefmiddleconjunction
1060 % \DescribeMacro\creflastconjunction
1061 % The conjunctions used in lists of multiple cross-references can be
1062 % customised by defining the commands |\crefpairconjunction|,
1063 % |\crefmiddleconjunction| and |\creflastconjunction|:
1064 % \begin{quote}
1065 % |\newcommand{\crefpairconjunction}|\marg{conjunction}\\
1066 % |\newcommand{\crefmiddleconjunction}|\marg{conjunction}\\
1067 % |\newcommand{\creflastconjunction}|\marg{conjunction}
1068 % \end{quote}
1069 % |\crefpairconjunction| is used when there are only two cross-references
1070 % in the list, |\creflastconjunction| is used between the penultimate and
1071 % final cross-reference in a list of more than two, and
1072 % |\crefmiddleconjunction| is used between all the others. Again, they do
1073 % not have to be conjunctions in the linguistic sense, and the same
1074 % considerations about surrounding space apply as in the case of
1075 % |\crefrangeconjunction|. For example, the default definition of
1076 % |\crefmiddleconjunction| is:
1077 % \begin{quote}
1078 % |\newcommand{\crefmiddleconjunction}{, }|
1079 % \end{quote}
1080 %
1081 % \DescribeMacro\crefpairgroupconjunction
1082 % \DescribeMacro\crefmiddlegroupconjunction
1083 % \DescribeMacro\creflastgroupconjunction
1084 % By default, the conjunctions used to separate sub-lists of different
1085 % cross-reference types in a multi-reference are identical to those used
1086 % to separate cross-references of the same type.\footnote{More
1087 % accurately, if you redefine $\backslash$crefpairconjunction etc.\ in
1088 % your preamble, $\backslash$crefpairgroupconjunction etc.\ are
1089 % automatically redefined so that they match. (In some languages, the
1090 % default definition of $\backslash$creflastgroupconjunction has an
1091 % additional comma lacking in $\backslash$creflastconjunction.)} You
1092 % can override this by defining the conjunction commands
1093 % |\crefpairgroupconjunction|, |\crefmiddlegroupconjunction| and
1094 % |\creflastgroupconjunction|.
1095 %
1096 % For example,
1097 % \begin{quote}
1098 % |\cref{eq1,eq2,eq3,thm1,thm2,fig1,thm3}|
1099 % \end{quote}
1100 % is typeset as
1101 % \begin{quote}
1102 % eqs.~(1)|\crefrangeconjunction|(3)|\crefmiddlegroupconjunction|%\\
1103 % theorems~1|\crefpairconjunction|2|\crefmiddlegroupconjunction|%\\
1104 % fig.~1|\creflastgroupconjunction{}|theorem~3
1105 % \end{quote}
1106 %
1107 %
1108 % \subsubsection{Customising Individual Cross-Reference Types}
1109 % \label{sec:individual_customisation}
1110 % \DescribeMacro\crefname
1111 % \DescribeMacro\Crefname
1112 % The cross-reference name for a given cross-reference type is customised
1113 % using the |\crefname| and |\Crefname| commands:
1114 % \begin{quote}
1115 % |\crefname|\marg{type}\marg{singular}\marg{plural}\\
1116 % |\Crefname|\marg{type}\marg{singular}\marg{plural}
1117 % \end{quote}
1118 % used by the |\cref| and |\Cref| commands, respectively. You must supply
1119 % both \meta{singular} and \meta{plural} forms of the name. If the
1120 % corresponding |\Crefname| is undefined when |\crefname| is called, it
1121 % will automatically define |\Crefname| to be a capitalised version of
1122 % |\crefname|, using |\MakeUppercase|. Conversely, if the corresponding
1123 % |\crefname| is undefined when |\Crefname| is called, it will
1124 % automatically define |\crefname| to be a lower-case version of
1125 % |\Crefname|, using |\MakeLowercase|. Obviously, this will only work
1126 % properly if the names begin with a letter. If the first letter is a
1127 % special character construct, such as an accented character, you will
1128 % need to surround it by braces. If the first thing in the name is
1129 % \emph{not} a letter at all (e.g.\ if it is a \LaTeX{} command), you
1130 % \emph{must} define both capitalisation variants explicitly. Otherwise
1131 % you will get strange and fatal errors when processing the document.
1132 %
1133 % The cross-reference \meta{type} is usually the name of the counter for
1134 % the environment (equation, chapter, section, etc.). The exceptions are
1135 % appendices, labels whose type has been overridden explicitly by
1136 % supplying an optional argument (see \cref{sec:label_type}), and
1137 % theorem-like environments when the \package{ntheorem} of
1138 % \package{amsthm} packages are loaded, for which \meta{type} should
1139 % instead be the environment name (lemma, corollary, definition, etc.)
1140 % even when different environments are part of the same numbering
1141 % sequence. (\package{ntheorem} and \package{amsthm} provide extra
1142 % information about the environment when different theorem-like
1143 % environments share a common counter, which \package{cleveref} makes use
1144 % of to distinguish between them automatically.) In the case of
1145 % appendices, the \meta{type} is ``appendix'' for the top-level
1146 % sectioning command (|\chapter| or |\section|, depending on the document
1147 % class), ``subappendix'' for the sectioning command one level below
1148 % (|\section| or |\subsection|), ``subsubappendix'' for the next level of
1149 % sectioning command, etc.
1150 %
1151 % For convenience, if they have not been otherwise customised by the end
1152 % of the preamble, the cross-reference name (and label format) for
1153 % |subsection| is by default inherited from that of |section|, and that
1154 % of |subsubsection| is inherited from |subsection| (which might itself
1155 % have been inherited from |section|). Similarly for |subappendix|,
1156 % |subsubappendix| and |subsubsubappendix|. The |enumii|, |enumiii|,
1157 % |enumiv| and |enumv| formats each inherit from the preceding one, with
1158 % |enumii| inheriting from |enumi|. Finally, |subfigure|, |subtable| and
1159 % |subequation| inherit from |figure|, |table| and |equation|,
1160 % respectively.
1161 %
1162 % If some of the format components for one of these reference types have
1163 % been customised using high-level customisation commands, any remaining
1164 % components are inherited from the parent type, and the
1165 % cross-reference formats are then defined in terms of those components.
1166 % (In this case, if the format for the parent type has been customised
1167 % using low-level commands, this low-level customisation will \emph{not}
1168 % be inherited.) If \emph{none} of the format components have been
1169 % customised, the whole format is always inherited from the parent type.
1170 %
1171 % \DescribeMacro\creflabelformat
1172 % You may want the label format for a particular cross-reference type to
1173 % differ from the global format set by |\crefdefaultlabelformat| (see
1174 % \cref{sec:global_customisation}). You can do this using
1175 % \begin{quote}
1176 % |\creflabelformat|\marg{type}\marg{format}
1177 % \end{quote}
1178 % The \meta{type} argument is the cross-reference type to customise, and
1179 % the \meta{format} argument defines the label format for
1180 % cross-references of that type. As in the case of\linebreak[4]
1181 % |\crefdefaultlabelformat|, the latter should contain the three
1182 % arguments |#1|, |#2| and |#3|, the first being the formatted version of
1183 % the label counter, the others determining the beginning and end of the
1184 % portion that becomes a hyperlink when the \package{hyperref} package
1185 % is loaded (see \cref{sec:other_packages}). |#2| and |#3| \emph{must}
1186 % appear in that order.
1187 %
1188 % \DescribeMacro\crefrangelabelformat
1189 % Normally, the start and end references in a reference range are
1190 % typeset using the usual label format (as defined by
1191 % |\crefdefaultlabelformat| or |\creflabelformat|) separated by
1192 % |\crefrangeconjunction| (\cref{sec:global_customisation}). You can
1193 % override this for a given cross-reference type using
1194 % \begin{quote}
1195 % |\crefrangelabelformat|\marg{type}\marg{format}
1196 % \end{quote}
1197 % The \meta{format} argument should contain six arguments: |#1|, |#2|,
1198 % |#3|, |#4|, |#5|, |#6|. The first two (|#1| and |#2|) are the formatted
1199 % versions of the two label counters defining the reference range. The
1200 % next two (|#3| and |#4|) denote the beginning and end of the hyperlink
1201 % for the first reference, the final two (|#5| and |#6|) the hyperlink
1202 % for the second reference. The hyperlink arguments \emph{must} appear
1203 % in order. For example,
1204 % \begin{quote}
1205 % |\crefrangelabelformat{equation}{(#3#1#4) to~(#5#2#6)}|
1206 % \end{quote}
1207 %
1208 %
1209 % \subsubsection{Automatic \textbackslash\texttt{newtheorem} Definitions}
1210 % \DescribeMacro\newtheorem
1211 % The standard \LaTeX{} |\newtheorem| command for defining new
1212 % theorem-like environments provides enough information to deduce a
1213 % reasonable cross-reference name for the new environment. So
1214 % \package{cleveref} automatically defines an appropriate cross-reference
1215 % name for new theorem-like environments. This automatic definition is
1216 % only used if no default definition is provided by \package{cleveref}
1217 % itself, and if no |\crefname| or |\Crefname| definition is given
1218 % explicitly (see \cref{sec:individual_customisation}).
1219 %
1220 % The caveat with this automatic definition is that, although
1221 % |\newtheorem| essentially provides the singular form of the
1222 % cross-reference name, it doesn't provide the plural form. And there is
1223 % no reliable way of constructing the plural form from the
1224 % singular.\footnote{If you're a native English-speaker, you might think
1225 % that just adding an `s' would work, though a moment's thought will
1226 % provide examples of words where this will fail. If you're a non-English
1227 % speaker, it probably won't even occur to you to claim that plurals can
1228 % reliably be constructed automatically!} Therefore, if the plural form
1229 % is ever required, \package{cleveref} will produce a ``reference type
1230 % undefined'' warning, and typeset the cross-reference where the plural
1231 % form is required as:
1232 % \begin{quote}
1233 % {\bf ??}~|\ref|\marg{label} \dots
1234 % \end{quote}
1235 % In this case, you will have to provide an explicit |\crefname| or
1236 % |\Crefname| definition yourself, to define the plural form as well as
1237 % the singular form.
1238 %
1239 % Note that this has \emph{nothing whatsoever} to do with automatically
1240 % determining the type of theorem-like environment in a cross-reference!
1241 % For that, you need to load either the \package{ntheorem} or the
1242 % \package{amsthm} package. See \cref{sec:non-bugs} for more details.
1243 %
1244 %
1245 %
1246 % \subsection{Low-Level Customisation: Taking Full Control}
1247 % \label{sec:low-level_customisation}
1248 % If you need more precise control over the cross-reference format than
1249 % is possible by customising the individual components, then you can take
1250 % full control of the format for any given type, overriding the
1251 % component-derived format entirely. The formats for single
1252 % cross-references, reference ranges and multi-references are customised
1253 % separately. If you only customise some of these, the other formats will
1254 % be constructed from components, as usual.
1255 %
1256 % Note that when deciding which cross-references should be grouped
1257 % together for sorting and/or compressing, \package{cleveref} does
1258 % something slightly more complicated than simply checking whether the
1259 % reference types match. In fact, it checks whether the reference
1260 % \emph{formats} match.\footnote{To be precise, \package{cleveref} checks
1261 % whether the $\backslash$|crefformat| definitions match.} This will
1262 % always be the case for cross-references of the same type. But it could
1263 % also be the case for cross-references that have different types, if the
1264 % cross-reference formats happen to be identical.
1265 %
1266 % The reason for doing this is to allow cross-references to e.g.\
1267 % sections and subsections to be grouped together if they have identical
1268 % formats. The default formats for the sectioning commands, figures and
1269 % subfigures, tables and subtables, and enumerated lists are set up in
1270 % this way. If you change any of them using the low-level customisation
1271 % commands, but still want them to be grouped together, then you must
1272 % ensure that the formats are \emph{identical}. (It is \emph{not}
1273 % sufficient for the formats to produce identical typeset text; the
1274 % format definitions must contain identical \LaTeX{} code.)
1275 %
1276 % Note that if you use the low-level customisation commands, you might
1277 % still want to provide |\crefname| and |\Crefname| definitions too, so
1278 % that the |\namecref| commands will work (see \cref{sec:typesetting}).
1279 %
1280 %
1281 % \subsubsection{Single Cross-References}
1282 % \label{sec:ref_format}
1283 % \DescribeMacro\crefformat
1284 % \DescribeMacro\Crefformat
1285 % Cross-reference formats for \emph{single} cross-references are defined
1286 % or redefined using the |\crefformat| and |\Crefformat| commands, which
1287 % are used by the |\cref| and |\Cref| commands respectively. These take
1288 % two arguments: the cross-reference type, and the formatting code:
1289 % \begin{quote}
1290 % |\crefformat|\marg{type}\marg{format}\\
1291 % |\Crefformat|\marg{type}\marg{format}
1292 % \end{quote}
1293 % The \meta{type} is usually the name of the counter, except for labels
1294 % whose type has been overridden explicitly (see \cref{sec:label_type}),
1295 % theorem-like environments \emph{when the \package{ntheorem} or
1296 % \package{amsthm} package is loaded}, in which case it is the
1297 % environment name, and appendices. For the latter, the \meta{type} is
1298 % ``appendix'' for the top-level sectioning command (|\chapter| or
1299 % |\section|, depending on the document class), ``subappendix'' for the
1300 % sectioning command one level below (|\section| or |subsection|),
1301 % ``subsubappendix'' for the next level of sectioning command, etc.
1302 %
1303 % As in the case of the |\crefname| and |\Crefname| commands, if the
1304 % corresponding |\Crefformat| is undefined when |\crefformat| is called,
1305 % it will define the |\Crefformat| to produce a capitalised version of
1306 % |\crefformat|, using |\MakeUppercase|. Conversely, if the corresponding
1307 % |\crefformat| is undefined when |\Crefformat| is called, it will define
1308 % the |\crefformat| to produce a lower-case version of |\Crefformat|,
1309 % using |\MakeLowercase|. Obviously, this will only work properly if the
1310 % format starts with a letter, and letter constructs (such as accented
1311 % letter constructs) must be surrounded by braces (see
1312 % \cref{sec:global_customisation}).
1313 %
1314 % The \meta{format} argument can be any valid \LaTeX{} code, though you
1315 % will need to |\protect| fragile commands. It should contain three
1316 % arguments, |#1|, |#2| and |#3|. The first argument is the formatted
1317 % version of the label counter (e.g.\ |\theequation|). The other two are
1318 % used to mark the beginning and end of the part of the cross-reference
1319 % that forms the hyperlink when the \package{hyperref} package is used,
1320 % and \emph{must} appear in that order (see \cref{sec:other_packages}).
1321 %
1322 % As an example,
1323 % \begin{quote}
1324 % |\crefformat{equation}{Eq.~(#2#1#3)}|
1325 % \end{quote}
1326 % will typeset equation references as
1327 % \begin{quote}
1328 % Eq.~(\meta{counter})
1329 % \end{quote}
1330 % with the counter (excluding the parentheses) forming the hyperlink.
1331 %
1332 % Note that the hyperlink arguments are \emph{not} letters, so if |#2|
1333 % appears at the beginning of \meta{format}, \package{cleveref} will not
1334 % be able to automatically define the other capitalisation variant
1335 % automatically using |\MakeUppercase| or |\MakeLowercase|. In this case,
1336 % you will have to define both variants separately. For example, if you
1337 % wanted the ``Eq.''\ to be part of the hyperlink, you would have to
1338 % explicitly define:
1339 % \begin{quote}
1340 % |\crefformat{equation}{#2eq.~(#1)#3}|\\
1341 % |\Crefformat{equation}{#2Eq.~(#1)#3}|
1342 % \end{quote}
1343 %
1344 %
1345 % \subsubsection{Reference Ranges}
1346 % \label{sec:ref_range_format}
1347 % \DescribeMacro\crefrangeformat
1348 % \DescribeMacro\Crefrangeformat
1349 % The format for reference ranges is defined by |\crefrangeformat|
1350 % and\linebreak[4] |\Crefrangeformat|. Like |\creformat| and
1351 % |\Crefformat|, the commands take two arguments: the cross-reference
1352 % type, and the formatting code.
1353 % \begin{quote}
1354 % |\crefrangeformat|\marg{type}\marg{format}\\
1355 % |\Crefrangeformat|\marg{type}\marg{format}
1356 % \end{quote}
1357 % The same comments apply as in the case of single cross-references: the
1358 % \meta{type} is usually the name of the counter, except for appendices,
1359 % labels with explicitly overridden types, and theorem-like environments
1360 % when \package{ntheorem} or \package{amsthm} are loaded. Again, if the
1361 % other-capitalisation variant is not already defined, it will be defined
1362 % automatically.
1363 %
1364 % The \meta{format} argument can again be any valid \LaTeX{} code, with
1365 % fragile commands |\protect|ed. However, this time it should contain
1366 % \emph{six} arguments, |#1|--|#6|. The first two (|#1| and |#2|) are the
1367 % formatted versions of the label counters, the next two (|#3| and |#4|)
1368 % are used to mark the beginning and end of the hyperlink for the first
1369 % cross-reference, and the final two (|#5| and |#6|) mark the beginning
1370 % and end of the second cross-reference's hyperlink.
1371 %
1372 % As an example,
1373 % \begin{quote}
1374 % |\crefrangeformat{equation}{eqs.~(#3#1#4) to~(#5#2#6)}|
1375 % \end{quote}
1376 % would typeset equation reference ranges as
1377 % \begin{quote}
1378 % eqs.~(\meta{counter1}) to~(\meta{counter2})
1379 % \end{quote}
1380 % with the counters (excluding the parentheses) forming the hyperlinks.
1381 %
1382 %
1383 % \subsubsection{Multiple Cross-References}
1384 % \label{sec:multiple_ref_format}
1385 % \DescribeMacro\crefmultiformat
1386 % \DescribeMacro\Crefmultiformat
1387 % \DescribeMacro\crefrangemultiformat
1388 % \DescribeMacro\Crefrangemultiformat
1389 % The format for multiple cross-references is defined by
1390 % |\crefmultiformat| and\linebreak[4] |\Crefmultiformat|, and that of
1391 % reference ranges within multiple cross-references by
1392 % |\crefrangemultiformat| and |\Crefrangemultiformat|. Multi-references
1393 % also require \emph{all} the other cross-reference formats to be defined
1394 % (see \cref{sec:ref_format,sec:ref_range_format}), including the single
1395 % reference range formats, even if you never use the |\crefrange| and
1396 % |\Crefrange| commands.
1397 %
1398 % The commands all take five arguments: the cross-reference type, the
1399 % format for the first cross-reference in a list, the format for the
1400 % second cross-reference in a list of two, the format for the middle
1401 % cross-references in a list of more than two, and the format for the
1402 % last cross-reference in a list of more than two.
1403 % \begin{quote}
1404 % |\crefmultiformat|\marg{type}\marg{first}\marg{second}\marg{middle}\marg{last}\\
1405 % |\Crefmultiformat|\marg{type}\marg{first}\marg{second}\marg{middle}\marg{last}\\
1406 % |\crefrangemultiformat|\marg{type}\marg{first}\marg{second}\marg{middle}\marg{last}\\
1407 % |\Crefrangemultiformat|\marg{type}\marg{first}\marg{second}\marg{middle}\marg{last}
1408 % \end{quote}
1409 %
1410 % The \meta{type} is, as ever, the counter name (except for appendices,
1411 % explicitly overridden label types, and theorem-like environments when
1412 % the \package{ntheorem} or \package{amsthm} packages are loaded). The
1413 % same considerations apply to the formatting arguments \meta{first},
1414 % \meta{second}, \meta{middle} and \meta{last} as for the \meta{format}
1415 % argument of |\crefformat| or |\crefrangeformat|, including the meaning
1416 % of the arguments that should appear in the formatting code (|#1|, |#2|
1417 % and |#3| for |\crefmultiformat| and |\Crefmultiformat|, |#1|--|#6| for
1418 % |\crefrangemultiformat| and |\Crefrangemultiformat|). However, when the
1419 % corresponding other-capitalisation variant is automatically defined,
1420 % only the first letter of the \meta{first} argument is upper- or
1421 % lower-cased; the other arguments are defined to be identical for both
1422 % variants.
1423 %
1424 % Be careful to get the spaces at the beginning and end of the formatting
1425 % code correct: the \meta{first} and \meta{second}, or \meta{first},
1426 % \meta{middle} and \meta{last}, \LaTeX{} code snippets are typeset one
1427 % after another in a multi-reference, with no space separating them. You
1428 % may or may not want spaces at the beginning or end of the formatting
1429 % code, depending on the formatting you desire. For example, in the
1430 % default equation format:
1431 % \begin{quote}
1432 % |\crefmultiformat{equation}{eqs.~(#2#1#3)}%|\\
1433 % | { and~(#2#1#3)}{, (#2#1#3)}{ and~(#2#1#3)}|
1434 % \end{quote}
1435 % the \meta{middle} argument should \emph{not} have a space at the
1436 % beginning, whereas the \meta{second} and \meta{last} arguments
1437 % \emph{should} have a space.
1438 %
1439 %
1440 % \subsubsection{Label Cross-References}
1441 % If you define the format for a particular cross-reference type using
1442 % the low-level customisation commands, and still want to use the
1443 % |\labelcref| command to produce just the label part of the
1444 % cross-reference, then you must also define the appropriate |\labelcref|
1445 % formats for that type. This is done using the |\labelcrefformat|,
1446 % |\labelcrefrangeformat|, |\labelcrefmultiformat| and
1447 % |\labelcrefrangemultiformat| commands. Their syntax is identical to
1448 % that of the corresponding |\crefformat|, |\crefrangmeformat|,
1449 % |\crefmultiformat| or |\crefrangemultiformat| command. Typically, the
1450 % |\labelcref| formats should be defined identically to the standard
1451 % |\cref| formats, except for the \meta{first} part, which should leave
1452 % off the cross-reference name. This is not enforced, however.
1453 %
1454 %
1455 %
1456 % \section{Advanced Cross-Reference Formating}
1457 % When you define a custom cross-reference format using
1458 % |\creflabelformat|, |\creformat| et al.\ (see \cref{sec:customising}),
1459 % you're not merely defining a pattern with placeholders to be filled in.
1460 % You're really defining the body of a LaTeX macro, with the formatted
1461 % labels as arguments. This is a very powerful tool. It means that the
1462 % only limit on how you can process the labels is your ability to code it
1463 % in \TeX{}.\footnote{Since \TeX{} is Turing-complete, that means you
1464 % can do anything you like short of solving the Halting Problem.} Which
1465 % potentially allows for very sophisticated cross-reference formatting.
1466 %
1467 % One example of this is removing common prefixes from reference ranges.
1468 % E.g.\ if you're numbering equations within sections, and |eq1|, |eq2|
1469 % and |eq3| are all in the section 1.2, then you might want to typeset
1470 % |\cref{eq1,eq2,eq3}| as ``eqs.~(1.2.1--3)'' instead of ``eqs.~(1.2.1)
1471 % to~(1.2.3)''. Similarly, if |eq1a|, |eq1b| and |eq1c| are
1472 % \package{amsmath} subequations, you might want to typeset
1473 % |\cref{eq1a,eq1b,eq1c}| as ``eqs.~(1a--c)'' instead of ``eqs.~(1a)
1474 % to~(1c)''.
1475 %
1476 % \package{Cleveref} provides a useful utility macro for this:
1477 % |\crefstripprefix|, which takes two strings as arguments, and returns
1478 % the second one with any common prefix stripped off. (However, the very
1479 % last run of digits or letters in the string is retained in its
1480 % entirety, even if it has a part in common.) With the help of this
1481 % macro, you can produce the desired reference-range formatting with:
1482 % \begin{quote}
1483 % |\crefrangelabelformat{equation}%|\\
1484 % | {(#3#1#4--#5\crefstripprefix{#1}{#2}#6)}|\\
1485 % |\crefrangelabelformat{subequation}%|\\
1486 % | {(#3#1#4--#5\crefstripprefix{#1}{#2}#6)}|
1487 % \end{quote}
1488 %
1489 % Similarly, stripping prefixes from multi-references so that e.g.\linebreak
1490 % |\cref{fig1a,fig1b,fig1d}| is typeset as ``figs.~1a, b and d'' instead
1491 % of ``figs.~1a, 1b and 1d'' can be achieved by passing the prefix from
1492 % the first component to the others in an auxiliary macro (called
1493 % |\crefstripprefixinfo| here):
1494 % \begin{quote}
1495 % |\crefmultiformat{figure}%|\\
1496 % | {\edef\crefstripprefixinfo{#1}figs.~#2#1#3}%|\\
1497 % | { and~#2\crefstripprefix{\crefstripprefixinfo}{#1}#3}%|\\
1498 % | {, #2\crefstripprefix{\crefstripprefixinfo}{#1}#3}%|\\
1499 % | {, and~#2\crefstripprefix{\crefstripprefixinfo}{#1}#3}|
1500 % \end{quote}
1501 %
1502 %
1503 % \section{Language, \package{babel} and \package{polyglossia}
1504 % support}
1505 % \label{sec:language_babel}
1506 % \package{Cleveref} supports different languages via package options, in
1507 % the usual way, though not all languages are supported
1508 % yet.\footnote{Contributions of translations for missing languages are
1509 % very welcome! See \cref{sec:new-features} for information on how to
1510 % contribute translations.} Basic \package{cleveref} language support
1511 % will work even if \package{babel} or \package{polyglossia} are not
1512 % loaded. The only exception currently is Catalan (which requires the
1513 % |\lgem| command provided by these packages).
1514 %
1515 % The \package{babel} package is fully supported if it is loaded,
1516 % allowing you to change the language used in cross-references using the
1517 % \package{babel} language switching commands, such as |\selectlanguage|
1518 % and |\foreignlanguage|. Similar support is provided for the
1519 % \package{polyglossia} babel replacement package.
1520 %
1521 % Note that when using \package{babel}, you still need to tell
1522 % \package{cleveref} which language it should use for the default
1523 % cross-reference formats. It is \emph{not} sufficient to pass the
1524 % language option to \package{babel} alone. You \emph{must} also
1525 % \emph{either} pass the language options to \package{cleveref} package
1526 % directly when loading it:
1527 % \begin{quote}
1528 % |\usepackage|\oarg{language}|{cleveref}|
1529 % \end{quote}
1530 % \emph{or} (better) specify the desired language globally as a document class
1531 % option:
1532 % \begin{quote}
1533 % |\documentclass|\oarg{language}\marg{class}\\
1534 % |\usepackage{babel}|\\
1535 % |\usepackage{cleveref}|\\
1536 % \end{quote}
1537 % The latter method is strongly recommended. \LaTeX{} automatically
1538 % passes document class options to \emph{every} loaded package. So
1539 % specifying the language as a global option causes the appropriate
1540 % language support to be enabled automatically in every package that
1541 % supports it.
1542 %
1543 % When writing multi-language documents, you may need to specify multiple
1544 % language options in order to load \package{babel} support for all of
1545 % them. In this case, \package{babel} sets the initial document language
1546 % to the \emph{last} language option. (See the \package{babel}
1547 % documentation for more details.) \package{Cleveref} does the same: the
1548 % last language in the option list determines the language for the
1549 % initial cross-reference format definitions; additional language options
1550 % load \package{cleveref} support for switching between those languages.
1551 %
1552 % \package{Polyglossia} uses a different mechanism for selecting and
1553 % loading languages, and ignores package language options entirely. The
1554 % default language must be set using \cmd{\setdefaultlanguage}, and
1555 % additional languages are loaded using \cmd{\setotherlanguage}.
1556 % \package{Cleveref} recognises these commands, so you should \emph{not}
1557 % pass language options to \package{cleveref} when using
1558 % \package{polyglossia}. (Passing language options to \package{cleveref},
1559 % either as package options or global options, will override the default
1560 % language set by \package{polyglossia}'s \cmd{\setdefaultlanguage}.)
1561 % Note that the |\setdefaultlanguage| option \emph{must} come before
1562 % \package{cleveref} is loaded, so that \package{cleveref} knows what
1563 % default language you want. (If you don't do this, \package{cleveref}
1564 % will generate a warning message in the log.)
1565 %
1566 % The \package{babel} and \package{polyglossia} support works by
1567 % redefining the cross-reference names and conjunctions for the default
1568 % cross-reference types. Any customisations you make to the default
1569 % cross-reference names and conjunctions \emph{in the preamble} apply to
1570 % the main language (i.e.\ the last language listed in the options). A
1571 % |\selectlanguage| \package{babel} command (or similar) in the document
1572 % body will override these customisations, replacing them with the
1573 % defaults for the newly selected language. If you later use
1574 % |\selectlanguage| to switch back to the main language, any
1575 % customisations from the preamble will be restored. If you want to
1576 % customise cross-reference names or conjunctions for any language other
1577 % than the main one, you either have to explicitly redefine them after
1578 % every language switching command, or hook the redefinitions into
1579 % \package{babel} or \package{polyglossia}'s language switching
1580 % mechanism. (See section ``Language and \package{babel} Support'' in the
1581 % full implementation documentation, and the \package{babel} or
1582 % \package{polyglossia} package documentation.)
1583 %
1584 % If you have defined formats for new cross-reference types for which no
1585 % defaults are provided, then you're on your own. \package{Cleveref} will
1586 % not know how to redefine them for other languages, and again you will
1587 % have to take care of it yourself, either by explicitly redefining them
1588 % in your document after each language switch, or by hooking the
1589 % redefinitions into \package{babel} or \package{polyglossia}'s language
1590 % switching mechanisms.
1591 %
1592 % On the other hand, since the language switching commands only modify
1593 % the cross-reference components, if you use the low-level customisation
1594 % commands to take full control of the format for a particular
1595 % cross-reference type, then (unless you're careful) you take it out of
1596 % the control of \package{babel} or \package{polyglossia} entirely. If
1597 % you want to use the low-level customisation commands, but \emph{do}
1598 % still want the language switching commands to work, then you have to
1599 % use the component macros in your customised formats. The
1600 % cross-reference names are stored in macros called
1601 % |\cref@|\meta{type}|@name|, |\Cref@|\meta{type}|@name|,
1602 % |\cref@|\meta{type}|@name@plural|, and
1603 % |\Cref@|\meta{type}|@name@plural|. (Note that since these
1604 % macro names contain the ``@'' character, you must use |\makeatletter|
1605 % and |\makeatother| to access them.)
1606 %
1607 % For example, if you wanted to redefine the equation format so that the
1608 % cross-reference name (``equation'') was also part of the
1609 % hyperlink,\footnote{This is merely as an example. Including names in
1610 % hyperlinks is more easily accomplished by setting the
1611 % \option{nameinlink} package option.} but you still want to be able to
1612 % switch language using \package{babel} or \package{polyglossia}, you
1613 % would need something like:
1614 % \begin{quote}
1615 % |\makeatletter|\\
1616 % |\crefformat{equation}{#2\cref@equation@name~(#1)#3}|\\
1617 % \dots\\
1618 % |\makeatother|
1619 % \end{quote}
1620 % and similarly for |\crefrangeformat|, |\crefmultiformat|,
1621 % |\Crefformat|, etc.
1622 %
1623 % Note that if you define an empty cross-reference name for some type
1624 % using an empty |\crefname|, e.g.\ for equations
1625 % \begin{quote}
1626 % |\crefname{equation}{}{}|
1627 % \end{quote}
1628 % then the empty cross-reference name will be retained when switching
1629 % languages. This is probably what you want anyway.
1630 %
1631 %
1632 %
1633 % \section{The \file{cleveref.cfg} File}
1634 % If \package{cleveref} finds a \file{cleveref.cfg} file somewhere in the
1635 % \LaTeX{} search path, it automatically loads any definitions found in
1636 % that file. (For details of which directories \LaTeX{} searches, consult
1637 % the documentation for your site's \TeX{} installation.) The main use of
1638 % \file{cleveref.cfg} is to store any cross-reference format
1639 % customisations that you want to use in every document you write, so
1640 % that you don't have to include them explicitly in every document's
1641 % preamble.
1642 %
1643 %
1644 %
1645 % \section{Poor Man's \package{cleveref}}
1646 % Sometimes you may need to send your \LaTeX{} source to someone who
1647 % can't or won't install the \package{cleveref} package themselves. For
1648 % example, many academic journals accept papers in \LaTeX{} format, but
1649 % only support a small subset of the packages available on CTAN. The
1650 % \option{poorman} option was designed specifically to help in this
1651 % situation.
1652 %
1653 % When the \option{poorman} option is supplied, your document will be
1654 % processed as normal. But in addition, a |sed| script will automatically
1655 % be written, containing rules for replacing all the \package{cleveref}
1656 % commands with the \LaTeX{} code that they would produce, and using the
1657 % standard |\ref| command to produce the cross-references themselves.
1658 % I.e.\ the script rewrites your document as you would have done if you
1659 % had had to do it manually!
1660 %
1661 % The advantage, of course, is that you \emph{don't} have to do it
1662 % manually. Instead, you can use all the features of \package{cleveref},
1663 % and once you've created a version of your document that you want to
1664 % send elsewhere, you can process it through the |sed| script to
1665 % completely remove the \package{cleveref} dependency. The recipient
1666 % won't even realise you used \package{cleveref}!
1667 %
1668 % The |sed| script is written to the same directory as the (main)
1669 % \LaTeX{} source file, and given the same name as that source file but
1670 % with the extension \file{.sed}. To process your document through the
1671 % script, all you need to do is run the following from your shell:
1672 % \begin{quote}
1673 % sed -f \meta{name}\file{.sed} \
1674 % \meta{name}\file{.tex} \textgreater \meta{newname}\file{.tex}
1675 % \end{quote}
1676 % where \meta{name} is the name of the file containing your \LaTeX{}
1677 % source file minus the \file{.tex} extension, and \meta{newname} is
1678 % whatever you want to call the new version. \emph{Do not} make
1679 % \meta{newname} the same as \meta{name}: it won't work. (It's in any
1680 % case wise to keep the original \LaTeX{} source file containing the
1681 % \package{cleveref} commands, in case you need to produce an updated
1682 % version of your document in the future. Think of the
1683 % \meta{newname}\file{.tex} file in the same way as a \file{DVI} file:
1684 % something you can always reproduce from the original source.)
1685 %
1686 % If your document is composed of a number of separate \LaTeX{} source
1687 % files, combined with |\include| commands, only one |sed| script will be
1688 % generated, but you will need to run \emph {each} source file through
1689 % that \emph{same} script (and probably modify the |\include| commands to
1690 % match the new file names). However, using \package{babel}'s language
1691 % switching commands in a document split across multiple separate source
1692 % files is beyond the capabilities of the \package{poorman} option. You
1693 % will almost certainly need to manually tweak the |sed| script in that
1694 % case.
1695 %
1696 % Note that the \option{poorman} script cannot fully reproduce the
1697 % typesetting of the original \package{cleveref} cross-references in all
1698 % cases.\footnote{At least, not without resorting to inserting low-level
1699 % \LaTeX{} code in your document, which would somewhat defeat the purpose
1700 % of the \option{poorman} option.} In particular, if you're using the
1701 % \package{hyperref} package (see \cref{sec:other_packages}) to turn
1702 % cross-references into hyperlinks, any customisation of hyperlinks will
1703 % be lost. And if you're using the \package{varioref} package (see
1704 % \cref{sec:other_packages}), you may need to manually tweak the spacing
1705 % in front of some of the \package{varioref} commands in the document
1706 % produced by the |sed| script.
1707 %
1708 %
1709 %
1710 % \section{Interaction with Other Packages}
1711 % \label{sec:other_packages}
1712 % The \package{cleveref} package \emph{must} be loaded \emph{after} all
1713 % other packages that don't specifically support it,\footnote{At the time
1714 % of writing, the only packages I'm aware of that should be loaded after
1715 % \package{cleveref} are the \package{hypdvips} and \package{autonum}
1716 % packages.} i.e.\ the
1717 % \begin{quote}
1718 % |\usepackage{cleveref}|
1719 % \end{quote}
1720 % line should usually be the last |\usepackage| command in your
1721 % document's preamble.
1722 %
1723 % \package{Cleveref} tries as far as possible to minimise its impact on
1724 % the standard \LaTeX{} cross-referencing machinery, allowing it to work
1725 % alongside many of the other packages that also enhance \LaTeX{}'s
1726 % cross-referencing features, though it can occasionally interact badly
1727 % with packages that redefine the same core \LaTeX{} commands. Beyond
1728 % peacefully co-existing with many packages, \package{cleveref} includes
1729 % specific support for a number other packages, allowing it to integrate
1730 % its clever cross-referencing features with the features provided by
1731 % these packages: \package{babel}, \package{polyglossia},
1732 % \package{hyperref}, \package{varioref}, \package{ntheorem},
1733 % \package{amsthm}, \package{aliascnt}, \package{subfig},
1734 % \package{algorithmicx}\footnote{The \package{algorithmic} package is
1735 % \emph{not} supported.}, \package{algorithm2e}, \package{listings}.
1736 %
1737 % \package{Cleveref} implements a significantly enhanced version of the
1738 % features found in the \package{fancyref} package, \package{ntheorem}'s
1739 % \option{thref} option, and \package{varioref}'s |\labelformat| command.
1740 % Although these features may (or may not) work correctly alongside
1741 % \package{cleveref}, there is no good reason to use them when using
1742 % \package{cleveref}, and their use is unsupported. (Note that
1743 % \package{varioref} \emph{is} fully supported by \package{cleveref},
1744 % just that \package{cleveref}'s features supersede \package{varioref}'s
1745 % |\labelformat| feature. Similarly, \package{ntheorem} is fully supported
1746 % and even recommended, only the \option{thref} option is superseded by
1747 % \package{cleveref}.)
1748 %
1749 % \DescribeMacro{\thref}
1750 % \DescribeMacro{\vref}
1751 % \DescribeMacro{\Vref}
1752 % \DescribeMacro{\vrefrange}
1753 % \DescribeMacro{\Vrefrange}
1754 % \DescribeMacro{\fullref}
1755 % \DescribeMacro{\Fullref}
1756 % In fact, if \package{ntheorem} is loaded with the \option{thref}
1757 % option, \package{cleveref} redefines \package{ntheorem}'s |\thref|
1758 % command for you, to be an alias for |\cref|. Similarly, if
1759 % \package{varioref} is loaded, \package{cleveref} redefines the |\vref|,
1760 % |\vrefrange|, |\fullref| commands and variants to instead use the
1761 % \package{cleveref} features for cross-reference formatting, whilst
1762 % retaining all the \package{varioref} page-referencing magic. You can
1763 % continue to use the other \package{varioref} and \package{ntheorem}
1764 % commands (other than |\labelformat| and the \option{thref} option)
1765 % whilst using \package{cleveref}, as long as \package{cleveref} is
1766 % loaded \emph{last}.
1767 %
1768 % \DescribeMacro{\vref*}
1769 % \DescribeMacro{\Vref*}
1770 % \DescribeMacro{\vrefrange*}
1771 % \DescribeMacro{\Vrefrange*}
1772 % \DescribeMacro{\fullref*}
1773 % \DescribeMacro{\Fullref*}
1774 % Note that, whilst in the business of redefining the \package{varioref}
1775 % commands, \package{cleveref} seizes the opportunity to get rid of the
1776 % irritating spacing behaviour of the |\vref| and |\Vref| commands,
1777 % instead making it consistent with the other \package{cleveref}
1778 % cross-referencing commands. This also frees up the starred variants of
1779 % the \package{varioref} commands to be used for suppressing hyperlinks
1780 % when the \package{hyperref} package is loaded, as usual.
1781 % (Unfortunately, due to lack of support for this in \package{varioref},
1782 % the page references will still sometimes be hyperlinks, even when using
1783 % the starred variants. Go bug the \package{varioref} maintainer about
1784 % this if you don't like it.)
1785 %
1786 % \package{Cleveref} is currently incompatible with the
1787 % \package{mathtools} package's\linebreak[4] \option{showonlyrefs}
1788 % option, which automatically labels only those equations that are
1789 % cross-referenced. The \package{autonum} package provides a possible
1790 % alternative, which implements similar features in a
1791 % \package{cleveref}-compatible manner.
1792 %
1793 %
1794 %
1795 % \section{Known Bugs, Non-Bugs, and Possible Improvements}
1796 % \label{sec:known_bugs}
1797 %
1798 % \subsection{Non-Bugs}\label{sec:non-bugs}
1799 % The following are \emph{not} bugs. They are either intentional
1800 % behaviour, unavoidable behaviour, or are caused by \LaTeX{}
1801 % misunderstandings:
1802 % \begin{itemize}
1803 % \item If you are using both \package{varioref} and \package{hyperref},
1804 % \emph{make sure you are loading them in the correct order}, otherwise
1805 % cross-references will reference completely the wrong thing
1806 % \emph{without any warning in the \LaTeX{} output or log!} The
1807 % packages \emph{must} be loaded in the following order:
1808 % \package{varioref}, \package{hyperref}, \package{cleveref}.
1809 % \item \package{Cleveref} on its own won't automatically infer the type
1810 % of theorem-like environment you're referring to in a cross-reference.
1811 % Cross-references to all theorem-like environments will use the same
1812 % name, ``theorem''. To allow the theorem type to be determined
1813 % automatically, you need to load either the \package{ntheorem} or the
1814 % \package{amsthm} package. Also note that all |\newtheorem|
1815 % definitions must be placed \emph{after} the \package{cleveref}
1816 % package is loaded.
1817 % \item Due to the way \TeX{} parses arguments, you have to be a little
1818 % careful when using |\label| inside an optional argument to another
1819 % command. |\label|\marg{label} will work, but trying to pass an
1820 % optional argument |\label|\oarg{type}\marg{label} will fail. If you
1821 % want to pass an optional argument to |\label| whilst already within
1822 % an optional argument to some other command, you must surround the
1823 % entire label command with braces:
1824 % |{\label|\oarg{type}\marg{label}|}|. This crops up e.g.\ when adding
1825 % labels to subfigure subcaptions in the \package{memoir} document
1826 % class. A simpler solution in this particular case is to define the
1827 % label in the subfigure body, instead of in the subcaption.
1828 % \item \package{Cleveref} will not work properly with the standard
1829 % \LaTeX{} |eqnarray| environment. There is no intention to fix this.
1830 % The |eqnarray| environment is poorly implemented, making it difficult
1831 % to get it to work properly with \package{cleveref}, and it's broken
1832 % any way. You're \emph{far} better off using the \package{amsmath}
1833 % replacements, such as |gather|, |align|, |multline| and |split|,
1834 % which \emph{do} work properly with \package{cleveref}. (See
1835 % \url{http://www.tug.org/pracjourn/2006-4/madsen/}).
1836 % \item If you are using \package{babel}, you \emph{must still} pass the
1837 % appropriate language option to \package{cleveref}, as well as to
1838 % \package{babel}. Passing it to \package{babel} alone is \emph{not}
1839 % sufficient (you will get the default English cross-reference
1840 % formats). The best way to set the document language is as a global
1841 % option in the |\documentclass| line. (This is standard \LaTeX{} and
1842 % \package{babel} practice -- read up on \LaTeX{}'s option handling for
1843 % more detail.)
1844 % \item \package{Cleveref} can't cope with active characters being
1845 % present in cross-reference label names. For example, if French
1846 % \package{babel} support is loaded, the commonly used ``:'' in label
1847 % names will often fail, spewing the usual random selection of
1848 % mysterious \TeX{} errors that accompany such deep-seated errors. The
1849 % solution is to avoid using active characters in label names. (You may
1850 % need to consult the \package{babel} documentation to discover which
1851 % active characters are defined in your language.)
1852 % \item The \option{poorman} |sed| script loses any custom
1853 % \package{cleveref} hyperlink formatting you might have defined, and
1854 % does not always reproduce the original spacing around the
1855 % \package{varioref} commands when \package{varioref} is used. This is
1856 % not a bug; it is a side-effect of the intended purpose of the
1857 % \option{poorman} option. The philosophy behind \option{poorman} is to
1858 % replace \package{cleveref}'s enhanced cross-referencing with standard
1859 % \LaTeX{} cross-reference commands that are guaranteed to work with
1860 % any standard \LaTeX{} installation. Although it would be simple to
1861 % fix these ``bugs'', it's almost certainly impossible without using
1862 % low-level \LaTeX{} code that is unlikely to be supported by e.g.\
1863 % academic journals, thereby defeating the whole purpose of the
1864 % \option{poorman} option.
1865 % \end{itemize}
1866 %
1867 %
1868 % \subsection{Known Bugs and Work-Arounds}
1869 % In rough order of significance:
1870 % \begin{itemize}
1871 % \item When both the \package{amsmath} \emph{and} \package{hyperref}
1872 % packages are loaded at the same time, the \package{cleveref}
1873 % cross-referencing commands do not work when used within section
1874 % titles. If anyone can figure out why, let me know! As a work-around,
1875 % use |\ref| within section titles when your document uses both
1876 % \package{amsmath} and \package{hyperref}.
1877 % \item When using \package{varioref} and \package{hyperref} with
1878 % \package{cleveref}, the \package{cleveref}\linebreak[4]
1879 % \option{nameinlink} option will not cause the word ``page'' in the
1880 % page-reference part of a |\vref| (or other \package{varioref})
1881 % command to be included in the hyperlink, nor will the ``on the
1882 % previous page'' (or similar) text produced by |\vref| be hyperlinked.
1883 % This is not strictly speaking a \package{cleveref} issue. It is the
1884 % normal behaviour of the \package{hyperref}-enhanced version of
1885 % \package{varioref}'s |\vpageref| command, which \package{cleveref}
1886 % uses to produce the page references in its enhanced |\vref| command.
1887 % (This \emph{might} be improved in a future version by partially
1888 % overriding \package{hyperref}.)
1889 % \item \package{Cleveref} doesn't know about the \package{subfloat}
1890 % package, so you have to revert to using |\ref| for cross-references
1891 % to sub-figures. (Might be fixed in a future version.)
1892 % \item The \package{beamer} document class redefines the |\label|
1893 % command in a particularly devious way that breaks
1894 % \package{cleveref}'s optional argument to that command. (Might be
1895 % fixed in a future version.)
1896 % \item \package{Cleveref} is incompatible with the \option{showonlyrefs}
1897 % option of the \package{mathtools} package, though it should be
1898 % compatible with the rest of \package{mathtools}. (Might be fixed in a
1899 % future version.) The \package{autonum} package, which provides
1900 % similar functionality and \emph{is} designed to be
1901 % \package{cleveref}-compatible, is a possible alternative.
1902 % \item \package{Cleveref} assumes that counters are only ever reset by
1903 % the standard sectioning commands (|\chapter|, |\section|, etc.). If
1904 % this is not the case, the automatic compression of consecutive
1905 % cross-references into a reference range may be incorrect. Making this
1906 % more flexible would be a simple task, but so far there doesn't seem
1907 % to be much need for it.
1908 % \end{itemize}
1909 %
1910 %
1911 % \subsection{Possible New Features and Improvements}
1912 % \label{sec:new-features}
1913 % In no particular order:
1914 % \begin{itemize}
1915 % \item The \option{poorman} option could be enhanced to allow a choice
1916 % of scripting language rather than just |sed| (e.g.\ |awk|, |perl|,
1917 % \dots?), but these are unlikely to be much better for those apt to
1918 % complain about the use of |sed|. The portable option would be to
1919 % output a \TeX{} ``script'', but this would be \emph{much} more
1920 % work\footnote{\LaTeX{} \emph{really} isn't suited to that kind of
1921 % pattern matching task -- just take a look at the code for escaping
1922 % regexp special characters in this package!} than I'm prepared to
1923 % invest.
1924 % \item \package{Cleveref} doesn't include support for all languages yet.
1925 % Any contributions of translations for missing languages are most
1926 % welcome! If you can contribute definitions for a missing language,
1927 % ideally you should add them below the existing ones in the
1928 % implementation (using those as a model), generate a patch against the
1929 % original \package{cleveref.dtx} file, and send the patch by email to
1930 % the package author. However, if you don't know how to produce a
1931 % patch, you can instead just send the translations as a plain text
1932 % file.
1933 % \end{itemize}
1934 %
1935 %
1936 %
1937 % \section{Thanks}
1938 % A number of people have helped improve \package{cleveref} by
1939 % contributing code and translations. Thanks to Michael Ummels for
1940 % contributing the \package{amsthm} support code, and to Stefan Pinnow,
1941 % Gonzalo Medina, Massimo Redaelli, Philip H\"olzenspies, Aleksander
1942 % Gorohovski, Benjamin H{\o}yer, Johannes Mueller, Paulo Roberto Massa
1943 % Cereda, Simon Sigurdhsson, Rafel Jaume Dey\`a and Eva Bosch Roura for
1944 % contributing translations. Thanks also to Susanna Goldschmidt for
1945 % additional help with the translations.
1946 %
1947 % Many people have suggested improvements or reported bugs -- indeed,
1948 % many have put significant effort into helping investigate and fix them.
1949 % So thanks (in alphabetical order) to: Adrian Knoth, Akim Demaille, Alan
1950 % Munn, Aleksander Gorohovski, Amar Ghaisas, Anand Deopurkar, Andreas
1951 % Haselbacher, Arne Meier, Bas Ploeger, Christian Tuma, Dan Luecking,
1952 % David Gleich, Davide Liessi, Denis Bitouz\'e, Domenic Denicola, Donald
1953 % Ars\-en\-eau, Eric Ahlberg, Frank Mittlebach, Hendrik Maryns, Iain
1954 % Cunningham, Ingolf Becker, James Sharam, Jens Mueller, Joel C.\
1955 % Salomon, Jonas Nyrup, Joris Pinkse, Kristian Debrabant, Leo Shidai Liu,
1956 % Lev Bishop, Mak Trifkovic, Mark Cipolone, Matej Batic, Matt Gately,
1957 % Matthew Skala, Michael Barber, Michael Gorven, Michal Kaut, Mico
1958 % Loretan, Milania, Nicolas Dudebout, Olivier Roy, Patrick H\"acker, Paul
1959 % Gomme, Ricardo de Aldama S\'anchez, Robert Fischer, Sebastian
1960 % \O{}rsted, Simon Spiegel, Stefan Pinnow, Steve Dower, Ted Pavlic,
1961 % Thomas Arildsen, Tobias Jores, Uwe L\"uck and Vadim Makarov for their
1962 % help.
1963 % (If I've inadvertently missed you out, please let me know!)
1964 %
1965 %
1966 % \StopEventually{\clearpage\PrintChanges\clearpage\PrintIndex}
1967 %
1968 %
1969 % \clearpage
1970 % \section{Implementation}
1971 % Essentially, the core of the implementation consists of writing an
1972 % extra piece of information --- the label ``type'' --- to the \file{aux}
1973 % file, and defining \cmd{\cref} commands which use this extra
1974 % information to typeset the cross-reference.
1975 %
1976 % The least invasive previous implementation of this kind of thing seems
1977 % to be that used by the \package{varioref} package. Namely, to redefine
1978 % the \cmd{\refstepcounter} command so that the \cmd{\@currentlabel}
1979 % macro, which usually just contains the typeset version of the counter,
1980 % now contains the additional type information.
1981 %
1982 % However, even less invasive than \package{varioref}'s implementation is
1983 % to leave \cmd{\@currentlabel} alone, and define a new
1984 % \cmd{\cref@currentlabel} macro to hold the extra information. (In fact,
1985 % we store three extra pieces of information: the type, the counter value
1986 % itself, and the value of the counter that causes the label's counter to
1987 % be reset, which we call the ``prefix'' from now on.) The standard
1988 % \cmd{\@currentlabel} contents eventually get written to the \file{aux}
1989 % file as an argument to \cmd{\newlabel} by the usual \LaTeX{} label
1990 % mechanisms. In order to also get the information in
1991 % \cmd{\cref@currentlabel} into the \file{aux} file, we have to redefine
1992 % the \cmd{\label} macro so that it writes \emph{two} \cmd{\newlabel}
1993 % lines to the \file{aux} file for \emph{each} label: the standard one,
1994 % plus an additional one which contains the extra information in
1995 % \cmd{\cref@currentlabel}. The additional \cmd{\newlabel} line has the
1996 % suffix |@cref| added to the label name. Thus the extra information in
1997 % \cmd{\cref@currentlabel} will end up in \cmd{\r@\meta{label}@cref} when
1998 % the \file{aux} file is re-read on the next pass.
1999 %
2000 % Doing things this way involves less hacking to get everything else
2001 % working again, since the standard cross-reference mechanism and
2002 % \cmd{\ref} command are left entirely intact. \package{Cleveref} can
2003 % then do what it likes with its own parallel set of labels, without
2004 % getting in the way of other packages that play around with the
2005 % cross-reference mechanism. The only downside is the additional memory
2006 % resources this uses, but on modern \TeX{} implementations this is
2007 % unlikely to be a problem.
2008 %
2009 %
2010 % \subsection{Redefinitions of \LaTeX{} Kernel Macros}
2011 % \begin{macro}{\refstepcounter}
2012 % \begin{macro}{\cref@currentlabel}
2013 % \begin{macro}{\cref@old@refstepcounter}
2014 % We store the original \cmd{\refstepcounter} in
2015 % \cmd{\cref@old@refstepcounter}, then redefine \cmd{\refstepcounter}
2016 % so that it first calls the old version to define the standard
2017 % \cmd{\@currentlabel} macro, before defining \package{cleveref}'s
2018 % \cmd{\cref@currentlabel}, which contains the extra information. The
2019 % cross-reference ``type'' stored in \cmd{\cref@currentlabel} is usually
2020 % inferred from the counter. This can be overridden by aliasing the
2021 % counter name to a different type using \cmd{\crefalias}. The new
2022 % \cmd{\refstepcounter} can also take an optional argument, which
2023 % always overrides the type.
2024 % \begin{macrocode}
2025 \def\cref@currentlabel{}%
2026 \let\cref@old@refstepcounter\refstepcounter%
2027 \def\refstepcounter{%
2028 \@ifnextchar[{\refstepcounter@optarg}{\refstepcounter@noarg}%]
2029 }%
2030 \def\refstepcounter@noarg#1{%
2031 \cref@old@refstepcounter{#1}%
2032 \cref@constructprefix{#1}{\cref@result}%
2033 \@ifundefined{cref@#1@alias}%
2034 {\def\@tempa{#1}}%
2035 {\def\@tempa{\csname cref@#1@alias\endcsname}}%
2036 \protected@edef\cref@currentlabel{%
2037 [\@tempa][\arabic{#1}][\cref@result]%
2038 \csname p@#1\endcsname\csname the#1\endcsname}}%
2039 \def\refstepcounter@optarg[#1]#2{%
2040 \cref@old@refstepcounter{#2}%
2041 \cref@constructprefix{#2}{\cref@result}%
2042 \@ifundefined{cref@#1@alias}%
2043 {\def\@tempa{#1}}%
2044 {\def\@tempa{\csname cref@#1@alias\endcsname}}%
2045 \protected@edef\cref@currentlabel{%
2046 [\@tempa][\arabic{#2}][\cref@result]%
2047 \csname p@#2\endcsname\csname the#2\endcsname}}%
2048 % \end{macrocode}
2049 % \end{macro}
2050 % \end{macro}
2051 % \end{macro}
2052 %
2053 %
2054 % \begin{macro}{\label}
2055 % \begin{macro}{\cref@label}
2056 % \begin{macro}{\label@optarg}
2057 % \begin{macro}{\label@noarg}
2058 % We redefine the \cmd{\label} command to make it define \emph{two}
2059 % labels each time it's called: the standard one, and an additional
2060 % \package{cleveref}-specific one with the suffix |@cref| added to the
2061 % label name, which contains the extra information from
2062 % \cmd{\cref@currentlabel}. We call the original \cmd{\label} command,
2063 % stored in \cmd{\cref@old@label}, to write the standard label to the
2064 % \file{aux} file. However, to avoid other packages messing around with
2065 % the content of the parallel set of \package{cleveref}-specific
2066 % labels, we write those directly to the \file{aux} file ourselves. We
2067 % also allow \cmd{\label} to take an optional argument which overrides
2068 % the default reference type in \cmd{\cref@currentlabel}.
2069 %
2070 % The redefinition of \cmd{\label} has to be postponed until the
2071 % beginning of the document because some other packages postpone their
2072 % own \cmd{\label} redefinitions too, and we need to override their
2073 % redefinitions.
2074 % \begin{macrocode}
2075 \AtBeginDocument{%
2076 \let\cref@old@label\label%
2077 \def\label{\@ifnextchar[\label@optarg\label@noarg}%]
2078 \let\cref@label\label%
2079 \def\label@noarg#1{%
2080 \cref@old@label{#1}%
2081 \@bsphack%
2082 \edef\@tempa{{page}{\the\c@page}}%
2083 \setcounter{page}{1}%
2084 \edef\@tempb{\thepage}%
2085 \expandafter\setcounter\@tempa%
2086 \cref@constructprefix{page}{\cref@result}%
2087 \protected@write\@auxout{}%
2088 {\string\newlabel{#1@cref}{{\cref@currentlabel}%
2089 {[\@tempb][\arabic{page}][\cref@result]\thepage}}}%
2090 \@esphack}%
2091 \def\label@optarg[#1]#2{%
2092 \cref@old@label{#2}%
2093 \@bsphack%
2094 \edef\@tempa{{page}{\the\c@page}}%
2095 \setcounter{page}{1}%
2096 \edef\@tempb{\thepage}%
2097 \expandafter\setcounter\@tempa%
2098 \cref@constructprefix{page}{\cref@result}%
2099 \protected@edef\cref@currentlabel{%
2100 \expandafter\cref@override@label@type%
2101 \cref@currentlabel\@nil{#1}}%
2102 \protected@write\@auxout{}%
2103 {\string\newlabel{#2@cref}{{\cref@currentlabel}%
2104 {[\@tempb][\arabic{page}][\cref@result]\thepage}}}%
2105 \@esphack}%
2106 }% end of AtBeginDocument
2107 % \end{macrocode}
2108 % \end{macro}
2109 % \end{macro}
2110 % \end{macro}
2111 % \end{macro}
2112 %
2113 %
2114 % \begin{macro}{\@makefntext}
2115 % Footnotes don't use the \cmd{\refstepcounter} mechanism, but instead
2116 % set\linebreak[4] \cmd{\@currentlabel} directly inside the footnote
2117 % insertion item. Thus we need to explicitly set
2118 % \cmd{\cref@currentlabel} in footnotes. To avoid the definition
2119 % spilling out of the footnote, we need to set it inside
2120 % \cmd{\insert}'s implicit insertion item grouping level. To this end,
2121 % we add the explicit \cmd{\cref@currentlabel} redefinition to
2122 % \cmd{\@makefntext}, which gets called from within \cmd{\insert} by
2123 % both \cmd{\@footnotetext} and \cmd{\@mpfootnotentext}.
2124 % \begin{macrocode}
2125 \let\cref@old@makefntext\@makefntext%
2126 \long\def\@makefntext{%
2127 \cref@constructprefix{footnote}{\cref@result}%
2128 \protected@edef\cref@currentlabel{%
2129 [footnote][\arabic{footnote}][\cref@result]%
2130 \p@footnote\@thefnmark}%
2131 \cref@old@makefntext}%
2132 % \end{macrocode}
2133 % \end{macro}
2134 %
2135 %
2136 % \begin{macro}{\newtheorem}
2137 % A \cmd{\newtheorem} command provides sufficient information to
2138 % automatically define a reasonable cross-reference name for
2139 % theorem-like environments (\package{ntheorem}'s \option{thref} does
2140 % essentially this). So we modify \cmd{\newtheorem} (actually, the
2141 % lower-level \cmd{\@othm}, \cmd{\@xnthm} and \cmd{\@ynthm} macros) so
2142 % that it does so. We do this in such a way that default definitions or
2143 % explicit \cmd{\crefname} definitions for theorem-like environments
2144 % override those produced automatically by our modified
2145 % \cmd{\newtheorem}.
2146 %
2147 % The catch is that, although the \cmd{\newtheorem} command provides
2148 % the singular form, there's no way of reliably deducing the correct
2149 % plural form. Rather than implement some half-baked attempt at this
2150 % which will be wrong more often than it's right (especially in
2151 % languages other than English) and generally cause more trouble than
2152 % it's worth, we simply define the singular form but leave the plural
2153 % form undefined. If the latter is ever needed, it will produce a
2154 % ``undefined cross-reference type'' warning, prompting the author to
2155 % provide an appropriate \cmd{\crefname} definition themselves.
2156 %
2157 % \begin{macro}{\@othm}
2158 % \begin{macro}{\@xnthm}
2159 % \begin{macro}{\@ynthm}
2160 % After sorting out its arguments, \cmd{\newtheorem} calls one of
2161 % \cmd{\@othm}, \cmd{\@xthm} or \cmd{\@ythm}. We add automatic
2162 % definitions of \cmd{\cref@\meta{type}@name} and\linebreak[4]
2163 % \cmd{\Cref@\meta{type}@name} to all three of these, and add the
2164 % theorem-like environment to the list of cross-reference types that
2165 % need to be defined from components at |\||begin{document}|. Since we
2166 % want explicit \cmd{\crefname}'s to override these automatic
2167 % definitions, we store the definitions in
2168 % \cmd{\cref@\meta{type}@name@preamble}, which are processed at
2169 % |\||begin{document}|) if they haven't been overridden. The default
2170 % definitions also get stored in \cmd{\cref@\meta{type}@name@preamble}
2171 % later on, so they too will override these automatic definitions,
2172 % which is what we want.
2173 %
2174 % All this means that these automatic \cmd{\newtheorem} definitions
2175 % will only work when \cmd{\newtheorem} is used in the preamble.
2176 % However, this is also true of (new) cross-reference types defined
2177 % using \cmd{\crefname}, so it doesn't seem worth the significant
2178 % effort of getting the automatic definitions to work within the
2179 % document body.
2180 % \begin{macrocode}
2181 \let\cref@old@othm\@othm%
2182 \def\@othm#1[#2]#3{%
2183 \edef\@tempa{\expandafter\noexpand%
2184 \csname cref@#1@name@preamble\endcsname}%
2185 \edef\@tempb{\expandafter\noexpand%
2186 \csname Cref@#1@name@preamble\endcsname}%
2187 \def\@tempc{#3}%
2188 \ifx\@tempc\@empty\relax%
2189 \expandafter\gdef\@tempa{}%
2190 \expandafter\gdef\@tempb{}%
2191 \else%
2192 \if@cref@capitalise%
2193 \expandafter\expandafter\expandafter\gdef\expandafter%
2194 \@tempa\expandafter{\MakeUppercase #3}%
2195 \else%
2196 \expandafter\expandafter\expandafter\gdef\expandafter%
2197 \@tempa\expandafter{\MakeLowercase #3}%
2198 \fi%
2199 \expandafter\expandafter\expandafter\gdef\expandafter%
2200 \@tempb\expandafter{\MakeUppercase #3}%
2201 \fi%
2202 \cref@stack@add{#1}{\cref@label@types}%
2203 \cref@old@othm{#1}[#2]{#3}}%
2204 \let\cref@old@xnthm\@xnthm%
2205 \def\@xnthm#1#2[#3]{%
2206 \edef\@tempa{\expandafter\noexpand%
2207 \csname cref@#1@name@preamble\endcsname}%
2208 \edef\@tempb{\expandafter\noexpand%
2209 \csname Cref@#1@name@preamble\endcsname}%
2210 \def\@tempc{#2}%
2211 \ifx\@tempc\@empty\relax%
2212 \expandafter\gdef\@tempa{}%
2213 \expandafter\gdef\@tempb{}%
2214 \else%
2215 \if@cref@capitalise%
2216 \expandafter\expandafter\expandafter\gdef\expandafter%
2217 \@tempa\expandafter{\MakeUppercase #2}%
2218 \else%
2219 \expandafter\expandafter\expandafter\gdef\expandafter%
2220 \@tempa\expandafter{\MakeLowercase #2}%
2221 \fi%
2222 \expandafter\expandafter\expandafter\gdef\expandafter%
2223 \@tempb\expandafter{\MakeUppercase #2}%
2224 \fi%
2225 \cref@stack@add{#1}{\cref@label@types}%
2226 \cref@old@xnthm{#1}{#2}[#3]}%
2227 \let\cref@old@ynthm\@ynthm%
2228 \def\@ynthm#1#2{%
2229 \edef\@tempa{\expandafter\noexpand%
2230 \csname cref@#1@name@preamble\endcsname}%
2231 \edef\@tempb{\expandafter\noexpand%
2232 \csname Cref@#1@name@preamble\endcsname}%
2233 \def\@tempc{#2}%
2234 \ifx\@tempc\@empty\relax%
2235 \expandafter\gdef\@tempa{}%
2236 \expandafter\gdef\@tempb{}%
2237 \else%
2238 \if@cref@capitalise%
2239 \expandafter\expandafter\expandafter\gdef\expandafter%
2240 \@tempa\expandafter{\MakeUppercase #2}%
2241 \else%
2242 \expandafter\expandafter\expandafter\gdef\expandafter%
2243 \@tempa\expandafter{\MakeLowercase #2}%
2244 \fi%
2245 \expandafter\expandafter\expandafter\gdef\expandafter%
2246 \@tempb\expandafter{\MakeUppercase #2}%
2247 \fi%
2248 \cref@stack@add{#1}{\cref@label@types}%
2249 \cref@old@ynthm{#1}{#2}}%
2250 % \end{macrocode}
2251 % \end{macro}
2252 % \end{macro}
2253 % \end{macro}
2254 % \end{macro}
2255 %
2256 %
2257 % \begin{macro}{\appendix}
2258 % The \cmd{\appendix} command causes the top-level sectioning commands
2259 % (\cmd{\chapter} or \cmd{\section}, depending on the document class)
2260 % to produce appendices instead. Since we want to be able to format
2261 % references to appendices separately from references to normal
2262 % top-level sections, we add to the tasks that \cmd{\appendix} does: it
2263 % redefines \cmd{\refstepcounter@noarg} to exceptionally override the
2264 % label type for chapters or sections, as appropriate, setting it to
2265 % ``appendix'' instead. There are two alternative definitions: one if
2266 % ``section'' is the top-level sectioning command, and one if
2267 % ``chapter'' fulfils that role.
2268 % \begin{macrocode}
2269 \@ifundefined{appendix}{}{%
2270 \let\cref@old@appendix\appendix%
2271 \def\appendix{%
2272 \@ifundefined{chapter}{%
2273 \gdef\refstepcounter@noarg##1{%
2274 \cref@old@refstepcounter{##1}%
2275 \cref@constructprefix{##1}{\cref@result}%
2276 % \end{macrocode}
2277 % We add a large value to the front of the counter data, to force
2278 % references to anything in appendices to be sorted after everything
2279 % else.
2280 % \begin{macrocode}
2281 \ifx\cref@result\@empty%
2282 \def\cref@result{2147483647}%
2283 \else%
2284 \edef\cref@result{2147483647,\cref@result}%
2285 \fi%
2286 % \end{macrocode}
2287 % Override the cross-reference type of sectioning commands.
2288 % \begin{macrocode}
2289 \def\@tempa{##1}%
2290 \def\@tempb{section}%
2291 \ifx\@tempa\@tempb%
2292 \@ifundefined{cref@appendix@alias}%
2293 {\def\@tempa{appendix}}%
2294 {\def\@tempa{\cref@appendix@alias}}%
2295 \protected@edef\cref@currentlabel{%
2296 [\@tempa][\arabic{##1}][\cref@result]%
2297 \csname p@##1\endcsname\csname the##1\endcsname}%
2298 \else%
2299 \def\@tempa{##1}%
2300 \def\@tempb{subsection}%
2301 \ifx\@tempa\@tempb%
2302 \@ifundefined{cref@subappendix@alias}%
2303 {\def\@tempa{subappendix}}%
2304 {\def\@tempa{\cref@subappendix@alias}}%
2305 \protected@edef\cref@currentlabel{%
2306 [\@tempa][\arabic{##1}][\cref@result]%
2307 \csname p@##1\endcsname\csname the##1\endcsname}%
2308 \else%
2309 \def\@tempa{##1}%
2310 \def\@tempb{subsubsection}%
2311 \ifx\@tempa\@tempb%
2312 \@ifundefined{cref@subsubappendix@alias}%
2313 {\def\@tempa{subsubappendix}}%
2314 {\def\@tempa{\cref@subsubappendix@alias}}%
2315 \protected@edef\cref@currentlabel{%
2316 [\@tempa][\arabic{##1}][\cref@result]%
2317 \csname p@##1\endcsname\csname the##1\endcsname}%
2318 \else%
2319 \@ifundefined{cref@##1@alias}%
2320 {\def\@tempa{##1}}%
2321 {\def\@tempa{\csname cref@##1@alias\endcsname}}%
2322 \protected@edef\cref@currentlabel{%
2323 [\@tempa][\arabic{##1}][\cref@result]%
2324 \csname p@##1\endcsname\csname the##1\endcsname}%
2325 \fi%
2326 \fi%
2327 \fi}%
2328 \cref@old@appendix%
2329 }{%
2330 \def\refstepcounter@noarg##1{%
2331 \cref@old@refstepcounter{##1}%
2332 \cref@constructprefix{##1}{\cref@result}%
2333 % \end{macrocode}
2334 % Again, the large value added to the front of the counter data forces
2335 % references to appendix items to be sorted last.
2336 % \begin{macrocode}
2337 \ifx\cref@result\@empty%
2338 \def\cref@result{2147483647}%
2339 \else%
2340 \edef\cref@result{2147483647,\cref@result}%
2341 \fi%
2342 % \end{macrocode}
2343 % Override the cross-reference type of sectioning commands.
2344 % \begin{macrocode}
2345 \def\@tempa{##1}%
2346 \def\@tempb{chapter}%
2347 \ifx\@tempa\@tempb%
2348 \@ifundefined{cref@appendix@alias}%
2349 {\def\@tempa{appendix}}%
2350 {\def\@tempa{\cref@appendix@alias}}%
2351 \protected@edef\cref@currentlabel{%
2352 [\@tempa][\arabic{##1}][\cref@result]%
2353 \csname p@##1\endcsname\csname the##1\endcsname}%
2354 \else%
2355 \def\@tempa{##1}%
2356 \def\@tempb{section}%
2357 \ifx\@tempa\@tempb%
2358 \@ifundefined{cref@subappendix@alias}%
2359 {\def\@tempa{subappendix}}%
2360 {\def\@tempa{\cref@subappendix@alias}}%
2361 \protected@edef\cref@currentlabel{%
2362 [\@tempa][\arabic{##1}][\cref@result]%
2363 \csname p@##1\endcsname\csname the##1\endcsname}%
2364 \else%
2365 \def\@tempa{##1}%
2366 \def\@tempb{subsection}%
2367 \ifx\@tempa\@tempb%
2368 \@ifundefined{cref@subsubappendix@alias}%
2369 {\def\@tempa{subsubappendix}}%
2370 {\def\@tempa{\cref@subsubappendix@alias}}%
2371 \protected@edef\cref@currentlabel{%
2372 [\@tempa][\arabic{##1}][\cref@result]%
2373 \csname p@##1\endcsname\csname the##1\endcsname}%
2374 \else%
2375 \def\@tempa{##1}%
2376 \def\@tempb{subsubsection}%
2377 \ifx\@tempa\@tempb%
2378 \@ifundefined{cref@subsubappendix@alias}%
2379 {\def\@tempa{subsubsubappendix}}%
2380 {\def\@tempa{\cref@subsubsubappendix@alias}}%
2381 \protected@edef\cref@currentlabel{%
2382 [\@tempa][\arabic{##1}][\cref@result]%
2383 \csname p@##1\endcsname\csname the##1\endcsname}%
2384 \else%
2385 \@ifundefined{cref@##1@alias}%
2386 {\def\@tempa{##1}}%
2387 {\def\@tempa{\csname cref@##1@alias\endcsname}}%
2388 \protected@edef\cref@currentlabel{%
2389 [\@tempa][\arabic{##1}][\cref@result]%
2390 \csname p@##1\endcsname\csname the##1\endcsname}%
2391 \fi%
2392 \fi%
2393 \fi%
2394 \fi}%
2395 \cref@old@appendix}%
2396 }%
2397 }% end of \@ifundefined{appendix}
2398 % \end{macrocode}
2399 % \end{macro}
2400 %
2401 %
2402 %
2403 % \subsection{Utility Macros}
2404 %
2405 % \subsubsection{miscellaneous}
2406 % \begin{macro}{\cref@gobble@optarg}
2407 % A basic macro that gobbles one argument plus, if present, one
2408 % optional argument.
2409 % \begin{macrocode}
2410 \def\cref@gobble@optarg{\@ifnextchar[\@cref@gobble@optarg\cref@gobble}%]
2411 \def\cref@gobble#1{}%
2412 \def\@cref@gobble@optarg[#1]#2{}%
2413 % \end{macrocode}
2414 % \end{macro}
2415 %
2416 % \begin{macro}{\cref@append@toks}
2417 % A basic utility macro for appending tokens to a token register.
2418 % \begin{macrocode}
2419 \def\cref@append@toks#1#2{\toks0={#2}%
2420 \edef\act{\noexpand#1={\the#1\the\toks0}}%
2421 \act}%
2422 % \end{macrocode}
2423 % \end{macro}
2424 %
2425 % \begin{macro}{\cref@ifstreq}
2426 % A utility macro to test string equality in a catcode-independent
2427 % fashion. Assumes both arguments are fully expandable. Note: using the
2428 % |\pdfstrcmp| primitive from |pdftex| would be more robust, but we don't
2429 % want to depend on |pdftex|. This macro suffices for our purposes.
2430 % \begin{macrocode}
2431 \def\cref@ifstreq#1#2#3#4{%
2432 \begingroup%
2433 \edef\@tempa{#1}%
2434 \edef\@tempb{#2}%
2435 \expandafter\def\expandafter\@tempa\expandafter{\csname\@tempa\endcsname}%
2436 \expandafter\def\expandafter\@tempb\expandafter{\csname\@tempb\endcsname}%
2437 \ifx\@tempa\@tempb%
2438 \let\@tempc\@firstoftwo%
2439 \else%
2440 \let\@tempc\@secondoftwo%
2441 \fi%
2442 \expandafter%
2443 \endgroup%
2444 \@tempc{#3}{#4}}%
2445 % \end{macrocode}
2446 % \end{macro}
2447 %
2448 %
2449 % \subsubsection{\file{aux} file information}
2450 % \begin{macro}{\cref@getlabel}
2451 % \begin{macro}{\cref@gettype}
2452 % \begin{macro}{\cref@getcounter}
2453 % \begin{macro}{\cref@getprefix}
2454 % Define some utility macros for extracting label, type, and counter
2455 % information from the contents of \cmd{\cref@currentlabel}, as written
2456 % to the \file{aux} file and stored in \cmd{\r@\meta{label}@cref} when
2457 % this is re-read on the next pass. Some other packages commandeer the
2458 % referencing system to write label information to the \file{aux} file
2459 % for other purposes, and probably use \cmd{\ref} to recover it later.
2460 % We still want them to work, so our utility macros must cope with the
2461 % type information being absent. However, since we need them to be
2462 % fully expandable in various places, and \cmd{\@ifnextchar} is
2463 % definitely \emph{not} fully expandable, we use the work-around of
2464 % having the macros store their result in another macro, whose name is
2465 % passed as the second argument. This other macro \emph{will} then be
2466 % fully expandable, and can be used e.g.\ inside an \cmd{\edef} or
2467 % \cmd{\csname}\ldots\cmd{\endcsname}.
2468 % \begin{macrocode}
2469 \def\cref@getref#1#2{%
2470 \expandafter\let\expandafter#2\csname r@#1@cref\endcsname%
2471 \expandafter\expandafter\expandafter\def%
2472 \expandafter\expandafter\expandafter#2%
2473 \expandafter\expandafter\expandafter{%
2474 \expandafter\@firstoftwo#2}}%
2475 \def\cref@getlabel#1#2{%
2476 \cref@getref{#1}{\@tempa}%
2477 \expandafter\@cref@getlabel\@tempa\@nil#2}%
2478 \def\@cref@getlabel{\@ifnextchar[%]
2479 \@@cref@getlabel{\@@cref@getlabel[][][]}}%
2480 \def\@@cref@getlabel[#1][#2][#3]#4\@nil#5{\def#5{#4}}%
2481 \def\cref@gettype#1#2{%
2482 \cref@getref{#1}{\@tempa}%
2483 \expandafter\@cref@gettype\@tempa\@nil#2}%
2484 \def\@cref@gettype{\@ifnextchar[%]
2485 \@@cref@gettype{\@@cref@gettype[][][]}}%
2486 \def\@@cref@gettype[#1][#2][#3]#4\@nil#5{\def#5{#1}}%
2487 \def\cref@getcounter#1#2{%
2488 \cref@getref{#1}{\@tempa}%
2489 \expandafter\@cref@getcounter\@tempa\@nil#2}%
2490 \def\@cref@getcounter{\@ifnextchar[%]
2491 \@@cref@getcounter{\@@cref@getcounter[][][]}}%
2492 \def\@@cref@getcounter[#1][#2][#3]#4\@nil#5{\def#5{#2}}%
2493 \def\cref@getprefix#1#2{%
2494 \cref@getref{#1}{\@tempa}%
2495 \expandafter\@cref@getprefix\@tempa\@nil#2}%
2496 \def\@cref@getprefix{\@ifnextchar[%]
2497 \@@cref@getprefix{\@@cref@getprefix[][][]}}%
2498 \def\@@cref@getprefix[#1][#2][#3]#4\@nil#5{\def#5{#3}}%
2499 % \end{macrocode}
2500 % \end{macro}
2501 % \end{macro}
2502 % \end{macro}
2503 % \end{macro}
2504 % \begin{macro}{\cpageref@getlabel}
2505 % \begin{macro}{\cpageref@gettype}
2506 % \begin{macro}{\cpageref@getcounter}
2507 % Similarly for the page number information. Here, the information we
2508 % store in addition to the page label is the page label ``type'' (used
2509 % to distinguish different page numbering sequences, e.g.\ roman in the
2510 % front-matter and arabic in the main text), and the numerical value of
2511 % the page counter.
2512 % \begin{macrocode}
2513 \def\cpageref@getref#1#2{%
2514 \expandafter\let\expandafter#2\csname r@#1@cref\endcsname%
2515 \expandafter\expandafter\expandafter\def%
2516 \expandafter\expandafter\expandafter#2%
2517 \expandafter\expandafter\expandafter{%
2518 \expandafter\@secondoftwo#2}}%
2519 \def\cpageref@getlabel#1#2{%
2520 \cpageref@getref{#1}{\@tempa}%
2521 \expandafter\@cpageref@getlabel\@tempa\@nil#2}%
2522 \def\@cpageref@getlabel{\@ifnextchar[%]
2523 \@@cpageref@getlabel{\@@cpageref@getlabel[][][]}}%
2524 \def\@@cpageref@getlabel[#1][#2][#3]#4\@nil#5{\def#5{#4}}%
2525 \def\cpageref@gettype#1#2{%
2526 \cpageref@getref{#1}{\@tempa}%
2527 \expandafter\@cpageref@gettype\@tempa\@nil#2}%
2528 \def\@cpageref@gettype{\@ifnextchar[%]
2529 \@@cpageref@gettype{\@@cpageref@gettype[][][]}}%
2530 \def\@@cpageref@gettype[#1][#2][#3]#4\@nil#5{\def#5{#1}}%
2531 \def\cpageref@getcounter#1#2{%
2532 \cpageref@getref{#1}{\@tempa}%
2533 \expandafter\@cpageref@getcounter\@tempa\@nil#2}%
2534 \def\@cpageref@getcounter{\@ifnextchar[%]
2535 \@@cpageref@getcounter{\@@cpageref@getcounter[][][]}}%
2536 \def\@@cpageref@getcounter[#1][#2][#3]#4\@nil#5{\def#5{#2}}%
2537 \def\cpageref@getprefix#1#2{%
2538 \cpageref@getref{#1}{\@tempa}%
2539 \expandafter\@cpageref@getprefix\@tempa\@nil#2}%
2540 \def\@cpageref@getprefix{\@ifnextchar[%]
2541 \@@cpageref@getprefix{\@@cpageref@getprefix[][][]}}%
2542 \def\@@cpageref@getprefix[#1][#2][#3]#4\@nil#5{\def#5{#3}}%
2543 % \end{macrocode}
2544 % \end{macro}
2545 % \end{macro}
2546 % \end{macro}
2547 %
2548 % \cmd{\cref@override@label@type} is a convenience macro for overriding
2549 % the label type stored in \cmd{\cref@currentlabel}.
2550 % \begin{macro}{\cref@override@label@type}
2551 % \begin{macrocode}
2552 \def\cref@override@label@type[#1][#2][#3]#4\@nil#5{[#5][#2][#3]#4}%
2553 % \end{macrocode}
2554 % \end{macro}
2555 %
2556 % \begin{macro}{\cref@constructprefix}
2557 % The \cmd{\cref@constructprefix} macro constructs the prefix
2558 % information stored in \cmd{\cref@currentlabel} (retrieved using
2559 % \cmd{\cref@getprefix}). This information consists of the numerical
2560 % value of each counter that's involved in resetting the label's
2561 % counter, i.e.\ it contains the numerical values of the chapter,
2562 % section, subsection\dots{} numbers that (ought to) make up the
2563 % formatted label produced by \cmd{\the\meta{counter}}. E.g.\ if
2564 % \cmd{\theequation} produces ``B.1.3'', this utility macro will return
2565 % ``2,1'' (the ``3'' corresponds to the equation number itself, which
2566 % is stored separately in \cmd{\cref@currentlabel}). The first argument
2567 % is the counter in question; the return value is stored in the second
2568 % argument, which should be a macro name.
2569 %
2570 % The real work is done by the recursive \cmd{\@cref@constructprefix}
2571 % macro, which works its way upwards through the counters' reset lists
2572 % until it reaches a counter that isn't reset by any other.
2573 % \begin{macrocode}
2574 \def\cref@constructprefix#1#2{%
2575 \cref@stack@init{\@tempstack}%
2576 % \end{macrocode}
2577 % We fully expand the first argument (the counter name) because sometimes
2578 % we get passed a counter name containing a macro.
2579 % \begin{macrocode}
2580 \edef\@tempa{\noexpand{#1\noexpand}}%
2581 \expandafter\def\expandafter\@tempa\expandafter{\@tempa{#2}}%
2582 \expandafter\@cref@constructprefix\@tempa%
2583 \cref@stack@to@list{\@tempstack}{\@tempa}%
2584 \expandafter\def\expandafter#2\expandafter{\@tempa}}%
2585 \def\@cref@constructprefix#1#2{%
2586 \cref@resetby{#1}{#2}%
2587 \ifx#2\relax%
2588 \else%
2589 \edef\@tempa{\the\csname c@#2\endcsname}%
2590 \expandafter\cref@stack@push\expandafter{\@tempa}{\@tempstack}%
2591 \edef\@tempa{{#2}}%
2592 \expandafter\expandafter\expandafter\@cref@constructprefix%
2593 \expandafter\@tempa\expandafter{\expandafter#2\expandafter}%
2594 \fi}%
2595 % \end{macrocode}
2596 % \end{macro}
2597 %
2598 %
2599 % \subsubsection{Stack data structures}
2600 % \begin{macro}{\cref@stack@init}
2601 % \begin{macro}{\cref@stack@top}
2602 % \begin{macro}{\cref@stack@pop}
2603 % \begin{macro}{\cref@stack@push}
2604 % \begin{macro}{\cref@stack@topandbottom}
2605 % \begin{macro}{\cref@stack@add}
2606 % \begin{macro}{\cref@stack@to@list}
2607 % We treat multiple references, supplied as a comma-separated list to
2608 % \cmd{\cref} or \cmd{\Cref}, as a stack structure. So we define some
2609 % utility macros for manipulating stacks (\cmd{\@nil} is used as an
2610 % end-of-stack delimiter).
2611 % \begin{macrocode}
2612 \def\cref@stack@init#1{\def#1{\@nil}}%
2613 \def\cref@stack@top#1{\expandafter\@cref@stack@top#1}%
2614 \def\@cref@stack@top#1,#2\@nil{#1}%
2615 \def\cref@stack@pop#1{\expandafter\@cref@stack@pop#1#1}%
2616 \def\@cref@stack@pop#1,#2\@nil#3{\def#3{#2\@nil}}%
2617 \def\cref@stack@push#1#2{%
2618 \expandafter\@cref@stack@push\expandafter{#2}{#1}{#2}}%
2619 \def\@cref@stack@push#1#2#3{\def#3{#2,#1}}%
2620 \def\cref@stack@pull#1#2{\expandafter\@cref@stack@pull#2{#1}{#2}}%
2621 \def\@cref@stack@pull#1\@nil#2#3{\def#3{#1#2,\@nil}}%
2622 \def\cref@stack@to@list#1#2{%
2623 \cref@isstackfull{#1}%
2624 \if@cref@stackfull%
2625 \expandafter\expandafter\expandafter\def%
2626 \expandafter\expandafter\expandafter#2%
2627 \expandafter\expandafter\expandafter{%
2628 \expandafter\@cref@stack@to@list#1}%
2629 \else%
2630 \def#2{}%
2631 \fi}%
2632 \def\@cref@stack@to@list#1,\@nil{#1}%
2633 \def\cref@stack@topandbottom#1#2#3{%
2634 \def#2{}%
2635 \def#3{}%
2636 \cref@isstackfull{#1}%
2637 \if@cref@stackfull%
2638 \edef#2{\cref@stack@top{#1}}%
2639 \cref@stack@pop{#1}%
2640 \cref@isstackfull{#1}%
2641 \@whilesw\if@cref@stackfull\fi{%
2642 \edef#3{\cref@stack@top{#1}}%
2643 \cref@stack@pop{#1}%
2644 \cref@isstackfull{#1}}%
2645 \fi}%
2646 \def\cref@stack@add#1#2{%
2647 \begingroup%
2648 \def\@arg1{#1}%
2649 \let\@tempstack#2%
2650 \newif\if@notthere%
2651 \@nottheretrue%
2652 \cref@isstackfull{\@tempstack}%
2653 \@whilesw\if@cref@stackfull\fi{%
2654 \edef\@tempb{\cref@stack@top{\@tempstack}}%
2655 \def\@tempa{#1}%
2656 \ifx\@tempa\@tempb%
2657 \@cref@stackfullfalse%
2658 \@nottherefalse%
2659 \else%
2660 \cref@stack@pop{\@tempstack}%
2661 \cref@isstackfull{\@tempstack}%
2662 \fi}%
2663 \expandafter\endgroup%
2664 \if@notthere\cref@stack@push{#1}{#2}\fi}%
2665 % \end{macrocode}
2666 % \end{macro}
2667 % \end{macro}
2668 % \end{macro}
2669 % \end{macro}
2670 % \end{macro}
2671 % \end{macro}
2672 % \end{macro}
2673 %
2674 % \begin{macro}{\if@cref@stackempty}
2675 % \begin{macro}{\if@cref@stackfull}
2676 % \begin{macro}{\cref@isstackempty}
2677 % \begin{macro}{\cref@isstackfull}
2678 % The \cmd{\cref@isstackempty} and \cmd{\cref@isstackfull} macros test
2679 % whether a stack is empty or full, respectively, and set the
2680 % corresponding conditionals\linebreak[4] |\if@cref@stackempty| and
2681 % |\if@cref@stackfull|.
2682 % \begin{macrocode}
2683 \newif\if@cref@stackempty%
2684 \newif\if@cref@stackfull%
2685 \def\cref@isstackempty#1{%
2686 \def\@tempa{\@nil}%
2687 \ifx#1\@tempa\@cref@stackemptytrue%
2688 \else\@cref@stackemptyfalse\fi}%
2689 \def\cref@isstackfull#1{%
2690 \def\@tempa{\@nil}%
2691 \ifx#1\@tempa\@cref@stackfullfalse%
2692 \else\@cref@stackfulltrue\fi}%
2693 % \end{macrocode}
2694 % \end{macro}
2695 % \end{macro}
2696 % \end{macro}
2697 % \end{macro}
2698 %
2699 % \begin{macro}{\cref@stack@dropempty}
2700 % Drop any empty references from head of a stack.
2701 % \begin{macrocode}
2702 \def\cref@stack@dropempty#1{%
2703 \edef\@tempa{\cref@stack@top{#1}}%
2704 \@whilesw\ifx\@tempa\@empty\fi{%
2705 \cref@stack@pop{#1}%
2706 \cref@isstackempty{#1}%
2707 \if@cref@stackempty%
2708 \let\@tempa\relax%
2709 \else%
2710 \edef\@tempa{\cref@stack@top{#1}}%
2711 \fi}}%
2712 % \end{macrocode}
2713 % \end{macro}
2714 %
2715 % \begin{macro}{\cref@stack@sort}
2716 % The \cmd{\cref@stack@sort} macro sorts a stack passed in |#2|, using
2717 % the comparison macro passed in |#1|, which we use later to sort lists
2718 % of references. We use insertion sort despite its $O(n^2)$ scaling
2719 % because it's simpler to code, and because we're very unlikely to
2720 % encounter lists of more than ten or so references, so in practice a
2721 % more complicated $O(n\log n)$ sorting algorithm will very likely be
2722 % slower anyway.
2723 % \begin{macrocode}
2724 \def\cref@stack@sort#1#2{%
2725 \begingroup%
2726 \cref@stack@init{\@sortstack}%
2727 % \end{macrocode}
2728 % Push first element into sorted stack.
2729 % \begin{macrocode}
2730 \edef\@element{\cref@stack@top{#2}}%
2731 \expandafter\cref@stack@push\expandafter{\@element}{\@sortstack}%
2732 \cref@stack@pop{#2}%
2733 % \end{macrocode}
2734 % If empty elements follow first one, need to add them after it in sorted
2735 % stack.
2736 % \begin{macrocode}
2737 \cref@isstackfull{#2}%
2738 \if@cref@stackfull%
2739 \edef\@tempa{\cref@stack@top{#2}}%
2740 \@whilesw\ifx\@tempa\@empty\fi{%
2741 \cref@stack@pull{}{\@sortstack}%
2742 \cref@stack@pop{#2}%
2743 \cref@isstackempty{#2}%
2744 \if@cref@stackempty%
2745 \let\@tempa\relax%
2746 \else%
2747 \edef\@tempa{\cref@stack@top{#2}}%
2748 \fi}%
2749 \fi%
2750 % \end{macrocode}
2751 % Process elements from stack.
2752 % \begin{macrocode}
2753 \cref@isstackfull{#2}%
2754 \@whilesw\if@cref@stackfull\fi{%
2755 \edef\@element{\cref@stack@top{#2}}%
2756 \cref@stack@pop{#2}%
2757 % \end{macrocode}
2758 % If empty elements follow current one, need to add them to sorted stack,
2759 % right after element we're currently dealing with.
2760 % \begin{macrocode}
2761 \def\@empties{}%
2762 \cref@isstackfull{#2}%
2763 \if@cref@stackfull%
2764 \edef\@tempa{\cref@stack@top{#2}}%
2765 \@whilesw\ifx\@tempa\@empty\fi{%
2766 \edef\@empties{\@empties,}%
2767 \cref@stack@pop{#2}%
2768 \cref@isstackempty{#2}%
2769 \if@cref@stackempty%
2770 \let\@tempa\relax%
2771 \else%
2772 \edef\@tempa{\cref@stack@top{#2}}%
2773 \fi}%
2774 \fi%
2775 % \end{macrocode}
2776 % Insert current element into sorted stack, appending any following empty
2777 % elements.
2778 % \begin{macrocode}
2779 \edef\@tempa{{\expandafter\noexpand\@element}%
2780 {\expandafter\noexpand\@empties}%
2781 {\noexpand\@sortstack}{\noexpand#1}}%
2782 \expandafter\cref@stack@insert\@tempa%
2783 \cref@isstackfull{#2}}%
2784 \expandafter\endgroup\expandafter%
2785 \def\expandafter#2\expandafter{\@sortstack}}%
2786 % \end{macrocode}
2787 % \end{macro}
2788 %
2789 % \begin{macro}{\cref@stack@insert}
2790 % \cmd{\cref@stack@insert}|{#1}{#2}{#3}{#4}| inserts |#1| into the
2791 % appropriate location in the sorted stack |#3| (appending |#2| onto
2792 % the end of |#1| when it's inserted), using the comparison macro |#4|.
2793 % \begin{macrocode}
2794 \def\cref@stack@insert#1#2#3#4{%
2795 \let\@cmp#4%
2796 \@cref@stack@insert{}{#1}{#2}{#3}%
2797 \cref@stack@pop{#3}}%
2798 % \end{macrocode}
2799 % \end{macro}
2800 % \begin{macro}{\@cref@stack@insert}
2801 % \cmd{\@cref@stack@insert}|{#1}{#2}{#3}{#4}| prepends |#1| to the
2802 % stack resulting from inserting |#2| (with |#3| appended to it) into
2803 % the sorted stack |#4|.
2804 % \begin{macrocode}
2805 \def\@cref@stack@insert#1#2#3#4{%
2806 \let\cref@iterate\relax%
2807 \cref@isstackempty{#4}%
2808 \if@cref@stackempty%
2809 \cref@stack@push{#1,#2#3}{#4}%
2810 \else%
2811 \edef\cref@elem{\cref@stack@top{#4}}%
2812 \expandafter\@cmp\expandafter{\cref@elem}{#2}{\cref@result}%
2813 \ifnum\cref@result=2\relax%
2814 \cref@stack@push{#1,#2#3}{#4}%
2815 \else%
2816 \cref@stack@pop{#4}%
2817 \edef\cref@elem{{\noexpand#1,\cref@elem}{\noexpand#2}%
2818 {\noexpand#3}{\noexpand#4}}%
2819 \expandafter\def\expandafter\cref@iterate\expandafter%
2820 {\expandafter\@cref@stack@insert\cref@elem}%
2821 \fi%
2822 \fi%
2823 \cref@iterate}%
2824 % \end{macrocode}
2825 % \end{macro}
2826 %
2827 %
2828 % \subsubsection{Reference comparison and sorting}
2829 % \begin{macro}{\cref@isrefsametype}
2830 % \begin{macro}{\if@cref@sametype}
2831 % Test if two references have same type, and set |\if@cref@sametype|
2832 % conditional accordingly.
2833 % \begin{macrocode}
2834 \newif\if@cref@sametype%
2835 \def\cref@isrefsametype#1#2{%
2836 \begingroup%
2837 % \end{macrocode}
2838 % Undefined references are treated as different from any other type, but
2839 % the same type as each other.
2840 % \begin{macrocode}
2841 \expandafter\ifx\csname r@#1@cref\endcsname\relax%
2842 \expandafter\ifx\csname r@#2@cref\endcsname\relax%
2843 \def\@after{\@cref@sametypetrue}%
2844 \else%
2845 \def\@after{\@cref@sametypefalse}%
2846 \fi%
2847 \else%
2848 \expandafter\ifx\csname r@#2@cref\endcsname\relax%
2849 \def\@after{\@cref@sametypefalse}%
2850 % \end{macrocode}
2851 % To test if two references have the same type, we actually compare the
2852 % expansion of |\cref@|\meta{type}|@format| rather than the \meta{type}
2853 % per se. This allows references with different counters but identical
2854 % formatting (e.g.\ equations and subequations with the default
2855 % formatting) to be typeset as part of the same reference group, which is
2856 % almost always what we want.
2857 % \begin{macrocode}
2858 \else%
2859 \cref@gettype{#1}{\@type}%
2860 \expandafter\expandafter\expandafter\def%
2861 \expandafter\expandafter\expandafter\@formata%
2862 \expandafter\expandafter\expandafter{%
2863 \csname cref@\@type @format\endcsname%
2864 {\@dummya}{\@dummyb}{\@dummyc}}%
2865 \cref@gettype{#2}{\@type}%
2866 \expandafter\expandafter\expandafter\def%
2867 \expandafter\expandafter\expandafter\@formatb%
2868 \expandafter\expandafter\expandafter{%
2869 \csname cref@\@type @format\endcsname%
2870 {\@dummya}{\@dummyb}{\@dummyc}}%
2871 \ifx\@formata\@formatb%
2872 \def\@after{\@cref@sametypetrue}%
2873 \else%
2874 \def\@after{\@cref@sametypefalse}%
2875 \fi%
2876 \fi%
2877 \fi%
2878 \expandafter\endgroup\@after}%
2879 % \end{macrocode}
2880 % \end{macro}
2881 % \end{macro}
2882 %
2883 % \begin{macro}{\cpageref@isrefsametype}
2884 % Test if two page references have same ``type'', and set
2885 % |\if@cref@sametype| conditional accordingly.
2886 % \begin{macrocode}
2887 \def\cpageref@isrefsametype#1#2{%
2888 \begingroup%
2889 % \end{macrocode}
2890 % Undefined references are treated as different from any other type, but
2891 % the same type as each other.
2892 % \begin{macrocode}
2893 \expandafter\ifx\csname r@#1@cref\endcsname\relax%
2894 \expandafter\ifx\csname r@#2@cref\endcsname\relax%
2895 \def\@after{\@cref@sametypetrue}%
2896 \else%
2897 \def\@after{\@cref@sametypefalse}%
2898 \fi%
2899 \else%
2900 \expandafter\ifx\csname r@#2@cref\endcsname\relax%
2901 \def\@after{\@cref@sametypefalse}%
2902 \else%
2903 \cpageref@gettype{#1}{\@typea}%
2904 \cpageref@gettype{#2}{\@typeb}%
2905 \ifx\@typea\@typeb%
2906 \def\@after{\@cref@sametypetrue}%
2907 \else%
2908 \def\@after{\@cref@sametypefalse}%
2909 \fi%
2910 \fi%
2911 \fi%
2912 \expandafter\endgroup\@after}%
2913 % \end{macrocode}
2914 % \end{macro}
2915 %
2916 % \begin{macro}{\cref@countercmp}
2917 % The \cmd{\cref@countercmp} macro compares references |#1| and |#2|
2918 % according to their respective sets of counter data (stored in the
2919 % \file{aux} file). It \cmd{\chardef}'s |#3| to 0 if they're equal, 1
2920 % if the first comes earlier than the second, or 2 if the first
2921 % reference comes later than the second. This is used later for sorting
2922 % references. \cmd{\cref@countercmp} compares the references
2923 % themselves, \cmd{\cpageref@countercmp} compares their page numbers.
2924 % \begin{macrocode}
2925 \def\cref@counter@first#1#2\@nil{#1}%
2926 \def\cref@counter@rest#1#2\@nil{#2}%
2927 \def\cref@countercmp{\@cref@countercmp{cref}}%
2928 \def\cpageref@countercmp{\@cref@countercmp{cpageref}}%
2929 \def\@cref@countercmp#1#2#3#4{%
2930 \begingroup%
2931 \def\@tempa{#2}%
2932 % \end{macrocode}
2933 % In order to ensure empty references end up in the right place when
2934 % sorting lists of multiple references, we make the comparison macro
2935 % sort them before a non-empty reference.
2936 % \begin{macrocode}
2937 \ifx\@tempa\@empty%
2938 \def\cref@result{1}%
2939 \else%
2940 \def\@tempa{#3}%
2941 \ifx\@tempa\@empty%
2942 \def\cref@result{2}%
2943 \else%
2944 % \end{macrocode}
2945 % Conversely, undefined references come after everything else.
2946 % \begin{macrocode}
2947 \expandafter\ifx\csname r@#2@cref\endcsname\relax%
2948 \def\cref@result{2}%
2949 \else%
2950 \expandafter\ifx\csname r@#3@cref\endcsname\relax%
2951 \def\cref@result{1}%
2952 \else%
2953 % \end{macrocode}
2954 % The real work of comparing two references is done by
2955 % \cmd{\@@cref@countercmp}.
2956 % \begin{macrocode}
2957 \csname #1@getcounter\endcsname{#2}{\@countera}%
2958 \csname #1@getprefix\endcsname{#2}{\@prefixa}%
2959 \csname #1@getcounter\endcsname{#3}{\@counterb}%
2960 \csname #1@getprefix\endcsname{#3}{\@prefixb}%
2961 \cref@stack@init{\@countstacka}%
2962 \expandafter\cref@stack@push\expandafter%
2963 {\@countera}{\@countstacka}%
2964 \ifx\@prefixa\@empty\else%
2965 \expandafter\cref@stack@push\expandafter%
2966 {\@prefixa}{\@countstacka}%
2967 \fi%
2968 \cref@stack@init{\@countstackb}%
2969 \expandafter\cref@stack@push\expandafter%
2970 {\@counterb}{\@countstackb}%
2971 \ifx\@prefixb\@empty\else%
2972 \expandafter\cref@stack@push\expandafter%
2973 {\@prefixb}{\@countstackb}%
2974 \fi%
2975 \@@cref@countercmp%
2976 \fi%
2977 \fi%
2978 \fi%
2979 \fi%
2980 \expandafter\endgroup\expandafter%
2981 \chardef\expandafter#4\expandafter=\cref@result\relax}%
2982 % \end{macrocode}
2983 % \end{macro}
2984 % \begin{macro}{\@@cref@countercmp}
2985 % The \cmd{\@@cref@countercmp} macro recursively compares counter
2986 % components until it runs out of components for one of the references,
2987 % or finds two corresponding components that are unequal.
2988 % \begin{macrocode}
2989 \def\@@cref@countercmp{%
2990 \let\@iterate\relax%
2991 \cref@isstackempty{\@countstacka}%
2992 \if@cref@stackempty%
2993 \cref@isstackempty{\@countstackb}%
2994 \if@cref@stackempty%
2995 \def\cref@result{0}%
2996 \else%
2997 \def\cref@result{1}%
2998 \fi%
2999 \else%
3000 \cref@isstackempty{\@countstackb}%
3001 \if@cref@stackempty%
3002 \def\cref@result{2}%
3003 \else%
3004 \edef\@tempa{\cref@stack@top{\@countstacka}}%
3005 \cref@stack@pop{\@countstacka}%
3006 \edef\@tempb{\cref@stack@top{\@countstackb}}%
3007 \cref@stack@pop{\@countstackb}%
3008 \ifnum\@tempa<\@tempb\relax%
3009 \def\cref@result{1}%
3010 \else%
3011 \ifnum\@tempa>\@tempb\relax%
3012 \def\cref@result{2}%
3013 \else%
3014 \def\@iterate{\@@cref@countercmp}%
3015 \fi%
3016 \fi%
3017 \fi%
3018 \fi%
3019 \@iterate}%
3020 % \end{macrocode}
3021 % \end{macro}
3022 %
3023 %
3024 % \begin{macro}{\if@cref@inresetlist}
3025 % \begin{macro}{\cref@isinresetlist}
3026 % \begin{macro}{\cref@resetby}
3027 % We need to be able to determine which counter is used to reset a
3028 % given counter. Usually, resets are done by sectioning counters, and
3029 % we assume that to be the case here. \cmd{\cref@isinresetlist}
3030 % searches through one counter's reset list, stored in
3031 % \cmd{\cl@\meta{counter}}, to determine whether another counter
3032 % appears there, and sets the new conditional
3033 % appropriately. \cmd{\cref@reset@by} searches through all the
3034 % sectioning counters' reset lists, from lowest-level (subsubsection)
3035 % to highest (part), checking whether the given counter is in the list,
3036 % and returns the first sectioning counter in whose list it appears.
3037 % (The value is returned by defining its second argument, which should
3038 % be a macro name.)
3039 % \begin{macrocode}
3040 \newif\if@cref@inresetlist%
3041 \def\cref@isinresetlist#1#2{%
3042 \begingroup%
3043 \def\@counter{#1}%
3044 % \end{macrocode}
3045 % We locally redefine \cmd{\@elt}, which appears at the head of the
3046 % expansion of |\cl@|\meta{counter}, so that entries in the reset list
3047 % end up separated by commas, thus can be treated as a stack.
3048 % \begin{macrocode}
3049 \def\@elt##1{##1,}%
3050 \expandafter\ifx\csname cl@#2\endcsname\relax%
3051 \def\cref@resetstack{,\@nil}%
3052 \else%
3053 \edef\cref@resetstack{\csname cl@#2\endcsname\noexpand\@nil}%
3054 \fi%
3055 \let\@nextcounter\relax%
3056 \cref@isstackfull{\cref@resetstack}%
3057 \@whilesw\if@cref@stackfull\fi{%
3058 \edef\@nextcounter{\cref@stack@top{\cref@resetstack}}%
3059 \ifx\@nextcounter\@counter%
3060 \@cref@stackfullfalse%
3061 \else%
3062 \let\@nextcounter\relax%
3063 \cref@stack@pop{\cref@resetstack}%
3064 \cref@isstackfull{\cref@resetstack}%
3065 \fi}%
3066 \ifx\@nextcounter\relax%
3067 \def\@next{\@cref@inresetlistfalse}%
3068 \else%
3069 \def\@next{\@cref@inresetlisttrue}%
3070 \fi%
3071 \expandafter%
3072 \endgroup%
3073 \@next}%
3074 % \end{macrocode}
3075 %
3076 % FIXME: We could easily remove the hard-coded search order in
3077 % \cmd{\cref@resetby} and, say, replace it with a customisable list of
3078 % counters to search in order. But, so far, I've yet to encounter a need
3079 % for anything other than the hard-coded default.
3080 % \begin{macrocode}
3081 \def\cref@resetby#1#2{%
3082 \let#2\relax%
3083 % \end{macrocode}
3084 % If counter in question is |subfigure| or |subtable|, check if it's
3085 % reset by |figure| or |table|, respectively.
3086 % \begin{macrocode}
3087 \cref@ifstreq{#1}{subfigure}{%
3088 \cref@isinresetlist{#1}{figure}%
3089 \if@cref@inresetlist%
3090 \def#2{figure}%
3091 \fi%
3092 }{}%
3093 \cref@ifstreq{#1}{subtable}{%
3094 \cref@isinresetlist{#1}{table}%
3095 \if@cref@inresetlist%
3096 \def#2{table}%
3097 \fi%
3098 }{}%
3099 % \end{macrocode}
3100 % If counter in question is |equation|, and the counter |parentequation|
3101 % is defined, check if it's reset by that. The |parentequation| counter
3102 % is used by \package{amsmath}'s |subequations| environment. Although
3103 % \package{amsmath} doesn't implement |subequations| using counter reset
3104 % lists, \package{cleveref}'s \package{amsmath} support tweaks the reset
3105 % lists inside |subequations| environments to hook into this mechanism.
3106 % We should really only check this when \package{amsmath} is loaded, but
3107 % checking it anyway might catch other packages that independently
3108 % implement amsmath's |subequations| environment (are there any?).
3109 % \begin{macrocode}
3110 \@ifundefined{cl@parentequation}{}{%
3111 \cref@ifstreq{#1}{equation}{%
3112 \cref@isinresetlist{#1}{parentequation}%
3113 \if@cref@inresetlist%
3114 \expandafter\ifnum\c@parentequation=0\else%
3115 \def#2{parentequation}%
3116 \fi%
3117 \fi%
3118 }{}}%
3119 % \end{macrocode}
3120 % \LaTeX{} hard-codes resetting of |enum|\meta{x} counters by
3121 % higher-level |enum|\meta{x} counters, so we hard-code the results for
3122 % these cases.
3123 % \begin{macrocode}
3124 \cref@ifstreq{#1}{enumii}{%
3125 \def#2{enumi}%
3126 }{%
3127 \cref@ifstreq{#1}{enumiii}{%
3128 \def#2{enumii}%
3129 }{%
3130 \cref@ifstreq{#1}{enumiv}{%
3131 \def#2{enumiii}%
3132 }{}%
3133 }%
3134 }%
3135 % \end{macrocode}
3136 % If we haven't found anything so far, check if it's reset by a
3137 % sectioning command.
3138 % \begin{macrocode}
3139 \ifx#2\relax%
3140 \cref@isinresetlist{#1}{table}%
3141 \if@cref@inresetlist%
3142 \def#2{table}%
3143 \else%
3144 \cref@isinresetlist{#1}{subsubsection}%
3145 \if@cref@inresetlist%
3146 \def#2{subsubsection}%
3147 \else%
3148 \cref@isinresetlist{#1}{subsection}%
3149 \if@cref@inresetlist%
3150 \def#2{subsection}%
3151 \else%
3152 \cref@isinresetlist{#1}{section}%
3153 \if@cref@inresetlist%
3154 \def#2{section}%
3155 \else%
3156 \cref@isinresetlist{#1}{chapter}%
3157 \if@cref@inresetlist%
3158 \def#2{chapter}%
3159 \else%
3160 \cref@isinresetlist{#1}{part}%
3161 \if@cref@inresetlist%
3162 \def#2{part}%
3163 \else%
3164 \let#2\relax%
3165 \fi%
3166 \fi%
3167 \fi%
3168 \fi%
3169 \fi%
3170 \fi%
3171 \fi}%
3172 % \end{macrocode}
3173 % \end{macro}
3174 % \end{macro}
3175 % \end{macro}
3176 %
3177 % \begin{macro}{\if@cref@refconsecutive}
3178 % \begin{macro}{\cref@isrefconsecutive}
3179 % \begin{macro}{\cpageref@isrefconsecutive}
3180 % Define a new conditional to test whether two references are
3181 % consecutive (needed when compressing references and typesetting
3182 % reference ranges). This uses the counter and prefix (i.e.\ chain of
3183 % counters that reset the reference's counter) information provided by
3184 % \cmd{\r@\meta{label}@cref} (via the \file{aux} file) to check if the
3185 % prefixes are identical (i.e.\ the references come from the same
3186 % chapter, section or whatever), and that the label counters differ
3187 % by~0 or~1. \cmd{\cref@isrefconsecutive} tests the references
3188 % themselves, \cmd{\cpageref@isrefconsecutve} tests their page numbers.
3189 % \begin{macrocode}
3190 \newif\if@cref@refconsecutive%
3191 \def\cref@isrefconsecutive{\@cref@isrefconsecutive{cref}}%
3192 \def\cpageref@isrefconsecutive{\@cref@isrefconsecutive{cpageref}}%
3193 \def\@cref@isrefconsecutive#1#2#3{%
3194 \begingroup%
3195 \def\@after{\@cref@refconsecutivefalse}%
3196 \expandafter\ifx\csname r@#2@cref\endcsname\relax\else%
3197 \expandafter\ifx\csname r@#3@cref\endcsname\relax\else%
3198 \countdef\refa@counter=0%
3199 \countdef\refb@counter=1%
3200 \csname #1@getcounter\endcsname{#2}{\cref@result}%
3201 \refa@counter=\cref@result%
3202 \csname #1@getcounter\endcsname{#3}{\cref@result}%
3203 \refb@counter=\cref@result%
3204 \csname #1@getprefix\endcsname{#2}{\refa@prefix}%
3205 \csname #1@getprefix\endcsname{#3}{\refb@prefix}%
3206 \ifx\refa@prefix\refb@prefix%
3207 \ifnum\refa@counter=\refb@counter\relax%
3208 \def\@after{\@cref@refconsecutivetrue}%
3209 \else%
3210 \advance\refa@counter 1\relax%
3211 \ifnum\refa@counter=\refb@counter\relax%
3212 \def\@after{\@cref@refconsecutivetrue}%
3213 \fi%
3214 \fi%
3215 \fi%
3216 \fi%
3217 \fi%
3218 \expandafter\endgroup\@after}%
3219 % \end{macrocode}
3220 % \end{macro}
3221 % \end{macro}
3222 % \end{macro}
3223 %
3224 %
3225 % \subsubsection{Reference stack processing}
3226 % \begin{macro}{\cref@processgroup}
3227 % \cmd{\cref@processgroup} processes the first group of references from
3228 % the stack passed in argument |#2|, by moving references to the stack
3229 % passed in argument |#3| until it encounters a reference that has a
3230 % different type to those that came before. Note that empty references
3231 % are treated as having the same type as the preceding one. If argument
3232 % |#1| is |cref| it processes references, it it's |cpageref| it
3233 % processes page references.
3234 % \begin{macrocode}
3235 \def\cref@processgroup#1#2#3{%
3236 \cref@stack@dropempty{#2}%
3237 \edef\@firstref{\cref@stack@top{#2}}%
3238 \let\@nextref\@firstref%
3239 \@cref@sametypetrue%
3240 \@whilesw\if@cref@sametype\fi{%
3241 \expandafter\cref@stack@pull\expandafter{\@nextref}{#3}%
3242 \cref@stack@pop{#2}%
3243 \cref@isstackempty{#2}%
3244 \if@cref@stackempty%
3245 \@cref@sametypefalse%
3246 \else%
3247 \edef\@nextref{\cref@stack@top{#2}}%
3248 \ifx\@nextref\@empty%
3249 \@cref@sametypetrue%
3250 \else%
3251 \csname #1@isrefsametype\endcsname{\@firstref}{\@nextref}%
3252 \fi%
3253 \fi}}%
3254 % \end{macrocode}
3255 % \end{macro}
3256 %
3257 % \begin{macro}{\cref@processgroupall}
3258 % \cmd{\cref@processgroupall} processes the first group of references
3259 % from the stack passed in argument |#2|, by moving all references with
3260 % the same type as the first one into the stack passed in argument
3261 % |#3|. If argument |#1| is |cref| it processes references, if it's
3262 % |cpageref| it processes page references.
3263 % \begin{macrocode}
3264 \def\cref@processgroupall#1#2#3{%
3265 \cref@stack@init{\@tempstack}%
3266 \cref@stack@dropempty{#2}%
3267 \edef\@firstref{\cref@stack@top{#2}}%
3268 \cref@isstackfull{#2}%
3269 \@whilesw\if@cref@stackfull\fi{%
3270 \edef\@nextref{\cref@stack@top{#2}}%
3271 \ifx\@nextref\@empty%
3272 \expandafter\cref@stack@pull\expandafter{\@nextref}{#3}%
3273 \else%
3274 \edef\@tempa{{\@firstref}{\@nextref}}%
3275 \csname #1@isrefsametype\expandafter\endcsname\@tempa%
3276 \if@cref@sametype%
3277 \expandafter\cref@stack@pull\expandafter{\@nextref}{#3}%
3278 \else%
3279 \expandafter\cref@stack@pull\expandafter{\@nextref}{\@tempstack}%
3280 \fi%
3281 \fi%
3282 \cref@stack@pop{#2}%
3283 \cref@isstackfull{#2}}%
3284 \let#2\@tempstack}%
3285 % \end{macrocode}
3286 % \end{macro}
3287 %
3288 %
3289 % \begin{macro}{\cref@processconsecutive}
3290 % \cmd{\cref@processconsecutive} processes the first sequence of
3291 % consecutive references from the stack passed in |#2|, sets the macro
3292 % passed as |#3| to the first reference in the sequence, sets |#4| to
3293 % the last reference, and sets the counter passed in |#5| to the number
3294 % of consecutive references in the sequence. If argument |#1| is |cref|
3295 % it processes references, if it's |cpageref| it processes page
3296 % references.
3297 % \begin{macrocode}
3298 \def\cref@processconsecutive#1#2#3#4#5{%
3299 % \end{macrocode}
3300 % Initialise return values to those appropriate for a single reference.
3301 % \begin{macrocode}
3302 \let#4\relax%
3303 #5=1\relax%
3304 \edef\@nextref{\cref@stack@top{#2}}%
3305 \edef#3{\@nextref}%
3306 \cref@stack@pop{#2}%
3307 \cref@isstackfull{#2}%
3308 % \end{macrocode}
3309 % If stack contains multiple references, find end of consecutive references.
3310 % \begin{macrocode}
3311 \if@cref@stackfull%
3312 \edef\@nextref{\cref@stack@top{#2}}%
3313 \expandafter\ifx\csname r@#3@cref\endcsname\relax%
3314 \@cref@refconsecutivefalse%
3315 \else%
3316 % \end{macrocode}
3317 % If next reference in stack is empty, it indicates that no
3318 % further compression should take place. Having served its purpose,
3319 % the empty reference and any consecutive empty references are
3320 % removed from the stack.
3321 % \begin{macrocode}
3322 \ifx\@nextref\@empty%
3323 \@cref@refconsecutivefalse%
3324 \cref@stack@dropempty{#2}%
3325 % \end{macrocode}
3326 % Otherwise, test whether next reference is consecutive or not.
3327 % \begin{macrocode}
3328 \else%
3329 \edef\@tempa{{#3}{\@nextref}}%
3330 \csname #1@isrefconsecutive\expandafter\endcsname\@tempa%
3331 \fi%
3332 \fi%
3333 % \end{macrocode}
3334 % Remove references from the stack until we find end of consecutive
3335 % sequence.
3336 % \begin{macrocode}
3337 \@whilesw\if@cref@refconsecutive\fi{%
3338 \advance#5 1\relax%
3339 \let#4\@nextref%
3340 \cref@stack@pop{#2}%
3341 \cref@isstackempty{#2}%
3342 \if@cref@stackempty%
3343 \@cref@refconsecutivefalse%
3344 \else%
3345 \edef\@nextref{\cref@stack@top{#2}}%
3346 % \end{macrocode}
3347 % If next reference is empty, remove any consecutive empty
3348 % references and we're done.
3349 % \begin{macrocode}
3350 \ifx\@nextref\@empty%
3351 \@cref@refconsecutivefalse%
3352 \@whilesw\ifx\@nextref\@empty\fi{%
3353 \cref@stack@pop{#2}%
3354 \cref@isstackempty{#2}%
3355 \if@cref@stackempty%
3356 \let\@nextref\relax%
3357 \else%
3358 \edef\@nextref{\cref@stack@top{#2}}%
3359 \fi}%
3360 % \end{macrocode}
3361 % Otherwise, test whether next reference is consecutive or not.
3362 % \begin{macrocode}
3363 \else%
3364 \edef\@tempa{{#4}{\@nextref}}%
3365 \csname #1@isrefconsecutive\expandafter\endcsname\@tempa%
3366 \fi%
3367 \fi}%
3368 \fi}%
3369 % \end{macrocode}
3370 % \end{macro}
3371 %
3372 %
3373 % \subsubsection{Prefix-stripping}
3374 % \begin{macro}{\crefstripprefix}
3375 % The \cmd{\crefstripprefix} utility command is intended for use in
3376 % cross-reference format definitions. It takes two strings of
3377 % characters as arguments, and strips any common prefix from the second
3378 % argument. The common prefix is only stripped up to the last sequence
3379 % of digits or letters in the second argument.
3380 % \begin{macrocode}
3381 \newcommand\crefstripprefix[2]{%
3382 \begingroup%
3383 \edef\@toksa{#1}%
3384 \edef\@toksb{#2}%
3385 \let\cref@acc\@empty%
3386 \@crefstripprefix%
3387 \cref@result%
3388 \endgroup}%
3389 % \end{macrocode}
3390 % \end{macro}
3391 %
3392 % The real work is done by the recursive \cmd{\@crefstripprefix} macro,
3393 % which compares characters one-by-one (accumulating runs of the same
3394 % type of character -- digit or letter as it goes). It removes matching
3395 % characters from the strings, and outputs the remaining characters
3396 % from the second string (plus any accumulated characters of the same
3397 % type) when it encounters the first non-matching character;
3398 % \begin{macrocode}
3399 \def\@crefstripprefix{%
3400 \let\@iterate\relax%
3401 \def\accum@flag{0}%
3402 % \end{macrocode}
3403 % Pop next characters from |\@toksa| and |\@toksb| string into |\@tempa|
3404 % and |\@tempb|, storing previous b-string character in |\@tempc|.
3405 % \begin{macrocode}
3406 \let\@tempc\@tempb%
3407 \cref@poptok{\@toksa}{\@tempa}%
3408 \cref@poptok{\@toksb}{\@tempb}%
3409 % \end{macrocode}
3410 % If characters match, drop character and proceed to next.
3411 % \begin{macrocode}
3412 \ifx\@tempa\@tempb\relax%
3413 \def\@iterate{\@crefstripprefix}%
3414 % \end{macrocode}
3415 % Accumulate popped character if accumulated string is empty\dots
3416 % \begin{macrocode}
3417 \ifx\cref@acc\@empty\relax%
3418 \let\cref@acc\@tempb%
3419 \else%
3420 % \end{macrocode}
3421 % or if it has same catcode as previous character, and is either a
3422 % letter\dots
3423 % \begin{macrocode}
3424 \ifcat\@tempb\@tempc\relax%
3425 \ifcat\@tempb a\relax%
3426 \def\accum@flag{1}%
3427 \else%
3428 % \end{macrocode}
3429 % or a digit.
3430 % \begin{macrocode}
3431 \expandafter\chardef\expandafter\@tempa%
3432 \expandafter=\expandafter`\@tempb\relax%
3433 \ifnum\@tempa>`/\relax%
3434 \expandafter\ifnum\@tempb<`:\relax%
3435 \def\accum@flag{1}%
3436 \fi%
3437 \fi%
3438 \fi%
3439 \fi%
3440 \def\@tempa{1}%
3441 \ifx\accum@flag\@tempa%
3442 \edef\cref@acc{\cref@acc\@tempb}%
3443 \else%
3444 \let\cref@acc\@empty%
3445 \fi%
3446 \fi%
3447 % \end{macrocode}
3448 % If characters don't match, return remaining characters from b-string,
3449 % prepending any accumulated characters.
3450 % \begin{macrocode}
3451 \else%
3452 \ifcat\@tempb\@tempc\relax\else%
3453 \let\cref@acc\@empty%
3454 \fi%
3455 \edef\cref@result{\cref@acc\@tempb\@toksb}%
3456 \fi%
3457 \@iterate}%
3458 % \end{macrocode}
3459 %
3460 % \begin{macro}{\cref@poptok}
3461 % The \cmd{\cref@poptok} macro takes two arguments, both macros. It
3462 % defines |#2| to be the first token in |#1|'s expansion, and removes
3463 % that token from |#1|'s definition.
3464 % \begin{macrocode}
3465 \def\cref@poptok#1#2{%
3466 \expandafter\expandafter\expandafter\def%
3467 \expandafter\expandafter\expandafter#2%
3468 \expandafter\expandafter\expandafter{%
3469 \expandafter\@cref@firsttok#1\@nil}%
3470 \expandafter\expandafter\expandafter\def%
3471 \expandafter\expandafter\expandafter#1%
3472 \expandafter\expandafter\expandafter{%
3473 \expandafter\@cref@poptok#1\@nil}}%
3474 \def\@cref@firsttok#1#2\@nil{#1}%
3475 \def\@cref@poptok#1#2\@nil{#2}%
3476 % \end{macrocode}
3477 % \end{macro}
3478 %
3479 %
3480 %
3481 % \subsection{Cross-Referencing Commands}
3482 % \begin{macro}{\cref}
3483 % \begin{macro}{\Cref}
3484 % \begin{macro}{\crefrange}
3485 % \begin{macro}{\Crefrange}
3486 % Define the main referencing command \cmd{\cref} and the
3487 % start-of-sentence variant \cmd{\Cref}, along with the reference range
3488 % commands \cmd{\crefrange} and \cmd{\Crefrange}.
3489 % \begin{macrocode}
3490 \DeclareRobustCommand{\cref}[1]{\@cref{cref}{#1}}%
3491 \DeclareRobustCommand{\Cref}[1]{\@cref{Cref}{#1}}%
3492 \DeclareRobustCommand{\crefrange}[2]{\@setcrefrange{#1}{#2}{}}%
3493 \DeclareRobustCommand{\Crefrange}[2]{\@setCrefrange{#1}{#2}{}}%
3494 % \end{macrocode}
3495 % \end{macro}
3496 % \end{macro}
3497 % \end{macro}
3498 % \end{macro}
3499 %
3500 % \begin{macro}{\if@crefstarred}
3501 % The |\if@crefstarred| flag is set within starred variants of
3502 % \package{cleveref} commands. Starred variants are only defined if
3503 % either the \package{hyperref} or \package{varioref} package is
3504 % loaded, so we only define it in those cases. We need to |\let|
3505 % |\if@crefstarred| to something even when not using it, otherwise
3506 % \TeX{} gets confused when parsing code that contains
3507 % |\if@crefstarred| inside a nested if.
3508 % \begin{macrocode}
3509 \@ifpackageloaded{hyperref}{\newif\if@crefstarred}{%
3510 \@ifpackageloaded{varioref}{\newif\if@crefstarred}{}}%
3511 \let\if@crefstarred\iffalse%
3512 % \end{macrocode}
3513 % \end{macro}
3514 %
3515 % \begin{macro}{\@cref}
3516 % To save duplicating code, the referencing macros pass an argument
3517 % determining the variant to an auxiliary macro \cmd{\@cref}, which
3518 % does the real work. The \cmd{\@cref} macro is the behemoth at the
3519 % heart of all the clever referencing features. It deals with grouping
3520 % references by type, typesetting the conjunctions between groups,
3521 % choosing the right formatting macro to use for each reference, and
3522 % compressing consecutive references into ranges.
3523 % \begin{macrocode}
3524 \def\@cref#1#2{%
3525 \leavevmode%
3526 \begingroup%
3527 \def\cref@variant{#1}%
3528 \def\@tempa{\in@{page}}%
3529 \expandafter\@tempa\expandafter{\cref@variant}%
3530 \ifin@%
3531 \def\cref@variant@get{cpageref}%
3532 \else%
3533 \def\cref@variant@get{cref}%
3534 \fi%
3535 % \end{macrocode}
3536 % Initialise some things, and put all the references into a stack called
3537 % \cmd{\@refstack}. Note that we fully expand the second argument, in
3538 % case it contains commands that \emph{expand to} label names, rather
3539 % than label names per se.
3540 % \begin{macrocode}
3541 \countdef\count@consecutive=0%
3542 \countdef\count@group=1%
3543 \count@group=1%
3544 \countdef\count@subgroup=2%
3545 \cref@stack@init{\@refstack}%
3546 \edef\@tempa{#2}%
3547 \expandafter\cref@stack@push\expandafter{\@tempa}{\@refstack}%
3548 \cref@isstackfull{\@refstack}%
3549 % \end{macrocode}
3550 %
3551 % Loop until the reference stack is empty.
3552 % \begin{macrocode}
3553 \@whilesw\if@cref@stackfull\fi{%
3554 % \end{macrocode}
3555 % Move next group of references with same type into \cmd{\@refsubstack}.
3556 % \begin{macrocode}
3557 \cref@stack@init{\@refsubstack}%
3558 \if@cref@sort%
3559 \expandafter\cref@processgroupall\expandafter%
3560 {\cref@variant@get}{\@refstack}{\@refsubstack}%
3561 \expandafter\cref@stack@sort\expandafter%
3562 {\csname\cref@variant@get @countercmp\endcsname}{\@refsubstack}%
3563 \else%
3564 \expandafter\cref@processgroup\expandafter%
3565 {\cref@variant@get}{\@refstack}{\@refsubstack}%
3566 \fi%
3567 % \end{macrocode}
3568 %
3569 % Typeset appropriate conjunction between groups of reference types.
3570 % \begin{macrocode}
3571 \ifnum\count@group=1\relax%
3572 \advance\count@group 1\relax%
3573 \else%
3574 \cref@isstackfull{\@refstack}%
3575 \if@cref@stackfull%
3576 \@setcref@middlegroupconjunction%
3577 \else%
3578 \ifnum\count@group=2\relax%
3579 \@setcref@pairgroupconjunction%
3580 \else%
3581 \@setcref@lastgroupconjunction%
3582 \fi%
3583 \fi%
3584 \advance\count@group 1\relax%
3585 \lowercase{\def\cref@variant{#1}}%
3586 \fi%
3587 % \end{macrocode}
3588 %
3589 % Process groups of consecutive references until substack is empty.
3590 % \begin{macrocode}
3591 \count@subgroup=1%
3592 \cref@isstackfull{\@refsubstack}%
3593 \@whilesw\if@cref@stackfull\fi{%
3594 \if@cref@compress%
3595 \expandafter\cref@processconsecutive\expandafter{\cref@variant@get}%
3596 {\@refsubstack}{\@beginref}{\@endref}{\count@consecutive}%
3597 % \end{macrocode}
3598 % Empty references serve no purpose when we're not compressing, so we
3599 % simply remove them and process the first non-empty reference..
3600 % \begin{macrocode}
3601 \else%
3602 \cref@stack@dropempty{\@refsubstack}%
3603 \edef\@beginref{\cref@stack@top{\@refsubstack}}%
3604 \cref@stack@pop{\@refsubstack}%
3605 \let\@endref\relax%
3606 \count@consecutive=1\relax%
3607 \fi%
3608 % \end{macrocode}
3609 % If the start and end labels are identical, treat it as a single
3610 % reference instead of a range
3611 % \begin{macrocode}
3612 \ifnum\count@consecutive>1\relax%
3613 \csname\cref@variant@get @getlabel\endcsname{\@beginref}{\@labela}%
3614 \csname\cref@variant@get @getlabel\endcsname{\@endref}{\@labelb}%
3615 \ifx\@labela\@labelb%
3616 \let\@endref\relax%
3617 \count@consecutive=1\relax%
3618 \fi%
3619 \fi%
3620 % \end{macrocode}
3621 % If there were only two consecutive references, keep the first one and
3622 % return the second one to the substack. (We add an empty reference after
3623 % it just to make sure there's no further compression.)
3624 % \begin{macrocode}
3625 \ifnum\count@consecutive=2\relax%
3626 \expandafter\cref@stack@push\expandafter{\@endref,}{\@refsubstack}%
3627 \let\@endref\relax%
3628 \count@consecutive=1\relax%
3629 \fi%
3630 % \end{macrocode}
3631 % Work out which type of reference we need to typeset.
3632 % \begin{macrocode}
3633 \cref@isstackfull{\@refsubstack}%
3634 \if@cref@stackfull%
3635 \ifnum\count@subgroup=1\relax%
3636 \def\@pos{@first}%
3637 \else%
3638 \def\@pos{@middle}%
3639 \fi%
3640 \else%
3641 \ifnum\count@subgroup=1\relax%
3642 \def\@pos{}%
3643 \else%
3644 \ifnum\count@subgroup=2\relax%
3645 \def\@pos{@second}%
3646 \else%
3647 \def\@pos{@last}%
3648 \fi%
3649 \fi%
3650 \fi%
3651 % \end{macrocode}
3652 % If there were no consecutive references, just typeset the next
3653 % reference;
3654 % \begin{macrocode}
3655 \ifnum\count@consecutive=1\relax%
3656 \edef\@tempa{{\@beginref}{\@pos}}%
3657 \csname @set\cref@variant\expandafter\endcsname\@tempa%
3658 % \end{macrocode}
3659 % otherwise, typeset a reference range.
3660 % \begin{macrocode}
3661 \else%
3662 \edef\@tempa{{\@beginref}{\@endref}{\@pos}}%
3663 \csname @set\cref@variant range\expandafter\endcsname\@tempa%
3664 \fi%
3665 \advance\count@subgroup 1\relax%
3666 \cref@isstackfull{\@refsubstack}%
3667 }% end loop over reference substack
3668 \cref@isstackfull{\@refstack}%
3669 % \end{macrocode}
3670 %
3671 % If we're typesetting a \cmd{\labelcref} reference and references in
3672 % stack have different types, throw a warning and stop processing.
3673 % \begin{macrocode}
3674 \if@cref@stackfull%
3675 \def\@tempa{labelcref}%
3676 \ifx\cref@variant\@tempa%
3677 \protect\G@refundefinedtrue%
3678 \nfss@text{\reset@font\bfseries\space ??}%
3679 \@latex@warning{References in label reference on page \thepage
3680 \space have different types}%
3681 \@cref@stackfullfalse%
3682 \fi%
3683 \fi%
3684 }% end loop over main reference stack
3685 \endgroup}%
3686 % \end{macrocode}
3687 % \end{macro}
3688 %
3689 %
3690 % \begin{macro}{\@setcref}
3691 % \begin{macro}{\@setCref}
3692 % \begin{macro}{\@setlavelcref}
3693 % \begin{macro}{\@@setcref}
3694 % The \cmd{\@setcref}, \cmd{\@setCref} and \cmd{\@setlabelcref} macros
3695 % are called as appropriate by \cmd{\@cref} to typeset a reference.
3696 % These macros just turn the |cref|, |Cref| or |labelcref| variant into
3697 % a macro argument and pass it along to \cmd{\@@setcref}, which deals
3698 % with actually typesetting the reference by calling the appropriate
3699 % type-dependent formatting macro defined by \cmd{\crefformat} etc.
3700 % \cmd{\@@setcref} takes three arguments. |#1| is the variant passed
3701 % along by |\@set|\meta{x}|ref|. |#2| contains the reference itself.
3702 % |#3| is either empty or one of ``@second'', ``@middle'' or ``@last'',
3703 % determining the type of reference group to typeset.
3704 % \begin{macrocode}
3705 \def\@setcref{\@@setcref{cref}}%
3706 \def\@setCref{\@@setcref{Cref}}%
3707 \def\@setlabelcref{\@@setcref{labelcref}}%
3708 \def\@@setcref#1#2#3{%
3709 \expandafter\ifx\csname r@#2@cref\endcsname\relax%
3710 \protect\G@refundefinedtrue%
3711 \nfss@text{\reset@font\bfseries ??}%
3712 \@latex@warning{Reference `#2' on page \thepage \space undefined}%
3713 \else%
3714 \cref@gettype{#2}{\@temptype}% puts label type in \@temptype
3715 \cref@getlabel{#2}{\@templabel}% puts label in \@templabel
3716 \expandafter\ifx\csname #1@\@temptype @format#3\endcsname\relax%
3717 % \end{macrocode}
3718 % If reference format is undefined, but we're typesetting a
3719 % \cmd{\labelcref}, fall back to default \cmd{\labelcref} format.
3720 % \begin{macrocode}
3721 \edef\@tempa{#1}\def\@tempb{labelcref}%
3722 \ifx\@tempa\@tempb\relax%
3723 \expandafter\@@@setcref\expandafter%
3724 {\csname #1@default@format#3\endcsname}{#2}%
3725 \else%
3726 \protect\G@refundefinedtrue%
3727 \nfss@text{\reset@font\bfseries ??}~\@templabel%
3728 \@latex@warning{#1\space reference format for label type
3729 `\@temptype' undefined}%
3730 \fi%
3731 \else%
3732 \expandafter\@@@setcref\expandafter%
3733 {\csname #1@\@temptype @format#3\endcsname}{#2}%
3734 \fi%
3735 \fi}%
3736 % \end{macrocode}
3737 % \end{macro}
3738 % \end{macro}
3739 % \end{macro}
3740 % \end{macro}
3741 %
3742 % \begin{macro}{\@@@setcref}
3743 % We separate out the very final typesetting step into a separate
3744 % macro, in order to make it easier to redefine things later to make
3745 % them work with the \package{hyperref} package.
3746 % \begin{macrocode}
3747 \def\@@@setcref#1#2{\cref@getlabel{#2}{\@templabel}#1{\@templabel}{}{}}%
3748 % \end{macrocode}
3749 % \end{macro}
3750 %
3751 % \begin{macro}{\@setcrefrange}
3752 % \begin{macro}{\@setCrefrange}
3753 % \begin{macro}{\@setlabelcrefrange}
3754 % \begin{macro}{\@@setcrefrange}
3755 % The \cmd{\@setcrefrange}, \cmd{\@setCrefrange} and
3756 % \cmd{\@setlabelrefrange} macros are called as appropriate by
3757 % \cmd{\@cref} to typeset a reference. The internal
3758 % \cmd{\@@setcrefrange} macro deals with actually typesetting reference
3759 % ranges, and takes four arguments. |#1| is the variant passed along by
3760 % |\@set|\meta{x}|ref|. |#2| and |#3| contains the references
3761 % themselves. |#4| is either empty or one of ``@second'', ``@middle''
3762 % or ``@last'', determining the type of reference group to typeset.
3763 %
3764 % The actual typesetting is no more complicated than in the
3765 % \cmd{\@@setcref} case; it's the error checking that makes the code
3766 % longer. We now have to check whether \emph{two} references are
3767 % undefined, whether \emph{two} reference formats are undefined,
3768 % whether the reference types are consistent, and also combinations of
3769 % these various errors.
3770 % \begin{macrocode}
3771 \def\@setcrefrange{\@@setcrefrange{cref}}%
3772 \def\@setCrefrange{\@@setcrefrange{Cref}}%
3773 \def\@setlabelcrefrange{\@@setcrefrange{labelcref}}%
3774 \def\@@setcrefrange#1#2#3#4{%
3775 \begingroup%
3776 % \end{macrocode}
3777 % Check if both references are defined.
3778 % \begin{macrocode}
3779 \expandafter\ifx\csname r@#2@cref\endcsname\relax%
3780 \protect\G@refundefinedtrue%
3781 \@latex@warning{Reference `#2' on page \thepage \space%
3782 undefined}%
3783 \expandafter\ifx\csname r@#3@cref\endcsname\relax%
3784 \nfss@text{\reset@font\bfseries ??}--%
3785 \nfss@text{\reset@font\bfseries ??}%
3786 \@latex@warning{Reference `#3' on page \thepage \space%
3787 undefined}%
3788 \else%
3789 \cref@getlabel{#3}{\@labelb}%
3790 \nfss@text{\reset@font\bfseries ??}--\@labelb%
3791 \fi%
3792 \else%
3793 \expandafter\ifx\csname r@#3@cref\endcsname\relax%
3794 \protect\G@refundefinedtrue%
3795 \cref@getlabel{#2}{\@labela}%
3796 \@labela--\nfss@text{\reset@font\bfseries ??}%
3797 \@latex@warning{Reference `#3' on page \thepage %
3798 \space undefined}%
3799 % \end{macrocode}
3800 % If both references are defined, check that the reference format is
3801 % defined.
3802 % \begin{macrocode}
3803 \else%
3804 \cref@gettype{#2}{\@typea}%
3805 \cref@gettype{#3}{\@typeb}%
3806 \cref@getlabel{#2}{\@labela}%
3807 \cref@getlabel{#3}{\@labelb}%
3808 \edef\@format{\expandafter\noexpand%
3809 \csname #1range@\@typea @format#4\endcsname}%
3810 \expandafter\ifx\@format\relax%
3811 % \end{macrocode}
3812 % If reference format is undefined, but we're typesetting a
3813 % \cmd{\labelcref}, fall back to default \cmd{\labelcref}
3814 % formats.
3815 % \begin{macrocode}
3816 \edef\@tempa{#1}\def\@tempb{labelcref}%
3817 \ifx\@tempa\@tempb\relax%
3818 \expandafter\@@@setcrefrange\expandafter%
3819 {\csname #1range@default@format#4\endcsname}{#2}{#3}%
3820 \else%
3821 \protect\G@refundefinedtrue%
3822 \nfss@text{\reset@font\bfseries ??}~\@labela--\@labelb%
3823 \@latex@warning{#1 reference range format for label
3824 type `\@typea' undefined}%
3825 \fi%
3826 \else%
3827 % \end{macrocode}
3828 % If reference types are identical, typeset reference range,
3829 % otherwise display warning.\\
3830 % (Note: there's no need to check if reference format for second type
3831 % is defined, since if it isn't it will be caught here as a
3832 % non-identical type.)
3833 % \begin{macrocode}
3834 \expandafter\expandafter\expandafter\def%
3835 \expandafter\expandafter\expandafter\@formata%
3836 \expandafter\expandafter\expandafter{%
3837 \csname #1range@\@typea @format#4\endcsname%
3838 {\@dummya}{\@dummyb}{\@dummyc}{\@dummyd}{\@dummye}{\@dummyf}}%
3839 \expandafter\expandafter\expandafter\def%
3840 \expandafter\expandafter\expandafter\@formatb%
3841 \expandafter\expandafter\expandafter{%
3842 \csname #1range@\@typeb @format#4\endcsname%
3843 {\@dummya}{\@dummyb}{\@dummyc}{\@dummyd}{\@dummye}{\@dummyf}}%
3844 \ifx\@formata\@formatb%
3845 \expandafter\@@@setcrefrange\expandafter{\@format}{#2}{#3}%
3846 \else%
3847 \protect\G@refundefinedtrue%
3848 \nfss@text{\reset@font\bfseries ??}~\@labela--\@labelb%
3849 \@latex@warning{References `#2' and `#3' in reference range
3850 on page \thepage \space have different types
3851 `\@typea' and `\@typeb'}%
3852 \fi%
3853 \fi%
3854 \fi%
3855 \fi%
3856 \endgroup}%
3857 % \end{macrocode}
3858 % \end{macro}
3859 % \end{macro}
3860 % \end{macro}
3861 % \end{macro}
3862 %
3863 % \begin{macro}{\@@@setcrefrange}
3864 % We again separate out the very final typesetting step into a
3865 % separate macro, in order to make it easier to redefine things later
3866 % to make them work with the \package{hyperref} package.
3867 % \begin{macrocode}
3868 \def\@@@setcrefrange#1#2#3{%
3869 \cref@getlabel{#2}{\@labela}%
3870 \cref@getlabel{#3}{\@labelb}%
3871 #1{\@labela}{\@labelb}{}{}{}{}}%
3872 % \end{macrocode}
3873 % \end{macro}
3874 %
3875 %
3876 % The typesetting of conjunctions is also separated out into separate
3877 % macros, for the same reason.
3878 % \begin{macrocode}
3879 \def\@setcref@pairgroupconjunction{\crefpairgroupconjunction}%
3880 \def\@setcref@middlegroupconjunction{\crefmiddlegroupconjunction}%
3881 \def\@setcref@lastgroupconjunction{\creflastgroupconjunction}%
3882 % \end{macrocode}
3883 %
3884 % \begin{macro}{\labelcref}
3885 % \begin{macro}{\namecref}
3886 % \begin{macro}{\nameCref}
3887 % \begin{macro}{\lcnamecref}
3888 % \begin{macro}{\namecrefs}
3889 % \begin{macro}{\nameCrefs}
3890 % \begin{macro}{\lcnamecrefs}
3891 % Finally, we define a \cmd{\labelcref} command that returns just the
3892 % typeset label part of a (multi-)reference, without the reference
3893 % name, and conversely \cmd{\namecref}, \cmd{\nameCref},
3894 % \cmd{\namecrefs} and \cmd{\nameCrefs} commands that return just the
3895 % typeset name of a reference, without the reference label. The latter
3896 % four retrieve the reference name from the corresponding
3897 % \cmd{\crefname} or \cmd{\Crefname} definition, so they only work when
3898 % this has been defined. We also define \cmd{\lcnamecref} and
3899 % \cmd{\lcnamecrefs} commands which force the reference name to
3900 % lowercase, for use when the \option{capitalise} option is enabled.
3901 % \begin{macrocode}
3902 \DeclareRobustCommand{\labelcref}[1]{\@cref{labelcref}{#1}}%
3903 \DeclareRobustCommand{\namecref}[1]{%
3904 \@setnamecref{cref}{#1}{}{}}%
3905 \DeclareRobustCommand{\nameCref}[1]{%
3906 \@setnamecref{Cref}{#1}{}{}}%
3907 \DeclareRobustCommand{\lcnamecref}[1]{%
3908 \@setnamecref{Cref}{#1}{}{\MakeLowercase}}%
3909 \DeclareRobustCommand{\namecrefs}[1]{%
3910 \@setnamecref{cref}{#1}{@plural}{}}%
3911 \DeclareRobustCommand{\nameCrefs}[1]{%
3912 \@setnamecref{Cref}{#1}{@plural}{}}%
3913 \DeclareRobustCommand{\lcnamecrefs}[1]{%
3914 \@setnamecref{Cref}{#1}{@plural}{\MakeLowercase}}%
3915 % \end{macrocode}
3916 % \end{macro}
3917 % \end{macro}
3918 % \end{macro}
3919 % \end{macro}
3920 % \end{macro}
3921 % \end{macro}
3922 % \end{macro}
3923 %
3924 % \begin{macro}{\@setnamecref}
3925 % \cmd{\@setnamecref} is the real macro underlying all the
3926 % \cmd{\namecref} commands. |#1| is the capitalisation variant, |#2|
3927 % the reference, |#3| is either empty or |@plural| if the plural name
3928 % should be generated, and |#4| is either empty or contains
3929 % \cmd{\MakeLowercase} if a lower-cased name should be generated.
3930 % \begin{macrocode}
3931 \def\@setnamecref#1#2#3#4{%
3932 \expandafter\ifx\csname r@#2@cref\endcsname\relax%
3933 \protect\G@refundefinedtrue%
3934 \nfss@text{\reset@font\bfseries ??}%
3935 \@latex@warning{Reference `#2' on page \thepage \space undefined}%
3936 \else%
3937 \cref@gettype{#2}{\@tempa}%
3938 \@ifundefined{#1@\@tempa @name#3}{%
3939 \protect\G@refundefinedtrue%
3940 \nfss@text{\reset@font\bfseries ??}%
3941 \@latex@warning{Reference name for label type `\@tempa' undefined}%
3942 }{%
3943 \edef\@tempa{%
3944 \expandafter\noexpand\csname #1@\@tempa @name#3\endcsname}%
3945 \expandafter\@@@setnamecref\expandafter{\@tempa}{#4}%
3946 }%
3947 \fi}%
3948 % \end{macrocode}
3949 % \end{macro}
3950 %
3951 % \begin{macro}{\@@@setnamecref}
3952 % We again separate out the final typesetting step of the
3953 % \cmd{\namecref} commands.
3954 % \begin{macrocode}
3955 \def\@@@setnamecref#1#2{%
3956 \expandafter\def\expandafter\@tempa\expandafter{#1}%
3957 \expandafter#2\@tempa}%
3958 % \end{macrocode}
3959 % \end{macro}
3960 %
3961 %
3962 %
3963 % \subsection{Page-Referencing Commands}
3964 % \begin{macro}{\cpageref}
3965 % \begin{macro}{\Cpageref}
3966 % \begin{macro}{\cpagerefrange}
3967 % \begin{macro}{\Cpagerefrange}
3968 % Define the main page referencing command \cmd{\cpageref} and the
3969 % start-of-sentence variant \cmd{\Cpageref}, along with the
3970 % \cmd{\cpagerefrange} and \cmd{\Cpagerefrange} page range referencing
3971 % commands, and \cmd{\labelcpageref} (the counterpart to
3972 % \cmd{\labelcref}).
3973 % \begin{macrocode}
3974 \DeclareRobustCommand{\cpageref}[1]{\@cref{cpageref}{#1}}%
3975 \DeclareRobustCommand{\Cpageref}[1]{\@cref{Cpageref}{#1}}%
3976 \DeclareRobustCommand{\cpagerefrange}[2]{%
3977 \@@setcpagerefrange{#1}{#2}{cref}{}}%
3978 \DeclareRobustCommand{\Cpagerefrange}[2]{%
3979 \@@setcpagerefrange{#1}{#2}{Cref}{}}%
3980 \DeclareRobustCommand{\labelcpageref}[1]{%
3981 \@cref{labelcpageref}{#1}}%
3982 % \end{macrocode}
3983 % \end{macro}
3984 % \end{macro}
3985 % \end{macro}
3986 % \end{macro}
3987 %
3988 % \begin{macro}{\@setcpageref}
3989 % \begin{macro}{\@setCpageref}
3990 % \begin{macro}{\@setlabelcpageref}
3991 % \begin{macro}{\@@setcpageref}
3992 % The \cmd{\@setcpageref}, \cmd{\@setCpageref} and
3993 % \cmd{\@setlabelcpageref} macros are called as appropriate by
3994 % \cmd{\@cref} to typeset a page reference. These macros just turn the
3995 % |cref|, |Cref| or |labelcref| variant into a macro argument and pass
3996 % it along to \cmd{\@@setcpageref}, which deals with actually
3997 % typesetting the page reference by calling the appropriate page
3998 % reference formatting macro defined by \cmd{\crefformat}|{page}| etc.
3999 % \cmd{\@@setcpageref} takes four arguments. |#1| is the variant passed
4000 % along by |\@set|\meta{x}|pageref|. |#2| contains the reference
4001 % itself. |#3| is either empty or one of ``@second'', ``@middle'' or
4002 % ``@last'', determining the type of page reference group to typeset.
4003 % \begin{macrocode}
4004 \def\@setcpageref{\@@setcpageref{cref}}
4005 \def\@setCpageref{\@@setcpageref{Cref}}
4006 \def\@setlabelcpageref{\@@setcpageref{labelcref}}
4007 \def\@@setcpageref#1#2#3{%
4008 \expandafter\ifx\csname r@#2@cref\endcsname\relax%
4009 \protect\G@refundefinedtrue%
4010 \nfss@text{\reset@font\bfseries ??}%
4011 \@latex@warning{Reference `#2' on page \thepage \space undefined}%
4012 \else%
4013 \cpageref@getlabel{#2}{\@temppage}%
4014 \expandafter\ifx\csname #1@page@format#3\endcsname\relax%
4015 % \end{macrocode}
4016 % If reference format is undefined, but we're typesetting a
4017 % \cmd{\labelcpageref}, fall back to default \cmd{\labelcref} format.
4018 % \begin{macrocode}
4019 \edef\@tempa{#1}\def\@tempb{labelcref}%
4020 \ifx\@tempa\@tempb\relax%
4021 \expandafter\@@@setcpageref\expandafter%
4022 {\csname #1@default@format#3\endcsname}{#2}%
4023 \else%
4024 \protect\G@refundefinedtrue%
4025 \nfss@text{\reset@font\bfseries ??}~\@temppage%
4026 \@latex@warning{ #1 reference format for
4027 page references undefined}%
4028 \fi%
4029 \else%
4030 \expandafter\@@@setcpageref\expandafter%
4031 {\csname #1@page@format#3\endcsname}{#2}%
4032 \fi%
4033 \fi}%
4034 % \end{macrocode}
4035 % \end{macro}
4036 %
4037 % \begin{macro}{\@@@setcpageref}
4038 % We separate out the very final typesetting step into a separate
4039 % macro, in order to make it easier to redefine things later to make
4040 % them work with the \package{hyperref} package.
4041 % \begin{macrocode}
4042 \def\@@@setcpageref#1#2{%
4043 \cpageref@getlabel{#2}{\@temppage}#1{\@temppage}{}{}}%
4044 % \end{macrocode}
4045 % \end{macro}
4046 % \end{macro}
4047 % \end{macro}
4048 % \end{macro}
4049 %
4050 % \begin{macro}{\@@setcpagerefrange}
4051 % The \cmd{\@@setcpagerefrange} macro deals with typesetting page range
4052 % references, just as \cmd{\@@setcpageref} does for normal page
4053 % references.
4054 % \begin{macrocode}
4055 \def\@@setcpagerefrange#1#2#3#4{%
4056 \begingroup%
4057 % \end{macrocode}
4058 % Check if both references are defined.
4059 % \begin{macrocode}
4060 \expandafter\ifx\csname r@#1@cref\endcsname\relax%
4061 \protect\G@refundefinedtrue%
4062 \@latex@warning{Reference `#1' on page \thepage \space%
4063 undefined}%
4064 \expandafter\ifx\csname r@#2@cref\endcsname\relax%
4065 \nfss@text{\reset@font\bfseries ??}--%
4066 \nfss@text{\reset@font\bfseries ??}%
4067 \@latex@warning{Reference `#2' on page \thepage \space%
4068 undefined}%
4069 \else%
4070 \cpageref@getlabel{#2}{\@pageb}%
4071 \nfss@text{\reset@font\bfseries ??}--\@pageb%
4072 \fi%
4073 \else%
4074 \expandafter\ifx\csname r@#2@cref\endcsname\relax%
4075 \protect\G@refundefinedtrue%
4076 \cpageref@getlabel{#1}{\@pagea}%
4077 \@pagea--\nfss@text{\reset@font\bfseries ??}%
4078 \@latex@warning{Reference `#2' on page \thepage %
4079 \space undefined}%
4080 % \end{macrocode}
4081 % If both references are defined, check that the reference format is
4082 % defined.
4083 % \begin{macrocode}
4084 \else%
4085 \cpageref@getlabel{#1}{\@pagea}%
4086 \cpageref@getlabel{#2}{\@pageb}%
4087 \edef\@format{\expandafter\noexpand%
4088 \csname#3range@page@format#4\endcsname}%
4089 \expandafter\ifx\@format\relax%
4090 % \end{macrocode}
4091 % If page reference format is undefined, but we're typesetting a
4092 % \cmd{\labelcpageref}, fall back to default \cmd{\labelcref}
4093 % formats.
4094 % \begin{macrocode}
4095 \edef\@tempa{#3}\def\@tempb{labelcref}%
4096 \ifx\@tempa\@tempb\relax%
4097 \expandafter\@@@setcpagerefrange\expandafter%
4098 {\csname#3range@default@format#4\endcsname}{#1}{#2}%
4099 \else%
4100 \protect\G@refundefinedtrue%
4101 \nfss@text{\reset@font\bfseries ??}~\@pagea--\@pageb%
4102 \@latex@warning{#3 reference range format for page
4103 references undefined}%
4104 \fi%
4105 \else%
4106 % \end{macrocode}
4107 % typeset page reference range,
4108 % \begin{macrocode}
4109 \expandafter\@@@setcpagerefrange\expandafter{\@format}{#1}{#2}%
4110 \fi%
4111 \fi%
4112 \fi%
4113 \endgroup}%
4114 % \end{macrocode}
4115 % \end{macro}
4116 %
4117 % \begin{macro}{\@@@setcpagerefrange}
4118 % We again separate out the very final typesetting step into a
4119 % separate macro, in order to make it easier to redefine things later
4120 % to make them work with the \package{hyperref} package.
4121 % \begin{macrocode}
4122 \def\@@@setcpagerefrange#1#2#3{%
4123 \cpageref@getlabel{#2}{\@pagea}%
4124 \cpageref@getlabel{#3}{\@pageb}%
4125 #1{\@pagea}{\@pageb}{}{}{}{}}%
4126 % \end{macrocode}
4127 % \end{macro}
4128 %
4129 %
4130 %
4131 % \subsection{Reference Format Customisation Commands}
4132 %
4133 % \subsubsection{Format component commands}
4134 % \begin{macro}{\cref@label@types}
4135 % The reference formats are usually constructed out of components
4136 % defined by the user-level \cmd{\crefname}, \cmd{\Crefname},
4137 % \cmd{\creflabel} and \cmd{\crefrangelabel} commands.
4138 % \cmd{\cref@label@types} keeps track of label types for which
4139 % components have been defined, and therefore need constructing at
4140 % \cmd{\begindocument} (see below).
4141 %
4142 % FIXME: We don't check if the label type is already in the list, so
4143 % some formats may needlessly be redefined identically, multiple times.
4144 %
4145 % \begin{macrocode}
4146 \cref@stack@init{\cref@label@types}%
4147 % \end{macrocode}
4148 % \end{macro}
4149 %
4150 % \begin{macro}{\crefdefaultlabelformat}
4151 % \begin{macro}{\crefname}
4152 % \begin{macro}{\Crefname}
4153 % \begin{macro}{\creflabelformat}
4154 % \begin{macro}{\crefrangelabelformat}
4155 % The component customisation commands simply use the supplied
4156 % arguments to define appropriately named macros containing the
4157 % formatting components. If the corresponding \cmd{\Crefname} or
4158 % \cmd{\crefname} variant is not already defined, \cmd{\crefname} and
4159 % \cmd{\Crefname} define it to be a version with the first letter
4160 % capitalised or lower-cased, respectively.
4161 % \begin{macrocode}
4162 \newcommand\crefdefaultlabelformat[1]{%
4163 \def\cref@default@label##1##2##3{#1}}%
4164 \newcommand\crefname[3]{%
4165 \@crefname{cref}{#1}{#2}{#3}{}}%
4166 \newcommand\Crefname[3]{%
4167 \@crefname{Cref}{#1}{#2}{#3}{}}%
4168 \newcommand\creflabelformat[2]{%
4169 \expandafter\def\csname cref@#1@label\endcsname##1##2##3{#2}%
4170 \cref@stack@add{#1}{\cref@label@types}}%
4171 \newcommand\crefrangelabelformat[2]{%
4172 \expandafter\def\csname cref@#1@rangelabel\endcsname%
4173 ##1##2##3##4##5##6{#2}%
4174 \cref@stack@add{#1}{\cref@label@types}}%
4175 % \end{macrocode}
4176 % \end{macro}
4177 % \end{macro}
4178 % \end{macro}
4179 % \end{macro}
4180 % \end{macro}
4181 %
4182 % \begin{macro}{\crefalias}
4183 % The \cmd{\crefalias} command aliases a counter name to another
4184 % cross-reference type, so can be used to make the same cross-reference
4185 % format apply to multiple different counters.
4186 %\begin{macrocode}
4187 \newcommand\crefalias[2]{%
4188 \expandafter\def\csname cref@#1@alias\endcsname{#2}}%
4189 % \end{macrocode}
4190 % \end{macro}
4191 %
4192 % \begin{macro}{\crefname@preamble}
4193 % \begin{macro}{\Crefname@preamble}
4194 % The \cmd{\crefname@preamble} and \cmd{\Crefname@preamble} commands
4195 % are very like the \cmd{\crefname} and \cmd{\Crefname} commands, but
4196 % they tag ``|@preamble|'' onto the end of the generated macro names.
4197 % They are used when defining the default formats for different
4198 % languages (see \cref{sec:code:babel}).
4199 %\begin{macrocode}
4200 \newcommand\crefname@preamble[3]{%
4201 \@crefname{cref}{#1}{#2}{#3}{@preamble}}%
4202 \newcommand\Crefname@preamble[3]{%
4203 \@crefname{Cref}{#1}{#2}{#3}{@preamble}}%
4204 % \end{macrocode}
4205 % \end{macro}
4206 % \end{macro}
4207 %
4208 %
4209 % \begin{macro}{cref@othervariant}
4210 % The following utility macro sets up the appropriate definitions for
4211 % the other capitalisation variant. It defines the macro passed in |#2|
4212 % to be the other variant (``cref'' or ``Cref'') to the one specified
4213 % in |#1|, and defines |#3| to be the appropriate
4214 % capitalisation-changing command. It makes use of the fact that the
4215 % first character of \#1 is ``c'' for the lower-case variant and ``C''
4216 % for the upper-case one.
4217 % \begin{macrocode}
4218 \def\cref@othervariant#1#2#3{\cref@@othervariant#1\@nil#2#3}%
4219 \def\cref@@othervariant#1#2\@nil#3#4{%
4220 \if#1c%
4221 \def#3{C#2}%
4222 \def#4{\MakeUppercase}%
4223 \else%
4224 \def#3{c#2}%
4225 \if@cref@capitalise%
4226 \def#4{}%
4227 \else%
4228 \def#4{\MakeLowercase}%
4229 \fi%
4230 \fi}%
4231 % \end{macrocode}
4232 % \end{macro}
4233 %
4234 % \begin{macro}{\@crefname}
4235 % The \cmd{\@crefname} utility macro does the real work of defining
4236 % format names, by defining an appropriately named command to contain
4237 % the format component, and using the additional first argument
4238 % (``cref'' or ``Cref'') to determine how to define the corresponding
4239 % command with the other capitalisation. The extra fifth argument gets
4240 % tagged onto the end of the generated macro names. Note that
4241 % \cmd{\@crefname} \emph{must not} create global definitions, or else
4242 % it will break \package{babel}'s \cmd{\otherlanguage},
4243 % \cmd{\otherlanguage*} and \cmd{\foreignlanguage} commands.
4244 % \begin{macrocode}
4245 \def\@crefname#1#2#3#4#5{%
4246 \expandafter\def\csname #1@#2@name#5\endcsname{#3}%
4247 \expandafter\def\csname #1@#2@name@plural#5\endcsname{#4}%
4248 % \end{macrocode}
4249 % If the other capitalisation variant is not already defined\dots
4250 % \begin{macrocode}
4251 \cref@othervariant{#1}{\@tempc}{\@tempd}%
4252 \@ifundefined{\@tempc @#2@name#5}{%
4253 % \end{macrocode}
4254 % Define \cmd{\@tempa} and \cmd{\@tempb} to be partial expansions (expanded
4255 % just once) of the macros for the capitalisation variant we've just
4256 % defined above.
4257 % \begin{macrocode}
4258 \expandafter\expandafter\expandafter\def%
4259 \expandafter\expandafter\expandafter\@tempa%
4260 \expandafter\expandafter\expandafter{%
4261 \csname#1@#2@name\endcsname}%
4262 \expandafter\expandafter\expandafter\def%
4263 \expandafter\expandafter\expandafter\@tempb%
4264 \expandafter\expandafter\expandafter{%
4265 \csname#1@#2@name@plural\endcsname}%
4266 % \end{macrocode}
4267 % Add the case-change command stored in \cmd{\@tempd} to the front of the
4268 % definitions of \cmd{\@tempa} and \cmd{\@tempb}.
4269 % \begin{macrocode}
4270 \expandafter\ifx\@tempa\@empty\else%
4271 \expandafter\expandafter\expandafter\def%
4272 \expandafter\expandafter\expandafter\@tempa%
4273 \expandafter\expandafter\expandafter{%
4274 \expandafter\@tempd\@tempa}%
4275 \expandafter\expandafter\expandafter\def%
4276 \expandafter\expandafter\expandafter\@tempb%
4277 \expandafter\expandafter\expandafter{%
4278 \expandafter\@tempd\@tempb}%
4279 \fi%
4280 % \end{macrocode}
4281 % Define the other capitalisation variants to be the partial expansions
4282 % (expanded just once) of \cmd{\@tempa} and \cmd{\@tempb}. The
4283 % \cmd{\@toksa} token register just makes the code less verbose.
4284 % \begin{macrocode}
4285 \toksdef\@toksa=0%
4286 \@toksa={%
4287 \expandafter\def\csname\@tempc @#2@name#5\endcsname}%
4288 \expandafter\the\expandafter\@toksa\expandafter{\@tempa}%
4289 \@toksa={%
4290 \expandafter\def\csname\@tempc @#2@name@plural#5\endcsname}%
4291 \expandafter\the\expandafter\@toksa\expandafter{\@tempb}%
4292 }{}%
4293 % \end{macrocode}
4294 % Add label type to list of types that need defining from components.
4295 % \begin{macrocode}
4296 \cref@stack@add{#2}{\cref@label@types}}%
4297 % \end{macrocode}
4298 % \end{macro}
4299 %
4300 %
4301 % \begin{macro}{\@crefconstructcomponents}
4302 % The \cmd{\@crefconstructcomponents} utility macro puts the reference
4303 % format components for the specified reference type into temporary
4304 % macros, for use by later macros. The ridiculous number of ``\#''
4305 % characters ensure that the correct number remain when they come to be
4306 % used later (recall that pairs ``\#\#'' are collapsed to a single
4307 % ``\#'' each time the code is expanded).
4308 % \begin{macrocode}
4309 \def\@crefconstructcomponents#1{%
4310 % \end{macrocode}
4311 % Single cross-reference label format.
4312 % \begin{macrocode}
4313 \@ifundefined{cref@#1@label}{%
4314 \let\@templabel\cref@default@label%
4315 }{%
4316 \expandafter\let\expandafter\@templabel%
4317 \csname cref@#1@label\endcsname%
4318 }%
4319 % \end{macrocode}
4320 % Reference range label format.
4321 % \begin{macrocode}
4322 \@ifundefined{cref@#1@rangelabel}{%
4323 \expandafter\def\expandafter\@tempa\expandafter{%
4324 \@templabel{####1}{####3}{####4}}%
4325 \expandafter\def\expandafter\@tempb\expandafter{%
4326 \@templabel{####2}{####5}{####6}}%
4327 \toksdef\@toksa=0%
4328 \@toksa={\def\@temprangelabel##1##2##3##4##5##6}%
4329 \expandafter\expandafter\expandafter\the%
4330 \expandafter\expandafter\expandafter\@toksa%
4331 \expandafter\expandafter\expandafter{%
4332 \expandafter\expandafter\expandafter\crefrangepreconjunction%
4333 \expandafter\@tempa\expandafter\crefrangeconjunction\@tempb%
4334 \crefrangepostconjunction}%
4335 }{%
4336 \expandafter\let\expandafter\@temprangelabel%
4337 \csname cref@#1@rangelabel\endcsname%
4338 }%
4339 % \end{macrocode}
4340 % If we're including names in hyperlinks, define variants of temporary
4341 % label macros which lack the hyperlink start argument (it will instead
4342 % be included in the temporary name macros).
4343 % \begin{macrocode}
4344 \if@cref@nameinlink%
4345 \expandafter\def\expandafter\@templabel@first\expandafter{%
4346 \@templabel{########1}{}{########3}}%
4347 \expandafter\def\expandafter\@temprangelabel@first\expandafter{%
4348 \@temprangelabel{########1}{########2}%
4349 {}{########4}{########5}{########6}}%
4350 \fi%
4351 % \end{macrocode}
4352 % Get the correct number of ``\#'''s into the label format definitions.
4353 % \begin{macrocode}
4354 \expandafter\def\expandafter\@templabel\expandafter{%
4355 \@templabel{########1}{########2}{########3}}%
4356 \expandafter\def\expandafter\@temprangelabel\expandafter{%
4357 \@temprangelabel{########1}{########2}{########3}%
4358 {########4}{########5}{########6}}%
4359 % \end{macrocode}
4360 % If we're not including names in hyperlinks, define all variants to be
4361 % the same as standard temporary name macros.
4362 % \begin{macrocode}
4363 \if@cref@nameinlink\else%
4364 \let\@templabel@first\@templabel%
4365 \let\@temprangelabel@first\@temprangelabel%
4366 \fi%
4367 % \end{macrocode}
4368 %
4369 % If including names in hyperlinks, define temporary name macros to
4370 % include hyperlink start argument.
4371 % \begin{macrocode}
4372 \if@cref@nameinlink%
4373 \def\@tempa##1##2{##2##1}%
4374 % \end{macrocode}
4375 % Lower-case singular cross-reference name.
4376 % \begin{macrocode}
4377 \expandafter\expandafter\expandafter\def%
4378 \expandafter\expandafter\expandafter\@tempname%
4379 \expandafter\expandafter\expandafter{%
4380 \expandafter\@tempa\expandafter%
4381 {\csname cref@#1@name\endcsname}{########2}}%
4382 % \end{macrocode}
4383 % Upper-case singular cross-reference name.
4384 % \begin{macrocode}
4385 \expandafter\expandafter\expandafter\def%
4386 \expandafter\expandafter\expandafter\@tempName%
4387 \expandafter\expandafter\expandafter{%
4388 \expandafter\@tempa\expandafter%
4389 {\csname Cref@#1@name\endcsname}{########2}}%
4390 % \end{macrocode}
4391 % Lower-case plural cross-reference name.
4392 % \begin{macrocode}
4393 \expandafter\expandafter\expandafter\def%
4394 \expandafter\expandafter\expandafter\@tempnameplural%
4395 \expandafter\expandafter\expandafter{%
4396 \expandafter\@tempa\expandafter%
4397 {\csname cref@#1@name@plural\endcsname}{########2}}%
4398 % \end{macrocode}
4399 % Upper-case plural cross-reference name.
4400 % \begin{macrocode}
4401 \expandafter\expandafter\expandafter\def%
4402 \expandafter\expandafter\expandafter\@tempNameplural%
4403 \expandafter\expandafter\expandafter{%
4404 \expandafter\@tempa\expandafter%
4405 {\csname Cref@#1@name@plural\endcsname}{########2}}%
4406 % \end{macrocode}
4407 % For cross-reference ranges, the hyperlink start argument is \#3 instead
4408 % of \#2, so we need a different variant of the temporary plural name
4409 % macros.
4410 % \begin{macrocode}
4411 \expandafter\expandafter\expandafter\def%
4412 \expandafter\expandafter\expandafter\@tempnameplural@range%
4413 \expandafter\expandafter\expandafter{%
4414 \expandafter\@tempa\expandafter%
4415 {\csname cref@#1@name@plural\endcsname}{########3}}%
4416 \expandafter\expandafter\expandafter\def%
4417 \expandafter\expandafter\expandafter\@tempNameplural@range%
4418 \expandafter\expandafter\expandafter{%
4419 \expandafter\@tempa\expandafter%
4420 {\csname Cref@#1@name@plural\endcsname}{########3}}%
4421 % \end{macrocode}
4422 %
4423 % If we're not including names in hyperlinks, temporary name macros don't
4424 % include the hyperlink start argument.
4425 % \begin{macrocode}
4426 \else%
4427 % \end{macrocode}
4428 % Lower-case singular cross-reference name.
4429 % \begin{macrocode}
4430 \expandafter\def\expandafter\@tempname\expandafter{%
4431 \csname cref@#1@name\endcsname}%
4432 % \end{macrocode}
4433 % Upper-case singular cross-reference name.
4434 % \begin{macrocode}
4435 \expandafter\def\expandafter\@tempName\expandafter{%
4436 \csname Cref@#1@name\endcsname}%
4437 % \end{macrocode}
4438 % Lower-case plural cross-reference name.
4439 % \begin{macrocode}
4440 \expandafter\def\expandafter\@tempnameplural\expandafter{%
4441 \csname cref@#1@name@plural\endcsname}%
4442 % \end{macrocode}
4443 % Upper-case plural cross-reference name.
4444 % \begin{macrocode}
4445 \expandafter\def\expandafter\@tempNameplural\expandafter{%
4446 \csname Cref@#1@name@plural\endcsname}%
4447 % \end{macrocode}
4448 % Define reference range variants to be identical to normal variants.
4449 % \begin{macrocode}
4450 \let\@tempnameplural@range\@tempnameplural%
4451 \let\@tempNameplural@range\@tempNameplural%
4452 \fi%
4453 }%
4454 % \end{macrocode}
4455 % \end{macro}
4456 %
4457 %
4458 % \begin{macro}{\@crefdefineformat}
4459 % The \cmd{\@crefdefineformat} et al.\ macros construct calls to
4460 % \cmd{\crefformat} et al.\ for the supplied reference type, which
4461 % define the corresponding formats in terms of the format components.
4462 % This is mostly just an arduous exercise in controlling macro
4463 % expansion order.
4464 % \begin{macrocode}
4465 \def\@crefdefineformat#1{%
4466 \begingroup%
4467 % \end{macrocode}
4468 % Put format components into tmp macros.
4469 % \begin{macrocode}
4470 \@crefconstructcomponents{#1}%
4471 % \end{macrocode}
4472 % Assemble the arguments for \cmd{\crefformat}, \cmd{\Crefformat} and
4473 % \cmd{\labelcrefformat} from the components.
4474 % \begin{macrocode}
4475 \expandafter\ifx\csname cref@#1@name\endcsname\@empty\relax%
4476 \expandafter\def\expandafter\@tempfirst\expandafter{\@templabel}%
4477 \else%
4478 \expandafter\expandafter\expandafter\def%
4479 \expandafter\expandafter\expandafter\@tempfirst%
4480 \expandafter\expandafter\expandafter{%
4481 \expandafter\@tempname\expandafter\nobreakspace\@templabel@first}%
4482 \fi%
4483 \expandafter\ifx\csname Cref@#1@name\endcsname\@empty\relax%
4484 \expandafter\def\expandafter\@tempFirst\expandafter{\@templabel}%
4485 \else%
4486 \expandafter\expandafter\expandafter\def%
4487 \expandafter\expandafter\expandafter\@tempFirst%
4488 \expandafter\expandafter\expandafter{%
4489 \expandafter\@tempName\expandafter\nobreakspace\@templabel@first}%
4490 \fi%
4491 \expandafter\def\expandafter\@templabel\expandafter{\@templabel}%
4492 % \end{macrocode}
4493 % Define \cmd{\crefformat} and \cmd{\Crefformat}.
4494 % \begin{macrocode}
4495 \toksdef\@toksa=0%
4496 \@toksa={\crefformat{#1}}%
4497 \expandafter\the\expandafter\@toksa\expandafter{\@tempfirst}%
4498 \@toksa={\Crefformat{#1}}%
4499 \expandafter\the\expandafter\@toksa\expandafter{\@tempFirst}%
4500 % \end{macrocode}
4501 % Define \cmd{\labelcrefformat} if type has custom label format.
4502 % \begin{macrocode}
4503 \@ifundefined{cref@#1@label}{}{%
4504 \@toksa={\labelcrefformat{#1}}%
4505 \expandafter\the\expandafter\@toksa\expandafter{\@templabel}}%
4506 \endgroup}%
4507 % \end{macrocode}
4508 % \end{macro}
4509 %
4510 %
4511 % \begin{macro}{\@crefrangedefineformat}
4512 % Construct call to \cmd{\crefrangeformat}.
4513 % \begin{macrocode}
4514 \def\@crefrangedefineformat#1{%
4515 \begingroup%
4516 % \end{macrocode}
4517 % Put format components into tmp macros.
4518 % \begin{macrocode}
4519 \@crefconstructcomponents{#1}%
4520 % \end{macrocode}
4521 % Assemble the arguments for \cmd{\crefrangeformat},
4522 % \cmd{\Crefrangeformat} and\linebreak[4] \cmd{\labelcrefrangeformat}
4523 % from the components.
4524 % \begin{macrocode}
4525 \expandafter\ifx\csname cref@#1@name\endcsname\@empty\relax%
4526 \expandafter\def\expandafter\@tempfirst%
4527 \expandafter{\@temprangelabel}%
4528 \else%
4529 \expandafter\expandafter\expandafter\def%
4530 \expandafter\expandafter\expandafter\@tempfirst%
4531 \expandafter\expandafter\expandafter{%
4532 \expandafter\@tempnameplural@range%
4533 \expandafter\nobreakspace\@temprangelabel@first}%
4534 \fi%
4535 \expandafter\ifx\csname Cref@#1@name\endcsname\@empty\relax%
4536 \expandafter\def\expandafter\@tempFirst%
4537 \expandafter{\@temprangelabel}%
4538 \else%
4539 \expandafter\expandafter\expandafter\def%
4540 \expandafter\expandafter\expandafter\@tempFirst%
4541 \expandafter\expandafter\expandafter{%
4542 \expandafter\@tempNameplural@range%
4543 \expandafter\nobreakspace\@temprangelabel@first}%
4544 \fi%
4545 \expandafter\def\expandafter\@temprangelabel%
4546 \expandafter{\@temprangelabel}%
4547 % \end{macrocode}
4548 % Define \cmd{\crefrangeformat} and \cmd{\Crefrangeformat}.
4549 % \begin{macrocode}
4550 \toksdef\@toksa=0%
4551 \@toksa={\crefrangeformat{#1}}%
4552 \expandafter\the\expandafter\@toksa\expandafter{\@tempfirst}%
4553 \@toksa={\Crefrangeformat{#1}}%
4554 \expandafter\the\expandafter\@toksa\expandafter{\@tempFirst}%
4555 % \end{macrocode}
4556 % Define \cmd{\labelcrefrangeformat} if type has custom label format.
4557 % \begin{macrocode}
4558 \@ifundefined{cref@#1@rangelabel}{%
4559 \@ifundefined{cref@#1@label}{\let\@tempa\relax}{\def\@tempa{}}}%
4560 {\def\@tempa{}}%
4561 \ifx\@tempa\@empty\relax%
4562 \@toksa={\labelcrefrangeformat{#1}}%
4563 \expandafter\the\expandafter\@toksa\expandafter{%
4564 \@temprangelabel}%
4565 \fi%
4566 \endgroup}%
4567 % \end{macrocode}
4568 % \end{macro}
4569 %
4570 %
4571 % \begin{macro}{\@crefdefinemultiformat}
4572 % Construct call to \cmd{\crefmultiformat}.
4573 % \begin{macrocode}
4574 \def\@crefdefinemultiformat#1{%
4575 \begingroup%
4576 % \end{macrocode}
4577 % Put format components into tmp macros.
4578 % \begin{macrocode}
4579 \@crefconstructcomponents{#1}%
4580 % \end{macrocode}
4581 % Assemble the arguments for \cmd{\crefmultiformat},
4582 % \cmd{\Crefmultiformat} and\linebreak[4] \cmd{\labelcrefmultiformat}
4583 % from the components.
4584 % \begin{macrocode}
4585 \expandafter\ifx\csname cref@#1@name@plural\endcsname\@empty\relax%
4586 \expandafter\def\expandafter\@tempfirst%
4587 \expandafter{\@templabel}%
4588 \else%
4589 \expandafter\expandafter\expandafter\def%
4590 \expandafter\expandafter\expandafter\@tempfirst%
4591 \expandafter\expandafter\expandafter{%
4592 \expandafter\@tempnameplural%
4593 \expandafter\nobreakspace\@templabel@first}%
4594 \fi%
4595 \expandafter\ifx\csname Cref@#1@name@plural\endcsname\@empty\relax%
4596 \expandafter\def\expandafter\@tempFirst%
4597 \expandafter{\@templabel}%
4598 \else%
4599 \expandafter\expandafter\expandafter\def%
4600 \expandafter\expandafter\expandafter\@tempFirst%
4601 \expandafter\expandafter\expandafter{%
4602 \expandafter\@tempNameplural%
4603 \expandafter\nobreakspace\@templabel@first}%
4604 \fi%
4605 \expandafter\def\expandafter\@tempsecond\expandafter{%
4606 \expandafter\crefpairconjunction\@templabel}%
4607 \expandafter\def\expandafter\@tempmiddle\expandafter{%
4608 \expandafter\crefmiddleconjunction\@templabel}%
4609 \expandafter\def\expandafter\@templast\expandafter{%
4610 \expandafter\creflastconjunction\@templabel}%
4611 \expandafter\def\expandafter\@templabel\expandafter{\@templabel}%
4612 % \end{macrocode}
4613 % Bundle all four arguments for \cmd{\crefmultiformat} in token register
4614 % \cmd{\@toksb}, then call it.
4615 % \begin{macrocode}
4616 \toksdef\@toksa=0%
4617 \toksdef\@toksb=1%
4618 \@toksb={}%
4619 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4620 \expandafter{\@tempfirst}}%
4621 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4622 \expandafter{\@tempsecond}}%
4623 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4624 \expandafter{\@tempmiddle}}%
4625 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4626 \expandafter{\@templast}}%
4627 \@toksa={\crefmultiformat{#1}}%
4628 \expandafter\the\expandafter\@toksa\the\@toksb%
4629 % \end{macrocode}
4630 % Bundle all four arguments for \cmd{\Crefmultiformat} in token register
4631 % \cmd{\@toksb}, then call it.
4632 % \begin{macrocode}
4633 \@toksb={}%
4634 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4635 \expandafter{\@tempFirst}}%
4636 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4637 \expandafter{\@tempsecond}}%
4638 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4639 \expandafter{\@tempmiddle}}%
4640 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4641 \expandafter{\@templast}}%
4642 \@toksa={\Crefmultiformat{#1}}%
4643 \expandafter\the\expandafter\@toksa\the\@toksb%
4644 % \end{macrocode}
4645 % If type has custom label format, bundle all four arguments
4646 % for\linebreak[4] \cmd{\labelcrefmultiformat} in token register
4647 % \cmd{\@toksb}, then call it.
4648 % \begin{macrocode}
4649 \@ifundefined{cref@#1@label}{}{%
4650 \@toksb={}%
4651 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4652 \expandafter{\@templabel}}%
4653 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4654 \expandafter{\@tempsecond}}%
4655 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4656 \expandafter{\@tempmiddle}}%
4657 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4658 \expandafter{\@templast}}%
4659 \@toksa={\labelcrefmultiformat{#1}}%
4660 \expandafter\the\expandafter\@toksa\the\@toksb}%
4661 \endgroup}%
4662 % \end{macrocode}
4663 % \end{macro}
4664 %
4665 %
4666 % \begin{macro}{\@crefrangedefinemultiformat}
4667 % Construct call to \cmd{\crefrangemultiformat}.
4668 % \begin{macrocode}
4669 \def\@crefrangedefinemultiformat#1{%
4670 \begingroup%
4671 % \end{macrocode}
4672 % Put format components into tmp macros.
4673 % \begin{macrocode}
4674 \@crefconstructcomponents{#1}%
4675 % \end{macrocode}
4676 % Assemble the arguments that need to be passed to
4677 % \cmd{\crefrangemultiformat}, \cmd{\Crefrangemultiformat} and
4678 % \cmd{\labelcrefrangemultiformat} from the reference components.
4679 % \begin{macrocode}
4680 \expandafter\ifx\csname cref@#1@name@plural\endcsname\@empty\relax%
4681 \expandafter\def\expandafter\@tempfirst%
4682 \expandafter{\@temprangelabel}%
4683 \else%
4684 \expandafter\expandafter\expandafter\def%
4685 \expandafter\expandafter\expandafter\@tempfirst%
4686 \expandafter\expandafter\expandafter{%
4687 \expandafter\@tempnameplural@range%
4688 \expandafter\nobreakspace\@temprangelabel@first}%
4689 \fi%
4690 \expandafter\ifx\csname Cref@#1@name@plural\endcsname\@empty\relax%
4691 \expandafter\def\expandafter\@tempFirst%
4692 \expandafter{\@temprangelabel}%
4693 \else%
4694 \expandafter\expandafter\expandafter\def%
4695 \expandafter\expandafter\expandafter\@tempFirst%
4696 \expandafter\expandafter\expandafter{%
4697 \expandafter\@tempNameplural@range%
4698 \expandafter\nobreakspace\@temprangelabel@first}%
4699 \fi%
4700 \expandafter\def\expandafter\@tempsecond\expandafter{%
4701 \expandafter\crefpairconjunction\@temprangelabel}%
4702 \expandafter\def\expandafter\@tempmiddle\expandafter{%
4703 \expandafter\crefmiddleconjunction\@temprangelabel}%
4704 \expandafter\def\expandafter\@templast\expandafter{%
4705 \expandafter\creflastconjunction\@temprangelabel}%
4706 \expandafter\def\expandafter\@temprangelabel%
4707 \expandafter{\@temprangelabel}%
4708 % \end{macrocode}
4709 % Bundle all four arguments for \cmd{\crefrangemultiformat} in token
4710 % register \cmd{\@toksb}, then call it.
4711 % \begin{macrocode}
4712 \toksdef\@toksa=0%
4713 \toksdef\@toksb=1%
4714 \@toksb={}%
4715 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4716 \expandafter{\@tempfirst}}%
4717 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4718 \expandafter{\@tempsecond}}%
4719 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4720 \expandafter{\@tempmiddle}}%
4721 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4722 \expandafter{\@templast}}%
4723 \@toksa={\crefrangemultiformat{#1}}%
4724 \expandafter\the\expandafter\@toksa\the\@toksb%
4725 % \end{macrocode}
4726 % Bundle all four arguments for \cmd{\Crefrangemultiformat} in token
4727 % register \cmd{\@toksb}, then call it.
4728 % \begin{macrocode}
4729 \@toksb={}%
4730 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4731 \expandafter{\@tempFirst}}%
4732 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4733 \expandafter{\@tempsecond}}%
4734 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4735 \expandafter{\@tempmiddle}}%
4736 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4737 \expandafter{\@templast}}%
4738 \@toksa={\Crefrangemultiformat{#1}}%
4739 \expandafter\the\expandafter\@toksa\the\@toksb%
4740 % \end{macrocode}
4741 % If type has custom label format, bundle all four arguments
4742 % for\linebreak[4] \cmd{\labelcrefrangemultiformat} in token register
4743 % \cmd{\@toksb}, then call it.
4744 % \begin{macrocode}
4745 \@ifundefined{cref@#1@rangelabel}{%
4746 \@ifundefined{cref@#1@label}{\let\@tempa\relax}{\def\@tempa{}}}%
4747 {\def\@tempa{}}%
4748 \ifx\@tempa\@empty\relax%
4749 \@toksb={}%
4750 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4751 \expandafter{\@temprangelabel}}%
4752 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4753 \expandafter{\@tempsecond}}%
4754 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4755 \expandafter{\@tempmiddle}}%
4756 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4757 \expandafter{\@templast}}%
4758 \@toksa={\labelcrefrangemultiformat{#1}}%
4759 \expandafter\the\expandafter\@toksa\the\@toksb%
4760 \fi%
4761 \endgroup}%
4762 % \end{macrocode}
4763 % \end{macro}
4764 %
4765 %
4766 % \begin{macro}{\@labelcrefdefinedefaultformats}
4767 % \cmd{\@labelcrefdefinedefaultformats} defines the default formats for
4768 % the\linebreak[4] \cmd{\labelcref} command, which are used when no
4769 % type-specific formats are defined.
4770 % \begin{macrocode}
4771 \def\@labelcrefdefinedefaultformats{%
4772 \begingroup%
4773 \toksdef\@toksa=0%
4774 \toksdef\@toksb=1%
4775 % \end{macrocode}
4776 % Assemble the arguments that need to be passed to
4777 % \cmd{\labelcrefformat},\linebreak[4] \cmd{\labelcrefrangeformat},
4778 % \cmd{\labelcrefmultiformat} and\linebreak[4]
4779 % \cmd{\labelcrefrangemultiformat}.
4780 % \begin{macrocode}
4781 \let\@templabel\cref@default@label%
4782 \expandafter\def\expandafter\@tempa\expandafter{%
4783 \@templabel{####1}{####3}{####4}}%
4784 \expandafter\def\expandafter\@tempb\expandafter{%
4785 \@templabel{####2}{####5}{####6}}%
4786 \@toksa={\def\@temprangelabel##1##2##3##4##5##6}%
4787 \expandafter\expandafter\expandafter\the%
4788 \expandafter\expandafter\expandafter\@toksa%
4789 \expandafter\expandafter\expandafter{%
4790 \expandafter\expandafter\expandafter\crefrangepreconjunction%
4791 \expandafter\@tempa\expandafter\crefrangeconjunction\@tempb%
4792 \crefrangepostconjunction}%
4793 \expandafter\def\expandafter\@templabel\expandafter{%
4794 \@templabel{########1}{########2}{########3}}%
4795 \expandafter\def\expandafter\@temprangelabel\expandafter{%
4796 \@temprangelabel{########1}{########2}{########3}%
4797 {########4}{########5}{########6}}%
4798 \expandafter\def\expandafter\@tempsecond\expandafter{%
4799 \expandafter\crefpairconjunction\@templabel}%
4800 \expandafter\def\expandafter\@tempmiddle\expandafter{%
4801 \expandafter\crefmiddleconjunction\@templabel}%
4802 \expandafter\def\expandafter\@templast\expandafter{%
4803 \expandafter\creflastconjunction\@templabel}%
4804 \expandafter\def\expandafter\@temprangesecond\expandafter{%
4805 \expandafter\crefpairconjunction\@temprangelabel}%
4806 \expandafter\def\expandafter\@temprangemiddle\expandafter{%
4807 \expandafter\crefmiddleconjunction\@temprangelabel}%
4808 \expandafter\def\expandafter\@temprangelast\expandafter{%
4809 \expandafter\creflastconjunction\@temprangelabel}%
4810 \expandafter\def\expandafter\@templabel\expandafter{\@templabel}%
4811 \expandafter\def\expandafter\@temprangelabel%
4812 \expandafter{\@temprangelabel}%
4813 % \end{macrocode}
4814 % Define default \cmd{\labelcrefformat}.
4815 % \begin{macrocode}
4816 \@toksa={\labelcrefformat{default}}%
4817 \expandafter\the\expandafter\@toksa\expandafter{\@templabel}%
4818 % \end{macrocode}
4819 % Define default \cmd{\labelcrefrangeformat}.
4820 % \begin{macrocode}
4821 \@toksa={\labelcrefrangeformat{default}}%
4822 \expandafter\the\expandafter\@toksa\expandafter{\@temprangelabel}%
4823 % \end{macrocode}
4824 % Bundle all four arguments for \cmd{\labelcrefmultiformat} in token
4825 % register \cmd{\@toksb}, then call it to define default formats.
4826 % \begin{macrocode}
4827 \@toksb={}%
4828 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4829 \expandafter{\@templabel}}%
4830 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4831 \expandafter{\@tempsecond}}%
4832 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4833 \expandafter{\@tempmiddle}}%
4834 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4835 \expandafter{\@templast}}%
4836 \@toksa={\labelcrefmultiformat{default}}%
4837 \expandafter\the\expandafter\@toksa\the\@toksb%
4838 % \end{macrocode}
4839 % Bundle all four arguments for \cmd{\labelcrefrangemultiformat} in token
4840 % register \cmd{\@toksb}, then call it to define default formats.
4841 % \begin{macrocode}
4842 \@toksb={}%
4843 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4844 \expandafter{\@temprangelabel}}%
4845 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4846 \expandafter{\@temprangesecond}}%
4847 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4848 \expandafter{\@temprangemiddle}}%
4849 \expandafter\cref@append@toks\expandafter\@toksb\expandafter{%
4850 \expandafter{\@temprangelast}}%
4851 \@toksa={\labelcrefrangemultiformat{default}}%
4852 \expandafter\the\expandafter\@toksa\the\@toksb%
4853 \endgroup}%
4854 % \end{macrocode}
4855 % \end{macro}
4856 %
4857 %
4858 % \begin{macro}{\@crefdefineallformats}
4859 % \cmd{\@crefdefineallformats} calls each of the above, to define all
4860 % formats for the given type from the corresponding components.
4861 % \begin{macrocode}
4862 \def\@crefdefineallformats#1{%
4863 \@crefdefineformat{#1}%
4864 \@crefrangedefineformat{#1}%
4865 \@crefdefinemultiformat{#1}%
4866 \@crefrangedefinemultiformat{#1}}%
4867 % \end{macrocode}
4868 % \end{macro}
4869 %
4870 %
4871 % \begin{macro}{\@crefcopyformats}
4872 % \cmd{\@crefcopyformats} copies any undefined formats for type |#2|
4873 % from those for type |#1|.
4874 % \begin{macrocode}
4875 \def\@crefcopyformats#1#2{%
4876 \let\@tempf\iffalse%
4877 \@ifundefined{cref@#2@name}{%
4878 \edef\@tempa{\expandafter\noexpand\csname cref@#2@name\endcsname}%
4879 \edef\@tempb{\expandafter\noexpand\csname cref@#1@name\endcsname}%
4880 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb%
4881 \edef\@tempa{\expandafter\noexpand\csname cref@#2@name@plural\endcsname}%
4882 \edef\@tempb{\expandafter\noexpand\csname cref@#1@name@plural\endcsname}%
4883 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb%
4884 }{%
4885 \let\@tempf\iftrue%
4886 }%
4887 \@ifundefined{Cref@#2@name}{%
4888 \edef\@tempa{\expandafter\noexpand\csname Cref@#2@name\endcsname}%
4889 \edef\@tempb{\expandafter\noexpand\csname Cref@#1@name\endcsname}%
4890 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb%
4891 \edef\@tempa{\expandafter\noexpand\csname Cref@#2@name@plural\endcsname}%
4892 \edef\@tempb{\expandafter\noexpand\csname Cref@#1@name@plural\endcsname}%
4893 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb%
4894 }{%
4895 \let\@tempf\iftrue%
4896 }%
4897 \@ifundefined{cref@#2@label}{%
4898 \@ifundefined{cref@#1@label}{}{%
4899 \edef\@tempa{\expandafter\noexpand\csname cref@#2@label\endcsname}%
4900 \edef\@tempb{\expandafter\noexpand\csname cref@#1@label\endcsname}%
4901 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}%
4902 }{%
4903 \let\@tempf\iftrue%
4904 }%
4905 \@ifundefined{cref@#2@rangelabel}{%
4906 \@ifundefined{cref@#1@rangelabel}{}{%
4907 \edef\@tempa{\expandafter\noexpand\csname cref@#2@rangelabel\endcsname}%
4908 \edef\@tempb{\expandafter\noexpand\csname cref@#1@rangelabel\endcsname}%
4909 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}%
4910 }{%
4911 \let\@tempf\iftrue%
4912 }%
4913 % \end{macrocode}
4914 % If at least one format component has been customised specifically for
4915 % reference type |#2|, generate its formats from components.
4916 % \begin{macrocode}
4917 \@tempf\relax%
4918 \@crefdefineallformats{#2}%
4919 % \end{macrocode}
4920 % If no format components have been defined for reference type |#2|, copy
4921 % over the low-level formats from type |#1|.
4922 % \begin{macrocode}
4923 \else%
4924 \@ifundefined{cref@#2@format}{%
4925 \edef\@tempa{\expandafter\noexpand\csname cref@#2@format\endcsname}%
4926 \edef\@tempb{\expandafter\noexpand\csname cref@#1@format\endcsname}%
4927 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4928 \@ifundefined{crefrange@#2@format}{%
4929 \edef\@tempa{\expandafter\noexpand\csname crefrange@#2@format\endcsname}%
4930 \edef\@tempb{\expandafter\noexpand\csname crefrange@#1@format\endcsname}%
4931 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4932 \@ifundefined{cref@#2@format@first}{%
4933 \edef\@tempa{\expandafter\noexpand\csname cref@#2@format@first\endcsname}%
4934 \edef\@tempb{\expandafter\noexpand\csname cref@#1@format@first\endcsname}%
4935 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4936 \@ifundefined{cref@#2@format@second}{%
4937 \edef\@tempa{\expandafter\noexpand\csname cref@#2@format@second\endcsname}%
4938 \edef\@tempb{\expandafter\noexpand\csname cref@#1@format@second\endcsname}%
4939 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4940 \@ifundefined{cref@#2@format@middle}{%
4941 \edef\@tempa{\expandafter\noexpand\csname cref@#2@format@middle\endcsname}%
4942 \edef\@tempb{\expandafter\noexpand\csname cref@#1@format@middle\endcsname}%
4943 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4944 \@ifundefined{cref@#2@format@last}{%
4945 \edef\@tempa{\expandafter\noexpand\csname cref@#2@format@last\endcsname}%
4946 \edef\@tempb{\expandafter\noexpand\csname cref@#1@format@last\endcsname}%
4947 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4948 \@ifundefined{crefrange@#2@format@first}{%
4949 \edef\@tempa{\expandafter\noexpand\csname crefrange@#2@format@first\endcsname}%
4950 \edef\@tempb{\expandafter\noexpand\csname crefrange@#1@format@first\endcsname}%
4951 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4952 \@ifundefined{crefrange@#2@format@second}{%
4953 \edef\@tempa{\expandafter\noexpand\csname crefrange@#2@format@second\endcsname}%
4954 \edef\@tempb{\expandafter\noexpand\csname crefrange@#1@format@second\endcsname}%
4955 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4956 \@ifundefined{crefrange@#2@format@middle}{%
4957 \edef\@tempa{\expandafter\noexpand\csname crefrange@#2@format@middle\endcsname}%
4958 \edef\@tempb{\expandafter\noexpand\csname crefrange@#1@format@middle\endcsname}%
4959 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4960 \@ifundefined{crefrange@#2@format@last}{%
4961 \edef\@tempa{\expandafter\noexpand\csname crefrange@#2@format@last\endcsname}%
4962 \edef\@tempb{\expandafter\noexpand\csname crefrange@#1@format@last\endcsname}%
4963 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4964 %
4965 \@ifundefined{Cref@#2@format}{%
4966 \edef\@tempa{\expandafter\noexpand\csname Cref@#2@format\endcsname}%
4967 \edef\@tempb{\expandafter\noexpand\csname Cref@#1@format\endcsname}%
4968 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4969 \@ifundefined{Crefrange@#2@format}{%
4970 \edef\@tempa{\expandafter\noexpand\csname Crefrange@#2@format\endcsname}%
4971 \edef\@tempb{\expandafter\noexpand\csname Crefrange@#1@format\endcsname}%
4972 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4973 \@ifundefined{Cref@#2@format@first}{%
4974 \edef\@tempa{\expandafter\noexpand\csname Cref@#2@format@first\endcsname}%
4975 \edef\@tempb{\expandafter\noexpand\csname Cref@#1@format@first\endcsname}%
4976 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4977 \@ifundefined{Cref@#2@format@second}{%
4978 \edef\@tempa{\expandafter\noexpand\csname Cref@#2@format@second\endcsname}%
4979 \edef\@tempb{\expandafter\noexpand\csname Cref@#1@format@second\endcsname}%
4980 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4981 \@ifundefined{Cref@#2@format@middle}{%
4982 \edef\@tempa{\expandafter\noexpand\csname Cref@#2@format@middle\endcsname}%
4983 \edef\@tempb{\expandafter\noexpand\csname Cref@#1@format@middle\endcsname}%
4984 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4985 \@ifundefined{Cref@#2@format@last}{%
4986 \edef\@tempa{\expandafter\noexpand\csname Cref@#2@format@last\endcsname}%
4987 \edef\@tempb{\expandafter\noexpand\csname Cref@#1@format@last\endcsname}%
4988 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4989 \@ifundefined{Crefrange@#2@format@first}{%
4990 \edef\@tempa{\expandafter\noexpand\csname Crefrange@#2@format@first\endcsname}%
4991 \edef\@tempb{\expandafter\noexpand\csname Crefrange@#1@format@first\endcsname}%
4992 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4993 \@ifundefined{Crefrange@#2@format@second}{%
4994 \edef\@tempa{\expandafter\noexpand\csname Crefrange@#2@format@second\endcsname}%
4995 \edef\@tempb{\expandafter\noexpand\csname Crefrange@#1@format@second\endcsname}%
4996 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
4997 \@ifundefined{Crefrange@#2@format@middle}{%
4998 \edef\@tempa{\expandafter\noexpand\csname Crefrange@#2@format@middle\endcsname}%
4999 \edef\@tempb{\expandafter\noexpand\csname Crefrange@#1@format@middle\endcsname}%
5000 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
5001 \@ifundefined{Crefrange@#2@format@last}{%
5002 \edef\@tempa{\expandafter\noexpand\csname Crefrange@#2@format@last\endcsname}%
5003 \edef\@tempb{\expandafter\noexpand\csname Crefrange@#1@format@last\endcsname}%
5004 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
5005 %
5006 \@ifundefined{labelcref@#2@format}{%
5007 \edef\@tempa{\expandafter\noexpand\csname labelcref@#2@format\endcsname}%
5008 \edef\@tempb{\expandafter\noexpand\csname labelcref@#1@format\endcsname}%
5009 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
5010 \@ifundefined{labelcrefrange@#2@format}{%
5011 \edef\@tempa{\expandafter\noexpand\csname labelcrefrange@#2@format\endcsname}%
5012 \edef\@tempb{\expandafter\noexpand\csname labelcrefrange@#1@format\endcsname}%
5013 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
5014 \@ifundefined{labelcref@#2@format@first}{%
5015 \edef\@tempa{\expandafter\noexpand\csname labelcref@#2@format@first\endcsname}%
5016 \edef\@tempb{\expandafter\noexpand\csname labelcref@#1@format@first\endcsname}%
5017 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
5018 \@ifundefined{labelcref@#2@format@second}{%
5019 \edef\@tempa{\expandafter\noexpand\csname labelcref@#2@format@second\endcsname}%
5020 \edef\@tempb{\expandafter\noexpand\csname labelcref@#1@format@second\endcsname}%
5021 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
5022 \@ifundefined{labelcref@#2@format@middle}{%
5023 \edef\@tempa{\expandafter\noexpand\csname labelcref@#2@format@middle\endcsname}%
5024 \edef\@tempb{\expandafter\noexpand\csname labelcref@#1@format@middle\endcsname}%
5025 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
5026 \@ifundefined{labelcref@#2@format@last}{%
5027 \edef\@tempa{\expandafter\noexpand\csname labelcref@#2@format@last\endcsname}%
5028 \edef\@tempb{\expandafter\noexpand\csname labelcref@#1@format@last\endcsname}%
5029 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
5030 \@ifundefined{labelcrefrange@#2@format@first}{%
5031 \edef\@tempa{\expandafter\noexpand\csname labelcrefrange@#2@format@first\endcsname}%
5032 \edef\@tempb{\expandafter\noexpand\csname labelcrefrange@#1@format@first\endcsname}%
5033 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
5034 \@ifundefined{labelcrefrange@#2@format@second}{%
5035 \edef\@tempa{\expandafter\noexpand\csname labelcrefrange@#2@format@second\endcsname}%
5036 \edef\@tempb{\expandafter\noexpand\csname labelcrefrange@#1@format@second\endcsname}%
5037 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
5038 \@ifundefined{labelcrefrange@#2@format@middle}{%
5039 \edef\@tempa{\expandafter\noexpand\csname labelcrefrange@#2@format@middle\endcsname}%
5040 \edef\@tempb{\expandafter\noexpand\csname labelcrefrange@#1@format@middle\endcsname}%
5041 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
5042 \@ifundefined{labelcrefrange@#2@format@last}{%
5043 \edef\@tempa{\expandafter\noexpand\csname labelcrefrange@#2@format@last\endcsname}%
5044 \edef\@tempb{\expandafter\noexpand\csname labelcrefrange@#1@format@last\endcsname}%
5045 \expandafter\expandafter\expandafter\let\expandafter\@tempa\@tempb}{}%
5046 \fi%
5047 }
5048 % \end{macrocode}
5049 % \end{macro}
5050 %
5051 %
5052 %
5053 % \subsubsection{Format definition commands}
5054 % \label{sec:crefformat}
5055 % \begin{macro}{\crefformat}
5056 % \begin{macro}{\Crefformat}
5057 % \begin{macro}{\crefrangeformat}
5058 % \begin{macro}{\Crefrangeformat}
5059 % \begin{macro}{\crefmultiformat}
5060 % \begin{macro}{\Crefmultiformat}
5061 % \begin{macro}{\crefrangemultiformat}
5062 % \begin{macro}{\Crefrangemultiformat}
5063 % \cmd{\crefformat} et al.\ are lower-level commands that give complete
5064 % control over the format of different reference types. They override
5065 % the component-based formats, simply using the supplied arguments to
5066 % define appropriately named formatting macros, which are called by
5067 % \cmd{\@@setcref} etc. If the corresponding \cmd{\Crefformat} or
5068 % \cmd{\crefformat} variant is not already defined, they define it to
5069 % be a version with the first letter capitalised or lower-cased.
5070 % \begin{macrocode}
5071 \newcommand\crefformat[2]{\@crefformat{cref}{#1}{#2}}%
5072 \newcommand\Crefformat[2]{\@crefformat{Cref}{#1}{#2}}%
5073 \newcommand\crefrangeformat[2]{\@crefrangeformat{crefrange}{#1}{#2}}%
5074 \newcommand\Crefrangeformat[2]{\@crefrangeformat{Crefrange}{#1}{#2}}%
5075 \newcommand\crefmultiformat[5]{%
5076 \@crefmultiformat{cref}{#1}{#2}{#3}{#4}{#5}}%
5077 \newcommand\Crefmultiformat[5]{%
5078 \@crefmultiformat{Cref}{#1}{#2}{#3}{#4}{#5}}%
5079 \newcommand\crefrangemultiformat[5]{%
5080 \@crefrangemultiformat{crefrange}{#1}{#2}{#3}{#4}{#5}}%
5081 \newcommand\Crefrangemultiformat[5]{%
5082 \@crefrangemultiformat{Crefrange}{#1}{#2}{#3}{#4}{#5}}%
5083 \newcommand\labelcrefformat[2]{%
5084 \expandafter\gdef\csname labelcref@#1@format\endcsname##1##2##3{#2}}%
5085 \newcommand\labelcrefrangeformat[2]{%
5086 \expandafter\gdef\csname labelcrefrange@#1@format\endcsname%
5087 ##1##2##3##4##5##6{#2}}%
5088 \newcommand\labelcrefmultiformat[5]{%
5089 \expandafter\gdef\csname labelcref@#1@format@first\endcsname%
5090 ##1##2##3{#2}%
5091 \expandafter\gdef\csname labelcref@#1@format@second\endcsname%
5092 ##1##2##3{#3}%
5093 \expandafter\gdef\csname labelcref@#1@format@middle\endcsname%
5094 ##1##2##3{#4}%
5095 \expandafter\gdef\csname labelcref@#1@format@last\endcsname%
5096 ##1##2##3{#5}}%
5097 \newcommand\labelcrefrangemultiformat[5]{%
5098 \expandafter\gdef\csname labelcrefrange@#1@format@first\endcsname%
5099 ##1##2##3##4##5##6{#2}%
5100 \expandafter\gdef\csname labelcrefrange@#1@format@second\endcsname%
5101 ##1##2##3##4##5##6{#3}%
5102 \expandafter\gdef\csname labelcrefrange@#1@format@middle\endcsname%
5103 ##1##2##3##4##5##6{#4}%
5104 \expandafter\gdef\csname labelcrefrange@#1@format@last\endcsname%
5105 ##1##2##3##4##5##6{#5}}%
5106 % \end{macrocode}
5107 % \end{macro}
5108 % \end{macro}
5109 % \end{macro}
5110 % \end{macro}
5111 % \end{macro}
5112 % \end{macro}
5113 % \end{macro}
5114 % \end{macro}
5115 %
5116 % The utility macros do the real work, by using the first argument
5117 % (``cref'' or ``Cref'', and ``crefrange'' or ``Crefrange'') to determine
5118 % how to define the corresponding command with the other capitalisation.
5119 % \begin{macro}{\@crefformat}
5120 % \cmd{\@crefformat} defines the macros for single references.
5121 % \begin{macrocode}
5122 \def\@crefformat#1#2#3{%
5123 \begingroup%
5124 \expandafter\gdef\csname #1@#2@format\endcsname##1##2##3{#3}%
5125 % \end{macrocode}
5126 % If the other capitalisation variant is not already defined\dots
5127 % \begin{macrocode}
5128 \cref@othervariant{#1}{\@other}{\@changecase}%
5129 \@ifundefined{\@other @#2@format}{%
5130 % \end{macrocode}
5131 % Define \cmd{\@tempa} to be a partial expansion (expanded just once) of
5132 % the capitalisation variant we've just defined above. The \cmd{\@toska}
5133 % token register just makes the code less verbose.
5134 % \begin{macrocode}
5135 \toksdef\@toksa=0%
5136 \@toksa={\def\@tempa##1##2##3}%
5137 \expandafter\expandafter\expandafter\the%
5138 \expandafter\expandafter\expandafter\@toksa%
5139 \expandafter\expandafter\expandafter{%
5140 \csname#1@#2@format\endcsname{##1}{##2}{##3}}%
5141 % \end{macrocode}
5142 % Add the \cmd{\@changecase} command to the front of the definition of
5143 % \cmd{\@tempa}.
5144 % \begin{macrocode}
5145 \expandafter\expandafter\expandafter\the%
5146 \expandafter\expandafter\expandafter\@toksa%
5147 \expandafter\expandafter\expandafter{%
5148 \expandafter\@changecase\@tempa{##1}{##2}{##3}}%
5149 % \end{macrocode}
5150 % Define the other capitalisation variant to be the partial expansion
5151 % (expanded just once) of \cmd{\@tempa}.
5152 % \begin{macrocode}
5153 \@toksa={%
5154 \expandafter\gdef\csname\@other @#2@format\endcsname##1##2##3}%
5155 \expandafter\the\expandafter\@toksa\expandafter{%
5156 \@tempa{##1}{##2}{##3}}%
5157 }{}%
5158 \endgroup}%
5159 % \end{macrocode}
5160 % \end{macro}
5161 %
5162 % \begin{macro}{\@crefrangeformat}
5163 % \cmd{\@crefrangeformat} defines the macros for single reference
5164 % ranges.
5165 % \begin{macrocode}
5166 \def\@crefrangeformat#1#2#3{%
5167 \begingroup%
5168 \expandafter\gdef\csname #1@#2@format\endcsname%
5169 ##1##2##3##4##5##6{#3}%
5170 % \end{macrocode}
5171 % If the other capitalisation variant is not already defined\dots
5172 % \begin{macrocode}
5173 \cref@othervariant{#1}{\@other}{\@changecase}%
5174 \@ifundefined{\@other @#2@format}{%
5175 % \end{macrocode}
5176 % Define \cmd{\@tempa} to be a partial expansion (expanded just once) of
5177 % the capitalisation variant we've just defined above. The \cmd{\@toska}
5178 % token register just makes the code less verbose.
5179 % \begin{macrocode}
5180 \toksdef\@toksa=0%
5181 \@toksa={\def\@tempa##1##2##3##4##5##6}%
5182 \expandafter\expandafter\expandafter\the%
5183 \expandafter\expandafter\expandafter\@toksa%
5184 \expandafter\expandafter\expandafter{%
5185 \csname#1@#2@format\endcsname{##1}{##2}{##3}{##4}{##5}{##6}}%
5186 % \end{macrocode}
5187 % Add the \cmd{\@changecase} command to the front of the definition of
5188 % \cmd{\@tempa}.
5189 % \begin{macrocode}
5190 \expandafter\expandafter\expandafter\the%
5191 \expandafter\expandafter\expandafter\@toksa%
5192 \expandafter\expandafter\expandafter{%
5193 \expandafter\@changecase\@tempa{##1}{##2}{##3}{##4}{##5}{##6}}%
5194 % \end{macrocode}
5195 % Define the other capitalisation variant to be the partial expansion
5196 % (expanded just once) of \cmd{\@tempa}.
5197 % \begin{macrocode}
5198 \@toksa={\expandafter\gdef%
5199 \csname\@other @#2@format\endcsname##1##2##3##4##5##6}%
5200 \expandafter\the\expandafter\@toksa\expandafter{%
5201 \@tempa{##1}{##2}{##3}{##4}{##5}{##6}}%
5202 }{}%
5203 \endgroup}%
5204 % \end{macrocode}
5205 % \end{macro}
5206 %
5207 % \begin{macro}{\@crefmultiformat}
5208 % \cmd{\@crefmultiformat} defines the macros for multiple references.
5209 % \begin{macrocode}
5210 \def\@crefmultiformat#1#2#3#4#5#6{%
5211 \begingroup%
5212 \expandafter\gdef\csname #1@#2@format@first\endcsname##1##2##3{#3}%
5213 \expandafter\gdef\csname #1@#2@format@second\endcsname##1##2##3{#4}%
5214 \expandafter\gdef\csname #1@#2@format@middle\endcsname##1##2##3{#5}%
5215 \expandafter\gdef\csname #1@#2@format@last\endcsname##1##2##3{#6}%
5216 % \end{macrocode}
5217 % If the other capitalisation variant of the first part of the
5218 % multi-format definition is not already defined\dots
5219 % \begin{macrocode}
5220 \cref@othervariant{#1}{\@other}{\@changecase}%
5221 \@ifundefined{\@other @#2@format@first}{%
5222 % \end{macrocode}
5223 % Define \cmd{\@tempa} to be a partial expansion (expanded just once) of
5224 % the capitalisation variant we've just defined above. The \cmd{\@toska}
5225 % token register just makes the code less verbose.
5226 % \begin{macrocode}
5227 \toksdef\@toksa=0%
5228 \@toksa={\def\@tempa##1##2##3}%
5229 \expandafter\expandafter\expandafter\the%
5230 \expandafter\expandafter\expandafter\@toksa%
5231 \expandafter\expandafter\expandafter{%
5232 \csname#1@#2@format@first\endcsname{##1}{##2}{##3}}%
5233 % \end{macrocode}
5234 % Add the \cmd{\@changecase} command to the front of the definition of
5235 % \cmd{\@tempa}.
5236 % \begin{macrocode}
5237 \expandafter\expandafter\expandafter\the%
5238 \expandafter\expandafter\expandafter\@toksa%
5239 \expandafter\expandafter\expandafter{%
5240 \expandafter\@changecase\@tempa{##1}{##2}{##3}}%
5241 % \end{macrocode}
5242 % Define the other capitalisation variant to be the partial expansion
5243 % (expanded just once) of \cmd{\@tempa}.
5244 % \begin{macrocode}
5245 \@toksa={%
5246 \expandafter\gdef\csname\@other @#2@format@first\endcsname%
5247 ##1##2##3}%
5248 \expandafter\the\expandafter\@toksa\expandafter{%
5249 \@tempa{##1}{##2}{##3}}%
5250 }{}%
5251 % \end{macrocode}
5252 % The other parts of the multi-format definition are defined to be
5253 % identical for both capitalisation variants.
5254 % \begin{macrocode}
5255 \@ifundefined{\@other @#2@format@second}{%
5256 \@toksa={%
5257 \expandafter\global\expandafter\let%
5258 \csname\@other @#2@format@second\endcsname}%
5259 \expandafter\the\expandafter\@toksa%
5260 \csname #1@#2@format@second\endcsname%
5261 }{}%
5262 \@ifundefined{\@other @#2@format@middle}{%
5263 \@toksa={%
5264 \expandafter\global\expandafter\let%
5265 \csname\@other @#2@format@middle\endcsname}%
5266 \expandafter\the\expandafter\@toksa%
5267 \csname #1@#2@format@middle\endcsname%
5268 }{}%
5269 \@ifundefined{\@other @#2@format@last}{%
5270 \@toksa={%
5271 \expandafter\global\expandafter\let%
5272 \csname\@other @#2@format@last\endcsname}%
5273 \expandafter\the\expandafter\@toksa%
5274 \csname #1@#2@format@last\endcsname%
5275 }{}%
5276 \endgroup}%
5277 % \end{macrocode}
5278 %\end{macro}
5279 %
5280 % \begin{macro}{\@crefrangemultiformat}
5281 % \cmd{\@crefmultiformat} defines the macros for reference ranges
5282 % within multiple references.
5283 % \begin{macrocode}
5284 \def\@crefrangemultiformat#1#2#3#4#5#6{%
5285 \begingroup%
5286 \expandafter\gdef\csname #1@#2@format@first\endcsname%
5287 ##1##2##3##4##5##6{#3}%
5288 \expandafter\gdef\csname #1@#2@format@second\endcsname%
5289 ##1##2##3##4##5##6{#4}%
5290 \expandafter\gdef\csname #1@#2@format@middle\endcsname%
5291 ##1##2##3##4##5##6{#5}%
5292 \expandafter\gdef\csname #1@#2@format@last\endcsname%
5293 ##1##2##3##4##5##6{#6}%
5294 % \end{macrocode}
5295 % If the other capitalisation variant of the first part of the
5296 % multi-format definition is not already defined\dots
5297 % \begin{macrocode}
5298 \cref@othervariant{#1}{\@other}{\@changecase}%
5299 \@ifundefined{\@other @#2@format@first}{%
5300 % \end{macrocode}
5301 % Define \cmd{\@tempa} to be a partial expansion (expanded just once) of
5302 % the capitalisation variant we've just defined above. The \cmd{\@toska}
5303 % token register just makes the code less verbose.
5304 % \begin{macrocode}
5305 \toksdef\@toksa=0%
5306 \@toksa={\def\@tempa##1##2##3##4##5##6}%
5307 \expandafter\expandafter\expandafter\the%
5308 \expandafter\expandafter\expandafter\@toksa%
5309 \expandafter\expandafter\expandafter{%
5310 \csname#1@#2@format@first\endcsname%
5311 {##1}{##2}{##3}{##4}{##5}{##6}}%
5312 % \end{macrocode}
5313 % Add the \cmd{\@changecase} command to the front of the definition of
5314 % \cmd{\@tempa}.
5315 % \begin{macrocode}
5316 \expandafter\expandafter\expandafter\the%
5317 \expandafter\expandafter\expandafter\@toksa%
5318 \expandafter\expandafter\expandafter{%
5319 \expandafter\@changecase\@tempa{##1}{##2}{##3}{##4}{##5}{##6}}%
5320 % \end{macrocode}
5321 % Define the other capitalisation variant to be the partial expansion
5322 % (expanded just once) of \cmd{\@tempa}.
5323 % \begin{macrocode}
5324 \@toksa={%
5325 \expandafter\gdef\csname\@other @#2@format@first\endcsname%
5326 ##1##2##3##4##5##6}%
5327 \expandafter\the\expandafter\@toksa\expandafter{%
5328 \@tempa{##1}{##2}{##3}{##4}{##5}{##6}}%
5329 }{}%
5330 % \end{macrocode}
5331 % The other parts of the multi-format definition are defined to be
5332 % identical for both capitalisation variants.
5333 % \begin{macrocode}
5334 \@ifundefined{\@other @#2@format@second}{%
5335 \@toksa={%
5336 \expandafter\global\expandafter\let%
5337 \csname\@other @#2@format@second\endcsname}%
5338 \expandafter\the\expandafter\@toksa%
5339 \csname #1@#2@format@second\endcsname%
5340 }{}%
5341 \@ifundefined{\@other @#2@format@middle}{%
5342 \@toksa={%
5343 \expandafter\global\expandafter\let%
5344 \csname\@other @#2@format@middle\endcsname}%
5345 \expandafter\the\expandafter\@toksa%
5346 \csname #1@#2@format@middle\endcsname%
5347 }{}%
5348 \@ifundefined{\@other @#2@format@last}{%
5349 \@toksa={%
5350 \expandafter\global\expandafter\let%
5351 \csname\@other @#2@format@last\endcsname}%
5352 \expandafter\the\expandafter\@toksa%
5353 \csname #1@#2@format@last\endcsname%
5354 }{}%
5355 \endgroup}%
5356 % \end{macrocode}
5357 % \end{macro}
5358 %
5359 %
5360 %
5361 % \subsection{Support for Other Packages}
5362 %
5363 % \subsubsection{\package{hyperref} support}
5364 % \begin{macro}{hyperref}
5365 % If the \package{hyperref} package is loaded, we add hyperlink
5366 % support to \package{cleveref}. Since \package{hyperref} messes around
5367 % with some of the same \LaTeX{} internals as we do, we also have to
5368 % override some of its redefinitions so that they work with
5369 % \package{cleveref}.
5370 % \begin{macrocode}
5371 \let\if@cref@hyperrefloaded\iffalse%
5372 \let\cref@addtoreset\@addtoreset%
5373 \@ifpackageloaded{hyperref}{%
5374 \@ifpackagewith{hyperref}{implicit=false}{%
5375 \let\if@cref@hyperrefloaded\iftrue%
5376 \PackageWarning{cleveref}{hyperref package loaded with
5377 implicit=false option - disabling cleveref's hyperref support.
5378 This situation is not supported by cleveref, and there's no guarantee
5379 anything will work. You're on your own!}%
5380 }{%
5381 \let\if@cref@hyperrefloaded\iftrue%
5382 \PackageInfo{cleveref}{`hyperref' support loaded}%
5383 % \end{macrocode}
5384 % \package{hyperref} redefines the \LaTeX{} kernel \cmd{\@addtoreset}
5385 % macro (sigh), but we sometimes need the vanilla version without the
5386 % \package{hyperref} shennanigans. \package{hyperref} saves the
5387 % original in \cmd{\HyOrg@addtoreset}. So we create yet
5388 % \emph{another} version called \cmd{\cref@addtotreset}, which is always
5389 % let to the original \cmd{\@addtoreset}, whereever that's found.
5390 % \begin{macrocode}
5391 \let\cref@addtoreset\HyOrg@addtoreset%
5392 % \end{macrocode}
5393 % \begin{macro}{\cref@hyperlinkname}
5394 % \begin{macro}{\cref@hyperlinkurl}
5395 % We define a utility macro to extract the hyperlink supplied by
5396 % \package{hyperref} (via the \file{aux} file). Note that
5397 % \package{hyperref} adds the hyperlink info to the standard
5398 % \cmd{\newlabel} line in the \file{aux} file, so we have to retrieve
5399 % it from the standard \cmd{\r@\meta{label}}, \emph{not} the one
5400 % suffixed with |@cref| that we've created ourselves.
5401 % \begin{macrocode}
5402 \def\cref@hyperlinkname#1{\expandafter\expandafter\expandafter%
5403 \@fourthoffive\csname r@#1\endcsname}%
5404 \def\cref@hyperlinkurl#1{\expandafter\expandafter\expandafter%
5405 \@fifthoffive\csname r@#1\endcsname}%
5406 % \end{macrocode}
5407 % \end{macro}
5408 % \end{macro}
5409 %
5410 % \begin{macro}{\cref@hyperlink}
5411 % Because of the way the cross-referencing formatting commands work, we
5412 % will need to use a delimited argument to specify the text to be
5413 % turned into a hyperlink. So we define a variant of
5414 % \package{hyperref}'s \cmd{\hyper@@link} command that takes the
5415 % hyperlink text as an argument delimited by |\@nil|, instead of a
5416 % standard argument. (We only ever need the |link| hyperlink type in
5417 % \package{cleveref}, so we don't bother providing \cmd{\hyper@@link}'s
5418 % optional argument.)
5419 % \begin{macrocode}
5420 \def\cref@hyperlink#1#2#3\@nil{\hyper@@link[link]{#1}{#2}{#3}}%
5421 % \end{macrocode}
5422 % \end{macro}
5423 %
5424 % \begin{macro}{\H@refstepcounter}
5425 % The \package{hyperref} package stores the original
5426 % \cmd{\refstepcounter} definition as\linebreak[4]
5427 % \cmd{\H@refstepcounter}. Unfortunately, it plasters
5428 % \cmd{\H@refstepcounter} all over the place, sometimes bypassing
5429 % \cmd{\refstepcounter} entirely. So we're forced to modify
5430 % \cmd{\H@refstepcounter} itself, in order to ensure that the extra
5431 % information we need is stored in \cmd{\cref@currentlabel}.
5432 % \begin{macrocode}
5433 \let\cref@old@H@refstepcounter\H@refstepcounter%
5434 \def\H@refstepcounter#1{%
5435 \cref@old@H@refstepcounter{#1}%
5436 \cref@constructprefix{#1}{\cref@result}%
5437 \@ifundefined{cref@#1@alias}%
5438 {\def\@tempa{#1}}%
5439 {\def\@tempa{\csname cref@#1@alias\endcsname}}%
5440 \protected@edef\cref@currentlabel{%
5441 [\@tempa][\arabic{#1}][\cref@result]%
5442 \csname p@#1\endcsname\csname the#1\endcsname}}%
5443 % \end{macrocode}
5444 % \end{macro}
5445 %
5446 % \begin{macro}{\refstepcounter@noarg}
5447 % \begin{macro}{\refstepcounter@optarg}
5448 % \package{hyperref}'s \cmd{\refstepcounter}, which ends up stored in
5449 % our\linebreak[4] \cmd{\cref@old@refstepcounter}, already calls
5450 % \cmd{\H@refstepcounter}, and we just redefined the latter to store
5451 % the extra information. So we only need to change
5452 % \cmd{\cref@currentlabel} in \emph{our} \cmd{\refstepcounter} if an
5453 % optional argument was supplied. Note that, in this case, the
5454 % mechanism for setting \cmd{\cref@currentlabel} is slightly different
5455 % than it is without \package{hyperref}: \cmd{\cref@currentlabel} first
5456 % gets set by our modified \cmd{\H@refstepcounter}, which gets called
5457 % via \package{hyperref}'s original version, as stored in
5458 % \cmd{\cref@old@refstepcounter}. The version of
5459 % \cmd{\cref@refstepcounter@optarg} defined below then overrides the
5460 % label type.
5461 % \begin{macrocode}
5462 \let\refstepcounter@noarg\cref@old@refstepcounter%
5463 \def\refstepcounter@optarg[#1]#2{%
5464 \cref@old@refstepcounter{#2}%
5465 \@ifundefined{cref@#1@alias}%
5466 {\def\@tempa{#1}}%
5467 {\def\@tempa{\csname cref@#1@alias\endcsname}}%
5468 \protected@edef\cref@currentlabel{%
5469 \expandafter\cref@override@label@type%
5470 \cref@currentlabel\@nil{\@tempa}}}%
5471 % \end{macrocode}
5472 % \end{macro}
5473 % \end{macro}
5474 %
5475 % \begin{macro}{\appendix}
5476 % We again make \cmd{\appendix} redefine things so that the label type
5477 % for chapters or sections is exceptionally overridden and set to
5478 % ``appendix'' instead. But this time, it is \cmd{\H@refstepcounter}
5479 % that needs to be redefined.
5480 % \begin{macrocode}
5481 \@ifundefined{appendix}{}{%
5482 \def\appendix{%
5483 \@ifundefined{chapter}{%
5484 \def\H@refstepcounter##1{%
5485 \cref@old@H@refstepcounter{##1}%
5486 \cref@constructprefix{##1}{\cref@result}%
5487 % \end{macrocode}
5488 % We add a large value to the front of the counter data, to force
5489 % references to anything in appendices to be sorted after
5490 % everything else.
5491 % \begin{macrocode}
5492 \ifx\cref@result\@empty%
5493 \def\cref@result{2147483647}%
5494 \else%
5495 \edef\cref@result{2147483647,\cref@result}%
5496 \fi%
5497 % \end{macrocode}
5498 % Override the cross-reference type of sectioning commands.
5499 % \begin{macrocode}
5500 \def\@tempa{##1}%
5501 \def\@tempb{section}%
5502 \ifx\@tempa\@tempb%
5503 \@ifundefined{cref@appendix@alias}%
5504 {\def\@tempa{appendix}}%
5505 {\def\@tempa{\cref@appendix@alias}}%
5506 \protected@edef\cref@currentlabel{%
5507 [\@tempa][\arabic{##1}][\cref@result]%
5508 \csname p@##1\endcsname\csname the##1\endcsname}%
5509 \else%
5510 \def\@tempa{##1}%
5511 \def\@tempb{subsection}%
5512 \ifx\@tempa\@tempb%
5513 \@ifundefined{cref@subappendix@alias}%
5514 {\def\@tempa{subappendix}}%
5515 {\def\@tempa{\cref@subappendix@alias}}%
5516 \protected@edef\cref@currentlabel{%
5517 [\@tempa][\arabic{##1}][\cref@result]%
5518 \csname p@##1\endcsname\csname the##1\endcsname}%
5519 \else%
5520 \def\@tempa{##1}%
5521 \def\@tempb{subsubsection}%
5522 \ifx\@tempa\@tempb%
5523 \@ifundefined{cref@subsubappendix@alias}%
5524 {\def\@tempa{subsubappendix}}%
5525 {\def\@tempa{\cref@subsubappendix@alias}}%
5526 \protected@edef\cref@currentlabel{%
5527 [\@tempa][\arabic{##1}][\cref@result]%
5528 \csname p@##1\endcsname\csname the##1\endcsname}%
5529 \else%
5530 \@ifundefined{cref@##1@alias}%
5531 {\def\@tempa{##1}}%
5532 {\def\@tempa{\csname cref@##1@alias\endcsname}}%
5533 \protected@edef\cref@currentlabel{%
5534 [\@tempa][\arabic{##1}][\cref@result]%
5535 \csname p@##1\endcsname\csname the##1\endcsname}%
5536 \fi%
5537 \fi%
5538 \fi}%
5539 \cref@old@appendix%
5540 }{%
5541 \def\H@refstepcounter##1{%
5542 \cref@old@H@refstepcounter{##1}%
5543 \cref@constructprefix{##1}{\cref@result}%
5544 % \end{macrocode}
5545 % Again, the large value added to the front of the counter data
5546 % forces references to appendix items to be sorted last.
5547 % \begin{macrocode}
5548 \ifx\cref@result\@empty%
5549 \def\cref@result{2147483647}%
5550 \else%
5551 \edef\cref@result{2147483647,\cref@result}%
5552 \fi%
5553 % \end{macrocode}
5554 % Override the cross-reference type of sectioning commands.
5555 % \begin{macrocode}
5556 \def\@tempa{##1}%
5557 \def\@tempb{chapter}%
5558 \ifx\@tempa\@tempb%
5559 \@ifundefined{cref@appendix@alias}%
5560 {\def\@tempa{appendix}}%
5561 {\def\@tempa{\cref@appendix@alias}}%
5562 \protected@edef\cref@currentlabel{%
5563 [\@tempa][\arabic{##1}][\cref@result]%
5564 \csname p@##1\endcsname\csname the##1\endcsname}%
5565 \else%
5566 \def\@tempa{##1}%
5567 \def\@tempb{section}%
5568 \ifx\@tempa\@tempb%
5569 \@ifundefined{cref@subappendix@alias}%
5570 {\def\@tempa{subappendix}}%
5571 {\def\@tempa{\cref@subappendix@alias}}%
5572 \protected@edef\cref@currentlabel{%
5573 [\@tempa][\arabic{##1}][\cref@result]%
5574 \csname p@##1\endcsname\csname the##1\endcsname}%
5575 \else%
5576 \def\@tempa{##1}%
5577 \def\@tempb{subsection}%
5578 \ifx\@tempa\@tempb%
5579 \@ifundefined{cref@subsubappendix@alias}%
5580 {\def\@tempa{subsubappendix}}%
5581 {\def\@tempa{\cref@subsubappendix@alias}}%
5582 \protected@edef\cref@currentlabel{%
5583 [\@tempa][\arabic{##1}][\cref@result]%
5584 \csname p@##1\endcsname\csname the##1\endcsname}%
5585 \else%
5586 \def\@tempa{##1}%
5587 \def\@tempb{subsubsection}%
5588 \ifx\@tempa\@tempb%
5589 \@ifundefined{cref@subsubappendix@alias}%
5590 {\def\@tempa{subsubsubappendix}}%
5591 {\def\@tempa{\cref@subsubsubappendix@alias}}%
5592 \protected@edef\cref@currentlabel{%
5593 [\@tempa][\arabic{##1}][\cref@result]%
5594 \csname p@##1\endcsname\csname the##1\endcsname}%
5595 \else%
5596 \@ifundefined{cref@##1@alias}%
5597 {\def\@tempa{##1}}%
5598 {\def\@tempa{\csname cref@##1@alias\endcsname}}%
5599 \protected@edef\cref@currentlabel{%
5600 [\@tempa][\arabic{##1}][\cref@result]%
5601 \csname p@##1\endcsname\csname the##1\endcsname}%
5602 \fi%
5603 \fi%
5604 \fi%
5605 \fi}%
5606 \cref@old@appendix}%
5607 }%
5608 }% end of \@ifundefined{appendix}
5609 % \end{macrocode}
5610 % \end{macro}
5611 %
5612 % \begin{macro}{\cref*}
5613 % \begin{macro}{\Cref*}
5614 % \begin{macro}{\@crefstar}
5615 % We redefine \cmd{\cref} and all the others to allow starred variants,
5616 % which don't create hyperlinks. The starred variants simply set a
5617 % flag, which is tested in the very final stage of reference
5618 % typesetting in \cmd{\@@@setcref}, \cmd{\@@@setcrefrange},
5619 % \cmd{\@@@setcpageref} and \cmd{\@@@setcpagerefrange} (below).
5620 % \begin{macrocode}
5621 \DeclareRobustCommand{\cref}{%
5622 \@ifstar{\@crefstar{cref}}{\@cref{cref}}}%
5623 \DeclareRobustCommand{\Cref}{%
5624 \@ifstar{\@crefstar{Cref}}{\@cref{Cref}}}%
5625 \def\@crefstar#1#2{%
5626 \@crefstarredtrue\@cref{#1}{#2}\@crefstarredfalse}%
5627 % \end{macrocode}
5628 % \end{macro}
5629 % \end{macro}
5630 % \end{macro}
5631 %
5632 % \begin{macro}{\crefrange*}
5633 % \begin{macro}{\Crefrange*}
5634 % \begin{macro}{\@crefrangestar}
5635 % \begin{macro}{\@crefrangenostar}
5636 % \begin{macrocode}
5637 \DeclareRobustCommand{\crefrange}{%
5638 \@ifstar{\@crefrangestar{cref}}{\@crefrangenostar{cref}}}%
5639 \DeclareRobustCommand{\Crefrange}{%
5640 \@ifstar{\@crefrangestar{Cref}}{\@crefrangenostar{Cref}}}%
5641 \def\@crefrangenostar#1#2#3{\@@setcrefrange{#1}{#2}{#3}{}}
5642 \def\@crefrangestar#1#2#3{%
5643 \@crefstarredtrue\@@setcrefrange{#1}{#2}{#3}{}\@crefstarredfalse}%
5644 % \end{macrocode}
5645 % \end{macro}
5646 % \end{macro}
5647 % \end{macro}
5648 % \end{macro}
5649 %
5650 % \begin{macro}{\cpageref*}
5651 % \begin{macro}{\Cpageref*}
5652 % \begin{macrocode}
5653 \DeclareRobustCommand{\cpageref}{%
5654 \@ifstar\@crefstar\@cref{cpageref}}%
5655 \DeclareRobustCommand{\Cpageref}{%
5656 \@ifstar\@crefstar\@cref{Cpageref}}%
5657 % \end{macrocode}
5658 % \end{macro}
5659 % \end{macro}
5660 % \begin{macro}{\cpagerefrange*}
5661 % \begin{macro}{\Cpagerefrange*}
5662 % \begin{macro}{\@cpagerefrangestar}
5663 % \begin{macrocode}
5664 \DeclareRobustCommand{\cpagerefrange}{%
5665 \@ifstar{\@cpagerefrangestar{cref}}{\@cpagerefrangenostar{cref}}}%
5666 \DeclareRobustCommand{\Cpagerefrange}{%
5667 \@ifstar{\@cpagerefrangestar{Cref}}{\@cpagerefrangenostar{Cref}}}%
5668 \def\@cpagerefrangenostar#1#2#3{%
5669 \@@setcpagerefrange{#2}{#3}{#1}{}}
5670 \def\@cpagerefrangestar#1#2#3{%
5671 \@crefstarredtrue%
5672 \@@setcpagerefrange{#2}{#3}{#1}{}%
5673 \@crefstarredfalse}%
5674 % \end{macrocode}
5675 % \end{macro}
5676 % \end{macro}
5677 % \end{macro}
5678 %
5679 % \begin{macro}{\labelcref*}
5680 % \begin{macro}{\labelcpageref*}
5681 % \begin{macro}{\@labelcrefstar}
5682 % \begin{macro}{\@labelcpagerefstar}
5683 % \begin{macrocode}
5684 \DeclareRobustCommand{\labelcref}{%
5685 \@ifstar{\@labelcrefstar}{\@cref{labelcref}}}%
5686 \def\@labelcrefstar#1{%
5687 \@crefstarredtrue%
5688 \@cref{labelcref}{#1}%
5689 \@crefstarredfalse}%
5690 \DeclareRobustCommand{\labelcpageref}{%
5691 \@ifstar{\@labelcpagerefstar}{\@cref{labelcpageref}}}%
5692 \def\@labelcpagerefstar#1{%
5693 \@crefstarredtrue%
5694 \@cref{labelcpageref}{#1}%
5695 \@crefstarredfalse}%
5696 % \end{macrocode}
5697 % \end{macro}
5698 % \end{macro}
5699 % \end{macro}
5700 % \end{macro}
5701 %
5702 % \begin{macro}{\@@@setcref}
5703 % \begin{macro}{\@@@setcrefrange}
5704 % \begin{macro}{\@@@setcpageref}
5705 % \begin{macro}{\@@@setcpagerefrange}
5706 % Redefine the final reference typesetting macros to create hyperlinks
5707 % (unless the starred flag is set), using the extra arguments supplied
5708 % in \cmd{\r@\meta{label}} (via the \file{aux} file) by
5709 % \package{hyperref}.
5710 % \begin{macrocode}
5711 \def\@@@setcref#1#2{%
5712 \cref@getlabel{#2}{\@templabel}%
5713 \if@crefstarred%
5714 #1{\@templabel}{}{}%
5715 \else%
5716 \edef\@tempname{\cref@hyperlinkname{#2}}%
5717 \edef\@tempurl{\cref@hyperlinkurl{#2}}%
5718 #1{\@templabel}{\cref@hyperlink{\@tempurl}{\@tempname}}{\@nil}%
5719 \fi}%
5720 \def\@@@setcrefrange#1#2#3{%
5721 \cref@getlabel{#2}{\@labela}%
5722 \cref@getlabel{#3}{\@labelb}%
5723 \if@crefstarred%
5724 #1{\@labela}{\@labelb}{}{}{}{}%
5725 \else%
5726 \edef\@tempnamea{\cref@hyperlinkname{#2}}%
5727 \edef\@tempurlb{\cref@hyperlinkurl{#3}}%
5728 \edef\@tempnameb{\cref@hyperlinkname{#3}}%
5729 \edef\@tempurla{\cref@hyperlinkurl{#2}}%
5730 #1{\@labela}{\@labelb}%
5731 {\cref@hyperlink{\@tempurla}{\@tempnamea}}{\@nil}%
5732 {\cref@hyperlink{\@tempurlb}{\@tempnameb}}{\@nil}%
5733 \fi}%
5734 \def\@@@setcpageref#1#2{%
5735 \cpageref@getlabel{#2}{\@temppage}%
5736 \if@crefstarred%
5737 #1{\@temppage}{}{}%
5738 \else%
5739 \edef\@tempname{\cref@hyperlinkname{#2}}%
5740 \edef\@tempurl{\cref@hyperlinkurl{#2}}%
5741 #1{\@temppage}{\cref@hyperlink{\@tempurl}{\@tempname}}{\@nil}%
5742 \fi}%
5743 \def\@@@setcpagerefrange#1#2#3{%
5744 \cpageref@getlabel{#2}{\@pagea}%
5745 \cpageref@getlabel{#3}{\@pageb}%
5746 \if@crefstarred%
5747 #1{\@pagea}{\@pageb}{}{}{}{}%
5748 \else%
5749 \edef\@tempnamea{\cref@hyperlinkname{#2}}%
5750 \edef\@tempurlb{\cref@hyperlinkurl{#3}}%
5751 \edef\@tempnameb{\cref@hyperlinkname{#3}}%
5752 \edef\@tempurla{\cref@hyperlinkurl{#2}}%
5753 #1{\@pagea}{\@pageb}%
5754 {\cref@hyperlink{\@tempurla}{\@tempnamea}}{\@nil}%
5755 {\cref@hyperlink{\@tempurlb}{\@tempnameb}}{\@nil}%
5756 \fi}%
5757 }% end of false case of \@ifpackagewith{hyperref}{implicit=false}
5758 % \end{macrocode}
5759 %
5760 %
5761 % \subsubsection{\package{revtex4} and \package{revtex4-1} support}
5762 % The \package{revtex4} and \package{revtex4-1} document classes use
5763 % |\H@refstepcounter| to increment section counters, even when
5764 % \package{hyperref} isn't explicitly loaded. Therefore, for these
5765 % docclasses we need to redefine |\H@refstepcounter| even when
5766 % \package{hyperref} is not loaded.
5767 % \begin{macrocode}
5768 }{% false case of \@ifpackageloaded{hyperref}
5769 \@ifclassloaded{revtex4}{\let\if@cref@hyperrefloaded\iftrue}{}%
5770 \@ifclassloaded{revtex4-1}{\let\if@cref@hyperrefloaded\iftrue}{}%
5771 \if@cref@hyperrefloaded\relax%
5772 \let\cref@old@H@refstepcounter\H@refstepcounter%
5773 \def\H@refstepcounter#1{%
5774 \cref@old@H@refstepcounter{#1}%
5775 \cref@constructprefix{#1}{\cref@result}%
5776 \@ifundefined{cref@#1@alias}%
5777 {\def\@tempa{#1}}%
5778 {\def\@tempa{\csname cref@#1@alias\endcsname}}%
5779 \protected@edef\cref@currentlabel{%
5780 [\@tempa][\arabic{#1}][\cref@result]%
5781 \csname p@#1\endcsname\csname the#1\endcsname}}%
5782 % \end{macrocode}
5783 % We also need to redefine |\appendix| to use
5784 % \begin{macrocode}
5785 \@ifundefined{appendix}{}{%
5786 \def\appendix{%
5787 \@ifundefined{chapter}{%
5788 \def\H@refstepcounter##1{%
5789 \cref@old@H@refstepcounter{##1}%
5790 \cref@constructprefix{##1}{\cref@result}%
5791 % \end{macrocode}
5792 % We add a large value to the front of the counter data, to force
5793 % references to anything in appendices to be sorted after
5794 % everything else.
5795 % \begin{macrocode}
5796 \ifx\cref@result\@empty%
5797 \def\cref@result{2147483647}%
5798 \else%
5799 \edef\cref@result{2147483647,\cref@result}%
5800 \fi%
5801 % \end{macrocode}
5802 % Override the cross-reference type of sectioning commands.
5803 % \begin{macrocode}
5804 \def\@tempa{##1}%
5805 \def\@tempb{section}%
5806 \ifx\@tempa\@tempb%
5807 \protected@edef\cref@currentlabel{%
5808 [appendix][\arabic{##1}][\cref@result]%
5809 \csname p@##1\endcsname\csname the##1\endcsname}%
5810 \else%
5811 \def\@tempa{##1}%
5812 \def\@tempb{subsection}%
5813 \ifx\@tempa\@tempb%
5814 \protected@edef\cref@currentlabel{%
5815 [subappendix][\arabic{##1}][\cref@result]%
5816 \csname p@##1\endcsname\csname the##1\endcsname}%
5817 \else%
5818 \def\@tempa{##1}%
5819 \def\@tempb{subsubsection}%
5820 \ifx\@tempa\@tempb%
5821 \protected@edef\cref@currentlabel{%
5822 [subsubappendix][\arabic{##1}][\cref@result]%
5823 \csname p@##1\endcsname\csname the##1\endcsname}%
5824 \else%
5825 \@ifundefined{cref@##1@alias}%
5826 {\def\@tempa{##1}}%
5827 {\def\@tempa{\csname cref@##1@alias\endcsname}}%
5828 \protected@edef\cref@currentlabel{%
5829 [\@tempa][\arabic{##1}][\cref@result]%
5830 \csname p@##1\endcsname\csname the##1\endcsname}%
5831 \fi%
5832 \fi%
5833 \fi}%
5834 \cref@old@appendix%
5835 }{%
5836 \def\H@refstepcounter##1{%
5837 \cref@old@H@refstepcounter{##1}%
5838 \cref@constructprefix{##1}{\cref@result}%
5839 % \end{macrocode}
5840 % Again, the large value added to the front of the counter data
5841 % forces references to appendix items to be sorted last.
5842 % \begin{macrocode}
5843 \ifx\cref@result\@empty%
5844 \def\cref@result{2147483647}%
5845 \else%
5846 \edef\cref@result{2147483647,\cref@result}%
5847 \fi%
5848 % \end{macrocode}
5849 % Override the cross-reference type of sectioning commands.
5850 % \begin{macrocode}
5851 \def\@tempa{##1}%
5852 \def\@tempb{chapter}%
5853 \ifx\@tempa\@tempb%
5854 \protected@edef\cref@currentlabel{%
5855 [appendix][\arabic{##1}][\cref@result]%
5856 \csname p@##1\endcsname\csname the##1\endcsname}%
5857 \else%
5858 \def\@tempa{##1}%
5859 \def\@tempb{section}%
5860 \ifx\@tempa\@tempb%
5861 \protected@edef\cref@currentlabel{%
5862 [subappendix][\arabic{##1}][\cref@result]%
5863 \csname p@##1\endcsname\csname the##1\endcsname}%
5864 \else%
5865 \def\@tempa{##1}%
5866 \def\@tempb{subsection}%
5867 \ifx\@tempa\@tempb%
5868 \protected@edef\cref@currentlabel{%
5869 [subsubappendix][\arabic{##1}][\cref@result]%
5870 \csname p@##1\endcsname\csname the##1\endcsname}%
5871 \else%
5872 \def\@tempa{##1}%
5873 \def\@tempb{subsubsection}%
5874 \ifx\@tempa\@tempb%
5875 \protected@edef\cref@currentlabel{%
5876 [subsubsubappendix][\arabic{##1}][\cref@result]%
5877 \csname p@##1\endcsname\csname the##1\endcsname}%
5878 \else%
5879 \@ifundefined{cref@##1@alias}%
5880 {\def\@tempa{##1}}%
5881 {\def\@tempa{\csname cref@##1@alias\endcsname}}%
5882 \protected@edef\cref@currentlabel{%
5883 [\@tempa][\arabic{##1}][\cref@result]%
5884 \csname p@##1\endcsname\csname the##1\endcsname}%
5885 \fi%
5886 \fi%
5887 \fi%
5888 \fi}%
5889 \cref@old@appendix}%
5890 }%
5891 }% end of \@ifundefined{appendix}
5892 \fi% end of \if@cref@hyperrefloaded
5893 \let\if@cref@hyperrefloaded\iffalse%
5894 }% end of \@ifpackageloaded{hyperref}
5895 % \end{macrocode}
5896 % Add check to AtBeginDocument to throw error if \package{hyperref} was
5897 % loaded after cleveref.
5898 % \begin{macrocode}
5899 \AtBeginDocument{%
5900 \if@cref@hyperrefloaded\else%
5901 \@ifpackageloaded{hyperref}{%
5902 \PackageError{cleveref}{cleveref must be loaded after hyperref!}%
5903 {Package load order is wrong: load cleveref *after* hyperref.}
5904 }{}%
5905 \fi}
5906 % \end{macrocode}
5907 % \end{macro}
5908 % \end{macro}
5909 % \end{macro}
5910 % \end{macro}
5911 %
5912 % \end{macro}
5913 %
5914 %
5915 %
5916 % \subsubsection{\package{varioref} support}
5917 % \begin{macro}{varioref}
5918 % If \package{varioref} is loaded, we redefine its commands to use
5919 % \cmd{\cref} instead of \cmd{\ref} to produce the reference. Since
5920 % \cmd{\cref} can cope with multiple references, we extend the page
5921 % referencing magic of \cmd{\vref} et al.\ to use \cmd{\cpageref}
5922 % instead, assisted by \cmd{\@@setvpageref} and \cmd{\@vpagerefrange}
5923 % (which typeset page references using \package{varioref} commands).
5924 % The former takes care of multi-references, the latter take care of
5925 % the \package{varioref} page referencing magic.
5926 % \end{macro}
5927 %
5928 % \begin{macrocode}
5929 \let\if@cref@variorefloaded\iffalse%
5930 \@ifpackageloaded{varioref}{%
5931 \let\if@cref@variorefloaded\iftrue%
5932 \PackageInfo{cleveref}{`varioref' support loaded}%
5933 \PackageInfo{cleveref}{`cleveref' supersedes `varioref's
5934 \string\labelformat command}%
5935 % \end{macrocode}
5936 %
5937 %
5938 % \begin{macro}{\cref@old@@vpageref}
5939 % Unfortunately, \package{varioref}'s |\@@vpageref| macro calls a
5940 % |\vref@label| \emph{before} it typesets the page reference. The
5941 % |\protected@write| within |\vref@label| seems to prevent an |\unskip|
5942 % command coming after the |\vref@label| from removing any space that
5943 % was inserted before the |\vref@label|. This means that setting a
5944 % |\reftext|\meta{x} command to |\unskip| won't work; it won't properly
5945 % remove any preceding space in the event that an empty page reference
5946 % is typeset.
5947 %
5948 % This didn't matter in the original \package{varioref} implementation,
5949 % because it \emph{always} removed any preceding space, then inserted
5950 % its own space \emph{after} the |\vref@label|, which the |\unskip|
5951 % could then gobble. But we want to get rid of this irritating
5952 % always-space-gobbling behaviour here. So we have to redefine
5953 % |\@@vpageref| (here renamed |\cref@old@@vpageref|) in order to move
5954 % the |\vref@label| to the end of the macro, after the page reference
5955 % has been typeset. We also remove the |\unskip| from the start of
5956 % |\@@vpageref|.
5957 % \begin{macrocode}
5958 \def\cref@old@@vpageref#1[#2]#3{%
5959 \leavevmode%\unskip <<<
5960 \global\advance\c@vrcnt\@ne\relax%
5961 \vref@pagenum\@tempa{\the\c@vrcnt @vr}%
5962 \vref@pagenum\@tempb{\the\c@vrcnt @xvr}%
5963 %\vref@label{\the\c@vrcnt @xvr}% <<<
5964 \ifx\@tempa\@tempb\else%
5965 \vref@err{\noexpand\vref or \noexpand\vpageref at page boundary
5966 \@tempb-\@tempa\space (may loop)%
5967 }%
5968 \fi%
5969 \vrefpagenum\thevpagerefnum{#3}%
5970 \vref@space%
5971 \ifx\@tempa\thevpagerefnum%
5972 \def\@tempc{#1}%
5973 \ifx\@tempc\@empty%
5974 \unskip%
5975 \else%
5976 #1%
5977 \fi%
5978 \else%
5979 #2%
5980 \is@pos@number\thevpagerefnum%
5981 {%
5982 \is@pos@number\@tempa%
5983 {\@tempcnta\@tempa%
5984 \advance\@tempcnta\@ne\relax%
5985 }%
5986 {\@tempcnta\maxdimen}%
5987 \ifnum \thevpagerefnum =\@tempcnta%
5988 \ifodd\@tempcnta%
5989 \if@twoside%
5990 \reftextfaceafter%
5991 \else%
5992 \reftextafter%
5993 \fi%
5994 \else%
5995 \reftextafter%
5996 \fi%
5997 \else%
5998 \advance\@tempcnta-2\relax%
5999 \ifnum \thevpagerefnum =\@tempcnta%
6000 \ifodd\@tempcnta%
6001 \reftextbefore%
6002 \else%
6003 \if@twoside%
6004 \reftextfacebefore%
6005 \else%
6006 \reftextbefore%
6007 \fi%
6008 \fi%
6009 \else%
6010 \reftextfaraway{#3}%
6011 \fi%
6012 \fi%
6013 }%
6014 {\reftextfaraway{#3}}%
6015 \fi%
6016 \vref@label{\the\c@vrcnt @xvr}% <<<
6017 \vref@label{\the\c@vrcnt @vr}%
6018 }%
6019 % \end{macrocode}
6020 % \end{macro}
6021 %
6022 %
6023 % \begin{macro}{\cref@@vpageref}
6024 % We first enhance the core \package{varioref} |\vpageref| macro to
6025 % allow it to cope with lists of page references. This is done by
6026 % defining our version in terms of \package{cleveref}'s \cmd{\cpageref}
6027 % command, which handles multi-references, but telling \cmd{\cpageref}
6028 % to typeset the actual page references themselves using
6029 % \package{varioref}'s own page-referencing commands. (The alternative
6030 % version of \cmd{\vpagerefrange} is there to facilitate later
6031 % redefinitions.)
6032 %
6033 % Most of the work is done by defining suitable |\@setvpageref| etc.\
6034 % commands (below), called as appropriate by our ever-faithful
6035 % \cmd{\@cref} work-horse. We only make use of one of the optional
6036 % arguments to the original \package{varioref} |\@@vpageref| macro,
6037 % which we store here in \cmd{\cref@@vpageref} for later.
6038 % \begin{macrocode}
6039 \def\cref@@vpageref#1[#2]#3{%
6040 \begingroup%
6041 \def\cref@@vpageref@arg{#1}%
6042 \@cref{vpageref}{#3}%
6043 \endgroup}%
6044 % \end{macrocode}
6045 % \end{macro}
6046 %
6047 % \begin{macro}{\cref@vref}
6048 % \begin{macro}{\cref@vrefrange}
6049 % \begin{macro}{\cref@fullref}
6050 % Now we define \package{cleveref}-enhanced versions of the other
6051 % \package{varioref} cross-\linebreak[4]referencing commands, which use
6052 % \cmd{\cref} et al.\ to type set the cross-references, and the
6053 % \package{cleveref}-enhanced \cmd{\vpageref} et al.\ to typeset page
6054 % references.
6055 %
6056 % The original \cmd{\vref} command passes an empty first argument to
6057 % \cmd{\@@vpageref}, to omit the page reference if it refers to the
6058 % current page. In our case, we only want to omit it if it's the sole
6059 % page reference we're printing; otherwise we need to print it even if
6060 % it refers to the current page. This is taken care of by
6061 % \cmd{\cref@patchreftexts} (which gets called further down). For this
6062 % mechanism, it's more convenient to pass \cmd{\reftextcurrent} as the
6063 % first argument but temporarily redefine it to be empty, instead of
6064 % passing an empty first argument to \cmd{\cref@@vpageref}.
6065 % \begin{macrocode}
6066 \def\cref@vref#1#2{%
6067 \leavevmode%
6068 \begingroup%
6069 \def\reftextcurrent{}%
6070 \@cref{#1}{#2}\@setcref@space%
6071 \cref@@vpageref{\reftextcurrent}[]{#2}%
6072 \endgroup}%
6073 \def\cref@vrefrange#1#2#3{%
6074 \@@setcrefrange{#1}{#2}{#3}{}\@setcref@space\vpagerefrange{#2}{#3}}%
6075 \def\cref@fullref#1#2{%
6076 \@cref{#1}{#2}\@setcref@space\@cref{fullpageref}{#2}}%
6077 % \end{macrocode}
6078 % \end{macro}
6079 % \end{macro}
6080 % \end{macro}
6081 %
6082 % \begin{macro}{\cref@vpagerefconjunction}
6083 % When typesetting multi-references, we need to add appropriate
6084 % conjunctions to the page references produced by the
6085 % \package{varioref} macros. Since we need this in various different
6086 % commands, we separate it out into a self-contained macro.
6087 % \begin{macrocode}
6088 \def\cref@vpagerefconjunction#1{%
6089 \def\@tempa{#1}%
6090 \def\@tempb{@second}%
6091 \ifx\@tempa\@tempb\relax%
6092 \@setcref@pairconjunction%
6093 \else%
6094 \def\@tempb{@middle}%
6095 \ifx\@tempa\@tempb\relax%
6096 \@setcref@middleconjunction%
6097 \else%
6098 \def\@tempb{@last}%
6099 \ifx\@tempa\@tempb\relax%
6100 \@setcref@lastconjunction%
6101 \fi%
6102 \fi%
6103 \fi}%
6104 % \end{macrocode}
6105 % \end{macro}
6106 %
6107 % \begin{macro}{\@setcref@space}
6108 % We separate out the typesetting of the space between the
6109 % cross-reference and page-reference into a separate macro, to make it
6110 % easier to implement the \option{poorman} option.
6111 % \begin{macrocode}
6112 \def\@setcref@space{ }%
6113 % \end{macrocode}
6114 % \end{macro}
6115 %
6116 %
6117 % \begin{macro}{\@setvpageref}
6118 % The \cmd{\@setvpageref} macro is called by \cmd{\@cref} to typeset
6119 % page references using \package{varioref} commands, tweaked to work
6120 % with the enhanced \package{cleveref} page-referencing features.
6121 % |#1| is the reference itself. |#2| is either empty if we're
6122 % typesetting a single page reference, or one of |@first|, |@second|,
6123 % |@middle| or |@end|, identifying where the page reference comes in a
6124 % multi-reference. We only make use of one of the optional arguments to
6125 % the original \package{varioref} |\@@vpageref| macro, available here
6126 % as \cmd{\cref@@vpageref@arg} (stored there by \cmd{\cref@@vpageref},
6127 % above).
6128 % \begin{macrocode}
6129 \def\@setvpageref#1#2{%
6130 % \end{macrocode}
6131 % Add the appropriate conjunction before the page reference.
6132 % \begin{macrocode}
6133 \cref@vpagerefconjunction{#2}%
6134 % \end{macrocode}
6135 % Undefining |\vref@space| prevents the original \package{varioref}
6136 % |\@@vpageref| macro from |\unskip|ing any preceding space and
6137 % inserting its own. We definitely don't want it to do that here when
6138 % we're typesetting anything other than the first group of page
6139 % references, as any preceding space then is part of the preceding
6140 % conjunction, and should be strictly respected. But, since we're
6141 % modifying the \package{varioref} commands anyway, we take this
6142 % opportunity to get rid of the irritating \package{varioref} spacing
6143 % behaviour even for the first group of page references.
6144 % \begin{macrocode}
6145 \def\vref@space{}%
6146 % \end{macrocode}
6147 % Modify the \package{varioref} |\reftext|\meta{x} commands as
6148 % appropriate for the page reference we're currently typesetting, then
6149 % typeset the page reference.
6150 % \begin{macrocode}
6151 \begingroup%
6152 \cref@patchreftexts{#2}%
6153 \expandafter\@@@setvpageref\expandafter%
6154 {\cref@@vpageref@arg}[\vref@space]{#1}%
6155 \endgroup}%
6156 % \end{macrocode}
6157 % \end{macro}
6158 %
6159 % \begin{macro}{\@@@setvpageref}
6160 % We separate out the final type setting step, as always, to make it
6161 % easier to redefine things later.
6162 % \begin{macrocode}
6163 \let\@@@setvpageref\cref@old@@vpageref%
6164 % \end{macrocode}
6165 % \end{macro}
6166 %
6167 %
6168 % \begin{macro}{\@setvpagerefrange}
6169 % |\@setvpagerefrange| is similar to |\@setvpageref|, but typesets page
6170 % ranges. |#1| and |#2| are the labels themselves. |#3| is either empty
6171 % if we're typesetting a single page range, or one of |@first|,
6172 % |@second|, |@middle| or |@end|, identifying where the page reference
6173 % comes in a multi-reference. We only make use of one of the optional
6174 % arguments to the original \package{varioref} |\@@vpageref| macro,
6175 % available here as \cmd{\cref@@vpageref@arg} (stored there by
6176 % \cmd{\cref@@vpageref}, above).
6177 % \begin{macrocode}
6178 \def\@setvpagerefrange#1#2#3{%
6179 % \end{macrocode}
6180 % Add the appropriate conjunction before the page range reference.
6181 % \begin{macrocode}
6182 \cref@vpagerefconjunction{#3}%
6183 % \end{macrocode}
6184 % Unlike |\vpageref|, \package{varioref}'s |\vpagerefrange| command
6185 % \emph{doesn't} go in for quite the same space-mangling behaviour. We
6186 % still undefine \cmd{\vref@space}, though.
6187 % \begin{macrocode}
6188 \let\vref@space\relax%
6189 % \end{macrocode}
6190 % Modify the \package{varioref} |\reftext|\meta{x} commands as
6191 % appropriate for the page range we're currently typesetting, then
6192 % typeset the page range.
6193 % \begin{macrocode}
6194 \begingroup%
6195 \cref@patchreftexts{#3}%
6196 \expandafter\@@@setvpagerefrange\expandafter%
6197 [\cref@@vpageref@arg]{#1}{#2}%
6198 \endgroup}%
6199 % \end{macrocode}
6200 % \end{macro}
6201 %
6202 % \begin{macro}{\@@@setvpagerefrange}
6203 % Again, we separate out the final typesetting step, to aid later
6204 % redefinition.
6205 % \begin{macrocode}
6206 \let\@@@setvpagerefrange\vpagerefrange
6207 % \end{macrocode}
6208 % \end{macro}
6209 %
6210 % \begin{macro}{\@setfullpageref}
6211 % Ditto for \cmd{\@setfullpageref}, with |#1| the reference, |#2|
6212 % either empty, |@first|, |@second|, |@middle| or |@end|.
6213 % \begin{macrocode}
6214 \def\@setfullpageref#1#2{%
6215 % \end{macrocode}
6216 % Add the appropriate conjunction before the page reference.
6217 % \begin{macrocode}
6218 \cref@vpagerefconjunction{#2}%
6219 % \end{macrocode}
6220 % Modify the \package{varioref} |\reftext|\meta{x} commands as
6221 % appropriate for the page reference we're currently typesetting, then
6222 % typeset the page reference.
6223 % \begin{macrocode}
6224 \begingroup%
6225 \cref@patchreftexts{#2}%
6226 \@@@setfullpageref{#1}%
6227 \endgroup}%
6228 % \end{macrocode}
6229 % \end{macro}
6230 %
6231 % \begin{macro}{\@@@setfullpageref}
6232 % Separate out the final typesetting step, as usual.
6233 % \begin{macrocode}
6234 \let\@@@setfullpageref\reftextfaraway%
6235 % \end{macrocode}
6236 % \end{macro}
6237 %
6238 %
6239 % \begin{macro}{\@setfullpagerefrange}
6240 % Ditto for \cmd{\@setfullpagerefrange}, with |#1| and |#2| the
6241 % references, |#3| either empty, |@first|, |@second|, |@middle| or
6242 % |@end|.
6243 % \begin{macrocode}
6244 \def\@setfullpagerefrange#1#2#3{%
6245 % \end{macrocode}
6246 % Add the appropriate conjunction before the page reference.
6247 % \begin{macrocode}
6248 \cref@vpagerefconjunction{#3}%
6249 % \end{macrocode}
6250 % Modify the \package{varioref} |\reftext|\meta{x} commands as
6251 % appropriate for the page reference we're currently typesetting, then
6252 % typeset the page reference.
6253 % \begin{macrocode}
6254 \begingroup%
6255 \cref@patchreftexts{#3}%
6256 \@@@setfullpagerefrange{#1}{#2}%
6257 \endgroup}%
6258 % \end{macrocode}
6259 % \end{macro}
6260 %
6261 % \begin{macro}{\@@@setfullpagerefrange}
6262 % Separate out the final typesetting step, as usual.
6263 % \begin{macrocode}
6264 \let\@@@setfullpagerefrange\reftextpagerange%
6265 % \end{macrocode}
6266 % \end{macro}
6267 %
6268 %
6269 % We save the default \package{varioref} |\reftext|\meta{x} commands as
6270 % |\creftext|\meta{x}, before the user's had any chance to redefine them.
6271 % These are used if a |\reftext|\meta{x} is redefined to produce an empty
6272 % reference, to force a non-empty reference within multi-references.
6273 % \begin{macrocode}
6274 \let\creftextcurrent\reftextcurrent%
6275 \let\creftextfaceafter\reftextfaceafter%
6276 \let\creftextfacebefore\reftextfacebefore%
6277 \let\creftextafter\reftextafter%
6278 \let\creftextbefore\reftextbefore%
6279 \let\creftextfaraway\reftextfaraway%
6280 \let\creftextpagerange\reftextpagerange%
6281 % \end{macrocode}
6282 %
6283 % \begin{macro}{\cref@patchreftexts}
6284 % \begin{macro}{\cref@restorereftexts}
6285 % The |\cref@patchreftexts| command modifies \package{varioref}
6286 % |\reftext|\meta{x} commands, for use within |\@@setvpageref| and
6287 % |\@@setvpagerefrange|.
6288 % \begin{macrocode}
6289 \def\cref@patchreftexts#1{%
6290 \cref@patchreftext{reftextcurrent}{#1}%
6291 \cref@patchreftext{reftextfaceafter}{#1}%
6292 \cref@patchreftext{reftextfacebefore}{#1}%
6293 \cref@patchreftext{reftextafter}{#1}%
6294 \cref@patchreftext{reftextbefore}{#1}}%
6295 % \end{macrocode}
6296 % \end{macro}
6297 % \end{macro}
6298 %
6299 % \begin{macro}{\cref@patchreftext}
6300 % |\cref@patchreftext| does the hard work of modifying the
6301 % |\reftext|\meta{x} command given in |#1| as appropriate for the
6302 % |\@setvpageref| or |\@setvpagerefrange| command that it's called
6303 % from. (It can only be called from within one of those commands.)
6304 % |#2| is empty if we're typesetting a single page reference, or one of
6305 % |@first|, |@second|, |@middle| or |@end| when typesetting a
6306 % multi-reference.
6307 % \begin{macrocode}
6308 \def\cref@patchreftext#1#2{%
6309 \def\@tempa{#2}%
6310 % \end{macrocode}
6311 % If we're typesetting a single page reference\dots
6312 % \begin{macrocode}
6313 \ifx\@tempa\@empty%
6314 % \end{macrocode}
6315 % if the reftext command produces an empty reference, redefine it to
6316 % be |\unskip|.
6317 % \begin{macrocode}
6318 \def\@tempc{}%
6319 \expandafter\ifx\csname #1\endcsname\@tempc\relax%
6320 \expandafter\def\csname #1\endcsname{\unskip}%
6321 %{\advance\count@group -1\relax\reftextcurrent@orig}%
6322 \else%
6323 \long\def\@tempc{}%
6324 \expandafter\ifx\csname #1\endcsname\@tempc\relax%
6325 \expandafter\def\csname #1\endcsname{\unskip}%
6326 %{\advance\count@group -1\relax\reftextcurrent@orig}%
6327 \fi%
6328 \fi%
6329 % \end{macrocode}
6330 %
6331 % If we're typesetting a multi-reference\dots
6332 % \begin{macrocode}
6333 \else%
6334 % \end{macrocode}
6335 % if the reftext command produces an empty page reference, patch it
6336 % to instead use |\creftext|\meta{x}, which always produces a
6337 % non-empty reference.
6338 % \begin{macrocode}
6339 \long\def\@tempc{\unskip}%
6340 \expandafter\ifx\csname #1\endcsname\@tempc\relax%
6341 \expandafter\expandafter\expandafter\def%
6342 \expandafter\expandafter\csname #1\endcsname\expandafter{%
6343 \csname c#1\endcsname}%
6344 \else%
6345 \long\def\@tempc{}%
6346 \expandafter\ifx\csname #1\endcsname\@tempc\relax%
6347 \expandafter\expandafter\expandafter\def%
6348 \expandafter\expandafter\csname #1\endcsname\expandafter{%
6349 \csname c#1\endcsname}%
6350 \else%
6351 \def\@tempc{\unskip}%
6352 \expandafter\ifx\csname #1\endcsname\@tempc\relax%
6353 \expandafter\expandafter\expandafter\def%
6354 \expandafter\expandafter\csname #1\endcsname\expandafter{%
6355 \csname c#1\endcsname}%
6356 \else%
6357 \def\@tempc{}%
6358 \expandafter\ifx\csname #1\endcsname\@tempc\relax%
6359 \expandafter\expandafter\expandafter\def%
6360 \expandafter\expandafter\csname #1\endcsname\expandafter{%
6361 \csname c#1\endcsname}%
6362 \fi%
6363 \fi%
6364 \fi%
6365 \fi%
6366 \fi}%
6367 % \end{macrocode}
6368 % \end{macro}
6369 %
6370 %
6371 % \begin{macro}{\@setcref@pairconjunction}
6372 % \begin{macro}{\@setcref@middleconjunction}
6373 % \begin{macro}{\@setcref@lastconjunction}
6374 % We also add an extra macro layer for typesetting the conjunctions,
6375 % for the same reason. (Note that we only needed to do this for the
6376 % group conjunctions previously, as the other conjunctions are never
6377 % used directly in the normal \package{cleveref} commands. But
6378 % |\@setvpageref| and |\@setvpagerefrange| \emph{do} use them directly,
6379 % so now we do need macros to separate out the final type setting of
6380 % the rest of the conjunctions.)
6381 % \begin{macrocode}
6382 \def\@setcref@pairconjunction{\crefpairconjunction}%
6383 \def\@setcref@middleconjunction{\crefmiddleconjunction}%
6384 \def\@setcref@lastconjunction{\creflastconjunction}%
6385 % \end{macrocode}
6386 % \end{macro}
6387 % \end{macro}
6388 % \end{macro}
6389 %
6390 %
6391 % We now redefine the original \package{varioref} commands to use the
6392 % \package{cleveref}-enhanced versions. The redefinition of
6393 % \cmd{\@@vpageref} has to be postponed until the beginning of the
6394 % document, to make sure it overrides \package{hyperref}'s redefinition
6395 % (if loaded).
6396 % \begin{macrocode}
6397 \AtBeginDocument{%
6398 \let\@@vpageref\cref@@vpageref%
6399 }%
6400 % \end{macrocode}
6401 %
6402 % \begin{macro}{\vref}
6403 % \begin{macro}{\vref*}
6404 % \begin{macro}{\Vref}
6405 % \begin{macro}{\Vref*}
6406 % \begin{macro}{\vrefrange}
6407 % \begin{macro}{\vrefrange*}
6408 % \begin{macro}{\Vrefrange}
6409 % \begin{macro}{\Vrefrange*}
6410 % \begin{macro}{\fullref}
6411 % \begin{macro}{\fullref*}
6412 % \begin{macro}{\Fullref}
6413 % \begin{macro}{\Fullref*}
6414 % Since we're defining the spacing behaviour of \cmd{\vref} et al.\ to
6415 % be consistent with the other \package{cleveref} referencing commands,
6416 % this frees up the starred variants to be used to suppress hyperlinks
6417 % when \package{hyperref} is loaded, as usual.
6418 % \end{macro}
6419 % \end{macro}
6420 % \end{macro}
6421 % \end{macro}
6422 % \end{macro}
6423 % \end{macro}
6424 % \end{macro}
6425 % \end{macro}
6426 % \end{macro}
6427 % \end{macro}
6428 % \end{macro}
6429 % \end{macro}
6430 % \begin{macrocode}
6431 \if@cref@hyperrefloaded\relax% hyperref loaded%
6432 \DeclareRobustCommand{\vref}{%
6433 \@ifstar{\cref@vrefstar{cref}}{\cref@vref{cref}}}%
6434 \DeclareRobustCommand{\Vref}{%
6435 \@ifstar{\cref@vrefstar{Cref}}{\cref@vref{Cref}}}%
6436 \DeclareRobustCommand{\vrefrange}{%
6437 \@ifstar{\cref@vrefrangestar{cref}}{\cref@vrefrange{cref}}}%
6438 \DeclareRobustCommand{\Vrefrange}{%
6439 \@ifstar{\cref@vrefrangestar{Cref}}{\cref@vrefrange{Cref}}}%
6440 \DeclareRobustCommand{\fullref}{%
6441 \@ifstar{\cref@fullrefstar{cref}}{\cref@fullref{cref}}}%
6442 \DeclareRobustCommand{\Fullref}{%
6443 \@ifstar{\cref@fullrefstar{Cref}}{\cref@fullref{Cref}}}%
6444 \def\cref@vrefstar#1#2{%
6445 \@crefstarredtrue%
6446 \cref@vref{#1}{#2}%
6447 \@crefstarredfalse}%
6448 \def\cref@vrefrangestar#1#2#3{%
6449 \@crefstarredtrue%
6450 \cref@vrefrange{#1}{#2}{#3}%
6451 \@crefstarredfalse}%
6452 \def\cref@fullrefstar#1#2{%
6453 \@crefstarredtrue%
6454 \cref@fullref{#1}{#2}%
6455 \@crefstarredfalse}%
6456 \else%
6457 \DeclareRobustCommand{\vref}{\cref@vref{cref}}%
6458 \DeclareRobustCommand{\Vref}{\cref@vref{Cref}}%
6459 \DeclareRobustCommand{\vrefrange}{\cref@vrefrange{cref}}%
6460 \DeclareRobustCommand{\Vrefrange}{\cref@vrefrange{Cref}}%
6461 \DeclareRobustCommand{\fullref}{\cref@fullref{cref}}%
6462 \DeclareRobustCommand{\Fullref}{\cref@fullref{Cref}}%
6463 \fi% end of test for hyperref
6464 }{\let\if@cref@variorefloaded\iffalse}% end of \@ifpackageloaded{varioref}
6465 % \end{macrocode}
6466 % Add check to AtBeginDocument to throw error if \package{varioref} was
6467 % loaded after cleveref.
6468 % \begin{macrocode}
6469 \AtBeginDocument{%
6470 \if@cref@variorefloaded\relax\else%
6471 \@ifpackageloaded{varioref}{%
6472 \PackageError{cleveref}{cleveref must be loaded after varioref!}%
6473 {Package load order is wrong: load cleveref *after* varioref.}
6474 }{}%
6475 \fi}
6476 % \end{macrocode}
6477 %
6478 %
6479 %
6480 % \subsubsection{\package{amsmath} support}
6481 % \begin{macro}{amsmath}
6482 % \begin{macro}{\label}
6483 % \begin{macro}{\label@in@display}
6484 % The \package{amsmath} package redefines the \cmd{\label} command
6485 % within equation environments, so if it is loaded we have to extend
6486 % the behaviour to support the optional argument. With
6487 % \package{amsmath}, the original \cmd{\label} command is stored in
6488 % \cmd{\ltx@label}, and \cmd{\label@in@display} replaces \cmd{\label}
6489 % inside equations. \cmd{\label@in@display} just saves the label for
6490 % later, and defining it is left until the end of the equation, when
6491 % \cmd{\ltx@label} is finally called.
6492 %
6493 % To allow \cmd{\label} within equations to support an optional
6494 % argument, we first store the original \cmd{\label@in@display} and the
6495 % new \cmd{\label} macro we defined above (since \cmd{\label} will be
6496 % clobbered inside equations). Then we redefine \cmd{\label@in@display}
6497 % so that it wraps all its arguments, including any optional argument,
6498 % in an extra set of braces. These are stripped away again by
6499 % \cmd{\ltx@label} before calling the \package{cleveref} \cmd{\label}
6500 % command we defined previously (saved in \cmd{\cref@label}). As
6501 % before, we must postpone the redefinition of \cmd{\label} until the
6502 % beginning of the document, since other packages do so.
6503 % \begin{macrocode}
6504 \let\if@cref@amsmathloaded\iffalse%
6505 \@ifpackageloaded{amsmath}{%
6506 \let\if@cref@amsmathloaded\iftrue%
6507 \AtBeginDocument{%
6508 \let\cref@old@label@in@display\label@in@display%
6509 \def\label@in@display{%
6510 \@ifnextchar[\label@in@display@optarg\label@in@display@noarg}%]
6511 \def\label@in@display@noarg#1{\cref@old@label@in@display{{#1}}}%
6512 \def\label@in@display@optarg[#1]#2{%
6513 \cref@old@label@in@display{[#1]{#2}}}%
6514 \def\ltx@label#1{\cref@label#1}%
6515 }% end of AtBeginDocument
6516 % \end{macrocode}
6517 % \end{macro}
6518 % \end{macro}
6519 % \end{macro}
6520 %
6521 % \begin{macro}{\measure@}
6522 % \begin{macro}{\gmeasure@}
6523 % The \package{amsmath} multi-line equation environments scan their
6524 % bodies twice: once to measure, once to typeset. In the measure phase,
6525 % the \cmd{\label} command is disabled by letting it to \cmd{\@gobble}.
6526 % But this isn't sufficient to gobble all the arguments any more if an
6527 % optional argument is supplied to our new \cmd{\label}, so we have to
6528 % modify the \package{amsmath} measuring commands so that they let
6529 % \cmd{\label} to \cmd{\cref@gobble@optarg} instead.
6530 %
6531 % Unfortunately, \package{amsmath} wasn't designed with redefinitions
6532 % of \cmd{\label} in mind, so there appears to be no safe way of doing
6533 % this other than copying the \package{amsmath} definitions and making
6534 % the modification directly in the macro's code. This is a recipe for
6535 % future chaos if these commands are ever modified in a new version of
6536 % \package{amsmath}, but it seems we have no choice. Luckily,
6537 % \package{amsmath} isn't updated too often!
6538 % \begin{macrocode}
6539 \def\measure@#1{%
6540 \begingroup%
6541 \measuring@true%
6542 \global\eqnshift@\z@%
6543 \global\alignsep@\z@%
6544 \global\let\tag@lengths\@empty%
6545 \global\let\field@lengths\@empty%
6546 \savecounters@%
6547 \global\setbox0\vbox{%
6548 \let\math@cr@@@\math@cr@@@align@measure%
6549 \everycr{\noalign{\global\tag@false%
6550 \global\let\raise@tag\@empty \global\column@\z@}}%
6551 \let\label\cref@gobble@optarg% <<< cleveref modification
6552 \global\row@\z@%
6553 \tabskip\z@%
6554 \halign{\span\align@preamble\crcr%
6555 #1%
6556 \math@cr@@@%
6557 \global\column@\z@%
6558 \add@amps\maxfields@\cr%
6559 }%
6560 }%
6561 \restorecounters@%
6562 \ifodd\maxfields@%
6563 \global\advance\maxfields@\@ne\relax%
6564 \fi%
6565 \ifnum\xatlevel@=\tw@%
6566 \ifnum\maxfields@<\thr@@%
6567 \let\xatlevel@\z@%
6568 \fi%
6569 \fi%
6570 \setbox\z@\vbox{%
6571 \unvbox\z@ \unpenalty \global\setbox\@ne\lastbox%
6572 }%
6573 \global\totwidth@\wd\@ne%
6574 \if@fleqn \global\advance\totwidth@\@mathmargin\relax\fi%
6575 \global\let\maxcolumn@widths\@empty%
6576 \begingroup%
6577 \let\or\relax%
6578 \loop%
6579 \global\setbox\@ne\hbox{%
6580 \unhbox\@ne \unskip \global\setbox\thr@@\lastbox%
6581 }%
6582 \ifhbox\thr@@%
6583 \xdef\maxcolumn@widths{ \or \the\wd\thr@@ \maxcolumn@widths}%
6584 \repeat%
6585 \endgroup%
6586 \dimen@\displaywidth%
6587 \advance\dimen@-\totwidth@\relax%
6588 \ifcase\xatlevel@%
6589 \global\alignsep@\z@%
6590 \let\minalignsep\z@%
6591 \@tempcntb\z@%
6592 \if@fleqn%
6593 \@tempcnta\@ne%
6594 \global\eqnshift@\@mathmargin%
6595 \else%
6596 \@tempcnta\tw@%
6597 \global\eqnshift@\dimen@%
6598 \global\divide\eqnshift@\@tempcnta\relax%
6599 \fi%
6600 \or%
6601 \@tempcntb\maxfields@%
6602 \divide\@tempcntb\tw@\relax%
6603 \@tempcnta\@tempcntb%
6604 \advance\@tempcntb\m@ne\relax%
6605 \if@fleqn%
6606 \global\eqnshift@\@mathmargin%
6607 \global\alignsep@\dimen@%
6608 \global\divide\alignsep@\@tempcnta\relax%
6609 \else%
6610 \global\advance\@tempcnta\@ne\relax%
6611 \global\eqnshift@\dimen@%
6612 \global\divide\eqnshift@\@tempcnta\relax%
6613 \global\alignsep@\eqnshift@%
6614 \fi%
6615 \or%
6616 \@tempcntb\maxfields@%
6617 \divide\@tempcntb\tw@\relax%
6618 \global\advance\@tempcntb\m@ne\relax%
6619 \global\@tempcnta\@tempcntb\relax%
6620 \global\eqnshift@\z@%
6621 \global\alignsep@\dimen@%
6622 \if@fleqn%
6623 \global\advance\alignsep@\@mathmargin\relax%
6624 \fi%
6625 \global\divide\alignsep@\@tempcntb\relax%
6626 \fi%
6627 \ifdim\alignsep@<\minalignsep\relax%
6628 \global\alignsep@\minalignsep\relax%
6629 \ifdim\eqnshift@>\z@%
6630 \if@fleqn\else%
6631 \global\eqnshift@\displaywidth%
6632 \global\advance\eqnshift@-\totwidth@\relax%
6633 \global\advance\eqnshift@-\@tempcntb\alignsep@\relax%
6634 \global\divide\eqnshift@\tw@\relax%
6635 \fi%
6636 \fi%
6637 \fi%
6638 \ifdim\eqnshift@<\z@%
6639 \global\eqnshift@\z@%
6640 \fi%
6641 \calc@shift@align%
6642 \global\tagshift@\totwidth@%
6643 \global\advance\tagshift@\@tempcntb\alignsep@\relax%
6644 \if@fleqn%
6645 \ifnum\xatlevel@=\tw@%
6646 \global\advance\tagshift@-\@mathmargin\relax%
6647 \fi%
6648 \else%
6649 \global\advance\tagshift@\eqnshift@\relax%
6650 \fi%
6651 \iftagsleft@ \else%
6652 \global\advance\tagshift@-\displaywidth\relax%
6653 \fi%
6654 \dimen@\minalignsep\relax%
6655 \global\advance\totwidth@\@tempcntb\dimen@\relax%
6656 \ifdim\totwidth@>\displaywidth%
6657 \global\let\displaywidth@\totwidth@%
6658 \else%
6659 \global\let\displaywidth@\displaywidth%
6660 \fi%
6661 \endgroup%
6662 }%
6663 \def\gmeasure@#1{%
6664 \begingroup%
6665 \measuring@true%
6666 \totwidth@\z@%
6667 \global\let\tag@lengths\@empty%
6668 \savecounters@%
6669 \setbox\@ne\vbox{%
6670 \everycr{\noalign{\global\tag@false%
6671 \global\let\raise@tag\@empty \global\column@\z@}}%
6672 \let\label\@gobble% <<< cleveref modification
6673 \halign{%
6674 \setboxz@h{$\m@th\displaystyle{##}$}%
6675 \ifdim\wdz@>\totwidth@%
6676 \global\totwidth@\wdz@%
6677 \fi%
6678 &\setboxz@h{\strut@{##}}%
6679 \savetaglength@%
6680 \crcr%
6681 #1%
6682 \math@cr@@@%
6683 }%
6684 }%
6685 \restorecounters@%
6686 \if@fleqn%
6687 \global\advance\totwidth@\@mathmargin\relax%
6688 \fi%
6689 \iftagsleft@%
6690 \ifdim\totwidth@>\displaywidth%
6691 \global\let\gdisplaywidth@\totwidth@%
6692 \else%
6693 \global\let\gdisplaywidth@\displaywidth%
6694 \fi%
6695 \fi%
6696 \endgroup%
6697 }%
6698 % \end{macrocode}
6699 % \end{macro}
6700 % \end{macro}
6701 %
6702 % \begin{macro}{\multline@}
6703 % \begin{macro}{\mmeasure@}
6704 % \begin{macro}{\label@mmeasure@noarg}
6705 % \begin{macro}{\label@mmeasure@optarg}
6706 % The |multline| environment works a bit differently to the other
6707 % \package{amsmath} environments, in that \cmd{\label} is
6708 % \emph{disabled} during the typesetting phase, and \emph{enabled}
6709 % during the measuring phase. To cope with \package{cleveref}'s
6710 % optional argument, we have to define separate versions of
6711 % \cmd{\label@in@display} specifically for \cmd{\mmeasure@}.
6712 % \begin{macrocode}
6713 \def\multline@#1{%
6714 \Let@%
6715 \@display@init{\global\advance\row@\@ne\relax\global\dspbrk@lvl\m@ne}%
6716 \chardef\dspbrk@context\z@%
6717 \restore@math@cr%
6718 \let\tag\tag@in@align%
6719 \global\tag@false \global\let\raise@tag\@empty%
6720 \mmeasure@{#1}%
6721 \let\tag\gobble@tag \let\label\cref@gobble@optarg% <<< cleveref modification
6722 \tabskip \if@fleqn \@mathmargin \else \z@skip \fi%
6723 \totwidth@\displaywidth%
6724 \if@fleqn%
6725 \advance\totwidth@-\@mathmargin\relax%
6726 \fi%
6727 \halign\bgroup%
6728 \hbox to\totwidth@{%
6729 \if@fleqn%
6730 \hskip \@centering \relax%
6731 \else%
6732 \hfil%
6733 \fi%
6734 \strut@%
6735 $\m@th\displaystyle{}##\endmultline@math%
6736 \hfil%
6737 }% $
6738 \crcr%
6739 \if@fleqn%
6740 \hskip-\@mathmargin%
6741 \def\multline@indent{\hskip\@mathmargin}%
6742 \else%
6743 \hfilneg%
6744 \def\multline@indent{\hskip\multlinegap}%
6745 \fi%
6746 \iftagsleft@%
6747 \iftag@%
6748 \begingroup%
6749 \ifshifttag@%
6750 \rlap{\vbox{%
6751 \normalbaselines%
6752 \hbox{%
6753 \strut@%
6754 \make@display@tag%
6755 }%
6756 \vbox to\lineht@{}%
6757 \raise@tag%
6758 }}%
6759 \multline@indent%
6760 \else%
6761 \setbox\z@\hbox{\make@display@tag}%
6762 \dimen@\@mathmargin \advance\dimen@-\wd\z@\relax%
6763 \ifdim\dimen@<\multlinetaggap%
6764 \dimen@\multlinetaggap%
6765 \fi%
6766 \box\z@ \hskip\dimen@\relax%
6767 \fi%
6768 \endgroup%
6769 \else%
6770 \multline@indent%
6771 \fi%
6772 \else%
6773 \multline@indent%
6774 \fi%
6775 #1%
6776 }%
6777 \def\mmeasure@#1{%
6778 \begingroup%
6779 \measuring@true%
6780 \def\label{% <<< cleveref modification
6781 \@ifnextchar[\label@in@mmeasure@optarg%]
6782 \label@in@mmeasure@noarg}%
6783 \def\math@cr@@@{\cr}%
6784 \let\shoveleft\@iden \let\shoveright\@iden%
6785 \savecounters@%
6786 \global\row@\z@%
6787 \setbox\@ne\vbox{%
6788 \global\let\df@tag\@empty%
6789 \halign{%
6790 \setboxz@h{\@lign$\m@th\displaystyle{}##$}%
6791 \iftagsleft@%
6792 \ifnum\row@=\@ne%
6793 \global\totwidth@\wdz@%
6794 \global\lineht@\ht\z@%
6795 \fi%
6796 \else%
6797 \global\totwidth@\wdz@%
6798 \global\lineht@\dp\z@%
6799 \fi%
6800 \crcr%
6801 #1%
6802 \crcr%
6803 }%
6804 }%
6805 \ifx\df@tag\@empty\else\global\tag@true\fi%
6806 \if@eqnsw\global\tag@true\fi%
6807 \iftag@%
6808 \setboxz@h{%
6809 \if@eqnsw%
6810 \stepcounter{equation}%
6811 \tagform@\theequation%
6812 \else%
6813 \df@tag%
6814 \fi%
6815 }%
6816 \global\tagwidth@\wdz@%
6817 \dimen@\totwidth@%
6818 \advance\dimen@\tagwidth@\relax%
6819 \advance\dimen@\multlinetaggap\relax%
6820 \iftagsleft@\else%
6821 \if@fleqn%
6822 \advance\dimen@\@mathmargin\relax%
6823 \fi%
6824 \fi%
6825 \ifdim\dimen@>\displaywidth%
6826 \global\shifttag@true%
6827 \else%
6828 \global\shifttag@false%
6829 \fi%
6830 \fi%
6831 \restorecounters@%
6832 \endgroup%
6833 }%
6834 \def\label@in@mmeasure@noarg#1{%
6835 \begingroup%
6836 \measuring@false%
6837 \cref@old@label@in@display{{#1}}%
6838 \endgroup}%
6839 \def\label@in@mmeasure@optarg[#1]#2{%
6840 \begingroup%
6841 \measuring@false%
6842 \cref@old@label@in@display{[#1]{#2}}%
6843 \endgroup}%
6844 % \end{macrocode}
6845 % \end{macro}
6846 % \end{macro}
6847 % \end{macro}
6848 % \end{macro}
6849 %
6850 % \begin{macro}{subequations}
6851 % In order for |subequations| to be sorted properly, \package{cleveref}
6852 % needs to know that the |equation| counter is effectively reset by the
6853 % |parentequation| counter within the |subequations| environment. This
6854 % isn't how |amsmath| implements subequations (for obvious reasons!),
6855 % but we harmlessly add the |equation| counter to the |parentequation|
6856 % counter's reset list \emph{within} |subequations| environments, so
6857 % that \package{cleveref}'s sorting mechanism can figure things out. We
6858 % also harmlessly make sure |parentequation| is reset by the same
6859 % counter as |equation|.
6860 %
6861 % We also want to treat subequations as a separate cross-reference type
6862 % from equations. However, \package{amsmath} still uses the |equation|
6863 % counter for subequations, not a separate ``subequation'' counter. We
6864 % therefore temporarily alias |equation| to |subequation| within
6865 % subequation environments.
6866 % \begin{macrocode}
6867 \let\cref@old@subequations\subequations%
6868 \let\cref@old@endsubequations\endsubequations%
6869 \cref@resetby{equation}{\cref@result}%
6870 \ifx\cref@result\relax\else%
6871 \cref@addtoreset{parentequation}{\cref@result}%
6872 \fi%
6873 \renewenvironment{subequations}{%
6874 % \end{macrocode}
6875 % Temporarily declare |equation| counter to be reset by |parentequation|.
6876 % \begin{macrocode}
6877 \cref@addtoreset{equation}{parentequation}%
6878 % \end{macrocode}
6879 % Temporarily alias |equation| to |subequation|, or to whatever
6880 % |subequation| has been aliased to.
6881 % \begin{macrocode}
6882 \let\cref@orig@equation@alias\cref@equation@alias%
6883 \@ifundefined{cref@subequation@alias}%
6884 {\crefalias{equation}{subequation}}%
6885 {\def\@tempa{{equation}}%
6886 \expandafter\expandafter\expandafter\crefalias%
6887 \expandafter\@tempa\expandafter{\cref@subequation@alias}}%
6888 \cref@old@subequations%
6889 }{%
6890 % \end{macrocode}
6891 % Remove |equation| from |parentequation| counter's reset list.
6892 % \begin{macrocode}
6893 \gdef\cl@parentequation{}%
6894 \cref@old@endsubequations%
6895 \setcounter{parentequation}{0}%
6896 % \end{macrocode}
6897 % Restore original |equation| alias (if any).
6898 % \begin{macrocode}
6899 \@ifundefined{cref@orig@cref@equation@alias}%
6900 {\let\cref@equation@alias\relax}%
6901 {\let\cref@equation@alias\cref@orig@equation@alias\relax}%
6902 \let\cref@orig@equation@alias\relax%
6903 }%
6904 % \end{macrocode}
6905 % \end{macro}
6906 %
6907 % \begin{macro}{\make@df@tag@@}
6908 % \begin{macro}{\make@df@tag@@@}
6909 % We override the internals of the \package{amsmath} \cmd{\tag} command
6910 % to add the additional information to the label definition. Since
6911 % labels produced by \cmd{\tag} have no logical ordering when sorting a
6912 % list of references, we give them a large numerical value so that they
6913 % get pushed to the end of sorted cross-reference lists.
6914 % \begin{macrocode}
6915 \let\cref@old@make@df@tag@@\make@df@tag@@%
6916 \def\make@df@tag@@#1{%
6917 \cref@old@make@df@tag@@{#1}%
6918 \let\cref@old@df@tag\df@tag%
6919 \expandafter\gdef\expandafter\df@tag\expandafter{%
6920 \cref@old@df@tag%
6921 \def\cref@currentlabel{[equation][2147483647][]#1}}}%
6922 \let\cref@old@make@df@tag@@@\make@df@tag@@@%
6923 \def\make@df@tag@@@#1{%
6924 \cref@old@make@df@tag@@@{#1}%
6925 \let\cref@old@df@tag\df@tag%
6926 \expandafter\gdef\expandafter\df@tag\expandafter{%
6927 \cref@old@df@tag%
6928 \toks@\@xp{\p@equation{#1}}%
6929 \edef\cref@currentlabel{[equation][2147483647][]\the\toks@}}}%
6930 }{}% end of \@ifpackageloaded{amsmath}
6931 % \end{macrocode}
6932 % \end{macro}
6933 % \end{macro}
6934 %
6935 % Add check to AtBeginDocument to throw error if \package{amsmath} was
6936 % loaded after cleveref.
6937 % \begin{macrocode}
6938 \AtBeginDocument{%
6939 \if@cref@amsmathloaded\else%
6940 \@ifpackageloaded{amsmath}{%
6941 \PackageError{cleveref}{cleveref must be loaded after amsmath!}%
6942 {Package load order is wrong: load cleveref *after* amsmath.}
6943 }{}%
6944 \fi}
6945 %
6946 %
6947 %
6948 % \subsubsection{\package{amsthm} support}
6949 % \begin{macro}{amsthm}
6950 % If \package{amsthm} is loaded, we need to modify its theorem
6951 % referencing features so that they work with \package{cleveref}.
6952 % \begin{macrocode}
6953 \@ifpackageloaded{amsthm}{%
6954 \PackageInfo{cleveref}{`amsthm' support loaded}%
6955 % \end{macrocode}
6956 %
6957 % \begin{macro}{\@thm}
6958 % We modify \package{amsthm}'s version of the \cmd{\@thm} macro, to
6959 % have it call \cmd{\refstepcounter} with an optional argument
6960 % containing the theorem type.
6961 % \begin{macrocode}
6962 \let\cref@thmnoarg\@thm%
6963 \def\@thm{\@ifnextchar[{\cref@thmoptarg}{\cref@thmnoarg}}%]
6964 \def\cref@thmoptarg[#1]#2#3#4{%
6965 \ifhmode\unskip\unskip\par\fi%
6966 \normalfont%
6967 \trivlist%
6968 \let\thmheadnl\relax%
6969 \let\thm@swap\@gobble%
6970 \thm@notefont{\fontseries\mddefault\upshape}%
6971 \thm@headpunct{.}% add period after heading
6972 \thm@headsep 5\p@ plus\p@ minus\p@\relax%
6973 \thm@space@setup%
6974 #2% style overrides
6975 \@topsep \thm@preskip % used by thm head
6976 \@topsepadd \thm@postskip % used by \@endparenv
6977 \def\@tempa{#3}\ifx\@empty\@tempa%
6978 \def\@tempa{\@oparg{\@begintheorem{#4}{}}[]}%
6979 \else%
6980 \refstepcounter[#1]{#3}% <<< cleveref modification
6981 \def\@tempa{\@oparg{\@begintheorem{#4}{\csname the#3\endcsname}}[]}%
6982 \fi%
6983 \@tempa}%
6984 % \end{macrocode}
6985 % \end{macro}
6986 %
6987 % \begin{macro}{\@ynthm}
6988 % We also have to modify \package{amsthm}'s \cmd{\@ynthm} command so
6989 % that it passes the optional argument to \cmd{\@thm}. Since
6990 % \package{amsmath}'s \cmd{\@ynthm} takes a different parameter list to
6991 % the standard \LaTeX{} \cmd{\@ynthm} macro, we deliberately override
6992 % our previous redefinition, and add the code for the automatic
6993 % \cmd{\crefname} definitions directly to this version.
6994 % \begin{macrocode}
6995 \def\@ynthm#1[#2]#3{%
6996 % \end{macrocode}
6997 % Here's the automatic \cmd{\crefname} definition.
6998 % \begin{macrocode}
6999 \edef\@tempa{\expandafter\noexpand%
7000 \csname cref@#1@name@preamble\endcsname}%
7001 \edef\@tempb{\expandafter\noexpand%
7002 \csname Cref@#1@name@preamble\endcsname}%
7003 \def\@tempc{#3}%
7004 \ifx\@tempc\@empty\relax%
7005 \expandafter\gdef\@tempa{}%
7006 \expandafter\gdef\@tempb{}%
7007 \else%
7008 \if@cref@capitalise%
7009 \expandafter\expandafter\expandafter\gdef\expandafter%
7010 \@tempa\expandafter{\MakeUppercase #3}%
7011 \else%
7012 \expandafter\expandafter\expandafter\gdef\expandafter%
7013 \@tempa\expandafter{\MakeLowercase #3}%
7014 \fi%
7015 \expandafter\expandafter\expandafter\gdef\expandafter%
7016 \@tempb\expandafter{\MakeUppercase #3}%
7017 \fi%
7018 \cref@stack@add{#1}{\cref@label@types}%
7019 % \end{macrocode}
7020 % Here's the original \package{amsthm} \cmd{\@ynthm} definition, with
7021 % the \package{cleveref} modification.
7022 % \begin{macrocode}
7023 \ifx\relax#2\relax%
7024 \def\@tempa{\@oparg{\@xthm{#1}{#3}}[]}%
7025 \else%
7026 \@ifundefined{c@#2}{%
7027 \def\@tempa{\@nocounterr{#2}}%
7028 }{%
7029 \@xp\xdef\csname the#1\endcsname{\@xp\@nx\csname the#2\endcsname}%
7030 \toks@{#3}%
7031 \@xp\xdef\csname#1\endcsname{%
7032 \@nx\@thm[#1]{% <<< new optional argument for theorem name
7033 \let\@nx\thm@swap%
7034 \if S\thm@swap\@nx\@firstoftwo\else\@nx\@gobble\fi%
7035 \@xp\@nx\csname th@\the\thm@style\endcsname}%
7036 {#2}{\the\toks@}}%
7037 \let\@tempa\relax%
7038 }%
7039 \fi%
7040 \@tempa}%
7041 % \end{macrocode}
7042 % \end{macro}
7043 %
7044 % \begin{macro}{\@xnthm}
7045 % Finally, we have to restore the \package{amsthm} version of
7046 % \cmd{\@xnthm}, which we stored earlier in \cmd{\cref@old@xnthm} and
7047 % redefined. With \package{amsthm}, \cmd{\@xnthm} calls \cmd{\@ynthm},
7048 % so the automatic \cmd{\crefname} definition is already taken care of.
7049 % \begin{macrocode}
7050 \let\@xnthm\cref@old@xnthm%
7051 }{}% end of \@ifpackageloaded{amsthm}
7052 % \end{macrocode}
7053 % \end{macro}
7054 %
7055 %
7056 %
7057 % \subsubsection{\package{ntheorem} support}
7058 % \begin{macro}{ntheorem}
7059 % \begin{macro}{thref}
7060 % If \package{ntheorem} is loaded, we need to modify its theorem
7061 % referencing features so that they work with \package{cleveref}.
7062 % \begin{macrocode}
7063 \@ifpackageloaded{ntheorem}{%
7064 \PackageInfo{cleveref}{`ntheorem' support loaded}%
7065 \@ifpackagewith{ntheorem}{thref}{%
7066 \PackageWarning{cleveref}{`cleveref' supersedes `ntheorem's `thref'
7067 option}%
7068 \renewcommand{\thref}{\cref}}{}%
7069 % \end{macrocode}
7070 %
7071 % \begin{macro}{\theorem@prework}
7072 % Newer versions of \package{ntheorem} require a call to
7073 % \cmd{\theorem@prework} when typesetting theorems. If an older
7074 % version of \package{ntheorem} is being used, we just \cmd{\let} it to
7075 % \cmd{\relax} to make sure it's defined.
7076 % \begin{macrocode}
7077 \@ifundefined{theorem@prework}{\let\theorem@prework\relax}{}%
7078 % \end{macrocode}
7079 % \end{macro}
7080 %
7081 % \begin{macro}{\@thm}
7082 % We modify \package{ntheorem}'s version of the \cmd{\@thm} macro very
7083 % slightly, to have it call \cmd{\refstepcounter} with an optional
7084 % argument containing the theorem type.
7085 % \begin{macrocode}
7086 \gdef\@thm#1#2#3{%
7087 \if@thmmarks%
7088 \stepcounter{end\InTheoType ctr}%
7089 \fi%
7090 \renewcommand{\InTheoType}{#1}%
7091 \if@thmmarks%
7092 \stepcounter{curr#1ctr}%
7093 \setcounter{end#1ctr}{0}%
7094 \fi%
7095 \refstepcounter[#1]{#2}% <<< cleveref modification
7096 \theorem@prework%
7097 \thm@topsepadd \theorempostskipamount%
7098 \ifvmode \advance\thm@topsepadd\partopsep\relax\fi%
7099 \trivlist%
7100 \@topsep \theorempreskipamount%
7101 \@topsepadd \thm@topsepadd%
7102 \advance\linewidth -\theorem@indent\relax%
7103 \advance\@totalleftmargin \theorem@indent\relax%
7104 \parshape \@ne \@totalleftmargin \linewidth%
7105 \@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}%]
7106 }%
7107 }{}% end of \@ifpackageloaded{ntheorem}
7108 % \end{macrocode}
7109 % \end{macro}
7110 % \end{macro}
7111 % \end{macro}
7112 %
7113 %
7114 %
7115 % \subsubsection{\package{IEEEtrantools} support}
7116 % \begin{macro}{IEEEtrantools}
7117 % The |IEEEeqnarray| environment and \cmd{\IEEEeqnarraccr} command calls
7118 % \cmd{\stepcounter} instead of \cmd{\refstepcounter} to increment the
7119 % equation counters, so they fail to set the cross-reference type for
7120 % \package{cleveref}. We patch in calls to \cmd{\refstepcounter} to fix
7121 % this.
7122 % \begin{macrocode}
7123 \@ifpackageloaded{IEEEtrantools}{%
7124 \PackageInfo{cleveref}{`IEEEtrantools' support loaded}%
7125 % \end{macrocode}
7126 %
7127 % \begin{macro}{\@@IEEEeqnarray}
7128 % Rather than copying the whole of \cmd{\@@IEEEeqnarray} just to patch
7129 % the \cmd{\stepcounter} line (which would be fragile and liable to
7130 % breakage), we insert an extra step which calls \cmd{\refstepcounter}
7131 % to set the cross-reference type, then decrements the |equation|
7132 % counter by one, before calling the original \cmd{\@@IEEEeqnarray}.
7133 % \begin{macrocode}
7134 \let\cref@orig@@IEEEeqnarray\@@IEEEeqnarray%
7135 \def\@@IEEEeqnarray[#1]#2{%
7136 \refstepcounter{equation}%
7137 \addtocounter{equation}{-1}%
7138 \cref@orig@@IEEEeqnarray[#1]{#2}}%
7139 % \end{macrocode}
7140 % \end{macro}
7141 %
7142 % We do the same thing with \cmd{\@IEEEeqnarrayXCR}, the last in the
7143 % chain of macros that gets invoked by |\\| (let to
7144 % \cmd{\IEEEeqnarraycr}) within |IEEEeqnarray| environments.
7145 % \begin{macro}{\@IEEEeqnarrayXCR}
7146 % \begin{macrocode}
7147 \let\cref@orig@IEEEeqnarrayXCR\@IEEEeqnarrayXCR%
7148 % \end{macrocode}
7149 % Newer versions of \package{IEEEtrantools} replace
7150 % |\if@IEEEissubequation| conditional with a counter |\c@IEEEsubequation|
7151 % that is $>0$ in subequations.
7152 % \begin{macrocode}
7153 \@ifundefined{c@IEEEsubequation}{%
7154 \def\@IEEEeqnarrayXCR[#1]{%
7155 \if@eqnsw%
7156 \if@IEEEissubequation%
7157 \refstepcounter{IEEEsubequation}%
7158 \addtocounter{IEEEsubequation}{-1}%
7159 \else%
7160 \refstepcounter{equation}%
7161 \addtocounter{equation}{-1}%
7162 \fi%
7163 \fi%
7164 \cref@orig@IEEEeqnarrayXCR[#1]}%
7165 }{
7166 \def\@IEEEeqnarrayXCR[#1]{%
7167 \if@eqnsw%
7168 \ifnum\c@IEEEsubequation>0\relax%
7169 \refstepcounter{IEEEsubequation}%
7170 \addtocounter{IEEEsubequation}{-1}%
7171 \else%
7172 \refstepcounter{equation}%
7173 \addtocounter{equation}{-1}%
7174 \fi%
7175 \fi%
7176 \cref@orig@IEEEeqnarrayXCR[#1]}%
7177 }% end of \@ifundefined{c@IEEEsubequation}
7178 % \end{macrocode}
7179 % \end{macro}
7180 %
7181 % \begin{macro}{\IEEEyessubnumber}
7182 % And again for \cmd{\IEEEyessubnumber} (used to turn an equation into a
7183 % subequation).
7184 % \begin{macrocode}
7185 \let\cref@orig@IEEEyessubnumber\IEEEyessubnumber%
7186 \def\IEEEyessubnumber{%
7187 \if@IEEEeqnarrayISinner%
7188 \if@IEEElastlinewassubequation\else%
7189 \setcounter{IEEEsubequation}{0}%
7190 \refstepcounter{IEEEsubequation}%
7191 \fi%
7192 \fi%
7193 \cref@orig@IEEEyessubnumber}%
7194 % \end{macrocode}
7195 % \end{macro}
7196 %
7197 % \begin{macro}{IEEEsubequation}
7198 % To get the subequation formatting right, we harmlessly add the
7199 % |IEEEsubequation| counter to the |equation| counter reset list so
7200 % that \package{cleveref} can figure out the subnumbering relationship,
7201 % and define |IEEEsubequation| to be an alias of the |subequation| format.
7202 % \begin{macrocode}
7203 \cref@addtoreset{IEEEsubequation}{subequation}%
7204 \crefalias{IEEEsubequation}{subequation}%
7205 % \end{macrocode}
7206 % \end{macro}
7207 %
7208 % \begin{macrocode}
7209 }{}% end of \@ifpackageloaded{IEEEtrantools}
7210 % \end{macrocode}
7211 % \end{macro}
7212 %
7213 %
7214 %
7215 % \subsubsection{\package{breqn} support}
7216 % \begin{macro}{breqn}
7217 % The \package{breqn} package uses \cmd{\eq@setcounter} instead of
7218 % \cmd{\refstepcounter} to set equation numbers, which as usual breaks
7219 % \package{cleveref}. To fix this, we have to patch
7220 % \cmd{\eq@setcounter} with similar code to that already added to
7221 % \cmd{\refstepcounter}.
7222 % \begin{macrocode}
7223 \@ifpackageloaded{breqn}{%
7224 \PackageInfo{cleveref}{`breqn' support loaded}%
7225 \let\cref@old@eq@setnumber\eq@setnumber%
7226 \def\eq@setnumber{%
7227 \cref@old@eq@setnumber%
7228 \cref@constructprefix{equation}{\cref@result}%
7229 \protected@xdef\cref@currentlabel{%
7230 [equation][\arabic{equation}][\cref@result]\p@equation\eq@number}}%
7231 }{}% end of \@ifpackageloaded{breqn}
7232 % \end{macrocode}
7233 % \end{macro}
7234 %
7235 %
7236 %
7237 % \subsubsection{\package{algorithmicx} support}
7238 % \begin{macro}{algorithmicx}
7239 % If \package{algorithmicx} is loaded, we modify its line numbering
7240 % mechanism so that labels referring to line numbers in algorithms work
7241 % with \package{cleveref}.
7242 % \end{macro}
7243 % \begin{macrocode}
7244 \@ifpackageloaded{algorithmicx}{%
7245 \PackageInfo{cleveref}{`algorithmicx' support loaded}%
7246 % \end{macrocode}
7247 %
7248 % \begin{macro}{\ALG@step}
7249 % We modify \package{algorithmicx}'s \cmd{\ALG@step} macro, which
7250 % increments the line number, so that it stores the necessary
7251 % information in \cmd{\cref@currentlabel}. \cmd{\ALG@step} already
7252 % increments the line number counter \cmd{\ALG@line} using
7253 % \cmd{\addtocounter}, but to get \package{cleveref} support working,
7254 % it's cleaner to hook into the \cmd{\refstepcounter} mechanism, so we
7255 % first decrement the counter and then re-increment it using
7256 % \cmd{\refstepcounter}.
7257 % \begin{macrocode}
7258 \g@addto@macro\ALG@step{%
7259 \addtocounter{ALG@line}{-1}%
7260 \refstepcounter{ALG@line}%
7261 \expandafter\@cref@getprefix\cref@currentlabel\@nil\cref@currentprefix%
7262 \xdef\cref@currentprefix{\cref@currentprefix}}%
7263 % \end{macrocode}
7264 % \end{macro}
7265 %
7266 % \begin{macro}{\ALG@beginalgorithmic}
7267 % However, this is not yet sufficient. The \cmd{\refstepcounter} above
7268 % is called within a group, so the resulting \cmd{\cref@currentlabel}
7269 % definition will not persist beyond the end of the group. To transfer
7270 % the information to the ``outside'', we follow \package{algorithmicx}'
7271 % own method for getting the label information into
7272 % \cmd{\@currentlabel}: we define \cmd{\cref@currentlabel} within
7273 % |algorithm| environments to refer specifically to macros that store
7274 % the line number information. The package conveniently supplies a
7275 % \cmd{\ALG@beginalgorithmic} hook, so we make use of it here.
7276 % \begin{macrocode}
7277 \g@addto@macro\ALG@beginalgorithmic{%
7278 \def\cref@currentlabel{%
7279 [line][\arabic{ALG@line}][\cref@currentprefix]\theALG@line}}%
7280 }{}% end of \@ifpackageloaded{algorithmicx}
7281 % \end{macrocode}
7282 % \end{macro}
7283 %
7284 %
7285 %
7286 % \subsubsection{\package{listings} support}
7287 % \begin{macro}{listings}
7288 % To support cross-references to listings produced by the
7289 % \package{listings} package, all we need to do is alias the counter it
7290 % uses, \cmd{\lstnumber}, to the ``listing'' cross-reference type.
7291 % \begin{macrocode}
7292 \@ifpackageloaded{listings}{%
7293 \PackageInfo{cleveref}{`listings' support loaded}%
7294 \crefalias{lstlisting}{listing}%
7295 \crefalias{lstnumber}{line}%
7296 % \end{macrocode}
7297 %
7298 % However, supporting cross-references to the line numbers is
7299 % unfortunately a little more complicated than simply aliasing the
7300 % ``lstnumber'' counter to the ``line'' cross-reference type (above).
7301 % \package{listings} calls \cmd{\refstepcounter} from its
7302 % \cmd{\lsthk@EveryPar} hook. But the hook macro is expanded inside a
7303 % group. So that \cmd{\refstepcounter} call is completely useless:
7304 % neither the \cmd{\@currentlabel} nor the \cmd{\cref@currentlabel}
7305 % definitions make it out of the group, so they have no effect on
7306 % \cmd{\label} definitions!
7307 %
7308 % To make line labels work, \package{listings} sets \cmd{\@currentlabel}
7309 % to \cmd{\thelstnumber} at the beginning of a listing, via the
7310 % \cmd{\lsthk@Init} hook, and it is \emph{this} (and not
7311 % \cmd{\refstepcounter}) which causes the current line number to be
7312 % picked up by \cmd{\label}s. To get line numbers working with
7313 % \package{cleveref} too, we need to replicate this for
7314 % \cmd{\cref@currentlabel}, which is what the following hook code does.
7315 %
7316 % \begin{macro}{\lsthk@Init}
7317 % \begin{macro}{\lsthk@EveryPar}
7318 % \begin{macrocode}
7319 \lst@AddToHook{Init}{%
7320 \def\cref@currentlabel{%
7321 [line][\arabic{lstnumber}][\cref@currentprefix]\thelstnumber}}%
7322 \lst@AddToHook{EveryPar}{%
7323 \expandafter\@cref@getprefix\cref@currentlabel\@nil\cref@currentprefix%
7324 \xdef\cref@currentprefix{\cref@currentprefix}}%
7325 }{}% end of \@ifpackageloaded{listings}
7326 % \end{macrocode}
7327 % \end{macro}
7328 % \end{macro}
7329 % \end{macro}
7330 %
7331 %
7332 %
7333 % \subsubsection{\package{algorithm2e} support}
7334 % \begin{macro}{algorithm2e}
7335 % When \package{hyperref} is not loaded, all we need to do to support
7336 % the \package{algorithm2e} package is to alias its counters,
7337 % \cmd{\algocf}, \cmd{AlgoLine} and \cmd{\algocfline}, to the
7338 % ``algorithm'' and ``line'' cross-reference types.
7339 % \begin{macrocode}
7340 \@ifpackageloaded{algorithm2e}{%
7341 \PackageInfo{cleveref}{`algorithm2e' support loaded}%
7342 \crefalias{algocf}{algorithm}%
7343 \crefalias{algocfline}{line}%
7344 \crefalias{AlgoLine}{line}%
7345 % \end{macrocode}
7346 % When \package{hyperref} \emph{is} loaded, \package{algorithm2e} does
7347 % some trickery when stepping the line number counter to avoid getting
7348 % duplicate hyperlink anchor names, and updates \cmd{@currentlabel}
7349 % manually. Unfortunately, this by-passes both \cmd{\refstepcounter} and
7350 % \cmd{\H@refstepcounter}, so \cmd{\cref@currentlabel} never gets
7351 % updated. To fix this, we have to hack its \cmd{algocf@nl@sethref} macro
7352 % to update \cmd{cref@currentlabel} along with \cmd{@currentlabel}.
7353 % \begin{macrocode}
7354 \let\cref@old@algocf@nl@sethref\algocf@nl@sethref%
7355 \renewcommand{\algocf@nl@sethref}[1]{%
7356 \cref@old@algocf@nl@sethref{#1}%
7357 \cref@constructprefix{AlgoLine}{\cref@result}%
7358 \@ifundefined{cref@AlgoLine@alias}%
7359 {\def\@tempa{AlgoLine}}%
7360 {\def\@tempa{\csname cref@AlgoLine@alias\endcsname}}%
7361 \xdef\cref@currentlabel{%
7362 [\@tempa][\arabic{AlgoLine}][\cref@result]%
7363 \csname p@AlgoLine\endcsname\csname theAlgoLine\endcsname}}%
7364 }{}% end of \@ifpackageloaded{algorithm2e}
7365 % \end{macrocode}
7366 % \end{macro}
7367 %
7368 %
7369 %
7370 % \subsubsection{\package{subfig} support}
7371 % \begin{macro}{subfig}
7372 % The \package{subfig} package modifies \cmd{\refstepcounter} within
7373 % floats. Most of the time, this isn't a problem for
7374 % \package{cleveref}, as \package{subfig}'s modified
7375 % \cmd{\refstepcounter} calls \package{cleveref}'s version after it's
7376 % done its stuff. However, this breaks support the
7377 % \cmd{\refstepcounter} optional argument, so we fix that here.
7378 %
7379 % \package{Subfig} also redefines \cmd{\label} within subfloats,
7380 % breaking \package{cleveref}'s optional argument. We also fix that.
7381 % \begin{macrocode}
7382 \@ifpackageloaded{subfig}{%
7383 \PackageInfo{cleveref}{`subfig' support loaded}%
7384 % \end{macrocode}
7385 %
7386 % \begin{macro}{\refsteponlycounter}
7387 % \package{subfig} replaces \cmd{\refstepcounter} with
7388 % \cmd{\refsteponlycounter} within floats, which calls the saved
7389 % \package{cleveref} \cmd{\refstepcounter} after doing some extra
7390 % \package{subfig}-related processing. We redefine
7391 % \cmd{\refsteponlycounter} so that passing it an optional argument
7392 % bypasses \package{subfig}'s code entirely and just calls the
7393 % \package{cleveref} code directly. Since only
7394 % \package{cleveref}-specific commands will ever pass an optional
7395 % argument to \cmd{\refstepcounter}, this won't affect
7396 % \package{subfig}'s use of \cmd{\refstepcounter}. We have to postpone
7397 % this redefinition until the beginning of the document because
7398 % \package{subfig} does.
7399 % \begin{macrocode}
7400 \AtBeginDocument{%
7401 \let\cref@old@refsteponlycounter\refsteponlycounter%
7402 \def\refsteponlycounter{%
7403 \@ifnextchar[\refstepcounter@optarg%
7404 \cref@old@refsteponlycounter%]
7405 }}%
7406 % \end{macrocode}
7407 % \end{macro}
7408 %
7409 % \begin{macro}{\sf@sub@label}
7410 % \begin{macro}{\sf@old@label}
7411 % \begin{macro}{\cref@old@label}
7412 % Inside a subfloat, \package{subfig} captures the current \cmd{\label}
7413 % definition in \cmd{\sf@oldlabel}, then replaces \cmd{\label} with
7414 % \cmd{\subfloat@label}, which does additional argument and
7415 % subfloat-related processing before calling \cmd{\sf@oldlabel}. This
7416 % breaks \package{cleveref}'s \cmd{\label} optional argument.
7417 %
7418 % We need to insert an extra layer of processing into the chain of
7419 % redefined \cmd{\label} macro calls, to process \package{cleveref}'s
7420 % optional argument. We do this by redefining \package{subfig}'s
7421 % \cmd{\sf@sub@label} command to process \package{subfig}'s optional
7422 % argument (which uses parentheses rather than square brackets) as usual,
7423 % but then have it call \cmd{\cref@label} which stores
7424 % \package{cleveref}'s \cmd{\label} command (recall that we're inside a
7425 % subfloat here, where \package{subfig} has overridden the \cmd{\label}
7426 % macro itself), to process \package{cleveref}'s own \cmd{\label}
7427 % optional argument.
7428 %
7429 % \cmd{\cref@label} would normally call the original \cmd{\label}
7430 % definition stored in \cmd{\cref@old@label}, whereas here we want it
7431 % to instead call \cmd{\sf@@sub@label}, the next layer of the
7432 % \package{subfig} \cmd{\label} macro stack, otherwise we bypass the
7433 % rest of the \package{subfig} processing and break it. So we
7434 % temporarily let \cmd{\cref@old@label} to \cmd{\sf@@sub@label}, so
7435 % that \cmd{\cref@label} hands back to \package{subfig}'s \cmd{\label}
7436 % processing when done. (We're inside a group, so \cmd{\cref@old@label}
7437 % gets restored at the end of the subfloat.)
7438 %
7439 % The final issue is that \package{subfig} captures the original
7440 % \cmd{\label} definition in \cmd{\sf@oldlabel} at the beginning of the
7441 % subfloat. But this captures \package{cleveref}'s
7442 % definition,\footnote{Actually, because \package{subfig} always loads
7443 % the \package{caption} package, it captures \package{cleveref}'s
7444 % \package{caption}-related redefinition of \cmd{\label}.} instead of
7445 % the original \cmd{\label} definition that needs to be called after
7446 % \package{subfig} has finished its stuff. So, we let \cmd{\sf@oldlabel}
7447 % to \cmd{\cref@old@label} before redefining the latter, so that the
7448 % \package{subfig} \cmd{\label} stack calls the right thing once it's
7449 % done its own processing. Oof!
7450 % \begin{macrocode}
7451 \def\sf@sub@label(#1){%
7452 \ifhyperrefloaded%
7453 \protected@edef\@currentlabelname{%
7454 \expandafter\strip@period #1\relax.\relax\@@@}%
7455 \fi%
7456 \let\sf@oldlabel\cref@old@label%
7457 \let\cref@old@label\sf@@sub@label%
7458 \cref@label}%
7459 % \end{macrocode}
7460 % \end{macro}
7461 % \end{macro}
7462 % \end{macro}
7463 %
7464 % \begin{macrocode}
7465 }{}% end of \@ifpackageloaded{subfig}
7466 % \end{macrocode}
7467 % \end{macro}
7468 %
7469 %
7470 %
7471 % \subsubsection{\package{memoir} subfig support}
7472 % \begin{macro}{memoir}
7473 % We try to stay out of \package{memoir}'s way as much as possible, by
7474 % using a separate set of parallel label definitions for
7475 % \package{cleveref}, and leaving the standard labels alone for
7476 % \package{memoir} and other packages to use as normal. The one
7477 % remaining point of contention is the \cmd{\label} command itself.
7478 %
7479 % \begin{macro}{\sf@memsub@label}
7480 % \begin{macro}{\@memoldlabel}
7481 % \begin{macro}{\cref@old@label}
7482 % \package{memoir} contains its own internal re-implementation of
7483 % \package{subfig}, which redefines \cmd{\label} in a very similar way.
7484 % We therefore have to replicate the \package{subfig} support for
7485 % \package{memoir}'s internal re-implementation. (We have to postpone
7486 % the redefinitions until the beginning of the document because
7487 % \package{memoir} does, too.)
7488 % \begin{macrocode}
7489 \@ifclassloaded{memoir}{%
7490 \AtBeginDocument{%
7491 \def\sf@memsub@label(#1){%
7492 \protected@edef\mem@currentlabelname{#1}%
7493 \let\@memoldlabel\cref@old@label%
7494 \let\cref@old@label\sf@@memsub@label%
7495 \cref@label}}%
7496 }{}%
7497 % \end{macrocode}
7498 % \end{macro}
7499 % \end{macro}
7500 % \end{macro}
7501 % \end{macro}
7502 %
7503 %
7504 %
7505 % \subsubsection{\package{caption} support}
7506 % \begin{macro}{caption}
7507 % The \package{caption} package redefines \cmd{\label} within floats.
7508 % Since version 3.2c, it is careful to redefine \cmd{\label} in a way
7509 % that doesn't break any optional arguments introduced by other
7510 % packages (such as \package{cleveref}'s), so we no longer need to add
7511 % any compatibility hacks.
7512 %
7513 % Earlier versions of \package{caption} do break \package{cleveref}'s
7514 % optional argument, however, so we have to fix things here for those
7515 % versions.
7516 % \begin{macrocode}
7517 \@ifpackageloaded{caption}{%
7518 \@ifpackagelater{caption}{2011/08/19}{}{%
7519 \PackageInfo{cleveref}{`caption' support loaded}%
7520 % \end{macrocode}
7521 %
7522 % \begin{macro}{\cref@old@caption@xlabel}
7523 % \begin{macro}{\cref@old@label}
7524 % \begin{macro}{\cref@ORI@label}
7525 % \begin{macro}{\caption@ORI@label}
7526 % We fix the \cmd{\label} argument parsing by redefining
7527 % \cmd{\caption@xlabel}, the macro which \cmd{\label} is let to inside
7528 % floats, to juggle around the various \package{cleveref} and
7529 % \package{caption} \cmd{\label}-processing macros so that everything
7530 % ultimately gets processed correctly.
7531 %
7532 % \cmd{\cref@label} stores \package{cleveref}'s \cmd{\label}
7533 % redefinition (recall that we're inside a float here, where
7534 % \cmd{\label} itself has been redefined by \package{caption}).
7535 % \cmd{\cref@label} processes \package{cleveref}'s optional
7536 % \cmd{\label} argument, if any. It then calls \cmd{\cref@old@label}.
7537 % But we've let that to \cmd{\cref@old@caption@xlabel}, which stores
7538 % the original \cmd{\caption@xlabel}. So the net effect is to insert an
7539 % extra layer of optional argument processing between \cmd{\label} and
7540 % \cmd{\caption@xlabel}, which can then proceed as before.
7541 %
7542 % The final issue is that \package{caption} captures the original
7543 % \cmd{\label} definition in \cmd{\caption@ORI@label}, but this picks
7544 % up the \package{cleveref} redefinition, which is not what we want. So
7545 % we let \cmd{\caption@ORI@label} to the original \cmd{\label}
7546 % definition as captured by \package{cleveref}. Usually, that's stored
7547 % in \cmd{\cref@old@label}, but we've temporarily redefined that. So we
7548 % need to save what was originally preserved in \cmd{\cref@old@label}
7549 % in \cmd{\cref@ORI@old@label}, and make \cmd{\caption@ORI@label} call
7550 % that. Oof!
7551 % \begin{macrocode}
7552 \let\cref@old@caption@xlabel\caption@xlabel%
7553 \def\caption@xlabel{%
7554 \let\cref@ORI@label\cref@old@label%
7555 \let\cref@old@label\cref@old@caption@xlabel%
7556 \let\caption@ORI@label\cref@ORI@label%
7557 \cref@label}%
7558 % \end{macrocode}
7559 % \end{macro}
7560 % \end{macro}
7561 % \end{macro}
7562 % \end{macro}
7563 %
7564 % \begin{macrocode}
7565 }% end of \@ifpackagelater
7566 }{}% end of \@ifpackageloaded{caption}
7567 % \end{macrocode}
7568 % \end{macro}
7569 %
7570 %
7571 %
7572 % \subsubsection{\package{aliascnt} support}
7573 % \begin{macro}{aliascnt}
7574 % For the \package{aliascnt} trick described in \cref{sec:label_type}
7575 % of the documentation to work, we have to inform \package{cleveref}
7576 % about how aliased counters get reset. \package{aliascnt}'s
7577 % \cmd{\newaliascnt} command doesn't add the aliased counter to any
7578 % reset list, but if the counter it's aliased to gets reset, the
7579 % aliased counter will get reset too. In order for \package{cleveref}
7580 % to correctly sort cross-references to the aliased counter, we have to
7581 % add that counter to the appropriate reset list, even though that
7582 % isn't necessary to actually reset the counter itself. We add this to
7583 % the \cmd{\newaliascnt} command.
7584 % \end{macro}
7585 % \begin{macro}{\newaliascnt}
7586 % \begin{macrocode}
7587 \@ifpackageloaded{aliascnt}{%
7588 \PackageInfo{cleveref}{`aliascnt' support loaded}%
7589 \let\cref@old@newaliascnt\newaliascnt%
7590 \renewcommand*{\newaliascnt}[2]{%
7591 \cref@old@newaliascnt{#1}{#2}%
7592 \cref@resetby{#2}{\cref@result}%
7593 \ifx\cref@result\relax\else%
7594 \cref@addtoreset{#1}{\cref@result}%
7595 \fi}%
7596 }{}% end of \@ifpackageloaded{aliascnt}
7597 % \end{macrocode}
7598 % \end{macro}
7599 %
7600 %
7601 %
7602 % \subsection{Poor Man's \package{cleveref}}
7603 % \begin{macro}{poorman}
7604 % The \option{poorman} option causes a |sed| script to automatically be
7605 % written. When the original \LaTeX{} source file is processed through
7606 % this script, it strips out all the \package{cleveref} commands,
7607 % typesetting all the reference formatting explicitly, and using the
7608 % standard \cmd{\ref} and \cmd{\pageref} commands to produce the
7609 % references themselves.
7610 % \end{macro}
7611 % \begin{macrocode}
7612 \DeclareOption{poorman}{%
7613 \PackageInfo{cleveref}{option `poorman' loaded}%
7614 % \end{macrocode}
7615 %
7616 %
7617 % \begin{macro}{\cref@poorman@text}
7618 % Define global macro \cmd{\cref@poorman@text} to store the text
7619 % produced by the \cmd{\cref} commands, and open an output stream for
7620 % writing the script before starting to process the document body.
7621 % \begin{macrocode}
7622 \gdef\cref@poorman@text{}%
7623 \AtBeginDocument{%
7624 \newwrite\@crefscript%
7625 \immediate\openout\@crefscript=\jobname.sed}%
7626 % \end{macrocode}
7627 % \end{macro}
7628 %
7629 %
7630 % \begin{macro}{select@language}
7631 % \begin{macro}{foreign@language}
7632 % If \package{babel} is loaded, we add to the \cmd{\select@language}
7633 % and \cmd{\foreign@language} commands to make them write substitution
7634 % rules to the script that replace the cross-reference name and
7635 % conjunction component macros with the appropriate language-dependent
7636 % names. We use |sed| line-number addresses in the rules to ensure they
7637 % are only applied to the regions in which that particular language was
7638 % in use.
7639 %
7640 % Note that we write substitution rules for the \emph{previous}
7641 % language block when the language is changed, because we need the
7642 % rules to appear in the script \emph{after} all the cross-reference
7643 % substitution rules for that language block. \cmd{\cref@inputlineno}
7644 % stores the input-file line-number of the start of the previous
7645 % language block.
7646 %
7647 % We postpone the redefinitions until the beginning of the document not
7648 % only to ensure that they don't get clobbered by other package's
7649 % redefinitions, but also because we don't want the redefinitions to
7650 % take effect until after \package{babel} has called
7651 % \cmd{\selectlanguage} for the main language (remember, the
7652 % substitution rules for this first language block will get written at
7653 % the next language change).
7654 %
7655 % Note that, since we're writing to the script file within
7656 % \cmd{\AtBeginDocument} and \cmd{\AtEndDocument}, this code has to
7657 % come \emph{after} the above \cmd{\AtBeginDocument} code which opens
7658 % the script file for writing, and \emph{before} the later
7659 % \cmd{\AtEndDocument} code (below) which closes it.
7660 %
7661 % The |\if@cref@switched@language| flag is set when a \package{babel}
7662 % language switching command is called. It is checked by
7663 % \cmd{\cref@writelanguagerules} when writing substitution rules.
7664 % \begin{macrocode}
7665 \newif\if@cref@switched@language%
7666 \@ifpackageloaded{babel}{%
7667 \AtBeginDocument{%
7668 \let\cref@old@select@language\select@language%
7669 \def\select@language{%
7670 \@cref@switched@languagetrue%
7671 \cref@writelanguagerules%
7672 \cref@old@select@language}%
7673 \let\cref@old@foreign@language\foreign@language%
7674 \def\foreign@language{%
7675 \@cref@switched@languagetrue%
7676 \cref@writelanguagerules%
7677 \cref@old@foreign@language}%
7678 \edef\cref@inputlineno{\the\inputlineno}}%
7679 }{}%
7680 % \end{macrocode}
7681 % \end{macro}
7682 % \end{macro}
7683 %
7684 % The final set of substitution rules gets written at the end of the
7685 % document. This is the only set of rules that gets written if
7686 % \package{babel} is not loaded.
7687 % \begin{macrocode}
7688 \AtEndDocument{%
7689 \let\select@language\cref@old@select@language%
7690 \let\foreign@language\cref@old@foreign@language%
7691 \cref@writelanguagerules}%
7692 % \end{macrocode}
7693 %
7694 % \begin{macro}{\cref@writelanguagerules}
7695 % \cmd{\cref@writelanguagerules} does the grunt work of writing out the
7696 % necessary substitution rules.
7697 % \begin{macrocode}
7698 \def\cref@writelanguagerules{%
7699 \begingroup%
7700 % \end{macrocode}
7701 % If |\if@cref@switched@language| hasn't been set, then we must be
7702 % writing the final set of substitution rules at the end of a document
7703 % in which no language switching command was ever used. In which case,
7704 % the substitution rules don't specify a line-number address.
7705 % \begin{macrocode}
7706 \if@cref@switched@language%
7707 \edef\@address{\cref@inputlineno,\the\inputlineno}%
7708 \else%
7709 \def\@address{}%
7710 \fi%
7711 \expandafter\def\expandafter\cref@poorman@text\expandafter{%
7712 \crefrangeconjunction}%
7713 \expandafter\def\expandafter\@tempa\expandafter{%
7714 \expandafter{\@address}{\string\crefrangeconjunction}}%
7715 \expandafter\cref@writescript\@tempa%
7716 \expandafter\def\expandafter\cref@poorman@text\expandafter{%
7717 \crefrangepreconjunction}%
7718 \expandafter\def\expandafter\@tempa\expandafter{%
7719 \expandafter{\@address}{\string\crefrangepreconjunction}}%
7720 \expandafter\cref@writescript\@tempa%
7721 \expandafter\def\expandafter\cref@poorman@text\expandafter{%
7722 \crefrangepostconjunction}%
7723 \expandafter\def\expandafter\@tempa\expandafter{%
7724 \expandafter{\@address}{\string\crefrangepostconjunction}}%
7725 \expandafter\cref@writescript\@tempa%
7726 \expandafter\def\expandafter\cref@poorman@text\expandafter{%
7727 \crefpairconjunction}%
7728 \expandafter\def\expandafter\@tempa\expandafter{%
7729 \expandafter{\@address}{\string\crefpairconjunction}}%
7730 \expandafter\cref@writescript\@tempa%
7731 \expandafter\def\expandafter\cref@poorman@text\expandafter{%
7732 \crefmiddleconjunction}%
7733 \expandafter\def\expandafter\@tempa\expandafter{%
7734 \expandafter{\@address}{\string\crefmiddleconjunction}}%
7735 \expandafter\cref@writescript\@tempa%
7736 \expandafter\def\expandafter\cref@poorman@text\expandafter{%
7737 \creflastconjunction}%
7738 \expandafter\def\expandafter\@tempa\expandafter{%
7739 \expandafter{\@address}{\string\creflastconjunction}}%
7740 \expandafter\cref@writescript\@tempa%
7741 \expandafter\def\expandafter\cref@poorman@text\expandafter{%
7742 \crefpairgroupconjunction}%
7743 \expandafter\def\expandafter\@tempa\expandafter{%
7744 \expandafter{\@address}{\string\crefpairgroupconjunction}}%
7745 \expandafter\cref@writescript\@tempa%
7746 \expandafter\def\expandafter\cref@poorman@text\expandafter{%
7747 \crefmiddlegroupconjunction}%
7748 \expandafter\def\expandafter\@tempa\expandafter{%
7749 \expandafter{\@address}{\string\crefmiddlegroupconjunction}}%
7750 \expandafter\cref@writescript\@tempa%
7751 \expandafter\def\expandafter\cref@poorman@text\expandafter{%
7752 \creflastgroupconjunction}%
7753 \expandafter\def\expandafter\@tempa\expandafter{%
7754 \expandafter{\@address}{\string\creflastgroupconjunction}}%
7755 \expandafter\cref@writescript\@tempa%
7756 % \end{macrocode}
7757 % We write substitution rules for all component-derived cross-reference
7758 % formats, as listed in \cmd{\cref@label@types}.
7759 % \begin{macrocode}
7760 \let\@tempstack\cref@label@types%
7761 \cref@isstackfull{\@tempstack}%
7762 \@whilesw\if@cref@stackfull\fi{%
7763 % \end{macrocode}
7764 % \cmd{\cref@\meta{type}@name} substitution rules.
7765 % \begin{macrocode}
7766 \edef\@tempa{\cref@stack@top{\@tempstack}}%
7767 \expandafter\expandafter\expandafter\def%
7768 \expandafter\expandafter\expandafter\cref@poorman@text%
7769 \expandafter\expandafter\expandafter{%
7770 \csname cref@\@tempa @name\endcsname}%
7771 \edef\@tempa{%
7772 \string\cref@\expandafter\noexpand\@tempa @name\space}%
7773 \expandafter\expandafter\expandafter\def%
7774 \expandafter\expandafter\expandafter\@tempa%
7775 \expandafter\expandafter\expandafter{%
7776 \expandafter\expandafter\expandafter{%
7777 \expandafter\@address\expandafter}%
7778 \expandafter{\@tempa}}%
7779 \expandafter\cref@writescript\@tempa%
7780 % \end{macrocode}
7781 % \cmd{\cref@\meta{type}@name@plural} substitution rules.
7782 % \begin{macrocode}
7783 \edef\@tempa{\cref@stack@top{\@tempstack}}%
7784 \expandafter\expandafter\expandafter\def%
7785 \expandafter\expandafter\expandafter\cref@poorman@text%
7786 \expandafter\expandafter\expandafter{%
7787 \csname cref@\@tempa @name@plural\endcsname}%
7788 \edef\@tempa{%
7789 \string\cref@\expandafter\noexpand\@tempa%
7790 @name@plural\space}%
7791 \expandafter\expandafter\expandafter\def%
7792 \expandafter\expandafter\expandafter\@tempa%
7793 \expandafter\expandafter\expandafter{%
7794 \expandafter\expandafter\expandafter{%
7795 \expandafter\@address\expandafter}%
7796 \expandafter{\@tempa}}%
7797 \expandafter\cref@writescript\@tempa%
7798 % \end{macrocode}
7799 % \cmd{\Cref@\meta{type}@name} substitution rules.
7800 % \begin{macrocode}
7801 \edef\@tempa{\cref@stack@top{\@tempstack}}%
7802 \expandafter\expandafter\expandafter\def%
7803 \expandafter\expandafter\expandafter\cref@poorman@text%
7804 \expandafter\expandafter\expandafter{%
7805 \csname Cref@\@tempa @name\endcsname}%
7806 \edef\@tempa{%
7807 \string\Cref@\expandafter\noexpand\@tempa @name\space}%
7808 \expandafter\expandafter\expandafter\def%
7809 \expandafter\expandafter\expandafter\@tempa%
7810 \expandafter\expandafter\expandafter{%
7811 \expandafter\expandafter\expandafter%
7812 {\expandafter\@address\expandafter}%
7813 \expandafter{\@tempa}}%
7814 \expandafter\cref@writescript\@tempa%
7815 % \end{macrocode}
7816 % \cmd{\Cref@\meta{type}@name@plural} substitution rules.
7817 % \begin{macrocode}
7818 \edef\@tempa{\cref@stack@top{\@tempstack}}%
7819 \expandafter\expandafter\expandafter\def%
7820 \expandafter\expandafter\expandafter\cref@poorman@text%
7821 \expandafter\expandafter\expandafter{%
7822 \csname Cref@\@tempa @name@plural\endcsname}%
7823 \edef\@tempa{%
7824 \string\Cref@\expandafter\noexpand\@tempa%
7825 @name@plural\space}%
7826 \expandafter\expandafter\expandafter\def%
7827 \expandafter\expandafter\expandafter\@tempa%
7828 \expandafter\expandafter\expandafter{%
7829 \expandafter\expandafter\expandafter%
7830 {\expandafter\@address\expandafter}%
7831 \expandafter{\@tempa}}%
7832 \expandafter\cref@writescript\@tempa%
7833 % \end{macrocode}
7834 % After the loop over cross-reference types, we set
7835 % \cmd{\cref@inputlineno} to the current input-file line, in preparation
7836 % for the next language block.
7837 % \begin{macrocode}
7838 \cref@stack@pop{\@tempstack}%
7839 \cref@isstackfull{\@tempstack}}%
7840 \endgroup%
7841 \edef\cref@inputlineno{\the\inputlineno}}%
7842 % \end{macrocode}
7843 % \end{macro}
7844 %
7845 %
7846 % After processing the document body, we re-read in the temporary script
7847 % file, and write it out again to the final |sed| script file, escaping
7848 % regexp special characters in the process. The escaping is carried out
7849 % by turning the regexp special characters into active characters, and
7850 % defining them to expand to their escaped form. This involves a lot of
7851 % juggling of catcodes and lccodes!
7852 %
7853 % Both \cmd{\DeclareOption} and \cmd{\AtEndDocument} store their
7854 % arguments in token lists, so all the following \TeX{} code is already
7855 % tokenised long before it is expanded and evaluated. Thus there is no
7856 % (easy) way to change the catcodes of the characters appearing here
7857 % before they are tokenised. In one way this is convenient: the catcode
7858 % changes we make don't ``take'' until evaluated, so we can continue to
7859 % use the standard \TeX{} characters (\textbackslash, \{, \} etc.) even
7860 % after the lines containing the catcode commands. But in another, more
7861 % significant, way, it is very inconvenient: it makes it difficult to
7862 % define the regexp special characters as active characters, since it's
7863 % impossible to directly create tokens with the correct char- and
7864 % catcodes.
7865 %
7866 % We get around this by creating the unusual charcode/catcode
7867 % combinations using the \cmd{\lowercase} trick (\cmd{\lowercase} changes
7868 % the charcodes of all characters in its argument to their lccodes, but
7869 % \emph{leaves their catcodes alone}). That way, the argument of
7870 % \cmd{\AtEndDocument} is tokenised correctly, and when it comes to be
7871 % expanded and evaluated, the \cmd{\lowercase} commands create tokens
7872 % with the correct char- and catcodes.
7873 % \begin{macrocode}
7874 \AtEndDocument{%
7875 \immediate\closeout\@crefscript%
7876 \newread\@crefscript%
7877 \immediate\openin\@crefscript=\jobname.sed%
7878 \begingroup%
7879 \newif\if@not@eof%
7880 \def\@eof{\par }%
7881 % \end{macrocode}
7882 % Change catcodes of regexp special characters to make them active
7883 % characters and define them to expand to their escaped forms. Change
7884 % those of \TeX{} special characters to make them normal letters.
7885 % \begin{macrocode}
7886 \catcode`.=13 \catcode`*=13%
7887 \catcode`[=13 \catcode`]=13%
7888 \catcode`^=13 \catcode`$=13 %$
7889 \catcode`\=0 \catcode`<=1 \catcode`>=2%
7890 \catcode`\\=13 \catcode`\{=12 \catcode`\}=12 \catcode`_=12%
7891 \lccode`/=92%
7892 \lccode`~=92\lowercase{\def~{\string/\string/}}%
7893 \lccode`~=42\lowercase{\def~{\string/\string*}}%
7894 \lccode`~=46\lowercase{\def~{\string/\string.}}%
7895 \lccode`~=91\lowercase{\def~{\string/\string[}}%
7896 \lccode`~=93\lowercase{\def~{\string/\string]}}%
7897 \lccode`~=94\lowercase{\def~{\string/\string^}}%
7898 \lccode`~=36\lowercase{\def~{\string/\string$}}% $
7899 \lccode`~=0 \lccode`/=0 \catcode`~=12%
7900 % \end{macrocode}
7901 % Read lines from the temporary script file, expand them to escape regexp
7902 % special characters, and store them in \cmd{\cref@poorman@text}.
7903 % \begin{macrocode}
7904 \def\cref@poorman@text{}%
7905 \immediate\read\@crefscript to \@tempa%
7906 \ifx\@tempa\@eof%
7907 \@not@eoffalse%
7908 \else%
7909 \@not@eoftrue%
7910 \edef\@tempa{\@tempa}%
7911 \fi%
7912 \@whilesw\if@not@eof\fi{%
7913 \expandafter\g@addto@macro\expandafter%
7914 \cref@poorman@text\expandafter{\@tempa^^J}%
7915 \immediate\read\@crefscript to \@tempa%
7916 \ifx\@tempa\@eof%
7917 \@not@eoffalse%
7918 \else%
7919 \@not@eoftrue%
7920 \edef\@tempa{\@tempa}%
7921 \fi}%
7922 \endgroup%
7923 \immediate\closein\@crefscript%
7924 % \end{macrocode}
7925 % Add some rules to remove other \package{cleveref} commands. We use the
7926 % \cmd{\lowercase} trick again for writing the \textbackslash, \{ and \}
7927 % characters. (This could be done in other ways, but since we're in
7928 % \cmd{\lowercase} mood, why not stick with it.)
7929 % \begin{macrocode}
7930 \begingroup%
7931 \lccode`|=92 \lccode`<=123 \lccode`>=125 \lccode`C=67%
7932 \lowercase{\def\@tempa{%[|
7933 s/||label|[[^]]*|]/||label/g}}%
7934 \expandafter\g@addto@macro\expandafter%
7935 \cref@poorman@text\expandafter{\@tempa^^J}%
7936 \lowercase{\edef\@tempa{s/||usepackage|(|[.*|]|)|<0,1|><cleveref>//g}}%
7937 \expandafter\g@addto@macro\expandafter%
7938 \cref@poorman@text\expandafter{\@tempa^^J}%
7939 \lowercase{\edef\@tempa{s/||[cC]refformat<.*><.*>//g}}%
7940 \expandafter\g@addto@macro\expandafter%
7941 \cref@poorman@text\expandafter{\@tempa^^J}%
7942 \lowercase{\edef\@tempa{s/||[cC]refrangeformat<.*><.*>//g}}%
7943 \expandafter\g@addto@macro\expandafter%
7944 \cref@poorman@text\expandafter{\@tempa^^J}%
7945 \lowercase{\edef\@tempa{s/||[cC]refmultiformat<.*><.*><.*><.*>//g}}%
7946 \expandafter\g@addto@macro\expandafter%
7947 \cref@poorman@text\expandafter{\@tempa^^J}%
7948 \lowercase{\edef\@tempa{%
7949 s/||[cC]refrangemultiformat<.*><.*><.*><.*>//g}}%
7950 \expandafter\g@addto@macro\expandafter%
7951 \cref@poorman@text\expandafter{\@tempa^^J}%
7952 \lowercase{\edef\@tempa{s/||[cC]refname<.*><.*>//g}}%
7953 \expandafter\g@addto@macro\expandafter%
7954 \cref@poorman@text\expandafter{\@tempa^^J}%
7955 \lowercase{\edef\@tempa{s/||[cC]reflabelformat<.*><.*>//g}}%
7956 \expandafter\g@addto@macro\expandafter%
7957 \cref@poorman@text\expandafter{\@tempa^^J}%
7958 \lowercase{\edef\@tempa{s/||[cC]refrangelabelformat<.*><.*>//g}}%
7959 \expandafter\g@addto@macro\expandafter%
7960 \cref@poorman@text\expandafter{\@tempa^^J}%
7961 \lowercase{\edef\@tempa{s/||[cC]refdefaultlabelformat<.*>//g}}%
7962 \expandafter\g@addto@macro\expandafter%
7963 \cref@poorman@text\expandafter{\@tempa^^J}%
7964 \lowercase{\edef\@tempa{%
7965 s/||renewcommand<||crefpairconjunction><.*>//g}}%
7966 \expandafter\g@addto@macro\expandafter%
7967 \cref@poorman@text\expandafter{\@tempa^^J}%
7968 \lowercase{\edef\@tempa{%
7969 s/||renewcommand<||crefpairgroupconjunction><.*>//g}}%
7970 \expandafter\g@addto@macro\expandafter%
7971 \cref@poorman@text\expandafter{\@tempa^^J}%
7972 \lowercase{\edef\@tempa{%
7973 s/||renewcommand<||crefmiddleconjunction><.*>//g}}%
7974 \expandafter\g@addto@macro\expandafter%
7975 \cref@poorman@text\expandafter{\@tempa^^J}%
7976 \lowercase{\edef\@tempa{%
7977 s/||renewcommand<||crefmiddlegroupconjunction><.*>//g}}%
7978 \expandafter\g@addto@macro\expandafter%
7979 \cref@poorman@text\expandafter{\@tempa^^J}%
7980 \lowercase{\edef\@tempa{%
7981 s/||renewcommand<||creflastconjunction><.*>//g}}%
7982 \expandafter\g@addto@macro\expandafter%
7983 \cref@poorman@text\expandafter{\@tempa^^J}%
7984 \lowercase{\edef\@tempa{%
7985 s/||renewcommand<||creflastgroupconjunction><.*>//g}}%
7986 \expandafter\g@addto@macro\expandafter%
7987 \cref@poorman@text\expandafter{\@tempa^^J}%
7988 \lowercase{\edef\@tempa{s/||renewcommand<||[cC]ref><.*>//g}}%
7989 \expandafter\g@addto@macro\expandafter%
7990 \cref@poorman@text\expandafter{\@tempa^^J}%
7991 \lowercase{\edef\@tempa{s/||renewcommand<||[cC]refrange><.*>//g}}%
7992 \expandafter\g@addto@macro\expandafter%
7993 \cref@poorman@text\expandafter{\@tempa^^J}%
7994 \endgroup%
7995 % \end{macrocode}
7996 % Overwrite the script file with the new, escaped regexp rules.
7997 % \begin{macrocode}
7998 \newwrite\@crefscript%
7999 \immediate\openout\@crefscript=\jobname.sed%
8000 \immediate\write\@crefscript{\cref@poorman@text}%
8001 \immediate\closeout\@crefscript%
8002 }% end of \AtEndDocument
8003 % \end{macrocode}
8004 %
8005 %
8006 % \begin{macro}{\cref@writescript}
8007 % The \cmd{\cref@writescript} utility macro does the actual writing of
8008 % the substitution rule to the script. The first argument is the
8009 % ``address'', the second argument is the regexp pattern to match,
8010 % whilst the substitution text is whatever is currently stored in
8011 % \cmd{\cref@poorman@text}.
8012 % \begin{macrocode}
8013 \def\cref@getmeaning#1{\expandafter\@cref@getmeaning\meaning#1\@nil}%
8014 \def\@cref@getmeaning#1->#2\@nil{#2}%
8015 \def\cref@writescript#1#2{%
8016 \edef\@tempa{\cref@getmeaning{\cref@poorman@text}}%
8017 \immediate\write\@crefscript{#1 s/#2/\@tempa/g}}%
8018 % \end{macrocode}
8019 % \end{macro}
8020 %
8021 %
8022 % \begin{macro}{\cref}
8023 % \begin{macro}{\Cref}
8024 % \begin{macro}{\crefrange}
8025 % \begin{macro}{\Crefrange}
8026 % \begin{macro}{\@crefstar}
8027 % \begin{macro}{\@crefnostar}
8028 % \begin{macro}{\@crefrangestar}
8029 % \begin{macro}{\@crefrangenostar}
8030 % To make use of all the \option{poorman} infrastructure defined above,
8031 % we must redefine the \package{cleveref} referencing commands
8032 % themselves. There are two parts to this: at the very top layer of the
8033 % cross-referencing macro stack, we redefine the user-level commands to
8034 % first initialise |\cref@poorman@text| to the empty string, then
8035 % typeset the reference as usual, and finally write a substitution
8036 % rule to the |sed| script containing whatever has been accumulated in
8037 % |\cref@poorman@text|. At the very lowest layer of the macro stack, we
8038 % redefine the macros that actually typeset the various parts of the
8039 % references to additionally add a copy of whatever they typeset to
8040 % |\cref@poorman@text|.
8041 %
8042 % We first redefine the user-level referencing commands so that they
8043 % write a substitution rule for the reference to the script, as well as
8044 % typesetting the reference itself. Most of the redefinitions differ
8045 % slightly depending on whether \package{hyperref} is loaded.
8046 % \begin{macrocode}
8047 \if@cref@hyperrefloaded\relax% hyperref loaded
8048 \def\@crefnostar#1#2{%
8049 \gdef\cref@poorman@text{}%
8050 \@cref{#1}{#2}%
8051 % \end{macrocode}
8052 % We use a temporary \cmd{\@tempa} macro here, which makes use of the
8053 % fact that the first character of \#1 is ``c'' for lower-case and ``C''
8054 % for upper-case in these commands, in order to write out the correct
8055 % capitalisation in the substitution.
8056 %
8057 % FIXME: We only resort to this because |\string\#1| doesn't work. But
8058 % there \emph{must} be a better way to get a backslash character into the
8059 % token stream, obviating the need for the ugly \cmd{\@tempa} macro.
8060 % \begin{macrocode}
8061 \def\@tempa##1##2\@nil{%
8062 \if##1c%
8063 \cref@writescript{}{\string\cref\string{#2\string}}%
8064 \else%
8065 \cref@writescript{}{\string\Cref\string{#2\string}}%
8066 \fi}%
8067 \@tempa#1\@nil}%
8068 \def\@crefstar#1#2{%
8069 \gdef\cref@poorman@text{}%
8070 \@crefstarredtrue\@cref{#1}{#2}\@crefstarredfalse%
8071 \def\@tempa##1##2\@nil{%
8072 \if##1c%
8073 \cref@writescript{}{\string\cref*\string{#2\string}}%
8074 \else%
8075 \cref@writescript{}{\string\Cref*\string{#2\string}}%
8076 \fi}%
8077 \@tempa#1\@nil}%
8078 \def\@crefrangenostar#1#2#3{%
8079 \gdef\cref@poorman@text{}%
8080 \@@setcrefrange{#2}{#3}{#1}{}%
8081 \def\@tempa##1##2\@nil{%
8082 \if##1c%
8083 \cref@writescript{}{%
8084 \string\crefrange\string{#2\string}\string{#3\string}}%
8085 \else%
8086 \cref@writescript{}{%
8087 \strinsg\Crefrange\string{#2\string}\string{#3\string}}%
8088 \fi}%
8089 \@tempa#1\@nil}%
8090 \def\@crefrangestar#1#2#3{%
8091 \gdef\cref@poorman@text{}%
8092 \@crefstarredtrue\@@setcrefrange{#2}{#3}{#1}{}\@crefstarredfalse%
8093 \def\@tempa##1##2\@nil{%
8094 \if##1c%
8095 \cref@writescript{}{%
8096 \string\crefrange*\string{#2\string}\string{#3\string}}%
8097 \else%
8098 \cref@writescript{}{%
8099 \string\Crefrange*\string{#2\string}\string{#3\string}}%
8100 \fi}%
8101 \@tempa#1\@nil}%
8102 \def\@cpagerefrangenostar#1#2#3{%
8103 \gdef\cref@poorman@text{}%
8104 \@@setcpagerefrange{#2}{#3}{#1}{}%
8105 \def\@tempa##1##2\@nil{%
8106 \if##1c%
8107 \cref@writescript{}{%
8108 \string\cpagerefrange\string{#2\string}\string{#3\string}}%
8109 \else%
8110 \cref@writescript{}{%
8111 \string\Cpagerefrange\string{#2\string}\string{#3\string}}%
8112 \fi}%
8113 \@tempa#1\@nil}%
8114 \def\@cpagerefrangestar#1#2#3{%
8115 \gdef\cref@poorman@text{}%
8116 \@crefstarredtrue%
8117 \@@setcpagerefrange{#2}{#3}{#1}{}%
8118 \@crefstarredfalse%
8119 \def\@tempa##1##2\@nil{%
8120 \if##1c%
8121 \cref@writescript{}{%
8122 \string\cpagerefrange*\string{#2\string}\string{#3\string}}%
8123 \else%
8124 \cref@writescript{}{%
8125 \string\Cpagerefrange*\string{#2\string}\string{#3\string}}%
8126 \fi}%
8127 \@tempa#1\@nil}%
8128 \def\@labelcrefnostar#1{%
8129 \gdef\cref@poorman@text{}%
8130 \@cref{labelcref}{#1}%
8131 \cref@writescript{}{\string\labelcref\string{#1\string}}}%
8132 \def\@labelcrefstar#1{%
8133 \gdef\cref@poorman@text{}%
8134 \@crefstarredtrue%
8135 \@cref{labelcref}{#1}%
8136 \@crefstarredfalse%
8137 \cref@writescript{}{\string\labelcref*\string{#1\string}}}%
8138 \def\@labelcpagerefnostar#1{%
8139 \gdef\cref@poorman@text{}%
8140 \@cref{labelcpageref}{#1}%
8141 \cref@writescript{}{\string\labelcpageref\string{#1\string}}}%
8142 \def\@labelcpagerefstar#1{%
8143 \gdef\cref@poorman@text{}%
8144 \@crefstarredtrue%
8145 \@cref{labelcpageref}{#1}%
8146 \@crefstarredfalse%
8147 \cref@writescript{}{\string\labelcpageref*\string{#1\string}}}%
8148 %
8149 \else% hyperref not loaded
8150 \DeclareRobustCommand{\cref}[1]{%
8151 \gdef\cref@poorman@text{}%
8152 \@cref{cref}{#1}%
8153 \cref@writescript{}{\string\cref\string{#1\string}}}%
8154 \DeclareRobustCommand{\Cref}[1]{%
8155 \gdef\cref@poorman@text{}%
8156 \@cref{Cref}{#1}%
8157 \cref@writescript{}{\string\Cref\string{#1\string}}}%
8158 \DeclareRobustCommand{\crefrange}[2]{%
8159 \gdef\cref@poorman@text{}%
8160 \@@setcrefrange{#1}{#2}{cref}{}%
8161 \cref@writescript{}{%
8162 \string\crefrange\string{#1\string}\string{#2\string}}}%
8163 \DeclareRobustCommand{\Crefrange}[2]{%
8164 \gdef\cref@poorman@text{}%
8165 \@@setcrefrange{#1}{#2}{Cref}{}%
8166 \cref@writescript{}{%
8167 \string\Crefrange\string{#1\string}\string{#2\string}}}%
8168 \DeclareRobustCommand{\cpageref}[1]{%
8169 \gdef\cref@poorman@text{}%
8170 \@cref{cpageref}{#1}%
8171 \cref@writescript{}{\string\cpageref\string{#1\string}}}%
8172 \DeclareRobustCommand{\Cpageref}[1]{%
8173 \gdef\cref@poorman@text{}%
8174 \@cref{Cpageref}{#1}%
8175 \cref@writescript{}{\string\Cpageref\string{#1\string}}}%
8176 \DeclareRobustCommand{\cpagerefrange}[2]{%
8177 \gdef\cref@poorman@text{}%
8178 \@@setcpagerefrange{#1}{#2}{cref}{}%
8179 \cref@writescript{}{%
8180 \string\cpagerefrange\string{#1\string}\string{#2\string}}}%
8181 \DeclareRobustCommand{\Cpagerefrange}[2]{%
8182 \gdef\cref@poorman@text{}%
8183 \@@setcpagerefrange{#1}{#2}{Cref}{}%
8184 \cref@writescript{}{%
8185 \string\Cpagerefrange\string{#1\string}\string{#2\string}}}%
8186 \DeclareRobustCommand{\labelcref}[1]{%
8187 \gdef\cref@poorman@text{}%
8188 \@cref{labelcref}{#1}%
8189 \cref@writescript{}{\string\labelcref\string{#1\string}}}%
8190 \DeclareRobustCommand{\labelcpageref}[1]{%
8191 \gdef\cref@poorman@text{}%
8192 \@cref{labelcpageref}{#1}%
8193 \cref@writescript{}{\string\labelcpageref\string{#1\string}}}%
8194 \fi% end of test for hyperref
8195 % \end{macrocode}
8196 % \end{macro}
8197 % \end{macro}
8198 % \end{macro}
8199 % \end{macro}
8200 % \end{macro}
8201 % \end{macro}
8202 % \end{macro}
8203 % \end{macro}
8204 % \begin{macro}{\namecref}
8205 % \begin{macro}{\nameCref}
8206 % \begin{macro}{\lcnamecref}
8207 % \begin{macro}{\namecrefs}
8208 % \begin{macro}{\nameCrefs}
8209 % \begin{macro}{\lcnamecrefs}
8210 % The \cmd{\namecref} et al.\ commands don't do anything different when
8211 % \package{hyperref} is loaded, so we don't need to test for
8212 % \package{hyperref} when redefining them.
8213 % \begin{macrocode}
8214 \DeclareRobustCommand{\namecref}[1]{%
8215 \gdef\cref@poorman@text{}%
8216 \@setnamecref{cref}{#1}{}{}%
8217 \cref@writescript{}{\string\namecref\string{#1\string}}}%
8218 \DeclareRobustCommand{\nameCref}[1]{%
8219 \gdef\cref@poorman@text{}%
8220 \@setnamecref{Cref}{#1}{}{}%
8221 \cref@writescript{}{\string\nameCref\string{#1\string}}}%
8222 \DeclareRobustCommand{\lcnamecref}[1]{%
8223 \gdef\cref@poorman@text{}%
8224 \@setnamecref{Cref}{#1}{}{\MakeLowercase}%
8225 \cref@writescript{}{\string\lcnamecref\string{#1\string}}}%
8226 \DeclareRobustCommand{\namecrefs}[1]{%
8227 \gdef\cref@poorman@text{}%
8228 \@setnamecref{cref}{#1}{@plural}{}%
8229 \cref@writescript{}{\string\namecrefs\string{#1\string}}}%
8230 \DeclareRobustCommand{\nameCrefs}[1]{%
8231 \gdef\cref@poorman@text{}%
8232 \@setnamecref{Cref}{#1}{@plural}{}%
8233 \cref@writescript{}{\string\nameCrefs\string{#1\string}}}%
8234 \DeclareRobustCommand{\lcnamecrefs}[1]{%
8235 \gdef\cref@poorman@text{}%
8236 \@setnamecref{Cref}{#1}{@plural}{\MakeLowercase}%
8237 \cref@writescript{}{\string\lcnamecrefs\string{#1\string}}}%
8238 % \end{macrocode}
8239 % \end{macro}
8240 % \end{macro}
8241 % \end{macro}
8242 % \end{macro}
8243 % \end{macro}
8244 % \end{macro}
8245 %
8246 %
8247 % \begin{macro}{\@setcref@pairgroupconjunction}
8248 % \begin{macro}{\@setcref@middlegroupconjunction}
8249 % \begin{macro}{\@setcref@lastgroupconjunction}
8250 % Redefine \cmd{\@@@setcref}, \cmd{\@@@setcrefrange},
8251 % \cmd{\@@@setcpageref} and\linebreak[4] \cmd{\@@@setcpagerefrange}, as
8252 % well as the conjunction macros\linebreak[4]
8253 % \cmd{\@setcref@middlegroupconjunction},
8254 % \cmd{\@setcref@lastgroupconjunction} and
8255 % \cmd{\@setcref@pairgroupconjunction}, to append text they typeset
8256 % to\linebreak[4] the \cmd{\cref@poorman@text} macro, as well as
8257 % actually doing the typesetting.
8258 % \begin{macrocode}
8259 \def\@setcref@pairgroupconjunction{%
8260 \crefpairgroupconjunction%
8261 \expandafter\g@addto@macro\expandafter\cref@poorman@text%
8262 \expandafter{\crefpairgroupconjunction}}%
8263 \def\@setcref@middlegroupconjunction{%
8264 \crefmiddlegroupconjunction%
8265 \expandafter\g@addto@macro\expandafter\cref@poorman@text%
8266 \expandafter{\crefmiddlegroupconjunction}}%
8267 \def\@setcref@lastgroupconjunction{%
8268 \creflastgroupconjunction%
8269 \expandafter\g@addto@macro\expandafter\cref@poorman@text%
8270 \expandafter{\creflastgroupconjunction}}%
8271 % \end{macrocode}
8272 % \end{macro}
8273 % \end{macro}
8274 % \end{macro}
8275 % \begin{macro}{\@@@setcref}
8276 % \begin{macro}{\@@@setcrefrange}
8277 % \begin{macro}{\@@@setcpageref}
8278 % \begin{macro}{\@@@setcpagerefrange}
8279 % The necessary redefinitions of most of the cross-referencing commands
8280 % differ slightly depending on whether \package{hyperref} is loaded or
8281 % not.
8282 % \begin{macrocode}
8283 \let\old@@@setcref\@@@setcref%
8284 \let\old@@@setcrefrange\@@@setcrefrange%
8285 \let\old@@@setcpageref\@@@setcpageref%
8286 \let\old@@@setcpagerefrange\@@@setcpagerefrange%
8287 \if@cref@hyperrefloaded\relax% hyperref loaded
8288 \def\@@@setcref#1#2{%
8289 \old@@@setcref{#1}{#2}%
8290 \if@crefstarred%
8291 \expandafter\g@addto@macro\expandafter\cref@poorman@text%
8292 \expandafter{#1{\ref*{#2}}{}{}}%
8293 \else%
8294 \expandafter\g@addto@macro\expandafter\cref@poorman@text%
8295 \expandafter{#1{\ref{#2}}{}{}}%
8296 \fi}%
8297 \def\@@@setcrefrange#1#2#3{%
8298 \old@@@setcrefrange{#1}{#2}{#3}%
8299 \if@crefstarred%
8300 \expandafter\g@addto@macro\expandafter\cref@poorman@text%
8301 \expandafter{#1{\ref*{#2}}{\ref*{#3}}{}{}{}{}}%
8302 \else%
8303 \expandafter\g@addto@macro\expandafter\cref@poorman@text%
8304 \expandafter{#1{\ref{#2}}{\ref{#3}}{}{}{}{}}%
8305 \fi}%
8306 \def\@@@setcpageref#1#2{%
8307 \old@@@setcpageref{#1}{#2}%
8308 \if@crefstarred%
8309 \expandafter\g@addto@macro\expandafter\cref@poorman@text%
8310 \expandafter{#1{\pageref*{#2}}{}{}}%
8311 \else%
8312 \expandafter\g@addto@macro\expandafter\cref@poorman@text%
8313 \expandafter{#1{\pageref{#2}}{}{}}%
8314 \fi}%
8315 \def\@@@setcpagerefrange#1#2#3{%
8316 \old@@@setcpagerefrange{#1}{#2}{#3}%
8317 \if@crefstarred%
8318 \expandafter\g@addto@macro\expandafter\cref@poorman@text%
8319 \expandafter{#1{\pageref*{#2}}{\pageref*{#3}}{}{}{}{}}%
8320 \else%
8321 \expandafter\g@addto@macro\expandafter\cref@poorman@text%
8322 \expandafter{#1{\pageref{#2}}{\pageref{#3}}{}{}{}{}}%
8323 \fi}%
8324 %
8325 \else% hyperref not loaded
8326 \def\@@@setcref#1#2{%
8327 \old@@@setcref{#1}{#2}%
8328 \expandafter\g@addto@macro\expandafter{%
8329 \expandafter\cref@poorman@text\expandafter}%
8330 \expandafter{#1{\ref{#2}}{}{}}}%
8331 \def\@@@setcrefrange#1#2#3{%
8332 \old@@@setcrefrange{#1}{#2}{#3}%
8333 \expandafter\g@addto@macro%
8334 \expandafter{\expandafter\cref@poorman@text\expandafter}%
8335 \expandafter{#1{\ref{#2}}{\ref{#3}}{}{}{}{}}}%
8336 \def\@@@setcpageref#1#2{%
8337 \old@@@setcpageref{#1}{#2}%
8338 \expandafter\g@addto@macro\expandafter{%
8339 \expandafter\cref@poorman@text\expandafter}%
8340 \expandafter{#1{\pageref{#2}}{}{}}}%
8341 \def\@@@setcpagerefrange#1#2#3{%
8342 \old@@@setcpagerefrange{#1}{#2}{#3}%
8343 \expandafter\g@addto@macro%
8344 \expandafter{\expandafter\cref@poorman@text\expandafter}%
8345 \expandafter{#1{\pageref{#2}}{\pageref{#3}}{}{}{}{}}}%
8346 \fi% end of hyperref test
8347 % \end{macrocode}
8348 % \end{macro}
8349 % \end{macro}
8350 % \end{macro}
8351 % \end{macro}
8352 % \begin{macro}{\@@@setnamecref}
8353 % The \cmd{\namecref} et al.\ commands don't do anything different when
8354 % \package{hyperref} is loaded, so we don't need to test for
8355 % \package{hyperref} when redefining \cmd{\@@@setnamecref}.
8356 % \begin{macrocode}
8357 \let\old@@@setnamecref\@@@setnamecref%
8358 \def\@@@setnamecref#1#2{%
8359 \old@@@setnamecref{#1}{#2}%
8360 \expandafter\def\expandafter\@tempa\expandafter{#1}%
8361 \def\@tempb{#2}%
8362 \expandafter\expandafter\expandafter\g@addto@macro%
8363 \expandafter\expandafter\expandafter{%
8364 \expandafter\expandafter\expandafter\cref@poorman@text%
8365 \expandafter\expandafter\expandafter}%
8366 \expandafter\expandafter\expandafter{\expandafter\@tempb\@tempa}}%
8367 % \end{macrocode}
8368 % \end{macro}
8369 %
8370 %
8371 % \begin{macro}{varioref}
8372 % If \package{varioref} is loaded, do the same for the
8373 % \package{varioref} commands.
8374 % \begin{macrocode}
8375 \@ifpackageloaded{varioref}{%
8376 \AtBeginDocument{%
8377 % \end{macrocode}
8378 %
8379 % \begin{macro}{\@@vpageref}
8380 % We redefine \cmd{\@@vpageref} to make it write a substitution rule to
8381 % the script, as well as typesetting the page reference.
8382 % \begin{macrocode}
8383 \def\@@vpageref#1[#2]#3{%
8384 \gdef\cref@poorman@text{}%
8385 \cref@@vpageref{#1}[#2]{#3}%
8386 \cref@writescript{}{\string\vpageref\string{#3\string}}}%
8387 % \end{macrocode}
8388 % \end{macro}
8389 %
8390 % \begin{macro}{\cref@vref}
8391 % \cmd{\cref@vref} is similarly redefined to write a substitution rule.
8392 % \begin{macrocode}
8393 \let\old@cref@vref\cref@vref%
8394 \def\cref@vref#1#2{%
8395 \gdef\cref@poorman@text{}%
8396 \old@cref@vref{#1}{#2}%
8397 \def\@tempa##1##2\@nil{%
8398 \if##1c%
8399 \if@crefstarred%
8400 \cref@writescript{}{\string\vref*\string{#2\string}}%
8401 \else%
8402 \cref@writescript{}{\string\vref\string{#2\string}}%
8403 \fi%
8404 \else%
8405 \if@crefstarred%
8406 \cref@writescript{}{\string\Vref*\string{#2\string}}%
8407 \else%
8408 \cref@writescript{}{\string\Vref\string{#2\string}}%
8409 \fi%
8410 \fi}%
8411 \@tempa#1\@nil}%
8412 % \end{macrocode}
8413 % \end{macro}
8414 %
8415 % \begin{macro}{\cref@fullref}
8416 % \begin{macro}{\cref@vrefrange}
8417 % \cmd{\cref@fullref} and \cmd{\cref@vrefrange} are also redefined so
8418 % that they write substitution rules. Strictly speaking, the starred
8419 % variants of \cmd{\fullref} and \cmd{\vrefrange} are not defined when
8420 % \package{hyperref} isn't loaded, so we could avoid checking for them
8421 % in that case. However, the redundant check does no harm, and avoids
8422 % some code duplication.
8423 % \begin{macrocode}
8424 \let\old@cref@fullref\cref@fullref%
8425 \def\cref@fullref#1#2{%
8426 \gdef\cref@poorman@text{}%
8427 \old@cref@fullref{#1}{#2}%
8428 \def\@tempa##1##2\@nil{%
8429 \if##1c%
8430 \if@crefstarred%
8431 \cref@writescript{}{\string\fullref*\string{#2\string}}%
8432 \else%
8433 \cref@writescript{}{\string\fullref\string{#2\string}}%
8434 \fi%
8435 \else%
8436 \if@crefstarred%
8437 \cref@writescript{}{\string\Fullref*\string{#2\string}}%
8438 \else%
8439 \cref@writescript{}{\string\Fullref\string{#2\string}}%
8440 \fi%
8441 \fi}%
8442 \@tempa#1\@nil}%
8443 %
8444 \let\old@cref@vrefrange\cref@vrefrange%
8445 \def\cref@vrefrange#1#2#3{%
8446 \gdef\cref@poorman@text{}%
8447 \old@cref@vrefrange{#1}{#2}{#3}%
8448 \def\@tempa##1##2\@nil{%
8449 \if##1c%
8450 \if@crefstarred%
8451 \cref@writescript{}{%
8452 \string\vrefrange*\string{#2\string}\string{#3\string}}%
8453 \else%
8454 \cref@writescript{}{%
8455 \string\vrefrange\string{#2\string}\string{#3\string}}%
8456 \fi%
8457 \else%
8458 \if@crefstarred%
8459 \cref@writescript{}{%
8460 \string\Vrefrange*\string{#2\string}\string{#3\string}}%
8461 \else%
8462 \cref@writescript{}{%
8463 \string\Vrefrange\string{#2\string}\string{#3\string}}%
8464 \fi%
8465 \fi}%
8466 \@tempa#1\@nil}%
8467 % \end{macrocode}
8468 % \end{macro}
8469 % \end{macro}
8470 %
8471 % \begin{macro}{\@@@setvpageref}
8472 % \begin{macro}{\@@@setvpagerefrange}
8473 % In order to get the appropriate substitution for \package{varioref}
8474 % commands appended to \cmd{\cref@poorman@text}, we have to redefine
8475 % \cmd{\@@@setvpageref} and\linebreak[4] \cmd{\@@@setvpagerefrange},
8476 % which perform the final typesetting of \package{varioref} page
8477 % references, so that they append an appropriate substitution for the
8478 % page reference they're typesetting.
8479 % \begin{macrocode}
8480 \def\@@@setvpageref#1[#2]#3{%
8481 \cref@old@@vpageref{#1}[#2]{#3}%
8482 \g@addto@macro\cref@poorman@text{\vpageref{#3}}}%
8483 \def\@@@setvpagerefrange[#1]#2#3{%
8484 \vpagerefrange[#1]{#2}{#3}%
8485 \g@addto@macro\cref@poorman@text{\vpagerefrange{#2}{#3}}}%
8486 \def\@@@setfullpageref#1{%
8487 \reftextfaraway{#1}%
8488 \g@addto@macro\cref@poorman@text{\reftextfaraway{#1}}}%
8489 \def\@@@setfullpagerefrange#1#2{%
8490 \reftextpagerange{#1}{#2}%
8491 \g@addto@macro\cref@poorman@text{\reftextpagerange{#1}{#2}}}%
8492 % \end{macrocode}
8493 % \end{macro}
8494 % \end{macro}
8495 %
8496 % \begin{macro}{\@setcref@space}
8497 % \begin{macro}{\@setcref@pairconjunction}
8498 % \begin{macro}{\@setcref@middleconjunction}
8499 % \begin{macro}{\@setcref@lastconjunction}
8500 % Finally, we make sure the conjunctions also get appended to
8501 % the\linebreak[4] \cmd{\cref@poorman@text} substitution.
8502 % \begin{macrocode}
8503 \def\@setcref@space{ % space here is deliberate
8504 \g@addto@macro\cref@poorman@text{ }}%
8505 \def\@setcref@pairconjunction{%
8506 \crefpairconjunction%
8507 \expandafter\g@addto@macro\expandafter\cref@poorman@text%
8508 \expandafter{\crefpairconjunction}}%
8509 \def\@setcref@middleconjunction{%
8510 \crefmiddleconjunction%
8511 \expandafter\g@addto@macro\expandafter\cref@poorman@text%
8512 \expandafter{\crefmiddleconjunction}}%
8513 \def\@setcref@lastconjunction{%
8514 \creflastconjunction%
8515 \expandafter\g@addto@macro\expandafter\cref@poorman@text%
8516 \expandafter{\creflastconjunction}}%
8517 }% end of \AtBeginDocument
8518 }{}% end of \@ifpackageloaded{varioref}
8519 }% end of poorman option
8520 % \end{macrocode}
8521 % \end{macro}
8522 % \end{macro}
8523 % \end{macro}
8524 % \end{macro}
8525 % \end{macro}
8526 %
8527 %
8528 %
8529 % \subsection{Sort and Compress Options}
8530 % \begin{macro}{sort}
8531 % \begin{macro}{compress}
8532 % \begin{macro}{nosort}
8533 % \begin{macro}{\if@cref@sort}
8534 % \begin{macro}{\if@cref@compress}
8535 % The \option{sort}, \option{compress} or \option{nosort} options
8536 % determine whether to sort and/or compress lists of multiple
8537 % references (default is to do both). They work simply by setting the
8538 % |\if@cref@sort| and |\if@cref@compress| flags appropriately.
8539 % \begin{macrocode}
8540 \newif\if@cref@sort%
8541 \newif\if@cref@compress%
8542 % \end{macrocode}
8543 % Default is to both sort and compress references.
8544 % \begin{macrocode}
8545 \@cref@sorttrue%
8546 \@cref@compresstrue%
8547 % \end{macrocode}
8548 % Options override default.
8549 % \begin{macrocode}
8550 \DeclareOption{sort}{%
8551 \PackageInfo{cleveref}{sorting but not compressing references}%
8552 \@cref@sorttrue%
8553 \@cref@compressfalse}%
8554 \DeclareOption{compress}{%
8555 \PackageInfo{cleveref}{compressing but not sorting references}%
8556 \@cref@sortfalse%
8557 \@cref@compresstrue}%
8558 \DeclareOption{sort&compress}{%
8559 \PackageInfo{cleveref}{sorting and compressing references}%
8560 \@cref@sorttrue%
8561 \@cref@compresstrue}%
8562 \DeclareOption{nosort}{%
8563 \PackageInfo{cleveref}{neither sorting nor compressing references}%
8564 \@cref@sortfalse%
8565 \@cref@compressfalse}%
8566 % \end{macrocode}
8567 % \end{macro}
8568 % \end{macro}
8569 % \end{macro}
8570 % \end{macro}
8571 % \end{macro}
8572 %
8573 %
8574 %
8575 % \subsection{Capitalise Option}
8576 % \begin{macro}{capitalise}
8577 % \begin{macro}{\if@cref@capitalise}
8578 % The \option{capitalise} option causes \package{cleveref} to always
8579 % use the |\Cref|* variants for typesetting cross-references, so that
8580 % cross-reference names are always capitalised.
8581 % \begin{macrocode}
8582 \newif\if@cref@capitalise%
8583 % \end{macrocode}
8584 % Disabled by default.
8585 % \begin{macrocode}
8586 \@cref@capitalisefalse%
8587 % \end{macrocode}
8588 % Option overrides default.
8589 % \begin{macrocode}
8590 \DeclareOption{capitalise}{%
8591 \PackageInfo{cleveref}{always capitalise cross-reference names}%
8592 \@cref@capitalisetrue}%
8593 \DeclareOption{capitalize}{%
8594 \PackageInfo{cleveref}{always capitalise cross-reference names}%
8595 \@cref@capitalisetrue}%
8596 % \end{macrocode}
8597 % \end{macro}
8598 % \end{macro}
8599 %
8600 %
8601 %
8602 % \subsection{Nameinlink Option}
8603 % \begin{macro}{nameinlink}
8604 % \begin{macro}{\if@cref@nameinlink}
8605 % The \option{nameinlink} option causes \package{cleveref} to include
8606 % the cross-reference name as part of the hyperlink target when the
8607 % \package{hyperref} package is used.
8608 % \begin{macrocode}
8609 \newif\if@cref@nameinlink%
8610 % \end{macrocode}
8611 % Disabled by default.
8612 % \begin{macrocode}
8613 \@cref@nameinlinkfalse%
8614 % \end{macrocode}
8615 % Option overrides default.
8616 % \begin{macrocode}
8617 \DeclareOption{nameinlink}{%
8618 \PackageInfo{cleveref}{include cross-reference names in hyperlinks}%
8619 \@cref@nameinlinktrue}%
8620 % \end{macrocode}
8621 % \end{macro}
8622 % \end{macro}
8623 %
8624 %
8625 %
8626 % \subsection{Noabbrev Option}
8627 % \begin{macro}{noabbrev}
8628 % \begin{macro}{\if@cref@abbrev}
8629 % The \option{noabbrev} option causes \package{cleveref} to always use
8630 % the full cross-reference names, instead of abbreviating some of the
8631 % more common names in the middle of sentences.
8632 % \begin{macrocode}
8633 \newif\if@cref@abbrev%
8634 % \end{macrocode}
8635 % Enabled by default.
8636 % \begin{macrocode}
8637 \@cref@abbrevtrue%
8638 % \end{macrocode}
8639 % Option overrides default.
8640 % \begin{macrocode}
8641 \DeclareOption{noabbrev}{%
8642 \PackageInfo{cleveref}{no abbreviation of names}%
8643 \@cref@abbrevfalse}%
8644 % \end{macrocode}
8645 % \end{macro}
8646 % \end{macro}
8647 %
8648 %
8649 %
8650 % \subsection{Language and \package{babel} Support}
8651 % \label{sec:code:babel}
8652 % Default reference formats for different languages are supported via
8653 % package options, in the usual way.
8654 %
8655 % Any contributions of translations for missing languages are most
8656 % welcome! If you can contribute definitions for a missing language,
8657 % ideally you should add them below the existing ones (using those as a
8658 % model), generate a patch against the original \package{cleveref.dtx}
8659 % file, and send the patch by email to the package author. However, if
8660 % you don't know how to produce a patch, you can instead just send the
8661 % translations as a plain text file.
8662 %
8663 %
8664 % \begin{macro}{\cref@addto}
8665 % Utility macro to use instead of \package{babel}'s flawed \cmd{\addto}
8666 % (copied and modified from \package{varioref}).
8667 % \begin{macrocode}
8668 \def\cref@addto#1#2{%
8669 \@temptokena{#2}%
8670 \ifx#1\undefined%
8671 \edef#1{\the\@temptokena}%
8672 \else%
8673 \toks@\expandafter{#1}%
8674 \edef#1{\the\toks@\the\@temptokena}%
8675 \fi%
8676 \@temptokena{}\toks@\@temptokena}%
8677 \@onlypreamble\cref@addto%
8678 % \end{macrocode}
8679 % \end{macro}
8680 %
8681 % \begin{macro}{\cref@addlanguagedefs}
8682 % Utility macro to add code to \cmd{\extras}\meta{language} or
8683 % \cmd{\captions}\meta{language}, depending on whether \package{babel}
8684 % or \package{polyglossia} are loaded.
8685 % \begin{macrocode}
8686 \long\def\cref@addlanguagedefs#1#2{%
8687 \@ifpackageloaded{polyglossia}%
8688 {\AtBeginDocument{%
8689 \ifcsdef{#1@loaded}{%
8690 \expandafter\cref@addto\csname captions#1\endcsname{#2}}{}}}%
8691 {\@ifpackageloaded{babel}{%
8692 \edef\@curroptions{\@ptionlist{\@currname.\@currext}}%
8693 \@expandtwoargs\in@{,#1,}{,\@classoptionslist,\@curroptions,}%
8694 \ifin@%
8695 \AtBeginDocument{%
8696 \expandafter\cref@addto\csname extras#1\endcsname{#2}}%
8697 \fi}{}}}%
8698 % \end{macrocode}
8699 % \end{macro}
8700 %
8701 %
8702 % Passing a language option to \package{cleveref} defines the
8703 % cross-reference names and conjunctions as appropriate for that
8704 % language. We can't make the definitions straight away, since they would
8705 % prevent the automatic definition of the other capitalisation variant
8706 % from working if the user chooses to change a default definition in the
8707 % preamble, so we postpone them until the beginning of the document.
8708 % However, if each language option were to simply define any formats that
8709 % aren't already defined by the end of the preamble, the \emph{first}
8710 % language option would override all the others. Unfortunately, the
8711 % convention in \LaTeX{} and \package{babel} is for the \emph{last}
8712 % language option to take precedence. So we instead use the
8713 % \cmd{\crefname@preamble} command to save the definitions in
8714 % |\cref@|\meta{type}|@name@preamble| etc., and after all the language
8715 % options have been processed, use the contents of these to set the
8716 % default definitions for any undefined formats.
8717 %
8718 % For \package{babel} support, we add the appropriate redefinitions to
8719 % the\linebreak[4] |\extras|\meta{language} macro, which is called by
8720 % \package{babel}'s \cmd{\selectlanguage} et al.\ commands. The main
8721 % language (the last one listed in the options) is set up by an automatic
8722 % call to \cmd{\selectlanguage} at the beginning of the document, which
8723 % would clobber any redefinitions made by the user in the preamble. To
8724 % avoid this, we postpone adding the redefinitions to
8725 % |\extras|\meta{language} until the beginning of the document. Since
8726 % \package{cleveref} must always be loaded \emph{after} \package{babel},
8727 % the redefinitions won't be added to |\extras|\meta{language} until
8728 % \emph{after} \package{babel} has already called \cmd{\selectlanguage}
8729 % for the main language. Thus the redefinitions will only be in effect
8730 % when \cmd{\selectlanguage} is called explicitly within the
8731 % document. (The definitions for the main language are taken care of by
8732 % the language options passed to \package{cleveref}, independently of
8733 % \package{babel}.)
8734 %
8735 % Note that we define both capitalisation variants explicitly throughout,
8736 % rather than relying on the automatic definition of the other variant,
8737 % in order to make the code produced by the poor man's |sed| script
8738 % slightly cleaner.
8739 %
8740 %
8741 % \subsubsection{English}
8742 % \begin{macro}{english}
8743 % English definitions (these are used by default).
8744 % \end{macro}
8745 %
8746 % Set up the definitions used at the beginning of the document to define
8747 % the formats created by the document preamble.
8748 % \begin{macrocode}
8749 \DeclareOption{english}{%
8750 \AtBeginDocument{%
8751 \def\crefrangeconjunction@preamble{ to\nobreakspace}%
8752 \def\crefrangepreconjunction@preamble{}%
8753 \def\crefrangepostconjunction@preamble{}%
8754 \def\crefpairconjunction@preamble{ and\nobreakspace}%
8755 \def\crefmiddleconjunction@preamble{, }%
8756 \def\creflastconjunction@preamble{ and\nobreakspace}%
8757 % \end{macrocode}
8758 % We have to define the group conjunctions explicitly here, rather than
8759 % relying on fall-back definitions in terms of the above conjunctions
8760 % (see \cref{sec:code:default_formats}), in case any other language
8761 % option defines them explicitly and we need to override those.
8762 % \begin{macrocode}
8763 \def\crefpairgroupconjunction@preamble{ and\nobreakspace}%
8764 \def\crefmiddlegroupconjunction@preamble{, }%
8765 \def\creflastgroupconjunction@preamble{, and\nobreakspace}%
8766 %
8767 \Crefname@preamble{equation}{Equation}{Equations}%
8768 \Crefname@preamble{figure}{Figure}{Figures}%
8769 \Crefname@preamble{table}{Table}{Tables}%
8770 \Crefname@preamble{page}{Page}{Pages}%
8771 \Crefname@preamble{part}{Part}{Parts}%
8772 \Crefname@preamble{chapter}{Chapter}{Chapters}%
8773 \Crefname@preamble{section}{Section}{Sections}%
8774 \Crefname@preamble{appendix}{Appendix}{Appendices}%
8775 \Crefname@preamble{enumi}{Item}{Items}%
8776 \Crefname@preamble{footnote}{Footnote}{Footnotes}%
8777 \Crefname@preamble{theorem}{Theorem}{Theorems}%
8778 \Crefname@preamble{lemma}{Lemma}{Lemmas}%
8779 \Crefname@preamble{corollary}{Corollary}{Corollaries}%
8780 \Crefname@preamble{proposition}{Proposition}{Propositions}%
8781 \Crefname@preamble{definition}{Definition}{Definitions}%
8782 \Crefname@preamble{result}{Result}{Results}%
8783 \Crefname@preamble{example}{Example}{Examples}%
8784 \Crefname@preamble{remark}{Remark}{Remarks}%
8785 \Crefname@preamble{note}{Note}{Notes}%
8786 \Crefname@preamble{algorithm}{Algorithm}{Algorithms}%
8787 \Crefname@preamble{listing}{Listing}{Listings}%
8788 \Crefname@preamble{line}{Line}{Lines}%
8789 %
8790 \if@cref@capitalise% capitalise set
8791 \if@cref@abbrev%
8792 \crefname@preamble{equation}{Eq.}{Eqs.}%
8793 \crefname@preamble{figure}{Fig.}{Figs.}%
8794 \else%
8795 \crefname@preamble{equation}{Equation}{Equations}%
8796 \crefname@preamble{figure}{Figure}{Figures}%
8797 \fi%
8798 \crefname@preamble{page}{Page}{Pages}%
8799 \crefname@preamble{table}{Table}{Tables}%
8800 \crefname@preamble{part}{Part}{Parts}%
8801 \crefname@preamble{chapter}{Chapter}{Chapters}%
8802 \crefname@preamble{section}{Section}{Sections}%
8803 \crefname@preamble{appendix}{Appendix}{Appendices}%
8804 \crefname@preamble{enumi}{Item}{Items}%
8805 \crefname@preamble{footnote}{Footnote}{Footnotes}%
8806 \crefname@preamble{theorem}{Theorem}{Theorems}%
8807 \crefname@preamble{lemma}{Lemma}{Lemmas}%
8808 \crefname@preamble{corollary}{Corollary}{Corollaries}%
8809 \crefname@preamble{proposition}{Proposition}{Propositions}%
8810 \crefname@preamble{definition}{Definition}{Definitions}%
8811 \crefname@preamble{result}{Result}{Results}%
8812 \crefname@preamble{example}{Example}{Examples}%
8813 \crefname@preamble{remark}{Remark}{Remarks}%
8814 \crefname@preamble{note}{Note}{Notes}%
8815 \crefname@preamble{algorithm}{Algorithm}{Algorithms}%
8816 \crefname@preamble{listing}{Listing}{Listings}%
8817 \crefname@preamble{line}{Line}{Lines}%
8818 %
8819 \else% capitalise unset
8820 \if@cref@abbrev%
8821 \crefname@preamble{equation}{eq.}{eqs.}%
8822 \crefname@preamble{figure}{fig.}{figs.}%
8823 \else%
8824 \crefname@preamble{equation}{equation}{equations}%
8825 \crefname@preamble{figure}{figure}{figures}%
8826 \fi%
8827 \crefname@preamble{page}{page}{pages}%
8828 \crefname@preamble{table}{table}{tables}%
8829 \crefname@preamble{part}{part}{parts}%
8830 \crefname@preamble{chapter}{chapter}{chapters}%
8831 \crefname@preamble{section}{section}{sections}%
8832 \crefname@preamble{appendix}{appendix}{appendices}%
8833 \crefname@preamble{enumi}{item}{items}%
8834 \crefname@preamble{footnote}{footnote}{footnotes}%
8835 \crefname@preamble{theorem}{theorem}{theorems}%
8836 \crefname@preamble{lemma}{lemma}{lemmas}%
8837 \crefname@preamble{corollary}{corollary}{corollaries}%
8838 \crefname@preamble{proposition}{proposition}{propositions}%
8839 \crefname@preamble{definition}{definition}{definitions}%
8840 \crefname@preamble{result}{result}{results}%
8841 \crefname@preamble{example}{example}{examples}%
8842 \crefname@preamble{remark}{remark}{remarks}%
8843 \crefname@preamble{note}{note}{notes}%
8844 \crefname@preamble{algorithm}{algorithm}{algorithms}%
8845 \crefname@preamble{listing}{listing}{listings}%
8846 \crefname@preamble{line}{line}{lines}%
8847 \fi%
8848 \def\cref@language{english}%
8849 }}% end \AtBeginDocument and \DeclareOption
8850 % \end{macrocode}
8851 %
8852 % If using \package{babel} and the corresponding option is set, or if
8853 % using \package{polyglossia} and the language has been loaded, add
8854 % format definition commands to \cmd{\extras}\meta{language} or
8855 % \cmd{\captions}\meta{language} so that language switching commands will
8856 % change the cross-reference formats appropriately.
8857 % \begin{macrocode}
8858 \cref@addlanguagedefs{english}{%
8859 \PackageInfo{cleveref}{loaded `english' language definitions}%
8860 \renewcommand{\crefrangeconjunction}{ to\nobreakspace}%
8861 \renewcommand\crefrangepreconjunction{}%
8862 \renewcommand\crefrangepostconjunction{}%
8863 \renewcommand{\crefpairconjunction}{ and\nobreakspace}%
8864 \renewcommand{\crefmiddleconjunction}{, }%
8865 \renewcommand{\creflastconjunction}{ and\nobreakspace}%
8866 \renewcommand{\crefpairgroupconjunction}{ and\nobreakspace}%
8867 \renewcommand{\crefmiddlegroupconjunction}{, }%
8868 \renewcommand{\creflastgroupconjunction}{, and\nobreakspace}%
8869 %
8870 \Crefname{equation}{Equation}{Equations}%
8871 \Crefname{figure}{Figure}{Figures}%
8872 \Crefname{subfigure}{Figure}{Figures}%
8873 \Crefname{table}{Table}{Tables}%
8874 \Crefname{subtable}{Table}{Tables}%
8875 \Crefname{page}{Page}{Pages}%
8876 \Crefname{part}{Part}{Parts}%
8877 \Crefname{chapter}{Chapter}{Chapters}%
8878 \Crefname{section}{Section}{Sections}%
8879 \Crefname{subsection}{Section}{Sections}%
8880 \Crefname{subsubsection}{Section}{Sections}%
8881 \Crefname{appendix}{Appendix}{Appendices}%
8882 \Crefname{subappendix}{Appendix}{Appendices}%
8883 \Crefname{subsubappendix}{Appendix}{Appendices}%
8884 \Crefname{subsubsubappendix}{Appendix}{Appendices}%
8885 \Crefname{enumi}{Item}{Items}%
8886 \Crefname{enumii}{Item}{Items}%
8887 \Crefname{enumiii}{Item}{Items}%
8888 \Crefname{enumiv}{Item}{Items}%
8889 \Crefname{enumv}{Item}{Items}%
8890 \Crefname{footnote}{Footnote}{Footnotes}%
8891 \Crefname{theorem}{Theorem}{Theorems}%
8892 \Crefname{lemma}{Lemma}{Lemmas}%
8893 \Crefname{corollary}{Corollary}{Corollaries}%
8894 \Crefname{proposition}{Proposition}{Propositions}%
8895 \Crefname{definition}{Definition}{Definitions}%
8896 \Crefname{result}{Result}{Results}%
8897 \Crefname{example}{Example}{Examples}%
8898 \Crefname{remark}{Remark}{Remarks}%
8899 \Crefname{note}{Note}{Notes}%
8900 \Crefname{algorithm}{Algorithm}{Algorithms}%
8901 \Crefname{listing}{Listing}{Listings}%
8902 \Crefname{line}{Line}{Lines}%
8903 %
8904 \if@cref@capitalise% capitalise set
8905 \if@cref@abbrev%
8906 \crefname{equation}{Eq.}{Eqs.}%
8907 \crefname{figure}{Fig.}{Figs.}%
8908 \crefname{subfigure}{Fig.}{Figs.}%
8909 \else%
8910 \crefname{equation}{Equation}{Equations}%
8911 \crefname{figure}{Figure}{Figures}%
8912 \crefname{subfigure}{Figure}{Figures}%
8913 \fi%
8914 \crefname{page}{Page}{Pages}%
8915 \crefname{table}{Table}{Tables}%
8916 \crefname{subtable}{Table}{Tables}%
8917 \crefname{part}{Part}{Parts}%
8918 \crefname{chapter}{Chapter}{Chapters}%
8919 \crefname{section}{Section}{Sections}%
8920 \crefname{subsection}{Section}{Sections}%
8921 \crefname{subsubsection}{Section}{Sections}%
8922 \crefname{appendix}{Appendix}{Appendices}%
8923 \crefname{subappendix}{Appendix}{Appendices}%
8924 \crefname{subsubappendix}{Appendix}{Appendices}%
8925 \crefname{subsubsubappendix}{Appendix}{Appendices}%
8926 \crefname{enumi}{Item}{Items}%
8927 \crefname{enumii}{Item}{Items}%
8928 \crefname{enumiii}{Item}{Items}%
8929 \crefname{enumiv}{Item}{Items}%
8930 \crefname{enumv}{Item}{Items}%
8931 \crefname{footnote}{Footnote}{Footnotes}%
8932 \crefname{theorem}{Theorem}{Theorems}%
8933 \crefname{lemma}{Lemma}{Lemmas}%
8934 \crefname{corollary}{Corollary}{Corollaries}%
8935 \crefname{proposition}{Proposition}{Propositions}%
8936 \crefname{definition}{Definition}{Definitions}%
8937 \crefname{result}{Result}{Results}%
8938 \crefname{example}{Example}{Examples}%
8939 \crefname{remark}{Remark}{Remarks}%
8940 \crefname{note}{Note}{Notes}%
8941 \crefname{algorithm}{Algorithm}{Algorithms}%
8942 \crefname{listing}{Listing}{Listings}%
8943 \crefname{line}{Line}{Lines}%
8944 %
8945 \else% capitalise unset
8946 \if@cref@abbrev%
8947 \crefname{equation}{eq.}{eqs.}%
8948 \crefname{figure}{fig.}{figs.}%
8949 \crefname{subfigure}{fig.}{figs.}%
8950 \else%
8951 \crefname{equation}{equation}{equations}%
8952 \crefname{figure}{figure}{figures}%
8953 \crefname{subfigure}{figure}{figures}%
8954 \fi%
8955 \crefname{table}{table}{tables}%
8956 \crefname{subtable}{table}{tables}%
8957 \crefname{page}{page}{pages}%
8958 \crefname{part}{part}{parts}%
8959 \crefname{chapter}{chapter}{chapters}%
8960 \crefname{section}{section}{sections}%
8961 \crefname{subsection}{section}{sections}%
8962 \crefname{subsubsection}{section}{sections}%
8963 \crefname{appendix}{appendix}{appendices}%
8964 \crefname{subappendix}{appendix}{appendices}%
8965 \crefname{subsubappendix}{appendix}{appendices}%
8966 \crefname{subsubsubappendix}{appendix}{appendices}%
8967 \crefname{enumi}{item}{items}%
8968 \crefname{enumii}{item}{items}%
8969 \crefname{enumiii}{item}{items}%
8970 \crefname{enumiv}{item}{items}%
8971 \crefname{enumv}{item}{items}%
8972 \crefname{footnote}{footnote}{footnotes}%
8973 \crefname{theorem}{theorem}{theorems}%
8974 \crefname{lemma}{lemma}{lemmas}%
8975 \crefname{corollary}{corollary}{corollaries}%
8976 \crefname{proposition}{proposition}{propositions}%
8977 \crefname{definition}{definition}{definitions}%
8978 \crefname{result}{result}{results}%
8979 \crefname{example}{example}{examples}%
8980 \crefname{remark}{remark}{remarks}%
8981 \crefname{note}{note}{notes}%
8982 \crefname{algorithm}{algorithm}{algorithms}%
8983 \crefname{listing}{listing}{listings}%
8984 \crefname{line}{line}{lines}%
8985 \fi}% end \cref@addlangagedefs
8986 % \end{macrocode}
8987 %
8988 %
8989 % \subsubsection{German}
8990 % \begin{macro}{german}
8991 % German translations kindly provided by Stefan Pinnow, abbreviations
8992 % by Natanael Arndt, and a few additions by the package author (so you
8993 % know to blame the latter for any errors!).
8994 % \end{macro}
8995 %
8996 % Set up the definitions used at the beginning of the document to define
8997 % the formats created by the document preamble.
8998 % \begin{macrocode}
8999 \DeclareOption{german}{%
9000 \AtBeginDocument{%
9001 \def\crefrangeconjunction@preamble{ bis\nobreakspace}%
9002 \def\crefrangepreconjunction@preamble{}%
9003 \def\crefrangepostconjunction@preamble{}%
9004 \def\crefpairconjunction@preamble{ und\nobreakspace}%
9005 \def\crefmiddleconjunction@preamble{, }%
9006 \def\creflastconjunction@preamble{ und\nobreakspace}%
9007 % \end{macrocode}
9008 % We don't want the extra comma before ``und'' that would be added by the
9009 % default fall-back definitions in terms of the above conjunctions, so we
9010 % define \cmd{\crefpairgroupconjunction} explicitly. In fact, we have to
9011 % define the other group conjunctions explicitly too here, in case any
9012 % other language option defines them explicitly and we need to override
9013 % them.
9014 % \begin{macrocode}
9015 \def\crefpairgroupconjunction@preamble{ und\nobreakspace}%
9016 \def\crefmiddlegroupconjunction@preamble{, }%
9017 \def\creflastgroupconjunction@preamble{ und\nobreakspace}%
9018 %
9019 \Crefname@preamble{equation}{Gleichung}{Gleichungen}%
9020 \Crefname@preamble{figure}{Abbildung}{Abbildungen}%
9021 \Crefname@preamble{table}{Tabelle}{Tabellen}%
9022 \Crefname@preamble{page}{Seite}{Seiten}%
9023 \Crefname@preamble{part}{Teil}{Teile}%
9024 \Crefname@preamble{chapter}{Kapitel}{Kapitel}%
9025 \Crefname@preamble{section}{Abschnitt}{Abschnitte}%
9026 \Crefname@preamble{appendix}{Anhang}{Anh\"ange}%
9027 \Crefname@preamble{enumi}{Punkt}{Punkte}%
9028 \Crefname@preamble{footnote}{Fu\ss note}{Fu\ss noten}%
9029 \Crefname@preamble{theorem}{Theorem}{Theoreme}%
9030 \Crefname@preamble{lemma}{Lemma}{Lemmata}%
9031 \Crefname@preamble{corollary}{Korollar}{Korollare}%
9032 \Crefname@preamble{proposition}{Satz}{S\"atze}%
9033 \Crefname@preamble{definition}{Definition}{Definitionen}%
9034 \Crefname@preamble{result}{Ergebnis}{Ergebnisse}%
9035 \Crefname@preamble{example}{Beispiel}{Beispiele}%
9036 \Crefname@preamble{remark}{Bemerkung}{Bemerkungen}%
9037 \Crefname@preamble{note}{Anmerkung}{Anmerkungen}%
9038 \Crefname@preamble{algorithm}{Algorithmus}{Algorithmen}%
9039 \Crefname@preamble{listing}{Listing}{Listings}%
9040 \Crefname@preamble{line}{Zeile}{Zeilen}%
9041 %
9042 \if@cref@abbrev%
9043 \crefname@preamble{figure}{Abb.}{Abb.}%
9044 \else%
9045 \crefname@preamble{figure}{Abbildung}{Abbildungen}%
9046 \fi%
9047 \crefname@preamble{equation}{Gleichung}{Gleichungen}%
9048 \crefname@preamble{table}{Tabelle}{Tabellen}%
9049 \crefname@preamble{page}{Seite}{Seiten}%
9050 \crefname@preamble{part}{Teil}{Teile}%
9051 \crefname@preamble{chapter}{Kapitel}{Kapitel}%
9052 \crefname@preamble{section}{Abschnitt}{Abschnitte}%
9053 \crefname@preamble{appendix}{Anhang}{Anh\"ange}%
9054 \crefname@preamble{enumi}{Punkt}{Punkte}%
9055 \crefname@preamble{footnote}{Fu\ss note}{Fu\ss noten}%
9056 \crefname@preamble{theorem}{Theorem}{Theoreme}%
9057 \crefname@preamble{lemma}{Lemma}{Lemmata}%
9058 \crefname@preamble{corollary}{Korollar}{Korollare}%
9059 \crefname@preamble{proposition}{Satz}{S\"atze}%
9060 \crefname@preamble{definition}{Definition}{Definitionen}%
9061 \crefname@preamble{result}{Ergebnis}{Ergebnisse}%
9062 \crefname@preamble{example}{Beispiel}{Beispiele}%
9063 \crefname@preamble{remark}{Bemerkung}{Bemerkungen}%
9064 \crefname@preamble{note}{Anmerkung}{Anmerkungen}%
9065 \crefname@preamble{algorithm}{Algorithmus}{Algorithmen}%
9066 \crefname@preamble{listing}{Listing}{Listings}%
9067 \crefname@preamble{line}{Zeile}{Zeilen}%
9068 \def\cref@language{german}%
9069 }}% end \AtBeginDocument and \DeclareOption
9070 % \end{macrocode}
9071 %
9072 % If using \package{babel} and the corresponding option is set, or if
9073 % using \package{polyglossia} and the language has been loaded, add
9074 % format definition commands to \cmd{\extras}\meta{language} or
9075 % \cmd{\captions}\meta{language} so that language switching commands will
9076 % change the cross-reference formats appropriately.
9077 % \begin{macrocode}
9078 \cref@addlanguagedefs{german}{%
9079 \PackageInfo{cleveref}{loaded `german language definitions}%
9080 \renewcommand{\crefrangeconjunction}{ bis\nobreakspace}%
9081 \renewcommand\crefrangepreconjunction{}%
9082 \renewcommand\crefrangepostconjunction{}%
9083 \renewcommand{\crefpairconjunction}{ und\nobreakspace}%
9084 \renewcommand{\crefmiddleconjunction}{, }%
9085 \renewcommand{\creflastconjunction}{ und\nobreakspace}%
9086 \renewcommand{\crefpairgroupconjunction}{ und\nobreakspace}%
9087 \renewcommand{\crefmiddlegroupconjunction}{, }%
9088 \renewcommand{\creflastgroupconjunction}{ und\nobreakspace}%
9089 %
9090 \Crefname{equation}{Gleichung}{Gleichungen}%
9091 \Crefname{figure}{Abbildung}{Abbildungen}%
9092 \Crefname{subfigure}{Abbildung}{Abbildungen}%
9093 \Crefname{table}{Tabelle}{Tabellen}%
9094 \Crefname{subtable}{Tabelle}{Tabellen}%
9095 \Crefname{page}{Seite}{Seiten}%
9096 \Crefname{part}{Teil}{Teile}%
9097 \Crefname{chapter}{Kapitel}{Kapitel}%
9098 \Crefname{section}{Abschnitt}{Abschnitte}%
9099 \Crefname{subsection}{Abschnitt}{Abschnitte}%
9100 \Crefname{subsubsection}{Abschnitt}{Abschnitte}%
9101 \Crefname{appendix}{Anhang}{Anh\"ange}%
9102 \Crefname{subappendix}{Anhang}{Anh\"ange}%
9103 \Crefname{subsubappendix}{Anhang}{Anh\"ange}%
9104 \Crefname{subsubsubappendix}{Anhang}{Anh\"ange}%
9105 \Crefname{enumi}{Punkt}{Punkte}%
9106 \Crefname{enumii}{Punkt}{Punkte}%
9107 \Crefname{enumiii}{Punkt}{Punkte}%
9108 \Crefname{enumiv}{Punkt}{Punkte}%
9109 \Crefname{enumv}{Punkt}{Punkte}%
9110 \Crefname{footnote}{Fu\ss note}{Fu\ss noten}%
9111 \Crefname{theorem}{Theorem}{Theoreme}%
9112 \Crefname{lemma}{Lemma}{Lemmata}%
9113 \Crefname{corollary}{Korollar}{Korollare}%
9114 \Crefname{proposition}{Satz}{S\"atze}%
9115 \Crefname{definition}{Definition}{Definitionen}%
9116 \Crefname{result}{Ergebnis}{Ergebnisse}%
9117 \Crefname{example}{Beispiel}{Beispiele}%
9118 \Crefname{remark}{Bemerkung}{Bemerkungen}%
9119 \Crefname{note}{Anmerkung}{Anmerkungen}%
9120 \Crefname{algorithm}{Algorithmus}{Algorithmen}%
9121 \Crefname{listing}{Listing}{Listings}%
9122 \Crefname{line}{Zeile}{Zeilen}%
9123 %
9124 \if@cref@abbrev%
9125 \crefname{figure}{Abb.}{Abb.}%
9126 \crefname{subfigure}{Abb.}{Abb.}%
9127 \else%
9128 \crefname{figure}{Abbildung}{Abbildungen}%
9129 \crefname{subfigure}{Abbildung}{Abbildungen}%
9130 \fi%
9131 \crefname{equation}{Gleichung}{Gleichungen}%
9132 \crefname{table}{Tabelle}{Tabellen}%
9133 \crefname{subtable}{Tabelle}{Tabellen}%
9134 \crefname{page}{Seite}{Seiten}%
9135 \crefname{part}{Teil}{Teile}%
9136 \crefname{chapter}{Kapitel}{Kapitel}%
9137 \crefname{section}{Abschnitt}{Abschnitte}%
9138 \crefname{subsection}{Abschnitt}{Abschnitte}%
9139 \crefname{subsubsection}{Abschnitt}{Abschnitte}%
9140 \crefname{appendix}{Anhang}{Anh\"ange}%
9141 \crefname{subappendix}{Anhang}{Anh\"ange}%
9142 \crefname{subsubappendix}{Anhang}{Anh\"ange}%
9143 \crefname{subsubsubappendix}{Anhang}{Anh\"ange}%
9144 \crefname{enumi}{Punkt}{Punkte}%
9145 \crefname{enumii}{Punkt}{Punkte}%
9146 \crefname{enumiii}{Punkt}{Punkte}%
9147 \crefname{enumiv}{Punkt}{Punkte}%
9148 \crefname{enumv}{Punkt}{Punkte}%
9149 \crefname{footnote}{Fu\ss note}{Fu\ss noten}%
9150 \crefname{theorem}{Theorem}{Theoreme}%
9151 \crefname{lemma}{Lemma}{Lemmata}%
9152 \crefname{corollary}{Korollar}{Korollare}%
9153 \crefname{proposition}{Satz}{S\"atze}%
9154 \crefname{definition}{Definition}{Definitionen}%
9155 \crefname{result}{Ergebnis}{Ergebnisse}%
9156 \crefname{example}{Beispiel}{Beispiele}%
9157 \crefname{remark}{Bemerkung}{Bemerkungen}%
9158 \crefname{note}{Anmerkung}{Anmerkungen}%
9159 \crefname{algorithm}{Algorithmus}{Algorithmen}%
9160 \crefname{listing}{Listing}{Listings}%
9161 \crefname{line}{Zeile}{Zeilen}}% end \cref@addlangagedefs
9162 % \end{macrocode}
9163 %
9164 %
9165 % \begin{macro}{ngerman}
9166 % It so happens that none of the cross-reference names differ in the
9167 % ``Neuerechtschreibung'', so we make \option{ngerman} execute
9168 % \option{german}.
9169 % \end{macro}
9170 % \begin{macrocode}
9171 \DeclareOption{ngerman}{%
9172 \ExecuteOptions{german}%
9173 \def\cref@language{ngerman}}%
9174 % \end{macrocode}
9175 % However, we still need to add the definitions to \cmd{\extrasngerman}
9176 % (note the ``n'') so that \cmd{\selectlanguage} etc.\ will work.
9177 % \begin{macrocode}
9178 \cref@addlanguagedefs{ngerman}{%
9179 \PackageInfo{cleveref}{loaded `ngerman' language definitions}%
9180 \renewcommand{\crefrangeconjunction}{ bis\nobreakspace}%
9181 \renewcommand\crefrangepreconjunction{}%
9182 \renewcommand\crefrangepostconjunction{}%
9183 \renewcommand{\crefpairconjunction}{ und\nobreakspace}%
9184 \renewcommand{\crefmiddleconjunction}{, }%
9185 \renewcommand{\creflastconjunction}{ und\nobreakspace}%
9186 \renewcommand{\crefpairgroupconjunction}{ und\nobreakspace}%
9187 \renewcommand{\crefmiddlegroupconjunction}{, }%
9188 \renewcommand{\creflastgroupconjunction}{ und\nobreakspace}%
9189 %
9190 \Crefname{equation}{Gleichung}{Gleichungen}%
9191 \Crefname{figure}{Abbildung}{Abbildungen}%
9192 \Crefname{subfigure}{Abbildung}{Abbildungen}%
9193 \Crefname{table}{Tabelle}{Tabellen}%
9194 \Crefname{subtable}{Tabelle}{Tabellen}%
9195 \Crefname{page}{Seite}{Seiten}%
9196 \Crefname{part}{Teil}{Teile}%
9197 \Crefname{chapter}{Kapitel}{Kapitel}%
9198 \Crefname{section}{Abschnitt}{Abschnitte}%
9199 \Crefname{subsection}{Abschnitt}{Abschnitte}%
9200 \Crefname{subsubsection}{Abschnitt}{Abschnitte}%
9201 \Crefname{appendix}{Anhang}{Anh\"ange}%
9202 \Crefname{subappendix}{Anhang}{Anh\"ange}%
9203 \Crefname{subsubappendix}{Anhang}{Anh\"ange}%
9204 \Crefname{subsubsubappendix}{Anhang}{Anh\"ange}%
9205 \Crefname{enumi}{Punkt}{Punkte}%
9206 \Crefname{enumii}{Punkt}{Punkte}%
9207 \Crefname{enumiii}{Punkt}{Punkte}%
9208 \Crefname{enumiv}{Punkt}{Punkte}%
9209 \Crefname{enumv}{Punkt}{Punkte}%
9210 \Crefname{footnote}{Fu\ss note}{Fu\ss noten}%
9211 \Crefname{theorem}{Theorem}{Theoreme}%
9212 \Crefname{lemma}{Lemma}{Lemmata}%
9213 \Crefname{corollary}{Korollar}{Korollare}%
9214 \Crefname{proposition}{Satz}{S\"atze}%
9215 \Crefname{definition}{Definition}{Definitionen}%
9216 \Crefname{result}{Ergebnis}{Ergebnisse}%
9217 \Crefname{example}{Beispiel}{Beispiele}%
9218 \Crefname{remark}{Bemerkung}{Bemerkungen}%
9219 \Crefname{note}{Anmerkung}{Anmerkungen}%
9220 \Crefname{algorithm}{Algorithmus}{Algorithmen}%
9221 \Crefname{listing}{Listing}{Listings}%
9222 \Crefname{line}{Zeile}{Zeilen}%
9223 %
9224 \if@cref@abbrev%
9225 \crefname{figure}{Abb.}{Abb.}%
9226 \crefname{subfigure}{Abb.}{Abb.}%
9227 \else%
9228 \crefname{figure}{Abbildung}{Abbildungen}%
9229 \crefname{subfigure}{Abbildung}{Abbildungen}%
9230 \fi%
9231 \crefname{equation}{Gleichung}{Gleichungen}%
9232 \crefname{table}{Tabelle}{Tabellen}%
9233 \crefname{subtable}{Tabelle}{Tabellen}%
9234 \crefname{page}{Seite}{Seiten}%
9235 \crefname{part}{Teil}{Teile}%
9236 \crefname{chapter}{Kapitel}{Kapitel}%
9237 \crefname{section}{Abschnitt}{Abschnitte}%
9238 \crefname{subsection}{Abschnitt}{Abschnitte}%
9239 \crefname{subsubsection}{Abschnitt}{Abschnitte}%
9240 \crefname{appendix}{Anhang}{Anh\"ange}%
9241 \crefname{subappendix}{Anhang}{Anh\"ange}%
9242 \crefname{subsubappendix}{Anhang}{Anh\"ange}%
9243 \crefname{subsubsubappendix}{Anhang}{Anh\"ange}%
9244 \crefname{enumi}{Punkt}{Punkte}%
9245 \crefname{enumii}{Punkt}{Punkte}%
9246 \crefname{enumiii}{Punkt}{Punkte}%
9247 \crefname{enumiv}{Punkt}{Punkte}%
9248 \crefname{enumv}{Punkt}{Punkte}%
9249 \crefname{footnote}{Fu\ss note}{Fu\ss noten}%
9250 \crefname{theorem}{Theorem}{Theoreme}%
9251 \crefname{lemma}{Lemma}{Lemmata}%
9252 \crefname{corollary}{Korollar}{Korollare}%
9253 \crefname{proposition}{Satz}{S\"atze}%
9254 \crefname{definition}{Definition}{Definitionen}%
9255 \crefname{result}{Ergebnis}{Ergebnisse}%
9256 \crefname{example}{Beispiel}{Beispiele}%
9257 \crefname{remark}{Bemerkung}{Bemerkungen}%
9258 \crefname{note}{Anmerkung}{Anmerkungen}%
9259 \crefname{algorithm}{Algorithmus}{Algorithmen}%
9260 \crefname{listing}{Listing}{Listings}%
9261 \crefname{line}{Zeile}{Zeilen}}% end \cref@addlangagedefs
9262 % \end{macrocode}
9263 %
9264 %
9265 % \subsubsection{Dutch}
9266 % \begin{macro}{dutch}
9267 % Dutch translations kindly contributed by Philip H\"olzenspies and Tom Marcoen.
9268 % \end{macro}
9269 %
9270 % Set up the definitions used at the beginning of the document to define
9271 % the formats created by the document preamble.
9272 % \begin{macrocode}
9273 \DeclareOption{dutch}{%
9274 \AtBeginDocument{%
9275 \def\crefrangeconjunction@preamble{ tot\nobreakspace}%
9276 \def\crefrangepreconjunction@preamble{}%
9277 \def\crefrangepostconjunction@preamble{}%
9278 \def\crefpairconjunction@preamble{ en\nobreakspace}%
9279 \def\crefmiddleconjunction@preamble{, }%
9280 \def\creflastconjunction@preamble{ en\nobreakspace}%
9281 % \end{macrocode}
9282 % As in German, we don't want the extra comma before ``en'' that would be
9283 % added by the default fall-back definitions in terms of the above
9284 % conjunctions, so we define \cmd{\crefpairgroupconjunction} explicitly.
9285 % In fact, we have to define the other group conjunctions explicitly too
9286 % here, in case any other language option defines them explicitly and we
9287 % need to override them.
9288 % \begin{macrocode}
9289 \def\crefpairgroupconjunction@preamble{ en\nobreakspace}%
9290 \def\crefmiddlegroupconjunction@preamble{, }%
9291 \def\creflastgroupconjunction@preamble{ en\nobreakspace}%
9292 %
9293 \Crefname@preamble{equation}{Vergel\ij{}king}{Vergel\ij{}kingen}%
9294 \Crefname@preamble{figure}{Figuur}{Figuren}%
9295 \Crefname@preamble{table}{Tabel}{Tabellen}%
9296 \Crefname@preamble{page}{Pagina}{Pagina's}%
9297 \Crefname@preamble{part}{Deel}{Delen}%
9298 \Crefname@preamble{chapter}{Hoofdstuk}{Hoofdstukken}%
9299 \Crefname@preamble{section}{Paragraaf}{Paragrafen}%
9300 \Crefname@preamble{appendix}{Appendix}{Appendices}%
9301 \Crefname@preamble{enumi}{Punt}{Punten}%
9302 \Crefname@preamble{footnote}{Voetnoot}{Voetnoten}%
9303 \Crefname@preamble{lemma}{Lemma}{Lemma's}%
9304 \Crefname@preamble{corollary}{Corollarium}{Corollaria}%
9305 \Crefname@preamble{proposition}{Bewering}{Beweringen}%
9306 \Crefname@preamble{definition}{Definitie}{Definities}%
9307 \Crefname@preamble{result}{Resultaat}{Resultaten}%
9308 \Crefname@preamble{example}{Voorbeeld}{Voorbeelden}%
9309 \Crefname@preamble{remark}{Opmerking}{Opmerkingen}%
9310 \Crefname@preamble{note}{Aantekening}{Aantekeningen}%
9311 \Crefname@preamble{algorithm}{Algoritme}{Algoritmen}%
9312 \Crefname@preamble{listing}{Listing}{Listings}%
9313 \Crefname@preamble{line}{Lijn}{Lijnen}%
9314 %
9315 \if@cref@capitalise% capitalise set
9316 \if@cref@abbrev%
9317 \crefname@preamble{equation}{Verg.}{Verg.'s}%
9318 \crefname@preamble{figure}{Fig.}{Fig.'s}%
9319 \else%
9320 \crefname@preamble{equation}{Vergel\ij{}king}{Vergel\ij{}kingen}%
9321 \crefname@preamble{figure}{Figuur}{Figuren}%
9322 \fi%
9323 \crefname@preamble{page}{Pagina}{Pagina's}%
9324 \crefname@preamble{table}{Tabel}{Tabellen}%
9325 \crefname@preamble{part}{Deel}{Delen}%
9326 \crefname@preamble{chapter}{Hoofdstuk}{Hoofdstukken}%
9327 \crefname@preamble{section}{Paragraaf}{Paragrafen}%
9328 \crefname@preamble{appendix}{Appendix}{Appendices}%
9329 \crefname@preamble{enumi}{Punt}{Punten}%
9330 \crefname@preamble{footnote}{Voetnoot}{Voetnoten}%
9331 \crefname@preamble{theorem}{Theorema}{Theorema's}%
9332 \crefname@preamble{lemma}{Lemma}{Lemma's}%
9333 \crefname@preamble{corollary}{Corollarium}{Corollaria}%
9334 \crefname@preamble{proposition}{Bewering}{Beweringen}%
9335 \crefname@preamble{definition}{Definitie}{Definities}%
9336 \crefname@preamble{result}{Resultaat}{Resultaten}%
9337 \crefname@preamble{example}{Voorbeeld}{Voorbeelden}%
9338 \crefname@preamble{remark}{Opmerking}{Opmerkingen}%
9339 \crefname@preamble{note}{Aantekening}{Aantekeningen}%
9340 \crefname@preamble{algorithm}{Algoritme}{Algoritmen}%
9341 \crefname@preamble{listing}{Listing}{Listings}%
9342 \crefname@preamble{line}{Lijn}{Lijnen}%
9343 %
9344 \else% capitalise unset
9345 \if@cref@abbrev%
9346 \crefname@preamble{equation}{verg.}{verg.'s}%
9347 \crefname@preamble{figure}{fig.}{fig.'s}%
9348 \else%
9349 \crefname@preamble{equation}{vergel\ij{}king}{vergel\ij{}kingen}%
9350 \crefname@preamble{figure}{figuur}{figuren}%
9351 \fi%
9352 \crefname@preamble{page}{pagina}{pagina's}%
9353 \crefname@preamble{table}{tabel}{tabellen}%
9354 \crefname@preamble{part}{deel}{delen}%
9355 \crefname@preamble{chapter}{hoofdstuk}{hoofdstukken}%
9356 \crefname@preamble{section}{paragraaf}{paragrafen}%
9357 \crefname@preamble{appendix}{appendix}{appendices}%
9358 \crefname@preamble{enumi}{punt}{punten}%
9359 \crefname@preamble{footnote}{voetnoot}{voetnoten}%
9360 \crefname@preamble{theorem}{theorema}{theorema's}%
9361 \crefname@preamble{lemma}{lemma}{lemma's}%
9362 \crefname@preamble{corollary}{corollarium}{corollaria}%
9363 \crefname@preamble{proposition}{bewering}{beweringen}%
9364 \crefname@preamble{definition}{definitie}{definities}%
9365 \crefname@preamble{result}{resultaat}{resultaten}%
9366 \crefname@preamble{example}{voorbeeld}{voorbeelden}%
9367 \crefname@preamble{remark}{opmerking}{opmerkingen}%
9368 \crefname@preamble{note}{aantekening}{aantekeningen}%
9369 \crefname@preamble{algorithm}{algoritme}{algoritmen}%
9370 \crefname@preamble{listing}{listing}{listings}%
9371 \crefname@preamble{line}{lijn}{lijnen}%
9372 \fi%
9373 \def\cref@language{dutch}%
9374 }}% end \DeclareOption and \AtBeginDocument
9375 % \end{macrocode}
9376 %
9377 % If using \package{babel} and the corresponding option is set, or if
9378 % using \package{polyglossia} and the language has been loaded, add
9379 % format definition commands to \cmd{\extras}\meta{language} or
9380 % \cmd{\captions}\meta{language} so that language switching commands will
9381 % change the cross-reference formats appropriately.
9382 % \begin{macrocode}
9383 \cref@addlanguagedefs{dutch}{%
9384 \PackageInfo{cleveref}{loaded `dutch' language definitions}%
9385 \renewcommand{\crefrangeconjunction}{ tot\nobreakspace}%
9386 \renewcommand\crefrangepreconjunction{}%
9387 \renewcommand\crefrangepostconjunction{}%
9388 \renewcommand{\crefpairconjunction}{ en\nobreakspace}%
9389 \renewcommand{\crefmiddleconjunction}{, }%
9390 \renewcommand{\creflastconjunction}{ en\nobreakspace}%
9391 \renewcommand{\crefpairgroupconjunction}{ en\nobreakspace}%
9392 \renewcommand{\crefmiddlegroupconjunction}{, }%
9393 \renewcommand{\creflastgroupconjunction}{ en\nobreakspace}%
9394 %
9395 \Crefname{equation}{Vergel\ij{}king}{Vergel\ij{}kingen}%
9396 \Crefname{figure}{Figuur}{Figuren}%
9397 \Crefname{subfigure}{Figuur}{Figuren}%
9398 \Crefname{table}{Tabel}{Tabellen}%
9399 \Crefname{subtable}{Tabel}{Tabellen}%
9400 \Crefname{page}{Pagina}{Pagina's}%
9401 \Crefname{part}{Deel}{Delen}%
9402 \Crefname{chapter}{Hoofdstuk}{Hoofdstuken}%
9403 \Crefname{section}{Paragraaf}{Paragrafen}%
9404 \Crefname{subsection}{Paragraaf}{Paragrafen}%
9405 \Crefname{subsubsection}{Paragraaf}{Paragrafen}%
9406 \Crefname{appendix}{Appendix}{Appendices}%
9407 \Crefname{subappendix}{Appendix}{Appendices}%
9408 \Crefname{subsubappendix}{Appendix}{Appendices}%
9409 \Crefname{subsubsubappendix}{Appendix}{Appendices}%
9410 \Crefname{enumi}{Punt}{Punten}%
9411 \Crefname{enumii}{Punt}{Punten}%
9412 \Crefname{enumiii}{Punt}{Punten}%
9413 \Crefname{enumiv}{Punt}{Punten}%
9414 \Crefname{enumv}{Punt}{Punten}%
9415 \Crefname{footnote}{Voetnote}{Voetnoten}%
9416 \Crefname{theorem}{Theorema}{Theorema's}%
9417 \Crefname{lemma}{Lemma}{Lemma's}%
9418 \Crefname{corollary}{Corollarium}{Corollaria}%
9419 \Crefname{proposition}{Bewering}{Beweringen}%
9420 \Crefname{definition}{Definitie}{Definities}%
9421 \Crefname{result}{Resultaat}{Resultaten}%
9422 \Crefname{example}{Voorbeeld}{Voorbeelden}%
9423 \Crefname{remark}{Opmerking}{Opmerkingen}%
9424 \Crefname{note}{Aantekening}{Aantekeningen}%
9425 \Crefname{algorithm}{Algoritme}{Algoritmen}%
9426 \Crefname{listing}{Listing}{Listings}%
9427 \Crefname{line}{Lijn}{Lijnen}%
9428 %
9429 \if@cref@capitalise% capitalise set
9430 \if@cref@abbrev%
9431 \crefname{equation}{Verg.}{Verg's.}%
9432 \crefname{figure}{Fig.}{Fig's.}%
9433 \crefname{subfigure}{Fig.}{Fig's.}%
9434 \else%
9435 \crefname{equation}{Vergel\ij{}king}{Vergel\ij{}kingen}%
9436 \crefname{figure}{Figuur}{Figuren}%
9437 \crefname{subfigure}{Figuur}{Figuren}%
9438 \fi%
9439 \crefname{table}{Tabel}{Tabellen}%
9440 \crefname{subtable}{Tabel}{Tabellen}%
9441 \crefname{page}{Pagina}{Pagina's}%
9442 \crefname{part}{Deel}{Delen}%
9443 \crefname{chapter}{Hoofdstuk}{Hoofdstukken}%
9444 \crefname{section}{Paragraaf}{Paragrafen}%
9445 \crefname{appendix}{Appendix}{Appendices}%
9446 \crefname{enumi}{Punt}{Punten}%
9447 \crefname{footnote}{Voetnote}{Voetnoten}%
9448 \crefname{theorem}{Theorema}{Theorema's}%
9449 \crefname{lemma}{Lemma}{Lemma's}%
9450 \crefname{corollary}{Corollarium}{Corollaria}%
9451 \crefname{proposition}{Bewering}{Beweringen}%
9452 \crefname{definition}{Definitie}{Definities}%
9453 \crefname{result}{Resultaat}{Resultaten}%
9454 \crefname{example}{Voorbeeld}{Voorbeelden}%
9455 \crefname{remark}{Opmerking}{Opmerkingen}%
9456 \crefname{note}{Aantekening}{Aantekeningen}%
9457 \crefname{algorithm}{Algoritme}{Algoritmen}%
9458 \crefname{listing}{Listing}{Listings}%
9459 \crefname{line}{Lijn}{Lijnen}%
9460 %
9461 \else% capitalise unset
9462 \if@cref@abbrev%
9463 \crefname{equation}{verg.}{verg's.}%
9464 \crefname{figure}{fig.}{fig's.}%
9465 \crefname{subfigure}{fig.}{fig's.}%
9466 \else%
9467 \crefname{equation}{vergel\ij{}king}{vergel\ij{}kingen}%
9468 \crefname{figure}{figuur}{figuren}%
9469 \crefname{subfigure}{figuur}{figuren}%
9470 \fi%
9471 \crefname{table}{tabel}{tabellen}%
9472 \crefname{subtable}{tabel}{tabellen}%
9473 \crefname{page}{pagina}{pagina's}%
9474 \crefname{part}{deel}{delen}%
9475 \crefname{chapter}{hoofdstuk}{hoofdstukken}%
9476 \crefname{section}{paragraaf}{paragrafen}%
9477 \crefname{appendix}{appendix}{appendices}%
9478 \crefname{enumi}{punt}{punten}%
9479 \crefname{footnote}{voetnote}{voetnoten}%
9480 \crefname{theorem}{theorema}{theorema's}%
9481 \crefname{lemma}{lemma}{lemma's}%
9482 \crefname{corollary}{corollarium}{corollaria}%
9483 \crefname{proposition}{bewering}{beweringen}%
9484 \crefname{definition}{definitie}{definities}%
9485 \crefname{result}{resultaat}{resultaten}%
9486 \crefname{example}{voorbeeld}{voorbeelden}%
9487 \crefname{remark}{opmerking}{opmerkingen}%
9488 \crefname{note}{aantekening}{aantekeningen}%
9489 \crefname{algorithm}{algoritme}{algoritmen}%
9490 \crefname{listing}{listing}{listings}%
9491 \crefname{line}{lijn}{lijnen}%
9492 \fi}% end \cref@addlanguagedefs
9493 % \end{macrocode}
9494 %
9495 %
9496 % \subsubsection{French}
9497 % \begin{macro}{french}
9498 % French translations attempted by the package author (please report
9499 % any corrections that might be needed!).
9500 % \end{macro}
9501 %
9502 % Set up the definitions used at the beginning of the document to define
9503 % the formats created by the document preamble.
9504 % \begin{macrocode}
9505 \DeclareOption{french}{%
9506 \AtBeginDocument{%
9507 \def\crefrangeconjunction@preamble{ \`a\nobreakspace}%
9508 \def\crefrangepreconjunction@preamble{}%
9509 \def\crefrangepostconjunction@preamble{}%
9510 \def\crefpairconjunction@preamble{ et\nobreakspace}%
9511 \def\crefmiddleconjunction@preamble{, }%
9512 \def\creflastconjunction@preamble{ et\nobreakspace}%
9513 % \end{macrocode}
9514 % Erring on the side of caution, I've left off the extra comma before
9515 % ``et'' between groups, pending more knowledgeable input on punctuation
9516 % rules from a native French speaker.
9517 % \begin{macrocode}
9518 \def\crefpairgroupconjunction@preamble{ et\nobreakspace}%
9519 \def\crefmiddlegroupconjunction@preamble{, }%
9520 \def\creflastgroupconjunction@preamble{, et\nobreakspace}%
9521 %
9522 \Crefname@preamble{equation}{{\'E}quation}{{\'E}quations}%
9523 \Crefname@preamble{figure}{Figure}{Figures}%
9524 \Crefname@preamble{table}{Tableau}{Tableaux}%
9525 \Crefname@preamble{page}{Page}{Pages}%
9526 \Crefname@preamble{part}{Partie}{Parties}%
9527 \Crefname@preamble{chapter}{Chapitre}{Chapitres}%
9528 \Crefname@preamble{section}{Section}{Sections}%
9529 \Crefname@preamble{appendix}{Annexe}{Annexes}%
9530 \Crefname@preamble{enumi}{Point}{Points}%
9531 \Crefname@preamble{footnote}{Note}{Notes}%
9532 \Crefname@preamble{theorem}{Th\'eor\`eme}{Th\'eor\`emes}%
9533 \Crefname@preamble{lemma}{Lemme}{Lemmes}%
9534 \Crefname@preamble{corollary}{Corollaire}{Corollaires}%
9535 \Crefname@preamble{proposition}{Proposition}{Propositions}%
9536 \Crefname@preamble{definition}{D\'efinition}{D\'efinitions}%
9537 \Crefname@preamble{result}{R\'esultat}{R\'esultats}%
9538 \Crefname@preamble{example}{Exemple}{Exemples}%
9539 \Crefname@preamble{remark}{Remarque}{Remarques}%
9540 \Crefname@preamble{algorithm}{Algorithme}{Algorithmes}%
9541 \Crefname@preamble{listing}{Liste}{Listes}%
9542 \Crefname@preamble{line}{Ligne}{Lignes}%
9543 %
9544 \if@cref@capitalise% capitalise set
9545 \crefname@preamble{equation}{{\'E}quation}{{\'E}quations}%
9546 \crefname@preamble{figure}{Figure}{Figures}%
9547 \crefname@preamble{table}{Tableau}{Tableaux}%
9548 \crefname@preamble{page}{Page}{Pages}%
9549 \crefname@preamble{part}{Partie}{Parties}%
9550 \crefname@preamble{chapter}{Chapitre}{Chapitres}%
9551 \crefname@preamble{section}{Section}{Sections}%
9552 \crefname@preamble{appendix}{Annexe}{Annexes}%
9553 \crefname@preamble{enumi}{Point}{Points}%
9554 \crefname@preamble{footnote}{Note}{Notes}%
9555 \crefname@preamble{theorem}{Th\'eor\`eme}{Th\'eor\`emes}%
9556 \crefname@preamble{lemma}{Lemme}{Lemmes}%
9557 \crefname@preamble{corollary}{Corollaire}{Corollaires}%
9558 \crefname@preamble{proposition}{Proposition}{Propositions}%
9559 \crefname@preamble{definition}{D\'efinition}{D\'efinitions}%
9560 \crefname@preamble{result}{R\'esultat}{R\'esultats}%
9561 \crefname@preamble{example}{Exemple}{Exemples}%
9562 \crefname@preamble{remark}{Remarque}{Remarques}%
9563 \crefname@preamble{note}{Commentaire}{Commentaires}%
9564 \crefname@preamble{algorithm}{Algorithme}{Algorithmes}%
9565 \crefname@preamble{listing}{Liste}{Listes}%
9566 \crefname@preamble{line}{Ligne}{Lignes}%
9567 %
9568 \else% capitalise unset
9569 \crefname@preamble{equation}{{\'e}quation}{{\'e}quations}%
9570 \crefname@preamble{figure}{figure}{figures}%
9571 \crefname@preamble{table}{tableau}{tableaux}%
9572 \crefname@preamble{page}{page}{pages}%
9573 \crefname@preamble{part}{partie}{parties}%
9574 \crefname@preamble{chapter}{chapitre}{chapitres}%
9575 \crefname@preamble{section}{section}{sections}%
9576 \crefname@preamble{appendix}{annexe}{annexes}%
9577 \crefname@preamble{enumi}{point}{points}%
9578 \crefname@preamble{footnote}{note}{notes}%
9579 \crefname@preamble{theorem}{th\'eor\`eme}{th\'eor\`emes}%
9580 \crefname@preamble{lemma}{lemme}{lemmes}%
9581 \crefname@preamble{corollary}{corollaire}{corollaires}%
9582 \crefname@preamble{proposition}{proposition}{propositions}%
9583 \crefname@preamble{definition}{d\'efinition}{d\'efinitions}%
9584 \crefname@preamble{result}{r\'esultat}{r\'esultats}%
9585 \crefname@preamble{example}{exemple}{exemples}%
9586 \crefname@preamble{remark}{remarque}{remarques}%
9587 \crefname@preamble{note}{commentaire}{commentaires}%
9588 \crefname@preamble{algorithm}{algorithme}{algorithmes}%
9589 \crefname@preamble{listing}{liste}{listes}%
9590 \crefname@preamble{line}{ligne}{lignes}%
9591 \fi%
9592 \def\cref@language{french}%
9593 }}% end \DeclareOption and \AtBeginDocument
9594 % \end{macrocode}
9595 %
9596 % If using \package{babel} and the corresponding option is set, or if
9597 % using \package{polyglossia} and the language has been loaded, add
9598 % format definition commands to \cmd{\extras}\meta{language} or
9599 % \cmd{\captions}\meta{language} so that language switching commands will
9600 % change the cross-reference formats appropriately.
9601 % \begin{macrocode}
9602 \cref@addlanguagedefs{french}{%
9603 \PackageInfo{cleveref}{loaded `french' language definitions}%
9604 \renewcommand{\crefrangeconjunction}{ \`a\nobreakspace}%
9605 \renewcommand\crefrangepreconjunction{}%
9606 \renewcommand\crefrangepostconjunction{}%
9607 \renewcommand{\crefpairconjunction}{ et\nobreakspace}%
9608 \renewcommand{\crefmiddleconjunction}{, }%
9609 \renewcommand{\creflastconjunction}{ et\nobreakspace}%
9610 \renewcommand{\crefpairgroupconjunction}{ et\nobreakspace}%
9611 \renewcommand{\crefmiddlegroupconjunction}{, }%
9612 \renewcommand{\creflastgroupconjunction}{ et\nobreakspace}%
9613 %
9614 \Crefname{equation}{{\'E}quation}{{\'E}quations}%
9615 \Crefname{figure}{Figure}{Figures}%
9616 \Crefname{subfigure}{Figure}{Figures}%
9617 \Crefname{table}{Tableau}{Tableaux}%
9618 \Crefname{subtable}{Tableau}{Tableaux}%
9619 \Crefname{page}{Page}{Pages}%
9620 \Crefname{part}{Partie}{Parties}%
9621 \Crefname{chapter}{Chapitre}{Chapitres}%
9622 \Crefname{section}{Section}{Sections}%
9623 \Crefname{subsection}{Section}{Sections}%
9624 \Crefname{subsubsection}{Section}{Sections}%
9625 \Crefname{appendix}{Annexe}{Annexes}%
9626 \Crefname{subappendix}{Annexe}{Annexes}%
9627 \Crefname{subsubappendix}{Annexe}{Annexes}%
9628 \Crefname{subsubsubappendix}{Annexe}{Annexes}%
9629 \Crefname{enumi}{Point}{Points}%
9630 \Crefname{enumii}{Point}{Points}%
9631 \Crefname{enumiii}{Point}{Points}%
9632 \Crefname{enumiv}{Point}{Points}%
9633 \Crefname{enumv}{Point}{Points}%
9634 \Crefname{footnote}{Note}{Notes}%
9635 \Crefname{theorem}{Th\'eor\`eme}{Th\'eor\`emes}%
9636 \Crefname{lemma}{Lemme}{Lemmes}%
9637 \Crefname{corollary}{Corollaire}{Corollaires}%
9638 \Crefname{proposition}{Proposition}{Propositions}%
9639 \Crefname{definition}{D\'efinition}{D\'efinitions}%
9640 \Crefname{result}{R\'esultat}{R\'esultats}%
9641 \Crefname{example}{Exemple}{Exemples}%
9642 \Crefname{remark}{Remarque}{Remarques}%
9643 \Crefname{note}{Commentaire}{Commentaires}%
9644 \Crefname{algorithm}{Algorithme}{Algorithmes}%
9645 \Crefname{listing}{Liste}{Listes}%
9646 \Crefname{line}{Ligne}{Lignes}%
9647 %
9648 \if@cref@capitalise% capitalise set
9649 \crefname{equation}{{\'E}quation}{{\'E}quations}%
9650 \crefname{figure}{Figure}{Figures}%
9651 \crefname{subfigure}{Figure}{Figures}%
9652 \crefname{table}{Tableau}{Tableaux}%
9653 \crefname{subtable}{Tableau}{Tableaux}%
9654 \crefname{page}{Page}{Pages}%
9655 \crefname{part}{Partie}{Parties}%
9656 \crefname{chapter}{Chapitre}{Chapitres}%
9657 \crefname{section}{Section}{Sections}%
9658 \crefname{subsection}{Section}{Sections}%
9659 \crefname{subsubsection}{Section}{Sections}%
9660 \crefname{appendix}{Annexe}{Annexes}%
9661 \crefname{subappendix}{Annexe}{Annexes}%
9662 \crefname{subsubappendix}{Annexe}{Annexes}%
9663 \crefname{subsubsubappendix}{Annexe}{Annexes}%
9664 \crefname{enumi}{Point}{Points}%
9665 \crefname{enumii}{Point}{Points}%
9666 \crefname{enumiii}{Point}{Points}%
9667 \crefname{enumiv}{Point}{Points}%
9668 \crefname{enumv}{Point}{Points}%
9669 \crefname{footnote}{Note}{Notes}%
9670 \crefname{theorem}{Th\'eor\`eme}{Th\'eor\`emes}%
9671 \crefname{lemma}{Lemme}{Lemmes}%
9672 \crefname{corollary}{Corollaire}{Corollaires}%
9673 \crefname{proposition}{Proposition}{Propositions}%
9674 \crefname{definition}{D\'efinition}{D\'efinitions}%
9675 \crefname{result}{R\'esultat}{R\'esultats}%
9676 \crefname{example}{Exemple}{Exemples}%
9677 \crefname{remark}{Remarque}{Remarques}%
9678 \crefname{note}{Commentaire}{Commentaires}%
9679 \crefname{algorithm}{Algorithme}{Algorithmes}%
9680 \crefname{listing}{Liste}{Listes}%
9681 \crefname{line}{Ligne}{Lignes}%
9682 %
9683 \else% capitalise unset
9684 \crefname{equation}{{\'e}quation}{{\'e}quations}%
9685 \crefname{figure}{figure}{figures}%
9686 \crefname{subfigure}{figure}{figures}%
9687 \crefname{table}{tableau}{tableaux}%
9688 \crefname{subtable}{tableau}{tableaux}%
9689 \crefname{page}{page}{pages}%
9690 \crefname{part}{partie}{parties}%
9691 \crefname{chapter}{chapitre}{chapitres}%
9692 \crefname{section}{section}{sections}%
9693 \crefname{subsection}{section}{sections}%
9694 \crefname{subsubsection}{section}{sections}%
9695 \crefname{appendix}{annexe}{annexes}%
9696 \crefname{subappendix}{annexe}{annexes}%
9697 \crefname{subsubappendix}{annexe}{annexes}%
9698 \crefname{subsubsubappendix}{annexe}{annexes}%
9699 \crefname{enumi}{point}{points}%
9700 \crefname{enumii}{point}{points}%
9701 \crefname{enumiii}{point}{points}%
9702 \crefname{enumiv}{point}{points}%
9703 \crefname{enumv}{point}{points}%
9704 \crefname{footnote}{note}{notes}%
9705 \crefname{theorem}{th\'eor\`eme}{th\'eor\`emes}%
9706 \crefname{lemma}{lemme}{lemmes}%
9707 \crefname{corollary}{corollaire}{corollaires}%
9708 \crefname{proposition}{proposition}{propositions}%
9709 \crefname{definition}{d\'efinition}{d\'efinitions}%
9710 \crefname{result}{r\'esultat}{r\'esultats}%
9711 \crefname{example}{exemple}{exemples}%
9712 \crefname{remark}{remarque}{remarques}%
9713 \crefname{note}{commentaire}{commentaires}%
9714 \crefname{algorithm}{algorithme}{algorithmes}%
9715 \crefname{listing}{liste}{listes}%
9716 \crefname{line}{ligne}{lignes}%
9717 \fi}% end \cref@loadlanguagedefs
9718 % \end{macrocode}
9719 %
9720 %
9721 % \subsubsection{Spanish}
9722 % \begin{macro}{spanish}
9723 % Spanish translations generously contributed by Gonzalo Medina.
9724 % \end{macro}
9725 %
9726 % Set up the definitions used at the beginning of the document to define
9727 % the formats created by the document preamble.
9728 % \begin{macrocode}
9729 \DeclareOption{spanish}{%
9730 \AtBeginDocument{%
9731 \def\crefrangeconjunction@preamble{ a\nobreakspace}%
9732 \def\crefrangepreconjunction@preamble{}%
9733 \def\crefrangepostconjunction@preamble{}%
9734 \def\crefpairconjunction@preamble{ y\nobreakspace}%
9735 \def\crefmiddleconjunction@preamble{, }%
9736 \def\creflastconjunction@preamble{ y\nobreakspace}%
9737 \def\crefpairgroupconjunction@preamble{ y\nobreakspace}%
9738 \def\crefmiddlegroupconjunction@preamble{, }%
9739 \def\creflastgroupconjunction@preamble{ y\nobreakspace}%
9740 %
9741 \Crefname@preamble{equation}{Ecuaci\'on}{Ecuaciones}%
9742 \Crefname@preamble{figure}{Figura}{Figuras}%
9743 \Crefname@preamble{table}{Cuadro}{Cuadros}%
9744 \Crefname@preamble{page}{P\'agina}{P\'aginas}%
9745 \Crefname@preamble{part}{Parte}{Partes}%
9746 \Crefname@preamble{chapter}{Cap\'itulo}{Cap\'itulos}%
9747 \Crefname@preamble{section}{Apartado}{Apartados}%
9748 \Crefname@preamble{appendix}{Ap\'endice}{Ap\'endices}%
9749 \Crefname@preamble{enumi}{Punto}{Puntos}%
9750 \Crefname@preamble{footnote}{Nota}{Notas}%
9751 \Crefname@preamble{theorem}{Teorema}{Teoremas}%
9752 \Crefname@preamble{lemma}{Lema}{Lemas}%
9753 \Crefname@preamble{corollary}{Corolario}{Corolarios}%
9754 \Crefname@preamble{proposition}{Proposici\'on}{Proposiciones}%
9755 \Crefname@preamble{definition}{Definici\'on}{Definiciones}%
9756 \Crefname@preamble{result}{Resultado}{Resultados}%
9757 \Crefname@preamble{example}{Ejemplo}{Ejemplos}%
9758 \Crefname@preamble{remark}{Observaci\'on}{Observaciones}%
9759 \Crefname@preamble{note}{Nota}{Notas}%
9760 \Crefname@preamble{algorithm}{Algoritmo}{Algoritmos}%
9761 \Crefname@preamble{listing}{Listado}{Listados}%
9762 \Crefname@preamble{line}{L\'inea}{L\'ineas}%
9763 %
9764 \if@cref@capitalise% capitalise set
9765 \crefname@preamble{equation}{Ecuaci\'on}{Ecuaciones}%
9766 \crefname@preamble{figure}{Figura}{Figuras}%
9767 \crefname@preamble{table}{Cuadro}{Cuadros}%
9768 \crefname@preamble{page}{P\'agina}{P\'aginas}%
9769 \crefname@preamble{part}{Parte}{Partes}%
9770 \crefname@preamble{chapter}{Cap\'itulo}{Cap\'itulos}%
9771 \crefname@preamble{section}{Apartado}{Apartados}%
9772 \crefname@preamble{appendix}{Ap\'endice}{Ap\'endices}%
9773 \crefname@preamble{enumi}{Punto}{Puntos}%
9774 \crefname@preamble{footnote}{Nota}{Notas}%
9775 \crefname@preamble{theorem}{Teorema}{Teoremas}%
9776 \crefname@preamble{lemma}{Lema}{Lemas}%
9777 \crefname@preamble{corollary}{Corolario}{Corolarios}%
9778 \crefname@preamble{proposition}{Proposici\'on}{Proposiciones}%
9779 \crefname@preamble{definition}{Definici\'on}{Definiciones}%
9780 \crefname@preamble{result}{Resultado}{Resultados}%
9781 \crefname@preamble{example}{Ejemplo}{Ejemplos}%
9782 \crefname@preamble{remark}{Observaci\'on}{Observaciones}%
9783 \crefname@preamble{note}{Nota}{Notas}%
9784 \crefname@preamble{algorithm}{Algoritmo}{Algoritmos}%
9785 \crefname@preamble{listing}{Listado}{Listados}%
9786 \crefname@preamble{line}{L\'inea}{L\'ineas}%
9787 %
9788 \else% capitalise unset
9789 \crefname@preamble{equation}{ecuaci\'on}{ecuaciones}%
9790 \crefname@preamble{figure}{figura}{figuras}%
9791 \crefname@preamble{table}{cuadro}{cuadros}%
9792 \crefname@preamble{page}{p\'agina}{p\'aginas}%
9793 \crefname@preamble{part}{parte}{partes}%
9794 \crefname@preamble{chapter}{cap\'itulo}{cap\'itulos}%
9795 \crefname@preamble{section}{apartado}{apartados}%
9796 \crefname@preamble{appendix}{ap\'endice}{ap\'endices}%
9797 \crefname@preamble{enumi}{punto}{puntos}%
9798 \crefname@preamble{footnote}{nota}{notas}%
9799 \crefname@preamble{theorem}{teorema}{teoremas}%
9800 \crefname@preamble{lemma}{lema}{lemas}%
9801 \crefname@preamble{corollary}{corolario}{corolarios}%
9802 \crefname@preamble{proposition}{proposici\'on}{proposiciones}%
9803 \crefname@preamble{definition}{definici\'on}{definiciones}%
9804 \crefname@preamble{result}{resultado}{resultados}%
9805 \crefname@preamble{example}{ejemplo}{ejemplos}%
9806 \crefname@preamble{remark}{observaci\'on}{observaciones}%
9807 \crefname@preamble{note}{nota}{notas}%
9808 \crefname@preamble{algorithm}{algoritmo}{algoritmos}%
9809 \crefname@preamble{listing}{listado}{listados}%
9810 \crefname@preamble{line}{l\'inea}{l\'ineas}%
9811 \fi%
9812 \def\cref@language{spanish}%
9813 }}% end \DeclareOption and \AtBeginDocument
9814 % \end{macrocode}
9815 %
9816 % If using \package{babel} and the corresponding option is set, or if
9817 % using \package{polyglossia} and the language has been loaded, add
9818 % format definition commands to \cmd{\extras}\meta{language} or
9819 % \cmd{\captions}\meta{language} so that language switching commands will
9820 % change the cross-reference formats appropriately.
9821 % \begin{macrocode}
9822 \cref@addlanguagedefs{spanish}{%
9823 \PackageInfo{cleveref}{loaded `spanish' language definitions}%
9824 \renewcommand{\crefrangeconjunction}{ a\nobreakspace}%
9825 \renewcommand{\crefrangepreconjunction}{}%
9826 \renewcommand{\crefrangepostconjunction}{}%
9827 \renewcommand{\crefpairconjunction}{ y\nobreakspace}%
9828 \renewcommand{\crefmiddleconjunction}{, }%
9829 \renewcommand{\creflastconjunction}{ y\nobreakspace}%
9830 \renewcommand{\crefpairgroupconjunction}{ y\nobreakspace}%
9831 \renewcommand{\crefmiddlegroupconjunction}{, }%
9832 \renewcommand{\creflastgroupconjunction}{ y\nobreakspace}%
9833 %
9834 \Crefname{equation}{Ecuaci\'on}{Ecuaciones}%
9835 \Crefname{figure}{Figura}{Figuras}%
9836 \Crefname{subfigure}{Figura}{Figuras}%
9837 \Crefname{table}{Cuadro}{Cuadros}%
9838 \Crefname{subtable}{Cuadro}{Cuadros}%
9839 \Crefname{page}{P\'agina}{P\'aginas}%
9840 \Crefname{part}{Parte}{Partes}%
9841 \Crefname{chapter}{Cap\'itulo}{Cap\'itulos}%
9842 \Crefname{section}{Apartado}{Apartados}%
9843 \Crefname{subsection}{Apartado}{Apartados}%
9844 \Crefname{subsubsection}{Apartado}{Apartados}%
9845 \Crefname{appendix}{Ap\'endice}{Ap\'endices}%
9846 \Crefname{subappendix}{Ap\'endice}{Ap\'endices}%
9847 \Crefname{subsubappendix}{Ap\'endice}{Ap\'endices}%
9848 \Crefname{subsubsubappendix}{Ap\'endice}{Ap\'endices}%
9849 \Crefname{enumi}{Punto}{Puntos}%
9850 \Crefname{enumii}{Punto}{Puntos}%
9851 \Crefname{enumiii}{Punto}{Puntos}%
9852 \Crefname{enumiv}{Punto}{Puntos}%
9853 \Crefname{enumv}{Punto}{Puntos}%
9854 \Crefname{footnote}{Nota}{Notas}%
9855 \Crefname{theorem}{Teorema}{Teoremas}%
9856 \Crefname{lemma}{Lema}{Lemas}%
9857 \Crefname{corollary}{Corolario}{Corolarios}%
9858 \Crefname{proposition}{Proposici\'on}{Proposiciones}%
9859 \Crefname{definition}{Definici\'on}{Definiciones}%
9860 \Crefname{result}{Resultado}{Resultados}%
9861 \Crefname{example}{Ejemplo}{Ejemplos}%
9862 \Crefname{remark}{Observaci\'on}{Observaci\'on}%
9863 \Crefname{note}{Nota}{Notas}%
9864 \Crefname{algorithm}{Algoritmo}{Algoritmos}%
9865 \Crefname{listing}{Listado}{Listados}%
9866 \Crefname{line}{L\'inea}{L\'ineas}%
9867 %
9868 \if@cref@capitalise% capitalise set
9869 \crefname{equation}{Ecuaci\'on}{Ecuaciones}%
9870 \crefname{figure}{Figura}{Figuras}%
9871 \crefname{subfigure}{Figura}{Figuras}%
9872 \crefname{table}{Cuadro}{Cuadros}%
9873 \crefname{subtable}{Cuadro}{Cuadros}%
9874 \crefname{page}{P\'agina}{P\'aginas}%
9875 \crefname{part}{Parte}{Partes}%
9876 \crefname{chapter}{Cap\'itulo}{Cap\'itulos}%
9877 \crefname{section}{Apartado}{Apartados}%
9878 \crefname{subsection}{Apartado}{Apartados}%
9879 \crefname{subsubsection}{Apartado}{Apartados}%
9880 \crefname{appendix}{Ap\'endice}{Ap\'endices}%
9881 \crefname{subappendix}{Ap\'endice}{Ap\'endices}%
9882 \crefname{subsubappendix}{Ap\'endice}{Ap\'endices}%
9883 \crefname{subsubsubappendix}{Ap\'endice}{Ap\'endices}%
9884 \crefname{enumi}{Punto}{Puntos}%
9885 \crefname{enumii}{Punto}{Puntos}%
9886 \crefname{enumiii}{Punto}{Puntos}%
9887 \crefname{enumiv}{Punto}{Puntos}%
9888 \crefname{enumv}{Punto}{Puntos}%
9889 \crefname{footnote}{Nota}{Notas}%
9890 \crefname{theorem}{Teorema}{Teoremas}%
9891 \crefname{lemma}{Lema}{Lemas}%
9892 \crefname{corollary}{Corolario}{Corolarios}%
9893 \crefname{proposition}{Proposici\'on}{Proposiciones}%
9894 \crefname{definition}{Definici\'on}{Definiciones}%
9895 \crefname{result}{Resultado}{Resultados}%
9896 \crefname{example}{Ejemplo}{Ejemplos}%
9897 \crefname{remark}{Observaci\'on}{Observaci\'ones}%
9898 \crefname{note}{Nota}{Notas}%
9899 \crefname{algorithm}{Algoritmo}{Algoritmos}%
9900 \crefname{listing}{Listado}{Listados}%
9901 \crefname{line}{L\'inea}{L\'ineas}%
9902 %
9903 \else% capitalise unset
9904 \crefname{equation}{ecuaci\'on}{ecuaciones}%
9905 \crefname{figure}{figura}{figuras}%
9906 \crefname{subfigure}{figura}{figuras}%
9907 \crefname{table}{cuadro}{cuadros}%
9908 \crefname{subtable}{cuadro}{cuadros}%
9909 \crefname{page}{p\'agina}{p\'aginas}%
9910 \crefname{part}{parte}{partes}%
9911 \crefname{chapter}{cap\'itulo}{cap\'itulos}%
9912 \crefname{section}{apartado}{apartados}%
9913 \crefname{subsection}{apartado}{apartados}%
9914 \crefname{subsubsection}{apartado}{apartados}%
9915 \crefname{appendix}{ap\'endice}{ap\'endices}%
9916 \crefname{subappendix}{ap\'endice}{ap\'endices}%
9917 \crefname{subsubappendix}{ap\'endice}{ap\'endices}%
9918 \crefname{subsubsubappendix}{ap\'endice}{ap\'endices}%
9919 \crefname{enumi}{punto}{puntos}%
9920 \crefname{enumii}{punto}{puntos}%
9921 \crefname{enumiii}{punto}{puntos}%
9922 \crefname{enumiv}{punto}{puntos}%
9923 \crefname{enumv}{punto}{puntos}%
9924 \crefname{footnote}{nota}{notas}%
9925 \crefname{theorem}{teorema}{teoremas}%
9926 \crefname{lemma}{lema}{lemas}%
9927 \crefname{corollary}{corolario}{corolarios}%
9928 \crefname{proposition}{proposici\'on}{proposiciones}%
9929 \crefname{definition}{definici\'on}{definiciones}%
9930 \crefname{result}{resultado}{resultados}%
9931 \crefname{example}{ejemplo}{ejemplos}%
9932 \crefname{remark}{observaci\'on}{observaci\'ones}%
9933 \crefname{note}{nota}{notas}%
9934 \crefname{algorithm}{algoritmo}{algoritmos}%
9935 \crefname{listing}{listado}{listados}%
9936 \crefname{line}{l\'inea}{l\'ineas}%
9937 \fi}% end \cref@loadlanguagedefs
9938 % \end{macrocode}
9939 %
9940 %
9941 % \subsubsection{Italian}
9942 % \begin{macro}{italian}
9943 % Italian translations kindly contributed by Massimo Redaelli.
9944 % \end{macro}
9945 %
9946 % Set up the definitions used at the beginning of the document to define
9947 % the formats created by the document preamble.
9948 % \begin{macrocode}
9949 \DeclareOption{italian}{%
9950 \AtBeginDocument{%
9951 \def\crefrangeconjunction@preamble{ a\nobreakspace}%
9952 \def\crefrangepreconjunction@preamble{da\nobreakspace}%
9953 \def\crefrangepostconjunction@preamble{}%
9954 \def\crefpairconjunction@preamble{ e\nobreakspace}%
9955 \def\crefmiddleconjunction@preamble{, }%
9956 \def\creflastconjunction@preamble{ e\nobreakspace}%
9957 % \end{macrocode}
9958 % We have to define the group conjunctions explicitly here, rather than
9959 % relying on fall-back definitions in terms of the above conjunctions
9960 % (see \cref{sec:code:default_formats}), in case any other language
9961 % option defines them explicitly and we need to override those.
9962 % \begin{macrocode}
9963 \def\crefpairgroupconjunction@preamble{ e\nobreakspace}%
9964 \def\crefmiddlegroupconjunction@preamble{, }%
9965 \def\creflastgroupconjunction@preamble{ e\nobreakspace}%
9966 %
9967 \Crefname@preamble{equation}{Equazione}{Equazioni}%
9968 \Crefname@preamble{figure}{Figura}{Figure}%
9969 \Crefname@preamble{table}{Tabella}{Tabelle}%
9970 \Crefname@preamble{page}{Pagina}{Pagine}%
9971 \Crefname@preamble{part}{Parte}{Parti}%
9972 \Crefname@preamble{chapter}{Capitolo}{Capitoli}%
9973 \Crefname@preamble{section}{Sezione}{Sezioni}%
9974 \Crefname@preamble{appendix}{Appendice}{Appendici}%
9975 \Crefname@preamble{enumi}{Voce}{Voci}%
9976 \Crefname@preamble{footnote}{Nota}{Note}%
9977 \Crefname@preamble{theorem}{Teorema}{Teoremi}%
9978 \Crefname@preamble{lemma}{Lemma}{Lemmi}%
9979 \Crefname@preamble{corollary}{Corollario}{Corollari}%
9980 \Crefname@preamble{proposition}{Proposizione}{Proposizioni}%
9981 \Crefname@preamble{definition}{Definizioni}{Definizioni}%
9982 \Crefname@preamble{result}{Risultato}{Risultati}%
9983 \Crefname@preamble{example}{esempio}{esempi}%
9984 \Crefname@preamble{remark}{Osservazione}{Osservazioni}%
9985 \Crefname@preamble{note}{Nota}{Note}%
9986 \Crefname@preamble{algorithm}{Algoritmo}{Algoritmi}%
9987 \Crefname@preamble{listing}{Elenco}{Elenchi}%
9988 \Crefname@preamble{line}{Linea}{Linee}%
9989 %
9990 \if@cref@capitalise% capitalise set
9991 \if@cref@abbrev%
9992 \crefname@preamble{equation}{Eq.}{Eq.}%
9993 \crefname@preamble{figure}{Fig.}{Fig.}%
9994 \else%
9995 \crefname@preamble{equation}{Equazione}{Equazioni}%
9996 \crefname@preamble{figure}{Figura}{Figure}%
9997 \fi%
9998 \crefname@preamble{table}{Tabella}{Tabelle}%
9999 \crefname@preamble{page}{Pagina}{Pagine}%
10000 \crefname@preamble{part}{Parte}{Parti}%
10001 \crefname@preamble{chapter}{Capitolo}{Capitoli}%
10002 \crefname@preamble{section}{Sezione}{Sezioni}%
10003 \crefname@preamble{appendix}{Appendice}{Appendici}%
10004 \crefname@preamble{enumi}{Voce}{Voci}%
10005 \crefname@preamble{footnote}{Nota}{Note}%
10006 \crefname@preamble{theorem}{Teorema}{Teoremi}%
10007 \crefname@preamble{lemma}{Lemma}{Lemmi}%
10008 \crefname@preamble{corollary}{Corollario}{Corollari}%
10009 \crefname@preamble{proposition}{Proposizione}{Proposizioni}%
10010 \crefname@preamble{definition}{Definizione}{Definizioni}%
10011 \crefname@preamble{result}{Risultato}{Risultati}%
10012 \crefname@preamble{example}{Esempio}{Esempi}%
10013 \crefname@preamble{remark}{Osservazione}{Osservazioni}%
10014 \crefname@preamble{note}{Nota}{Note}%
10015 \crefname@preamble{algorithm}{Algoritmo}{Algoritmi}%
10016 \crefname@preamble{listing}{Elenco}{Elenchi}%
10017 \crefname@preamble{line}{Linea}{Linee}%
10018 %
10019 \else% capitalise unset
10020 \if@cref@abbrev%
10021 \crefname@preamble{equation}{eq.}{eq.}%
10022 \crefname@preamble{figure}{fig.}{fig.}%
10023 \else%
10024 \crefname@preamble{equation}{equazione}{equazioni}%
10025 \crefname@preamble{figure}{figura}{figure}%
10026 \fi%
10027 \crefname@preamble{table}{tabella}{tabelle}%
10028 \crefname@preamble{page}{pagina}{pagine}%
10029 \crefname@preamble{part}{parte}{parti}%
10030 \crefname@preamble{chapter}{capitolo}{capitoli}%
10031 \crefname@preamble{section}{sezione}{sezioni}%
10032 \crefname@preamble{appendix}{appendice}{appendici}%
10033 \crefname@preamble{enumi}{voce}{voci}%
10034 \crefname@preamble{footnote}{nota}{note}%
10035 \crefname@preamble{theorem}{teorema}{teoremi}%
10036 \crefname@preamble{lemma}{lemma}{lemmi}%
10037 \crefname@preamble{corollary}{corollario}{corollari}%
10038 \crefname@preamble{proposition}{proposizione}{proposizioni}%
10039 \crefname@preamble{definition}{definizione}{definizioni}%
10040 \crefname@preamble{result}{risultato}{risultati}%
10041 \crefname@preamble{example}{esempio}{esempi}%
10042 \crefname@preamble{remark}{osservazione}{osservazioni}%
10043 \crefname@preamble{note}{nota}{note}%
10044 \crefname@preamble{algorithm}{algoritmo}{algoritmi}%
10045 \crefname@preamble{listing}{elenco}{elenchi}%
10046 \crefname@preamble{line}{linea}{linee}%
10047 \fi%
10048 \def\cref@language{italian}%
10049 }}% end \DeclareOption and \AtBeginDocument
10050 % \end{macrocode}
10051 %
10052 % If using \package{babel} and the corresponding option is set, or if
10053 % using \package{polyglossia} and the language has been loaded, add
10054 % format definition commands to \cmd{\extras}\meta{language} or
10055 % \cmd{\captions}\meta{language} so that language switching commands will
10056 % change the cross-reference formats appropriately.
10057 % \begin{macrocode}
10058 \cref@addlanguagedefs{italian}{%
10059 \PackageInfo{cleveref}{loaded `italian' language definitions}%
10060 \renewcommand{\crefrangeconjunction}{ a\nobreakspace}%
10061 \renewcommand\crefrangepreconjunction{da\nobreakspace}%
10062 \renewcommand\crefrangepostconjunction{}%
10063 \renewcommand{\crefpairconjunction}{ e\nobreakspace}%
10064 \renewcommand{\crefmiddleconjunction}{, }%
10065 \renewcommand{\creflastconjunction}{ e\nobreakspace}%
10066 \renewcommand{\crefpairgroupconjunction}{ e\nobreakspace}%
10067 \renewcommand{\crefmiddlegroupconjunction}{, }%
10068 \renewcommand{\creflastgroupconjunction}{ e\nobreakspace}%
10069 %
10070 \Crefname{equation}{Equazione}{Equazioni}%
10071 \Crefname{figure}{Figura}{Figure}%
10072 \Crefname{subfigure}{Figura}{Figure}%
10073 \Crefname{table}{Tabella}{Tabelle}%
10074 \Crefname{subtable}{Tabella}{Tabelle}%
10075 \Crefname{page}{Pagina}{Pagine}%
10076 \Crefname{part}{Parte}{Parti}%
10077 \Crefname{chapter}{Capitolo}{Capitoli}%
10078 \Crefname{section}{Sezione}{Sezioni}%
10079 \Crefname{subsection}{Sezione}{Sezioni}%
10080 \Crefname{subsubsection}{Sezione}{Sezioni}%
10081 \Crefname{appendix}{Appendice}{Appendici}%
10082 \Crefname{subappendix}{Appendice}{Appendici}%
10083 \Crefname{subsubappendix}{Appendice}{Appendici}%
10084 \Crefname{subsubsubappendix}{Appendice}{Appendici}%
10085 \Crefname{enumi}{Voce}{Voci}%
10086 \Crefname{enumii}{Voce}{Voci}%
10087 \Crefname{enumiii}{Voce}{Voci}%
10088 \Crefname{enumiv}{Voce}{Voci}%
10089 \Crefname{enumv}{Voce}{Voci}%
10090 \Crefname{footnote}{Nota}{Note}%
10091 \Crefname{theorem}{Teorema}{Teoremi}%
10092 \Crefname{lemma}{Lemma}{Lemmi}%
10093 \Crefname{corollary}{Corollario}{Corollari}%
10094 \Crefname{proposition}{Proposizione}{Proposizioni}%
10095 \Crefname{definition}{Definizione}{Definizione}%
10096 \Crefname{result}{Risultato}{Risultati}%
10097 \Crefname{example}{esempio}{esempi}%
10098 \Crefname{remark}{Osservazione}{Osservazioni}%
10099 \Crefname{note}{Nota}{Note}%
10100 \Crefname{algorithm}{Algoritmo}{Algoritmi}%
10101 \Crefname{listing}{Elenco}{Elenchi}%
10102 \Crefname{line}{Linea}{Linee}%
10103 %
10104 \if@cref@capitalise% capitalise set
10105 \if@cref@abbrev%
10106 \crefname{equation}{Eq.}{Eq.}%
10107 \crefname{figure}{Fig.}{Fig.}%
10108 \crefname{subfigure}{Fig.}{Fig.}%
10109 \else%
10110 \crefname{equation}{Equazione}{Equazioni}%
10111 \crefname{figure}{Figura}{Figure}%
10112 \crefname{figure}{Figura}{Figure}%
10113 \fi%
10114 \crefname{table}{Tabella}{Tabelle}%
10115 \crefname{page}{Pagina}{Pagine}%
10116 \crefname{subtable}{Tabella}{Tabelle}%
10117 \crefname{part}{Parte}{Parti}%
10118 \crefname{chapter}{Capitolo}{Capitoli}%
10119 \crefname{section}{Sezione}{Sezioni}%
10120 \crefname{subsection}{Sezione}{Sezioni}%
10121 \crefname{subsubsection}{Sezione}{Sezioni}%
10122 \crefname{appendix}{Appendice}{Appendici}%
10123 \crefname{subappendix}{Appendice}{Appendici}%
10124 \crefname{subsubappendix}{Appendice}{Appendici}%
10125 \crefname{subsubsubappendix}{Appendice}{Appendici}%
10126 \crefname{enumi}{Voce}{Voci}%
10127 \crefname{enumii}{Voce}{Voci}%
10128 \crefname{enumiii}{Voce}{Voci}%
10129 \crefname{enumiv}{Voce}{Voci}%
10130 \crefname{enumv}{Voce}{Voci}%
10131 \crefname{footnote}{Nota}{Note}%
10132 \crefname{theorem}{Teorema}{Teoremi}%
10133 \crefname{lemma}{Lemma}{Lemmi}%
10134 \crefname{corollary}{Corollario}{Corollari}%
10135 \crefname{proposition}{Proposizione}{Proposizioni}%
10136 \crefname{definition}{Definizione}{Definizione}%
10137 \crefname{result}{Risultato}{Risultati}%
10138 \crefname{example}{Esempio}{Esempi}%
10139 \crefname{remark}{Osservazione}{Osservazioni}%
10140 \crefname{note}{Nota}{Note}%
10141 \crefname{algorithm}{Algoritmo}{Algoritmi}%
10142 \crefname{listing}{Elenco}{Elenchi}%
10143 \crefname{line}{Linea}{Linee}%
10144 %
10145 \else% capitalise unset
10146 \if@cref@abbrev%
10147 \crefname{equation}{eq.}{eq.}%
10148 \crefname{figure}{fig.}{fig.}%
10149 \crefname{subfigure}{fig.}{fig.}%
10150 \else%
10151 \crefname{equation}{equazione}{equazioni}%
10152 \crefname{figure}{figura}{figure}%
10153 \crefname{figure}{figura}{figure}%
10154 \fi%
10155 \crefname{table}{tabella}{tabelle}%
10156 \crefname{page}{pagina}{pagine}%
10157 \crefname{subtable}{tabella}{tabelle}%
10158 \crefname{part}{parte}{parti}%
10159 \crefname{chapter}{capitolo}{capitoli}%
10160 \crefname{section}{sezione}{sezioni}%
10161 \crefname{subsection}{sezione}{sezioni}%
10162 \crefname{subsubsection}{sezione}{sezioni}%
10163 \crefname{appendix}{appendice}{appendici}%
10164 \crefname{subappendix}{appendice}{appendici}%
10165 \crefname{subsubappendix}{appendice}{appendici}%
10166 \crefname{subsubsubappendix}{appendice}{appendici}%
10167 \crefname{enumi}{voce}{voci}%
10168 \crefname{enumii}{voce}{voci}%
10169 \crefname{enumiii}{voce}{voci}%
10170 \crefname{enumiv}{voce}{voci}%
10171 \crefname{enumv}{voce}{voci}%
10172 \crefname{footnote}{nota}{note}%
10173 \crefname{theorem}{teorema}{teoremi}%
10174 \crefname{lemma}{lemma}{lemmi}%
10175 \crefname{corollary}{corollario}{corollari}%
10176 \crefname{proposition}{proposizione}{proposizioni}%
10177 \crefname{definition}{definizione}{definizione}%
10178 \crefname{result}{risultato}{risultati}%
10179 \crefname{example}{esempio}{esempi}%
10180 \crefname{remark}{osservazione}{osservazioni}%
10181 \crefname{note}{nota}{note}%
10182 \crefname{algorithm}{algoritmo}{algoritmi}%
10183 \crefname{listing}{elenco}{elenchi}%
10184 \crefname{line}{linea}{linee}%
10185 \fi}% end \cref@loadlanguagedefs
10186 % \end{macrocode}
10187 %
10188 %
10189 % \subsubsection{Russian}
10190 % \begin{macro}{russian}
10191 % Russian translations generously contributed by Aleksander Gorohovski.
10192 % \end{macro}
10193 %
10194 % Set up the definitions used at the beginning of the document to define
10195 % the formats created by the document preamble.
10196 % \begin{macrocode}
10197 \DeclareOption{russian}{%
10198 \AtBeginDocument{%
10199 \def\crefrangeconjunction@preamble{--}%
10200 \def\crefrangepreconjunction@preamble{}%
10201 \def\crefrangepostconjunction@preamble{}%
10202 \def\crefpairconjunction@preamble{ \cyri\nobreakspace}%
10203 \def\crefmiddleconjunction@preamble{, }%
10204 \def\creflastconjunction@preamble{ \cyri\nobreakspace}%
10205 % \end{macrocode}
10206 % We have to define the group conjunctions explicitly here, rather than
10207 % relying on fall-back definitions in terms of the above conjunctions
10208 % (see \cref{sec:code:default_formats}), in case any other language
10209 % option defines them explicitly and we need to override those.
10210 % \begin{macrocode}
10211 \def\crefpairgroupconjunction@preamble{ \cyri\nobreakspace}%
10212 \def\crefmiddlegroupconjunction@preamble{, }%
10213 \def\creflastgroupconjunction@preamble%
10214 {, \cyra\ \cyrt\cyra\cyrk\cyrzh\cyre\nobreakspace}%
10215 %
10216 \Crefname@preamble{equation}%
10217 {\CYRF\cyro\cyrr\cyrm\cyru\cyrl\cyra}%
10218 {\CYRF\cyro\cyrr\cyrm\cyru\cyrl\cyrery}%
10219 \Crefname@preamble{figure}%
10220 {\CYRR\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
10221 {\CYRR\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
10222 \Crefname@preamble{table}%
10223 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyra}%
10224 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrery}%
10225 \Crefname@preamble{enumi}%
10226 {\CYRP\cyru\cyrn\cyrk\cyrt}%
10227 {\CYRP\cyru\cyrn\cyrk\cyrt\cyrery}%
10228 \Crefname@preamble{chapter}%
10229 {\CYRG\cyrl\cyra\cyrv\cyra}%
10230 {\CYRG\cyrl\cyra\cyrv\cyrery}%
10231 \Crefname@preamble{section}%
10232 {\CYRR\cyra\cyrz\cyrd\cyre\cyrl}%
10233 {\CYRR\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
10234 \Crefname@preamble{appendix}%
10235 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
10236 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
10237 \Crefname@preamble{footnote}%
10238 {\CYRS\cyrn\cyro\cyrs\cyrk\cyra}%
10239 {\CYRS\cyrn\cyro\cyrs\cyrk\cyri}%
10240 \Crefname@preamble{theorem}%
10241 {\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyra}%
10242 {\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyrery}%
10243 \Crefname@preamble{lemma}%
10244 {\CYRL\cyre\cyrm\cyrm\cyra}%
10245 {\CYRL\cyre\cyrm\cyrm\cyrery}%
10246 \Crefname@preamble{corollary}%
10247 {\CYRV\cyrery\cyrv\cyro\cyrd}%
10248 {\CYRV\cyrery\cyrv\cyro\cyrd\cyrery}%
10249 \Crefname@preamble{proposition}%
10250 {\CYRU\cyrt\cyrv\cyre\cyrr\cyrzh\cyrd\cyre\cyrn\cyri\cyre}%
10251 {\CYRU\cyrt\cyrv\cyre\cyrr\cyrzh\cyrd\cyre\cyrn\cyri\cyrya}%
10252 \Crefname@preamble{definition}%
10253 {\CYRO\cyrp\cyrr\cyre\cyrd\cyre\cyrl\cyre\cyrn\cyri\cyre}%
10254 {\CYRO\cyrp\cyrr\cyre\cyrd\cyre\cyrl\cyre\cyrn\cyri\cyrya}%
10255 \Crefname@preamble{result}%
10256 {\CYRR\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt}%
10257 {\CYRR\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt\cyrery}%
10258 \Crefname@preamble{example}%
10259 {\CYRP\cyrr\cyri\cyrm\cyre\cyrr}%
10260 {\CYRP\cyrr\cyri\cyrm\cyre\cyrr\cyrery}%
10261 \Crefname@preamble{remark}%
10262 {\CYRP\cyrr\cyri\cyrm\cyre\cyrch\cyra\cyrn\cyri\cyre}%
10263 {\CYRP\cyrr\cyri\cyrm\cyre\cyrch\cyra\cyrn\cyri\cyrya}%
10264 \Crefname@preamble{note}%
10265 {\CYRZ\cyra\cyrm\cyre\cyrt\cyrk\cyra}%
10266 {\CYRZ\cyra\cyrm\cyre\cyrt\cyrk\cyri}%
10267 \Crefname@preamble{algorithm}%
10268 {\CYRA\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm}%
10269 {\CYRA\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm\cyrery}%
10270 \Crefname@preamble{listing}%
10271 {\CYRL\cyri\cyrs\cyrt\cyri\cyrn\cyrg}%
10272 {\CYRL\cyri\cyrs\cyrt\cyri\cyrn\cyrg\cyri}%
10273 \Crefname@preamble{line}%
10274 {\CYRS\cyrt\cyrr\cyro\cyrk\cyra}%
10275 {\CYRS\cyrt\cyrr\cyro\cyrk\cyri}%
10276 \Crefname@preamble{page}%
10277 {\CYRS\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
10278 {\CYRS\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyrery}%
10279 \Crefname@preamble{part}%
10280 {\CYRCH\cyra\cyrs\cyrt\cyrsftsn}%
10281 {\CYRCH\cyra\cyrs\cyrt\cyri}%
10282 %
10283 \if@cref@capitalise% capitalise set
10284 \if@cref@abbrev% abbrev set
10285 \crefname@preamble{equation}%
10286 {\CYRF-\cyrl.}%
10287 {\CYRF-\cyrl.}%
10288 \crefname@preamble{figure}%
10289 {\CYRR\cyri\cyrs.}%
10290 {\CYRR\cyri\cyrs.}%
10291 \crefname@preamble{table}%
10292 {\CYRT\cyra\cyrb\cyrl.}%
10293 {\CYRT\cyra\cyrb\cyrl.}%
10294 \crefname@preamble{enumi}%
10295 {\CYRP.}%
10296 {\CYRP.\cyrp.}%
10297 \else%
10298 \crefname@preamble{equation}%
10299 {\CYRF\cyro\cyrr\cyrm\cyru\cyrl\cyra}%
10300 {\CYRF\cyro\cyrr\cyrm\cyru\cyrl\cyrery}%
10301 \crefname@preamble{figure}%
10302 {\CYRR\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
10303 {\CYRR\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
10304 \crefname@preamble{table}%
10305 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyra}%
10306 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrery}%
10307 \crefname@preamble{enumi}%
10308 {\CYRP\cyru\cyrn\cyrk\cyrt}%
10309 {\CYRP\cyru\cyrn\cyrk\cyrt\cyrery}%
10310 \fi%
10311 \crefname@preamble{chapter}%
10312 {\CYRG\cyrl\cyra\cyrv\cyra}%
10313 {\CYRG\cyrl\cyra\cyrv\cyrery}%
10314 \crefname@preamble{section}%
10315 {\CYRR\cyra\cyrz\cyrd\cyre\cyrl}%
10316 {\CYRR\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
10317 \crefname@preamble{appendix}%
10318 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
10319 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
10320 \crefname@preamble{footnote}%
10321 {\CYRS\cyrn\cyro\cyrs\cyrk\cyra}%
10322 {\CYRS\cyrn\cyro\cyrs\cyrk\cyri}%
10323 \crefname@preamble{theorem}%
10324 {\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyra}%
10325 {\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyrery}%
10326 \crefname@preamble{lemma}%
10327 {\CYRL\cyre\cyrm\cyrm\cyra}%
10328 {\CYRL\cyre\cyrm\cyrm\cyrery}%
10329 \crefname@preamble{corollary}%
10330 {\CYRV\cyrery\cyrv\cyro\cyrd}%
10331 {\CYRV\cyrery\cyrv\cyro\cyrd\cyrery}%
10332 \crefname@preamble{proposition}%
10333 {\CYRU\cyrt\cyrv\cyre\cyrr\cyrzh\cyrd\cyre\cyrn\cyri\cyre}%
10334 {\CYRU\cyrt\cyrv\cyre\cyrr\cyrzh\cyrd\cyre\cyrn\cyri\cyrya}%
10335 \crefname@preamble{definition}%
10336 {\CYRO\cyrp\cyrr\cyre\cyrd\cyre\cyrl\cyre\cyrn\cyri\cyre}%
10337 {\CYRO\cyrp\cyrr\cyre\cyrd\cyre\cyrl\cyre\cyrn\cyri\cyrya}%
10338 \crefname@preamble{result}%
10339 {\CYRR\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt}%
10340 {\CYRR\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt\cyrery}%
10341 \crefname@preamble{example}%
10342 {\CYRP\cyrr\cyri\cyrm\cyre\cyrr}%
10343 {\CYRP\cyrr\cyri\cyrm\cyre\cyrr\cyrery}%
10344 \crefname@preamble{remark}%
10345 {\CYRP\cyrr\cyri\cyrm\cyre\cyrch\cyra\cyrn\cyri\cyre}%
10346 {\CYRP\cyrr\cyri\cyrm\cyre\cyrch\cyra\cyrn\cyri\cyrya}%
10347 \crefname@preamble{note}%
10348 {\CYRZ\cyra\cyrm\cyre\cyrt\cyrk\cyra}%
10349 {\CYRZ\cyra\cyrm\cyre\cyrt\cyrk\cyri}%
10350 \crefname@preamble{algorithm}%
10351 {\CYRA\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm}%
10352 {\CYRA\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm\cyrery}%
10353 \crefname@preamble{listing}%
10354 {\CYRL\cyri\cyrs\cyrt\cyri\cyrn\cyrg}%
10355 {\CYRL\cyri\cyrs\cyrt\cyri\cyrn\cyrg\cyri}%
10356 \crefname@preamble{line}%
10357 {\CYRS\cyrt\cyrr\cyro\cyrk\cyra}%
10358 {\CYRS\cyrt\cyrr\cyro\cyrk\cyri}%
10359 \crefname@preamble{page}%
10360 {\CYRS\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
10361 {\CYRS\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyrery}%
10362 \crefname@preamble{part}%
10363 {\CYRCH\cyra\cyrs\cyrt\cyrsftsn}%
10364 {\CYRCH\cyra\cyrs\cyrt\cyri}%
10365 %
10366 \else% capitalise unset
10367 \if@cref@abbrev% abbrev set
10368 \crefname@preamble{equation}%
10369 {\cyrf-\cyrl.}%
10370 {\cyrf-\cyrl.}%
10371 \crefname@preamble{figure}%
10372 {\cyrr\cyri\cyrs.}%
10373 {\cyrr\cyri\cyrs.}%
10374 \crefname@preamble{table}%
10375 {\cyrt\cyra\cyrb\cyrl.}%
10376 {\cyrt\cyra\cyrb\cyrl.}%
10377 \crefname@preamble{enumi}%
10378 {\cyrp.}%
10379 {\cyrp.\cyrp.}%
10380 \crefname@preamble{chapter}%
10381 {\cyrg\cyrl\cyra\cyrv.}%
10382 {\cyrg\cyrl\cyra\cyrv.}%
10383 \crefname@preamble{section}%
10384 {\cyrr\cyra\cyrz\cyrd.}%
10385 {\cyrr\cyra\cyrz\cyrd\cyre\cyrl.}%
10386 \crefname@preamble{appendix}%
10387 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh.}%
10388 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh.}%
10389 \crefname@preamble{footnote}%
10390 {\cyrs\cyrn\cyro\cyrs\cyrk.}%
10391 {\cyrs\cyrn\cyro\cyrs\cyrk.}%
10392 \crefname@preamble{theorem}%
10393 {\cyrt\cyre\cyro\cyrr\cyre\cyrm.}%
10394 {\cyrt\cyre\cyro\cyrr\cyre\cyrm.}%
10395 \crefname@preamble{lemma}%
10396 {\cyrl\cyre\cyrm\cyrm.}%
10397 {\cyrl\cyre\cyrm\cyrm.}%
10398 \crefname@preamble{corollary}%
10399 {\cyrv\cyrery\cyrv\cyro\cyrd}%
10400 {\cyrv\cyrery\cyrv\cyro\cyrd.}%
10401 \crefname@preamble{proposition}%
10402 {\cyru\cyrt\cyrv\cyre\cyrr\cyrzh\cyrd.}%
10403 {\cyru\cyrt\cyrv\cyre\cyrr\cyrzh\cyrd.}%
10404 \crefname@preamble{definition}%
10405 {\cyro\cyrp\cyrr\cyre\cyrd\cyre\cyrl\cyre\cyrn.}%
10406 {\cyro\cyrp\cyrr\cyre\cyrd\cyre\cyrl\cyre\cyrn.}%
10407 \crefname@preamble{result}%
10408 {\cyrr\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt.}%
10409 {\cyrr\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt.}%
10410 \crefname@preamble{example}%
10411 {\cyrp\cyrr\cyri\cyrm.}%
10412 {\cyrp\cyrr\cyri\cyrm\cyre\cyrr.}%
10413 \crefname@preamble{remark}%
10414 {\cyrp\cyrr\cyri\cyrm\cyre\cyrch.}%
10415 {\cyrp\cyrr\cyri\cyrm\cyre\cyrch.}%
10416 \crefname@preamble{note}%
10417 {\cyrz\cyra\cyrm\cyre\cyrt\cyrk.}%
10418 {\cyrz\cyra\cyrm\cyre\cyrt\cyrk.}%
10419 \crefname@preamble{algorithm}%
10420 {\cyra\cyrl\cyrg.}%
10421 {\cyra\cyrl\cyrg.}%
10422 \crefname@preamble{listing}%
10423 {\cyrl\cyri\cyrs\cyrt\cyri\cyrn.}%
10424 {\cyrl\cyri\cyrs\cyrt\cyri\cyrn\cyrg.}%
10425 \crefname@preamble{line}%
10426 {\cyrs\cyrt\cyrr\cyrk.}%
10427 {\cyrs\cyrt\cyrr\cyrk.}%
10428 \else% abbrev unset
10429 \crefname@preamble{equation}%
10430 {\cyrf\cyro\cyrr\cyrm\cyru\cyrl\cyra}%
10431 {\cyrf\cyro\cyrr\cyrm\cyru\cyrl\cyrery}%
10432 \crefname@preamble{figure}%
10433 {\cyrr\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
10434 {\cyrr\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
10435 \crefname@preamble{table}%
10436 {\cyrt\cyra\cyrb\cyrl\cyri\cyrc\cyra}%
10437 {\cyrt\cyra\cyrb\cyrl\cyri\cyrc\cyrery}%
10438 \crefname@preamble{enumi}%
10439 {\cyrp\cyru\cyrn\cyrk\cyrt}%
10440 {\cyrp\cyru\cyrn\cyrk\cyrt\cyrery}%
10441 \crefname@preamble{chapter}%
10442 {\cyrg\cyrl\cyra\cyrv\cyra}%
10443 {\cyrg\cyrl\cyra\cyrv\cyrery}%
10444 \crefname@preamble{section}%
10445 {\cyrr\cyra\cyrz\cyrd\cyre\cyrl}%
10446 {\cyrr\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
10447 \crefname@preamble{appendix}%
10448 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
10449 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
10450 \crefname@preamble{footnote}%
10451 {\cyrs\cyrn\cyro\cyrs\cyrk\cyra}%
10452 {\cyrs\cyrn\cyro\cyrs\cyrk\cyri}%
10453 \crefname@preamble{theorem}%
10454 {\cyrt\cyre\cyro\cyrr\cyre\cyrm\cyra}%
10455 {\cyrt\cyre\cyro\cyrr\cyre\cyrm\cyrery}%
10456 \crefname@preamble{lemma}%
10457 {\cyrl\cyre\cyrm\cyrm\cyra}%
10458 {\cyrl\cyre\cyrm\cyrm\cyrery}%
10459 \crefname@preamble{corollary}%
10460 {\cyrv\cyrery\cyrv\cyro\cyrd}%
10461 {\cyrv\cyrery\cyrv\cyro\cyrd\cyrery}%
10462 \crefname@preamble{proposition}%
10463 {\cyru\cyrt\cyrv\cyre\cyrr\cyrzh\cyrd\cyre\cyrn\cyri\cyre}%
10464 {\cyru\cyrt\cyrv\cyre\cyrr\cyrzh\cyrd\cyre\cyrn\cyri\cyrya}%
10465 \crefname@preamble{definition}%
10466 {\cyro\cyrp\cyrr\cyre\cyrd\cyre\cyrl\cyre\cyrn\cyri\cyre}%
10467 {\cyro\cyrp\cyrr\cyre\cyrd\cyre\cyrl\cyre\cyrn\cyri\cyrya}%
10468 \crefname@preamble{result}%
10469 {\cyrr\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt}%
10470 {\cyrr\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt\cyrery}%
10471 \crefname@preamble{example}%
10472 {\cyrp\cyrr\cyri\cyrm\cyre\cyrr}%
10473 {\cyrp\cyrr\cyri\cyrm\cyre\cyrr\cyrery}%
10474 \crefname@preamble{remark}%
10475 {\cyrp\cyrr\cyri\cyrm\cyre\cyrch\cyra\cyrn\cyri\cyre}%
10476 {\cyrp\cyrr\cyri\cyrm\cyre\cyrch\cyra\cyrn\cyri\cyrya}%
10477 \crefname@preamble{note}%
10478 {\cyrz\cyra\cyrm\cyre\cyrt\cyrk\cyra}%
10479 {\cyrz\cyra\cyrm\cyre\cyrt\cyrk\cyri}%
10480 \crefname@preamble{algorithm}%
10481 {\cyra\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm}%
10482 {\cyra\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm\cyrery}%
10483 \crefname@preamble{listing}%
10484 {\cyrl\cyri\cyrs\cyrt\cyri\cyrn\cyrg}%
10485 {\cyrl\cyri\cyrs\cyrt\cyri\cyrn\cyrg\cyri}%
10486 \crefname@preamble{line}%
10487 {\cyrs\cyrt\cyrr\cyro\cyrk\cyra}%
10488 {\cyrs\cyrt\cyrr\cyro\cyrk\cyri}%
10489 \fi%
10490 \crefname@preamble{page}%
10491 {\cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyre}%
10492 {\cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra\cyrh}%
10493 \crefname@preamble{part}%
10494 {\cyrch\cyra\cyrs\cyrt\cyrsftsn}%
10495 {\cyrch\cyra\cyrs\cyrt\cyri}%
10496 \fi%
10497 \def\cref@language{russian}%
10498 }}% end \DeclareOption and \AtBeginDocument
10499 % \end{macrocode}
10500 %
10501 % If using \package{babel} and the corresponding option is set, or if
10502 % using \package{polyglossia} and the language has been loaded, add
10503 % format definition commands to \cmd{\extras}\meta{language} or
10504 % \cmd{\captions}\meta{language} so that language switching commands will
10505 % change the cross-reference formats appropriately.
10506 % \begin{macrocode}
10507 \cref@addlanguagedefs{russian}{%
10508 \PackageInfo{cleveref}{loaded `russian' language definitions}%
10509 \renewcommand{\crefrangeconjunction}{--}%
10510 \renewcommand\crefrangepreconjunction{}%
10511 \renewcommand\crefrangepostconjunction{}%
10512 \renewcommand{\crefpairconjunction}{ \cyri\nobreakspace}%
10513 \renewcommand{\crefmiddleconjunction}{, }%
10514 \renewcommand{\creflastconjunction}{ \cyri\nobreakspace}%
10515 \renewcommand{\crefpairgroupconjunction}{ \cyri\nobreakspace}%
10516 \renewcommand{\crefmiddlegroupconjunction}{, }%
10517 \renewcommand{\creflastgroupconjunction}%
10518 {, \cyra\ \cyrt\cyra\cyrk\cyrzh\cyre\nobreakspace}%
10519 %
10520 \Crefname{page}%
10521 {\CYRS\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
10522 {\CYRS\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyrery}%
10523 \Crefname{equation}%
10524 {\CYRF\cyro\cyrr\cyrm\cyru\cyrl\cyra}%
10525 {\CYRF\cyro\cyrr\cyrm\cyru\cyrl\cyrery}%
10526 \Crefname{figure}%
10527 {\CYRR\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
10528 {\CYRR\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
10529 \Crefname{subfigure}%
10530 {\CYRR\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
10531 {\CYRR\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
10532 \Crefname{table}%
10533 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyra}%
10534 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrery}%
10535 \Crefname{subtable}%
10536 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyra}%
10537 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrery}%
10538 \Crefname{part}%
10539 {\CYRCH\cyra\cyrs\cyrt\cyrsftsn}%
10540 {\CYRCH\cyra\cyrs\cyrt\cyri}%
10541 \Crefname{chapter}%
10542 {\CYRG\cyrl\cyra\cyrv\cyra}%
10543 {\CYRG\cyrl\cyra\cyrv\cyrery}%
10544 \Crefname{section}%
10545 {\CYRR\cyra\cyrz\cyrd\cyre\cyrl}%
10546 {\CYRR\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
10547 \Crefname{subsection}%
10548 {\CYRR\cyra\cyrz\cyrd\cyre\cyrl}%
10549 {\CYRR\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
10550 \Crefname{subsubsection}%
10551 {\CYRR\cyra\cyrz\cyrd\cyre\cyrl}%
10552 {\CYRR\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
10553 \Crefname{appendix}%
10554 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
10555 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
10556 \Crefname{subappendix}%
10557 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
10558 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
10559 \Crefname{subsubappendix}%
10560 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
10561 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
10562 \Crefname{subsubsubappendix}%
10563 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
10564 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
10565 \Crefname{enumi}%
10566 {\CYRP\cyru\cyrn\cyrk\cyrt}%
10567 {\CYRP\cyru\cyrn\cyrk\cyrt\cyrery}%
10568 \Crefname{enumii}%
10569 {\CYRP\cyru\cyrn\cyrk\cyrt}%
10570 {\CYRP\cyru\cyrn\cyrk\cyrt\cyrery}%
10571 \Crefname{enumiii}%
10572 {\CYRP\cyru\cyrn\cyrk\cyrt}%
10573 {\CYRP\cyru\cyrn\cyrk\cyrt\cyrery}%
10574 \Crefname{enumiv}%
10575 {\CYRP\cyru\cyrn\cyrk\cyrt}%
10576 {\CYRP\cyru\cyrn\cyrk\cyrt\cyrery}%
10577 \Crefname{enumv}%
10578 {\CYRP\cyru\cyrn\cyrk\cyrt}%
10579 {\CYRP\cyru\cyrn\cyrk\cyrt\cyrery}%
10580 \Crefname{footnote}%
10581 {\CYRS\cyrn\cyro\cyrs\cyrk\cyra}%
10582 {\CYRS\cyrn\cyro\cyrs\cyrk\cyri}%
10583 \Crefname{theorem}%
10584 {\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyra}%
10585 {\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyrery}%
10586 \Crefname{lemma}%
10587 {\CYRL\cyre\cyrm\cyrm\cyra}%
10588 {\CYRL\cyre\cyrm\cyrm\cyrery}%
10589 \Crefname{corollary}%
10590 {\CYRV\cyrery\cyrv\cyro\cyrd}%
10591 {\CYRV\cyrery\cyrv\cyro\cyrd\cyrery}%
10592 \Crefname{proposition}%
10593 {\CYRU\cyrt\cyrv\cyre\cyrr\cyrzh\cyrd\cyre\cyrn\cyri\cyre}%
10594 {\CYRU\cyrt\cyrv\cyre\cyrr\cyrzh\cyrd\cyre\cyrn\cyri\cyrya}%
10595 \Crefname{definition}%
10596 {\CYRO\cyrp\cyrr\cyre\cyrd\cyre\cyrl\cyre\cyrn\cyri\cyre}%
10597 {\CYRO\cyrp\cyrr\cyre\cyrd\cyre\cyrl\cyre\cyrn\cyri\cyrya}%
10598 \Crefname{result}%
10599 {\CYRR\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt}%
10600 {\CYRR\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt\cyrery}%
10601 \Crefname{example}%
10602 {\CYRP\cyrr\cyri\cyrm\cyre\cyrr}%
10603 {\CYRP\cyrr\cyri\cyrm\cyre\cyrr\cyrery}%
10604 \Crefname{remark}%
10605 {\CYRP\cyrr\cyri\cyrm\cyre\cyrch\cyra\cyrn\cyri\cyre}%
10606 {\CYRP\cyrr\cyri\cyrm\cyre\cyrch\cyra\cyrn\cyri\cyrya}%
10607 \Crefname{note}%
10608 {\CYRZ\cyra\cyrm\cyre\cyrt\cyrk\cyra}%
10609 {\CYRZ\cyra\cyrm\cyre\cyrt\cyrk\cyri}%
10610 \Crefname{algorithm}%
10611 {\CYRA\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm}%
10612 {\CYRA\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm\cyrery}%
10613 \Crefname{listing}%
10614 {\CYRL\cyri\cyrs\cyrt\cyri\cyrn\cyrg}%
10615 {\CYRL\cyri\cyrs\cyrt\cyri\cyrn\cyrg\cyri}%
10616 \Crefname{line}%
10617 {\CYRS\cyrt\cyrr\cyro\cyrk\cyra}%
10618 {\CYRS\cyrt\cyrr\cyro\cyrk\cyri}%
10619 %
10620 \if@cref@capitalise% capitalise set
10621 \if@cref@abbrev% abbrev set
10622 \crefname{equation}%
10623 {\CYRF-\cyrl.}%
10624 {\CYRF-\cyrl.}%
10625 \crefname{figure}%
10626 {\CYRR\cyri\cyrs.}%
10627 {\CYRR\cyri\cyrs.}%
10628 \crefname{subfigure}%
10629 {\CYRR\cyri\cyrs.}%
10630 {\CYRR\cyri\cyrs.}%
10631 \crefname{table}%
10632 {\CYRT\cyra\cyrb\cyrl.}%
10633 {\CYRT\cyra\cyrb\cyrl.}%
10634 \crefname{subtable}%
10635 {\CYRT\cyra\cyrb\cyrl.}%
10636 {\CYRT\cyra\cyrb\cyrl.}%
10637 \crefname{enumi}%
10638 {\CYRP.}%
10639 {\CYRP.\cyrp.}%
10640 \crefname{enumii}%
10641 {\CYRP.}%
10642 {\CYRP.\cyrp.}%
10643 \crefname{enumiii}%
10644 {\CYRP.}%
10645 {\CYRP.\cyrp.}%
10646 \crefname{enumiv}%
10647 {\CYRP.}%
10648 {\CYRP.\cyrp.}%
10649 \crefname{enumv}%
10650 {\CYRP.}%
10651 {\CYRP.\cyrp.}%
10652 \else% abbrev unset
10653 \crefname{equation}%
10654 {\CYRF\cyro\cyrr\cyrm\cyru\cyrl\cyra}%
10655 {\CYRF\cyro\cyrr\cyrm\cyru\cyrl\cyrery}%
10656 \crefname{figure}%
10657 {\CYRR\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
10658 {\CYRR\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
10659 \crefname{subfigure}%
10660 {\CYRR\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
10661 {\CYRR\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
10662 \crefname{table}%
10663 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyra}%
10664 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrery}%
10665 \crefname{subtable}%
10666 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyra}%
10667 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrery}%
10668 \crefname{enumi}%
10669 {\CYRP\cyru\cyrn\cyrk\cyrt}%
10670 {\CYRP\cyru\cyrn\cyrk\cyrt\cyrery}%
10671 \crefname{enumii}%
10672 {\CYRP\cyru\cyrn\cyrk\cyrt}%
10673 {\CYRP\cyru\cyrn\cyrk\cyrt\cyrery}%
10674 \crefname{enumiii}%
10675 {\CYRP\cyru\cyrn\cyrk\cyrt}%
10676 {\CYRP\cyru\cyrn\cyrk\cyrt\cyrery}%
10677 \crefname{enumiv}%
10678 {\CYRP\cyru\cyrn\cyrk\cyrt}%
10679 {\CYRP\cyru\cyrn\cyrk\cyrt\cyrery}%
10680 \crefname{enumv}%
10681 {\CYRP\cyru\cyrn\cyrk\cyrt}%
10682 {\CYRP\cyru\cyrn\cyrk\cyrt\cyrery}%
10683 \fi%
10684 \crefname{page}%
10685 {\CYRS\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
10686 {\CYRS\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyrery}%
10687 \crefname{part}%
10688 {\CYRCH\cyra\cyrs\cyrt\cyrsftsn}%
10689 {\CYRCH\cyra\cyrs\cyrt\cyri}%
10690 \crefname{chapter}%
10691 {\CYRG\cyrl\cyra\cyrv\cyra}%
10692 {\CYRG\cyrl\cyra\cyrv\cyrery}%
10693 \crefname{section}%
10694 {\CYRR\cyra\cyrz\cyrd\cyre\cyrl}%
10695 {\CYRR\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
10696 \crefname{subsection}%
10697 {\CYRR\cyra\cyrz\cyrd\cyre\cyrl}%
10698 {\CYRR\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
10699 \crefname{subsubsection}%
10700 {\CYRR\cyra\cyrz\cyrd\cyre\cyrl}%
10701 {\CYRR\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
10702 \crefname{appendix}%
10703 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
10704 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
10705 \crefname{subappendix}%
10706 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
10707 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
10708 \crefname{subsubappendix}%
10709 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
10710 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
10711 \crefname{subsubsubappendix}%
10712 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
10713 {\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
10714 \crefname{footnote}%
10715 {\CYRS\cyrn\cyro\cyrs\cyrk\cyra}%
10716 {\CYRS\cyrn\cyro\cyrs\cyrk\cyri}%
10717 \crefname{theorem}%
10718 {\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyra}%
10719 {\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyrery}%
10720 \crefname{lemma}%
10721 {\CYRL\cyre\cyrm\cyrm\cyra}%
10722 {\CYRL\cyre\cyrm\cyrm\cyrery}%
10723 \crefname{corollary}%
10724 {\CYRV\cyrery\cyrv\cyro\cyrd}%
10725 {\CYRV\cyrery\cyrv\cyro\cyrd\cyrery}%
10726 \crefname{proposition}%
10727 {\CYRU\cyrt\cyrv\cyre\cyrr\cyrzh\cyrd\cyre\cyrn\cyri\cyre}%
10728 {\CYRU\cyrt\cyrv\cyre\cyrr\cyrzh\cyrd\cyre\cyrn\cyri\cyrya}%
10729 \crefname{definition}%
10730 {\CYRO\cyrp\cyrr\cyre\cyrd\cyre\cyrl\cyre\cyrn\cyri\cyre}%
10731 {\CYRO\cyrp\cyrr\cyre\cyrd\cyre\cyrl\cyre\cyrn\cyri\cyrya}%
10732 \crefname{result}%
10733 {\CYRR\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt}%
10734 {\CYRR\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt\cyrery}%
10735 \crefname{example}%
10736 {\CYRP\cyrr\cyri\cyrm\cyre\cyrr}%
10737 {\CYRP\cyrr\cyri\cyrm\cyre\cyrr\cyrery}%
10738 \crefname{remark}%
10739 {\CYRP\cyrr\cyri\cyrm\cyre\cyrch\cyra\cyrn\cyri\cyre}%
10740 {\CYRP\cyrr\cyri\cyrm\cyre\cyrch\cyra\cyrn\cyri\cyrya}%
10741 \crefname{note}%
10742 {\CYRZ\cyra\cyrm\cyre\cyrt\cyrk\cyra}%
10743 {\CYRZ\cyra\cyrm\cyre\cyrt\cyrk\cyri}%
10744 \crefname{algorithm}%
10745 {\CYRA\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm}%
10746 {\CYRA\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm\cyrery}%
10747 \crefname{listing}%
10748 {\CYRL\cyri\cyrs\cyrt\cyri\cyrn\cyrg}%
10749 {\CYRL\cyri\cyrs\cyrt\cyri\cyrn\cyrg\cyri}%
10750 \crefname{line}%
10751 {\CYRS\cyrt\cyrr\cyro\cyrk\cyra}%
10752 {\CYRS\cyrt\cyrr\cyro\cyrk\cyri}%
10753 %
10754 \else% capitalise unset
10755 \if@cref@abbrev% abbrev set
10756 \crefname{equation}%
10757 {\cyrf-\cyrl.}%
10758 {\cyrf-\cyrl.}%
10759 \crefname{chapter}%
10760 {\cyrg\cyrl\cyra\cyrv.}%
10761 {\cyrg\cyrl\cyra\cyrv.}%
10762 \crefname{section}%
10763 {\cyrr\cyra\cyrz\cyrd.}%
10764 {\cyrr\cyra\cyrz\cyrd\cyre\cyrl.}%
10765 \crefname{subsection}%
10766 {\cyrr\cyra\cyrz\cyrd.}%
10767 {\cyrr\cyra\cyrz\cyrd\cyre\cyrl.}%
10768 \crefname{subsubsection}%
10769 {\cyrr\cyra\cyrz\cyrd.}%
10770 {\cyrr\cyra\cyrz\cyrd\cyre\cyrl.}%
10771 \crefname{appendix}%
10772 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh.}%
10773 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh.}%
10774 \crefname{subappendix}%
10775 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh.}%
10776 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh.}%
10777 \crefname{subsubappendix}%
10778 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh.}%
10779 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh.}%
10780 \crefname{subsubsubappendix}%
10781 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh.}%
10782 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh.}%
10783 \crefname{enumi}%
10784 {\cyrp.}%
10785 {\cyrp.\cyrp.}%
10786 \crefname{enumii}%
10787 {\cyrp.}%
10788 {\cyrp.\cyrp.}%
10789 \crefname{enumiii}%
10790 {\cyrp.}%
10791 {\cyrp.\cyrp.}%
10792 \crefname{enumiv}%
10793 {\cyrp.}%
10794 {\cyrp.\cyrp.}%
10795 \crefname{enumv}%
10796 {\cyrp.}%
10797 {\cyrp.\cyrp.}%
10798 \crefname{footnote}%
10799 {\cyrs\cyrn\cyro\cyrs\cyrk.}%
10800 {\cyrs\cyrn\cyro\cyrs\cyrk.}%
10801 \crefname{figure}%
10802 {\cyrr\cyri\cyrs.}%
10803 {\cyrr\cyri\cyrs.}%
10804 \crefname{subfigure}%
10805 {\cyrr\cyri\cyrs.}%
10806 {\cyrr\cyri\cyrs.}%
10807 \crefname{table}%
10808 {\cyrt\cyra\cyrb\cyrl.}%
10809 {\cyrt\cyra\cyrb\cyrl.}%
10810 \crefname{subtable}%
10811 {\cyrt\cyra\cyrb\cyrl.}%
10812 {\cyrt\cyra\cyrb\cyrl.}%
10813 \crefname{theorem}%
10814 {\cyrt\cyre\cyro\cyrr\cyre\cyrm.}%
10815 {\cyrt\cyre\cyro\cyrr\cyre\cyrm.}%
10816 \crefname{lemma}%
10817 {\cyrl\cyre\cyrm\cyrm.}%
10818 {\cyrl\cyre\cyrm\cyrm.}%
10819 \crefname{corollary}%
10820 {\cyrv\cyrery\cyrv\cyro\cyrd}%
10821 {\cyrv\cyrery\cyrv\cyro\cyrd.}%
10822 \crefname{proposition}%
10823 {\cyru\cyrt\cyrv\cyre\cyrr\cyrzh\cyrd.}%
10824 {\cyru\cyrt\cyrv\cyre\cyrr\cyrzh\cyrd.}%
10825 \crefname{definition}%
10826 {\cyro\cyrp\cyrr\cyre\cyrd\cyre\cyrl\cyre\cyrn.}%
10827 {\cyro\cyrp\cyrr\cyre\cyrd\cyre\cyrl\cyre\cyrn.}%
10828 \crefname{result}%
10829 {\cyrr\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt.}%
10830 {\cyrr\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt.}%
10831 \crefname{example}%
10832 {\cyrp\cyrr\cyri\cyrm.}%
10833 {\cyrp\cyrr\cyri\cyrm\cyre\cyrr.}%
10834 \crefname{remark}%
10835 {\cyrp\cyrr\cyri\cyrm\cyre\cyrch.}%
10836 {\cyrp\cyrr\cyri\cyrm\cyre\cyrch.}%
10837 \crefname{note}%
10838 {\cyrz\cyra\cyrm\cyre\cyrt\cyrk.}%
10839 {\cyrz\cyra\cyrm\cyre\cyrt\cyrk.}%
10840 \crefname{algorithm}%
10841 {\cyra\cyrl\cyrg.}%
10842 {\cyra\cyrl\cyrg.}%
10843 \crefname{listing}%
10844 {\cyrl\cyri\cyrs\cyrt\cyri\cyrn.}%
10845 {\cyrl\cyri\cyrs\cyrt\cyri\cyrn\cyrg.}%
10846 \crefname{line}%
10847 {\cyrs\cyrt\cyrr\cyrk.}%
10848 {\cyrs\cyrt\cyrr\cyrk.}%
10849 \else% abbrev unset
10850 \crefname{equation}%
10851 {\cyrf\cyro\cyrr\cyrm\cyru\cyrl\cyra}%
10852 {\cyrf\cyro\cyrr\cyrm\cyru\cyrl\cyrery}%
10853 \crefname{figure}%
10854 {\cyrr\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
10855 {\cyrr\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
10856 \crefname{subfigure}%
10857 {\cyrr\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
10858 {\cyrr\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
10859 \crefname{table}%
10860 {\cyrt\cyra\cyrb\cyrl\cyri\cyrc\cyra}%
10861 {\cyrt\cyra\cyrb\cyrl\cyri\cyrc\cyrery}%
10862 \crefname{subtable}%
10863 {\cyrt\cyra\cyrb\cyrl\cyri\cyrc\cyra}%
10864 {\cyrt\cyra\cyrb\cyrl\cyri\cyrc\cyrery}%
10865 \crefname{enumi}%
10866 {\cyrp\cyru\cyrn\cyrk\cyrt}%
10867 {\cyrp\cyru\cyrn\cyrk\cyrt\cyrery}%
10868 \crefname{enumii}%
10869 {\cyrp\cyru\cyrn\cyrk\cyrt}%
10870 {\cyrp\cyru\cyrn\cyrk\cyrt\cyrery}%
10871 \crefname{enumiii}%
10872 {\cyrp\cyru\cyrn\cyrk\cyrt}%
10873 {\cyrp\cyru\cyrn\cyrk\cyrt\cyrery}%
10874 \crefname{enumiv}%
10875 {\cyrp\cyru\cyrn\cyrk\cyrt}%
10876 {\cyrp\cyru\cyrn\cyrk\cyrt\cyrery}%
10877 \crefname{enumv}%
10878 {\cyrp\cyru\cyrn\cyrk\cyrt}%
10879 {\cyrp\cyru\cyrn\cyrk\cyrt\cyrery}%
10880 \crefname{chapter}%
10881 {\cyrg\cyrl\cyra\cyrv\cyra}%
10882 {\cyrg\cyrl\cyra\cyrv\cyrery}%
10883 \crefname{section}%
10884 {\cyrr\cyra\cyrz\cyrd\cyre\cyrl}%
10885 {\cyrr\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
10886 \crefname{subsection}%
10887 {\cyrr\cyra\cyrz\cyrd\cyre\cyrl}%
10888 {\cyrr\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
10889 \crefname{subsubsection}%
10890 {\cyrr\cyra\cyrz\cyrd\cyre\cyrl}%
10891 {\cyrr\cyra\cyrz\cyrd\cyre\cyrl\cyrery}%
10892 \crefname{appendix}%
10893 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
10894 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
10895 \crefname{subappendix}%
10896 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
10897 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
10898 \crefname{subsubappendix}%
10899 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
10900 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
10901 \crefname{subsubsubappendix}%
10902 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}%
10903 {\cyrp\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}%
10904 \crefname{footnote}%
10905 {\cyrs\cyrn\cyro\cyrs\cyrk\cyra}%
10906 {\cyrs\cyrn\cyro\cyrs\cyrk\cyri}%
10907 \crefname{theorem}%
10908 {\cyrt\cyre\cyro\cyrr\cyre\cyrm\cyra}%
10909 {\cyrt\cyre\cyro\cyrr\cyre\cyrm\cyrery}%
10910 \crefname{lemma}%
10911 {\cyrl\cyre\cyrm\cyrm\cyra}%
10912 {\cyrl\cyre\cyrm\cyrm\cyrery}%
10913 \crefname{corollary}%
10914 {\cyrv\cyrery\cyrv\cyro\cyrd}%
10915 {\cyrv\cyrery\cyrv\cyro\cyrd\cyrery}%
10916 \crefname{proposition}%
10917 {\cyru\cyrt\cyrv\cyre\cyrr\cyrzh\cyrd\cyre\cyrn\cyri\cyre}%
10918 {\cyru\cyrt\cyrv\cyre\cyrr\cyrzh\cyrd\cyre\cyrn\cyri\cyrya}%
10919 \crefname{definition}%
10920 {\cyro\cyrp\cyrr\cyre\cyrd\cyre\cyrl\cyre\cyrn\cyri\cyre}%
10921 {\cyro\cyrp\cyrr\cyre\cyrd\cyre\cyrl\cyre\cyrn\cyri\cyrya}%
10922 \crefname{result}%
10923 {\cyrr\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt}%
10924 {\cyrr\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt\cyrery}%
10925 \crefname{example}%
10926 {\cyrp\cyrr\cyri\cyrm\cyre\cyrr}%
10927 {\cyrp\cyrr\cyri\cyrm\cyre\cyrr\cyrery}%
10928 \crefname{remark}%
10929 {\cyrp\cyrr\cyri\cyrm\cyre\cyrch\cyra\cyrn\cyri\cyre}%
10930 {\cyrp\cyrr\cyri\cyrm\cyre\cyrch\cyra\cyrn\cyri\cyrya}%
10931 \crefname{note}%
10932 {\cyrz\cyra\cyrm\cyre\cyrt\cyrk\cyra}%
10933 {\cyrz\cyra\cyrm\cyre\cyrt\cyrk\cyri}%
10934 \crefname{algorithm}%
10935 {\cyra\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm}%
10936 {\cyra\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm\cyrery}%
10937 \crefname{listing}%
10938 {\cyrl\cyri\cyrs\cyrt\cyri\cyrn\cyrg}%
10939 {\cyrl\cyri\cyrs\cyrt\cyri\cyrn\cyrg\cyri}%
10940 \crefname{line}%
10941 {\cyrs\cyrt\cyrr\cyro\cyrk\cyra}%
10942 {\cyrs\cyrt\cyrr\cyro\cyrk\cyri}%
10943 \fi%
10944 \crefname{page}%
10945 {\cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyre}%
10946 {\cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra\cyrh}%
10947 \crefname{part}%
10948 {\cyrch\cyra\cyrs\cyrt\cyrsftsn}%
10949 {\cyrch\cyra\cyrs\cyrt\cyri}%
10950 \fi}% end \cref@loadlanguagedefs
10951 % \end{macrocode}
10952 %
10953 %
10954 % \subsubsection{Ukrainian}
10955 % \begin{macro}{ukrainian}
10956 % Ukrainian translations courtesy of Aleksander Gorohovski.
10957 % \end{macro}
10958 %
10959 % Set up the definitions used at the beginning of the document to define
10960 % the formats created by the document preamble.
10961 % \begin{macrocode}
10962 \DeclareOption{ukrainian}{%
10963 \AtBeginDocument{%
10964 \def\crefrangeconjunction@preamble{--}%
10965 \def\crefrangepreconjunction@preamble{}%
10966 \def\crefrangepostconjunction@preamble{}%
10967 \def\crefpairconjunction@preamble{ \cyrii\nobreakspace}%
10968 \def\crefmiddleconjunction@preamble{, }%
10969 \def\creflastconjunction@preamble{ \cyrii\nobreakspace}%
10970 % \end{macrocode}
10971 % We have to define the group conjunctions explicitly here, rather than
10972 % relying on fall-back definitions in terms of the above conjunctions
10973 % (see \cref{sec:code:default_formats}), in case any other language
10974 % option defines them explicitly and we need to override those.
10975 % \begin{macrocode}
10976 \def\crefpairgroupconjunction@preamble{ \cyrt\cyra\nobreakspace}%
10977 \def\crefmiddlegroupconjunction@preamble{, }%
10978 \def\creflastgroupconjunction@preamble%
10979 {, \cyra\ \cyrt\cyra\cyrk\cyro\cyrzh\nobreakspace}%
10980 %
10981 \Crefname@preamble{equation}%
10982 {\CYRF\cyro\cyrr\cyrm\cyru\cyrl\cyra}%
10983 {\CYRF\cyro\cyrr\cyrm\cyru\cyrl\cyri}%
10984 \Crefname@preamble{figure}%
10985 {\CYRR\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
10986 {\CYRR\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
10987 \Crefname@preamble{table}%
10988 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrya}%
10989 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrii}%
10990 \Crefname@preamble{enumi}%
10991 {\CYRP\cyru\cyrn\cyrk\cyrt}%
10992 {\CYRP\cyru\cyrn\cyrk\cyrt\cyri}%
10993 \Crefname@preamble{chapter}%
10994 {\CYRG\cyrl\cyra\cyrv\cyra}%
10995 {\CYRG\cyrl\cyra\cyrv\cyri}%
10996 \Crefname@preamble{section}%
10997 {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}%
10998 {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
10999 \Crefname@preamble{appendix}%
11000 {\CYRD\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
11001 {\CYRD\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
11002 \Crefname@preamble{footnote}%
11003 {\CYRV\cyri\cyrn\cyro\cyrs\cyrk\cyra}%
11004 {\CYRV\cyri\cyrn\cyro\cyrs\cyrk\cyri}%
11005 \Crefname@preamble{theorem}%
11006 {\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyra}%
11007 {\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyri}%
11008 \Crefname@preamble{lemma}%
11009 {\CYRL\cyre\cyrm\cyrm\cyra}%
11010 {\CYRL\cyre\cyrm\cyrm\cyri}%
11011 \Crefname@preamble{corollary}%
11012 {\CYRV\cyri\cyrs\cyrn\cyro\cyrv\cyro\cyrk}%
11013 {\CYRV\cyri\cyrs\cyrn\cyro\cyrv\cyrk\cyri}%
11014 \Crefname@preamble{proposition}%
11015 {\CYRT\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn\cyrya}%
11016 {\CYRT\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn\cyrya}%
11017 \Crefname@preamble{definition}%
11018 {\CYRV\cyri\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn\cyrya}%
11019 {\CYRV\cyri\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn\cyrya}%
11020 \Crefname@preamble{result}%
11021 {\CYRR\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt}%
11022 {\CYRR\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt\cyri}%
11023 \Crefname@preamble{example}%
11024 {\CYRP\cyrr\cyri\cyrk\cyrl\cyra\cyrd}%
11025 {\CYRP\cyrr\cyri\cyrk\cyrl\cyra\cyrd\cyri}%
11026 \Crefname@preamble{remark}%
11027 {\CYRP\cyrr\cyri\cyrm\cyrii\cyrt\cyrk\cyra}%
11028 {\CYRP\cyrr\cyri\cyrm\cyrii\cyrt\cyrk\cyri}%
11029 \Crefname@preamble{note}%
11030 {\CYRZ\cyra\cyrm\cyrii\cyrt\cyrk\cyra}%
11031 {\CYRZ\cyra\cyrm\cyrii\cyrt\cyrk\cyri}%
11032 \Crefname@preamble{algorithm}%
11033 {\CYRA\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm}%
11034 {\CYRA\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm\cyri}%
11035 \Crefname@preamble{listing}%
11036 {\CYRL\cyrii\cyrs\cyrt\cyri\cyrn\cyrg}%
11037 {\CYRL\cyrii\cyrs\cyrt\cyri\cyrn\cyrg\cyri}%
11038 \Crefname@preamble{line}%
11039 {\CYRS\cyrt\cyrr\cyro\cyrk\cyra}%
11040 {\CYRS\cyrt\cyrr\cyro\cyrk\cyri}%
11041 \Crefname@preamble{page}%
11042 {\CYRS\cyrt\cyro\cyrr\cyri\cyrn\cyrk\cyra}%
11043 {\CYRS\cyrt\cyro\cyrr\cyrii\cyrn\cyrk\cyri}%
11044 \Crefname@preamble{part}%
11045 {\CYRCH\cyra\cyrs\cyrt\cyri\cyrn\cyra}%
11046 {\CYRCH\cyra\cyrs\cyrt\cyri\cyrn\cyri}%
11047 %
11048 \if@cref@capitalise% capitalise set
11049 \if@cref@abbrev% abbrev set
11050 \crefname@preamble{equation}%
11051 {\CYRF-\cyrl.}%
11052 {\CYRF-\cyrl.}%
11053 \crefname@preamble{figure}%
11054 {\CYRR\cyri\cyrs.}%
11055 {\CYRR\cyri\cyrs.}%
11056 \crefname@preamble{table}%
11057 {\CYRT\cyra\cyrb\cyrl.}%
11058 {\CYRT\cyra\cyrb\cyrl.}%
11059 \crefname@preamble{enumi}%
11060 {\CYRP.}%
11061 {\CYRP.\cyrp.}%
11062 \else%
11063 \crefname@preamble{equation}%
11064 {\CYRF\cyro\cyrr\cyrm\cyru\cyrl\cyra}%
11065 {\CYRF\cyro\cyrr\cyrm\cyru\cyrl\cyri}%
11066 \crefname@preamble{figure}%
11067 {\CYRR\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
11068 {\CYRR\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
11069 \crefname@preamble{table}%
11070 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrya}%
11071 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrii}%
11072 \crefname@preamble{enumi}%
11073 {\CYRP\cyru\cyrn\cyrk\cyrt}%
11074 {\CYRP\cyru\cyrn\cyrk\cyrt\cyri}%
11075 \fi%
11076 \crefname@preamble{chapter}%
11077 {\CYRG\cyrl\cyra\cyrv\cyra}%
11078 {\CYRG\cyrl\cyra\cyrv\cyri}%
11079 \crefname@preamble{section}%
11080 {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}%
11081 {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
11082 \crefname@preamble{appendix}%
11083 {\CYRD\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
11084 {\CYRD\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
11085 \crefname@preamble{footnote}%
11086 {\CYRV\cyri\cyrn\cyro\cyrs\cyrk\cyra}%
11087 {\CYRV\cyri\cyrn\cyro\cyrs\cyrk\cyri}%
11088 \crefname@preamble{theorem}%
11089 {\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyra}%
11090 {\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyri}%
11091 \crefname@preamble{lemma}%
11092 {\CYRL\cyre\cyrm\cyrm\cyra}%
11093 {\CYRL\cyre\cyrm\cyrm\cyri}%
11094 \crefname@preamble{corollary}%
11095 {\CYRV\cyri\cyrs\cyrn\cyro\cyrv\cyro\cyrk}%
11096 {\CYRV\cyri\cyrs\cyrn\cyro\cyrv\cyrk\cyri}%
11097 \crefname@preamble{proposition}%
11098 {\CYRT\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn\cyrya}%
11099 {\CYRT\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn\cyrya}%
11100 \crefname@preamble{definition}%
11101 {\CYRV\cyri\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn\cyrya}%
11102 {\CYRV\cyri\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn\cyrya}%
11103 \crefname@preamble{result}%
11104 {\CYRR\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt}%
11105 {\CYRR\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt\cyri}%
11106 \crefname@preamble{example}%
11107 {\CYRP\cyrr\cyri\cyrk\cyrl\cyra\cyrd}%
11108 {\CYRP\cyrr\cyri\cyrk\cyrl\cyra\cyrd\cyri}%
11109 \crefname@preamble{remark}%
11110 {\CYRP\cyrr\cyri\cyrm\cyrii\cyrt\cyrk\cyra}%
11111 {\CYRP\cyrr\cyri\cyrm\cyrii\cyrt\cyrk\cyri}%
11112 \crefname@preamble{note}%
11113 {\CYRZ\cyra\cyrm\cyrii\cyrt\cyrk\cyra}%
11114 {\CYRZ\cyra\cyrm\cyrii\cyrt\cyrk\cyri}%
11115 \crefname@preamble{algorithm}%
11116 {\CYRA\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm}%
11117 {\CYRA\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm\cyri}%
11118 \crefname@preamble{listing}%
11119 {\CYRL\cyrii\cyrs\cyrt\cyri\cyrn\cyrg}%
11120 {\CYRL\cyrii\cyrs\cyrt\cyri\cyrn\cyrg\cyri}%
11121 \crefname@preamble{line}%
11122 {\CYRS\cyrt\cyrr\cyro\cyrk\cyra}%
11123 {\CYRS\cyrt\cyrr\cyro\cyrk\cyri}%
11124 \crefname@preamble{page}%
11125 {\CYRS\cyrt\cyro\cyrr\cyri\cyrn\cyrk\cyra}%
11126 {\CYRS\cyrt\cyro\cyrr\cyrii\cyrn\cyrk\cyri}%
11127 \crefname@preamble{part}%
11128 {\CYRCH\cyra\cyrs\cyrt\cyri\cyrn\cyra}%
11129 {\CYRCH\cyra\cyrs\cyrt\cyri\cyrn\cyri}%
11130 %
11131 \else% capitalise unset
11132 \if@cref@abbrev% abbrev set
11133 \crefname@preamble{equation}%
11134 {\cyrf-\cyrl.}%
11135 {\cyrf-\cyrl.}%
11136 \crefname@preamble{figure}%
11137 {\cyrr\cyri\cyrs.}%
11138 {\cyrr\cyri\cyrs.}%
11139 \crefname@preamble{table}%
11140 {\cyrt\cyra\cyrb\cyrl.}%
11141 {\cyrt\cyra\cyrb\cyrl.}%
11142 \crefname@preamble{enumi}%
11143 {\cyrp.}%
11144 {\cyrp.\cyrp.}%
11145 \crefname@preamble{chapter}%
11146 {\cyrg\cyrl\cyra\cyrv.}%
11147 {\cyrg\cyrl\cyra\cyrv.}%
11148 \crefname@preamble{section}%
11149 {\cyrr\cyro\cyrz\cyrd.}%
11150 {\cyrr\cyro\cyrz\cyrd\cyrii\cyrl.}%
11151 \crefname@preamble{appendix}%
11152 {\cyrd\cyro\cyrd\cyra\cyrt.}%
11153 {\cyrd\cyro\cyrd\cyra\cyrt\cyrk.}%
11154 \crefname@preamble{footnote}%
11155 {\cyrv\cyri\cyrn\cyro\cyrs\cyrk.}%
11156 {\cyrv\cyri\cyrn\cyro\cyrs\cyrk.}%
11157 \crefname@preamble{theorem}%
11158 {\cyrt\cyre\cyro\cyrr\cyre\cyrm.}%
11159 {\cyrt\cyre\cyro\cyrr\cyre\cyrm.}%
11160 \crefname@preamble{lemma}%
11161 {\cyrl\cyre\cyrm\cyrm.}%
11162 {\cyrl\cyre\cyrm\cyrm.}%
11163 \crefname@preamble{corollary}%
11164 {\cyrv\cyri\cyrs\cyrn\cyro\cyrv.}%
11165 {\cyrv\cyri\cyrs\cyrn\cyro\cyrv\cyrk.}%
11166 \crefname@preamble{proposition}%
11167 {\cyrt\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn.}%
11168 {\cyrt\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn.}%
11169 \crefname@preamble{definition}%
11170 {\cyrv\cyri\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn.}%
11171 {\cyrv\cyri\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn.}%
11172 \crefname@preamble{result}%
11173 {\cyrr\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt.}%
11174 {\cyrr\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt.}%
11175 \crefname@preamble{example}%
11176 {\cyrp\cyrr\cyri\cyrk\cyrl.}%
11177 {\cyrp\cyrr\cyri\cyrk\cyrl\cyra\cyrd.}%
11178 \crefname@preamble{remark}%
11179 {\cyrp\cyrr\cyri\cyrm\cyrii\cyrt.}%
11180 {\cyrp\cyrr\cyri\cyrm\cyrii\cyrt.}%
11181 \crefname@preamble{note}%
11182 {\cyrz\cyra\cyrm\cyrii\cyrt.}%
11183 {\cyrz\cyra\cyrm\cyrii\cyrt.}%
11184 \crefname@preamble{algorithm}%
11185 {\cyra\cyrl\cyrg.}%
11186 {\cyra\cyrl\cyrg.}%
11187 \crefname@preamble{listing}%
11188 {\cyrl\cyrii\cyrs\cyrt\cyri\cyrn.}%
11189 {\cyrl\cyrii\cyrs\cyrt\cyri\cyrn\cyrg.}%
11190 \crefname@preamble{line}%
11191 {\cyrs\cyrt\cyrr\cyrk.}%
11192 {\cyrs\cyrt\cyrr\cyrk.}%
11193 \else% abbrev unset
11194 \crefname@preamble{equation}%
11195 {\cyrf\cyro\cyrr\cyrm\cyru\cyrl\cyra}%
11196 {\cyrf\cyro\cyrr\cyrm\cyru\cyrl\cyri}%
11197 \crefname@preamble{figure}%
11198 {\cyrr\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
11199 {\cyrr\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
11200 \crefname@preamble{table}%
11201 {\cyrt\cyra\cyrb\cyrl\cyri\cyrc\cyrya}%
11202 {\cyrt\cyra\cyrb\cyrl\cyri\cyrc\cyrii}%
11203 \crefname@preamble{enumi}%
11204 {\cyrp\cyru\cyrn\cyrk\cyrt}%
11205 {\cyrp\cyru\cyrn\cyrk\cyrt\cyri}%
11206 \crefname@preamble{chapter}%
11207 {\cyrg\cyrl\cyra\cyrv\cyra}%
11208 {\cyrg\cyrl\cyra\cyrv\cyri}%
11209 \crefname@preamble{section}%
11210 {\cyrr\cyro\cyrz\cyrd\cyrii\cyrl}%
11211 {\cyrr\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
11212 \crefname@preamble{appendix}%
11213 {\cyrd\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
11214 {\cyrd\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
11215 \crefname@preamble{footnote}%
11216 {\cyrv\cyri\cyrn\cyro\cyrs\cyrk\cyra}%
11217 {\cyrv\cyri\cyrn\cyro\cyrs\cyrk\cyri}%
11218 \crefname@preamble{theorem}%
11219 {\cyrt\cyre\cyro\cyrr\cyre\cyrm\cyra}%
11220 {\cyrt\cyre\cyro\cyrr\cyre\cyrm\cyri}%
11221 \crefname@preamble{lemma}%
11222 {\cyrl\cyre\cyrm\cyrm\cyra}%
11223 {\cyrl\cyre\cyrm\cyrm\cyri}%
11224 \crefname@preamble{corollary}%
11225 {\cyrv\cyri\cyrs\cyrn\cyro\cyrv\cyro\cyrk}%
11226 {\cyrv\cyri\cyrs\cyrn\cyro\cyrv\cyrk\cyri}%
11227 \crefname@preamble{proposition}%
11228 {\cyrt\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn\cyrya}%
11229 {\cyrt\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn\cyrya}%
11230 \crefname@preamble{definition}%
11231 {\cyrv\cyri\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn\cyrya}%
11232 {\cyrv\cyri\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn\cyrya}%
11233 \crefname@preamble{result}%
11234 {\cyrr\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt}%
11235 {\cyrr\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt\cyri}%
11236 \crefname@preamble{example}%
11237 {\cyrp\cyrr\cyri\cyrk\cyrl\cyra\cyrd}%
11238 {\cyrp\cyrr\cyri\cyrk\cyrl\cyra\cyrd\cyri}%
11239 \crefname@preamble{remark}%
11240 {\cyrp\cyrr\cyri\cyrm\cyrii\cyrt\cyrk\cyra}%
11241 {\cyrp\cyrr\cyri\cyrm\cyrii\cyrt\cyrk\cyri}%
11242 \crefname@preamble{note}%
11243 {\cyrz\cyra\cyrm\cyrii\cyrt\cyrk\cyra}%
11244 {\cyrz\cyra\cyrm\cyrii\cyrt\cyrk\cyri}%
11245 \crefname@preamble{algorithm}%
11246 {\cyra\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm}%
11247 {\cyra\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm\cyri}%
11248 \crefname@preamble{listing}%
11249 {\cyrl\cyrii\cyrs\cyrt\cyri\cyrn\cyrg}%
11250 {\cyrl\cyrii\cyrs\cyrt\cyri\cyrn\cyrg\cyri}%
11251 \crefname@preamble{line}%
11252 {\cyrs\cyrt\cyrr\cyro\cyrk\cyra}%
11253 {\cyrs\cyrt\cyrr\cyro\cyrk\cyri}%
11254 \fi%
11255 \crefname@preamble{page}%
11256 {\cyrs\cyrt\cyro\cyrr\cyri\cyrn\cyrc\cyrii}%
11257 {\cyrs\cyrt\cyro\cyrr\cyrii\cyrn\cyrk\cyra\cyrh}%
11258 \crefname@preamble{part}%
11259 {\cyrch\cyra\cyrs\cyrt\cyri\cyrn\cyra}%
11260 {\cyrch\cyra\cyrs\cyrt\cyri\cyrn\cyri}%
11261 \fi%
11262 \def\cref@language{ukrainian}%
11263 }}% end \DeclareOption and \AtBeginDocument
11264 % \end{macrocode}
11265 %
11266 % If using \package{babel} and the corresponding option is set, or if
11267 % using \package{polyglossia} and the language has been loaded, add
11268 % format definition commands to \cmd{\extras}\meta{language} or
11269 % \cmd{\captions}\meta{language} so that language switching commands will
11270 % change the cross-reference formats appropriately.
11271 % \begin{macrocode}
11272 \cref@addlanguagedefs{ukrainian}{%
11273 \PackageInfo{cleveref}{loaded `ukrainian' language definitions}%
11274 \renewcommand{\crefrangeconjunction}{--}%
11275 \renewcommand\crefrangepreconjunction{}%
11276 \renewcommand\crefrangepostconjunction{}%
11277 \renewcommand{\crefpairconjunction}{ \cyrii\nobreakspace}%
11278 \renewcommand{\crefmiddleconjunction}{, }%
11279 \renewcommand{\creflastconjunction}{ \cyrii\nobreakspace}%
11280 \renewcommand{\crefpairgroupconjunction}%
11281 { \cyrt\cyra\nobreakspace}%
11282 \renewcommand{\crefmiddlegroupconjunction}{, }%
11283 \renewcommand{\creflastgroupconjunction}%
11284 {, \cyra\ \cyrt\cyra\cyrk\cyro\cyrzh\nobreakspace}%
11285 %
11286 \Crefname{equation}%
11287 {\CYRF\cyro\cyrr\cyrm\cyru\cyrl\cyra}%
11288 {\CYRF\cyro\cyrr\cyrm\cyru\cyrl\cyri}%
11289 \Crefname{figure}%
11290 {\CYRR\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
11291 {\CYRR\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
11292 \Crefname{subfigure}%
11293 {\CYRR\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
11294 {\CYRR\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
11295 \Crefname{table}%
11296 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrya}%
11297 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrii}%
11298 \Crefname{subtable}%
11299 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrya}%
11300 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrii}%
11301 \Crefname{enumi}%
11302 {\CYRP\cyru\cyrn\cyrk\cyrt}%
11303 {\CYRP\cyru\cyrn\cyrk\cyrt\cyri}%
11304 \Crefname{enumii}%
11305 {\CYRP\cyru\cyrn\cyrk\cyrt}%
11306 {\CYRP\cyru\cyrn\cyrk\cyrt\cyri}%
11307 \Crefname{enumiii}%
11308 {\CYRP\cyru\cyrn\cyrk\cyrt}%
11309 {\CYRP\cyru\cyrn\cyrk\cyrt\cyri}%
11310 \Crefname{enumiv}%
11311 {\CYRP\cyru\cyrn\cyrk\cyrt}%
11312 {\CYRP\cyru\cyrn\cyrk\cyrt\cyri}%
11313 \Crefname{enumv}%
11314 {\CYRP\cyru\cyrn\cyrk\cyrt}%
11315 {\CYRP\cyru\cyrn\cyrk\cyrt\cyri}%
11316 \Crefname{chapter}%
11317 {\CYRG\cyrl\cyra\cyrv\cyra}%
11318 {\CYRG\cyrl\cyra\cyrv\cyri}%
11319 \Crefname{section}%
11320 {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}%
11321 {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
11322 \Crefname{subsection}%
11323 {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}%
11324 {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
11325 \Crefname{subsubsection}%
11326 {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}%
11327 {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
11328 \Crefname{appendix}%
11329 {\CYRD\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
11330 {\CYRD\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
11331 \Crefname{subappendix}%
11332 {\CYRD\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
11333 {\CYRD\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
11334 \Crefname{subsubappendix}%
11335 {\CYRD\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
11336 {\CYRD\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
11337 \Crefname{subsubsubappendix}%
11338 {\CYRD\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
11339 {\CYRD\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
11340 \Crefname{footnote}%
11341 {\CYRV\cyri\cyrn\cyro\cyrs\cyrk\cyra}%
11342 {\CYRV\cyri\cyrn\cyro\cyrs\cyrk\cyri}%
11343 \Crefname{theorem}%
11344 {\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyra}%
11345 {\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyri}%
11346 \Crefname{lemma}%
11347 {\CYRL\cyre\cyrm\cyrm\cyra}%
11348 {\CYRL\cyre\cyrm\cyrm\cyri}%
11349 \Crefname{corollary}%
11350 {\CYRV\cyri\cyrs\cyrn\cyro\cyrv\cyro\cyrk}%
11351 {\CYRV\cyri\cyrs\cyrn\cyro\cyrv\cyrk\cyri}%
11352 \Crefname{proposition}%
11353 {\CYRT\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn\cyrya}%
11354 {\CYRT\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn\cyrya}%
11355 \Crefname{definition}%
11356 {\CYRV\cyri\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn\cyrya}%
11357 {\CYRV\cyri\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn\cyrya}%
11358 \Crefname{result}%
11359 {\CYRR\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt}%
11360 {\CYRR\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt\cyri}%
11361 \Crefname{example}%
11362 {\CYRP\cyrr\cyri\cyrk\cyrl\cyra\cyrd}%
11363 {\CYRP\cyrr\cyri\cyrk\cyrl\cyra\cyrd\cyri}%
11364 \Crefname{remark}%
11365 {\CYRP\cyrr\cyri\cyrm\cyrii\cyrt\cyrk\cyra}%
11366 {\CYRP\cyrr\cyri\cyrm\cyrii\cyrt\cyrk\cyri}%
11367 \Crefname{note}%
11368 {\CYRZ\cyra\cyrm\cyrii\cyrt\cyrk\cyra}%
11369 {\CYRZ\cyra\cyrm\cyrii\cyrt\cyrk\cyri}%
11370 \Crefname{algorithm}%
11371 {\CYRA\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm}%
11372 {\CYRA\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm\cyri}%
11373 \Crefname{listing}%
11374 {\CYRL\cyrii\cyrs\cyrt\cyri\cyrn\cyrg}%
11375 {\CYRL\cyrii\cyrs\cyrt\cyri\cyrn\cyrg\cyri}%
11376 \Crefname{line}%
11377 {\CYRS\cyrt\cyrr\cyro\cyrk\cyra}%
11378 {\CYRS\cyrt\cyrr\cyro\cyrk\cyri}%
11379 \Crefname{page}%
11380 {\CYRS\cyrt\cyro\cyrr\cyri\cyrn\cyrk\cyra}%
11381 {\CYRS\cyrt\cyro\cyrr\cyrii\cyrn\cyrk\cyri}%
11382 \Crefname{part}%
11383 {\CYRCH\cyra\cyrs\cyrt\cyri\cyrn\cyra}%
11384 {\CYRCH\cyra\cyrs\cyrt\cyri\cyrn\cyri}%
11385 %
11386 \if@cref@capitalise% capitalise set
11387 \if@cref@abbrev% abbrev set
11388 \crefname{equation}%
11389 {\CYRF-\cyrl.}%
11390 {\CYRF-\cyrl.}%
11391 \crefname{figure}%
11392 {\CYRR\cyri\cyrs.}%
11393 {\CYRR\cyri\cyrs.}%
11394 \crefname{subfigure}%
11395 {\CYRR\cyri\cyrs.}%
11396 {\CYRR\cyri\cyrs.}%
11397 \crefname{table}%
11398 {\CYRT\cyra\cyrb\cyrl.}%
11399 {\CYRT\cyra\cyrb\cyrl.}%
11400 \crefname{subtable}%
11401 {\CYRT\cyra\cyrb\cyrl.}%
11402 {\CYRT\cyra\cyrb\cyrl.}%
11403 \crefname{enumi}%
11404 {\CYRP.}%
11405 {\CYRP.\cyrp.}%
11406 \crefname{enumii}%
11407 {\CYRP.}%
11408 {\CYRP.\cyrp.}%
11409 \crefname{enumiii}%
11410 {\CYRP.}%
11411 {\CYRP.\cyrp.}%
11412 \crefname{enumiv}%
11413 {\CYRP.}%
11414 {\CYRP.\cyrp.}%
11415 \crefname{enumv}%
11416 {\CYRP.}%
11417 {\CYRP.\cyrp.}%
11418 \else% abbrev unset
11419 \crefname{equation}%
11420 {\CYRF\cyro\cyrr\cyrm\cyru\cyrl\cyra}%
11421 {\CYRF\cyro\cyrr\cyrm\cyru\cyrl\cyri}%
11422 \crefname{figure}%
11423 {\CYRR\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
11424 {\CYRR\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
11425 \crefname{subfigure}%
11426 {\CYRR\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
11427 {\CYRR\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
11428 \crefname{table}%
11429 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrya}%
11430 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrii}%
11431 \crefname{subtable}%
11432 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrya}%
11433 {\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrii}%
11434 \crefname{enumi}%
11435 {\CYRP\cyru\cyrn\cyrk\cyrt}%
11436 {\CYRP\cyru\cyrn\cyrk\cyrt\cyri}%
11437 \crefname{enumii}%
11438 {\CYRP\cyru\cyrn\cyrk\cyrt}%
11439 {\CYRP\cyru\cyrn\cyrk\cyrt\cyri}%
11440 \crefname{enumiii}%
11441 {\CYRP\cyru\cyrn\cyrk\cyrt}%
11442 {\CYRP\cyru\cyrn\cyrk\cyrt\cyri}%
11443 \crefname{enumiv}%
11444 {\CYRP\cyru\cyrn\cyrk\cyrt}%
11445 {\CYRP\cyru\cyrn\cyrk\cyrt\cyri}%
11446 \crefname{enumv}%
11447 {\CYRP\cyru\cyrn\cyrk\cyrt}%
11448 {\CYRP\cyru\cyrn\cyrk\cyrt\cyri}%
11449 \fi%
11450 \crefname{chapter}%
11451 {\CYRG\cyrl\cyra\cyrv\cyra}%
11452 {\CYRG\cyrl\cyra\cyrv\cyri}%
11453 \crefname{section}%
11454 {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}%
11455 {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
11456 \crefname{subsection}%
11457 {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}%
11458 {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
11459 \crefname{subsubsection}%
11460 {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}%
11461 {\CYRR\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
11462 \crefname{appendix}%
11463 {\CYRD\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
11464 {\CYRD\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
11465 \crefname{subappendix}%
11466 {\CYRD\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
11467 {\CYRD\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
11468 \crefname{subsubappendix}%
11469 {\CYRD\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
11470 {\CYRD\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
11471 \crefname{subsubsubappendix}%
11472 {\CYRD\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
11473 {\CYRD\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
11474 \crefname{footnote}%
11475 {\CYRV\cyri\cyrn\cyro\cyrs\cyrk\cyra}%
11476 {\CYRV\cyri\cyrn\cyro\cyrs\cyrk\cyri}%
11477 \crefname{theorem}%
11478 {\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyra}%
11479 {\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyri}%
11480 \crefname{lemma}%
11481 {\CYRL\cyre\cyrm\cyrm\cyra}%
11482 {\CYRL\cyre\cyrm\cyrm\cyri}%
11483 \crefname{corollary}%
11484 {\CYRV\cyri\cyrs\cyrn\cyro\cyrv\cyro\cyrk}%
11485 {\CYRV\cyri\cyrs\cyrn\cyro\cyrv\cyrk\cyri}%
11486 \crefname{proposition}%
11487 {\CYRT\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn\cyrya}%
11488 {\CYRT\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn\cyrya}%
11489 \crefname{definition}%
11490 {\CYRV\cyri\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn\cyrya}%
11491 {\CYRV\cyri\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn\cyrya}%
11492 \crefname{result}%
11493 {\CYRR\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt}%
11494 {\CYRR\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt\cyri}%
11495 \crefname{example}%
11496 {\CYRP\cyrr\cyri\cyrk\cyrl\cyra\cyrd}%
11497 {\CYRP\cyrr\cyri\cyrk\cyrl\cyra\cyrd\cyri}%
11498 \crefname{remark}%
11499 {\CYRP\cyrr\cyri\cyrm\cyrii\cyrt\cyrk\cyra}%
11500 {\CYRP\cyrr\cyri\cyrm\cyrii\cyrt\cyrk\cyri}%
11501 \crefname{note}%
11502 {\CYRZ\cyra\cyrm\cyrii\cyrt\cyrk\cyra}%
11503 {\CYRZ\cyra\cyrm\cyrii\cyrt\cyrk\cyri}%
11504 \crefname{algorithm}%
11505 {\CYRA\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm}%
11506 {\CYRA\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm\cyri}%
11507 \crefname{listing}%
11508 {\CYRL\cyrii\cyrs\cyrt\cyri\cyrn\cyrg}%
11509 {\CYRL\cyrii\cyrs\cyrt\cyri\cyrn\cyrg\cyri}%
11510 \crefname{line}%
11511 {\CYRS\cyrt\cyrr\cyro\cyrk\cyra}%
11512 {\CYRS\cyrt\cyrr\cyro\cyrk\cyri}%
11513 \crefname{page}%
11514 {\CYRS\cyrt\cyro\cyrr\cyri\cyrn\cyrk\cyra}%
11515 {\CYRS\cyrt\cyro\cyrr\cyrii\cyrn\cyrk\cyri}%
11516 \crefname{part}%
11517 {\CYRCH\cyra\cyrs\cyrt\cyri\cyrn\cyra}%
11518 {\CYRCH\cyra\cyrs\cyrt\cyri\cyrn\cyri}%
11519 %
11520 \else% capitalise unset
11521 \if@cref@abbrev% abbrev set
11522 \crefname{equation}%
11523 {\cyrf-\cyrl.}%
11524 {\cyrf-\cyrl.}%
11525 \crefname{chapter}%
11526 {\cyrg\cyrl\cyra\cyrv.}%
11527 {\cyrg\cyrl\cyra\cyrv.}%
11528 \crefname{section}%
11529 {\cyrr\cyro\cyrz\cyrd.}%
11530 {\cyrr\cyro\cyrz\cyrd\cyrii\cyrl.}%
11531 \crefname{subsection}%
11532 {\cyrr\cyro\cyrz\cyrd.}%
11533 {\cyrr\cyro\cyrz\cyrd\cyrii\cyrl.}%
11534 \crefname{subsubsection}%
11535 {\cyrr\cyro\cyrz\cyrd.}%
11536 {\cyrr\cyro\cyrz\cyrd\cyrii\cyrl.}%
11537 \crefname{appendix}%
11538 {\cyrd\cyro\cyrd\cyra\cyrt.}%
11539 {\cyrd\cyro\cyrd\cyra\cyrt\cyrk.}%
11540 \crefname{subappendix}%
11541 {\cyrd\cyro\cyrd\cyra\cyrt.}%
11542 {\cyrd\cyro\cyrd\cyra\cyrt\cyrk.}%
11543 \crefname{subsubappendix}%
11544 {\cyrd\cyro\cyrd\cyra\cyrt.}%
11545 {\cyrd\cyro\cyrd\cyra\cyrt\cyrk.}%
11546 \crefname{subsubsubappendix}%
11547 {\cyrd\cyro\cyrd\cyra\cyrt.}%
11548 {\cyrd\cyro\cyrd\cyra\cyrt\cyrk.}%
11549 \crefname{enumi}%
11550 {\cyrp.}%
11551 {\cyrp.\cyrp.}%
11552 \crefname{enumii}%
11553 {\cyrp.}%
11554 {\cyrp.\cyrp.}%
11555 \crefname{enumiii}%
11556 {\cyrp.}%
11557 {\cyrp.\cyrp.}%
11558 \crefname{enumiv}%
11559 {\cyrp.}%
11560 {\cyrp.\cyrp.}%
11561 \crefname{enumv}%
11562 {\cyrp.}%
11563 {\cyrp.\cyrp.}%
11564 \crefname{footnote}%
11565 {\cyrv\cyri\cyrn\cyro\cyrs\cyrk.}%
11566 {\cyrv\cyri\cyrn\cyro\cyrs\cyrk.}%
11567 \crefname{figure}%
11568 {\cyrr\cyri\cyrs.}%
11569 {\cyrr\cyri\cyrs.}%
11570 \crefname{subfigure}%
11571 {\cyrr\cyri\cyrs.}%
11572 {\cyrr\cyri\cyrs.}%
11573 \crefname{table}%
11574 {\cyrt\cyra\cyrb\cyrl.}%
11575 {\cyrt\cyra\cyrb\cyrl.}%
11576 \crefname{subtable}%
11577 {\cyrt\cyra\cyrb\cyrl.}%
11578 {\cyrt\cyra\cyrb\cyrl.}%
11579 \crefname{theorem}%
11580 {\cyrt\cyre\cyro\cyrr\cyre\cyrm.}%
11581 {\cyrt\cyre\cyro\cyrr\cyre\cyrm.}%
11582 \crefname{lemma}%
11583 {\cyrl\cyre\cyrm\cyrm.}%
11584 {\cyrl\cyre\cyrm\cyrm.}%
11585 \crefname{corollary}%
11586 {\cyrv\cyri\cyrs\cyrn\cyro\cyrv.}%
11587 {\cyrv\cyri\cyrs\cyrn\cyro\cyrv\cyrk.}%
11588 \crefname{proposition}%
11589 {\cyrt\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn.}%
11590 {\cyrt\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn.}%
11591 \crefname{definition}%
11592 {\cyrv\cyri\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn.}%
11593 {\cyrv\cyri\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn.}%
11594 \crefname{result}%
11595 {\cyrr\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt.}%
11596 {\cyrr\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt.}%
11597 \crefname{example}%
11598 {\cyrp\cyrr\cyri\cyrk\cyrl.}%
11599 {\cyrp\cyrr\cyri\cyrk\cyrl\cyra\cyrd.}%
11600 \crefname{remark}%
11601 {\cyrp\cyrr\cyri\cyrm\cyrii\cyrt.}%
11602 {\cyrp\cyrr\cyri\cyrm\cyrii\cyrt.}%
11603 \crefname{note}%
11604 {\cyrz\cyra\cyrm\cyrii\cyrt.}%
11605 {\cyrz\cyra\cyrm\cyrii\cyrt.}%
11606 \crefname{algorithm}%
11607 {\cyra\cyrl\cyrg.}%
11608 {\cyra\cyrl\cyrg.}%
11609 \crefname{listing}%
11610 {\cyrl\cyrii\cyrs\cyrt\cyri\cyrn.}%
11611 {\cyrl\cyrii\cyrs\cyrt\cyri\cyrn\cyrg.}%
11612 \crefname{line}%
11613 {\cyrs\cyrt\cyrr\cyrk.}%
11614 {\cyrs\cyrt\cyrr\cyrk.}%
11615 \else% abbrev unset
11616 \crefname{equation}%
11617 {\cyrf\cyro\cyrr\cyrm\cyru\cyrl\cyra}%
11618 {\cyrf\cyro\cyrr\cyrm\cyru\cyrl\cyri}%
11619 \crefname{figure}%
11620 {\cyrr\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
11621 {\cyrr\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
11622 \crefname{subfigure}%
11623 {\cyrr\cyri\cyrs\cyru\cyrn\cyro\cyrk}%
11624 {\cyrr\cyri\cyrs\cyru\cyrn\cyrk\cyri}%
11625 \crefname{table}%
11626 {\cyrt\cyra\cyrb\cyrl\cyri\cyrc\cyrya}%
11627 {\cyrt\cyra\cyrb\cyrl\cyri\cyrc\cyrii}%
11628 \crefname{subtable}%
11629 {\cyrt\cyra\cyrb\cyrl\cyri\cyrc\cyrya}%
11630 {\cyrt\cyra\cyrb\cyrl\cyri\cyrc\cyrii}%
11631 \crefname{enumi}%
11632 {\cyrp\cyru\cyrn\cyrk\cyrt}%
11633 {\cyrp\cyru\cyrn\cyrk\cyrt\cyri}%
11634 \crefname{enumii}%
11635 {\cyrp\cyru\cyrn\cyrk\cyrt}%
11636 {\cyrp\cyru\cyrn\cyrk\cyrt\cyri}%
11637 \crefname{enumiii}%
11638 {\cyrp\cyru\cyrn\cyrk\cyrt}%
11639 {\cyrp\cyru\cyrn\cyrk\cyrt\cyri}%
11640 \crefname{enumiv}%
11641 {\cyrp\cyru\cyrn\cyrk\cyrt}%
11642 {\cyrp\cyru\cyrn\cyrk\cyrt\cyri}%
11643 \crefname{enumv}%
11644 {\cyrp\cyru\cyrn\cyrk\cyrt}%
11645 {\cyrp\cyru\cyrn\cyrk\cyrt\cyri}%
11646 \crefname{chapter}%
11647 {\cyrg\cyrl\cyra\cyrv\cyra}%
11648 {\cyrg\cyrl\cyra\cyrv\cyri}%
11649 \crefname{section}%
11650 {\cyrr\cyro\cyrz\cyrd\cyrii\cyrl}%
11651 {\cyrr\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
11652 \crefname{subsection}%
11653 {\cyrr\cyro\cyrz\cyrd\cyrii\cyrl}%
11654 {\cyrr\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
11655 \crefname{subsubsection}%
11656 {\cyrr\cyro\cyrz\cyrd\cyrii\cyrl}%
11657 {\cyrr\cyro\cyrz\cyrd\cyrii\cyrl\cyri}%
11658 \crefname{appendix}%
11659 {\cyrd\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
11660 {\cyrd\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
11661 \crefname{subappendix}%
11662 {\cyrd\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
11663 {\cyrd\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
11664 \crefname{subsubappendix}%
11665 {\cyrd\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
11666 {\cyrd\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
11667 \crefname{subsubsubappendix}%
11668 {\cyrd\cyro\cyrd\cyra\cyrt\cyro\cyrk}%
11669 {\cyrd\cyro\cyrd\cyra\cyrt\cyrk\cyri}%
11670 \crefname{footnote}%
11671 {\cyrv\cyri\cyrn\cyro\cyrs\cyrk\cyra}%
11672 {\cyrv\cyri\cyrn\cyro\cyrs\cyrk\cyri}%
11673 \crefname{theorem}%
11674 {\cyrt\cyre\cyro\cyrr\cyre\cyrm\cyra}%
11675 {\cyrt\cyre\cyro\cyrr\cyre\cyrm\cyri}%
11676 \crefname{lemma}%
11677 {\cyrl\cyre\cyrm\cyrm\cyra}%
11678 {\cyrl\cyre\cyrm\cyrm\cyri}%
11679 \crefname{corollary}%
11680 {\cyrv\cyri\cyrs\cyrn\cyro\cyrv\cyro\cyrk}%
11681 {\cyrv\cyri\cyrs\cyrn\cyro\cyrv\cyrk\cyri}%
11682 \crefname{proposition}%
11683 {\cyrt\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn\cyrya}%
11684 {\cyrt\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn\cyrya}%
11685 \crefname{definition}%
11686 {\cyrv\cyri\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn\cyrya}%
11687 {\cyrv\cyri\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn\cyrya}%
11688 \crefname{result}%
11689 {\cyrr\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt}%
11690 {\cyrr\cyre\cyrz\cyru\cyrl\cyrsftsn\cyrt\cyra\cyrt\cyri}%
11691 \crefname{example}%
11692 {\cyrp\cyrr\cyri\cyrk\cyrl\cyra\cyrd}%
11693 {\cyrp\cyrr\cyri\cyrk\cyrl\cyra\cyrd\cyri}%
11694 \crefname{remark}%
11695 {\cyrp\cyrr\cyri\cyrm\cyrii\cyrt\cyrk\cyra}%
11696 {\cyrp\cyrr\cyri\cyrm\cyrii\cyrt\cyrk\cyri}%
11697 \crefname{note}%
11698 {\cyrz\cyra\cyrm\cyrii\cyrt\cyrk\cyra}%
11699 {\cyrz\cyra\cyrm\cyrii\cyrt\cyrk\cyri}%
11700 \crefname{algorithm}%
11701 {\cyra\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm}%
11702 {\cyra\cyrl\cyrg\cyro\cyrr\cyri\cyrt\cyrm\cyri}%
11703 \crefname{listing}%
11704 {\cyrl\cyrii\cyrs\cyrt\cyri\cyrn\cyrg}%
11705 {\cyrl\cyrii\cyrs\cyrt\cyri\cyrn\cyrg\cyri}%
11706 \crefname{line}%
11707 {\cyrs\cyrt\cyrr\cyro\cyrk\cyra}%
11708 {\cyrs\cyrt\cyrr\cyro\cyrk\cyri}%
11709 \fi%
11710 \crefname{page}%
11711 {\cyrs\cyrt\cyro\cyrr\cyri\cyrn\cyrc\cyrii}%
11712 {\cyrs\cyrt\cyro\cyrr\cyrii\cyrn\cyrk\cyra\cyrh}%
11713 \crefname{part}%
11714 {\cyrch\cyra\cyrs\cyrt\cyri\cyrn\cyra}%
11715 {\cyrch\cyra\cyrs\cyrt\cyri\cyrn\cyri}%
11716 \fi}% end \cref@loadlanguagedefs
11717 % \end{macrocode}
11718 %
11719 %
11720 % \subsubsection{Norwegian}
11721 % \begin{macro}{norsk}
11722 % Norwegian translations kindly donated by Sveinung Heggen.
11723 % \end{macro}
11724 %
11725 % Set up the definitions used at the beginning of the document to define
11726 % the formats created by the document preamble.
11727 % \begin{macrocode}
11728 \DeclareOption{norsk}{%
11729 \AtBeginDocument{%
11730 \def\crefrangeconjunction@preamble{ til\nobreakspace}%
11731 \def\crefrangepreconjunction@preamble{}%
11732 \def\crefrangepostconjunction@preamble{}%
11733 \def\crefpairconjunction@preamble{ og\nobreakspace}%
11734 \def\crefmiddleconjunction@preamble{, }%
11735 \def\creflastconjunction@preamble{ og\nobreakspace}%
11736 % \end{macrocode}
11737 % We have to define the group conjunctions explicitly here, rather than
11738 % relying on fall-back definitions in terms of the above conjunctions
11739 % (see \cref{sec:code:default_formats}), in case any other language
11740 % option defines them explicitly and we need to override those.
11741 % \begin{macrocode}
11742 \def\crefpairgroupconjunction@preamble{ og\nobreakspace}%
11743 \def\crefmiddlegroupconjunction@preamble{, }%
11744 \def\creflastgroupconjunction@preamble{ og\nobreakspace}%
11745 %
11746 \Crefname@preamble{equation}{Likning}{Likningene}%
11747 \Crefname@preamble{figure}{Figur}{Figurene}%
11748 \Crefname@preamble{table}{Tabell}{Tabellene}%
11749 \Crefname@preamble{page}{Side}{Siden}%
11750 \Crefname@preamble{part}{Del}{Delene}%
11751 \Crefname@preamble{chapter}{Kapittel}{Kapitlene}%
11752 \Crefname@preamble{section}{Avsnitt}{Avsnittene}%
11753 \Crefname@preamble{appendix}{Tillegg}{Tilleggene}%
11754 \Crefname@preamble{enumi}{Punkt}{Punktene}%
11755 \Crefname@preamble{footnote}{Fotnote}{Fotnotene}%
11756 \Crefname@preamble{theorem}{Teorem}{Teoremene}%
11757 \Crefname@preamble{lemma}{Lemma}{Lemma}%
11758 \Crefname@preamble{corollary}{Korollar}{Korollarene}%
11759 \Crefname@preamble{proposition}{P\aa stand}{P\aa standene}%
11760 \Crefname@preamble{definition}{Definisjon}{Definisjonene}%
11761 \Crefname@preamble{result}{Resultat}{Resultatene}%
11762 \Crefname@preamble{example}{Eksempel}{Eksemplene}%
11763 \Crefname@preamble{remark}{Bemerkning}{Bemerkningene}%
11764 \Crefname@preamble{note}{Note}{Notene}%
11765 \Crefname@preamble{algorithm}{Algoritme}{Algoritmene}%
11766 \Crefname@preamble{listing}{Opplisting}{Opplistingene}%
11767 \Crefname@preamble{line}{Linje}{Linjene}%
11768 %
11769 \if@cref@capitalise%
11770 \crefname@preamble{page}{Side}{Siden}%
11771 \crefname@preamble{equation}{Likning}{Likningene}%
11772 \crefname@preamble{figure}{Figur}{Figurene}%
11773 \crefname@preamble{table}{Tabell}{Tabellene}%
11774 \crefname@preamble{part}{Del}{Delene}%
11775 \crefname@preamble{chapter}{Kapittel}{Kapitlene}%
11776 \crefname@preamble{section}{Avsnitt}{Avsnittene}%
11777 \crefname@preamble{appendix}{Tillegg}{Tilleggene}%
11778 \crefname@preamble{enumi}{Punkt}{Punktene}%
11779 \crefname@preamble{footnote}{Fotnote}{Fotnotene}%
11780 \crefname@preamble{theorem}{Teorem}{Teoremene}%
11781 \crefname@preamble{lemma}{Lemma}{Lemma}%
11782 \crefname@preamble{corollary}{Korollar}{Korollarene}%
11783 \crefname@preamble{proposition}{P\aa stand}{P\aa standene}%
11784 \crefname@preamble{definition}{Definisjon}{Definisjonene}%
11785 \crefname@preamble{result}{Resultat}{Resultatene}%
11786 \crefname@preamble{example}{Eksempel}{Eksemplene}%
11787 \crefname@preamble{remark}{Bemerkning}{Bemerkningene}%
11788 \crefname@preamble{note}{Note}{Notene}%
11789 \crefname@preamble{algorithm}{Algoritme}{Algoritmene}%
11790 \crefname@preamble{listing}{Opplisting}{Opplistingene}%
11791 \crefname@preamble{line}{Linje}{Linjene}%
11792 %
11793 \else%
11794 \crefname@preamble{equation}{likning}{likningene}%
11795 \crefname@preamble{figure}{figur}{figurene}%
11796 \crefname@preamble{table}{tabell}{tabeller}%
11797 \crefname@preamble{page}{side}{siden}%
11798 \crefname@preamble{part}{del}{delene}%
11799 \crefname@preamble{chapter}{kapittel}{kapitlene}%
11800 \crefname@preamble{section}{avsnitt}{avsnittene}%
11801 \crefname@preamble{appendix}{tillegg}{tilleggene}%
11802 \crefname@preamble{enumi}{punkt}{punktene}%
11803 \crefname@preamble{footnote}{fotnote}{fotnotene}%
11804 \crefname@preamble{theorem}{teorem}{teoremene}%
11805 \crefname@preamble{lemma}{lemma}{lemma}%
11806 \crefname@preamble{corollary}{korollar}{korollarene}%
11807 \crefname@preamble{proposition}{p\aa stand}{p\aa standene}%
11808 \crefname@preamble{definition}{definisjon}{definisjonene}%
11809 \crefname@preamble{result}{resultat}{resultatene}%
11810 \crefname@preamble{example}{eksempel}{eksemplene}%
11811 \crefname@preamble{remark}{bemerkning}{bemerkningene}%
11812 \crefname@preamble{note}{note}{notene}%
11813 \crefname@preamble{algorithm}{algoritme}{algoritmene}%
11814 \crefname@preamble{listing}{opplisting}{opplistingene}%
11815 \crefname@preamble{line}{linje}{linjene}%
11816 \fi%
11817 \def\cref@language{norsk}%
11818 }}% end \DeclareOption and \AtBeginDocument
11819 % \end{macrocode}
11820 %
11821 % If using \package{babel} and the corresponding option is set, or if
11822 % using \package{polyglossia} and the language has been loaded, add
11823 % format definition commands to \cmd{\extras}\meta{language} or
11824 % \cmd{\captions}\meta{language} so that language switching commands will
11825 % change the cross-reference formats appropriately.
11826 % \begin{macrocode}
11827 \cref@addlanguagedefs{norsk}{%
11828 \PackageInfo{cleveref}{loaded `norsk' language definitions}%
11829 \renewcommand{\crefrangeconjunction}{ til\nobreakspace}%
11830 \renewcommand\crefrangepreconjunction{}%
11831 \renewcommand\crefrangepostconjunction{}%
11832 \renewcommand{\crefpairconjunction}{ og\nobreakspace}%
11833 \renewcommand{\crefmiddleconjunction}{, }%
11834 \renewcommand{\creflastconjunction}{ og\nobreakspace}%
11835 \renewcommand{\crefpairgroupconjunction}{ og\nobreakspace}%
11836 \renewcommand{\crefmiddlegroupconjunction}{, }%
11837 \renewcommand{\creflastgroupconjunction}{ og\nobreakspace}%
11838 %
11839 \Crefname{equation}{Likning}{Likningene}%
11840 \Crefname{figure}{Figur}{Figurene}%
11841 \Crefname{subfigure}{Figur}{Figurene}%
11842 \Crefname{table}{Tabell}{Tabellene}%
11843 \Crefname{subtable}{Tabell}{Tabellene}%
11844 \Crefname{page}{Side}{Siden}%
11845 \Crefname{part}{Del}{Delene}%
11846 \Crefname{chapter}{Kapittel}{Kapitlene}%
11847 \Crefname{section}{Avsnitt}{Avsnittene}%
11848 \Crefname{subsection}{Avsnitt}{Avsnittene}%
11849 \Crefname{subsubsection}{Avsnitt}{Avsnittene}%
11850 \Crefname{appendix}{Tillegg}{Tilleggene}%
11851 \Crefname{subappendix}{Tillegg}{Tilleggene}%
11852 \Crefname{subsubappendix}{Tillegg}{Tilleggene}%
11853 \Crefname{subsubsubappendix}{Tillegg}{Tilleggene}%
11854 \Crefname{enumi}{Punkt}{Punktene}%
11855 \Crefname{enumii}{Punkt}{Punktene}%
11856 \Crefname{enumiii}{Punkt}{Punktene}%
11857 \Crefname{enumiv}{Punkt}{Punktene}%
11858 \Crefname{enumv}{Punkt}{Punktene}%
11859 \Crefname{footnote}{Fotnote}{Fotnotene}%
11860 \Crefname{theorem}{Teorem}{Teoremene}%
11861 \Crefname{lemma}{Lemma}{Lemma}%
11862 \Crefname{corollary}{Korollar}{Korollarene}%
11863 \Crefname{proposition}{P\aa stand}{P\aa standene}%
11864 \Crefname{definition}{Definisjon}{Definisjonene}%
11865 \Crefname{result}{Resultat}{Resultatene}%
11866 \Crefname{example}{Eksempel}{Eksemplene}%
11867 \Crefname{remark}{Bemerkning}{Bemerkningene}%
11868 \Crefname{note}{Note}{Notene}%
11869 \Crefname{algorithm}{Algoritme}{Algoritmene}%
11870 \Crefname{listing}{Opplisting}{Opplistingene}%
11871 \Crefname{line}{Linje}{Linjene}%
11872 %
11873 \if@cref@capitalise%
11874 \crefname{equation}{Likning}{Likningene}%
11875 \crefname{figure}{Figur}{Figurene}%
11876 \crefname{subfigure}{Figur}{Figurene}%
11877 \crefname{table}{Tabell}{Tabellene}%
11878 \crefname{subtable}{Tabell}{Tabellene}%
11879 \crefname{page}{Side}{Siden}%
11880 \crefname{part}{Del}{Delene}%
11881 \crefname{chapter}{Kapittel}{Kapitlene}%
11882 \crefname{section}{Avsnitt}{Avsnittene}%
11883 \crefname{subsection}{Avsnitt}{Avsnittene}%
11884 \crefname{subsubsection}{Avsnitt}{Avsnittene}%
11885 \crefname{appendix}{Tillegg}{Tilleggene}%
11886 \crefname{subappendix}{Tillegg}{Tilleggene}%
11887 \crefname{subsubappendix}{Tillegg}{Tilleggene}%
11888 \crefname{subsubsubappendix}{Tillegg}{Tilleggene}%
11889 \crefname{enumi}{Punkt}{Punktene}%
11890 \crefname{enumii}{Punkt}{Punktene}%
11891 \crefname{enumiii}{Punkt}{Punktene}%
11892 \crefname{enumiv}{Punkt}{Punktene}%
11893 \crefname{enumv}{Punkt}{Punktene}%
11894 \crefname{footnote}{Fotnote}{Fotnotene}%
11895 \crefname{theorem}{Teorem}{Teoremene}%
11896 \crefname{lemma}{Lemma}{Lemma}%
11897 \crefname{corollary}{Korollar}{Korollarene}%
11898 \crefname{proposition}{P\aa stand}{P\aa standene}%
11899 \crefname{definition}{Definisjon}{Definisjonene}%
11900 \crefname{result}{Resultat}{Resultatene}%
11901 \crefname{example}{Eksempel}{Eksemplene}%
11902 \crefname{remark}{Bemerkning}{Bemerkningene}%
11903 \crefname{note}{Note}{Notene}%
11904 \crefname{algorithm}{Algoritme}{Algoritmene}%
11905 \crefname{listing}{Opplisting}{Opplistingene}%
11906 \crefname{line}{Linje}{Linjene}%
11907 %
11908 \else%
11909 \crefname{equation}{likning}{likningene}%
11910 \crefname{figure}{figur}{figurene}%
11911 \crefname{subfigure}{figur}{figurene}%
11912 \crefname{table}{tabell}{tabellene}%
11913 \crefname{subtable}{tabell}{tabellene}%
11914 \crefname{page}{side}{siden}%
11915 \crefname{part}{del}{delene}%
11916 \crefname{chapter}{kapittel}{kapitlene}%
11917 \crefname{section}{avsnitt}{avsnittene}%
11918 \crefname{subsection}{avsnitt}{avsnittene}%
11919 \crefname{subsubsection}{avsnitt}{avsnittene}%
11920 \crefname{appendix}{tillegg}{tilleggene}%
11921 \crefname{subappendix}{tillegg}{tilleggene}%
11922 \crefname{subsubappendix}{tillegg}{tilleggene}%
11923 \crefname{subsubsubappendix}{tillegg}{tilleggene}%
11924 \crefname{enumi}{punkt}{punktene}%
11925 \crefname{enumii}{punkt}{punktene}%
11926 \crefname{enumiii}{punkt}{punktene}%
11927 \crefname{enumiv}{punkt}{punktene}%
11928 \crefname{enumv}{punkt}{punktene}%
11929 \crefname{footnote}{fotnote}{fotnotene}%
11930 \crefname{theorem}{teorem}{teoremene}%
11931 \crefname{lemma}{lemma}{lemma}%
11932 \crefname{corollary}{korollar}{korollarene}%
11933 \crefname{proposition}{p\aa stand}{p\aa standene}%
11934 \crefname{definition}{definisjon}{definisjonene}%
11935 \crefname{result}{resultat}{resultatene}%
11936 \crefname{example}{eksempel}{eksemplene}%
11937 \crefname{remark}{bemerkning}{bemerkningene}%
11938 \crefname{note}{note}{notene}%
11939 \crefname{algorithm}{algoritme}{algoritmene}%
11940 \crefname{listing}{opplisting}{opplistingene}%
11941 \crefname{line}{linje}{linjene}%
11942 \fi}% end \cref@loadlanguagedefs
11943 % \end{macrocode}
11944 %
11945 %
11946 % \subsubsection{Danish}
11947 % \begin{macro}{danish}
11948 % Danish translations courtesy of Benjamin H{\o}yer.
11949 % \end{macro}
11950 %
11951 % Set up the definitions used at the beginning of the document to define
11952 % the formats created by the document preamble.
11953 % \begin{macrocode}
11954 \DeclareOption{danish}{%
11955 \AtBeginDocument{%
11956 \def\crefrangeconjunction@preamble{ til\nobreakspace}%
11957 \def\crefrangepreconjunction@preamble{}%
11958 \def\crefrangepostconjunction@preamble{}%
11959 \def\crefpairconjunction@preamble{ og\nobreakspace}%
11960 \def\crefmiddleconjunction@preamble{, }%
11961 \def\creflastconjunction@preamble{ og\nobreakspace}%
11962 % \end{macrocode}
11963 % We have to define the group conjunctions explicitly here, rather than
11964 % relying on fall-back definitions in terms of the above conjunctions
11965 % (see \cref{sec:code:default_formats}), in case any other language
11966 % option defines them explicitly and we need to override those.
11967 % \begin{macrocode}
11968 \def\crefpairgroupconjunction@preamble{ og\nobreakspace}%
11969 \def\crefmiddlegroupconjunction@preamble{, }%
11970 \def\creflastgroupconjunction@preamble{ og\nobreakspace}%
11971 %
11972 \Crefname@preamble{equation}{Ligning}{Ligninger}%
11973 \Crefname@preamble{figure}{Figur}{Figurer}%
11974 \Crefname@preamble{table}{Tabel}{Tabeller}%
11975 \Crefname@preamble{page}{Side}{Sider}%
11976 \Crefname@preamble{part}{Del}{Dele}%
11977 \Crefname@preamble{chapter}{Kapitel}{Kapitler}%
11978 \Crefname@preamble{section}{Afsnit}{Afsnit}%
11979 \Crefname@preamble{appendix}{Appendiks}{Appendiks}%
11980 \Crefname@preamble{enumi}{Punkt}{Punkter}%
11981 \Crefname@preamble{footnote}{Fodnote}{Fodnoter}%
11982 \Crefname@preamble{theorem}{Teorem}{Teoremer}%
11983 \Crefname@preamble{lemma}{Lemma}{Lemma}%
11984 \Crefname@preamble{corollary}{F\o lgeslutning}{F\o lgeslutninger}%
11985 \Crefname@preamble{proposition}{Udsagn}{Udsagn}%
11986 \Crefname@preamble{definition}{Definition}{Definitioner}%
11987 \Crefname@preamble{result}{Resultat}{Resultater}%
11988 \Crefname@preamble{example}{Eksempel}{Eksempler}%
11989 \Crefname@preamble{remark}{Bem\ae rkning}{Bem\ae rkninger}%
11990 \Crefname@preamble{note}{Note}{Noter}%
11991 \Crefname@preamble{algorithm}{Algoritme}{Algoritmer}%
11992 \Crefname@preamble{line}{Linje}{Linjer}%
11993 %
11994 \if@cref@capitalise%
11995 \crefname@preamble{equation}{Ligning}{Ligninger}%
11996 \crefname@preamble{figure}{Figur}{Figurer}%
11997 \crefname@preamble{table}{Tabel}{Tabeller}%
11998 \crefname@preamble{page}{Side}{Sider}%
11999 \crefname@preamble{part}{Del}{Dele}%
12000 \crefname@preamble{chapter}{Kapitel}{Kapitler}%
12001 \crefname@preamble{section}{Afsnit}{Afsnit}%
12002 \crefname@preamble{appendix}{Appendiks}{Appendiks}%
12003 \crefname@preamble{enumi}{Punkt}{Punkter}%
12004 \crefname@preamble{footnote}{Fodnote}{Fodnoter}%
12005 \crefname@preamble{theorem}{Teorem}{Teoremer}%
12006 \crefname@preamble{lemma}{Lemma}{Lemma}%
12007 \crefname@preamble{corollary}{F\o lgeslutning}{F\o lgeslutninger}%
12008 \crefname@preamble{proposition}{Udsagn}{Udsagn}%
12009 \crefname@preamble{definition}{Definition}{Definitioner}%
12010 \crefname@preamble{result}{Resultat}{Resultater}%
12011 \crefname@preamble{example}{Eksempel}{Eksempler}%
12012 \crefname@preamble{remark}{Bem\ae rkning}{Bem\ae rkninger}%
12013 \crefname@preamble{note}{Note}{Noter}%
12014 \crefname@preamble{algorithm}{Algoritme}{Algoritmer}%
12015 \crefname@preamble{line}{Linje}{Linjer}%
12016 %
12017 \else%
12018 \crefname@preamble{equation}{ligning}{ligninger}%
12019 \crefname@preamble{figure}{figur}{figurer}%
12020 \crefname@preamble{table}{tabel}{tabeller}%
12021 \crefname@preamble{page}{side}{sider}%
12022 \crefname@preamble{part}{del}{dele}%
12023 \crefname@preamble{chapter}{kapitel}{kapitler}%
12024 \crefname@preamble{section}{afsnit}{afsnit}%
12025 \crefname@preamble{appendix}{appendiks}{appendiks}%
12026 \crefname@preamble{enumi}{punkt}{punkter}%
12027 \crefname@preamble{footnote}{fodnote}{fodnoter}%
12028 \crefname@preamble{theorem}{teorem}{teoremer}%
12029 \crefname@preamble{lemma}{lemma}{lemma}%
12030 \crefname@preamble{corollary}{f\o lgeslutning}{f\o lgeslutninger}%
12031 \crefname@preamble{proposition}{udsagn}{udsagn}%
12032 \crefname@preamble{definition}{definition}{definitioner}%
12033 \crefname@preamble{result}{resultat}{resultater}%
12034 \crefname@preamble{example}{eksempel}{eksempler}%
12035 \crefname@preamble{remark}{bem\ae rkning}{bem\ae rkninger}%
12036 \crefname@preamble{note}{note}{noter}%
12037 \crefname@preamble{algorithm}{algoritme}{algoritmer}%
12038 \crefname@preamble{line}{linje}{linjer}%
12039 \fi%
12040 \def\cref@language{danish}%
12041 }}% end \DeclareOption and \AtBeginDocument
12042 % \end{macrocode}
12043 %
12044 % If using \package{babel} and the corresponding option is set, or if
12045 % using \package{polyglossia} and the language has been loaded, add
12046 % format definition commands to \cmd{\extras}\meta{language} or
12047 % \cmd{\captions}\meta{language} so that language switching commands will
12048 % change the cross-reference formats appropriately.
12049 % \begin{macrocode}
12050 \cref@addlanguagedefs{danish}{%
12051 \PackageInfo{cleveref}{loaded `danish' language definitions}%
12052 \renewcommand{\crefrangeconjunction@preamble}{ til\nobreakspace}%
12053 \renewcommand\crefrangepreconjunction@preamble{}%
12054 \renewcommand\crefrangepostconjunction@preamble{}%
12055 \renewcommand{\crefpairconjunction@preamble}{ og\nobreakspace}%
12056 \renewcommand{\crefmiddleconjunction@preamble}{, }%
12057 \renewcommand{\creflastconjunction@preamble}{ og\nobreakspace}%
12058 \renewcommand{\crefpairgroupconjunction@preamble}{ og\nobreakspace}%
12059 \renewcommand{\crefmiddlegroupconjunction@preamble}{, }%
12060 \renewcommand{\creflastgroupconjunction@preamble}{ og\nobreakspace}%
12061 %
12062 \Crefname{equation}{Ligning}{Ligninger}%
12063 \Crefname{figure}{Figur}{Figurer}%
12064 \Crefname{subfigure}{Figur}{Figurer}%
12065 \Crefname{table}{Tabel}{Tabeller}%
12066 \Crefname{subtable}{Tabel}{Tabeller}%
12067 \Crefname{page}{Side}{Sider}%
12068 \Crefname{part}{Del}{Dele}%
12069 \Crefname{chapter}{Kapitel}{Kapitler}%
12070 \Crefname{section}{Afsnit}{Afsnit}%
12071 \Crefname{subsection}{Afsnit}{Afsnit}%
12072 \Crefname{subsubsection}{Afsnit}{Afsnit}%
12073 \Crefname{appendix}{Appendiks}{Appendiks}%
12074 \Crefname{subappendix}{Appendiks}{Appendiks}%
12075 \Crefname{subsubappendix}{Appendiks}{Appendiks}%
12076 \Crefname{subsubsubappendix}{Appendiks}{Appendiks}%
12077 \Crefname{enumi}{Punkt}{Punkter}%
12078 \Crefname{enumii}{Punkt}{Punkter}%
12079 \Crefname{enumiii}{Punkt}{Punkter}%
12080 \Crefname{enumiv}{Punkt}{Punkter}%
12081 \Crefname{enumv}{Punkt}{Punkter}%
12082 \Crefname{footnote}{Fodnote}{Fodnoter}%
12083 \Crefname{theorem}{Teorem}{Teoremer}%
12084 \Crefname{lemma}{Lemma}{Lemma}%
12085 \Crefname{corollary}{F\o lgeslutning}{F\o lgeslutninger}%
12086 \Crefname{proposition}{Udsagn}{Udsagn}%
12087 \Crefname{definition}{Definition}{Definitioner}%
12088 \Crefname{result}{Resultat}{Resultater}%
12089 \Crefname{example}{Eksempel}{Eksempler}%
12090 \Crefname{remark}{Bem\ae rkning}{Bem\ae rkninger}%
12091 \Crefname{note}{Note}{Noter}%
12092 \Crefname{algorithm}{Algoritme}{Algoritmer}%
12093 \Crefname{line}{Linje}{Linjer}%
12094 %
12095 \if@cref@capitalise%
12096 \crefname{equation}{Ligning}{Ligninger}%
12097 \crefname{figure}{Figur}{Figurer}%
12098 \crefname{subfigure}{Figur}{Figurer}%
12099 \crefname{table}{Tabel}{Tabeller}%
12100 \crefname{subtable}{Tabel}{Tabeller}%
12101 \crefname{page}{Side}{Sider}%
12102 \crefname{part}{Del}{Dele}%
12103 \crefname{chapter}{Kapitel}{Kapitler}%
12104 \crefname{section}{Afsnit}{Afsnit}%
12105 \crefname{subsection}{Afsnit}{Afsnit}%
12106 \crefname{subsubsection}{Afsnit}{Afsnit}%
12107 \crefname{appendix}{Appendiks}{Appendiks}%
12108 \crefname{subappendix}{Appendiks}{Appendiks}%
12109 \crefname{subsubappendix}{Appendiks}{Appendiks}%
12110 \crefname{subsubsubappendix}{Appendiks}{Appendiks}%
12111 \crefname{enumi}{Punkt}{Punkter}%
12112 \crefname{enumii}{Punkt}{Punkter}%
12113 \crefname{enumiii}{Punkt}{Punkter}%
12114 \crefname{enumiv}{Punkt}{Punkter}%
12115 \crefname{enumv}{Punkt}{Punkter}%
12116 \crefname{footnote}{Fodnote}{Fodnoter}%
12117 \crefname{theorem}{Teorem}{Teoremer}%
12118 \crefname{lemma}{Lemma}{Lemma}%
12119 \crefname{corollary}{F\o lgeslutning}{F\o lgeslutninger}%
12120 \crefname{proposition}{Udsagn}{Udsagn}%
12121 \crefname{definition}{Definition}{Definitioner}%
12122 \crefname{result}{Resultat}{Resultater}%
12123 \crefname{example}{Eksempel}{Eksempler}%
12124 \crefname{remark}{Bem\ae rkning}{Bem\ae rkninger}%
12125 \crefname{note}{Note}{Noter}%
12126 \crefname{algorithm}{Algoritme}{Algoritmer}%
12127 \crefname{line}{Linje}{Linjer}%
12128 %
12129 \else%
12130 \crefname{equation}{ligning}{ligninger}%
12131 \crefname{figure}{figur}{figurer}%
12132 \crefname{subfigure}{figur}{figurer}%
12133 \crefname{table}{tabel}{tabeller}%
12134 \crefname{subtable}{tabel}{tabeller}%
12135 \crefname{page}{side}{sider}%
12136 \crefname{part}{del}{dele}%
12137 \crefname{chapter}{kapitel}{kapitler}%
12138 \crefname{section}{afsnit}{afsnit}%
12139 \crefname{subsection}{afsnit}{afsnit}%
12140 \crefname{subsubsection}{afsnit}{afsnit}%
12141 \crefname{appendix}{appendiks}{appendiks}%
12142 \crefname{subappendix}{appendiks}{appendiks}%
12143 \crefname{subsubappendix}{appendiks}{appendiks}%
12144 \crefname{subsubsubappendix}{appendiks}{appendiks}%
12145 \crefname{enumi}{punkt}{punkter}%
12146 \crefname{enumii}{punkt}{punkter}%
12147 \crefname{enumiii}{punkt}{punkter}%
12148 \crefname{enumiv}{punkt}{punkter}%
12149 \crefname{enumv}{punkt}{punkter}%
12150 \crefname{footnote}{fodnote}{fodnoter}%
12151 \crefname{theorem}{teorem}{teoremer}%
12152 \crefname{lemma}{lemma}{lemma}%
12153 \crefname{corollary}{f\o lgeslutning}{f\o lgeslutninger}%
12154 \crefname{proposition}{udsagn}{udsagn}%
12155 \crefname{definition}{definition}{definitioner}%
12156 \crefname{result}{resultat}{resultater}%
12157 \crefname{example}{eksempel}{eksempler}%
12158 \crefname{remark}{bem\ae rkning}{bem\ae rkninger}%
12159 \crefname{note}{note}{noter}%
12160 \crefname{algorithm}{algoritme}{algoritmer}%
12161 \crefname{line}{linje}{linjer}%
12162 \fi}% end \cref@loadlanguagedefs
12163 % \end{macrocode}
12164 %
12165 %
12166 % \subsubsection{Esperanto}
12167 % \begin{macro}{esperanto}
12168 % Esperanto translations courtesy of Johannes Mueller.
12169 % \end{macro}
12170 %
12171 % Set up the definitions used at the beginning of the document to define
12172 % the formats created by the document preamble.
12173 % \begin{macrocode}
12174 \DeclareOption{esperanto}{%
12175 \AtBeginDocument{%
12176 \def\crefrangeconjunction@preamble{ \^gis\nobreakspace}%
12177 \def\crefrangepreconjunction@preamble{}%
12178 \def\crefrangepostconjunction@preamble{}%
12179 \def\crefpairconjunction@preamble{ kaj\nobreakspace}%
12180 \def\crefmiddleconjunction@preamble{, }%
12181 \def\creflastconjunction@preamble{ kaj\nobreakspace}%
12182 \def\crefpairgroupconjunction@preamble{ kaj\nobreakspace}%
12183 \def\crefmiddlegroupconjunction@preamble{, }%
12184 \def\creflastgroupconjunction@preamble{ kaj\nobreakspace}%
12185 %
12186 \Crefname@preamble{equation}{Ekvacio}{Ekvacioj}%
12187 \Crefname@preamble{part}{Parto}{Partoj}%
12188 \Crefname@preamble{chapter}{\^Capitro}{\^Capitroj}%
12189 \Crefname@preamble{section}{Sekcio}{Sekcioj}%
12190 \Crefname@preamble{appendix}{Aldono}{Aldonoj}%
12191 \Crefname@preamble{enumi}{Punkto}{Punktoj}%
12192 \Crefname@preamble{footnote}{Piednoto}{Piednotoj}%
12193 \Crefname@preamble{figure}{Figuro}{Figuroj}%
12194 \Crefname@preamble{table}{Tabelo}{Tabeloj}%
12195 \Crefname@preamble{theorem}{Teoremo}{Teoremoj}%
12196 \Crefname@preamble{lemma}{Lemo}{Lemoj}%
12197 \Crefname@preamble{corollary}{Korolario}{Korolarioj}%
12198 \Crefname@preamble{proposition}{Propozicio}{Propozicioj}%
12199 \Crefname@preamble{definition}{Defino}{Definoj}%
12200 \Crefname@preamble{result}{Rezulto}{Rezultoj}%
12201 \Crefname@preamble{example}{Ekzemplo}{Ekzemploj}%
12202 \Crefname@preamble{remark}{Rimarko}{Rimarkoj}%
12203 \Crefname@preamble{note}{Noto}{Notoj}%
12204 \Crefname@preamble{algorithm}{Algoritmo}{Algoritmoj}%
12205 \Crefname@preamble{listing}{Listado}{Listadoj}%
12206 \Crefname@preamble{line}{Linio}{Linioj}%
12207 %
12208 \if@cref@capitalise%
12209 \crefname@preamble{equation}{Ekvacio}{Ekvacioj}%
12210 \crefname@preamble{part}{Parto}{Partoj}%
12211 \crefname@preamble{chapter}{\^Capitro}{\^Capitroj}%
12212 \crefname@preamble{section}{Sekcio}{Sekcioj}%
12213 \crefname@preamble{appendix}{Aldono}{Aldonoj}%
12214 \crefname@preamble{enumi}{Punkto}{Punktoj}%
12215 \crefname@preamble{footnote}{Piednoto}{Piednotoj}%
12216 \crefname@preamble{figure}{Figuro}{Figuroj}%
12217 \crefname@preamble{table}{Tabelo}{Tabeloj}%
12218 \crefname@preamble{theorem}{Teoremo}{Teoremoj}%
12219 \crefname@preamble{lemma}{Lemo}{Lemoj}%
12220 \crefname@preamble{corollary}{Korolario}{Korolarioj}%
12221 \crefname@preamble{proposition}{Propozicio}{Propozicioj}%
12222 \crefname@preamble{definition}{Defino}{Definoj}%
12223 \crefname@preamble{result}{Rezulto}{Rezultoj}%
12224 \crefname@preamble{example}{Ekzemplo}{Ekzemploj}%
12225 \crefname@preamble{remark}{Rimarko}{Rimarkoj}%
12226 \crefname@preamble{note}{Noto}{Notoj}%
12227 \crefname@preamble{algorithm}{Algoritmo}{Algoritmoj}%
12228 \crefname@preamble{listing}{Listado}{Listadoj}%
12229 \crefname@preamble{line}{Linio}{Linioj}%
12230 %
12231 \else%
12232 \crefname@preamble{equation}{ekvacio}{ekvacioj}%
12233 \crefname@preamble{part}{parto}{partoj}%
12234 \crefname@preamble{chapter}{\^capitro}{\^capitroj}%
12235 \crefname@preamble{section}{sekcio}{sekcioj}%
12236 \crefname@preamble{appendix}{aldono}{aldonoj}%
12237 \crefname@preamble{enumi}{punkto}{punktoj}%
12238 \crefname@preamble{footnote}{piednoto}{piednotoj}%
12239 \crefname@preamble{figure}{figuro}{figuroj}%
12240 \crefname@preamble{table}{tabelo}{tabeloj}%
12241 \crefname@preamble{theorem}{teoremo}{teoremoj}%
12242 \crefname@preamble{lemma}{lemo}{lemoj}%
12243 \crefname@preamble{corollary}{korolario}{korolarioj}%
12244 \crefname@preamble{proposition}{propozicio}{propozicioj}%
12245 \crefname@preamble{definition}{defino}{definoj}%
12246 \crefname@preamble{result}{rezulto}{rezultoj}%
12247 \crefname@preamble{example}{ekzemplo}{ekzemploj}%
12248 \crefname@preamble{remark}{rimarko}{rimarkoj}%
12249 \crefname@preamble{note}{noto}{notoj}%
12250 \crefname@preamble{algorithm}{algoritmo}{algoritmoj}%
12251 \crefname@preamble{listing}{listado}{listadoj}%
12252 \crefname@preamble{line}{linio}{linioj}%
12253 \fi%
12254 \def\cref@language{esperanto}%
12255 }}% end \DeclareOption and \AtBeginDocument
12256 % \end{macrocode}
12257 %
12258 % If using \package{babel} and the corresponding option is set, or if
12259 % using \package{polyglossia} and the language has been loaded, add
12260 % format definition commands to \cmd{\extras}\meta{language} or
12261 % \cmd{\captions}\meta{language} so that language switching commands will
12262 % change the cross-reference formats appropriately.
12263 % \begin{macrocode}
12264 \cref@addlanguagedefs{esperanto}{%
12265 \PackageInfo{cleveref}{loaded `esperanto' language definitions}%
12266 \renewcommand{\crefrangeconjunction}{ \^gis\nobreakspace}%
12267 \renewcommand{\crefrangepreconjunction}{}%
12268 \renewcommand{\crefrangepostconjunction}{}%
12269 \renewcommand{\crefpairconjunction}{ kaj\nobreakspace}%
12270 \renewcommand{\crefmiddleconjunction}{, }%
12271 \renewcommand{\creflastconjunction}{ kaj\nobreakspace}%
12272 \renewcommand{\crefpairgroupconjunction}{ kaj\nobreakspace}%
12273 \renewcommand{\crefmiddlegroupconjunction}{, }%
12274 \renewcommand{\creflastgroupconjunction}{ kaj\nobreakspace}%
12275 %
12276 \Crefname{equation}{Ekvacio}{Ekvacioj}%
12277 \Crefname{part}{Parto}{Partoj}%
12278 \Crefname{chapter}{\^Capitro}{\^Capitroj}%
12279 \Crefname{section}{Sekcio}{Sekcioj}%
12280 \Crefname{appendix}{Aldono}{Aldonoj}%
12281 \Crefname{enumi}{Punkto}{Punktoj}%
12282 \Crefname{footnote}{Piednoto}{Piednotoj}%
12283 \Crefname{figure}{Figuro}{Figuroj}%
12284 \Crefname{table}{Tabelo}{Tabeloj}%
12285 \Crefname{theorem}{Teoremo}{Teoremoj}%
12286 \Crefname{lemma}{Lemo}{Lemoj}%
12287 \Crefname{corollary}{Korolario}{Korolarioj}%
12288 \Crefname{proposition}{Propozicio}{Propozicioj}%
12289 \Crefname{definition}{Defino}{Definoj}%
12290 \Crefname{result}{Rezulto}{Rezultoj}%
12291 \Crefname{example}{Ekzemplo}{Ekzemploj}%
12292 \Crefname{remark}{Rimarko}{Rimarkoj}%
12293 \Crefname{note}{Noto}{Notoj}%
12294 \Crefname{algorithm}{Algoritmo}{Algoritmoj}%
12295 \Crefname{listing}{Listado}{Listadoj}%
12296 \Crefname{line}{Linio}{Linioj}%
12297 %
12298 \if@cref@capitalise%
12299 \crefname{equation}{Ekvacio}{Ekvacioj}%
12300 \crefname{part}{Parto}{Partoj}%
12301 \crefname{chapter}{\^Capitro}{\^Capitroj}%
12302 \crefname{section}{Sekcio}{Sekcioj}%
12303 \crefname{appendix}{Aldono}{Aldonoj}%
12304 \crefname{enumi}{Punkto}{Punktoj}%
12305 \crefname{footnote}{Piednoto}{Piednotoj}%
12306 \crefname{figure}{Figuro}{Figuroj}%
12307 \crefname{table}{Tabelo}{Tabeloj}%
12308 \crefname{theorem}{Teoremo}{Teoremoj}%
12309 \crefname{lemma}{Lemo}{Lemoj}%
12310 \crefname{corollary}{Korolario}{Korolarioj}%
12311 \crefname{proposition}{Propozicio}{Propozicioj}%
12312 \crefname{definition}{Defino}{Definoj}%
12313 \crefname{result}{Rezulto}{Rezultoj}%
12314 \crefname{example}{Ekzemplo}{Ekzemploj}%
12315 \crefname{remark}{Rimarko}{Rimarkoj}%
12316 \crefname{note}{Noto}{Notoj}%
12317 \crefname{algorithm}{Algoritmo}{Algoritmoj}%
12318 \crefname{listing}{Listado}{Listadoj}%
12319 \crefname{line}{Linio}{Linioj}%
12320 %
12321 \else%
12322 \crefname{equation}{ekvacio}{ekvacioj}%
12323 \crefname{part}{parto}{partoj}%
12324 \crefname{chapter}{\^capitro}{\^capitroj}%
12325 \crefname{section}{sekcio}{sekcioj}%
12326 \crefname{appendix}{aldono}{aldonoj}%
12327 \crefname{enumi}{punkto}{punktoj}%
12328 \crefname{footnote}{piednoto}{piednotoj}%
12329 \crefname{figure}{figuro}{figuroj}%
12330 \crefname{table}{tabelo}{tabeloj}%
12331 \crefname{theorem}{teoremo}{teoremoj}%
12332 \crefname{lemma}{lemo}{lemoj}%
12333 \crefname{corollary}{korolario}{korolarioj}%
12334 \crefname{proposition}{propozicio}{propozicioj}%
12335 \crefname{definition}{defino}{definoj}%
12336 \crefname{result}{rezulto}{rezultoj}%
12337 \crefname{example}{ekzemplo}{ekzemploj}%
12338 \crefname{remark}{rimarko}{rimarkoj}%
12339 \crefname{note}{noto}{notoj}%
12340 \crefname{algorithm}{algoritmo}{algoritmoj}%
12341 \crefname{listing}{listado}{listadoj}%
12342 \crefname{line}{linio}{linioj}%
12343 \fi}% end \cref@loadlanguagedefs
12344 % \end{macrocode}
12345 %
12346 %
12347 % \subsubsection{Swedish}
12348 % \begin{macro}{swedish}
12349 % Swedish definitions thanks to Simon Sigurdhsson.
12350 % \end{macro}
12351 %
12352 % Set up the definitions used at the beginning of the document to define
12353 % the formats created by the document preamble.
12354 % \begin{macrocode}
12355 \DeclareOption{swedish}{%
12356 \AtBeginDocument{%
12357 \def\crefrangeconjunction@preamble{ till\nobreakspace}%
12358 \def\crefrangepreconjunction@preamble{}%
12359 \def\crefrangepostconjunction@preamble{}%
12360 \def\crefpairconjunction@preamble{ och\nobreakspace}%
12361 \def\crefmiddleconjunction@preamble{, }%
12362 \def\creflastconjunction@preamble{ och\nobreakspace}%
12363 % \end{macrocode}
12364 % We have to define the group conjunctions explicitly here, rather than
12365 % relying on fall-back definitions in terms of the above conjunctions
12366 % (see \cref{sec:code:default_formats}), in case any other language
12367 % option defines them explicitly and we need to override those.
12368 % \begin{macrocode}
12369 \def\crefpairgroupconjunction@preamble{ och\nobreakspace}%
12370 \def\crefmiddlegroupconjunction@preamble{, }%
12371 \def\creflastgroupconjunction@preamble{, och\nobreakspace}%
12372 %
12373 \Crefname@preamble{equation}{Ekvation}{Ekvation}%
12374 \Crefname@preamble{figure}{Figur}{Figur}%
12375 \Crefname@preamble{table}{Tabell}{Tabell}%
12376 \Crefname@preamble{page}{Sida}{Sida}%
12377 \Crefname@preamble{part}{Del}{Del}%
12378 \Crefname@preamble{chapter}{Kapitel}{Kapitel}%
12379 \Crefname@preamble{section}{Avsnitt}{Avsnitt}%
12380 \Crefname@preamble{appendix}{Appendix}{Appendix}%
12381 \Crefname@preamble{enumi}{Punkt}{Punkt}%
12382 \Crefname@preamble{footnote}{Fotnot}{Fotnot}%
12383 \Crefname@preamble{theorem}{Sats}{Sats}%
12384 \Crefname@preamble{lemma}{Lemma}{Lemmas}%
12385 \Crefname@preamble{corollary}{F\"oljdsats}{F\"oljdsats}%
12386 \Crefname@preamble{proposition}{Proposition}{Proposition}%
12387 \Crefname@preamble{definition}{Definition}{Definition}%
12388 \Crefname@preamble{result}{Resultat}{Resultat}%
12389 \Crefname@preamble{example}{Exempel}{Exempel}%
12390 \Crefname@preamble{remark}{Anm\"arkning}{Anm\"arkning}%
12391 \Crefname@preamble{note}{Notering}{Notering}%
12392 \Crefname@preamble{algorithm}{Algoritm}{Algoritm}%
12393 \Crefname@preamble{listing}{Kodlistning}{Kodlistning}%
12394 \Crefname@preamble{line}{Rad}{Rad}%
12395 %
12396 \if@cref@capitalise% capitalise set
12397 \if@cref@abbrev%
12398 \crefname@preamble{equation}{Ekv.}{Ekv.}%
12399 \crefname@preamble{figure}{Fig.}{Fig.}%
12400 \else%
12401 \crefname@preamble{equation}{Ekvation}{Ekvation}%
12402 \crefname@preamble{figure}{Figur}{Figur}%
12403 \fi%
12404 \crefname@preamble{page}{Sida}{Sida}%
12405 \crefname@preamble{table}{Tabell}{Tabell}%
12406 \crefname@preamble{part}{Del}{Del}%
12407 \crefname@preamble{chapter}{Kapitel}{Kapitel}%
12408 \crefname@preamble{section}{Avsnitt}{Avsnitt}%
12409 \crefname@preamble{appendix}{Appendix}{Appendix}%
12410 \crefname@preamble{enumi}{Punkt}{Punkt}%
12411 \crefname@preamble{footnote}{Fotnot}{Fotnot}%
12412 \crefname@preamble{theorem}{Sats}{Sats}%
12413 \crefname@preamble{lemma}{Lemma}{Lemmas}%
12414 \crefname@preamble{corollary}{F\"oljdsats}{F\"oljdsats}%
12415 \crefname@preamble{proposition}{Proposition}{Proposition}%
12416 \crefname@preamble{definition}{Definition}{Definition}%
12417 \crefname@preamble{result}{Resultat}{Resultat}%
12418 \crefname@preamble{example}{Exempel}{Exempel}%
12419 \crefname@preamble{remark}{Anm\"arkning}{Anm\"arkning}%
12420 \crefname@preamble{note}{Notering}{Notering}%
12421 \crefname@preamble{algorithm}{Algoritm}{Algoritm}%
12422 \crefname@preamble{listing}{Kodlistning}{Kodlistning}%
12423 \crefname@preamble{line}{Rad}{Rad}%
12424 %
12425 \else% capitalise unset
12426 \if@cref@abbrev%
12427 \crefname@preamble{equation}{ekv.}{ekv.}%
12428 \crefname@preamble{figure}{fig.}{fig.}%
12429 \crefname@preamble{page}{s.}{ss.}%
12430 \else%
12431 \crefname@preamble{equation}{ekvation}{ekvation}%
12432 \crefname@preamble{figure}{figur}{figur}%
12433 \crefname@preamble{page}{sida}{sida}%
12434 \fi%
12435 \crefname@preamble{table}{tabell}{tabell}%
12436 \crefname@preamble{part}{del}{del}%
12437 \crefname@preamble{chapter}{kapitel}{kapitel}%
12438 \crefname@preamble{section}{avsnitt}{avsnitt}%
12439 \crefname@preamble{appendix}{appendix}{appendix}%
12440 \crefname@preamble{enumi}{punkt}{punkt}%
12441 \crefname@preamble{footnote}{fotnot}{fotnot}%
12442 \crefname@preamble{theorem}{sats}{sats}%
12443 \crefname@preamble{lemma}{lemma}{lemmas}%
12444 \crefname@preamble{corollary}{f\"oljdsats}{f\"oljdsats}%
12445 \crefname@preamble{proposition}{proposition}{proposition}%
12446 \crefname@preamble{definition}{definition}{definition}%
12447 \crefname@preamble{result}{resultat}{resultat}%
12448 \crefname@preamble{example}{exempel}{exempel}%
12449 \crefname@preamble{remark}{anm\"arkning}{anm\"arkning}%
12450 \crefname@preamble{note}{notering}{notering}%
12451 \crefname@preamble{algorithm}{algoritm}{algoritm}%
12452 \crefname@preamble{listing}{kodlistning}{kodlistning}%
12453 \crefname@preamble{line}{rad}{rad}%
12454 \fi%
12455 \def\cref@language{swedish}%
12456 }}% end \AtBeginDocument and \DeclareOption
12457 % \end{macrocode}
12458 %
12459 % If using \package{babel} and the corresponding option is set, or if
12460 % using \package{polyglossia} and the language has been loaded, add
12461 % format definition commands to \cmd{\extras}\meta{language} or
12462 % \cmd{\captions}\meta{language} so that language switching commands will
12463 % change the cross-reference formats appropriately.
12464 % \begin{macrocode}
12465 \cref@addlanguagedefs{swedish}{%
12466 \PackageInfo{cleveref}{loaded `swedish' language definitions}%
12467 \renewcommand{\crefrangeconjunction}{ till\nobreakspace}%
12468 \renewcommand\crefrangepreconjunction{}%
12469 \renewcommand\crefrangepostconjunction{}%
12470 \renewcommand{\crefpairconjunction}{ och\nobreakspace}%
12471 \renewcommand{\crefmiddleconjunction}{, }%
12472 \renewcommand{\creflastconjunction}{ och\nobreakspace}%
12473 \renewcommand{\crefpairgroupconjunction}{ and\nobreakspace}%
12474 \renewcommand{\crefmiddlegroupconjunction}{, }%
12475 \renewcommand{\creflastgroupconjunction}{, and\nobreakspace}%
12476 %
12477 \Crefname{equation}{Ekvation}{Ekvation}%
12478 \Crefname{figure}{Figur}{Figur}%
12479 \Crefname{subfigure}{Figur}{Figur}%
12480 \Crefname{table}{Tabell}{Tabell}%
12481 \Crefname{subtable}{Tabell}{Tabell}%
12482 \Crefname{page}{Sida}{Sida}%
12483 \Crefname{part}{Del}{Del}%
12484 \Crefname{chapter}{Kapitel}{Kapitel}%
12485 \Crefname{section}{Avsnitt}{Avsnitt}%
12486 \Crefname{subsection}{Avsnitt}{Avsnitt}%
12487 \Crefname{subsubsection}{Avsnitt}{Avsnitt}%
12488 \Crefname{appendix}{Appendix}{Appendix}%
12489 \Crefname{subappendix}{Appendix}{Appendix}%
12490 \Crefname{subsubappendix}{Appendix}{Appendix}%
12491 \Crefname{subsubsubappendix}{Appendix}{Appendix}%
12492 \Crefname{enumi}{Punkt}{Punkt}%
12493 \Crefname{enumii}{Punkt}{Punkt}%
12494 \Crefname{enumiii}{Punkt}{Punkt}%
12495 \Crefname{enumiv}{Punkt}{Punkt}%
12496 \Crefname{enumv}{Punkt}{Punkt}%
12497 \Crefname{footnote}{Fotnot}{Fotnot}%
12498 \Crefname{theorem}{Sats}{Sats}%
12499 \Crefname{lemma}{Lemma}{Lemmas}%
12500 \Crefname{corollary}{F\"oljdsats}{F\"oljdsats}%
12501 \Crefname{proposition}{Proposition}{Proposition}%
12502 \Crefname{definition}{Definition}{Definition}%
12503 \Crefname{result}{Resultat}{Resultat}%
12504 \Crefname{example}{Exempel}{Exempel}%
12505 \Crefname{remark}{Anm\"arkning}{Anm\"arkning}%
12506 \Crefname{note}{Notering}{Notering}%
12507 \Crefname{algorithm}{Algoritm}{Algoritm}%
12508 \Crefname{listing}{Kodlistning}{Kodlistning}%
12509 \Crefname{line}{Rad}{Rad}%
12510 %
12511 \if@cref@capitalise% capitalise set
12512 \if@cref@abbrev%
12513 \crefname{equation}{Ekv.}{Ekv.}%
12514 \crefname{figure}{Fig.}{Fig.}%
12515 \crefname{subfigure}{Fig.}{Fig.}%
12516 \else%
12517 \crefname{equation}{Ekvation}{Ekvation}%
12518 \crefname{figure}{Figur}{Figur}%
12519 \crefname{subfigure}{Figur}{Figur}%
12520 \fi%
12521 \crefname{page}{Sida}{Sida}%
12522 \crefname{table}{Tabell}{Tabell}%
12523 \crefname{subtable}{Tabell}{Tabell}%
12524 \crefname{part}{Del}{Del}%
12525 \crefname{chapter}{Kapitel}{Kapitel}%
12526 \crefname{section}{Avsnitt}{Avsnitt}%
12527 \crefname{subsection}{Avsnitt}{Avsnitt}%
12528 \crefname{subsubsection}{Avsnitt}{Avsnitt}%
12529 \crefname{appendix}{Appendix}{Appendix}%
12530 \crefname{subappendix}{Appendix}{Appendix}%
12531 \crefname{subsubappendix}{Appendix}{Appendix}%
12532 \crefname{subsubsubappendix}{Appendix}{Appendix}%
12533 \crefname{enumi}{Punkt}{Punkt}%
12534 \crefname{enumii}{Punkt}{Punkt}%
12535 \crefname{enumiii}{Punkt}{Punkt}%
12536 \crefname{enumiv}{Punkt}{Punkt}%
12537 \crefname{enumv}{Punkt}{Punkt}%
12538 \crefname{footnote}{Fotnot}{Fotnot}%
12539 \crefname{theorem}{Sats}{Sats}%
12540 \crefname{lemma}{Lemma}{Lemmas}%
12541 \crefname{corollary}{F\"oljdsats}{F\"oljdsats}%
12542 \crefname{proposition}{Proposition}{Proposition}%
12543 \crefname{definition}{Definition}{Definition}%
12544 \crefname{result}{Resultat}{Resultat}%
12545 \crefname{example}{Exempel}{Exempel}%
12546 \crefname{remark}{Anm\"arkning}{Anm\"arkning}%
12547 \crefname{note}{Notering}{Notering}%
12548 \crefname{algorithm}{Algoritm}{Algoritm}%
12549 \crefname{listing}{Kodlistning}{Kodlistnings}%
12550 \crefname{line}{Rad}{Rad}%
12551 %
12552 \else% capitalise unset
12553 \if@cref@abbrev%
12554 \crefname{equation}{ekv.}{ekv.}%
12555 \crefname{figure}{fig.}{fig.}%
12556 \crefname{subfigure}{fig.}{fig.}%
12557 \crefname{page}{s.}{ss.}%
12558 \else%
12559 \crefname{equation}{ekvation}{ekvation}%
12560 \crefname{figure}{figur}{figur}%
12561 \crefname{subfigure}{figur}{figur}%
12562 \crefname{page}{sida}{sida}%
12563 \fi%
12564 \crefname{table}{tabell}{tabell}%
12565 \crefname{subtable}{tabell}{tabell}%
12566 \crefname{part}{del}{del}%
12567 \crefname{chapter}{kapitel}{kapitel}%
12568 \crefname{section}{avsnitt}{avsnitt}%
12569 \crefname{subsection}{avsnitt}{avsnitt}%
12570 \crefname{subsubsection}{avsnitt}{avsnitt}%
12571 \crefname{appendix}{appendix}{appendix}%
12572 \crefname{subappendix}{appendix}{appendix}%
12573 \crefname{subsubappendix}{appendix}{appendix}%
12574 \crefname{subsubsubappendix}{appendix}{appendix}%
12575 \crefname{enumi}{punkt}{punkt}%
12576 \crefname{enumii}{punkt}{punkt}%
12577 \crefname{enumiii}{punkt}{punkt}%
12578 \crefname{enumiv}{punkt}{punkt}%
12579 \crefname{enumv}{punkt}{punkt}%
12580 \crefname{footnote}{fotnot}{fotnot}%
12581 \crefname{theorem}{sats}{sats}%
12582 \crefname{lemma}{lemma}{lemmas}%
12583 \crefname{corollary}{f\"oljdsats}{f\"oljdsats}%
12584 \crefname{proposition}{proposition}{proposition}%
12585 \crefname{definition}{definition}{definition}%
12586 \crefname{result}{resultat}{resultat}%
12587 \crefname{example}{exempel}{exempel}%
12588 \crefname{remark}{anm\"arkning}{anm\"arkning}%
12589 \crefname{note}{notering}{notering}%
12590 \crefname{algorithm}{algoritm}{algoritm}%
12591 \crefname{listing}{kodlistning}{kodlistnings}%
12592 \crefname{line}{rad}{rad}%
12593 \fi}% end \cref@addlangagedefs
12594 % \end{macrocode}
12595 %
12596 %
12597 % \subsubsection{Brazilian}
12598 % \begin{macro}{brazilian}
12599 % Brazilian translations courtesy of Paulo Roberto Massa Cereda.
12600 % \end{macro}
12601 % \begin{macrocode}
12602 \DeclareOption{brazilian}{%
12603 \AtBeginDocument{%
12604 \def\crefrangeconjunction@preamble{ a\nobreakspace}%
12605 \def\crefrangepreconjunction@preamble{}%
12606 \def\crefrangepostconjunction@preamble{}%
12607 \def\crefpairconjunction@preamble{ e\nobreakspace}%
12608 \def\crefmiddleconjunction@preamble{, }%
12609 \def\creflastconjunction@preamble{ e\nobreakspace}%
12610 % \end{macrocode}
12611 % We have to define the group conjunctions explicitly here, rather than
12612 % relying on fall-back definitions in terms of the above conjunctions
12613 % (see \cref{sec:code:default_formats}), in case any other language
12614 % option defines them explicitly and we need to override those.
12615 % \begin{macrocode}
12616 \def\crefpairgroupconjunction@preamble{ e\nobreakspace}%
12617 \def\crefmiddlegroupconjunction@preamble{, }%
12618 \def\creflastgroupconjunction@preamble{, e\nobreakspace}%
12619 %
12620 \Crefname@preamble{equation}{Equa\c c\~ao}{Equa\c c\~oes}%
12621 \Crefname@preamble{figure}{Figura}{Figuras}%
12622 \Crefname@preamble{table}{Tabela}{Tabelas}%
12623 \Crefname@preamble{page}{P\'agina}{P\'aginas}%
12624 \Crefname@preamble{part}{Parte}{Partes}%
12625 \Crefname@preamble{chapter}{Cap\'itulo}{Cap\'itulos}%
12626 \Crefname@preamble{section}{Se\c c\~ao}{Se\c c\~oes}%
12627 \Crefname@preamble{appendix}{Ap\^endice}{Ap\^endices}%
12628 \Crefname@preamble{enumi}{Item}{Itens}%
12629 \Crefname@preamble{footnote}{Nota de rodap\'e}{Notas de rodap\'e}%
12630 \Crefname@preamble{theorem}{Teorema}{Teoremas}%
12631 \Crefname@preamble{lemma}{Lema}{Lemas}%
12632 \Crefname@preamble{corollary}{Corol\'ario}{Corol\'arios}%
12633 \Crefname@preamble{proposition}{Proposi\c c\~ao}{Proposi\c c\~oes}%
12634 \Crefname@preamble{definition}{Defini\c c\~ao}{Defini\c c\~oes}%
12635 \Crefname@preamble{result}{Resultado}{Resultados}%
12636 \Crefname@preamble{example}{Exemplo}{Exemplos}%
12637 \Crefname@preamble{remark}{Observa\c c\~ao}{Observa\c c\~oes}%
12638 \Crefname@preamble{note}{Nota}{Notas}%
12639 \Crefname@preamble{algorithm}{Algoritmo}{Algoritmos}%
12640 \Crefname@preamble{listing}{Listagem}{Listagens}%
12641 \Crefname@preamble{line}{Linha}{Linhas}%
12642 %
12643 \if@cref@capitalise% capitalise set
12644 \if@cref@abbrev%
12645 \crefname@preamble{equation}{Eq.}{Eqs.}%
12646 \crefname@preamble{figure}{Fig.}{Figs.}%
12647 \else%
12648 \crefname@preamble{equation}{Equa\c c\~ao}{Equa\c c\~oes}%
12649 \crefname@preamble{figure}{Figura}{Figuras}%
12650 \fi%
12651 \crefname@preamble{page}{P\'agina}{P\'aginas}%
12652 \crefname@preamble{table}{Tabela}{Tabelas}%
12653 \crefname@preamble{part}{Parte}{Partes}%
12654 \crefname@preamble{chapter}{Cap\'itulo}{Cap\'itulos}%
12655 \crefname@preamble{section}{Se\c c\~ao}{Se\c c\~oes}%
12656 \crefname@preamble{appendix}{Ap\^endice}{Ap\^endices}%
12657 \crefname@preamble{enumi}{Item}{Itens}%
12658 \crefname@preamble{footnote}{Nota de rodap\'e}{Notas de rodap\'e}%
12659 \crefname@preamble{theorem}{Teorema}{Teoremas}%
12660 \crefname@preamble{lemma}{Lema}{Lemas}%
12661 \crefname@preamble{corollary}{Corol\'ario}{Corol\'arios}%
12662 \crefname@preamble{proposition}{Proposi\c c\~ao}{Proposi\c c\~oes}%
12663 \crefname@preamble{definition}{Defini\c c\~ao}{Defini\c c\~oes}%
12664 \crefname@preamble{result}{Resultado}{Resultados}%
12665 \crefname@preamble{example}{Exemplo}{Exemplos}%
12666 \crefname@preamble{remark}{Observa\c c\~ao}{Observa\c c\~oes}%
12667 \crefname@preamble{note}{Nota}{Notas}%
12668 \crefname@preamble{algorithm}{Algoritmo}{Algoritmos}%
12669 \crefname@preamble{listing}{Listagem}{Listagens}%
12670 \crefname@preamble{line}{Linha}{Linhas}%
12671 %
12672 \else% capitalise unset
12673 \if@cref@abbrev%
12674 \crefname@preamble{equation}{eq.}{eqs.}%
12675 \crefname@preamble{figure}{fig.}{figs.}%
12676 \else%
12677 \crefname@preamble{equation}{equa\c c\~ao}{equa\c c\~oes}%
12678 \crefname@preamble{figure}{figura}{figuras}%
12679 \fi%
12680 \crefname@preamble{page}{p\'agina}{p\'aginas}%
12681 \crefname@preamble{table}{tabela}{tabelas}%
12682 \crefname@preamble{part}{parte}{partes}%
12683 \crefname@preamble{chapter}{cap\'itulo}{cap\'itulos}%
12684 \crefname@preamble{section}{se\c c\~ao}{se\c c\~oes}%
12685 \crefname@preamble{appendix}{ap\^endice}{ap\^endices}%
12686 \crefname@preamble{enumi}{item}{itens}%
12687 \crefname@preamble{footnote}{nota de rodap\'e}{notas de rodap\'e}%
12688 \crefname@preamble{theorem}{teorema}{teoremas}%
12689 \crefname@preamble{lemma}{lema}{lemas}%
12690 \crefname@preamble{corollary}{corol\'ario}{corol\'arios}%
12691 \crefname@preamble{proposition}{proposi\c c\~ao}{proposi\c c\~oes}%
12692 \crefname@preamble{definition}{defini\c c\~ao}{defini\c c\~oes}%
12693 \crefname@preamble{result}{resultado}{resultados}%
12694 \crefname@preamble{example}{exemplo}{exemplos}%
12695 \crefname@preamble{remark}{observa\c c\~ao}{observa\c c\~oes}%
12696 \crefname@preamble{note}{nota}{notas}%
12697 \crefname@preamble{algorithm}{algoritmo}{algoritmos}%
12698 \crefname@preamble{listing}{listagem}{listagens}%
12699 \crefname@preamble{line}{linha}{linhas}%
12700 \fi%
12701 \def\cref@language{brazilian}%
12702 }}% end \AtBeginDocument and \DeclareOption
12703 % \end{macrocode}
12704 %
12705 % If using \package{babel} and the corresponding option is set, or if
12706 % using \package{polyglossia} and the language has been loaded, add
12707 % format definition commands to \cmd{\extras}\meta{language} or
12708 % \cmd{\captions}\meta{language} so that language switching commands will
12709 % change the cross-reference formats appropriately.
12710 % \begin{macrocode}
12711 \cref@addlanguagedefs{brazilian}{%
12712 \PackageInfo{cleveref}{loaded `brazilian' language definitions}%
12713 \renewcommand{\crefrangeconjunction}{ a\nobreakspace}%
12714 \renewcommand\crefrangepreconjunction{}%
12715 \renewcommand\crefrangepostconjunction{}%
12716 \renewcommand{\crefpairconjunction}{ e\nobreakspace}%
12717 \renewcommand{\crefmiddleconjunction}{, }%
12718 \renewcommand{\creflastconjunction}{ e\nobreakspace}%
12719 \renewcommand{\crefpairgroupconjunction}{ e\nobreakspace}%
12720 \renewcommand{\crefmiddlegroupconjunction}{, }%
12721 \renewcommand{\creflastgroupconjunction}{ e\nobreakspace}%
12722 %
12723 \Crefname{equation}{Equa\c c\~ao}{Equa\c c\~oes}%
12724 \Crefname{figure}{Figura}{Figuras}%
12725 \Crefname{subfigure}{Figura}{Figuras}%
12726 \Crefname{table}{Tabela}{Tabelas}%
12727 \Crefname{subtable}{Tabela}{Tabelas}%
12728 \Crefname{page}{P\'agina}{P\'aginas}%
12729 \Crefname{part}{Parte}{Partes}%
12730 \Crefname{chapter}{Cap\'itulo}{Cap\'itulos}%
12731 \Crefname{section}{Se\c c\~ao}{Se\c c\~oes}%
12732 \Crefname{subsection}{Se\c c\~ao}{Se\c c\~oes}%
12733 \Crefname{subsubsection}{Se\c c\~ao}{Se\c c\~oes}%
12734 \Crefname{appendix}{Ap\^endice}{Ap\^endices}%
12735 \Crefname{subappendix}{Ap\^endice}{Ap\^endices}%
12736 \Crefname{subsubappendix}{Ap\^endice}{Ap\^endices}%
12737 \Crefname{subsubsubappendix}{Ap\^endice}{Ap\^endices}%
12738 \Crefname{enumi}{Item}{Itens}%
12739 \Crefname{enumii}{Item}{Itens}%
12740 \Crefname{enumiii}{Item}{Itens}%
12741 \Crefname{enumiv}{Item}{Itens}%
12742 \Crefname{enumv}{Item}{Itens}%
12743 \Crefname{footnote}{Nota de rodap\'e}{Notas de rodap\'e}%
12744 \Crefname{theorem}{Teorema}{Teoremas}%
12745 \Crefname{lemma}{Lema}{Lemas}%
12746 \Crefname{corollary}{Corol\'ario}{Corol\'arios}%
12747 \Crefname{proposition}{Proposi\c c\~ao}{Proposi\c c\~oes}%
12748 \Crefname{definition}{Defini\c c\~ao}{Defini\c c\~oes}%
12749 \Crefname{result}{Resultado}{Resultados}%
12750 \Crefname{example}{Exemplo}{Exemplos}%
12751 \Crefname{remark}{Observa\c c\~ao}{Observa\c c\~oes}%
12752 \Crefname{note}{Nota}{Notas}%
12753 \Crefname{algorithm}{Algoritmo}{Algoritmos}%
12754 \Crefname{listing}{Listagem}{Listagens}%
12755 \Crefname{line}{Linha}{Linhas}%
12756 %
12757 \if@cref@capitalise% capitalise set
12758 \if@cref@abbrev%
12759 \crefname{equation}{Eq.}{Eqs.}%
12760 \crefname{figure}{Fig.}{Figs.}%
12761 \crefname{subfigure}{Fig.}{Figs.}%
12762 \else%
12763 \crefname{equation}{Equa\c c\~ao}{Equa\c c\~oes}%
12764 \crefname{figure}{Figura}{Figuras}%
12765 \crefname{subfigure}{Figura}{Figuras}%
12766 \fi%
12767 \crefname{page}{P\'agina}{P\'aginas}%
12768 \crefname{table}{Tabela}{Tabelas}%
12769 \crefname{subtable}{Tabela}{Tabelas}%
12770 \crefname{part}{Parte}{Partes}%
12771 \crefname{chapter}{Cap\'itulo}{Cap\'itulos}%
12772 \crefname{section}{Se\c c\~ao}{Se\c c\~oes}%
12773 \crefname{subsection}{Se\c c\~ao}{Se\c c\~oes}%
12774 \crefname{subsubsection}{Se\c c\~ao}{Se\c c\~oes}%
12775 \crefname{appendix}{Ap\^endice}{Ap\^endices}%
12776 \crefname{subappendix}{Ap\^endice}{Ap\^endices}%
12777 \crefname{subsubappendix}{Ap\^endice}{Ap\^endices}%
12778 \crefname{subsubsubappendix}{Ap\^endice}{Ap\^endices}%
12779 \crefname{enumi}{Item}{Itens}%
12780 \crefname{enumii}{Item}{Itens}%
12781 \crefname{enumiii}{Item}{Itens}%
12782 \crefname{enumiv}{Item}{Itens}%
12783 \crefname{enumv}{Item}{Itens}%
12784 \crefname{footnote}{Nota de rodap\'e}{Notas de rodap\'e}%
12785 \crefname{theorem}{Teorema}{Teoremas}%
12786 \crefname{lemma}{Lema}{Lemas}%
12787 \crefname{corollary}{Corol\'ario}{Corol\'arios}%
12788 \crefname{proposition}{Proposi\c c\~ao}{Proposi\c c\~oes}%
12789 \crefname{definition}{Defini\c c\~ao}{Defini\c c\~oes}%
12790 \crefname{result}{Resultado}{Resultados}%
12791 \crefname{example}{Exemplo}{Exemplos}%
12792 \crefname{remark}{Observa\c c\~ao}{Observa\c c\~oes}%
12793 \crefname{note}{Nota}{Notas}%
12794 \crefname{algorithm}{Algoritmo}{Algoritmos}%
12795 \crefname{listing}{Listagem}{Listagens}%
12796 \crefname{line}{Linha}{Linhas}%
12797 %
12798 \else% capitalise unset
12799 \if@cref@abbrev%
12800 \crefname{equation}{eq.}{eqs.}%
12801 \crefname{figure}{fig.}{figs.}%
12802 \crefname{subfigure}{fig.}{figs.}%
12803 \else%
12804 \crefname{equation}{equa\c c\~ao}{equa\c c\~oes}%
12805 \crefname{figure}{figura}{figuras}%
12806 \crefname{subfigure}{figura}{figuras}%
12807 \fi%
12808 \crefname{table}{tabela}{tabelas}%
12809 \crefname{subtable}{tabela}{tabelas}%
12810 \crefname{page}{p\'agina}{p\'aginas}%
12811 \crefname{part}{parte}{partes}%
12812 \crefname{chapter}{cap\'itulo}{cap\'itulos}%
12813 \crefname{section}{se\c c\~ao}{se\c c\~oes}%
12814 \crefname{subsection}{se\c c\~ao}{se\c c\~oes}%
12815 \crefname{subsubsection}{se\c c\~ao}{se\c c\~oes}%
12816 \crefname{appendix}{ap\^endice}{ap\^endices}%
12817 \crefname{subappendix}{ap\^endice}{ap\^endices}%
12818 \crefname{subsubappendix}{ap\^endice}{ap\^endices}%
12819 \crefname{subsubsubappendix}{ap\^endice}{ap\^endices}%
12820 \crefname{enumi}{item}{itens}%
12821 \crefname{enumii}{item}{itens}%
12822 \crefname{enumiii}{item}{itens}%
12823 \crefname{enumiv}{item}{itens}%
12824 \crefname{enumv}{item}{itens}%
12825 \crefname{footnote}{nota de rodap\'e}{notas de rodap\'e}%
12826 \crefname{theorem}{teorema}{teoremas}%
12827 \crefname{lemma}{lema}{lemas}%
12828 \crefname{corollary}{corol\'ario}{corol\'arios}%
12829 \crefname{proposition}{proposi\c c\~ao}{proposi\c c\~oes}%
12830 \crefname{definition}{defini\c c\~ao}{defini\c c\~oes}%
12831 \crefname{result}{resultado}{resultados}%
12832 \crefname{example}{exemplo}{exemplos}%
12833 \crefname{remark}{observa\c c\~ao}{observa\c c\~oes}%
12834 \crefname{note}{nota}{notas}%
12835 \crefname{algorithm}{algoritmo}{algoritmos}%
12836 \crefname{listing}{listagem}{listagens}%
12837 \crefname{line}{linha}{linhas}%
12838 \fi}% end \cref@addlangagedefs
12839 % \end{macrocode}
12840 %
12841 %
12842 % \subsubsection{Catalan}
12843 % \begin{macro}{catalan}
12844 % Catalan definitions thanks to Rafel Jaume Deya and Eva Bosch Roura.
12845 % \end{macro}
12846 %
12847 % Set up the definitions used at the beginning of the document to define
12848 % the formats created by the document preamble.
12849 % \begin{macrocode}
12850 \DeclareOption{catalan}{%
12851 \AtBeginDocument{%
12852 \def\crefrangeconjunction@preamble{ a\nobreakspace}%
12853 \def\crefrangepreconjunction@preamble{}%
12854 \def\crefrangepostconjunction@preamble{}%
12855 \def\crefpairconjunction@preamble{ i\nobreakspace}%
12856 \def\crefmiddleconjunction@preamble{, }%
12857 \def\creflastconjunction@preamble{ i\nobreakspace}%
12858 % \end{macrocode}
12859 % We have to define the group conjunctions explicitly here, rather than
12860 % relying on fall-back definitions in terms of the above conjunctions
12861 % (see \cref{sec:code:default_formats}), in case any other language
12862 % option defines them explicitly and we need to override those.
12863 % \begin{macrocode}
12864 \def\crefpairgroupconjunction@preamble{ i\nobreakspace}%
12865 \def\crefmiddlegroupconjunction@preamble{, }%
12866 \def\creflastgroupconjunction@preamble{ i\nobreakspace}%
12867 %
12868 \Crefname@preamble{equation}{Equaci\'o}{Equacions}%
12869 \Crefname@preamble{figure}{Gr\`afic}{Gr\`afics}%
12870 \Crefname@preamble{table}{Taula}{Taules}%
12871 \Crefname@preamble{page}{P\`agina}{P\`agines}%
12872 \Crefname@preamble{part}{Part}{Parts}%
12873 \Crefname@preamble{chapter}{Cap\'itol}{Cap\'itols}%
12874 \Crefname@preamble{section}{Secci\'o}{Seccions}%
12875 \Crefname@preamble{appendix}{Ap\`endix}{Ap\`endixs}%
12876 \Crefname@preamble{enumi}{Punt}{Punts}%
12877 \Crefname@preamble{footnote}{Nota}{Notes}%
12878 \Crefname@preamble{theorem}{Teorema}{Teoremes}%
12879 \Crefname@preamble{lemma}{Lema}{Lemes}%
12880 \Crefname@preamble{corollary}{Coro\lgem ari}{Coro\lgem aris}%
12881 \Crefname@preamble{proposition}{Proposici\'o}{Proposicions}%
12882 \Crefname@preamble{definition}{Definici\'o}{Definicions}%
12883 \Crefname@preamble{result}{Resultat}{Resultats}%
12884 \Crefname@preamble{example}{Exemple}{Exemples}%
12885 \Crefname@preamble{remark}{Observaci\'o}{Observacions}%
12886 \Crefname@preamble{note}{Nota}{Notes}%
12887 \Crefname@preamble{algorithm}{Algorisme}{Algorismes}%
12888 \Crefname@preamble{listing}{Llistat}{Llistats}%
12889 \Crefname@preamble{line}{L\'inia}{L\'inies}%
12890 %
12891 \if@cref@capitalise% capitalise set
12892 \crefname@preamble{equation}{Equaci\'o}{Equacions}%
12893 \crefname@preamble{figure}{Gr\`afic}{Gr\`afics}%
12894 \crefname@preamble{table}{Taula}{Taules}%
12895 \crefname@preamble{page}{P\`agina}{P\`agines}%
12896 \crefname@preamble{part}{Part}{Parts}%
12897 \crefname@preamble{chapter}{Cap\'itol}{Cap\'itols}%
12898 \crefname@preamble{section}{Secci\'o}{Seccions}%
12899 \crefname@preamble{appendix}{Ap\`endix}{Ap\`endixs}%
12900 \crefname@preamble{enumi}{Punt}{Punts}%
12901 \crefname@preamble{footnote}{Nota}{Notes}%
12902 \crefname@preamble{theorem}{Teorema}{Teoremes}%
12903 \crefname@preamble{lemma}{Lema}{Lemes}%
12904 \crefname@preamble{corollary}{Coro\lgem ari}{Coro\lgem aris}%
12905 \crefname@preamble{proposition}{Proposici\'o}{Proposicions}%
12906 \crefname@preamble{definition}{Definici\'o}{Definicions}%
12907 \crefname@preamble{result}{Resultat}{Resultats}%
12908 \crefname@preamble{example}{Exemple}{Exemples}%
12909 \crefname@preamble{remark}{Observaci\'o}{Observacions}%
12910 \crefname@preamble{note}{Nota}{Notes}%
12911 \crefname@preamble{algorithm}{Algorisme}{Algorismes}%
12912 \crefname@preamble{listing}{Llistat}{Llistats}%
12913 \crefname@preamble{line}{L\'inia}{L\'inies}%
12914 %
12915 \else% capitalise unset
12916 \crefname@preamble{equation}{equaci\'o}{equacions}%
12917 \crefname@preamble{figure}{gr\`afic}{gr\`afics}%
12918 \crefname@preamble{table}{taula}{taules}%
12919 \crefname@preamble{page}{p\`agina}{p\`agines}%
12920 \crefname@preamble{part}{part}{parts}%
12921 \crefname@preamble{chapter}{cap\'itol}{cap\'itols}%
12922 \crefname@preamble{section}{secci\'o}{seccions}%
12923 \crefname@preamble{appendix}{ap\`endix}{ap\`endixs}%
12924 \crefname@preamble{enumi}{punt}{punts}%
12925 \crefname@preamble{footnote}{nota}{notes}%
12926 \crefname@preamble{theorem}{teorema}{teoremes}%
12927 \crefname@preamble{lemma}{lema}{lemes}%
12928 \crefname@preamble{corollary}{coro\lgem ari}{coro\lgem aris}%
12929 \crefname@preamble{proposition}{proposici\'o}{proposicions}%
12930 \crefname@preamble{definition}{definici\'o}{definicions}%
12931 \crefname@preamble{result}{resultat}{resultats}%
12932 \crefname@preamble{example}{exemple}{exemples}%
12933 \crefname@preamble{remark}{observaci\'o}{observacions}%
12934 \crefname@preamble{note}{nota}{notes}%
12935 \crefname@preamble{algorithm}{algorisme}{algorismes}%
12936 \crefname@preamble{listing}{llistat}{llistats}%
12937 \crefname@preamble{line}{l\'inia}{l\'inies}%
12938 \fi%
12939 \def\cref@language{catalan}%
12940 }}% end \AtBeginDocument and \DeclareOption
12941 % \end{macrocode}
12942 %
12943 % If using \package{babel} and the corresponding option is set, or if
12944 % using \package{polyglossia} and the language has been loaded, add
12945 % format definition commands to \cmd{\extras}\meta{language} or
12946 % \cmd{\captions}\meta{language} so that language switching commands will
12947 % change the cross-reference formats appropriately.
12948 % \begin{macrocode}
12949 \cref@addlanguagedefs{catalan}{%
12950 \PackageInfo{cleveref}{loaded `catalan language definitions}%
12951 \renewcommand{\crefrangeconjunction}{ a\nobreakspace}%
12952 \renewcommand{\crefrangepreconjunction}{}%
12953 \renewcommand{\crefrangepostconjunction}{}%
12954 \renewcommand{\crefpairconjunction}{ i\nobreakspace}%
12955 \renewcommand{\crefmiddleconjunction}{, }%
12956 \renewcommand{\creflastconjunction}{ i\nobreakspace}%
12957 \renewcommand{\crefpairgroupconjunction}{ i\nobreakspace}%
12958 \renewcommand{\crefmiddlegroupconjunction}{, }%
12959 \renewcommand{\creflastgroupconjunction}{ i\nobreakspace}%
12960 %
12961 \Crefname{equation}{Equaci\'o}{Equacions}%
12962 \Crefname{figure}{Gr\`afic}{Gr\`afics}%
12963 \Crefname{subfigure}{Gr\`afic}{Gr\`afics}%
12964 \Crefname{table}{Taula}{Taules}%
12965 \Crefname{subtable}{Taula}{Taules}%
12966 \Crefname{page}{P\`agina}{P\`aginas}%
12967 \Crefname{part}{Part}{Parts}%
12968 \Crefname{chapter}{Cap\'itol}{Cap\'itols}%
12969 \Crefname{section}{Secci\'o}{Seccions}%
12970 \Crefname{subsection}{Secci\'o}{Seccions}%
12971 \Crefname{subsubsection}{Secci\'o}{Seccions}%
12972 \Crefname{appendix}{Ap\`endix}{Ap\`endixs}%
12973 \Crefname{subappendix}{Ap\`endix}{Ap\`endixs}%
12974 \Crefname{subsubappendix}{Ap\`endix}{Ap\`endixs}%
12975 \Crefname{subsubsubappendix}{Ap\`endix}{Ap\`endixs}%
12976 \Crefname{enumi}{Punt}{Punts}%
12977 \Crefname{enumii}{Punt}{Punts}%
12978 \Crefname{enumiii}{Punt}{Punts}%
12979 \Crefname{enumiv}{Punt}{Punts}%
12980 \Crefname{enumv}{Punt}{Punts}%
12981 \Crefname{footnote}{Nota}{Notes}%
12982 \Crefname{theorem}{Teorema}{Teoremes}%
12983 \Crefname{lemma}{Lema}{Lemes}%
12984 \Crefname{corollary}{Coro\lgem ari}{Coro\lgem aris}%
12985 \Crefname{proposition}{Proposici\'o}{Proposicions}%
12986 \Crefname{definition}{Definici\'o}{Definicions}%
12987 \Crefname{result}{Resultat}{Resultats}%
12988 \Crefname{example}{Exemple}{Exemples}%
12989 \Crefname{remark}{Observaci\'o}{Observacions}%
12990 \Crefname{note}{Nota}{Notes}%
12991 \Crefname{algorithm}{Algorisme}{Algorismes}%
12992 \Crefname{listing}{Llistat}{Llistats}%
12993 \Crefname{line}{L\'inia}{L\'inies}%
12994 %
12995 \if@cref@capitalise% capitalise set
12996 \crefname{equation}{Equaci\'o}{Equacions}%
12997 \crefname{figure}{Gr\`afic}{Gr\`afics}%
12998 \crefname{subfigure}{Gr\`afic}{Gr\`afics}%
12999 \crefname{table}{Taula}{Taules}%
13000 \crefname{subtable}{Taula}{Taules}%
13001 \crefname{page}{P\`agina}{P\`aginas}%
13002 \crefname{part}{Part}{Parts}%
13003 \crefname{chapter}{Cap\'itol}{Cap\'itols}%
13004 \crefname{section}{Secci\'o}{Seccions}%
13005 \crefname{subsection}{Secci\'o}{Seccions}%
13006 \crefname{subsubsection}{Secci\'o}{Seccions}%
13007 \crefname{appendix}{Ap\`endix}{Ap\`endixs}%
13008 \crefname{subappendix}{Ap\`endix}{Ap\`endixs}%
13009 \crefname{subsubappendix}{Ap\`endix}{Ap\`endixs}%
13010 \crefname{subsubsubappendix}{Ap\`endix}{Ap\`endixs}%
13011 \crefname{enumi}{Punt}{Punts}%
13012 \crefname{enumii}{Punt}{Punts}%
13013 \crefname{enumiii}{Punt}{Punts}%
13014 \crefname{enumiv}{Punt}{Punts}%
13015 \crefname{enumv}{Punt}{Punts}%
13016 \crefname{footnote}{Nota}{Notes}%
13017 \crefname{theorem}{Teorema}{Teoremes}%
13018 \crefname{lemma}{Lema}{Lemes}%
13019 \crefname{corollary}{Coro\lgem ari}{Coro\lgem aris}%
13020 \crefname{proposition}{Proposici\'o}{Proposicions}%
13021 \crefname{definition}{Definici\'o}{Definicions}%
13022 \crefname{result}{Resultat}{Resultats}%
13023 \crefname{example}{Exemple}{Exemples}%
13024 \crefname{remark}{Observaci\'o}{Observacions}%
13025 \crefname{note}{Nota}{Notes}%
13026 \crefname{algorithm}{Algorisme}{Algorismes}%
13027 \crefname{listing}{Llistat}{Llistats}%
13028 \crefname{line}{L\'inia}{L\'inies}%
13029 %
13030 \else% capitalise unset
13031 \crefname{equation}{equaci\'o}{equacions}%
13032 \crefname{figure}{gr\`afic}{gr\`afics}%
13033 \crefname{subfigure}{gr\`afic}{gr\`afics}%
13034 \crefname{table}{taula}{taules}%
13035 \crefname{subtable}{taula}{taules}%
13036 \crefname{page}{p\`agina}{p\`aginas}%
13037 \crefname{part}{part}{parts}%
13038 \crefname{chapter}{cap\'itol}{cap\'itols}%
13039 \crefname{section}{secci\'o}{seccions}%
13040 \crefname{subsection}{secci\'o}{seccions}%
13041 \crefname{subsubsection}{secci\'o}{seccions}%
13042 \crefname{appendix}{ap\`endix}{ap\`endixs}%
13043 \crefname{subappendix}{ap\`endix}{ap\`endixs}%
13044 \crefname{subsubappendix}{ap\`endix}{ap\`endixs}%
13045 \crefname{subsubsubappendix}{ap\`endix}{ap\`endixs}%
13046 \crefname{enumi}{punt}{punts}%
13047 \crefname{enumii}{punt}{punts}%
13048 \crefname{enumiii}{punt}{punts}%
13049 \crefname{enumiv}{punt}{punts}%
13050 \crefname{enumv}{punt}{punts}%
13051 \crefname{footnote}{nota}{notes}%
13052 \crefname{theorem}{teorema}{teoremes}%
13053 \crefname{lemma}{lema}{lemes}%
13054 \crefname{corollary}{coro\lgem ari}{coro\lgem aris}%
13055 \crefname{proposition}{proposici\'o}{proposicions}%
13056 \crefname{definition}{definici\'o}{definicions}%
13057 \crefname{result}{resultat}{resultats}%
13058 \crefname{example}{exemple}{exemples}%
13059 \crefname{remark}{observaci\'o}{observacions}%
13060 \crefname{note}{nota}{notes}%
13061 \crefname{algorithm}{algorisme}{algorismes}%
13062 \crefname{listing}{llistat}{llistats}%
13063 \crefname{line}{l\'inia}{l\'inies}%
13064 \fi}% end \cref@loadlanguagedefs
13065 % \end{macrocode}
13066 %
13067 %
13068 % \subsection{Default Cross-Reference Formats}
13069 % \label{sec:code:default_formats}
13070 % The \option{capitalise} and \option{nameinlink} options must be
13071 % processed before we process any language options and define the default
13072 % formats, so that they take effect in the default format definitions.
13073 % Therefore, we have to manually check whether they're present, and force
13074 % processing of those before the other options.
13075 % \begin{macrocode}
13076 \edef\@curroptions{\@ptionlist{\@currname.\@currext}}%
13077 \@expandtwoargs\in@{,capitalise,}{%
13078 ,\@classoptionslist,\@curroptions,}%
13079 \ifin@%
13080 \ExecuteOptions{capitalise}%
13081 \else%
13082 \@expandtwoargs\in@{,capitalize,}{%
13083 ,\@classoptionslist,\@curroptions,}%
13084 \ifin@%
13085 \ExecuteOptions{capitalise}%
13086 \fi%
13087 \fi%
13088 \@expandtwoargs\in@{,nameinlink,}{%
13089 ,\@classoptionslist,\@curroptions,}%
13090 \ifin@%
13091 \ExecuteOptions{nameinlink}%
13092 \fi%
13093 % \end{macrocode}
13094 %
13095 %
13096 % \begin{macro}{\crefdefaultlabelformat}
13097 % \begin{macro}{\creflabelformat}
13098 % Define the default label formats, which don't depend on language. We
13099 % override the default format for equations, to follow the near
13100 % universal convention of enclosing equation labels in parentheses.
13101 % However, if the \option{nameinlink} option is enabled, the end of the
13102 % hyperlink must come outside the group or it will cause \LaTeX{}
13103 % grouping errors, so we must define it differently in that case.
13104 % \begin{macrocode}
13105 \crefdefaultlabelformat{#2#1#3}%
13106 \if@cref@nameinlink%
13107 \creflabelformat{equation}{#2\textup{(#1)}#3}%
13108 \else%
13109 \creflabelformat{equation}{\textup{(#2#1#3)}}%
13110 \fi%
13111 % \end{macrocode}
13112 % \end{macro}
13113 % \end{macro}
13114 %
13115 %
13116 % Set up the default English format definitions, then process options in
13117 % the order they were supplied.
13118 % \begin{macrocode}
13119 \@ifpackageloaded{polyglossia}%
13120 {\ifcsdef{languagename}%
13121 {\ExecuteOptions{\languagename}}%
13122 {\PackageWarning{cleveref}%
13123 {`polyglossia' loaded but default language not set
13124 - defaulting to english}%
13125 \ExecuteOptions{english}}}%
13126 {\ExecuteOptions{english}}%
13127 \ProcessOptions*\relax%
13128 % \end{macrocode}
13129 %
13130 %
13131 % Define the component-derived formats.
13132 % \begin{macrocode}
13133 \AtBeginDocument{%
13134 % \end{macrocode}
13135 % Use whatever's in the \dots|@preamble| definitions at the beginning of
13136 % the document to set up the default cross-reference names, unless
13137 % overridden by explicit definitions.
13138 % \begin{macrocode}
13139 \edef\@tempa{%
13140 \expandafter\noexpand\csname extras\cref@language\endcsname}%
13141 \@ifundefined{crefrangeconjunction}{%
13142 \let\crefrangeconjunction\crefrangeconjunction@preamble%
13143 }{%
13144 \expandafter\def\expandafter\@tempb\expandafter{%
13145 \expandafter\renewcommand\expandafter%
13146 {\expandafter\crefrangeconjunction\expandafter}%
13147 \expandafter{\crefrangeconjunction}}%
13148 \expandafter\expandafter\expandafter\cref@addto%
13149 \expandafter\@tempa\expandafter{\@tempb}%
13150 }%
13151 \@ifundefined{crefrangepreconjunction}{%
13152 \let\crefrangepreconjunction\crefrangepreconjunction@preamble%
13153 }{%
13154 \expandafter\def\expandafter\@tempb\expandafter{%
13155 \expandafter\renewcommand\expandafter%
13156 {\expandafter\crefrangepreconjunction\expandafter}%
13157 \expandafter{\crefrangepreconjunction}}%
13158 \expandafter\expandafter\expandafter\cref@addto%
13159 \expandafter\@tempa\expandafter{\@tempb}%
13160 }%
13161 \@ifundefined{crefrangepostconjunction}{%
13162 \let\crefrangepostconjunction\crefrangepostconjunction@preamble%
13163 }{%
13164 \expandafter\def\expandafter\@tempb\expandafter{%
13165 \expandafter\renewcommand\expandafter%
13166 {\expandafter\crefrangepostconjunction\expandafter}%
13167 \expandafter{\crefrangepostconjunction}}%
13168 \expandafter\expandafter\expandafter\cref@addto%
13169 \expandafter\@tempa\expandafter{\@tempb}%
13170 }%
13171 % \end{macrocode}
13172 % If the group conjunctions haven't been defined, but explicit
13173 % definitions \emph{have} been given for the reference list conjunctions,
13174 % define the group conjunctions to be identical to the reference
13175 % conjunctions.
13176 % \begin{macrocode}
13177 \@ifundefined{crefpairconjunction}{%
13178 \let\crefpairconjunction\crefpairconjunction@preamble%
13179 }{%
13180 \expandafter\def\expandafter\@tempb\expandafter{%
13181 \expandafter\renewcommand\expandafter%
13182 {\expandafter\crefpairconjunction\expandafter}%
13183 \expandafter{\crefpairconjunction}}%
13184 \expandafter\expandafter\expandafter\cref@addto%
13185 \expandafter\@tempa\expandafter{\@tempb}%
13186 \@ifundefined{crefpairgroupconjunction}{%
13187 \let\crefpairgroupconjunction\crefpairconjunction}{}%
13188 }%
13189 \@ifundefined{crefmiddleconjunction}{%
13190 \let\crefmiddleconjunction\crefmiddleconjunction@preamble%
13191 }{%
13192 \expandafter\def\expandafter\@tempb\expandafter{%
13193 \expandafter\renewcommand\expandafter%
13194 {\expandafter\crefmiddleconjunction\expandafter}%
13195 \expandafter{\crefmiddleconjunction}}%
13196 \expandafter\expandafter\expandafter\cref@addto%
13197 \expandafter\@tempa\expandafter{\@tempb}%
13198 \@ifundefined{crefmiddlegroupconjunction}{%
13199 \let\crefmiddlegroupconjunction\crefmiddleconjunction}{}%
13200 }%
13201 \@ifundefined{creflastconjunction}{%
13202 \let\creflastconjunction\creflastconjunction@preamble%
13203 }{%
13204 \expandafter\def\expandafter\@tempb\expandafter{%
13205 \expandafter\renewcommand\expandafter%
13206 {\expandafter\creflastconjunction\expandafter}%
13207 \expandafter{\creflastconjunction}}%
13208 \expandafter\expandafter\expandafter\cref@addto%
13209 \expandafter\@tempa\expandafter{\@tempb}%
13210 % \end{macrocode}
13211 % Define the last group conjunction to include an extra comma.
13212 % \begin{macrocode}
13213 \@ifundefined{creflastgroupconjunction}{%
13214 \edef\creflastgroupconjunction{, \creflastconjunction}}{}%
13215 }%
13216 \@ifundefined{crefpairgroupconjunction}{%
13217 \let\crefpairgroupconjunction%
13218 \crefpairgroupconjunction@preamble%
13219 }{%
13220 \expandafter\def\expandafter\@tempb\expandafter{%
13221 \expandafter\renewcommand\expandafter%
13222 {\expandafter\crefpairgroupconjunction\expandafter}%
13223 \expandafter{\crefpairgroupconjunction}}%
13224 \expandafter\expandafter\expandafter\cref@addto%
13225 \expandafter\@tempa\expandafter{\@tempb}%
13226 }%
13227 \@ifundefined{crefmiddlegroupconjunction}{%
13228 \let\crefmiddlegroupconjunction%
13229 \crefmiddlegroupconjunction@preamble%
13230 }{%
13231 \expandafter\def\expandafter\@tempb\expandafter{%
13232 \expandafter\renewcommand\expandafter%
13233 {\expandafter\crefmiddlegroupconjunction\expandafter}%
13234 \expandafter{\crefmiddlegroupconjunction}}%
13235 \expandafter\expandafter\expandafter\cref@addto%
13236 \expandafter\@tempa\expandafter{\@tempb}%
13237 }%
13238 \@ifundefined{creflastgroupconjunction}{%
13239 \let\creflastgroupconjunction%
13240 \creflastgroupconjunction@preamble%
13241 }{%
13242 \expandafter\def\expandafter\@tempb\expandafter{%
13243 \expandafter\renewcommand\expandafter%
13244 {\expandafter\creflastgroupconjunction\expandafter}%
13245 \expandafter{\creflastgroupconjunction}}%
13246 \expandafter\expandafter\expandafter\cref@addto%
13247 \expandafter\@tempa\expandafter{\@tempb}%
13248 }%
13249 % \end{macrocode}
13250 %
13251 % Define any undefined formats listed in \cmd{\cref@label@types} using
13252 % the components.
13253 % \begin{macrocode}
13254 \let\@tempstack\cref@label@types%
13255 \cref@isstackfull{\@tempstack}%
13256 \@whilesw\if@cref@stackfull\fi{%
13257 \edef\@tempa{\cref@stack@top{\@tempstack}}%
13258 \@ifundefined{cref@\@tempa @name}{%
13259 \expandafter\def\expandafter\@tempb\expandafter{%
13260 \csname cref@\@tempa @name\endcsname}%
13261 \expandafter\def\expandafter\@tempc\expandafter{%
13262 \csname cref@\@tempa @name@preamble\endcsname}%
13263 \expandafter\expandafter\expandafter%
13264 \let\expandafter\@tempb\@tempc%
13265 \expandafter\def\expandafter\@tempb\expandafter{%
13266 \csname cref@\@tempa @name@plural\endcsname}%
13267 \expandafter\def\expandafter\@tempc\expandafter{%
13268 \csname cref@\@tempa @name@plural@preamble\endcsname}%
13269 \expandafter\expandafter\expandafter%
13270 \let\expandafter\@tempb\@tempc%
13271 }{%
13272 \edef\@tempb{%
13273 \expandafter\noexpand\csname extras\cref@language\endcsname}%
13274 \expandafter\def\expandafter\@tempc\expandafter{%
13275 \expandafter\crefname\expandafter{\@tempa}}%
13276 \expandafter\expandafter\expandafter\cref@addto%
13277 \expandafter\expandafter\expandafter\@tempc%
13278 \expandafter\expandafter\expandafter{%
13279 \expandafter\expandafter\expandafter{%
13280 \csname cref@\@tempa @name\endcsname}}%
13281 \expandafter\expandafter\expandafter\cref@addto%
13282 \expandafter\expandafter\expandafter\@tempc%
13283 \expandafter\expandafter\expandafter{%
13284 \expandafter\expandafter\expandafter{%
13285 \csname cref@\@tempa @name@plural\endcsname}}%
13286 \expandafter\expandafter\expandafter\cref@addto%
13287 \expandafter\@tempb\expandafter{\@tempc}%
13288 }%
13289 \@ifundefined{Cref@\@tempa @name}{%
13290 \expandafter\def\expandafter\@tempb\expandafter{%
13291 \csname Cref@\@tempa @name\endcsname}%
13292 \expandafter\def\expandafter\@tempc\expandafter{%
13293 \csname Cref@\@tempa @name@preamble\endcsname}%
13294 \expandafter\expandafter\expandafter%
13295 \let\expandafter\@tempb\@tempc%
13296 \expandafter\def\expandafter\@tempb\expandafter{%
13297 \csname Cref@\@tempa @name@plural\endcsname}%
13298 \expandafter\def\expandafter\@tempc\expandafter{%
13299 \csname Cref@\@tempa @name@plural@preamble\endcsname}%
13300 \expandafter\expandafter\expandafter%
13301 \let\expandafter\@tempb\@tempc%
13302 }{%
13303 \edef\@tempb{%
13304 \expandafter\noexpand\csname extras\cref@language\endcsname}%
13305 \expandafter\def\expandafter\@tempc\expandafter{%
13306 \expandafter\Crefname\expandafter{\@tempa}}%
13307 \expandafter\expandafter\expandafter\cref@addto%
13308 \expandafter\expandafter\expandafter\@tempc%
13309 \expandafter\expandafter\expandafter{%
13310 \expandafter\expandafter\expandafter{%
13311 \csname Cref@\@tempa @name\endcsname}}%
13312 \expandafter\expandafter\expandafter\cref@addto%
13313 \expandafter\expandafter\expandafter\@tempc%
13314 \expandafter\expandafter\expandafter{%
13315 \expandafter\expandafter\expandafter{%
13316 \csname Cref@\@tempa @name@plural\endcsname}}%
13317 \expandafter\expandafter\expandafter\cref@addto%
13318 \expandafter\@tempb\expandafter{\@tempc}%
13319 }%
13320 % \end{macrocode}
13321 % We only define the reference-range and multi-reference formats if the
13322 % plural form of the name is defined in the corresponding
13323 % \cmd{\cref\meta{type}@name@plural}. Though \cmd{\crefname} and
13324 % \cmd{\Crefname} always define both the singular and plural forms
13325 % together, cross-reference names can also be defined automatically by
13326 % \cmd{\newtheorem}, which can only define the singular form. For
13327 % symmetry, we apply the same logic to the normal cross-reference format
13328 % definition (only defining it if the singular form of the name is
13329 % defined in \cmd{\cref\meta{type}@name}), though this should always be
13330 % the case.
13331 % \begin{macrocode}
13332 \@ifundefined{cref@\@tempa @format}{%
13333 \@ifundefined{cref@\@tempa @name}{}{%
13334 \expandafter\@crefdefineformat\expandafter{\@tempa}}}{}%
13335 \@ifundefined{crefrange@\@tempa @format}{%
13336 \@ifundefined{cref@\@tempa @name@plural}{}{%
13337 \expandafter\@crefrangedefineformat\expandafter{\@tempa}}}{}%
13338 \@ifundefined{cref@\@tempa @format@first}{%
13339 \@ifundefined{cref@\@tempa @name@plural}{}{%
13340 \expandafter\@crefdefinemultiformat\expandafter{\@tempa}}}{}%
13341 \@ifundefined{crefrange@\@tempa @format@first}{%
13342 \@ifundefined{cref@\@tempa @name@plural}{}{%
13343 \expandafter\@crefrangedefinemultiformat%
13344 \expandafter{\@tempa}}}{}%
13345 \cref@stack@pop{\@tempstack}%
13346 \cref@isstackfull{\@tempstack}}%
13347 % \end{macrocode}
13348 %
13349 % If formats for subsections are undefined, define them to be identical
13350 % to the formats for sections. Similarly for subsections within
13351 % appendices, subfigures, subtables, subequations and enums.
13352 % \begin{macrocode}
13353 \@crefcopyformats{section}{subsection}%
13354 \@crefcopyformats{subsection}{subsubsection}%
13355 \@crefcopyformats{appendix}{subappendix}%
13356 \@crefcopyformats{subappendix}{subsubappendix}%
13357 \@crefcopyformats{figure}{subfigure}%
13358 \@crefcopyformats{table}{subtable}%
13359 \@crefcopyformats{equation}{subequation}%
13360 %
13361 \@crefcopyformats{enumi}{enumii}%
13362 \@crefcopyformats{enumii}{enumiii}%
13363 \@crefcopyformats{enumiii}{enumiv}%
13364 \@crefcopyformats{enumiv}{enumv}%
13365 % \end{macrocode}
13366 % Definition of default |\labelcref| formats also needs to be postponed
13367 % until beginning of document, in case |\crefdefaultlabelformat| has been
13368 % modified.
13369 % \begin{macrocode}
13370 \@labelcrefdefinedefaultformats%
13371 %
13372 \let\cref@language\relax%
13373 }% end of \AtBeginDocument
13374 % \end{macrocode}
13375 %
13376 %
13377 %
13378 % \subsection{\file{cleveref.cfg} Config File}
13379 % \begin{macro}{cleveref.cfg}
13380 % If \LaTeX{} can find a \file{cleveref.cfg} file in its search path,
13381 % then we read in whatever's in it. The intended use of
13382 % \file{cleveref.cfg} is to make it easy for authors to customise the
13383 % cross-reference formats for all their documents, without having to
13384 % manually include the definitions in every document preamble. In order
13385 % for these customisations to override the default formats, we input
13386 % \file{cleveref.cfg} right at the end, after the rest of
13387 % \package{cleveref} has loaded.
13388 % \begin{macrocode}
13389 \InputIfFileExists{cleveref.cfg}%
13390 {\PackageInfo{cleveref}{reading definitions from cleveref.cfg}}{}%
13391 % \end{macrocode}
13392 % \end{macro}
13393 %
13394 %
13395 %
13396 % \Finale
13397 \endinput
13398 %%
13399 %% End of file `cleveref.dtx'.
13400
13401 %%% Local Variables:
13402 %%% mode: doctex
13403 %%% TeX-command-default: "Make"
13404 %%% fill-column: 73
13405 %%% TeX-master: t
13406 %%% End: