# How to use align in a two-column document?

I want to write this equation by fitting it in double column. How can I do that?

I use this code:

\documentclass[lettersize,journal]{IEEEtran}

\begin{align}
\bar{u}_{x_-} &= \frac{1}{M_r}\sum_{i=1}^{M_r} u_{x_-}^{(i)} = \frac{1}{M_r}\sum_{i=1}^{M_r}\frac{|x_{i,1}-x_{i,2}|}{(t_{i,1}-t_{i,2})}, \ \text{Cluster-1  (-x  direction)}\\
\bar{u}_{x_+} &= \frac{1}{M_r}\sum_{i=1}^{M_r} u_{x_+}^{(i)} = \frac{1}{M_r}\sum_{i=1}^{M_r}\frac{|x_{i,5}-x_{i,4}|}{(t_{i,5}-t_{i,4})},\ \text{Cluster-3 (+x  direction)}\\
\bar{u}_{y_+} &= \frac{1}{M_c}\sum_{j=1}^{M_c} u_{y_+}^{(j)} = \frac{1}{M_c}\sum_{j=1}^{M_c}\frac{|y_{5,j}-y_{4,j}|}{(t_{5,j}-t_{4,j})},\ \text{Cluster-2  (+y  direction)}\\
\bar{u}_{y_-} &= \frac{1}{M_c}\sum_{j=1}^{M_c} u_{y_-}^{(j)} = \frac{1}{M_c}\sum_{j=1}^{M_c}\frac{|y_{1,j}-y_{2,j}|}{(t_{1,j}-t_{2,j})}, \text{ Cluster-4  (-y  direction)}

\end{align}


Use a different format:

\documentclass[letterpaper,journal]{IEEEtran}
\usepackage{amsmath,mathtools}

\usepackage{lipsum} % for mock text

\begin{document}

\lipsum*[1][1-4]
\begin{align}
\shortintertext{Cluster-1 ($-x$ direction)}
\bar{u}_{x_-} &= \frac{1}{M_r}\sum_{i=1}^{M_r} u_{x_-}^{(i)} =
\frac{1}{M_r}\sum_{i=1}^{M_r}\frac{|x_{i,1}-x_{i,2}|}{(t_{i,1}-t_{i,2})}, \\[1ex]
\shortintertext{Cluster-3 ($+x$ direction)}
\bar{u}_{x_+} &= \frac{1}{M_r}\sum_{i=1}^{M_r} u_{x_+}^{(i)} =
\frac{1}{M_r}\sum_{i=1}^{M_r}\frac{|x_{i,5}-x_{i,4}|}{(t_{i,5}-t_{i,4})}, \\[1ex]
\shortintertext{Cluster-2 ($+y$ direction)}
\bar{u}_{y_+} &= \frac{1}{M_c}\sum_{j=1}^{M_c} u_{y_+}^{(j)} =
\frac{1}{M_c}\sum_{j=1}^{M_c}\frac{|y_{5,j}-y_{4,j}|}{(t_{5,j}-t_{4,j})}, \\[1ex]
\shortintertext{Cluster-4 ($-y$ direction)}
\bar{u}_{y_-} &= \frac{1}{M_c}\sum_{j=1}^{M_c} u_{y_-}^{(j)} =
\frac{1}{M_c}\sum_{j=1}^{M_c}\frac{|y_{1,j}-y_{2,j}|}{(t_{1,j}-t_{2,j})},
\end{align}
\lipsum

\end{document}


Note that the option is letterpaper, not lettersize.

As usual when I deal with IEEEtran, I show the output after adding

\usepackage{newtxtext,newtxmath}


• thank you for help. But i copied your code and paste my text. I changed lettersize to letterpaper. But i get error. Oct 31, 2022 at 19:11

Here's an answer that's overall quite similar to @egreg's answer -- e.g., it also uses the mathtools package and its \shortintertext macro, and it also recommends loading the newtxtext and newtxmath font packages. The main difference is the use of an alignat{2} environment instead of an align environment, in order to perform alignment on both columns of = symbols.

\documentclass[letterpaper,journal]{IEEEtran}
\usepackage{mathtools}
\usepackage{newtxtext,newtxmath} % optional

\begin{document}
\hrule % just to illustrate width of text block
\begin{alignat}{2}
\shortintertext{Cluster 1: $-x$ direction}
\bar{u}_{x_-}
&=  \frac{1}{M_r}\sum_{i=1}^{M_r} u_{x_-}^{(i)}
&&= \frac{1}{M_r}\sum_{i=1}^{M_r}\frac{|x_{i,1}-x_{i,2}|}{(t_{i,1}-t_{i,2})}\,,\\[2ex]
\shortintertext{Cluster 3: $+x$ direction}
\bar{u}_{x_+}
&=  \frac{1}{M_r}\sum_{i=1}^{M_r} u_{x_+}^{(i)}
&&= \frac{1}{M_r}\sum_{i=1}^{M_r}\frac{|x_{i,5}-x_{i,4}|}{(t_{i,5}-t_{i,4})}\,,\\[2ex]
\shortintertext{Cluster 2: $+y$ direction}
\bar{u}_{y_+}
&=  \frac{1}{M_c}\sum_{j=1}^{M_c} u_{y_+}^{(j)}
&&= \frac{1}{M_c}\sum_{j=1}^{M_c}\frac{|y_{5,j}-y_{4,j}|}{(t_{5,j}-t_{4,j})}\,,\\[2ex]
\shortintertext{Cluster 4: $-y$ direction}
\bar{u}_{y_-}
&=  \frac{1}{M_c}\sum_{j=1}^{M_c} u_{y_-}^{(j)}
&&= \frac{1}{M_c}\sum_{j=1}^{M_c}\frac{|y_{1,j}-y_{2,j}|}{(t_{1,j}-t_{2,j})}\,.
\end{alignat}
\hrule % just to illustrate width of text block
\end{document}