1

I would like to increase the line length of the vertical line between the start and the end of the block in the following example using the algorithm2e package:

\documentclass{article}

\usepackage[linesnumbered, boxed, vlined]{algorithm2e}

\begin{document}

\begin{algorithm}
\ForEach{\begin{tabular}[t]{l} condition 1\\ condition 2\end{tabular}}{
stuff
}
\end{algorithm}

\end{document}

The output is:

output1

The output I desire is:

updated

3

This might be a special case for you conditional setup, so you'll have to treat the on a one-off basis:

enter image description here

\documentclass{article}

\usepackage[linesnumbered, boxed, vlined]{algorithm2e}

\begin{document}

\begin{algorithm}
\ForEach{\smash{\begin{tabular}[t]{@{}l@{}} condition 1\\ condition 2\end{tabular}}}{
  \rule{0pt}{1.8\baselineskip}stuff
}
\end{algorithm}

\end{document}

I've \smash-ed the conditions, removing any vertical height/depth. Then, to supplement the possible overlay with line 2, a vertical strut (zero-width rule with height) is inserted.

| improve this answer | |

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.