Problem with algorithm2e: \SetAlgoLined and \Indp not working properly together

Problem:

I need to get something like this:

But I'm getting this (note the vertical line):

What I have:

Here my code:

\documentclass{report}
\usepackage[linesnumbered,ruled,vlined,spanish,onelanguage]{algorithm2e}

\begin{document}
\begin{algorithm}
\caption{SomeTitle}
\label{alg:classes}
\DontPrintSemicolon
\SetAlgoLined
\footnotesize
delRef(Refutation ref)\{\;
\Indp
Lanza Hilo que borra refutaciones en esta parte\;
\If{se eliminaron refutaciones}{
synczd $\leftarrow$ false\;
actualizar size\;
}
\Indm
\}\;
\end{algorithm}
\end{document}


Documentation:

I have checked this documentation but I can't find how to draw those lines after the \Indp

As always, thank you so much for your time :)

• i think that this is the same problem as asked about in your other question. the documentation says that the margin of all algorithms depends on the sum of 'leftskip and \parindent when the package is loaded. so if you load parskip after loading algorithm2e it should take the original values for the report class. – barbara beeton Mar 18 '16 at 16:39
• makes sense, but unfortunately I get the same, even without parskip at all, check my edit – onlycparra Mar 18 '16 at 16:43
• well, loading order fixed the other problem. it looks to me like the line isn't observing the indentation request, and the documentation doesn't really help; lines are shown only in examples where they start in the leftmost possible "margin", and in your example, that's supposed to be empty. needs someone with more experience, i'm afraid. – barbara beeton Mar 18 '16 at 17:30
• Exactly, they show only nice examples. Anyway, thank you so much for helping me with the other, if you get an idea of how to solve this, please let me know. :) – onlycparra Mar 18 '16 at 17:34
• there was a new release late last year, so the author appears to be active. send him an inquiry, asking in particular how to construct a "lined" algorithm where the first "key block" is indented, and suggest that such an example would be a helpful addition to the manual. – barbara beeton Mar 18 '16 at 17:43

This answer is quite similar to This answer. The \indp and \indm are not good friends of vlined. What you could do if you wanted to indent is add a new (in this case empty) block using \SetKwBlock{DummyBlock}{}{} As in the previous answer, this would give the new dummy block a vertical line which can easily be removed with \SetAlgoNoLine. Then we set in the block \SetAlgoLined' To have the vertical line on the If.

MWE:

\documentclass{report}
\usepackage[linesnumbered,ruled,vlined,spanish,onelanguage]{algorithm2e}
\SetKwBlock{DummyBlock}{}{}
\begin{document}
\begin{algorithm}
\caption{With Dummy}
\label{alg:classes}
\DontPrintSemicolon
\SetAlgoLined
\footnotesize
delRef(Refutation ref)\{
\SetAlgoNoLine\DummyBlock{\SetAlgoLined
Lanza Hilo que borra refutaciones en esta parte\;
\If{se eliminaron refutaciones}{
synczd $\leftarrow$ false\;
actualizar size\;
}}
\}\;
\end{algorithm}
\end{document}


Notice here that the use of \; is important: it tells algorithm2e when to go down a new line. The Dummy block already feeds one line down so we can remove the \; at the end of line 1.

An even better solution would be to insert line 1 into a block:

\documentclass{report}
\usepackage[linesnumbered,ruled,vlined,spanish,onelanguage]{algorithm2e}
\SetKwBlock{delRef}{delRef(Refutation ref)\{}{\}}
\begin{document}
\begin{algorithm}
\caption{With new Block}
\label{alg:classes}
\DontPrintSemicolon
\SetAlgoLined
\footnotesize
\SetAlgoNoLine\delRef{\SetAlgoLined
Lanza Hilo que borra refutaciones en esta parte\;
\If{se eliminaron refutaciones}{
synczd $\leftarrow$ false\;
actualizar size\;
}}
\end{algorithm}
\end{document}
`

I was assuming this was not what you were looking for.

The results of both: