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.

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'm getting this error:

! Undefined control sequence.
l.64 ...p(- \frac{E_j - E_i}{k_B T}) & \quad \text
                                                  {:  E_j > E_i}\\
! Undefined control sequence.
l.65     1 & \quad \text
                        {:  E_j<E_i}\\

which is from this:

w_{i,j}=w_0 exp(-2 \gamma R_{i,j})\left\{ 
  \begin{array}{l l}
    exp(- \frac{E_j - E_i}{k_B T}) & \quad \text{:  E_j > E_i}\\
    1 & \quad \text{:  E_j<E_i}\\
  \end{array} \right.

But I don't understand why I get the error. This is my header:

%\newcommand{\gguide}{{\it Preparing graphics for IOP journals}}
%Uncomment next line if AMS fonts required
\usepackage{graphicx, wrapfig}

And my class file is the standard IoP one from here

Can anyone help me get read of this error?

share|improve this question
up vote 10 down vote accepted

The mistake is, as TeX also informs. It cannot find your \text command. The error lies probably in package iopams and should be noticed there. It seems that it does not load the ams math package (only its fonts) and thus you need to explicitly include that package as well.

On a side note you should also include $ in your \text command.

share|improve this answer
On a side note you should also include $ in your \text command. Where in the text command? It renders $E_j$ etc fine. – Pureferret Jan 13 '12 at 21:19
Probably not in \text{: E_j > E_i} the _ is a mathchar as well as >. You need \text{: $E_j > E_i$} unless iopams does magic for you! :) – zeroth Jan 13 '12 at 21:24
I do in fact elieve some form of magic for me. Or, that due to \text not being recognised, it's ignored so E_j renders correctly. – Pureferret Jan 13 '12 at 21:35
So is your original problem solved? Then its fine. I havn't tried the iopart class so can not say if it changes the definition of _. It just seems against normal TeX packages to do this (unless it is grouped in the math environments). Glad it works! :) – zeroth Jan 13 '12 at 21:46
I've just edited the iopams file to include the maths library. Works like a charm. – Pureferret Jan 13 '12 at 21:51

The macro \text is undefined. You need to load the amsmath package or at least amstext.


\text is defined in amstext, which is loaded by amsmath. Load the latter, because it offers many math functionality, such as aligned multi-line formulas and much more.

share|improve this answer
Now it is just returning lots of errors about extra { or missing $ and it never finishes compiling. – Pureferret Jan 13 '12 at 21:16
@Pureferret Use text within \text{...} That's what it's for: escaping math mode. If you need math symbols within again, write \text{word $\symbol$} or even better, end the macro argument, such as \text{word } \symbol \text{ and more text}. – Stefan Kottwitz Jan 13 '12 at 21:26
I just removed the \text{...} macro, and it runs smoothly now. I'll sacrifice that : for the sake of simplicity. – Pureferret Jan 13 '12 at 21:44

A similar mistake might also be caused by something as simple as trying to build the wrong file(e.g. clicking a PDFLaTeX command while being in the "abstract" file, which is part of your document). You should be in your main file(where you call and "gather" all the "smaller" files) when you're building.

I hope this saves some time for newbies like me, as this page was the first suggestion when looking for this error.

share|improve this answer

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.