# Cases environment problem, when used with subscript

I am trying to use the cases environment but I get the message, missing $inserted.  \begin{cases} deg(u_i) \textrm{ if u_i on primary diagonal} \\ -1 & \textrm{ if u_i u_j adjacent} \\ 0 & \textrm{otherwise} \end{cases}  Is the use of subscript, the problem? Any solutions? • That is because you have subscripted term u_i inside a \textrm argument, which nullifies the math mode. – Steven B. Segletes May 26 '14 at 18:40 • So what is the solution? I tried u\sb{i} without success. Any ideas? – Paramar May 26 '14 at 18:43 ## 1 Answer You have to place a math environment and add $ inside \textrm.

$\begin{cases} deg(u_i) \textrm{if u_i on primary diagonal} \\ -1 & \textrm{if u_i u_j adjacent} \\ 0 & \textrm{otherwise} \end{cases}$

• I'd use \text instead of \textrm. – egreg May 26 '14 at 20:08