In the declaration of the input and output data, I would like to add a comment in order to explain the kind of data.
I use: \usepackage[ruled,vlined]{algorithm2e}
My code is:
\begin{algorithm}[!ht]
\linesnumbered
\dontprintsemicolon
\KwData{$\mathbf{X}\in \mathbb{R}^{i\times j}$\tcp*{comment}\;
$\qquad\quad\:p_x,p_y,p_z \in \mathbb{N}$\tcp*{comment}\;
$\qquad\quad\:\alpha \in \mathbb{R}$\tcp*{comment}\;}
\KwResult{$\mathcal{X}\in \mathbb{R}^{i\times j\times k}$\tcp*{comment}\;}
.
.
.
\caption{algo}
\label{alg:name}
\end{algorithm}
Unfortunately, with the introduction of the comments in Kwdata the declarations are numbered.
How could I remove the number line in kwdata?
Best Answer
Here are no less than four ways to do it, maybe the second is preferable.
\KwData
lines.\KwDataXX
is defined that leaves space as ifData:
is written, but without actually writing it.aligned
environment; here, only one comment can be left to the right of thealigned
blockalign*
environment with comments in the math block itselfCode: