1

I have the following tex code.

\documentclass{IEEEtran}
\usepackage{amsmath}
\usepackage{lipsum}

\begin{document}
\lipsum[1-9]

Integer sapien est, iaculis in, pretium quis,
viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum.
Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at,
mollis ac, nulla. Curabitur auctor semper nulla. Donec varius
viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum.
Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at,
mollis ac, nulla. Curabitur auctor semper nulla. Donec varius

\begin{equation}\label{eq:init}
\Omega^{a}_{t} = 
  \begin{bmatrix}
    (a_t)^2 &0       &0\\
    0       &(a_t)^3 &0\\
    0       &0       &\hspace{-2ex}(a_t)^4
  \end{bmatrix},
\Omega^{b}_{t} = \hat{\Omega}^{a}_{t} = 
  \begin{bmatrix}
    (b_t)^2 & 0\\
    0       & (b_t)^4
  \end{bmatrix}.
\end{equation}
\section{New section}
\lipsum[1-7]
\end{document}

The produced equation number will be in a new line as shown below. enter image description here

I mannually add some space in a bmatrix to move the equation number up.

\begin{equation}\label{eq:init}
\Omega^{a}_{t} = 
  \begin{bmatrix}
    (a_t)^2 &\hspace{-2ex}0       &\hspace{-2ex}0\\
    0       &\hspace{-2ex}(a_t)^3 &\hspace{-2ex}0\\
    0       &\hspace{-2ex}0       &\hspace{-2ex}(a_t)^4
  \end{bmatrix},
\Omega^{b}_{t} = \hat{\Omega}^{a}_{t} = 
  \begin{bmatrix}
    (b_t)^2 & 0\\
    0       & (b_t)^4
  \end{bmatrix}.
\end{equation}

Then the bottom lines are not aligned... Do you know how to move the equation number up and keep the bottom lines being aligned?

enter image description here

  • Why do you want the bottom lines aligned? I think it is better to have matrices center-aligned and TeX does that. It would look odd, imho, if they were bottom-aligned. – Skillmon likes topanswers.xyz Sep 15 '17 at 12:13
  • Its a two columns document. – aban Sep 15 '17 at 12:23
  • Now I get what the problem is. I thought you were talking about the alignment of the two matrices to each other, not about the alignment of the two columns. My bad. – Skillmon likes topanswers.xyz Sep 15 '17 at 12:31
  • :) could you help me on this? – aban Sep 15 '17 at 12:32
2
  • what is difference (in math sense) between $(a_t)^2$ and $a_t^2$? If you omit parentheses in your equation, it will fit nicely in column width

  • if you persist to use parentheses around your variables, than you can "shrink" matrix width by use of \setlength\arraycolsep{2pt} after \begin{equation}:

\documentclass{IEEEtran}
\usepackage{amsmath}
\usepackage{lipsum}

\begin{document}
\lipsum[1-9]
\begin{equation}\label{eq:init}
\Omega^{a}_{t} =
  \begin{bmatrix}
a_t^2 & 0       & 0\\
0     & a_t^3   & 0\\
0     & 0       & a_t^4
  \end{bmatrix},
\Omega^{b}_{t} = \hat{\Omega}^{a}_{t} =
  \begin{bmatrix}
    b_t^2 & 0\\
    0     & b_t^4
  \end{bmatrix}.
\end{equation}

\begin{equation}\label{eq:init}
\setlength\arraycolsep{2pt}
\Omega^{a}_{t} =
  \begin{bmatrix}
(a_t)^2 & 0       & 0\\
0       & (a_t)^3 & 0\\
0       & 0       & (a_t)^4
  \end{bmatrix},
\Omega^{b}_{t} = \hat{\Omega}^{a}_{t} =
  \begin{bmatrix}
  (b_t)^2 & 0\\
    0     & (b_t)^4
  \end{bmatrix}.
\end{equation}

\section{New section}
\lipsum
\end{document}

enter image description here

  • regarding to equation spill out of bottom text border consider suggestion in others answer or see if change math environment from equation to gather (which has defined different vertical space before/after equation) can help you:

enter image description here

\documentclass{IEEEtran}
\usepackage{amsmath}
\usepackage{lipsum}

%-------------------------------- show page layout, only for test
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%


\begin{document}
\lipsum[1-9]

Integer sapien est, iaculis in, pretium quis,
viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum.
Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at,
mollis ac, nulla. Curabitur auctor semper nulla. Donec varius
viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum.
Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at,
mollis ac, nulla. Curabitur auctor semper nulla. Donec varius

\begin{gather}\label{eq:init}
\setlength\arraycolsep{2pt}
\Omega^{a}_{t} =
  \begin{bmatrix}
(a_t)^2 & 0       & 0\\
0       & (a_t)^3 & 0\\
0       & 0       & (a_t)^4
  \end{bmatrix},
\Omega^{b}_{t} = \hat{\Omega}^{a}_{t} =
  \begin{bmatrix}
  (b_t)^2 & 0\\
    0     & (b_t)^4
  \end{bmatrix}.
\end{gather}

\section{New section}
\lipsum
\end{document}
1

this is clearly cheating, but ...

add a \vphantom with four rows to make latex think the height is greater than it really is:

\documentclass{IEEEtran}
\usepackage{amsmath}
\usepackage{lipsum}

\begin{document}
\lipsum[1-9]

Integer sapien est, iaculis in, pretium quis,
viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum.
Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at,
mollis ac, nulla. Curabitur auctor semper nulla. Donec varius
viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum.
Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at,
mollis ac, nulla. Curabitur auctor semper nulla. Donec varius
\begin{equation}\label{eq:init}
\Omega^{a}_{t} = 
  \begin{bmatrix}
    (a_t)^2 &\hspace{-2ex}0       &\hspace{-2ex}0\\
    0       &\hspace{-2ex}(a_t)^3 &\hspace{-2ex}0\\
    0       &\hspace{-2ex}0       &\hspace{-2ex}(a_t)^4
  \end{bmatrix},
\Omega^{b}_{t} = \hat{\Omega}^{a}_{t} = 
  \begin{bmatrix}
    (b_t)^2 & 0\\
    0       & (b_t)^4
  \end{bmatrix}.
\vphantom{
  \begin{bmatrix}
    (a_t)^2\\
    (a_t)^2\\
    (a_t)^2\\
    (a_t)^2
  \end{bmatrix}
}
\end{equation}
\section{New section}
\lipsum[1-7]

\end{document}
0

A \vspace{1pt} does solve the problem (though it is perhaps not the ideal solution):

\documentclass{IEEEtran}
\usepackage{amsmath}
\usepackage{lipsum}

\begin{document}
\lipsum[1-9]

Integer sapien est, iaculis in, pretium quis,
viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum.
Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at,
mollis ac, nulla. Curabitur auctor semper nulla. Donec varius
viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum.
Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at,
mollis ac, nulla. Curabitur auctor semper nulla. Donec varius

\begin{equation}\label{eq:init}
\Omega^{a}_{t} = 
  \begin{bmatrix}
    (a_t)^2 &\hspace{-2ex}0       &\hspace{-2ex}0\\
    0       &\hspace{-2ex}(a_t)^3 &\hspace{-2ex}0\\
    0       &\hspace{-2ex}0       &\hspace{-2ex}(a_t)^4
  \end{bmatrix},
\Omega^{b}_{t} = \hat{\Omega}^{a}_{t} = 
  \begin{bmatrix}
    (b_t)^2 & 0\\
    0       & (b_t)^4
  \end{bmatrix}.
  \vspace{1pt}
\end{equation}
\section{New section}
\lipsum[1-7]
\end{document}

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.