4

I am using a newfloat in LaTeX. Within that float (called Model) I use an IEEEeqnarray environment, as such:

\documentclass[journal]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage{float}
\usepackage{caption}

\floatstyle{ruled}
\newfloat{model}{thp}{lop}
\floatname{model}{Model}

\captionsetup
  [model]% Float type
  {%
      name      = Model,
      labelfont = normalfont,
      %textfont  = it,
      labelsep  = period
  }

\begin{document}
\title{MWE}
\maketitle
\section{Mwe}

\begin{model}[!h]
\caption{My Model}
\label{Model3}
 \begin{IEEEeqnarray}{l}   
   x_a + y_b \leq c_1 + 1000000000000000000,~\forall~a\in A,b\in B\\
   x_d + y_e \leq c_2 - 1000000000000000000,~\forall~d\in D,e\in E
 \end{IEEEeqnarray}
\end{model}

\bibliographystyle{IEEEtran}

\end{document}

I want to reduce the left margin in front of the equations, how do i achieve that?

I couldn't find anything in the documentation or on Google.

Thanks a lot.

EDIT: MWE

Even though I provide the argument {l}, I cannot get equations to be shifted to the left (like in a table cell).

enter image description here

2
  • 1
    Please expand your code fragment into a minimally compilable example that exhibits the problem behavior you wish to fix.
    – Mico
    Jul 20, 2021 at 10:54
  • Thanks, I provided the example
    – ahi
    Jul 20, 2021 at 12:06

2 Answers 2

4

IEEEeqnarray makes no attempt to align the contents with the left margin, but rather it tries to center the block with respect to the margin.

You get a better setup with rCl'l, but you may want to change r into l and ' into " (for wider space). If you really want alignment to the left margin, you can use flalign.

\documentclass[journal]{IEEEtran}
%\usepackage[utf8]{inputenc}
\usepackage{float}
\usepackage{caption}

\usepackage{newtxtext,newtxmath} % I recommend this

\floatstyle{ruled}
\newfloat{model}{thp}{lop}
\floatname{model}{Model}

\captionsetup[model]{% Float type
  name      = Model,
  labelfont = normalfont,
  %textfont  = it,
  labelsep  = period
}

\begin{document}

\title{MWE}
\author{me}
\maketitle

\section{Mwe}

\begin{model}[!htp]
\caption{My Model}
\label{Model3}
\begin{IEEEeqnarray}{rCl'l}
  x_a + y_b &\leq& c_1 + 1000000000000000000, &\forall\, a\in A,b\in B\\
  x_d + y_e &\leq& c_2 - 1000000000000000000, &\forall\, d\in D,e\in E
  \IEEEeqnarraynumspace
\end{IEEEeqnarray}
\end{model}

\begin{model}[!htp]
\caption{My Model}
\label{Model3-again}
\begin{flalign}
  x_a + y_b &\leq c_1 + 1000000000000000000, &&\forall\, a\in A,b\in B\\
  x_d + y_e &\leq c_2 - 1000000000000000000, &&\forall\, d\in D,e\in E
\end{flalign}
\end{model}

\end{document}

enter image description here

4
  • What is your general expert’s assessment of IEEEeqnarrary? Is there any reason to use it? Is it as robust as the amsmath environments? (The Not So Short Introduction to LaTeX2e claims that it is even better, but I’m not so sure.)
    – Gaussler
    Jul 20, 2021 at 13:30
  • 1
    @Gaussler It offers many bells and whistles and in some cases it helps a lot.
    – egreg
    Jul 20, 2021 at 13:34
  • But do you consider it as good and robust as the amsmath environments? Or should it only be used with caution?
    – Gaussler
    Jul 20, 2021 at 13:37
  • 1
    @Gaussler I prefer amsmath, but have no reason to consider IEEEeqnarray less robust or to be used with caution.
    – egreg
    Jul 20, 2021 at 13:43
2

Use of IEEEeqnarray is not good choice. Better is to use math environments defined by amsmath package. For example By use of fleqn and gather math environments provided by packages nccmath and amsmath:

\documentclass[journal]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage{float}
\usepackage{caption}
\usepackage{nccmath}  % <--- it also load amsmath

\floatstyle{ruled}
\newfloat{model}{thp}{lop}
\floatname{model}{Model}

\captionsetup
  [model]% Float type
  {%
      name      = Model,
      labelfont = normalfont,
      %textfont  = it,
      labelsep  = period
  }

\begin{document}
\title{MWE}
\maketitle
\section{Mwe}

\begin{model}[!h]
\caption{My Model}
\label{Model3}
\begin{fleqn}        % <---
    \begin{gather}   % <---
x_a + y_b \leq c_1 + 1000000000000000000,~\forall~a\in A,b\in B\\
x_d + y_e \leq c_2 - 1000000000000000000,~\forall~d\in D,e\in E
    \end{gather}
\end{fleqn}
\end{model}

\bibliographystyle{IEEEtran} % not relevant for your problem

\end{document}

enter image description here

You may also consider to use smaller font size for this equation:

...
\begin{model}[!h]
\caption{My Model}
\label{Model3}
\small            % <---
\begin{fleqn}
    \begin{gather}%
x_a + y_b \leq c_1 + 1000000000000000000,~\forall~a\in A,b\in B\\
x_d + y_e \leq c_2 - 1000000000000000000,~\forall~d\in D,e\in E
    \end{gather}
\end{fleqn}
\end{model}
...

In this case you will get the following result:

enter image description here

7
  • I don’t know much about the IEEEeqnarray environment, but it’s being strongly recommended in The Not So Short Introduction To LaTeX2e. What is supposed to be wrong with it?
    – Gaussler
    Jul 20, 2021 at 12:40
  • @Gaussler, as far as I remember, it is recommended to use it instead of eqnarray (it fixes some of it bad formatting) but not general over ˙amsmath environments. I may be wrong, however, math environments defined by amsmath for sure are superior to IEEEeqnarray. For example, IEEEeqnarray` doesn't enables desired solution (out of box).
    – Zarko
    Jul 20, 2021 at 12:50
  • Well, the authors clearly seem to think that it’s superior to align. We don’t have to agree with them, of course.
    – Gaussler
    Jul 20, 2021 at 12:53
  • Thanks a lot for the answer! I will use your solution for now. IEEEeqnarray has however a couple features that I don't really want to give up on .... I will not tag this issue as solved just yet.
    – ahi
    Jul 20, 2021 at 13:11
  • P.S. thanks for suggesting to use small font :) this alleviates many of my current layouting issues
    – ahi
    Jul 20, 2021 at 13:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .