Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I got an error "Missing $ inserted" for the following code:

\begin{algorithm}[ht!]
\If{cond2}{
second if\;
second if\;
} 
\caption{Algorithm MyAlgo()}\label{algo:synConstraint}
\end{algorithm}

What is the problem?

share|improve this question

closed as too localized by Brent.Longborough, Marco Daniel, percusse, Paulo Cereda, Joseph Wright Jul 28 '12 at 15:14

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

3  
Please edit your question to include a complete example that reproduces the error. I don't think anything is wrong with the snippet you have provided. –  Ian Thompson Jul 28 '12 at 12:04
    
Thanks, your comment does help, this is caused by other \usepackage, I just move the line \usepackage[ruled,vlined,linesnumbered]{algorithm2e} to the last one of all the \usepackage, it works! –  william007 Jul 28 '12 at 12:15
    
@william007: It is ok to answer your own question. Just explain what you have found out and put it in an answer. In this way the question can be marked as answered (after 48h) and others who happen to have the same problem can find it. –  canaaerus Jul 28 '12 at 13:21

Browse other questions tagged or ask your own question.