# What is causing undefined control sequence?

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.
{:  E_j<E_i}\\
?


which is from this:

$$\label{eq:hop} 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:

\documentclass[11pt]{iopart}
%\newcommand{\gguide}{{\it Preparing graphics for IOP journals}}
%Uncomment next line if AMS fonts required
\usepackage{iopams}
\usepackage{graphicx, wrapfig}
\usepackage{fixltx2e}
\graphicspath{{images/}}
\DeclareGraphicsExtensions{.pdf,.png,.jpg,.gif}
\makeatletter
%\def\@cite#1{\textsuperscript{[#1]}}
\makeatother


And my class file is the standard IoP one from here

Can anyone help me get read of this error?

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. – 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.

\usepackage{amsmath}


\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. – 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
• Note to readers: amsmath is not compatible with iopart. – Szabolcs Nov 23 '20 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.