[Tex/LaTex] ELSE IF in algorithmic package


Is there a command in algorithmic package which is similar to \ElsIf in algorithmicx? ( I do not want each nested if to be indented).

Best Answer

Yes there is: \ELSIF. This is one of the first examples taken from the algorithms bundle documentation (section 3.2 The if-then-else Statement, p 3):

enter image description here

\usepackage{algorithmic}% http://ctan.org/pkg/algorithms
  \IF{some condition is true}
    \STATE do some processing
  \ELSIF{some other condition is true}
    \STATE do some different processing
  \ELSIF{some even more bizarre condition is met}
    \STATE do something else
    \STATE do the default actions
Related Question