TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Please, what package can i use in latex to have the model of algorithm in the figure ? figure algorithm

share|improve this question
See tex.stackexchange.com/q/1375/5701 – N.N. Sep 29 '12 at 11:33
Have you tried algorithm2e? – Marc van Dongen Sep 29 '12 at 11:36
algorithm2e let me to write a pseudo algorithm ? because my algorithm is just a set of sentences, it is not a true algorithm.. – researcher Sep 29 '12 at 11:53
See Werner's excellent answer at Print programs with its proper syntax. – Peter Grill Sep 30 '12 at 8:35
up vote 1 down vote accepted

As has been mentioned in a comment, the algorithm2e package gives you the desired layout:



$V \longleftarrow U$\;
$S \longleftarrow \emptyset$\;
\For{$x\in X$}{
$NbSuccInS(x) \longleftarrow 0$\;
$NbPredInMin(x) \longleftarrow 0$\;
$NbPredNotInMin(x) \longleftarrow |ImPred(x)|$\;
\caption{My Algorithm}


enter image description here

share|improve this answer
i have used your code but i don't have the line that connects begin to end. have you an idea please – researcher Sep 30 '12 at 9:47
with \usepackage[ruled,vlined]{algorithm2e} i have resolved the problem – researcher Sep 30 '12 at 9:56
Please i ask if it's possible to have this same format with package algorithmic, because i should use it – researcher Sep 30 '12 at 17:29
@researcher You can do it with algorithmicx (notice the "x" at the end) which is much better, can do everything algorithmic does and they are compatible. See [this answer by Werner] to learn how to achieve the desired layout using algorithmicx. – Gonzalo Medina Sep 30 '12 at 23:17
The function names don't look very pretty. $\textit{NbSuccInS}(x) \longleftarrow 0$ looks nice and informal. – Marc van Dongen Apr 15 '13 at 13:33

Your Answer


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.