需要注意的是下面的代码采用是\usepackage{algorithmic}
而不是\usepackage{algorithm2e}

Latex algorithmic 中添加 comment

对应的代码如下:

\STATE $sum=0$;
\FOR[comment for FOR]{$j=1$ \TO $100$}
	\IF[comment for IF]{$j\%2==1$}
		\STATE $sum=sum+i$; \COMMENT{normal comment}
	\ENDIF
\ENDFOR

相关文章: