Writing comments in pseudocode, I wanted to insert comments to the right side of the line which is commented. This thread help me a lot.
The algorithm is line-numbered, however I need the comments with no number! (as a regular \comment
command do), but because the macro has the \State
command in it, it really is a normal line with number.
\algnewcommand{\LineComment}[1]{\State \(\triangleright\) #1}
Thanks in Advance!
Best Answer
The following definition of
\LineComment
provides the appropriate indentation without numbering the line:\Statex
sets an\item[]
(note that the algorithm is actually a list, so\item[]
sets an empty item and therefore has no line number), while\ALG@thistlm
contains the appropriate indentation of the current list item.