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

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}

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.
    – Turion
    Dec 18, 2015 at 17:10
  • 3
    Welcome to TeX.SX! Do you have \usepackage{amsmath} in your document?
    – egreg
    Dec 18, 2015 at 17:11
  • I did't... I've added it and now it works!!! Thanks!!!
    – Biologist
    Dec 18, 2015 at 17:13
  • @egreg would you add this as an answer? :)
    – Rico
    Dec 18, 2015 at 17:26

1 Answer 1


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:



  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}


Note \max to get the letters upright.

enter image description here

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

enter image description here

This is how TeXStudio colorizes the same input:

enter image description here


You must log in to answer this question.

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