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

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

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

This question was marked as an exact duplicate of an existing question.

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

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

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