[Tex/LaTex] Highlight, textcolor, and boldface simultaneously

boldcolorhighlighting

I would like some portion of the text to have all three features but it's not compiling. It works two at a time but not with all three.

\hl{\textbf{foo}}
\hl{\textcolor{red}{foo}}
\textbf{\textcolor{red}{foo}}

The above three work but this doesn't

\hl{\textbf{\textcolor{red}{foo}}}

I have tried all 6 combinations.. I think.

Thanks

Best Answer

Put \hl{..} inside.

\documentclass{report}
\usepackage{color,soul}
\begin{document}
  \hl{foo}
  \hl{\textbf{foo}} 
  \textcolor{red}{foo}
  \textbf{\textcolor{red}{\hl{foo}}}
  \textcolor{red}{\textbf{\hl{foo}}}
\end{document}

enter image description here