# Command "&" is not working

I am new to TeX and I am trying to write the following

$$N_{a,0}\begin{cases} R_{0,0} & a=0\\ N_{a-1,0}e^{-m} & 1\leq a\leq a_{max}-1\\ N_{a-1,0}e^{-m}/1-e^{-m} & a=a_{max} \end{cases}$$


but I get an error because & is not being recognized as a command, it does not even have the green color as the rest of the commands do. Any ideas on how to fix it?

• Please tell us which error it is. And indent your code by 4 spaces so we can see the syntax highlighting. Dec 18, 2015 at 17:10
• Welcome to TeX.SX! Do you have \usepackage{amsmath} in your document? Dec 18, 2015 at 17:11
• I did't... I've added it and now it works!!! Thanks!!! Dec 18, 2015 at 17:13
– Rico
Dec 18, 2015 at 17:26

Whether & is recognized as a command as far as syntax coloring is concerned depends on the editor you're using.

In any case, in order to use the cases environment you need to load amsmath.

Minimal example:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$$N_{a,0}= \begin{cases} R_{0,0} & a=0\\ N_{a-1,0}e^{-m} & 1\leq a\leq a_{\max}-1\\ N_{a-1,0}e^{-m}/1-e^{-m} & a=a_{\max} \end{cases}$$

\end{document}


Note \max to get the letters upright.

Here's what I get in the editor I use most commonly (Aquamacs)

This is how TeXStudio colorizes the same input: