This is what i tried, but i can get the algorithms to display side by side.
\begin{minipage}{\textwidth}
\centering
\begin{minipage}{0.48\textwidth}
\centering
%\begin{algorithm}
\captionof{algorithm}{alg1}
\label{alg:case3}
\begin{algorithmic}
\REQUIRE $\F$, $O''$,
\ENSURE $I''$
\STATE $P_O \leftarrow$ $O''$
\STATE I $\leftarrow$ \{$I_1,I_2,..., I_n$\};
\end{algorithmic}
\end{minipage}
\begin{minipage}[c]{0.48\textwidth}
\centering
%\begin{algorithm}
\captionof{algorithm}{alg2}
\label{alg:case2_2}
\begin{algorithmic}
\REQUIRE $T$, $O''$, $I$,
\ENSURE $I''$
\STATE $P_O \leftarrow$ $O''$
\STATE $W'_O \leftarrow \O$
\end{algorithmic}
\end{minipage}
\captionof{figure}{Both alg}
\label{xxxxx}
\end{minipage}
Where could i be going wrong?
Best Answer
The
\centering
of the "outer" minipage causes the two "inner" minipages to be centered. Without this, LaTeX will put the first minipage flushed left, and then see if there's room for the next one: there is, so it will be put next to it, as desired. You might want to add a\hfill
between the two inner minipages so that the second one is flushed right and thus the page will be more balanced.If you enclose the minipage in an
\fbox
this will put a frame around it:But depending on what package you're using to set your algorithms, it might include its own resources for adding frames. The
framed
andmdframed
packages provide further options for customising frames.