# Additional separation between require and algorithm

\usepackage{algorithm}
\usepackage{algorithmic}
...
\begin{algorithm}
\caption{A good name}
\begin{algorithmic}
\REQUIRE something usefull
\STATE $i \leftarrow 1$
\end{algorithmic}
\end{algorithm}

This works fine but there is only a line above and below the algorithm and between the caption and require. Is it possible to add an additional line between require and the first statemenent because it looks confusing especially if the requirement is long?

-
Possible Duplicate: adjust spacing of algorithm float caption –  Peter Grill Nov 27 '11 at 21:22

## Line after Require:

To add a horizontal line after the Require you can use \hrule:

or a rule:

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

\begin{document}
\begin{algorithm}
\caption{A good name}
\begin{algorithmic}
\REQUIRE something useful \vspace{4pt}\hrule\vspace{5pt}
\STATE $i \leftarrow 1$
\end{algorithmic}
\end{algorithm}

\begin{algorithm}
\caption{A good name}
\begin{algorithmic}
\REQUIRE something useful \vspace{4pt}\par\rule{\linewidth}{0.5pt}\vspace{5pt}
\STATE $i \leftarrow 1$
\end{algorithmic}
\end{algorithm}
\end{document}

## Alternative Solution:

A better alternative might be to use \rule and incorporate the solution form Adjust spacing of algorithm float caption, which uses \DeclareCaptionFormat from the caption package:

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

\DeclareCaptionFormat{algorithm}{\vspace{0ex}{%
\parbox[c][1.75em][c]{\textwidth}{#1#2#3}}\par\rule{\linewidth}{0.5pt}}
\captionsetup[algorithm]{format=algorithm}

\begin{document}
\begin{algorithm}
\caption{A good name}
\begin{algorithmic}
\REQUIRE something usefull \vspace{4pt}\par\rule{\linewidth}{0.5pt}\vspace{5pt}
\STATE $i \leftarrow 1$
\end{algorithmic}
\end{algorithm}
\end{document}
-
I want an additional line between require and the first statemenet not additional space for the caption. Thanks anyways! –  joachim Nov 27 '11 at 21:33
@joachim: have updated solution to add a horizontal line. –  Peter Grill Nov 27 '11 at 21:50