1

What do the two commands \labelcrefformat and \creflabelformat do exactly? In the documentation of cleveref I see both mentioned. While \creflabelformat is described (without any examples, unfortunately) on p. 15, \labelcrefformat is mentioned only twice (without any particularities):

The \labelcref command will typeset cross-reference labels using the default label format if no type-specific format is defined using \creflabelformat (see Sections 8.1.1 and 8.1.2). Note that, if you customise reference formats using the low-level commands, you may want to also explicitly define the \labelcref formats to match, using the \labelcrefformat etc. commands (see Section 8.2).

The only other reference to \labelcrefformat is in Section 8.2:

If you define the format for a particular cross-reference type using the low-level customisation commands, and still want to use the \labelcref command to produce just the label part of the cross-reference, then you must also define the appropriate \labelcref formats for that type. This is done using the \labelcrefformat, \labelcrefrangeformat, \labelcrefmultiformat and \labelcrefrangemultiformat commands.

So how do these two commands differ? Any examples of using these two commands, especially \labelcrefformat?

1 Answer 1

1

creflabelformat is a "high-level" setting in cleveref terminology.

It allows you to change how the reference itself (without the type) will be rendered for a specific reference type.

Basically it does exactly the same as crefdefaultlabelformat, but for rendering references of a particular type instead of all references altogether (except equations, because reasons).

Example:

\creflabelformat{section}{(((#2#1#3)))}
...
See \cref{mylabel}. % mylabel points to a section 2.1

produces See sect. (((2.1))), but references to all other types (figures, tables etc.) will be untouched. On the other hand, section numbers will look like (((X.X))) for all rendering modes, including ranges (like sect. (((2.2)))-(((2.4)))) and lists (like sect. (((2.2))), (((2.4))) and (((2.6)))).


labelcrefformat is a "low-level" setting in cleveref terminology.

Together with labelcrefrangeformat, labelcrefmultiformat and labelcrefrangemultiformat it allows you to completely redefine the behavior of \labelcref, exactly as crefformat, crefrangeformat, crefmultiformat and crefrangemultiformat allow you to completely redefine the behavior of \cref.

Example:

\crefformat{section}{sect.~<#2#1#3>}
\labelcrefformat{section}{<#2#1#3>}
...
\labelcref{mylabel} % mylabel points to a section 2.1

produces <2.1>.

Notice that labelcrefformat and friends are meant to be crutches to make \labelcref work when you tune the behavior of \cref with crefformat (and friends), i.e. use the low-level interface. If you also use \creflabelformat (i.e. high-level interface), and remove \crefformat from the example above, \labelcref will be rendered as usual. (Obviously this is not a problem since it's a degenerate case).

You must log in to answer this question.