gusbrs / zref-clever

Clever LaTeX cross-references based on zref
LaTeX Project Public License v1.3c
11 stars 4 forks source link

Does `labelhook` option make `tcolorbox`' `label is zlabel` option useless? #19

Closed dbitouze closed 1 year ago

dbitouze commented 1 year ago

The documentation, section 7, states:

However, the labelhook option (see Section 8) leverages the kernel’s label hook to also set a \zlabel when a standard \label is called, so that we can simply use \labels in our document and refer to them with either referencing system.

Does it mean the tcolorbox' label is zlabel option becomes useless?

gusbrs commented 1 year ago

Hi @dbitouze

Does it mean the tcolorbox' label is zlabel option becomes useless?

No it doesn't. First of all, one can always prefer to continue using \zlabel (you've probably seen it, but it is discussed in the "\label or \zlabel?" section of the manual). Second, the tcolorbox label type option won't work for zref unless label is zlabel is enabled. For two reasons, first label type with label is label presumes cleveref is loaded, and calls \label with an optional argument, so that if you only load zref-clever and use that option, you'll get an error. Second, \zcsetup{reftype=...} is only called with label is zlabel. In sum, you need label is zlabel to use label type with zref-clever.

It would actually be good if this second restriction could be lifted, but I think tcolorbox's maintainer has already been generous enough with zref-clever specifics of late (see https://github.com/T-F-S/tcolorbox/issues/206 and https://github.com/T-F-S/tcolorbox/issues/230), I would not want to abuse. And there's also a technical problem in trying to generalize this, and it is the aforementioned fact that tcolorbox unconditionally calls \label with an optional argument if label is label, which requires cleveref because that's the only place which defines \label this way. So it would be somewhat tricky, and I'm not sure if worth the hassle.