TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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


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


I get an error as:

ERROR: Missing $ inserted.

--- TeX said ---
<inserted text> 

--- 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
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:

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

please provide a minimal example:

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

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

Your Answer


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.