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


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

  • 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. – user10274 Apr 15 '13 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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