## LaTeX forum ⇒ Others ⇒ How to resolve the error: “Missing { inserted” in WriteLatex Topic is solved

Information and discussion about other LaTeX editors not listed above
FernandoRAJ
Posts: 2
Joined: Wed Sep 10, 2014 11:42 pm

### How to resolve the error: “Missing { inserted” in WriteLatex

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.
\gdef
l.485 }
\uElse{

The line where the error is pointed out is "}\uElse{".

Somebody can help me?

Johannes_B
Site Moderator
Posts: 3934
Joined: Thu Nov 01, 2012 4:08 pm
This seems to be a crosspost to How to resolve the error: “Missing { inserted.” inside an algorithm2e.

The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

FernandoRAJ
Posts: 2
Joined: Wed Sep 10, 2014 11:42 pm
Thank you, very much, for answers! It works!!
I would like to apologize for my mistake, but I will not do (crosspost) again.

Johannes_B
Site Moderator
Posts: 3934
Joined: Thu Nov 01, 2012 4:08 pm
Crossposts are ok for me, but please cross reference the posts so a helper can check the progress.

Henri Menke already solved your problem, it was a missing pair of braces (C_{\hat{\imath}}). His tip of using imath to produce a dotless i is a very good one. He made some more improvements to your code, for example setting »numSeqNoise« upright in the first line and including the binary oparator > in the math-environment. Otherwise it is a textual > with the corresponding spacing which wouldn't make much sense.

You might even want to typeset the OR upright and maybe even bold.

Here is Henris code for future reference
\documentclass{article}\usepackage{algorithm2e}\begin{document}\begin{algorithm}   \uIf{$|F_d(D'(C_{\hat{\imath}})) - F_d(D(C_{\hat{\imath}}))| > \sigma$ %\textup{\bfseries OR%} $\mathrm{numSeqNoise} > \mu$}{     SplitCluster($C_j$)\;   }    \uElseIf{$|F_d(D'(C_{\hat{\imath}})) - F_d(D(C_{\hat{\imath}}))| > \tau$}{     numSeqNoise++\;   }    \uElseIf{$j \neq \hat{\imath}$}{     Remove $S_{R}$ from cluster $C_j$\;     Place $S_{R}$ in cluster $C_{\hat{\imath}}$\;   }\uElse{     Replace $S_{R}$ in cluster $C_{\hat{\imath}}$\;   }\end{algorithm}\end{document}

Hint, you can click on »open in writelatex« to see the output.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Stefan Kottwitz
Posts: 9244
Joined: Mon Mar 10, 2008 9:44 pm
Hi Fernando,

welcome to the forum!

I tested you code too. Nice suggestion to use a dot less i with the hat, otherwise the hat should be shifted.

To have a look at the output (we like screenshots too )

algorithm.png (30.78 KiB) Viewed 7521 times

If you would have further questions, let us know.

Stefan