# Change Indentation Size in algorithmicx package

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?

-

You can renew the internal command \algorithmicindent:

\algrenewcommand\algorithmicindent{2.0em}%


Change the 2.0em to whatever you wish.

Here is a MWE extracted from the documentation and adapted:

\documentclass{article}
\usepackage{algorithmicx}
\usepackage[ruled]{algorithm}
\usepackage{algpseudocode}
\usepackage{algpascal}
\usepackage{algc}
\newcommand{\euk}{Euclid}
\algrenewcommand\algorithmicindent{2.0em}%
\begin{document}
\begin{algorithmic}[1]
\algrenewcommand{\algorithmiccomment}[1]{\hskip3em$\rightarrow$ #1}
\State $x\gets x+1$\Comment{Here is the new comment}
\end{algorithmic}
\alglanguage{pseudocode}
\begin{algorithm}[H]
\caption{\euk's algorithm}\label{euclid}
\begin{algorithmic}[1]
\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$
\EndWhile\label{euclidendwhile}
\State \Return $b$\Comment{The gcd is b}
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{document}

-
Awesome, thank you! –  Richard Mar 12 '12 at 20:11