对齐问题?

对齐问题?

我试图对齐以下代码每行开头的两个等号和减号,但无论我做什么,都不起作用。

$C_{n}$  = $ \dfrac{1}{4\pi{i}} $ $ \displaystyle\int^\pi_{-\pi} x^2e^{ix({1-n})}\ dx $ $ - \dfrac{1}{4\pi{i}} $ $ \displaystyle\int^\pi_{-\pi} x^2e^{{-ix}({1+n})}\ dx $ 

\bigskip $  = \dfrac{1}{4\pi i}\Bigg[ \bigg[\dfrac {x^2ie^{-i(n-1)x}}{n-1} \bigg]_{-\pi}^\pi -  \displaystyle\int^\pi_{-\pi} \dfrac{2xie^{-i(n-1)x}}{n-1} \ dx \Bigg] $  

\bigskip $  - \dfrac{1}{4\pi i}\Bigg[ \bigg[\dfrac {x^2ie^{-i(n+1)x}}{n+1} \bigg]_{-\pi}^\pi -  \displaystyle\int^\pi_{-\pi} \dfrac {2xie^{-i(n+1)x}} {n+1} \ dx \Bigg] $

答案1

可能有更好的方法可以做到这一点,即根据align环境完全重构您的答案(见下文),但这个答案对您最初的尝试的影响最小。本质上,我\phantom在第二行和第三行的开头添加了一个。

\documentclass{letter}
\usepackage{amsmath}
\begin{document}
$C_{n}$  = $ \dfrac{1}{4\pi{i}} $ $ \displaystyle\int^\pi_{-\pi} x^2e^{ix({1-n})}\ dx $ $ - \dfrac{1}{4\pi{i}} $ $ \displaystyle\int^\pi_{-\pi} x^2e^{{-ix}({1+n})}\ dx $ 

\bigskip $\phantom{C_{n}}  = \dfrac{1}{4\pi i}\Bigg[ \bigg[\dfrac {x^2ie^{-i(n-1)x}}{n-1} \bigg]_{-\pi}^\pi -  \displaystyle\int^\pi_{-\pi} \dfrac{2xie^{-i(n-1)x}}{n-1} \ dx \Bigg] $  

\bigskip $\phantom{C_{n}}  - \dfrac{1}{4\pi i}\Bigg[ \bigg[\dfrac {x^2ie^{-i(n+1)x}}{n+1} \bigg]_{-\pi}^\pi -  \displaystyle\int^\pi_{-\pi} \dfrac {2xie^{-i(n+1)x}} {n+1} \ dx \Bigg] $
\end{document}

在此处输入图片描述


以下是一种实现此操作的方法align

\documentclass{letter}
\usepackage{amsmath}
\begin{document}
\begin{align}
C_{n} &=  \dfrac{1}{4\pi{i}}  \displaystyle\int^\pi_{-\pi} x^2e^{ix({1-n})}\ dx  - \dfrac{1}{4\pi{i}}  \displaystyle\int^\pi_{-\pi} x^2e^{{-ix}({1+n})}\ dx 
\\[2ex]
&= \dfrac{1}{4\pi i}\Bigg[ \bigg[\dfrac {x^2ie^{-i(n-1)x}}{n-1} \bigg]_{-\pi}^\pi -  \displaystyle\int^\pi_{-\pi} \dfrac{2xie^{-i(n-1)x}}{n-1} \ dx \Bigg]  
\\[2ex]
&- \dfrac{1}{4\pi i}\Bigg[ \bigg[\dfrac {x^2ie^{-i(n+1)x}}{n+1} \bigg]_{-\pi}^\pi -  \displaystyle\int^\pi_{-\pi} \dfrac {2xie^{-i(n+1)x}} {n+1} \ dx \Bigg]
\end{align}
\end{document}

相关内容