
我有以下等式:
\begin{equation}
\begin{split}
f_a(w_1,\ldots,w_m,&z_{w_1pa},\ldots,z_{w_mpa},a) = \\
&\prod_{j\in \{1,\ldots,m\} \mid z_{w_jpa} \neq \emptyset} \left( \left|z_{w_jpa} - a\right| + \left(-1\right)^{|z_{w_jpa} - a|} w_j\right)\\
\end{split}
\end{equation}
這段程式碼的結果是
我想將方程式的第二行移到左側,以便方程式標籤不使用另一行。
答案1
像這樣添加\hspace*{-15pt}
之後:&
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{split}
f_a(w_1,\ldots,w_m,&z_{w_1pa},\ldots,z_{w_mpa},a) = \\
&\hspace*{-15pt}\prod_{j\in \{1,\ldots,m\} \mid z_{w_jpa} \neq \emptyset} \left( \left|z_{w_jpa} - a\right| + \left(-1\right)^{|z_{w_jpa} - a|} w_j\right)
\end{split}
\end{equation}
\end{document}
\hspace* ensures that the space is given unlike other
\hspace, \hskip commands especially when given at the
beginning of the line.
答案2
刪除最後一個\\
.我提出了其他四種變體,其中multlined
需要加載mathtools
而不是amsmath
;整個方程式寫在一行上:
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage[showframe]{geometry}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}
\begin{document}
\begin{multline}
f_a(w_1,\ldots,w_m,z_{w_1pa},\ldots,z_{w_mpa},a) =\\%
\prod _{j \in \{1,\ldots,m\} ∣z_{w_jpa} \neq \emptyset} \bigl( \abs{z_{w_jpa} - a} + \left(-1\right)^{\abs{z_{w_jpa} - a}} w_j\bigr)
\end{multline}
\vskip 0.5cm
\begin{equation}
\begin{split}
f_a(w_1,\ldots,w_m,{}&z_{w_1pa},\ldots,z_{w_mpa},a) = \\
&\prod _{j \in \{1,\ldots,m\} ∣z_{w_jpa} \neq \emptyset} \left( \abs{z_{w_jpa} - a} + \left(-1\right)^{\abs{z_{w_jpa} - a}} w_j\right)
\end{split}
\end{equation}
\vskip 0.5cm
\begin{equation}
\begin{multlined}
f_a(w_1,\ldots,w_m, z_{w_1pa},\ldots,z_{w_mpa},a) = \\
\prod _{j \in \{1,\ldots,m\} ∣z_{w_jpa} \neq \emptyset} \left( \abs{z_{w_jpa} - a} + \left(-1\right)^{\abs{z_{w_jpa} - a}} w_j\right)
\end{multlined}
\end{equation}%
\vskip 0.5cm
\begin{equation}
\begin{aligned}
\MoveEqLeft f_a(w_1,\ldots,w_m, z_{w_1pa},\ldots,z_{w_mpa},a) = \\
& \prod _{j \in \{1,\ldots,m\} ∣z_{w_jpa} \neq \emptyset} \left( \abs{z_{w_jpa} - a} + \left(-1\right)^{\abs{z_{w_jpa} - a}} w_j\right)
\end{aligned}
\end{equation}%
\vskip 0.5cm
\begin{equation}
f_a(w_1,\ldots,w_m,{}z_{w_1pa},\ldots,z_{w_mpa},a) = \\
\prod _{\mathclap{\substack{j \in \{1,\ldots,m\} \\ z_{w_jpa} \neq \emptyset}}}\!\left( \abs{z_{w_jpa} - a} + \left(-1\right)^{\abs{z_{w_jpa} - a}} w_j\right)
\end{equation}
\end{document}
答案3
您可以透過align-command的位置來定義它&
。目前,您正在將產品的左側與z
上面一行的左側對齊。只需嘗試這些位置即可。
兩點注意:不要\\
在最後一行輸入。如果您在第一行中對齊,z
,您將停用逗號後的自動間距。請,{}&z
改為這樣做。
% arara: pdflatex
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\setcounter{equation}{7}
% without any alignment.
\begin{equation}
\begin{split}
f_a(w_1,\ldots,w_m,z_{w_{1\mathrm{pa}}},\ldots,z_{w_{m\mathrm{pa}}},a) = \\
\prod_{\mathclap{j\in \{1,\ldots,m\} \mid z_{w_{j\mathrm{pa}}} \neq \emptyset}} \bigl( |z_{w_{j\mathrm{pa}}} - a| + (-1)^{|z_{w_{j\mathrm{pa}}} - a|} w_j\bigr)
\end{split}
\end{equation}
% aligned left
\begin{equation}
\begin{split}
&f_a(w_1,\ldots,w_m,z_{w_{1\mathrm{pa}}},\ldots,z_{w_{m\mathrm{pa}}},a) = \\
&\prod_{\mathrlap{j\in \{1,\ldots,m\} \mid z_{w_{j\mathrm{pa}}} \neq \emptyset}} \bigl( |z_{w_{j\mathrm{pa}}} - a| + (-1)^{|z_{w_{j\mathrm{pa}}} - a|} w_j\bigr)
\end{split}
\end{equation}
% aligned to the z as in your MWE
\begin{equation}
\begin{split}
f_a(w_1,\ldots,w_m,{}&z_{w_{1\mathrm{pa}}},\ldots,z_{w_{m\mathrm{pa}}},a) = \\
&\prod_{\mathclap{j\in \{1,\ldots,m\} \mid z_{w_{j\mathrm{pa}}} \neq \emptyset}} \bigl( |z_{w_{j\mathrm{pa}}} - a| + (-1)^{|z_{w_{j\mathrm{pa}}} - a|} w_j\bigr)
\end{split}
\end{equation}
\end{document}
題外話:我建議在第二行寫=。看https://tex.stackexchange.com/a/172110
答案4
這是一份工作multline
;我透過使用來更改複雜的下標\substack
,以避免使其太長。請注意,我更喜歡第一個未經調整的版本。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
This is the default rendering
\begin{multline}
f_a(w_1,\ldots,w_m,z_{w_1pa},\ldots,z_{w_mpa},a) = \\
\prod_{\substack{j\in \{1,\ldots,m\} \\ z_{w_jpa} \neq \emptyset}}
\Bigl( \lvert z_{w_jpa} - a\rvert + (-1)^{|z_{w_jpa} - a|} w_j\Bigr)
\end{multline}
and this happens if you add some balanced spaces
\begin{multline}
\hspace{4em}
f_a(w_1,\ldots,w_m,z_{w_1pa},\ldots,z_{w_mpa},a) = \\
\prod_{\substack{j\in \{1,\ldots,m\} \\ z_{w_jpa} \neq \emptyset}}
\Bigl( \lvert z_{w_jpa} - a\rvert + (-1)^{|z_{w_jpa} - a|} w_j\Bigr)
\hspace{4em}
\end{multline}
\end{document}