我一直在尝试对齐这两个方程,但我无法将 q(z) 与 j(z) 对齐。我尝试过
\begin{multline}
q(z) = \frac{(1-\Omega_m)(3zw_a + 3w_0(z+1)+z+1)(z+1)^{3(w_a + w_0)}+(z+1)\Omega_m e^{\frac{3z w_a}{z+1}}}{2(z+1)[(1-\Omega_m)(z+1)^{3(w_a +w_0)}+\Omega_m e^{\frac{3 z w_a}{z+1}}]} \\
j(z) = \Big[(1-\Omega_m)(9 z^2 w_a^2 + 3(z+1)w_a(6 w_0 z + 3z +1) + (9w_0(w_0+1)+2) (z+1)^2)\times\\(z+1)^{3(w_a+w_0)}+2(z+1)^2 \Omega_m \frac{3 w_a z}{z+1}\Big] \Big(2(z+1)^2((1-\Omega_m)(z+1)^{3(w_a+w_0)}+ \Omega_m e^{\frac{3 z w_a}{z+1}})\Big)^{-1}
\end{multline}
这让我
如您所见,q(z) 略微向左移动,并且两个方程式似乎没有对齐。有没有更好的方法在 latex 上显示长方程式?
答案1
flalign
包装内容amsmath
:
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{amsmath}
\begin{document}
\begin{flalign}
q(z) & = \frac{(1-\Omega_m)(3zw_a + 3w_0(z+1)+z+1)(z+1)^{3(w_a + w_0)}
+(z+1)\Omega_m \mathrm{e}^{\tfrac{3z w_a}{z+1}}}
{2(z+1)[(1-\Omega_m)(z+1)^{3(w_a +w_0)}
+\Omega_m \mathrm{e}^{\tfrac{3 z w_a}{z+1}}]}
\notag \\
j(z) & = \bigg[(1-\Omega_m)(9 z^2 w_a^2 + 3(z+1)w_a(6 w_0 z + 3z +1)
+ (9w_0(w_0+1)+2)(z+1)^2)(z+1)^{3(w_a+w_0)}
\notag \\
& \qquad
+2(z+1)^2 \Omega_m \frac{3 w_a z}{z+1}\biggr] \biggl(2(z+1)^2\Bigl((1-\Omega_m)(z+1)^{3(w_a+w_0)}
+ \Omega_m \mathrm{e}^{\tfrac{3 z w_a}{z+1}}\Bigr)\biggr)^{-1}
\end{flalign}
\end{document}
(灰线表示文本区域边框)
附录:
一种可能性是将方程拆分j(z)
为三行并引入新变量z' = z - 1
。考虑默认article
页面布局:
\documentclass{article}
\usepackage{amsmath}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text. Don't use in a real document
\begin{document}
\begin{flalign}
q(z) & = \frac{(1-\Omega_m)\bigl(3zw_a + 3w_0(z')+z'\bigr)(z')^{3(w_a + w_0)}
+(z+1)\Omega_m \mathrm{e}^{\tfrac{3z w_a}{z'}}}
{2(z')[(1-\Omega_m)(z')^{3(w_a +w_0)}
+\Omega_m \mathrm{e}^{\tfrac{3 z w_a}{z'}}]}
\notag \\
j(z) & = \bigg[(1-\Omega_m)\bigl(9 z^2 w_a^2 + 3(z')w_a(6 w_0 z + 3z +1)
\notag \\
& \qquad
+ (9w_0(w_0+1)+2)(z')^2\bigr)(z)^{3(w_a+w_0)}
+ 2(z')^2 \Omega_m \frac{3 w_a z}{z'}\biggr]\cdot
\notag \\
& \qquad
\biggl(2(z')^2\Bigl((1-\Omega_m)(z')^{3(w_a+w_0)}
+ \Omega_m \mathrm{e}^{\tfrac{3 z w_a}{z'}}\Bigr)\biggr)^{-1}
\end{flalign}
\end{document}
(红线显示部分文章页面布局)
答案2
有很多可能的解决方案。一种是使用包中的IEEEeqnarray*
(*
用于抑制方程式编号)环境IEEEtrantools
。它的用法与环境相似tabular
。您可以指定用于对齐的列数,并且r
,C
和l
用于右对齐、居中(略多一点空间)和左对齐。
\documentclass{article}
\usepackage{geometry} %Used for increased textwidth.
\usepackage{IEEEtrantools}
\begin{document}
\begin{IEEEeqnarray*}{*rCl} %the * type glue ensures that the whole equation is left aligned not centered
q(z) &=& \frac{(1-\Omega_m)(3zw_a + 3w_0(z+1)+z+1)(z+1)^{3(w_a + w_0)}+(z+1)\Omega_m e^{\frac{3z w_a}{z+1}}}{2(z+1)[(1-\Omega_m)(z+1)^{3(w_a +w_0)}+\Omega_m e^{\frac{3 z w_a}{z+1}}]} \\
j(z) &=& \Big[(1-\Omega_m)(9 z^2 w_a^2 + 3(z+1)w_a(6 w_0 z + 3z +1) + (9w_0(w_0+1)+2) (z+1)^2)\times\\
& & (z+1)^{3(w_a+w_0)}+2(z+1)^2 \Omega_m \frac{3 w_a z}{z+1}\Big] \Big(2(z+1)^2((1-\Omega_m)(z+1)^{3(w_a+w_0)}+ \Omega_m e^{\frac{3 z w_a}{z+1}})\Big)^{-1} \IEEEeqnarraynumspace\IEEEyesnumber
\end{IEEEeqnarray*}
\end{document}
插入IEEEyesnumber
方程号并确保IEEEeqnarraynumspace
方程号和方程之间没有重叠。
答案3
我建议加载geometry
包以获得更合适的边距,并使用aligned
嵌套在全局中的第二个方程的环境align
:
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{mathtools, bm}
\begin{document}
\begin{align}
q(z) & = \frac{(1-\Omega_m)(3zw_a + 3w_0(z+1)+z+1)(z+1)^{3(w_a + w_0)}+(z+1)\Omega_m e^{\frac{3z w_a}{z+1}}}{2(z+1)[(1-\Omega_m)(z+1)^{3(w_a +w_0)}+\Omega_m e^{\frac{3 z w_a}{z+1}}]} \\
j(z) & = \biggl[\begin{aligned}[t] (1-\Omega_m)(9 z^2 w_a^2 + 3(z+1)w_a(6 w_0 z + 3z +1) + (9w_0(w_0+1)+2) (z+1)^2)\times{}\\
(z+1)^{3(w_a+w_0)}+2(z+1)^2 \Omega_m \frac{3 w_a z}{z+1}\biggr]\bm\cdot {}\\
\Bigl(2(z+1)^2((1-\Omega_m)(z+1)^{3(w_a+w_0)}+ \Omega_m e^{\frac{3 z w_a}{z+1}})\Bigr)^{\!\!\mathrlap{-1}}
\end{aligned}
\end{align}
\end{document}