# how to use cleveref with IEEEeqnarray?

Here is the codes. I have 3 questions about the labeling by using the packages IEEEtrantools and cleveref together.

\documentclass{amsart}
\usepackage[capitalize]{cleveref}
\crefname{ineq}{Ineq.}{Ineqs.}
\Crefname{ineq}{Inequality}{Inequalities}
\creflabelformat{ineq}{~\upshape(#2#1#3)}
\numberwithin{equation}{section}
\usepackage[retainorgcmds]{IEEEtrantools}

\begin{document}

\section{IEEE}

\begin{IEEEeqnarray}{rCl}
a
&>&b+c \IEEEyessubnumber\label[ineq]{1a}\\
&>&f+g \IEEEyessubnumber\label[ineq]{2a}
\end{IEEEeqnarray}

I have 2 questions here.
1) In PDF, the labels behind the inequalities are (1.0a) and (1.0b).
How can I get (1.1a) and (1.1b)?
2) The command \verb|\cref| gives \cref{1b,2b}.
How can I get Ineqs. (1.1a) and (1.1b)'' by using \verb|\cref|?

\begin{IEEEeqnarray}{rCl}
a
&<&b+c \IEEEyessubnumber\label[ineq]{1b}\\
&<&f+g \IEEEyessubnumber\label[ineq]{2b}
\end{IEEEeqnarray}

I have another question here.
3) In PDF, the labels behind the inequalities are (1.0c) and (1.0d).
How can I get (1.2a) and (1.2b)?

\end{document}


I can address questions 1 and 3 fully. I'm afraid I can offer only work-arounds for question 2.

Regarding question 3: Use \IEEEyesnumber before \IEEEyessubnumber in the inequality labelled 1b.

Regarding question 1: Since you're using the amsart document class, which loads the amsmath package, it turns out to be better not to use the \IEEEyessubnumber directives and, instead, to encase the IEEEeqnarray environments in subequation environments. With this change in place, the printed equation "numbers" come out as expected. (If you make this change, you should omit all \IEEEyesnumber and \IEEEyessubnumber directives.)

Regarding question 2: With subequation environments in use, the names of the items being cross-referenced via \cref -- Ineqs -- are correct but the numbers are not: \cref{1b,2b} produces "Ineqs. (1.2) and (1.2)" rather than "Ineqs. (1.1a) and (1.1b)". (If the [ineq] qualifiers are omitted, the name changes from "Ineqs." to "Eqs." but the numbers are still incorrect; hence, the problem isn't caused by the use of the [ineq] label modifiers.) I can only surmise that cleveref's support for the IEEEeqnarray environment isn't perfect. Contacting the authors of the cleveref and IEEEtrantools packages and asking them for a fix is probably the way to go to get a complete solution.

In the meantime, it's possible to work around this problem by writing

... Ineqs.~\eqref{1a}) and~\eqref{1b} ...


This foresakes the elegance of \cref, but it has the merit of working.

A separate potential work-around: The \cref macro is known to work very well with the amsmath-based multiline-math environments. Thus, you may want to consider switching from the environments of the IEEEtrantools package to those of the amsmath package. (Note that the amsmath package is loaded automatically by the amsart document class.) As an intermediate step, you could choose to use the amsmath environments just for those equation groups that involve subequation-style numbering.

\documentclass[reqno]{amsart}
\numberwithin{equation}{section}

\usepackage[capitalize]{cleveref}
\crefname{ineq}{Ineq.}{Ineqs.}
\Crefname{ineq}{Inequality}{Inequalities}
\creflabelformat{ineq}{~\upshape(#2#1#3)}

\usepackage[retainorgcmds]{IEEEtrantools}

\begin{document}
\section{IEEE}

\subsection{Using \texttt{subequations} and \texttt{IEEEeqnarray}}

\begin{subequations}
\begin{IEEEeqnarray}{rCl}
a &>&b+c \label[ineq]{1a}\\
&>&f+g \label[ineq]{2a}
\end{IEEEeqnarray}
\end{subequations}

The printed numbers'' are (1.1a) and (1.1b), as desired.

\verb|\cref| gives \cref{1a,2a}'', but Ineqs. (1.1a) and (1.1b)'' is desired.

\subsection{Using \texttt{subequations} and \texttt{align}}

\begin{subequations}
\begin{align}
a &<b+c \label[ineq]{1b}\\
&<f+g \label[ineq]{2b}
\end{align}
\end{subequations}

The printed numbers'' are (1.2a) and (1.2b), as desired.

\verb|\cref{1b,2b}| gives \cref{1b,2b}'', also as desired.

\end{document}