[Tex/LaTex] Omit round brackets around equation numbers with cleveref

amsmathbracketscleverefhyperref

By default equation numbers produced with the equation environment are put in round brackets. I want to get rid of these on the equation line as well as when referencing. karlkoeller gave a solution for this on this post (this solution requires amsmath).

But this fails when citing with \cref from the cleveref package while \autoref and the default \ref work as expected. See the MWE below.

How can this issue be solved? Or is it wiser to just switch to \autoref?

MWE

\documentclass{scrreprt}
\usepackage{mathtools}
\usepackage{hyperref}
\usepackage{cleveref}

% see: https://tex.stackexchange.com/questions/228448/removing-the-brackets-around-equation-numbering
\makeatletter
\renewcommand\tagform@[1]{\maketag@@@{\ignorespaces#1\unskip\@@italiccorr}}
\makeatother
%=====================================================
\begin{document}
foo
\begin{equation}
1+1=2
\label{eq:foo}
\end{equation}
Something is shown in \cref{eq:foo}. Also in \autoref{eq:foo}. And in equation \ref{eq:foo}.
\end{document}

Best Answer

Using \creflabelformat as follows

\creflabelformat{equation}{#2\textup{#1}#3}

helps.

creflabelformat

\documentclass{scrreprt}
\usepackage{mathtools}
\usepackage{hyperref}
\usepackage{cleveref}

% see: https://tex.stackexchange.com/questions/228448/removing-the-brackets-around-equation-numbering
\makeatletter
\renewcommand\tagform@[1]{\maketag@@@{\ignorespaces#1\unskip\@@italiccorr}}
\makeatother

\creflabelformat{equation}{#2\textup{#1}#3}

\begin{document}
foo
\begin{equation}
1+1=2
\label{eq:foo}
\end{equation}
Something is shown in \cref{eq:foo}. Also in \autoref{eq:foo}. And in equation \ref{eq:foo}.
\end{document}

Thanks to Mico for mentioning in the comments that you should consider using \textup{} to ensure an upright font for the references.