3

I am using IEEEeqnarray to align long equations, but it seems it won't consider the width of the equation reference number when performing the aligningment, despite the documentation clearly stating "\IEEEeqnarray automatically adds a hidden column for equation numbering" (IEEEtrantools documentation, page 19).

My mwe, made just to illustrate the problem:

\documentclass[11pt, a4paper, english]{article}
\usepackage[retainorgcmds]{IEEEtrantools}

\begin{document}

\section{testing}

testing some stuff testing some stuff testing some stuff testing some stuff testing some stuff testing some stuff testing some stuff testing some  

\setcounter{equation}{110}

\begin{IEEEeqnarray}{rCl}
\int_{\Omega_{V^*}} \!\!\!\!\nabla \tilde{u} \cdot \nabla \varphi \;d\Omega - \int_{\Gamma_{V^*}} \!\!\!\!K_H\, \varphi\, \delta V\cdot \hat{n} \;d\Gamma &=& \int_{\Omega_{V^*}}\!\!\! f \varphi \;d\Omega + \int_{\Gamma_{V^*}}\!\!\! g\,\varphi \;d\Gamma
\end{IEEEeqnarray}

\begin{equation}
\int_{\Omega_{V^*}} \!\!\!\!\nabla \tilde{u} \cdot \nabla \varphi \;d\Omega - \int_{\Gamma_{V^*}} \!\!\!\!K_H\, \varphi\, \delta V\cdot \hat{n} \;d\Gamma = \int_{\Omega_{V^*}}\!\!\! f \varphi \;d\Omega + \int_{\Gamma_{V^*}}\!\!\! g\,\varphi \;d\Gamma
\end{equation}
testing some stuff testing some stuff testing some stuff testing some stuff testing some stuff testing some stuff testing some stuff testing some  

\end{document}

The output of the above is the following:

screenshot

As you can see the equation environment properly considers the space taken by the equation number, while IEEEeqnarray seems not to do it.

Any suggestion on how to handle this?

Thank you, Filippo

  • \rule{5cm}{2mm} &=& \rule{6cm}{2mm} confirms that like the normal eqnarray the equation number is not moved if the line is too long. Exactly where is it mentioned that IEEEeqnarray should be able to move the eqn number? I cannot find any documentation that has a page 19 – daleif Mar 23 '17 at 13:33
  • @daleif: here: ctan.mirrors.hoobly.com/macros/latex/contrib/IEEEtran/… At the very end of Page 19. EDIT: I never said that the equation number should be moved. Instead, the positioning of the equation itself should take into consideration the space occupied by the equation number, exactly like the "equation" environment does. – F. Remonato Mar 23 '17 at 13:40
4

There may be some confusion over what the expression "\IEEEeqnarray automatically adds a hidden column for equation numbering" means in practice. To my reading of the user guide, it simply means that care is taken not to let the math material "overlap" with the equation number. (By the way, this type of overlap is a well-known problem of the deprecated eqnarray environment. Indeed, the overlap issue is just one of several reasons for why eqnarray is considered deprecated and should no longer be used.)

The expression does not mean, though, that the resulting row will be centered in the exact same way as would be the case if it (the whole equation) had been entered directly as an equation environment. To achieve the latter effect, it's necessary to insert the directive \IEEEeqnarraynumspace on every row that's supposed to receive the special centering treatment.

enter image description here

\documentclass[11pt, a4paper]{article}
\usepackage[retainorgcmds]{IEEEtrantools}
\begin{document}

\setcounter{equation}{110}

\hrule % just to illustrate width of text block
\begin{IEEEeqnarray}{rCl}
\int_{\Omega_{V^*}} \mkern-12mu\nabla \tilde{u} \cdot \nabla \varphi \,\mathrm{d}\Omega 
-\int_{\Gamma_{V^*}} \mkern-12muK_H\, \varphi\, \delta V\cdot \hat{n} \,\mathrm{d}\Gamma 
&=& \int_{\Omega_{V^*}}\mkern-12mu f \varphi \,\mathrm{d}\Omega 
+\int_{\Gamma_{V^*}}\mkern-12mu g\,\varphi \,\mathrm{d}\Gamma
\IEEEeqnarraynumspace % <--- this is new
\end{IEEEeqnarray}
\hrule
\begin{equation}
\int_{\Omega_{V^*}} \mkern-12mu\nabla \tilde{u} \cdot \nabla \varphi \,\mathrm{d}\Omega 
-\int_{\Gamma_{V^*}} \mkern-12muK_H\, \varphi\, \delta V\cdot \hat{n} \,\mathrm{d}\Gamma 
= \int_{\Omega_{V^*}}\mkern-12mu f \varphi \,\mathrm{d}\Omega 
+\int_{\Gamma_{V^*}}\mkern-12mu g\,\varphi \,\mathrm{d}\Gamma
\end{equation}
\hrule
\end{document}
  • 1
    THANK YOU! I was under the impression that reserving a column for the equation number would produce exactly that effect, so that the equation itself would be centered in the remaining space thanks to the hidden "+" glue delimiter that ends the declaration of the columns. Indeed, with your suggestion it looks so much better. – F. Remonato Mar 23 '17 at 13:49

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.