[Tex/LaTex] Use \hl command to highlight a subsection title

highlightingsoul

I am trying to use the \hl command to highlight a subsection and subsubsection title.

I have tried wrapping the commands in a \mbox or between parenthesis but it doesn't seem to work. They worked with the \ref and \cite commands.

This is what I tried:

\hl{\mbox{\subsection{Section1}}}
\hl{{\subsection{Section1}}}

Best Answer

Put it inside the section command as so:

\documentclass{article}
\usepackage{color}
\usepackage{soul}
\begin{document}
\section{\hl{Something}}
\subsection{\hl{Something}}
\subsubsection{\hl{Something}}
\end{document}

enter image description here

Related Question