1

I am working with the elsarticle document class in two-column format, but I have encountered a problem during the inclusion of equations in my document.

The issue is well described by the following MWE:

\documentclass[3p,preprint]{elsarticle}

\usepackage{multicol}
\usepackage{amsmath,amssymb}
\begin{document}

\begin{multicols}{2}

\begin{equation}
\hspace*{-.4cm}
E_1=E_2=E_3=E_4=E_5=
\begin{cases}
1, {\rm~if~} 1=1, \\
0, {\rm~if~otherwise} 
\end{cases}
\end{equation}

\end{multicols}

\end{document}

I would like to move the equation to the left in order to lift the equation number to the previous line. If I use \hspace*{-.3cm}, then nothing changes, while \hspace*{-.4cm} moves the equation left, but creating large space between the equation and its serial number.

Is there any way that remove this extra space after the equation and before its serial number, thereby making the equation environment sensitive to the value of \hspace*{}?

3
  • the equation number is set flush left and the equation is centred apart from the offset from the hspace it isn't clear what you want to change? (also do not use \rm in latex, \textrm{if otherwise}` would be better) Feb 2, 2021 at 0:12
  • If I add some text to better see the columns, the space around the equation nymber does not look large? this output Feb 2, 2021 at 0:13
  • Looking at your image, it can be seen that the equation can be shifted back to the right, but the (fixed?) space between the serial number and the equation does not allow this. Therefore, I thought of reducing this space.
    – TobiR
    Feb 2, 2021 at 0:18

2 Answers 2

1

If I understand correctly you want to remove the space from the right not the left (or from both sides)

enter image description here

\documentclass[3p,preprint]{elsarticle}

\usepackage{multicol}
\usepackage{amsmath,amssymb}
\begin{document}

\begin{multicols}{2}

aaa\dotfill aaa
\begin{equation}
E_1=E_2=E_3=E_4=E_5=
\begin{cases}
1, \textrm{ if } 1=1, \\
0, \textrm{ if otherwise} 
\end{cases}
\hspace*{-.35cm}
\end{equation}
bbb\dotfill bbb

bbb\dotfill bbb

bbb\dotfill bbb

bbb\dotfill bbb

bbb\dotfill bbb

bbb\dotfill bbb

bbb\dotfill bbb

bbb\dotfill bbb

\end{multicols}

\end{document}
1
  • Yes, this is what I wanted to have. I believed that the space between equation and its serial number is adaptive, but now it is clear that the space can be reduced on both sides by hspace.
    – TobiR
    Feb 2, 2021 at 0:25
0

Old trick (it's in the TeXbook). No need to guess a length, if the formula can fit the line width at all.

\documentclass[3p,preprint]{elsarticle}

\usepackage{multicol}
\usepackage{amsmath,amssymb}

\usepackage{lipsum}

\begin{document}

\begin{multicols}{2}
\lipsum*[1][1-2]
\begin{equation}
\hspace{0pt}
E_1=E_2=E_3=E_4=E_5=
\begin{cases}
1, &\text{if } 1=1, \\
0, &\text{if otherwise} 
\end{cases}
\hspace{1000pt minus 1fil}
\end{equation}
\lipsum[4-8]
\end{multicols}

\end{document}

enter image description here

The very large space at the end will make TeX into thinking it has to squeeze every flexible glue at the maximum and hope for the best. However, the added space has infinite shrinkable glue, so the formula will not be in an overfull box. In order for this to work requires a glob of glue at the left side.

I fixed the syntax of the cases environment.

You must log in to answer this question.

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