I would like to save some horizontal space by changing indent space for package algpseudocode. How can I do that?
I think the variable I have to change is \algorithmicindent but I can't manage to do that.
\documentclass{article}
\usepackage{algorithm}% http://ctan.org/pkg/algorithm
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\usepackage{caption}
\usepackage{subcaption}
\usepackage{tikz}
\begin{document}
\section{foo}
Text
\setlength\fboxsep{0pt}
\renewcommand\algorithmicindent{.5em}
\begin{figure}[!ht]
\fbox{
\begin{subfigure}[b]{.5\linewidth}
\centering
\begin{algorithmic}[0]
\Procedure{Euclid}{$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 \textbf{return} $b$\Comment{The gcd is b}
\EndProcedure
\end{algorithmic}
\caption{Algorithm}\label{fig:alg}
\end{subfigure}%
}
\quad
\begin{subfigure}[b]{.5\linewidth}
\centering
\tikz\draw [fill=red!20] (0,0) rectangle (3,2);
\caption{tikz}\label{fig:tikz}
\end{subfigure}
\caption{Both}\label{fig:both}
\end{figure}
Text \ref{fig:alg} and \ref{fig:tikz} and \ref{fig:both}
\end{document}
* Edit *
And the result of \listfiles is:
*File List*
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
algorithm.sty 2009/08/24 v0.1 Document Style `algorithm' - floating environm
ent
float.sty 2001/11/08 v1.3d Float enhancements (AL)
ifthen.sty 2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
algpseudocode.sty
algorithmicx.sty 2005/04/27 v1.2 Algorithmicx
caption.sty 2010/01/09 v3.1m Customizing captions (AR)
caption3.sty 2010/01/14 v3.1m caption3 kernel (AR)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
subcaption.sty 2008/08/31 v1.0b Adding subcaptions (AR)
tikz.sty 2010/10/13 v2.10 (rcs-revision 1.76)
pgf.sty 2008/01/15 v2.10 (rcs-revision 1.12)
pgfrcs.sty 2010/10/25 v2.10 (rcs-revision 1.24)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2010/04/11 v2.10 (rcs-revision 1.7)
graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/message (HO)
ltxcmds.sty 2011/04/18 v1.20 LaTeX kernel commands for general use (HO)
pgfsys.sty 2010/06/30 v2.10 (rcs-revision 1.37)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2008/07/18 (rcs-revision 1.7)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
pgfcore.code.tex
pgfcomp-version-0-65.sty 2007/07/03 v2.10 (rcs-revision 1.7)
pgfcomp-version-1-18.sty 2007/07/23 v2.10 (rcs-revision 1.1)
pgffor.sty 2010/03/23 v2.10 (rcs-revision 1.18)
pgfkeys.sty
pgfkeys.code.tex
pgffor.code.tex
tikz.code.tex
supp-pdf.mkii
pdftexcmds.sty 2011/04/22 v0.16 Utilities of pdfTeX for LuaTeX (HO)
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
epstopdf-base.sty 2010/02/09 v2.5 Base part for package epstopdf
grfext.sty 2010/08/19 v1.1 Managing graphics extensions (HO)
kvdefinekeys.sty 2011/04/07 v1.3 Defining keys (HO)
kvoptions.sty 2010/12/23 v3.10 Keyval support for LaTeX options (HO)
kvsetkeys.sty 2011/04/07 v1.13 Key value parser (HO)
etexcmds.sty 2011/02/16 v1.5 Prefix for e-TeX command names (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
I'm using a mac. I have installed the latex packages using macports and those are the most recent versions available there.
\algorithmicindentsounds like a length modifiable via\setlength, it is actually a command. Therefore, you need to use\renewcommand{\algorithmicindent}{<len>}. That's just the way it is... – Werner Jan 6 '12 at 20:00algorithmicenvironment ofalgpseudocode(from thealgorithmicxpackage) typesets its contents as a list which is flush with the left margin and a default item label width of12pt. If you have a short algorithm (with fewer than 10 lines), it may seem like there's a gap between the item and the left margin. Is this the indent you're referring to that you want removed? – Werner Jan 6 '12 at 20:24