3

I have the following code:

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

(It used to be in an align environment, but I wrote the minimal example for which the code doesn't work).

I keep getting the same error:

Missing $ inserted.
<inserted text> 
                $
l.9 ..._{32} & a_{33} \end{vmatrix} - a_{12} 
                                                  \begin{vmatrix} a_{21} ...

What is wrong with a_{12} ?

9
  • 1
    When I copied your code into my example file, it came with some strange values added between the empty lines. After removing those strange symbols, it worked fine. Please check your encoding and editor settings. Commented Sep 20, 2021 at 14:44
  • 1
    You've got some spurious characters U+000C (form feed) in the code.
    – campa
    Commented Sep 20, 2021 at 14:46
  • 3
    I copy/pasted into a Unicode Text Analyzer (just google it and you'll find some). Some editors have an option "show non-printable characters" or similar.
    – campa
    Commented Sep 20, 2021 at 14:53
  • 3
    Even though you may not see them in the source they are showing in the log see above where you get the square boxes in the error message Commented Sep 20, 2021 at 15:59
  • 2
    Another way to find invisible symbols is to go to the indicated part of the tex source, and start pressing the right arrow key. At the problem site, you'll press the key but nothing will happen to your cursor. Then you can delete the invisible character that you just passed.
    – Teepeemm
    Commented Oct 21, 2021 at 3:18

2 Answers 2

1

I cleaned it up a little and aligned it so it fits onto a page.

\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}
1
  • This (and the other answer) would greatly benefit from saying that the original problem was a non-printable character.
    – Teepeemm
    Commented Oct 21, 2021 at 3:19
1

enter image description here

\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}
1
  • This (and the other answer) would greatly benefit from saying that the original problem was a non-printable character.
    – Teepeemm
    Commented Oct 21, 2021 at 3:19

Not the answer you're looking for? Browse other questions tagged .