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?

1 Answer 1


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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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