我嘗試按如下方式使用 pmatrix:
\begin{equation}\label{Eq.11}
J =
\begin{pmatrix}
\frac{\partial c_{1}(t+1)}{\partial c_{1}(t)} & \frac{\partial c_{1}(t+1)}{\partial c_{2}(t)} & \cdots & \frac{\partial c_{1}(t+1)}{\partial c_{L}(t)} \\
\frac{\partial c_{2}(t+1)}{\partial c_{1}(t)} & \frac{\partial c_{2}(t+1)}{\partial c_{2}(t)} & \cdots & \frac{\partial c_{2}(t+1)}{\partial c_{L}(t)} \\
\vdots & \vdots & \ddots & \vdots \\
\frac{\partial c_{L}(t+1)}{\partial c_{1}(t)} & \frac{\partial c_{L}(t+1)}{\partial c_{2}(t)} & \cdots & \frac{\partial c_{L}(t+1)}{\partial c_{L}(t)}
\end{pmatrix}.
\end{equation}
出現以下錯誤:
! Extra \right.\endpmatrix -> \endmatrix \right ) \end{pmatrix}
! Missing $ inserted.<inserted text>$ \end{pmatrix}
! Missing } inserted.<inserted text>} \end{pmatrix}
! You can't use `\eqno' in math mode.\endmathdisplay@a ...\df@tag \@empty \else \veqno\alt@tag \df@tag \fi \ifx ... \end{equation}
! Missing \right. inserted.<inserted text>\right . \end{equation}
! Missing \endgroup inserted.<inserted text>\endgroup \end{equation}
該程式碼在其他文件中運作良好,但我正在處理的最後一個文件由多個文件組成,每個文件代表文件中的一個章節。
任何建議將不勝感激。
謝謝
答案1
請經常發帖完全的產生錯誤的文檔。特別是,它允許您檢查您發布的片段實際上是否產生了錯誤。您問題中的片段不會產生錯誤,而且錯誤訊息也不是完整的 TeX 錯誤訊息。
不過我猜你的真實文件是這樣的,它會產生類似的錯誤,這裡我顯示完整的 TeX 錯誤,它比過濾視圖提供更多資訊:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\left( % unfinished math expression
\begin{equation}\label{Eq.11}
J =
\begin{pmatrix}
\frac{\partial c_{1}(t+1)}{\partial c_{1}(t)} & \frac{\partial c_{1}(t+1)}{\partial c_{2}(t)} & \cdots & \frac{\partial c_{1}(t+1)}{\partial c_{L}(t)} \\
\frac{\partial c_{2}(t+1)}{\partial c_{1}(t)} & \frac{\partial c_{2}(t+1)}{\partial c_{2}(t)} & \cdots & \frac{\partial c_{2}(t+1)}{\partial c_{L}(t)} \\
\vdots & \vdots & \ddots & \vdots \\
\frac{\partial c_{L}(t+1)}{\partial c_{1}(t)} & \frac{\partial c_{L}(t+1)}{\partial c_{2}(t)} & \cdots & \frac{\partial c_{L}(t+1)}{\partial c_{L}(t)}
\end{pmatrix}.
\end{equation}
\end{document}
出現以下錯誤(在 TeX 中總是首先查看第一個錯誤,因為在這種情況下,以下所有錯誤都是虛假的)
! LaTeX Error: Bad math environment delimiter.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.7 \begin{equation}
\label{Eq.11}
?
! You can't use `\eqno' in math mode.
\endmathdisplay@a ...\df@tag \@empty \else \veqno
\alt@tag \df@tag \fi \ifx ...
l.15 \end{equation}
?
! Missing \endgroup inserted.
<inserted text>
\endgroup
l.15 \end{equation}
?
! Missing \right. inserted.
<inserted text>
\right .
l.15 \end{equation}
?
! LaTeX Error: \begin{document} ended by \end{equation}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.15 \end{equation}