Skip to content

Instantly share code, notes, and snippets.

@ashwin
Created June 29, 2012 06:49
Show Gist options
  • Save ashwin/3016347 to your computer and use it in GitHub Desktop.
Save ashwin/3016347 to your computer and use it in GitHub Desktop.
Inserting algorithm in LaTeX
% Add the packages
\usepackage{algorithm}
\usepackage{algpseudocode}
% Insert the algorithm
\begin{algorithm}
\caption{Compute sum of integers in array}
\label{array-sum}
\begin{algorithmic}[1]
\Procedure{ArraySum}{$A$}
\State $sum = 0$
\For {each integer $i$ in $A$}
\State $sum = sum + i$
\EndFor
\State Return $sum$
\EndProcedure
\end{algorithmic}
\end{algorithm}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment