Diego’s CS research blog

August 13, 2008

Side-by-Side Algorithms in LaTex

Filed under: Uncategorized — Diego @ 9:35 am

Here is the code of how to put two (or more) algorithms side by side in latex using algorithmic and algorithm packages. (The principle is the same used to put figures side-by-side).
NB: remeber to put [H] as a parameter for \begin{algorithm} (I lost a lot of time trying to understand this very simple thing)

 

\begin{figure*}[ttt!]

 \begin{minipage}[t]{3.15in}

 \begin{algorithm}[H]

\caption{Mission-side Greedy} 

\label{alg1} 

\begin{algorithmic}[1]

\STATE whatever your alg does

\FOR{each mission $M_{j}$ in sorted order} 

\STATE do something

\ENDFOR

\end{algorithmic}

\end{algorithm}

 \end{minipage}

 \hfill

 \begin{minipage}[t]{3.15in}

\begin{algorithm}[H]

\caption{Mission-side2 Greedy} 

\label{alg2} 

\begin{algorithmic}[1]

\STATE whatever your alg does

\FOR{each mission $M_{j}$ in sorted order} 

\STATE do something

\ENDFOR

\end{algorithmic}

\end{algorithm}

 \end{minipage}

 \hfill

\end{figure*}

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.