TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When using comments in the algorithmicx package like in the code below, the comment is aligned at the right. How do I change that? I'd like the comment to appear next to the code, separated by a tab.

\State $var$ \Comment{comment about var}
share|improve this question
up vote 5 down vote accepted

You can re-define how the comment is formatted, perhaps something like this:

\renewcommand{\algorithmiccomment}[1]{\hskip2em$\triangleright$ #1}
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.