我如何对齐以下内容,以便所有内容都\Leftrightarrows
像这样彼此对齐:
到目前为止我有以下内容
\begin{align}
\frac{\partial f_A (x)}{\partial x_1} & = w_1 - \lambda \alpha x_1^{\alpha -1} x_2^{1- \alpha}
\Leftrightarrow
w_1 = \lambda \alpha x_1^{\alpha -1} x_2^{1- \alpha}
\\[0.7em]
\frac{\partial f_A (x)}{\partial x_2} & = w_2 - \lambda x_1^\alpha (1- \alpha) x_2^{- \alpha}
\Leftrightarrow
w_2 = \lambda x_1^\alpha (1-\alpha)x_2^{-\alpha}
\\[0.7em]
\frac{\partial f_A (x)}{\partial \lambda} & =x_1^\alpha x_2^{1-\alpha} - y
\Leftrightarrow
y = x_1^\alpha x_2^{1-\alpha}
\end{align}
答案1
设置/格式化为三个垂直对齐的方程系统:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\frac{\partial f_A (x)}{\partial x_1} & = w_1 - \lambda \alpha x_1^{\alpha
-1} x_2^{1- \alpha}
&\Leftrightarrow&&
w_1 &= \lambda \alpha x_1^{\alpha -1} x_2^{1- \alpha}
\\[\medskipamount]
\frac{\partial f_A (x)}{\partial x_2} & = w_2 - \lambda x_1^\alpha (1-
\alpha) x_2^{- \alpha}
&\Leftrightarrow&&
w_2 &= \lambda x_1^\alpha (1-\alpha)x_2^{-\alpha}
\\[\medskipamount]
\frac{\partial f_A (x)}{\partial \lambda} & =x_1^\alpha x_2^{1-\alpha} - y
&\Leftrightarrow&&
y &= x_1^\alpha x_2^{1-\alpha}
\end{align}
\end{document}
alignat
通过使用而不是可以实现更小的间距align
。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat}{3}
\frac{\partial f_A (x)}{\partial x_1} & = w_1 - \lambda \alpha x_1^{\alpha
-1} x_2^{1- \alpha}
&\quad\Leftrightarrow&\quad&
w_1 &= \lambda \alpha x_1^{\alpha -1} x_2^{1- \alpha}
\\[\medskipamount]
\frac{\partial f_A (x)}{\partial x_2} & = w_2 - \lambda x_1^\alpha (1-
\alpha) x_2^{- \alpha}
&\Leftrightarrow&&
w_2 &= \lambda x_1^\alpha (1-\alpha)x_2^{-\alpha}
\\[\medskipamount]
\frac{\partial f_A (x)}{\partial \lambda} & =x_1^\alpha x_2^{1-\alpha} - y
&\Leftrightarrow&&
y &= x_1^\alpha x_2^{1-\alpha}
\end{alignat}
\end{document}