Cleveref: Parentheses around references to subequations using \labelcref

You are right, in version 0.18.9 the parenthesis were there.

In the latest version, additional support for subequations has been added. So says the documentation:

Added separate subequation cross-reference type

First of all, you have to use subequation instead of subequations and, for them, \labelcrefformat instead of \creflabelformat and \labelcrefrangeformat instead of \crefrangelabelformat, that is

\labelcrefformat{subequation}{#2(#1)#3}
\labelcrefrangeformat{subequation}{#3(#1)#4 to #5(#2)#6}

instead of

\creflabelformat{subequations}{#2(#1)#3}
\crefrangelabelformat{subequations}{#3(#1)#4 to #5(#2)#6}

MWE:

\documentclass{article}
\usepackage{parskip}
\usepackage{amsmath}
\usepackage[colorlinks]{hyperref}
\usepackage{cleveref}

% Change so that the parentheses for equations are part of the hyperlink
\creflabelformat{equation}{#2(#1)#3}
\crefrangelabelformat{equation}{#3(#1)#4 to #5(#2)#6}

% This does work:
\labelcrefformat{subequation}{#2(#1)#3}
\labelcrefrangeformat{subequation}{#3(#1)#4 to #5(#2)#6}

\begin{document}
\textbf{Writing three subequations:}
\begin{subequations}\label{eqn:abc}
    \begin{align}
        A&=B\label{eqn:abc1}\\
        B&=C\label{eqn:abc2}\\
        C&=A\label{eqn:abc3}
    \end{align}
\end{subequations}
Referencing using \texttt{$\backslash$cref}: \cref{eqn:abc}, \cref{eqn:abc1}, \cref{eqn:abc2}, \cref{eqn:abc3}.

Referencing using \texttt{$\backslash$labelcref}: \labelcref{eqn:abc}, \labelcref{eqn:abc1}, \labelcref{eqn:abc2}, \labelcref{eqn:abc3}. $\leftarrow$ Parenthesis are \emph{NOT} missing for subequations!\\[2ex]

\textbf{Writing two separate single equations:}
\begin{equation}\label{eqn:singlexy}
    x=y
\end{equation}
and
\begin{equation}\label{eqn:singleyx}
    y=x
\end{equation}
Referencing using \texttt{$\backslash$cref}: \cref{eqn:singlexy}, \cref{eqn:singleyx}.

Referencing using \texttt{$\backslash$labelcref}: \labelcref{eqn:singlexy}, \labelcref{eqn:singleyx}. $\leftarrow$ Parenthesis are \emph{not} missing for normal equations!
\end{document} 

Output:

enter image description here

Strangely enough, for equations you have to use \creflabelformat and \crefrangelabelformat.


In my case

\crefalias{subequation}{equation}

in the preamble was the best solution for this problem. (I got this idea from this answer to the same question asked by somebody else.)

The great advantage of this solution is, that

\labelcref{equation1,subequation2a)
\labelcref{eqn:singlexy,eqn:abc2} %in your example

works too. (In the accepted solution this would not work.) Other advantages of this solution are:

  • Only one line in the preamble has to be added.
  • You don't have to think about different languages
  • You don't have to think about modifications like \newcommand{\crefrangeconjunction}{--}

Are there any disadvantages of this (\crefalias{subequation}{equation}) solution?