When I use ShareLatex or MikTex to compile the following LaTeX code:
\begin{algorithm}
\uIf{$|F_d(D'(C_{\hat{i}})) - F_d(D(C_{\hat{i}}))| > \sigma$ OR numSeqNoise > $\mu$}{
SplitCluster($C_j$)\;
}
\uElseIf{$|F_d(D'(C_{\hat{i}})) - F_d(D(C_{\hat{i}}))| > \tau$}{
numSeqNoise++\;
}
\uElseIf{$j \neq \hat{i}$}{
Remove $S_{R}$ from cluster $C_j$\;
Place $S_{R}$ in cluster $C_\hat{i}$\;
}\uElse{
Replace $S_{R}$ in cluster $C_\hat{i}$\;
}
\end{algorithm}
it compiles normally, but when I try to use WriteLatex, then the following error always happens:
Missing { inserted.
<to be read again>
\gdef
l.485 }
\uElse{
The line where the error is pointed out is }\uElse{
.
Somebody can help me? 😉
Best Answer
You need to use
C_{\hat{i}}
instead ofC_\hat{i}
, because\hat
doesn't open a group.Typographical advice: Because
\hat{i}
is too high and looks weird, LaTeX provides a dotless i\imath
.It is favourable to use
\hat{\imath}
instead of\hat{i}
. I replaced every occurrence in the example below.