Is there a special formatting to add comments to code? I mean I want to show comments in pseudocode that I write 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.
Best Answer
Since you use the term
algorithmic
, I assume you're using thealgorithms
bundle (which provides thealgorithmic
package and environment). Then the\COMMENT{...}
macro typesets a comment in pseudo-code:If you're using the (more advanced)
algorithmicx
package (and use\usepackage{algpseudocode}
, which also provides analgorithmic
environment), then the\Comment{...}
macro typesets a comment in pseudo-code: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.