为什么这个使用 align* 的等式没有居中?

为什么这个使用 align* 的等式没有居中?
\begin{align*}
        &\textit{One can see that:}\\
        &\langle n,x_i\rangle=0\\
        \implies &\partial_k\langle n, x_i\rangle=\langle n_k,x_i\rangle+\langle n,x_{i,k}\rangle=0\\
        \implies &\langle -n_k,x_i\rangle=\langle n_k,x_{i,k}\rangle\\
        \implies &\langle -n_k,x_i\rangle g^{i,j}x_j=\langle n_k,x_{i,k}\rangle g^{i,j}x_j\\
        \textit{Looking at the left expression, one can use:}\\
        &n_k=\alpha^l x_l\implies \langle x_i,n_k\rangle=\alpha^l \langle x_i,x_l\rangle=\alpha^l g_{i,l}\\
        \implies &\alpha^l=\langle x_i,n_k\rangle g^{i,l}\\
        \textit{Plugging this into the left expression and adapting the indices:}\\
        \implies -n_k=...
        \end{align*}

在此处输入图片描述

答案1

断断续续的短语使对齐变得混乱。用于\intertext添加解释。

或者,为了获得更紧凑的间距,请使用\shortintertext@egreg 在评论中指出的方式(需要\usepackage{mathtools}而不是\usepackage{amsmath})。

\intertext(包amsmath):

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum} % only for demo
\begin{document}
\lipsum[1]

One can see that:
\begin{align*}
        &\langle n,x_i\rangle=0\\
        \implies &\partial_k\langle n, x_i\rangle=\langle n_k,x_i\rangle+\langle n,x_{i,k}\rangle=0\\
        \implies &\langle -n_k,x_i\rangle=\langle n_k,x_{i,k}\rangle\\
  \implies &\langle -n_k,x_i\rangle g^{i,j}x_j=\langle n_k,x_{i,k}\rangle g^{i,j}x_j\\
  \intertext{Looking at the left expression, one can use:}
        &n_k=\alpha^l x_l\implies \langle x_i,n_k\rangle=\alpha^l \langle x_i,x_l\rangle=\alpha^l g_{i,l}\\
  \implies &\alpha^l=\langle x_i,n_k\rangle g^{i,l}\\
  \intertext{Plugging this into the left expression and adapting the indices:}
        \implies & -n_k=...
\end{align*}
\lipsum[2]

\end{document}

\shortintertext(包mathtools):

在此处输入图片描述

\documentclass{article}
\usepackage{mathtools}
\usepackage{lipsum} % only for demo
\begin{document}
\lipsum[1]

One can see that:
\begin{align*}
        &\langle n,x_i\rangle=0\\
        \implies &\partial_k\langle n, x_i\rangle=\langle n_k,x_i\rangle+\langle n,x_{i,k}\rangle=0\\
        \implies &\langle -n_k,x_i\rangle=\langle n_k,x_{i,k}\rangle\\
  \implies &\langle -n_k,x_i\rangle g^{i,j}x_j=\langle n_k,x_{i,k}\rangle g^{i,j}x_j\\
  \shortintertext{Looking at the left expression, one can use:}
        &n_k=\alpha^l x_l\implies \langle x_i,n_k\rangle=\alpha^l \langle x_i,x_l\rangle=\alpha^l g_{i,l}\\
  \implies &\alpha^l=\langle x_i,n_k\rangle g^{i,l}\\
  \shortintertext{Plugging this into the left expression and adapting the indices:}
        \implies & -n_k=...
\end{align*}
\lipsum[2]

\end{document}

答案2

除了用于\intertext两个解释性段落之外,我还会将&对齐点从左对齐移至符号对齐=。事实上,您可能希望简单地删除所有\implies指令,因为它们似乎是隐含的 [双关语]。

在此处输入图片描述

\documentclass{article}
\usepackage{mathtools} % for '\DeclarePairedDelimiter' macro
\DeclarePairedDelimiter\iprod\langle\rangle % "inner product"

\begin{document}

One can see that:
\begin{align*}
    \iprod{n,x_i} &=0\\
    \implies \partial_k\iprod{n, x_i}
       &=\iprod{n_k,x_i}+\iprod{n,x_{i,k}}=0\\
    \implies \iprod{-n_k,x_i}
       &=\iprod{n_k,x_{i,k}}\\
    \implies \iprod{-n_k,x_i} g^{i,j}x_j
       &=\iprod{n_k,x_{i,k}} g^{i,j}x_j\\
\intertext{Looking at the LHS expression, one can use:}
    n_k&=\alpha^l x_l \\
    \implies \iprod{x_i,n_k}
       &=\alpha^l \iprod{x_i,x_l}=\alpha^l g_{i,l}\\
    \implies \alpha^l
       &=\iprod{x_i,n_k} g^{i,l}\\
\intertext{Plugging this into the LHS expression and adapting the indices:}
    \implies -n_k &=\dots
\end{align*}

\end{document}

相关内容