3

this is my code:

\begin{eqnarray}
[A,C]\mid_{dom(x)} = -x^1x^2\frac{\partial}{\partial x^1} + (2(x^1)^2 - (x^2)^2 +2)\frac{\partial}{\partial x^2}  \\
[B,C]\mid_{dom(x)} = ((x^1)^2 - 2) \frac{\partial}{\partial x^1} -5x^1x^2 \frac{\partial}{\partial x^2} 
\end{eqnarray}

and this the error:

54
Missing number, treated as zero.
<to be read again> 
                   B
l.54 [B,C]
          \mid_{dom(x)} = ((x^1)^2 - 2) \frac{\partial}{\partial x^1} -5x^1x...

I would be glad if you help me, I cannot figure out the problem and solve it. I am a new Tex learner :/

I could not write the comment, anyway I like to thank you, these advices of yours solved my little problem!

Troy
  • 13,741
lilith
  • 31
  • 1
    Welcome to TeX.SX! It seems you're missing the &, before the = signs. In this case it's better to use align of the amsmath package than eqnarray. See http://tex.stackexchange.com/q/196/18228 – Herr K. Nov 23 '13 at 23:02
  • 1
    Since it hasn't been explained, the reason for the error is that \\ of eqnarray has an optional argument which is expected to be a length. So your first \\ takes [B,C] for its argument, and finds no length there, producing the error. The amsmath align environment is better in many ways, and this is just one of the minor ones. – Dan Nov 24 '13 at 07:01

1 Answers1

5

Don't use eqnarray. Use align* from amsmath.

Further, dom(x) looks like an operater, hence you may put \DeclareMathOperator{\dom}{dom} in the preamble and use it as \dom(x). I have also used \bigl and bigr from amsmath to make [ and ] bigger.

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\dom}{dom}
\begin{document}
 \begin{align*}
[A,C]\mid_{\dom(x)} &= -x^1x^2\frac{\partial}{\partial x^1} + \bigl[2(x^1)^2 - (x^2)^2 +2\bigr]\frac{\partial}{\partial x^2}  \\
[B,C]\mid_{\dom(x)} &= \bigl[(x^1)^2 - 2\bigr] \frac{\partial}{\partial x^1} -5x^1x^2 \frac{\partial}{\partial x^2}
\end{align*}
\end{document}

enter image description here

Moriambar
  • 11,466