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.
\begin{algorithm}
\caption{Partial Sum Update Algorithm}\label{alg:usline}
\begin{algorithmic}[1]
\State $\mathcal{N}^*\gets$ bitreverse$(\mathcal{N})$
\If{$i(s)=0$}\Comment{The $s^{th}$ LSB in the binary representation of i is $0$.}
\If{$s=\log _2N - 1$ or$ i_{(\log _{2}N - 1):(s+1)} = \mathcal{N}_{(\log _{2}N - 2):s}^*$
\Endif
\Endif

\end{algorithmic}
\end{algorithm}

The above produces "runaway argument". Any ideas why ?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

There is a missing closing brace in the last \If (the first opening brace is not balanced); in the code below I added it:

\documentclass{article}
\usepackage{algorithm,algpseudocode}

\begin{document}

\begin{algorithm}
\caption{Partial Sum Update Algorithm}\label{alg:usline}
\begin{algorithmic}[1]
\State $\mathcal{N}^*\gets$ bitreverse$(\mathcal{N})$
\If{$i(s)=0$}\Comment{The $s^{th}$ LSB in the binary representation of i is $0$.}
\If{$s=\log _2N - 1$ or $ i_{(\log _{2}N - 1):(s+1)} = \mathcal{N}_{(\log _{2}N - 2):s}^*}$
\EndIf
\EndIf
\end{algorithmic}
\end{algorithm}

\end{document}

enter image description here

Note also that the right syntax is \EndIf and not \Endif (at least if algpseudocode is being used).

share|improve this answer
    
Thanks a lot. This is what I needed. –  mishr Aug 25 '12 at 23:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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