How to make cleveref cross-references match a modified equation label style?
In my point of view the easiest (though not most elegant, perhaps) way is to change \creflabelformat
for the equation
counter as well, applying the \tagform@
macro explicitly for this.
\creflabelformat{equation}{#2\tagform@{#1}#3}
The #2
and #3
are reserved for hyperref
targets.
Here's the full code.
\documentclass{article}
\usepackage{amsmath}
\usepackage[capitalise,noabbrev,]{cleveref}
\makeatletter
\def\tagform@#1{\maketag@@@{[\ignorespaces#1\unskip\@@italiccorr]}}
\creflabelformat{equation}{#2\tagform@{#1}#3}
\makeatother
\begin{document}
\cref{eq1} is fancy
\begin{equation}\label{eq1}
a = b
\end{equation}
\end{document}
The following solution uses the \newtagform
and \usetagform
macros of the mathtools
package and the \creflabelformat
macro of the cleveref
package to achieve your formatting objective.
\documentclass{article}
\usepackage{mathtools} % for "\newtagform" macro
\newtagform{brackets}{[}{]}
\usetagform{brackets} % employ square brackets as delimiters around eq. numbers
\usepackage[capitalise,noabbrev]{cleveref}
\creflabelformat{equation}{#2{\upshape[#1]}#3}
\begin{document}
\cref{eq1} is fancy.
\begin{equation}\label{eq1}
a = b
\end{equation}
\end{document}