對齊不是我所期望的

對齊不是我所期望的

我正在使用以下來源:

\usepackage[fleqn]{amsmath}

\begin{equation}
     \begin{aligned}
        \notag
        &t_m & = & \alpha_1(m_1) & \oplus & \alpha_2(m_2) & \oplus & \cdots & \oplus & \alpha_{m-1}(m_{m-1}) & \oplus & \alpha_{m}(0) \oplus \gamma_{m-1}(0) \oplus m_m0^* \\
        &t_a & = & \alpha_1(a_1) & \oplus & \alpha_2(a_2) & \oplus & \cdots & \oplus & \alpha_{a-1}(a_{a-1}) & \oplus & \alpha_{a}(a_a0^*)
    \end{aligned}
\end{equation}

我希望得到一個良好對齊的公式,元素之間有適當的間距,第一行比第二行延伸得更遠。相反,我得到這個:

在此輸入影像描述

我究竟做錯了什麼?

答案1

也許alignedat這裡的環境比較適合。

\documentclass[11pt,fleqn]{article}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage{mathtools}  % loads »amsmath«

\begin{document}
  \begin{equation*}
     \begin{alignedat}{5}
        t_m &= \alpha_1(m_1) &&\oplus\alpha_2(m_2) &&\oplus\cdots\oplus\alpha_{m-1}(m_{m-1}) &&\oplus\alpha_{m}(0) &&\oplus \gamma_{m-1}(0) \oplus m_m0^* \\
        t_a &= \alpha_1(a_1) &&\oplus\alpha_2(a_2) &&\oplus\cdots\oplus\alpha_{a-1}(a_{a-1}) &&\oplus\alpha_{a}(a_a0^*)
    \end{alignedat}
  \end{equation*}
\end{document}

如需全面的解釋,請查看 »數學模式" 文件.


在此輸入影像描述

答案2

你的程式碼對我來說運作得很好。但是,我懷疑缺少的 & 符號對導致了您的問題。例如,代碼(注意\oplus和之間缺少 & 符號\alpha_2(m_2)):

\begin{equation}
 \begin{aligned}
    \notag
    &t_m &= &\alpha_1(m_1) & \oplus \alpha_2(m_2) & \oplus & \cdots & \oplus & \alpha_{m-1}(m_{m-1}) & \oplus & \alpha_{m}(0) \oplus \gamma_{m-1}(0) \oplus m_m0^* \\
    &t_a &= &\alpha_1(a_1) & \oplus \alpha_2(a_2) & \oplus & \cdots & \oplus & \alpha_{a-1}(a_{a-1}) & \oplus & \alpha_{a}(a_a0^*)
\end{aligned}
\end{equation}

給我的正是你在那裡得到的。

在此輸入影像描述

相關內容