1

I use the cleveref package to produce equation references like Figure 3 and Equation (12). The parentheses for equation references are fine most of the time, but it seems silly when the reference is already enclosed by parentheses.

When I use ...(e.g. \Cref{eqn:ExampleEqn}), it typesets it as ...(e.g. Equation (6)). What I want is it to look like ...(e.g. Equation 6).

I know \citep{} has the ability to typeset citations differently: \citep[e.g.][]{Author2019} produces (at least, using the Elsevier author-year citation style) (e.g. Author, 2019). I'm hoping for something like this with cleveref.

Does cleveref have a "clever" way to reference things inside parentheses so that it doesn't add the extra set of parentheses? If so, how? If not, what is a good way to do that for this one time (similar SX questions have answers that generally are for the entire document)?

  • are you sure you really want that? it sticks out to me as inconsistent; I personally prefer to typeset with square brackets for equations [Eqn. (6)]. That's the way aps journals do it as well, if I'm not mistaken. – Troy Jan 7 at 23:20
  • Will there always be just one equation number to cross-reference in this parenthetic manner? Or might there be instances of the type (e.g., Equations 4, 5, and 7)? – Mico Jan 7 at 23:30
2

Make the parentheses to be inserted by macros which you can redefine at will.

\documentclass{article}
\usepackage{amsmath}
\usepackage{cleveref}

\crefformat{equation}{Equation~\textup{\OPEN#2#1#3\CLOSE}}
\newcommand{\OPEN}{(}
\newcommand{\CLOSE}{)}
\newcommand{\tcref}[1]{%
  \begingroup
  \renewcommand{\OPEN}{}%
  \renewcommand{\CLOSE}{}%
  \cref{#1}%
  \endgroup
}

\begin{document}

\begin{equation}
a=b \label{test}
\end{equation}

\cref{test}

\tcref{test}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.