1

I'm trying to define a matrix:

\begin{matrix}  
a & b & c \\
d & e & f
\end{matrix}

But I'm keep getting this error:

! Missing $ inserted.<inserted text>$ \begin{matrix}
! Missing $ inserted.<inserted text>$ \end{matrix}
1
  • 1
    $\begin{matrix}...\end{matrix}$ should do!
    – user31729
    Oct 25 '15 at 22:23
2

The matrix environment must be used in math mode, i.e. use $\begin{matrix}...\end{matrix}$ or within one of the various math-environments such as equation or align etc.

\documentclass{article}

\usepackage{mathtools}% Only needed for `pmatrix` etc. 

\begin{document}

$
\begin{matrix}  
a & b & c \\ 
d & e & f
\end{matrix}$  

$\begin{pmatrix}  
a & b & c \\
d & e & f
\end{pmatrix}$


\begin{equation}
\begin{bmatrix}  
a & b & c \\
d & e & f
\end{bmatrix} &\neq 
\begin{Bmatrix}  
a & b & c \\
d & e & f
\end{Bmatrix}
\end{equation}


\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.