Missing inserted error All the below equations work in CodeCogs but I am still getting an error for them in Texmaker. is line 501 \begin{align} P(c)= \frac{1}{n} \sum_{i=1}^{n} P(c\vert\vec{x_i}) \mu_{c,j} = \sum_{i=1}^{n} (\frac{P(c\vert\vec{x_i})}{nP(c)})x_{i,j} (\sum_{c})_{j,k} = \sum_{i=1}^{n}(\frac{P(c\vert\vec{x_i})}{nP(c)})(x_{i,j} - \mu_{c,j})(x_{i,k} - \mu_{c,k}) P(c\vert\vec{x_i}) = \frac{P(\vec{x_i}\vertc)P(c))}{\sum_{i=1}^{k}P(\vec{x_i}\vertc)P(c)} P(\vec{x_i}|c) = \frac{1}{\sqrt{2\pi(\sum_{c})}} exp(- \frac{1}{2}(\vec{x_i} - \vec{\mu_c})^T \sum_{c}^{-1}(\vec{x_i} - \vec{\mu_c})) \end{align}  Error: ! Missing inserted.
<inserted text>
$l.501 I've inserted a begin-math/end-math symbol since I think you left one out. Proceed, with fingers crossed. ! Display math should end with$\$.
\par
l.501

• Welcome to TeX.SE. There must be no empty line after or .etc. In addition, equation is not the right tool for this. Use align instead, for example. What is codecogs?
– user31729
Jun 2 '17 at 6:44
• online latex equation editor codecogs.com/latex/eqneditor.php Jun 2 '17 at 6:51
• its still not working Jun 2 '17 at 6:52

Apart from the missing \\s to terminate the lines, I strongly suggest you read the amsmath package documentation.

I could not find the vertc symbol anyway, which I translated in \vert c.

Do not leave empty lines inside math;

I also manually adjusted the height of the brackets, and substituted exp with the proper operator \exp.

I also substituted (\sum_c)_{j,k} with \sum_c{\mathstrut}_{j,k} to get rid of the parenthesis

I hope to have caught everything

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
P(c)= \frac{1}{n} \sum_{i=1}^{n} P(c\vert\vec{x_i})\\
\mu_{c,j} = \sum_{i=1}^{n} \Bigl(\frac{P(c\vert\vec{x_i})}{nP(c)}\Bigr)x_{i,j}\\
\sum_{c}{\mathstrut}_{j,k} = \sum_{i=1}^{n}\Bigl(\frac{P(c\vert\vec{x_i})}{nP(c)}\Bigr)(x_{i,j} - \mu_{c,j})(x_{i,k} - \mu_{c,k})\\
P(c\vert\vec{x_i}) = \frac{P(\vec{x_i}\vert c)P(c))}{\sum_{i=1}^{k}P(\vec{x_i}\vert c)P(c)}\\
P(\vec{x_i}|c) = \frac{1}{\sqrt{2\pi\sum_{c}}} \exp\Bigl(- \frac{1}{2}(\vec{x_i} - \vec{\mu_c})^T \sum_{c}^{-1}(\vec{x_i} - \vec{\mu_c})\Bigr)
\end{align}
\end{document}


• You beat me by 2 seconds Jun 2 '17 at 7:04
• @CarLaTeX but still working on it :) ahhaha the fastest of the west Jun 2 '17 at 7:05
• You'll beat egreg! Jun 2 '17 at 7:06
• @Moriambar: Hm, the coughing never stops
– user31729
Jun 2 '17 at 7:26
• @ChristianHupfer I understand: with all the allergies I sometimes start sneezing all around :) Jun 2 '17 at 7:28