latex 方程式记录“缺少插入的 $”。$

latex 方程式记录“缺少插入的 $”。$

我有一个大文档,一切运行良好。我更改了方程的参数,但现在无法编译。

我使用XeLaTeX可以正常编译。 我需要一个像这样的等式

 \begin{equation}           

 \begin{bmatrix}
    V_{as}\\ 
    V_{bs}\\ 
    V_{cs}
    \end{bmatrix} 

= 

\left(\begin{smallmatrix}
R_s & 0 &0 \\ 
0 & R_{s} &0 \\ 
0 &0  &R_{s} 
\end{smallmatrix}\right)

\begin{bmatrix}
i_{as}\\ 
i_{bs}\\ 
i_{cs}
\end{bmatrix}
+
p\left(\begin{smallmatrix}
L_{aa} & L_{ab} &L_{ac} \\ 
L_{ba} & L_{bb} &L_{bc} \\ 
L_{ca} & L_{cb} &L_{cc}
\end{smallmatrix}\right)

\begin{bmatrix}
i_{as}\\ 
i_{bs}\\ 
i_{cs}
\end{bmatrix}
+
\left(\begin{smallmatrix}
e_{as}\\ 
e_{bs}\\ 
e_{cs}
\end{smallmatrix}\right) .

\label{ec:DCBrushless}
\end{equation}

然而当我编译时,我得到了这个

! Missing $ inserted.
<inserted text>
$
l.81
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.
! Display math should end with $$.
<to be read again>
\par
l.81
The `$' that I just saw supposedly matches a previous `$$'.
So I shall assume that you typed `$$' both times.
! Missing $ inserted.
<inserted text>
$
l.82 \begin{bmatrix}
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.
! Missing $ inserted.
<inserted text>
$
l.86 \end{bmatrix}
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
! Missing $ inserted.
<inserted text>
$
l.90 \left
(\begin{smallmatrix}
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.
! Missing $ inserted.
<inserted text>
$
l.95
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.
! Missing $ inserted.
<inserted text>
$
l.96 \begin{bmatrix}
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.
! Missing $ inserted.
<inserted text>
$

答案1

除了删除equation环境中的空白行以删除错误消息的直接来源之外,您还应该努力使您的符号更加一致。例如,您可能希望对所有矩阵和向量统一使用圆括号 - 或者对这些对象统一使用方括号 - 并对矩阵和向量使用相同的字体大小。(毕竟,向量只是单列或单行矩阵。)

以下示例实现了这些想法。该指令\setlength\arraycolsep{3pt}减少了矩阵中的列间空白;它用于确保数学本身和方程编号都适合同一行。假设您拥有最新的 TeX 发行版,则以下代码在 pdfLaTeX、XeLaTeX 和 LuaLaTeX 下应该同样可以很好地编译。

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{equation} \label{ec:DCBrushless}
\setlength\arraycolsep{3pt} % default value: 5pt
\begin{pmatrix}
    V_{as}\\
    V_{bs}\\
    V_{cs}
\end{pmatrix}
=
\begin{pmatrix}
R_s & 0 &0 \\
0 & R_{s} &0 \\
0 &0  &R_{s}
\end{pmatrix}
\begin{pmatrix}
i_{as}\\
i_{bs}\\
i_{cs}
\end{pmatrix}
+
p\begin{pmatrix}
L_{aa} & L_{ab} &L_{ac} \\
L_{ba} & L_{bb} &L_{bc} \\
L_{ca} & L_{cb} &L_{cc}
\end{pmatrix}
\begin{pmatrix}
i_{as}\\
i_{bs}\\
i_{cs}
\end{pmatrix}
+
\begin{pmatrix}
e_{as}\\
e_{bs}\\
e_{cs}
\end{pmatrix} .
\end{equation}

\end{document} 

答案2

其中不能有任何空行equation——删除它们并(添加\begin{equation})使这个编译

请不要对方程式的风格发表进一步的评论——它来自 OP。

\documentclass{article}
\usepackage{mathtools}
\begin{document}

\begin{equation}
\begin{bmatrix}
V_{as}\\ 
V_{bs}\\ 
V_{cs}
\end{bmatrix} 
= 
\left(\begin{smallmatrix}
R_s & 0 &0 \\ 
0 & R_{s} &0 \\ 
0 &0  &R_{s} 
\end{smallmatrix}\right)
\begin{bmatrix}
i_{as}\\ 
i_{bs}\\ 
i_{cs}
\end{bmatrix}
+
p\left(\begin{smallmatrix}
L_{aa} & L_{ab} &L_{ac} \\ 
L_{ba} & L_{bb} &L_{bc} \\ 
L_{ca} & L_{cb} &L_{cc}
\end{smallmatrix}\right)
\begin{bmatrix}
i_{as}\\ 
i_{bs}\\ 
i_{cs}
\end{bmatrix}
+
\left(\begin{smallmatrix}
e_{as}\\ 
e_{bs}\\ 
e_{cs}
\end{smallmatrix}\right) .
\label{ec:DCBrushless}
\end{equation}
\end{document}

相关内容