1

This is a problem concerning \IEEEeqnarray, \IEEEyessubnumber, and \eqref in combination with hyperref.sty.

\documentclass{article}
\usepackage{amsmath}
\usepackage{IEEEtrantools}
\usepackage{hyperref}
\begin{document}
page1\newpage
\phantomsection\begin{IEEEeqnarray}{rCl}
\IEEEyesnumber\label{eqn} \IEEEyessubnumber*
  a &=&b \label{subeqn}\\
    &=&c
\end{IEEEeqnarray} 
clicking \eqref{subeqn} sends me to the correct position :)\\
clicking \eqref{eqn} sends me to the beginning of the document :(
\end{document}

enter image description here

Problem
Clicking on (1) sends me to the beginning of the document, instead of to Equation (1).


Related questions
"IEEEeqnarray vs. hyperref -> reference jumps to the beginning of the section "
I think it is not a duplicate as the solution therein, namely adding \phantomsection as in the MWE, has no effect.

Additional Information
I use IEEEtrantools 2015/08/26 V1.5 by Michael Shell.


6
  • 2
    what is so special on IEEEeqnarray, that you use it? you load amsmath and with it you can use align inside subequations and all will work as expected ... – Zarko Aug 20 '18 at 13:41
  • this document even more convinced me, that amsmath environments are superior to result of the IEEEeqnarray. however, with way as i suggested you before, links will work as expected. – Zarko Aug 20 '18 at 14:04
  • @Zarko see Section 4.1 moser-isi.ethz.ch/docs/typeset_equations.pdf I'd prefer if we leave it to that instead of trailing off topic ;) – Felix Aug 20 '18 at 14:30
  • 1
    Sorry, but I couldn't agree less with the reference you link. The fact that the author suggests using some sort of \hspace which (I quote) "will never yield a precise arrangement" simply means the author does not know how to use align. – campa Aug 20 '18 at 14:30
  • 1
    Don't misunderstand me, I have nothing against IEEE. It seems a valid alternative. But all alleged flaws of amsmath are just ignorance of the author. Which syntax is more convenient might well be a matter of taste. – campa Aug 21 '18 at 18:58
2

IEEEeqnaray uses \stepcounter{equation} instead of \refstecounter{equation}, then sets \@currentlabel and \@currentHref directly. \IEEEyesnumber just sets a flag for later use.

The group containing \label{eqn} can be inserted almost anywhere. It is a sort of \pseudoequation command.

\documentclass{article}
\usepackage{amsmath}
\usepackage{IEEEtrantools}
\usepackage{hyperref}

\begin{document}
page1\newpage

\begin{IEEEeqnarray}{rCl}
{\addtocounter{equation}{-1}\refstepcounter{equation}\label{eqn}}%
\IEEEyesnumber\IEEEyessubnumber*
  a &=&b \label{subeqn}\\
    &=&c
\end{IEEEeqnarray} 
clicking \eqref{subeqn} sends me to the correct position :)\\
clicking \eqref{eqn} sends me to the beginning of the document :(
\end{document}
3
  • Thank you John - it works! I've saved myself some adaption time by just redefining \IEEEeqnarray accordingly, i.e., I add to the preamble \let\oldIEEEyesnumber\IEEEyesnumber \renewcommand{\IEEEyesnumber}[0]{{\addtocounter{equation}{-1}\refstepcounter{equation}}\oldIEEEyesnumber} – Felix Aug 20 '18 at 14:58
  • 2
    The \label has to be inside the group with the \refstepcounter. I deliberately used local changes so as not to interfere with the subequation numbering. Try creating a \eqnlabel command instead. – John Kormylo Aug 20 '18 at 15:14
  • Thank you again John! \newcommand{\eqlabel}[1]{\addtocounter{equation}{-1}\refstepcounter{equation}\label{#1}} – Felix Aug 21 '18 at 7:20

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.