i've tried to partially color an algorithm defined within the algorithmic-environment. To do so, i've used a combination of \vbox and \colorbox. However, the output doesn't look like desired (see attachment), since lines 2 and 4 are not indented. Here's a short code example, illustrating the problem...
Code: Select all
\documentclass[a4paper]{article}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{color}
\begin{document}
\begin{algorithm}[H]
\caption{test algorithm}
\begin{algorithmic}[1]
\IF {A = B}
\vbox{\colorbox{green}{\vbox{\IF {B = C} \STATE {C = A} \ENDIF}}}
\ENDIF
\end{algorithmic}
\end{algorithm}
\end{document}