Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Please, how can i increase spacing in an algorithm, between instruction 1 et instruction 2 ?

 \usepackage{algorithm}
 \usepackage{algorithmic}
 \begin{document}
 \begin{algorithm}[H]
 \caption{My algo}
 \begin{algorithmic}[1]
 \STATE instruction 1
 \STATE instruction 2
 \end{algorithmic}
 \end{algorithm}
 \end{document}

i'd like also to increase spacing between line and first instruction (see figure) enter image description here

please just another question: is it possible to add the option [vlined] with

\usepackage{algorithm} 
\usepackage{algorithmic} ?
share|improve this question

1 Answer 1

up vote 3 down vote accepted

set \setstretch{1.4} to any value you like

\documentclass{article}
 \usepackage{algorithm}
 \usepackage{algorithmic}
 \usepackage{setspace}
\let\Algorithm\algorithm
\renewcommand\algorithm[1][]{\Algorithm[#1]\setstretch{1.4}}

\begin{document}
 \begin{algorithm}[H]
 \caption{My algo}
 \begin{algorithmic}[1]
 \STATE instruction 1
 \STATE instruction 2
 \end{algorithmic}
 \end{algorithm}
\end{document}
share|improve this answer
    
i edit my question –  researcher Oct 1 '12 at 10:28
    
use \caption{\strut My algo} –  Herbert Oct 1 '12 at 10:36
    
thank you for answer but i'd like have a spaing between the second line and the first instruction 1: –  researcher Oct 1 '12 at 10:39
    
\STATE \strut instruction 1 The command \strutis the height of the character "(" but without a width. It can be used to get some more space, if needed –  Herbert Oct 1 '12 at 10:49
    
thank you so much , my question about vlined i post it in a new question ? –  researcher Oct 1 '12 at 10:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.