- I have picture below I want my paper look like that.
- I have sample code below but the highlight doesnt fill up to the left margin and there is whitespace in between.
- I have been trying very long but keep failing.
- Point 2 is not addressed in this post How can I colourfuly highlight some lines of an algorithm using algorithm2e? SO THIS IS NOT A DUPLICATE
\documentclass{article}
\usepackage[ruled]{algorithm2e} % http://www.ctan.org/pkg/algorithm2e
\usepackage{xcolor} % http://www.ctan.org/tex-archive/macros/latex/contrib/xcolor
\def\HiLi{\leavevmode\rlap{\hbox to \hsize{\color{yellow!50}\leaders\hrule height .8\baselineskip depth .5ex\hfill}}}
\begin{document}
\begin{algorithm}[h]
\caption{Evolutionary algorithm}
initialize population \;
\HiLi\For( \emph{Evolutionary loop}){$g := 1$ to $G_{max}$}
{
\HiLi do things \;
evolve population \;
}
celebrate \;
\end{algorithm}
\end{document}
The code gives me the image below. How can i fill up the highlight to the left margin like in the 1st picture and remove the whitespace between highlights ?