I'm using Texmaker 4.5 over Ubuntu 15.10 and trying to compile some amsmath code:

  \displaystyle\sum\_{i=1}^{k} \sum\_{\mathbf x \in S\_i}
  \left\| \mathbf x - \boldsymbol\mu\_i \right\|^2

When compiling, got both Missing } inserted and missing $ inserted in the line that begins with $\underset....

I guess I've escaped correctly all needed escapes; been trying to fix it for some minutes now with no success, wanted to check with someone more proficient at this.

Thank you for your collaboration!

  • 3
    eqnarray is already math so you do not want $ (or \displaystyle) but it is usually better to avoid eqnarray and use align from the amsmath package. Jan 14 '16 at 16:57
  • 2
    Well the first thing that leaps out at me is you do not need to use $ ... $ within an eqnarray* environment. Also, is there any reason you're using \_? This will produce an _ character, rather than the subscript that I presume you want? Also \mathbf is not a switch, you want \mathbf{x}
    – Au101
    Jan 14 '16 at 16:57

eqnarray is already math so you should not have $ but (a) eqnarray should not be used, amsmath provides align and (b) there is no alignment here at all so you just want \[

enter image description here

\sum_{i=1}^{k} \sum_{\mathbf{x} \in S_i} \| 
\mathbf{x} - \boldsymbol{\mu}_i \|^2

Note _ for subscripts not \_


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.