latex表达式 -- 公式等号对其

公式的换行:

使用\\就可以使得公式换行

比如下面的表达式
在等号前面加上了\\,公式就换行了。


$$ \sum_{r = i + 1}^{R + 1}\sum_{l = L}^{i}sum[r] - sum[l] 
 \\=(i - L + 1)\sum_{r = i + 1}^{R + 1}sum[r] - (R - i + 1)\sum_{l = L}^{i}sum[l] 
 \\= (i - L + 1)(sums[R + 2] - sums[i + 1]) - (R - i + 1)(sums[i + 1] - sums[L]) $$

∑ r = i + 1 R + 1 ∑ l = L i s u m [ r ] − s u m [ l ] = ( i − L + 1 ) ∑ r = i + 1 R + 1 s u m [ r ] − ( R − i + 1 ) ∑ l = L i s u m [ l ] = ( i − L + 1 ) ( s u m s [ R + 2 ] − s u m s [ i + 1 ] ) − ( R − i + 1 ) ( s u m s [ i + 1 ] − s u m s [ L ] ) \sum_{r = i + 1}^{R + 1}\sum_{l = L}^{i}sum[r] - sum[l] \\=(i - L + 1)\sum_{r = i + 1}^{R + 1}sum[r] - (R - i + 1)\sum_{l = L}^{i}sum[l] \\= (i - L + 1)(sums[R + 2] - sums[i + 1]) - (R - i + 1)(sums[i + 1] - sums[L]) r=i+1R+1l=Lisum[r]sum[l]=(iL+1)r=i+1R+1sum[r](Ri+1)l=Lisum[l]=(iL+1)(sums[R+2]sums[i+1])(Ri+1)(sums[i+1]sums[L])

但是上面的表达式可以看到公式的等号是不对齐的。

  1. 首先,使用\begin{aligned} \end{aligned}包裹整个表达式

  2. 然后再需要对其的等号前面加上&即可。

比如下面的表达式,等号前面加上了&,等号自动对其

\begin{aligned}
\theta ^{*},\theta ^{'*}
&= \argmin\limits_{\theta,\theta^{'}}\frac{1}{n}\sum_{n}^{i=1}L\left (\textbf{x}^{(i)},\textbf{x}^{'(i)}  \right )
\\
&=\argmin\limits_{\theta,\theta^{'}}\frac{1}{n}\sum_{n}^{i=1}L\left (\textbf{x}^{(i)},g_{\theta ^{'}}\left ( f_{\theta }\left ( \textbf{x}^{i}\right )\right )\right )
\end{aligned}

θ ∗ , θ ′ ∗ = arg min ⁡ θ , θ ′ 1 n ∑ n i = 1 L ( x ( i ) , x ′ ( i ) ) = arg min ⁡ θ , θ ′ 1 n ∑ n i = 1 L ( x ( i ) , g θ ′ ( f θ ( x i ) ) ) \begin{aligned} \theta ^{*},\theta ^{'*} &= \argmin\limits_{\theta,\theta^{'}}\frac{1}{n}\sum_{n}^{i=1}L\left (\textbf{x}^{(i)},\textbf{x}^{'(i)} \right ) \\ &=\argmin\limits_{\theta,\theta^{'}}\frac{1}{n}\sum_{n}^{i=1}L\left (\textbf{x}^{(i)},g_{\theta ^{'}}\left ( f_{\theta }\left ( \textbf{x}^{i}\right )\right )\right ) \end{aligned} θ,θ=θ,θargminn1ni=1L(x(i),x(i))=θ,θargminn1ni=1L(x(i),gθ(fθ(xi)))

还有下面的表达式

\begin{aligned}
\sum_{r = i + 1}^{R + 1}\sum_{l = L}^{i}sum[r] - sum[l]
&=(i - L + 1)\sum_{r = i + 1}^{R + 1}sum[r] - (R - i + 1)\sum_{l = L}^{i}sum[l]
\\
&=(i - L + 1)(sums[R + 2] - sums[i + 1]) - (R - i + 1)(sums[i + 1] - sums[L])
\end{aligned}

∑ r = i + 1 R + 1 ∑ l = L i s u m [ r ] − s u m [ l ] = ( i − L + 1 ) ∑ r = i + 1 R + 1 s u m [ r ] − ( R − i + 1 ) ∑ l = L i s u m [ l ] = ( i − L + 1 ) ( s u m s [ R + 2 ] − s u m s [ i + 1 ] ) − ( R − i + 1 ) ( s u m s [ i + 1 ] − s u m s [ L ] ) \begin{aligned} \sum_{r = i + 1}^{R + 1}\sum_{l = L}^{i}sum[r] - sum[l] &=(i - L + 1)\sum_{r = i + 1}^{R + 1}sum[r] - (R - i + 1)\sum_{l = L}^{i}sum[l] \\ &=(i - L + 1)(sums[R + 2] - sums[i + 1]) - (R - i + 1)(sums[i + 1] - sums[L]) \end{aligned} r=i+1R+1l=Lisum[r]sum[l]=(iL+1)r=i+1R+1sum[r](Ri+1)l=Lisum[l]=(iL+1)(sums[R+2]sums[i+1])(Ri+1)(sums[i+1]sums[L])

你可能感兴趣的:(后台,latex)