在 IEEEtrantools 中使用 \cref 引用两个以上子方程时出错

在 IEEEtrantools 中使用 \cref 引用两个以上子方程时出错

我想得到“(4c)-(4e)”,而不是在最后一行产生错误的“(4a)”。我也遇到了错误。

\documentclass{article}

\usepackage{amsmath}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
% for adjustting large optimization problems
\usepackage{IEEEtrantools}
%
% for reference ...
\usepackage[noabbrev]{cleveref}
\newcommand\crefrangeconjunction{\textendash}
\crefname{equation}{}{}

\begin{document}
We have the following equations:
\begin{align}
    &1 =   1 \label{eq:Ymin}\\
    & 2 =   2 \label{eq:Omax} \\
    & 3 =   3 \label{eq:Vmin}
\end{align}

\begin{subequations}\label{OptDet}
\begin{IEEEeqnarray}{s,l}
&\IEEEeqnarraymulticol{1}{l}{x\label{OptDet:Obj}
}\\
s.t. & t = 1,\dots,T\nonumber\\
    & 1 =   1 \label{OptDet:ConstQ} \\
    & 1 \leq 1 \IEEEyesnumber \label{OptDet:ConstYmin}\IEEEyessubnumber\label{OptDet:ConstYminA} \\
&1 \leq 1\IEEEyessubnumber\label{OptDet:ConstYminB} \\
&1 \geq 1\IEEEyessubnumber\label{OptDet:ConstYminC} \\
&1 \geq 1\IEEEyessubnumber\label{OptDet:ConstYminD} \\
    &2 \geq 2 \IEEEyesnumber \label{OptDet:ConstOmax}\IEEEyessubnumber\label{OptDet:ConstOmaxA} \\
&2 \geq 2 \IEEEyessubnumber\label{OptDet:ConstOmaxB} \\
&2 \leq 2 \IEEEyessubnumber\label{OptDet:ConstOmaxC} \\
&2 \leq 2 \IEEEyessubnumber\label{OptDet:ConstOmaxD} \\
    &3 \leq 3 \IEEEyesnumber \label{OptDet:ConstVmin}\IEEEyessubnumber\label{OptDet:ConstVminA} \\
&3 \leq 3 \IEEEyessubnumber\label{OptDet:ConstVminB} \\
&3 \geq 3 \IEEEyessubnumber\label{OptDet:ConstVminC} \\
&3 \geq 3 \IEEEyessubnumber\label{OptDet:ConstVminD} 
\end{IEEEeqnarray}
\end{subequations}

We have three sets of constraints \cref{OptDet:ConstYmin,OptDet:ConstOmax,OptDet:ConstVmin}, respectively, corresponding to the three equations \cref{eq:Ymin,eq:Omax,eq:Vmin}. 
\end{document}

我希望IEEEtrantoolsarticle课堂上一定要用到,也希望可以用作cleveref参考。

答案1

zref-clever如果您想尝试一下,这个特定示例几乎可以立即使用。唯一需要的调整是设置内部的 currentcounter,IEEEeqnarray因为处理计数器amsmath的方式不同。subequation

但是,@UlrikeFischer 说得对,它zref-clever不提供对 的特殊支持IEEEtrans。这通常不应该是个问题,但正如她所说,它做了很多特殊编号,所以这可能是个问题。事实是,我不熟悉IEEEtrans,也没有检查过它是否能很好地与 配合使用zref-clever。所以,如果你选择使用它,要小心可能出现的边缘情况。

\documentclass{article}

\usepackage{amsmath}
\usepackage{zref-clever}
\AddToHook{env/IEEEeqnarray/begin}{%
  \zcsetup{ currentcounter = equation }%
}
\zcRefTypeSetup{equation}{
  rangesep=\textendash,
  name-sg=,
  name-pl=,
  Name-sg=,
  Name-pl=,
}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
% for adjustting large optimization problems
\usepackage{IEEEtrantools}

\begin{document}
We have the following equations:
\begin{align}
    &1 =   1 \label{eq:Ymin}\\
    & 2 =   2 \label{eq:Omax} \\
    & 3 =   3 \label{eq:Vmin}
\end{align}

\begin{subequations}\label{OptDet}
\begin{IEEEeqnarray}{s,l}
&\IEEEeqnarraymulticol{1}{l}{x\label{OptDet:Obj}
}\\
s.t. & t = 1,\dots,T\nonumber\\
    & 1 =   1 \label{OptDet:ConstQ} \\
    & 1 \leq 1 \IEEEyesnumber \label{OptDet:ConstYmin}\IEEEyessubnumber\label{OptDet:ConstYminA} \\
&1 \leq 1\IEEEyessubnumber\label{OptDet:ConstYminB} \\
&1 \geq 1\IEEEyessubnumber\label{OptDet:ConstYminC} \\
&1 \geq 1\IEEEyessubnumber\label{OptDet:ConstYminD} \\
    &2 \geq 2 \IEEEyesnumber \label{OptDet:ConstOmax}\IEEEyessubnumber\label{OptDet:ConstOmaxA} \\
&2 \geq 2 \IEEEyessubnumber\label{OptDet:ConstOmaxB} \\
&2 \leq 2 \IEEEyessubnumber\label{OptDet:ConstOmaxC} \\
&2 \leq 2 \IEEEyessubnumber\label{OptDet:ConstOmaxD} \\
    &3 \leq 3 \IEEEyesnumber \label{OptDet:ConstVmin}\IEEEyessubnumber\label{OptDet:ConstVminA} \\
&3 \leq 3 \IEEEyessubnumber\label{OptDet:ConstVminB} \\
&3 \geq 3 \IEEEyessubnumber\label{OptDet:ConstVminC} \\
&3 \geq 3 \IEEEyessubnumber\label{OptDet:ConstVminD}
\end{IEEEeqnarray}
\end{subequations}

We have three sets of constraints \zcref{OptDet:ConstYmin,OptDet:ConstOmax,OptDet:ConstVmin}, respectively, corresponding to the three equations \zcref{eq:Ymin,eq:Omax,eq:Vmin}.

\end{document}

在此处输入图片描述

相关内容