数学模式中缺少$?

数学模式中缺少$?

我有以下代码:

\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}

相关内容