I'm trying to define some sort of algorithmicx command to give me this:
\Statex \textbf{Local State:}
\Statex \hspace{\algorithmicindent} $v \gets []$
\Statex \hspace{\algorithmicindent} $h \gets \bot$
I've tried
\algloopdefx{LocalState}{\textbf{LocalState:}}
which results in a line number in front of Local State:, and I've tried
\algloopdefx{LocalState}{\Statex\textbf{LocalState:}}
but that results in blank line with a line number (probably because the \algloopdefx
macro puts a \State
at the beginning of the <start>
line.
Is there any way to produce the sample above without resorting putting an hspace
at the beginning of every line or similar dirty hacks?
EDIT: Adding MWE
\documentclass{article}
\usepackage{algorithm, algorithmicx, algpseudocode}
\begin{document}
\begin{algorithm}
\caption{Algorithm}
\begin{algorithmic}[1]
\Statex \textbf{Local State:}
\Statex \hspace{\algorithmicindent} Foo
\Statex \hspace{\algorithmicindent} Bar
\Statex
\Procedure{Foobar}{}
\State Numbering should start at this procedure
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{document}
Best Answer
Just define new macro, say
\StateX
as follows, that will solve the problem.