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?

3 Answers 3


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.


  • On a side note you should also include $ in your \text command. Where in the text command? It renders $E_j$ etc fine. Jan 13, 2012 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! :)
    – nickpapior
    Jan 13, 2012 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. Jan 13, 2012 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! :)
    – nickpapior
    Jan 13, 2012 at 21:46
  • I've just edited the iopams file to include the maths library. Works like a charm. Jan 13, 2012 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.

  • Now it is just returning lots of errors about extra { or missing $ and it never finishes compiling. Jan 13, 2012 at 21:16
  • 1
    @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, 2012 at 21:26
  • I just removed the \text{...} macro, and it runs smoothly now. I'll sacrifice that : for the sake of simplicity. Jan 13, 2012 at 21:44
  • Note to readers: amsmath is not compatible with iopart.
    – Szabolcs
    Nov 23, 2020 at 19:18

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .