Handle \text in \cases better
As reported in this meta.math.SE post, the backwards-compatibility check used to detect when \text{}
is already in the second column is not robust enough, and something like
$$d_{1}\left(x,y\right)=\cases{
0&\text{if }x=y\cr
1&\text{if }x\neq y}$$
causes the check to put the second column in math-mode when it shouldn't.