2

Following this question, I used the solution in my document as follows but as you can see in the output, the algorithms do not start and end at the same levels. Is there a way I can make the algorithms start and end at the same level?

EDIT - It is OK if the algorithms don't end at the same level, I would just like them to start at the same level. If solutions exist for both scenarios, it would be great if you post them.

\documentclass{article}
\usepackage{algorithm}
\usepackage{algorithmic}

\begin{document}

\begin{minipage}{0.45\textwidth}
\begin{algorithm}[H]
\caption{BLAH}
\begin{algorithmic}[1]
\REQUIRE $Input$
\ENSURE $A$.
\STATE
\STATE 
\STATE Set $AA$
\STATE 
\STATE
\STATE
\STATE
\STATE
\STATE
\end{algorithmic}
\end{algorithm}
\end{minipage}
\hfill
\begin{minipage}{0.45\textwidth}
\begin{algorithm}[H]
\caption{BLAH}
\begin{algorithmic}[1]
\REQUIRE $Input$
\STATE Compute $B$
\end{algorithmic}
\end{algorithm}
\end{minipage}

\end{document}

Output

  • 'H is not a float specifier out of the box. Why do you even have a float inside of a minipage? what is the purpose of this? – daleif Nov 19 '18 at 15:45
  • The algorithms were being used in a document without minipage initially. Now, I decided to use minipage to reduce document length. Following your comment, if I remove H from the code above, I receive errors. Also, are you just wondering my usage of H or did you just suggest a possible solution? Either way, not using H didn't help. – Papa Delta Nov 19 '18 at 15:50

2 Answers2

3

The minipages have a t (top) option, so in both minipages

\begin{minipage}[t]{0.45\textwidth} 

produce this:

mwe

Fran
  • 80,769
0

If I want to end the algorithms at the same level I can use the solution posted here to add blank lines in the smaller algorithm i.e adding \item[] to the smaller algorithm will do