Rahul wrote:But in the case of using it simply like
it works.
This works although it is wrong. It should be
However, what you're doing in the other equation is basically this:
which does
not work! It escapes math mode
inside a mathematical formula which has to fail. If you remove those unnecessary
$
in your code it will compile.
You should use display mode for an equation that large, anyway:
Code: Select all
\documentclass[12pt,journal,compsoc]{IEEEtran}
\usepackage{alltt}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{array}
\begin{document}
\[
s =
\frac
{
\left[
n\sum_{i=1}^n a_i \cdot b_i
-\sum_{i=1}^n a_i \sum_{i=1}^n b_i
\right]
}
{2}
\]
\end{document}
I recommend reading
mathmode
Regards