![如何在双列文档中使用对齐?](https://linux22.com/image/456887/%E5%A6%82%E4%BD%95%E5%9C%A8%E5%8F%8C%E5%88%97%E6%96%87%E6%A1%A3%E4%B8%AD%E4%BD%BF%E7%94%A8%E5%AF%B9%E9%BD%90%EF%BC%9F.png)
我想用双列格式来写这个方程。我该怎么做?
我使用这个代码:
\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}
答案1
使用不同的格式:
\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}
请注意,选项是letterpaper
,而不是lettersize
。
像往常一样,当我处理时IEEEtran
,我在添加后显示输出
\usepackage{newtxtext,newtxmath}
答案2
这是一个总体上与以下答案非常相似的答案@egreg 的回答-- 例如,它还使用了mathtools
包及其\shortintertext
宏,还建议加载newtxtext
和newtxmath
字体包。主要区别在于使用alignat{2}
环境而不是align
环境,以便对两个都符号列=
。
\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}