Indentation in latex algorithmic

latex

Solution

Try this instead:

\STATE\hspace{\algorithmicindent} do something
\STATE\hspace{\algorithmicindent} do another thing

It should work better because it uses the current indent value to indent.

Edit: Using Charles's suggestion, you could define a new command, `\INDSTATE`:

\newcommand{\INDSTATE}[1][1]{\STATE\hspace{#1\algorithmicindent}}

and then use that when you want indentation. By default, `\INDSTATE` indents by one level, but you can change it:

\INDSTATE do something % What you want
\INDSTATE[2] do something % Indent by twice the amount

Problem

How is it possible to indent lines in an algorithm (algorithmic) in latex? I would like to be able to write the following: ``` \begin{algorithm}[H] \caption{My Awesome Program} \label{awesome-algorithm} \begin{algorithmic}[1] \FOR { $i=0$ to $logn$ } \STATE Step A: % would like the indent the next lines... \STATE do something \STATE do another thing \STATE Step B \ENDFOR \end{algorithmic} \end{algorithm} ``` How is it possible to indent those lines? I've been trying to find the answer by googling without success. I hope you guys can help me. Thanks. I'm currently using the following for indentation: ``` \STATE \ \ \ \ do something ``` which seems plain wrong. But works.

Original source