![数学模式中缺少$?](https://linux22.com/image/439735/%E6%95%B0%E5%AD%A6%E6%A8%A1%E5%BC%8F%E4%B8%AD%E7%BC%BA%E5%B0%91%24%EF%BC%9F.png)
我有以下代码:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\det(A) = a_{11}(a_{22}a_{33} - a_{23}a_{32}) - a_{12}(a_{21}a_{33} - a_{23}a_{31}) + a_{13}(a_{21}a_{32} - a_{22}a_{31})
= a_{11} \begin{vmatrix} a_{22} & a_{23} \\ a_{32} & a_{33} \end{vmatrix} - a_{12} \begin{vmatrix} a_{21} & a_{23} \\ a_{31} & a_{33} \end{vmatrix} + a_{13} \begin{vmatrix} a_{21} & a_{22} \\ a_{31} & a_{32} \end{vmatrix}
\]
\end{document}
(它曾经处于对齐环境中,但是我编写了一个代码不起作用的最小示例)。
我不断收到同样的错误:
Missing $ inserted.
<inserted text>
$
l.9 ..._{32} & a_{33} \end{vmatrix} - a_{12}
\begin{vmatrix} a_{21} ...
a_{12} 有什么问题?
答案1
我稍微整理了一下并将其对齐以便它适合页面。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\begin{aligned}
\det(A) &= a_{11}(a_{22}a_{33} - a_{23}a_{32}) - a_{12}(a_{21}a_{33} - a_{23}a_{31}) + a_{13}(a_{21}a_{32} - a_{22}a_{31}) \\
&= a_{11} \begin{vmatrix}
a_{22} & a_{23} \\
a_{32} & a_{33}
\end{vmatrix}
- a_{12}
\begin{vmatrix}
a_{21} & a_{23} \\
a_{31} & a_{33}
\end{vmatrix}
+ a_{13}
\begin{vmatrix}
a_{21} & a_{22} \\
a_{31} & a_{32}
\end{vmatrix}
\end{aligned}
\]
\end{document}
答案2
\documentclass{article}
\usepackage[left=1.5cm,right=1.5cm,top=1.5cm,bottom=2cm,bindingoffset=0cm]{geometry}
\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
\[
\det(A) = a_{11}(a_{22}a_{33} - a_{23}a_{32}) - a_{12}(a_{21}a_{33} - a_{23}a_{31}) + a_{13}(a_{21}a_{32} - a_{22}a_{31})
= a_{11}
\begin{vmatrix} a_{22} & a_{23} \\ a_{32} & a_{33} &
\end{vmatrix} - a_{12}
\begin{vmatrix} a_{21} & a_{23} \\ a_{31} & a_{33} &
\end{vmatrix} + a_{13}
\begin{vmatrix} a_{21} & a_{22} \\ a_{31} & a_{32}
\end{vmatrix}
\]
\end{document}