5

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.

2

1 Answer 1

0

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.

Not the answer you're looking for? Browse other questions tagged .