When using the algorithm2e package each line MUST end with \;. In the compiled document a semicolon also appears at the end of the line. One can avoid this if the line is written inside a macro. The classical example is:
\begin{algorithm}[H]
\SetAlgoLined
\KwData{this text}
\KwResult{how to write algorithm with \LaTeX2e }
initialization\;
\While{not at end of this document}{read current\;
\eIf{understand}{
go to next section\;
current section becomes this one\;
}{
go back to the beginning of current section\;
}
}
\caption{How to write algorithms}
\end{algorithm}
I was wondering whether is possible to have the semicolon removed from the compiled document. Is there some package option or a simple macro that can do this ?
Thanks !
Best Answer
It is stated in the document that every line should end with
\;
indeed. That being said, you can use\DontPrintSemicolon
to remove the;
in the output, however it seems that using\\
also works, without creating much difference. I guess this is related to some parameters hidden in\;
.