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.

Possible Duplicate:
Linebreak in Package algorithm2e

Is it somehow possible to generate vertical alines that connect the start and end of a block in algpseudocode (as provided by the algorithmicx package) or any other algorithm environment? E.g. something like this:

for ... do
|    for ... do
|    |    if ... then
|    |        ...
|    |    end if
|    end for
end for

Thin and possibly grey lines where the | are would be appreciated. It would make rather long and deeply nested code more readable. (I know splitting the code into several functions could help sometimes, but still this would be nice to have.)

I don't know how to deal with line breaks in pseudocode that would overlap with these lines. I guess it would be best if they would interrupt the lines, such as this:

for ... do
|    for ... do
|    |    a very long line (e.g. introduced by a comment) that
continues here and interrupts the lines on the left
|    end for
end for

But this is a minor detail, of course.

share|improve this question
3  
Almost similar to tex.stackexchange.com/questions/37181/… –  Harish Kumar Apr 11 '12 at 11:26
    
This question is very similar to Is it possible to have connecting loop lines (like algorithm2e) in algorithmic?. Please take a look at it as the information there might help you. If so, that's great, and we'll probably close this question as a duplicate just to keep the place tidy and to help people find answers quickly. If not, please edit your question here to explain why so that people can better focus their attention to help you. –  Werner Nov 11 '12 at 3:28
add comment

marked as duplicate by Joseph Wright Dec 1 '12 at 22:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

The algorithm2e package can do this. However, it requires (as far as I can tell) that you use their floating environment.

See http://ctan.unixbrain.com/macros/latex/contrib/algorithm2e/algorithm2e.pdf for details and examples.

share|improve this answer
add comment

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