For example, if you want cross-references at the beginning of a sentence formatted in any way other than capitalizing the first letter of the cross-reference text, it is impossible to use varioref. For example, this can be useful when setting cross-references in a language for which the ending of the cross-reference name changes depending on where it is used in a sentence. It is best to think of the empty reference as "attached" to the cross-reference that precedes it.
The error message indicates the name of the unknown cross-reference type, which you then probably want to define. Cross-reference formats are usually made up of components: the name of the cross-reference (different for each type of cross-reference), the format for the label itself, and the conjunctions used in reference ranges and lists with multiple cross-references.
Customising the Cross-Reference Components
Global Customisation
The cleveref package allows you to take full control over setting up the type of cross-references by allowing you to customize the formatting. If cleveref encounters a cross-reference to a type it doesn't know, it will produce a "reference type undefined" warning and type the cross-reference as . sticker counter preceded by a double question mark. It does not have to be an actual conjunction in the linguistic sense, e.g. it is quite reasonable to define it as the letter "--". The crefrange conjunction is used directly between the start and end references in the reference scope, without any extra space surrounding it, e.g.\crefrange{thm1}{thm2} is set as . theorems~\ref{thm1}\crefrangeconjunction\ref{thm2}. so you may or may not want to include the surrounding space depending on the design you want. requires surrounding space while.
These commands are not used in the default English format definitions, but they are required in some languages to correctly print an array. The conjunctions used in lists of multiple cross-references can be modified by. define the commands \crefpairconjunction, \crefmiddleconjunction and. crefpair conjunction is used when there are only two cross-references in the list, \creflast conjunction is used between the penultimate and final cross-reference in a list of more than two, and \crefmiddle conjunction is used between all others.
Customising Individual Cross-Reference Types
By default, links are used to separate different sub-lists. The reference types in a multi-reference are identical to those used to separate cross-references of the same type.5 You can override this by defining the \crefpairgroupconjunction, \crefmiddlegroupconjunction, and \creflastgroupconjunction commands. 1)\crefrangeconjunction(3)\crefmiddlegroupconjunction theorem 1\crefpairconjunction2\crefmiddlegroupconjunction fig. The cross-reference is usually the name of the counter for the setting (equation, chapter, section, etc.). Exceptions are appendices, tags whose type is explicitly overridden by providing an optional argument (see section 7), and theorem-like environments when the theorem package is loaded, for which the type must be the name of the environment (lemma, conclusion, definition, etc.) even when the same environments are part of different sequence numbers. (nteorem provides additional environment information when different theorem-like environments share a common counter, which cleveref uses to distinguish them automatically.) In the case of plugins, htypei is "appendix" for the top-level section command (\chapter\section, depending on the document class), "for the subsection command \ubsection" below plugin" for the next level section command, etc.
For convenience, unless otherwise adapted by the end of the preamble, the cross-reference name (and label format) for a subsection is by default inherited from that of a section, and the name of a subsection is inherited from a subsection (which may itself have been inherited from a section). The first two (#1 and #2) are formatted versions of the two tag counters that define the reference range.
Automatic \newtheorem Definitions
Low-Level Customisation: Taking Full Control
- Single Cross-References
- Reference Ranges
- Multiple Cross-References
- Label Cross-References
The other two are used to indicate the start and end of the part of the cross-reference that forms the hyperlink when the hyperref package is used, and must appear in that order (see Section 9). The first two (#1 and #2) are formatted versions of tag counters, the next two (#3 and #4) are used to mark the start and end of the hyperlink for the first cross-reference, and the last two (#5 and #6) mark the start and end of the second cross-reference hyperlink. Be careful that the spaces at the beginning and end of the formatting code are correct: thehfirstiandhsecondi, orhfirsti,hmiddleiandhlasti, LATEX code is typed one after the other in multireferences, not separated by a space.
You may want spaces at the beginning and end of the formatting code, depending on the formatting you want. If you define the format for a particular cross-reference type using low-level customization commands, and still want to use the \labelcref command to produce only the label portion of the cross-reference, you must also define the appropriate \labelcref formats for that type.
Language and babel support
The babel support works by redefining the cross-reference names and conjunctions for the default cross-reference types. Note that if you define an empty cross-reference name for some type using an empty\crefname, e.g. This can be useful if you want multiple counters to use the same cross-reference format.
Sometimes you want to override the cross-reference type for a particular label once. You have to somehow ensure that the correct contra-alias is used depending on the cross-reference format you want (probably by defining two variants of the environment in question).
Possible Improvements
Basically, the core of the implementation consists of causing some extra information - the "type" tag - to be written to the aux file and defining the \cref commands which use this extra information to set the reference. However, to avoid other packages messing with the contents of the parallel set of specific smart tags, we write them directly to the aux file itself. We bypass the internals of the theamsmath \tag command to add the additional information to the tag definition.
We add a large value to the front of the counter data, to force references to anything in appends to be sorted after everything else. Again, the large value added to the front of the counter data forces references to side items to be sorted last.
Utility Macros
- miscelaneous
- aux file information
- Stack data structures
- Sorting and comparison of counters
- Reference stack processing
The first argument is the counter in question; the return value is stored in the second argument, which must be a macro name. We fully expand the first argument (countername) because sometimes we are given a countername that contains a macro. If the counter in question is the equation in question and the parentheses of the counter is defined, check if it is reset from this.
Cross-Referencing Commands
If the subset is now empty, we'll need to assign an "end" reference, otherwise we'll need to assign a "middle" reference. If there were no consecutive references, just type the next reference;. if there were only two consecutive references, write the first and return the second to the sub-stack,. If the reference format is undefined, but we are specifying a \labelcref, fall back to the default \labelcref formats. 1224 \@latex@warning{#2 \Space reference format for label type. hidden.
If the reference format is not defined but we enter \labelcref, fall back to the default of \labelcrefformats. 1272 \@latex@warning{#3\format scope of reference space for label. Finally, we define \labelcref, which returns only the label part of the (multi)reference type string, without the name of the reference, and vice versa \namecref,.
Format Component Commands
Cross-Reference Format Definition Commands
Bring all four arguments to \labelcrefmultiformatin token register\@toksb, then call it to define default formats. The helper macros do the real work by using the first argument ("cref" or . "Cref", and "crefrange" or "Crefrange") to determine how the corresponding command should be defined with the second case. The following\@tempamacro makes use of the fact that the first character in #1 is "c" for lowercase and "C" for uppercase, to wrap the case-dependent parts into macros so that the rest of the code can be case-variant.
Define\@tempato be a partial expansion (expanded only once) of the uppercase variant we just defined above. Define the second uppercase variant to be the partial expansion (expanded only once) of \@tempa. The following\@tempamacro makes use of the fact that the first character in #1 is "c" for lowercase and "C" for uppercase, to wrap uppercase-.
The following\@tempamacro makes use of the fact that the first character in #1 is "c" for lowercase and "C" for uppercase, to wrap the case-dependent parts into macros so that the rest of the code can be case-agnostic. If the second uppercase variant of the first part of the multiformat definition is not already defined. The other parts of the multiformat definition are defined to be identical for both variants of uppercase.
Other parts of the multiple format definition are defined as the same for both case versions.
Redefine \cref and everything else to allow starred variants, which do not create hyperlinks. Redefine \@@setcref and \@@setrangeref to create hyperlinks (unless the star flag is set), using the extra arguments provided in\r@cref@hlabeli(via the aux file) byhyperref.
We do this in such a way that default definitions or explicit\crefname definitions for statement-like environments override those automatically produced by our modified\new statement. If the latter is ever needed, it will produce an "undefined cross-reference type" warning, prompting the author to provide an appropriate one. Cref@htypei@name to all three of these, adding the statement-like environment to the list of cross-reference types to be defined from components.
Since we want explicit \crefnames to override these automatic definitions, we store the definitions in \cref@htypei@name@preamble, which are processed at\begin{document}) if they are not overwritten. The default definitions are also stored in\cref@htypei@name@preamblelater on, so they will also override these automatic definitions, which is what we want. However, this is also true of (new) cross-reference types defined with \crefname, so it doesn't seem worth the effort to make the automatic definitions work within the document body.
Since amsmath's\@ynthm uses a different parameter list than the default LATEX\@ynthmmacro, we are intentionally ignoring our previous redefinition and adding the automatic\crefnamedefinitions code directly to this version. ALG@step We modify the \LG@step macro of the algorithm, which increments the line number so that the necessary information is stored in \cref@currentlabel. Usually this isn't a problem for cleveref, as subfig's modified \efstepcounter calls cleveref's version after it has done its job.
We redefine \efsteponlycounter so that passing an optional argument completely bypasses subfig's code and only calls the smartefcode directly.
This frees up the starred variants to be used to suppress hyperlinks when loading hyperrefs, as usual.
Poor Man’s cleveref
Read lines from the temporary script file, expand them to escape regexp special characters, and save them in\cref@poorman@text.
Sort and Compress options
Capitalise option
Language and babel Support
Default Cross-Reference Formats