I am trying to complete my research paper in LaTeX but getting following three errors. I have tried so many things from the internet but to no advantage. Could any one help me please?


File ended while scanning use of \ELSIF.\par \input{proposed-scheme}


LaTeX Error: Not in outer par mode.See the LaTeX manual or LaTeX Companion for explanation.Type H for immediate help.... \begin{algorithm}[t]


LaTeX Error: Command \ALC@lno already defined.Or name \end... illegal, see p.192 of the manual.See the LaTeX manual or LaTeX Companion for explanation.Type H for immediate help.... \begin{algorithmic}[1]

Error type 3 is coming many times.

Here is the working example of the algorithm.


\STATE Phase 1: Compute (abc)    
\STATE abc    
\FOR {condition}    
\STATE Compute abc   

\STATE Phase 2: Optimization (xyz)    
\FOR {condition}
\STATE xyz        
\IF {condition}    
\STATE xyz        
\ELSIF {condition}    
\STATE xyz    
\STATE return xyz to Algorithm 1    
  • Welcome to TeX.SX! Your example is neither compilable nor minimal. Please try to minimize that in order to give less work to us. Thanks. – LaRiFaRi Sep 2 '14 at 12:36
  • You missed a \begin{document} right before \begin{algorithm} – Jesse Sep 2 '14 at 12:40
  • @mani In order to help a bit on your MWE: The first 13 packages can be deleted without effecting the output (I guess... try that and trace down your problem). We do not have a package mystyle on our PCs. Do we need caption, label, fontsize, papersize in order to see your errors? Could you reproduce the same with a more standard documentclass like article. Do we really need to check 20 \STATE-commands in order to help or would 1 be enough. Please edit your question and a lot of people will be happy to help. Your MWE should still show the three errors, though. – LaRiFaRi Sep 2 '14 at 13:23
  • @LaRiFaRi Yes my document has footnote on first page. Please try the reduced example now. – mani Sep 2 '14 at 13:36
  • @LaRiFaRi I also have few other algorithms before this algorithm and all those algorithms compile properly, but this algorithm is causing trouble. – mani Sep 2 '14 at 13:39

The MWE is useless, because it does not generate any of the errors.

Ad 1) It seems, that the syntax in an environment algorithmic is not correct, probably an \ENDIF is missing.

Ad 2) Environment algorithm cannot be used in floats like figure or table because it is already a float object.

Ad 3) Usually \ALC@no is locally defined in the start code of algorithmic and the definition is dropped by \end{algorithmic}. Thus it could be caused by a missing \end{algorithmic} or it is a consecutive error of 1).

| improve this answer | |
  • Ad 1) The conditional statement is one multi-condition statement, i.e., \IF - \ELSIF - \ELSIF - \ELSIF - \ELSIF - \ELSE - \ENDIF. So where is the syntax error. – mani Sep 2 '14 at 13:05
  • @mani meta.tex.stackexchange.com/q/228 – LaRiFaRi Sep 2 '14 at 13:06
  • I could not interpret Ad 2 and Ad 3 at all. Could you please elaborate upon them? What is \ALC@no. Sorry - but lack of my knowledge. – mani Sep 2 '14 at 13:06
  • @Heiko Oberdiek I guess you are right on Ad 2 and may be on Ad 3 as well. How to avoid the Ad 2 error? – mani Sep 2 '14 at 13:51
  • @mani Ad 2: There is no source or MWE. Check your .log file, where the error occurs (file, line number) and check, if the environment algorithm around this location or right before, whether it is wrapped inside another environment or macro. – Heiko Oberdiek Sep 2 '14 at 14:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.