0

In the document I'm working on, in most cases I need \cref{eq:kolmogorov} to write, e.g., Equation (2.4). But in some specific cases I only need it to be (2.4), without Equation. How can I do this?

EDIT: I could use \eqref{}, but the problem is that the parentheses are not coloured with \eqref, only the number is.

4
  • Welcome to TeX SX! Use \eqref{eq:komogorov}.
    – Bernard
    Jun 15, 2019 at 18:03
  • Hi, thank you! Yes but the problem is that the parentheses are not coloured when using \eqref{}. Is there a way to colour them? Jun 15, 2019 at 18:06
  • Maybe \textcolor{some colour}{\eqref{...}} (for which you could define a \myeqref macro)?
    – Bernard
    Jun 15, 2019 at 18:08
  • Yes, it worked perfectly. Thank you! Jun 15, 2019 at 18:27

1 Answer 1

0

The cleveref package has the \labelcref macro for this:

\documentclass{article}

\usepackage[colorlinks]{hyperref}
\usepackage[nameinlink]{cleveref}

\begin{document}

\begin{equation}
xxx\label{key}
\end{equation}

\cref{key}

\labelcref{key}

\end{document}

enter image description here

1
  • Exactly what I was looking for. I didn't know that macro. Thanks! Jun 15, 2019 at 19:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .