Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am designing an article, and using the amsmath package.

I tried to use the following to include an equation in my document:

\begin{equation}

  |\psi\rangle = \alpha|0\rangle + \beta|1\rangle \begin{pmatrix}
    \alpha & \beta \end{pmatrix} ^T

\end{equation}

I get an error as:

ERROR: Missing $ inserted.

--- TeX said ---
<inserted text> 
                $
l.51 

--- HELP ---
TeX probably found a command that can be used only in math mode when
it wasn't in math mode.  Remember that unless stated otherwise, all
all the commands of Section 3.3 in LaTeX Book (Lamport) can be used
only in math mode. TeX is not in math mode when it begins processing
the argument of a box-making command, even if that command is inside a
math environment. This error also occurs if TeX encounters a blank
line when it is in math mode.

Any idea where I'm going wrong here? Thanks.

EDIT: Took off the $'s. NOTE: I am using the T1 font encoding to be able to use the pipe symbol like that.

share|improve this question
    
The environment equation open the mathmode. You don't need any $. I very good composition ist the mathmode (author: Herbert Voß). mirror.ctan.org/info/math/voss/mathmode/Mathmode.pdf –  Marco Daniel Jun 10 '11 at 13:25
    
I included the $'s in a last-minute 'try-everything' kind of approach. I forgot to take them out before posting here. –  morgoth_bauglir Jun 10 '11 at 13:26
add comment

2 Answers

up vote 4 down vote accepted

The dollar sign switches to (inline) math mode. As you already is in a math environment (equation), they are unnecessary. Also, you cannot have empty lines in the equation environment. This works:

\begin{equation}
  |\psi\rangle = \alpha|0\rangle + \beta|1\rangle \begin{pmatrix}
  \alpha & \beta \end{pmatrix} ^T
\end{equation}
share|improve this answer
    
That was it! Thanks! –  morgoth_bauglir Jun 10 '11 at 13:30
add comment

please provide a minimal example:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
  |\psi\rangle = \alpha|0\rangle + \beta|1\rangle \begin{pmatrix}
    \alpha & \beta \end{pmatrix} ^T
\end{equation}
\end{document}

It is very important that you can't use blank line inside the environment. If you want a blank line in your code you can comment them.

share|improve this answer
    
Thanks, that was it! –  morgoth_bauglir Jun 15 '11 at 3:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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