# Cleveref equation to match italic local style.

This question is similar to \eqref in italic math environnment, but I think all the cross referencing tools from cleveref justify a separate question.

I would like cleveref to produce the equation number in a format which is the same as the local environment, namely the italic style in a theorem. The reason I point this out is because other referenced items (like the assumptions) match but the equations don't, and it currently looks inconsistent.

Currently I am using the minimal \crefname{equation}{}{} as suggested in this answer.

### Disclaimer

I realise there is good reason for having \eqref be upright, but this seems to stem from avoiding strange symbols like & or non-numerical equation labels change drastically between upright and italic. Given I only ever use numeric labels this doesn't seem to apply.

# Example

where we can notice the difference between (1)/(1):

## MWE

\documentclass{extarticle}

\usepackage{amsmath,amsthm,cleveref,physics}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{assumption}{Assumption}[section]
\Crefname{theorem}{Theorem}{Theorems}
\crefname{equation}{}{} % so cleveref mathes eqref style

\begin{document}
Einstein gave us
$$\label{eqt} e = mc^2.$$
\begin{assumption}\label{asmp}
An observer $S$ measures a velocity $v$ where $\abs{v} < c$.
\end{assumption}
\begin{theorem}
\label{thm}
Using \cref{eqt}/(\ref{eqt}) and \Cref{asmp}, the natural choice of metric is $g_{\mu\nu} = \mathrm{diag}(1,1,1,-1)$.
\end{theorem}
\section{Some comments on \Cref{thm} and \Cref{eqt}} % Some maniac might want to do this....
\end{document}


### Extras

If the solution can be clean enough so that it would transfer in environments outside of theorem (e.g. bold) such as sections that would be great. (I can't think of a reason why I would want to do this yet, but anticipate someone else might at a later date).

• The good reasons for printing equation numbers always upright are not related to “strange symbols”. The example in the answer you refer to is very misleading. – egreg Oct 10 '18 at 19:56

The cleveref package provides the command \creflabelformat, which allows you to change the formatting of labels. I'll quote the documentation:

\creflabelformat

You may want the label format for a particular cross-reference type to differ from the global format set by \crefdefaultlabelformat (see Section 8.1.1). You can do this using

\creflabelformat{⟨type⟩}{⟨format⟩}


The ⟨type⟩ argument is the cross-reference type to customise, and the ⟨format⟩ argument defines the label format for cross-references of that type. As in the case of \crefdefaultlabelformat, the latter should contain the three arguments #1, #2 and #3, the first being the formatted version of the label counter, the others determining the beginning and end of the portion that becomes a hyperlink when the hyperref package is loaded (see Section 13). #2 and #3 must appear in that order.

When you load the cleveref package, one of the many things it does is execute the following line:

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


The \textup command is what causes the equation number (and the surrounding braces) to be set upright. You can remove this feature by adding \creflabelformat{equation}{(#2#1#3)} to your preamble (the same thing, but without \textup).

\documentclass{extarticle}

\usepackage{amsmath,amsthm,cleveref,physics}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{assumption}{Assumption}[section]
\Crefname{theorem}{Theorem}{Theorems}
\crefname{equation}{}{} % so cleveref mathes eqref style

\creflabelformat{equation}{(#2#1#3)}

\begin{document}
Einstein gave us
$$\label{eqt} e = mc^2.$$
\begin{assumption}\label{asmp}
An observer $S$ measures a velocity $v$ where $\abs{v} < c$.
\end{assumption}
\begin{theorem}
\label{thm}
Using \cref{eqt}/(\ref{eqt}) and \Cref{asmp}, the natural choice of metric is $g_{\mu\nu} = \mathrm{diag}(1,1,1,-1)$.
\end{theorem}
\section{Some comments on \Cref{thm} and \Cref{eqt}} % Some maniac might want to do this....
\end{document}


• Will this also affect \crefformat, \crefmultiformat, \crefrangeformat, \labelcrefformat, or do these also need to be adjusted? (This was the appeal in using \crefname{equation}{}{}). – oliversm Oct 10 '18 at 19:24
• These should not need to be adjusted, unless you already manually set them elsewhere in your document. – Circumscribe Oct 10 '18 at 19:36
• The default label format for equations actually depends on whether the nameinlink option is provided to cleveref. I had accidentally copied the wrong version (fixed now). If you do use the nameinlink option you should instead add \creflabelformat{equation}{#2(#1)#3}. – Circumscribe Oct 10 '18 at 19:57