While \cref{vip:1-4}
---where vip
refers to a tcolorbox
---will typeset as Alert 1-4 ∞ is not a number
and \labelcref
will typeset as 1-4 ∞ is not a number
, occasionally I would like to go one step further and typeset only ∞ is not a number
.
Here is a MWE:
\documentclass[11pt]{book}
\usepackage[hyperfootnotes=false]{hyperref}%
\usepackage{cleveref}%
\usepackage{tcolorbox}%
\newcounter{vip}%
\newtcolorbox%
[%
use counter= vip,
number within=chapter,
number freestyle={\noexpand\thechapter.\noexpand\arabic{\tcbcounter}~\noexpand\mytitlealert},%.
crefname={Alert}{Alert},
Crefname={Alert}{Alerts},
]%
{mportant}%
[2][]%
{%
detach title,%
before upper={\tcbtitle\quad},
fonttitle=\bfseries,
coltitle=black,
code={\gdef\mytitlealert{#2}},%
title=ALERT \thetcbcounter,%
#1,
}%
\begin{document}
\chapter{One}
\begin{mportant}[label={vip:1-4}]{$\infty$ is not a number}
\hspace{-3mm}and we cannot compute with $\infty$.
\end{mportant}
\chapter{Two}
We cannot input $\infty$ because \labelcref{vip:1-4} (\Cpageref{vip:1-4})
\end{document}
and, occasionally, I would like not to have the reference number 1.1
at the beginning of the reference in: