Math & ScienceError: ! Missing $ inserted

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
luso
Posts: 2
Joined: Mon May 18, 2009 2:56 pm

Error: ! Missing $ inserted

Post by luso »

Hi all,

This is the first time I need to post and that's cool. It means I've found the 100E16 answers needed before... and thanks to you xD.

But now I found four of this => Error: ! Missing $ inserted at lines 3 and 4 on the code, what is wrong?

Code: Select all

\begin{equation}
  \left( 
  \begin{array}{cc}
    $R_{3 \times 3}$ & $p_{3 \times 1}$ \\
    $0$ & $1$
  \end{array} 
  \right)
\end{equation}
Sorry if is a trivial question, but I tried all the ways to avoid it with no results.

Thanks for everything.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10344
Joined: Mon Mar 10, 2008 9:44 pm

Error: ! Missing $ inserted

Post by Stefan Kottwitz »

Hi luso,

welcome to the board!
The complete array environment is set in math mode, you don't need those $ inside:

Code: Select all

\begin{equation}
\left(
\begin{array}{cc}
R_{3 \times 3} & p_{3 \times 1} \\
0 & 1
\end{array}
\right)
\end{equation}
You could use amsmath and a matrix environment instead:

Code: Select all

\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
  \begin{pmatrix}
    R_{3 \times 3} & p_{3 \times 1} \\
    0 & 1
  \end{pmatrix}
\end{equation}
\end{document}
Stefan
LaTeX.org admin
luso
Posts: 2
Joined: Mon May 18, 2009 2:56 pm

Re: Error: ! Missing $ inserted

Post by luso »

As I guess, there was a simple thing... thanks for helping.

Luso
Post Reply