非法的 pream-token (\frac): 使用了 `c'

非法的 pream-token (\frac): 使用了 `c'

我在 Latex 程式碼中插入了一個方程,但它出現了問題。

我試圖創建一個由兩個方程組組成的系統,但問題不斷出現,我不知道為什麼

\begin{equation}
    \begin{array}
        \frac{d\vec{x}_P}{dt}(t) = \vec{u}_P(\vec{x}_{str}(t), t)\\
        \vec{x}_{str}(t = \tau) = \vec{x}_{P0}
    \end{array}
\end{equation}

希望您能幫忙,事先致謝

答案1

array拋出錯誤是因為您沒有指定對齊方式。l例如,如果我們將對齊方式設為左對齊,那麼它可以正常編譯:

\documentclass{article}

\begin{document}

\begin{equation}
    \begin{array}{l}
        \frac{d\vec{x}_P}{dt}(t) = \vec{u}_P(\vec{x}_{str}(t), t)\\
        \vec{x}_{str}(t = \tau) = \vec{x}_{P0}
    \end{array}
\end{equation}

\end{document}

OP 的方程組左對齊

就像 @dg 在評論中所說,有更好的方法來排版方程組,這取決於您希望它們的外觀。我個人使用casesfrom amsmath,但我會將這個討論留給評論中的其他人。

另外,_{str}下標其實應該是類似的東西_{\mathrm{str}}。後者被視為文字並設定樣式,而前者只是變數序列,並且並不總是正確調整字距。

答案2

array需要一個參數來指定列類型。在您的情況下,單列l已對齊。

但這並不是達到此目的的正確工具。請查閱手冊amsmath以獲得更好的選擇。這裡我推薦aligned(或split)。

\documentclass{article}
\usepackage{amsmath}

\begin{document}

You're missing the column specification for \texttt{array}
\begin{equation}
\begin{array}{l}
  \frac{d\vec{x}_P}{dt}(t) = \vec{u}_P(\vec{x}_{str}(t), t)\\
  \vec{x}_{str}(t = \tau) = \vec{x}_{P_0}
\end{array}
\end{equation}
but you can do much better with \texttt{aligned}
and \verb+\mathrm{str}+
\begin{equation}
\begin{aligned}
& \frac{d\vec{x}_P}{dt}(t) = \vec{u}_P(\vec{x}_{\mathrm{str}}(t), t)\\
& \vec{x}_{\mathrm{str}}(t = \tau) = \vec{x}_{P_0}
\end{aligned}
\end{equation}

\end{document}

在此輸入影像描述

我也固定P0P_0.

相關內容