1

I have a huge equation consisting of several matrices. It is stuck together and has to be moved completely between pages causing white spaces in the preceding page. I had to resize it but seems that breaking it is a much better solution. I want to let it break, i.e., e.g. half of at the bottom of one page and the rest in the beginning of the next page. I'm using a double column paper style.

This is what I got,

enter image description here

\documentclass[10pt, twocolumn, twoside, journal]{IEEEtran}

%\makeatletter
%\let\IEEEproof\proof
%\let\IEEEendproof\endproof
%\let\proof\@undefined
%\let\endproof\@undefined
%\makeatother

%\let\proof\relax
%\let\endproof\relax

%\IEEEoverridecommandlockouts                           
%\overrideIEEEmargins

\usepackage{amsmath, amsfonts, amssymb, color, enumerate, amsthm, graphicx}
\usepackage{tikz, subcaption, cite}
\usepackage{color, xcolor, soul, bm}
\PassOptionsToPackage{hyphens}{url}\usepackage{hyperref}
\hypersetup{
  colorlinks   = true, %Colours links instead of ugly boxes
  urlcolor     = blue, %Colour for external hyperlinks
  linkcolor    = blue, %Colour of internal links
  citecolor   = green %Colour of citations
}
\usepackage[normalem]{ulem}
\newtheorem{problem}{Problem}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}
\newtheorem{assumption}{Assumption}
\newtheorem{proposition}{Proposition}
\newtheorem{lemma}{Lemma}
\newtheorem{remark}{Remark}
\newtheorem{definition}{Definition}
\newtheorem{example}{Example}
\usepackage{epsfig} 
\usepackage{psfrag}
\DeclareMathOperator{\diag}{diag}
\usepackage{tcolorbox}
\newcommand{\JW}[1]{{\color{red}#1}}
\include{user_newcommands}

\usepackage{algorithm}
\usepackage{algpseudocode}
\allowdisplaybreaks

%\newcommand{\ShS}[1]{$\clubsuit$\footnote{SHREYAS: #1}}
%\newcommand{\mathcolorbox}[2]{\colorbox{#1}{$\displaystyle #2$}}

\def\endtheorem{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
\def\endlemma{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
\def\endproposition{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
\def\endexample{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
\def\endremark{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
\def\enddefinition{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
\begin{document}
\begin{equation}
    \resizebox{.45\textwidth}{!}{$
    \begin{split}
    &L_g^{-1}\mathbf{e}_i \mathbf{e}_{ij}^{\sf T}L_g^{-1} = \begin{bmatrix}
    \frac{1}{w_1} & 0 & \cdots & \overbrace{0}^{j^\text{th}} & \cdots & \overbrace{0}^{i^\text{th}} & \cdots & 0\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & 0 & \cdots & 0 & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots \\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & 0 & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & \frac{1}{w_i} & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & \frac{1}{w_i} & \cdots & \frac{1}{w_n}
    \end{bmatrix}\\
    &\times \begin{bmatrix}
    0\\
    0\\
    \vdots\\
    \vdots\\
    \vdots\\
    \underbrace{1}_{i^\text{th}}\\
    \vdots\\
    0
    \end{bmatrix} \begin{bmatrix}
    0\\
    0\\
    \vdots\\
    \underbrace{-1}_{j^\text{th}}\\
    \vdots\\
    \underbrace{1}_{i^\text{th}}\\
    \vdots\\
    0
    \end{bmatrix}^{\sf T} \begin{bmatrix}
    \frac{1}{w_1} & 0 & \cdots & 0 & \cdots & 0 & \cdots & 0\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & 0 & \cdots & 0 & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots \\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & 0 & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & \frac{1}{w_i} & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & \frac{1}{w_i} & \cdots & \frac{1}{w_n}
    \end{bmatrix}\\
    &=\begin{bmatrix}
    0\\
    0\\
    \vdots\\
    0\\
    \vdots\\
    \underbrace{\frac{1}{w_i}}_{i^\text{th}}\\
    \vdots\\
    \frac{1}{w_i}
    \end{bmatrix} \begin{bmatrix}
    0 & \cdots & \underbrace{0}_{j^\text{th}} & \frac{1}{w_{j+1}} & \frac{1}{w_{j+2}} & \cdots & \underbrace{\frac{1}{w_i}}_{i^\text{th}} & 0 & \cdots & 0
    \end{bmatrix}\\
    &=\begin{bmatrix}
    0 & 0 & \cdots & \overbrace{0}^{j^\text{th}} & \overbrace{0}^{{j+1}^\text{th}} & \overbrace{0}^{{j+2}^\text{th}} & \cdots & \overbrace{0}^{i^\text{th}} & \cdots & 0\\
    0 & 0 & \cdots & 0 & 0 & 0 & \cdots & 0 & \cdots & 0\\
    \vdots & \vdots & & \vdots & \vdots & \vdots & & \vdots & & \vdots\\
    0 & 0 & \cdots & 0 & \frac{1}{w_i w_{j+1}} & \frac{1}{w_i w_{j+2}} & \cdots & \frac{1}{w_i^2} & \cdots & 0\\
    \vdots & \vdots & & \vdots & \vdots & \vdots & & \vdots & & \vdots\\
    0 & 0 & \cdots & 0 & \cdots & \cdots & \cdots & \cdots & \cdots & 0
    \end{bmatrix} \geq 0
%}
\end{split}
$}
    \end{equation}
\end{document}
3
  • 3
    remove resizebox. it block \allowdisplaybreaks. use resizebox for math expressions is bad practice ... – Zarko Feb 8 '19 at 4:51
  • @Zarko But still the whole equation remains in the next page – Mohammad Feb 8 '19 at 5:38
  • Because the twoside document class option was set, the \flushbottom directive is in effect. This means that the LaTeX is forced to create very large gaps between paragraphs. – Mico Feb 8 '19 at 7:51
1

In my view, the entire equation belongs in one "block", i.e., it should never be broken across columns, let alone pages. What to do? I suggest you place the equation in a figure environment. Using \resizebox isn't necessary; instead, just reduce the value of \arraycolsep a bit.

To economize on vertical space, you could use \smash[t]{...} and \smash[b]{...} "wrappers", to let the arguments of \underbrace and \overbrace "hang out" outside the top or bottom rows of the bmatrix environments.

In the following example, the showframe package is loaded purely to demonstrate that the equation can fit inside a column without resorting to the \resizebox sledgehammer.

enter image description here

\documentclass[10pt, twocolumn, twoside, journal]{IEEEtran}

\usepackage{showframe}  %optional

%\makeatletter
%\let\IEEEproof\proof
%\let\IEEEendproof\endproof
%\let\proof\@undefined
%\let\endproof\@undefined
%\makeatother

%\let\proof\relax
%\let\endproof\relax

%\IEEEoverridecommandlockouts                           
%\overrideIEEEmargins

\usepackage{amsmath, %amsfonts, % is loaded by 'amssymb'
            amssymb, %color, 
            enumerate, amsthm, graphicx}
\allowdisplaybreaks

\usepackage{tikz, subcaption, cite}
\usepackage{%color, 
            xcolor, soul, bm}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage[normalem]{ulem}
%%\usepackage{epsfig} % shouldn't be necessary
\usepackage{psfrag}
\usepackage{tcolorbox}

%\PassOptionsToPackage{hyphens}{url}
\usepackage[hyphens,spaces,obeyspaces]{url} % <-- new
\usepackage{hyperref}
\hypersetup{%
  colorlinks = true, %Coloured links instead of boxes
  urlcolor   = blue, %Colour for external hyperlinks
  linkcolor  = blue, %Colour of internal links
  citecolor  = green %Colour of citations
}

%% for "clever" cross-referencing:
\usepackage[noabbrev,nameinlink]{cleveref}  

\newtheorem{problem}{Problem}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}
\newtheorem{assumption}{Assumption}
\newtheorem{proposition}{Proposition}
\newtheorem{lemma}{Lemma}
\newtheorem{remark}{Remark}
\newtheorem{definition}{Definition}
\newtheorem{example}{Example}

\DeclareMathOperator{\diag}{diag}
\newcommand{\JW}[1]{\textcolor{red}{#1}}
\include{user_newcommands}

\newcommand{\ShS}[1]{$\clubsuit$\footnote{SHREYAS: #1}}
\newcommand{\mathcolorbox}[2]{\colorbox{#1}{$\displaystyle #2$}}

%\def\endtheorem{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
%\def\endlemma{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
%\def\endproposition{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
%\def\endexample{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
%\def\endremark{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
%\def\enddefinition{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}

\newcommand{\trans}{\mathsf{T}} % <-- new
\usepackage{lipsum}

\begin{document}
\lipsum[1-2] % filler text

A cross-reference to \cref{eq:tall}.

\begin{figure}[t!]
\setlength\arraycolsep{2pt} % default: 5pt

%% caption is optional:
\caption*{Evaluating $L_g^{-1}\mathbf{e}_i \mathbf{e}_{ij}^{\trans}L_g^{-1}$}

\bigskip

\begin{equation} \label{eq:tall}
%%%%\resizebox{.9\columnwidth}{!}{$\displaystyle
\begin{aligned}[b]
    &L_g^{-1}\mathbf{e}_i \mathbf{e}_{ij}^{\trans}L_g^{-1} = 
    \begin{bmatrix}
    \frac{1}{w_1} & 0 & \cdots & \smash[t]{\overbrace{0}^{j^\text{th}}} & \cdots & \smash[t]{\overbrace{0}^{i^\text{th}}} & \cdots & 0\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & 0 & \cdots & 0 & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots \\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & 0 & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & \frac{1}{w_i} & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & \frac{1}{w_i} & \cdots & \frac{1}{w_n}
    \end{bmatrix} \\%end of first row
    &\times 
    \begin{bmatrix}
    0\\
    0\\
    \vdots\\
    \vdots\\
    \vdots\\
    \underbrace{1}_{i^\text{th}}\\
    \vdots\\
    0
    \end{bmatrix} 
    \begin{bmatrix}
    0\\
    0\\
    \vdots\\
    \underbrace{-1}_{j^\text{th}}\\
    \vdots\\
    \underbrace{1}_{i^\text{th}}\\
    \vdots\\
    0
    \end{bmatrix}^{\trans} 
    \begin{bmatrix}
    \frac{1}{w_1} & 0 & \cdots & 0 & \cdots & 0 & \cdots & 0\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & 0 & \cdots & 0 & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots \\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & 0 & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & \frac{1}{w_i} & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & \frac{1}{w_i} & \cdots & \frac{1}{w_n}
    \end{bmatrix}\\%end of second row
    &=
    \begin{bmatrix}
    0\\
    0\\
    \vdots\\
    0\\
    \vdots\\
    \underbrace{\frac{1}{w_i}}_{i^\text{th}}\\
    \vdots\\
    \frac{1}{w_i}
    \end{bmatrix} 
    \begin{bmatrix}
    0 & \cdots & \smash[b]{\underbrace{0}_{j^\text{th}}} & \frac{1}{w_{j+1}} & \frac{1}{w_{j+2}} & \cdots & \smash[b]{\underbrace{\frac{1}{w_i}}_{i^\text{th}}} & 0 & \cdots & 0
    \end{bmatrix}\\%end of third row
    &=
    \begin{bmatrix}
    0 & 0 & \cdots & \smash[t]{\overbrace{0}^{j^\text{th}}} & \smash[t]{\overbrace{0}^{{j+1}^\text{th}}} & \smash[t]{\overbrace{0}^{{j+2}^\text{th}}} & \cdots & \smash[t]{\overbrace{0}^{i^\text{th}}} & \cdots & 0\\
    0 & 0 & \cdots & 0 & 0 & 0 & \cdots & 0 & \cdots & 0\\
    \vdots & \vdots & & \vdots & \vdots & \vdots & & \vdots & & \vdots\\
    0 & 0 & \cdots & 0 & \frac{1}{w_i w_{j+1}} & \frac{1}{w_i w_{j+2}} & \cdots & \frac{1}{w_i^2} & \cdots & 0\\
    \vdots & \vdots & & \vdots & \vdots & \vdots & & \vdots & & \vdots\\
    0 & 0 & \cdots & 0 & \cdots & \cdots & \cdots & \cdots & \cdots & 0
    \end{bmatrix} \\% end of fourth row
    &\geq 0
\end{aligned}
\end{equation}
\end{figure}

\lipsum[3-6] % more filler text
\end{document}


Addendum: In case you're not sure that placing the big equation in a figure environment is a good way to go, it's not much extra work to encase the entire equation in a "frame box", thereby giving it further visual prominence.

enter image description here

\documentclass[10pt, twocolumn, twoside, journal]{IEEEtran}

%\makeatletter
%\let\IEEEproof\proof
%\let\IEEEendproof\endproof
%\let\proof\@undefined
%\let\endproof\@undefined
%\makeatother

%\let\proof\relax
%\let\endproof\relax

%\IEEEoverridecommandlockouts                           
%\overrideIEEEmargins

\usepackage{amsmath, %amsfonts, % is loaded by 'amssymb'
            amssymb, %color, 
            enumerate, amsthm, graphicx}
\allowdisplaybreaks

\usepackage{tikz, subcaption, cite}
\usepackage{%color, 
            xcolor, soul, bm}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage[normalem]{ulem}
%%\usepackage{epsfig} % shouldn't be necessary
\usepackage{psfrag}
\usepackage{tcolorbox}

%\PassOptionsToPackage{hyphens}{url}
\usepackage[hyphens,spaces,obeyspaces]{url} % <-- new
\usepackage{hyperref}
\hypersetup{%
  colorlinks = true, %Coloured links instead of boxes
  urlcolor   = blue, %Colour for external hyperlinks
  linkcolor  = blue, %Colour of internal links
  citecolor  = green %Colour of citations
}

%% for "clever" cross-referencing:
\usepackage[noabbrev,nameinlink]{cleveref}  

\newtheorem{problem}{Problem}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}
\newtheorem{assumption}{Assumption}
\newtheorem{proposition}{Proposition}
\newtheorem{lemma}{Lemma}
\newtheorem{remark}{Remark}
\newtheorem{definition}{Definition}
\newtheorem{example}{Example}

\DeclareMathOperator{\diag}{diag}
\newcommand{\JW}[1]{\textcolor{red}{#1}}
\include{user_newcommands}

\newcommand{\ShS}[1]{$\clubsuit$\footnote{SHREYAS: #1}}
\newcommand{\mathcolorbox}[2]{\colorbox{#1}{$\displaystyle #2$}}

%\def\endtheorem{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
%\def\endlemma{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
%\def\endproposition{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
%\def\endexample{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
%\def\endremark{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
%\def\enddefinition{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}

\newcommand{\trans}{\mathsf{T}} % <-- new
\usepackage{lipsum}

\begin{document}
\lipsum[1-2] % filler text

A cross-reference to \cref{eq:tall}.

\begin{figure}[t!]
\setlength\fboxsep{1.5pt}   % default: 3pt
\setlength\arraycolsep{2pt} % default: 5pt

\fbox{\begin{minipage}{\dimexpr\columnwidth-2\fboxsep-2\arrayrulewidth\relax}
%% caption is optional:
\caption*{Evaluation of $L_g^{-1}\mathbf{e}^{}_i \mathbf{e}_{ij}^{\trans}L_g^{-1}$}

\medskip
\begin{equation} \label{eq:tall}
\begin{aligned}[b]
&L_g^{-1}\mathbf{e}^{}_i \mathbf{e}_{ij}^{\trans}L_g^{-1} = 
    \begin{bmatrix}
    \frac{1}{w_1} & 0 & \cdots & \smash[t]{\overbrace{0}^{j\text{th}}} & \cdots & \smash[t]{\overbrace{0}^{i\text{th}}} & \cdots & 0\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & 0 & \cdots & 0 & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots \\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & 0 & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & \frac{1}{w_i} & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & \frac{1}{w_i} & \cdots & \frac{1}{w_n}
    \end{bmatrix} \\%end of first row
&\times 
    \begin{bmatrix}
    0\\
    0\\
    \vdots\\
    \vdots\\
    \vdots\\
    \underbrace{1}_{i\text{th}}\\
    \vdots\\
    0
    \end{bmatrix} 
    \begin{bmatrix}
    0\\
    0\\
    \vdots\\
    \underbrace{-1}_{j\text{th}}\\
    \vdots\\
    \underbrace{1}_{i\text{th}}\\
    \vdots\\
    0
    \end{bmatrix}^{\!\trans} 
    \begin{bmatrix}
    \frac{1}{w_1} & 0 & \cdots & 0 & \cdots & 0 & \cdots & 0\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & 0 & \cdots & 0 & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots \\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & 0 & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & \frac{1}{w_i} & \cdots & 0\\
    \vdots & \vdots & & \vdots & & \vdots & & \vdots\\
    \frac{1}{w_1} & \frac{1}{w_2} & \cdots & \frac{1}{w_j} & \cdots & \frac{1}{w_i} & \cdots & \frac{1}{w_n}
    \end{bmatrix}\\%end of second row
&=
    \begin{bmatrix}
    0\\
    0\\
    \vdots\\
    0\\
    \vdots\\
    \underbrace{\frac{1}{w_i}}_{i\text{th}}\\
    \vdots\\
    \frac{1}{w_i}
    \end{bmatrix} 
    \begin{bmatrix}
    0 & \cdots & \smash[b]{\underbrace{0}_{j\text{th}}} & \frac{1}{w_{j+1}} & \frac{1}{w_{j+2}} & \cdots & \smash[b]{\underbrace{\frac{1}{w_i}}_{i\text{th}}} & 0 & \cdots & 0
    \end{bmatrix}\\%end of third row
&=
    \begin{bmatrix}
    0 & 0 & \cdots & \smash[t]{\overbrace{0}^{j\text{th}}} & \smash[t]{\overbrace{0}^{{j+1}\text{st}}} & \smash[t]{\overbrace{0}^{j+2\text{nd}}} & \cdots & \smash[t]{\overbrace{0}^{i\text{th}}} & \cdots & 0\\
    0 & 0 & \cdots & 0 & 0 & 0 & \cdots & 0 & \cdots & 0\\
    \vdots & \vdots & & \vdots & \vdots & \vdots & & \vdots & & \vdots\\
    0 & 0 & \cdots & 0 & \frac{1}{w_i w_{j+1}} & \frac{1}{w_i w_{j+2}} & \cdots & \frac{1}{w_i^2} & \cdots & 0\\
    \vdots & \vdots & & \vdots & \vdots & \vdots & & \vdots & & \vdots\\
    0 & 0 & \cdots & 0 & \cdots & \cdots & \cdots & \cdots & \cdots & 0
    \end{bmatrix} \\% end of fourth row
&\geq 0
\end{aligned}%
\end{equation}%
\end{minipage}}
\end{figure}

\lipsum[3-6] % more filler text
\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.