Skip to content

Instantly share code, notes, and snippets.

@rg3915
Created April 3, 2014 02:08
Show Gist options
  • Save rg3915/9947088 to your computer and use it in GitHub Desktop.
Save rg3915/9947088 to your computer and use it in GitHub Desktop.
LaTex pseudocode example with minipage.
\documentclass{article}
\usepackage{algpseudocode,algorithm}
\begin{document}
\begin{minipage}[t]{0.45\textwidth}
\begin{algorithmic}
\Function{Absoluto}{x}
\If {$x < 0$}
\State \Return $-x$
\Else
\State \Return $x$
\EndIf
\EndFunction
\end{algorithmic}
\end{minipage}
\begin{minipage}[t]{0.45\textwidth}
\begin{algorithmic}
\For{$i \gets 1, n$}
\State {$A[i] \gets i + 1$}
\EndFor
\While {$i < n$}
\State $i \gets i + 1$
\EndWhile
\end{algorithmic}
\end{minipage}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment