# [Tex/LaTex] How to add a comment to pseudocode in LaTeX

this is code // this is comment part (the part that I want)


Edit: To be more clear, what I mean is in "algorithmic" syntax I write some pseudo code. However, I am not sure if there is a standard comment used in that context.

Since you use the term algorithmic, I assume you're using the algorithms bundle (which provides the algorithmic package and environment). Then the \COMMENT{...} macro typesets a comment in pseudo-code:

\documentclass{article}
\usepackage{algorithmic}% http://ctan.org/pkg/algorithms
\begin{document}
\begin{algorithmic}[1]
\STATE this is code \COMMENT{this is a comment}
\end{algorithmic}
\end{document}​


If you're using the (more advanced) algorithmicx package (and use \usepackage{algpseudocode}, which also provides an algorithmic environment), then the \Comment{...} macro typesets a comment in pseudo-code:

\documentclass{article}
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\begin{document}
\begin{algorithmic}[1]
\State this is code \Comment{this is a comment}
\end{algorithmic}
\end{document}​


In both these environments/packages, you are able to modify the formatting (or typesetting) of the comment. Alternatively, you could create your own \comment{...} macro as well, based on the existing commenting macros.