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

I'm using and enjoying the algorithmicx package, but would like to adjust the size of its indentations.

In the algorithms package, I could do this with \algsetup{indent=1em}, but that doesn't seem to work here.

Any thoughts?

share|improve this question
up vote 17 down vote accepted

You can renew the internal command \algorithmicindent:


Change the 2.0em to whatever you wish.

Here is a MWE extracted from the documentation and adapted:

\algrenewcommand{\algorithmiccomment}[1]{\hskip3em$\rightarrow$ #1}
\State $x\gets x+1$\Comment{Here is the new comment}
\caption{\euk's algorithm}\label{euclid}
\Procedure{\euk}{$a,b$}\Comment{The g.c.d. of a and b}
   \State $r\gets a\bmod b$
   \While{$r\not=0$}\Comment{We have the answer if r is 0}
      \State $a\gets b$
      \State $b\gets r$
      \State $r\gets a\bmod b$
   \State \Return $b$\Comment{The gcd is b}
share|improve this answer
Awesome, thank you! – Richard Mar 12 '12 at 20:11

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.