0

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}}}

1 Answer 1

2

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

8
  • What if I want the color to be green instead of yellow?
    – Wallflower
    Jul 1, 2021 at 8:05
  • 1
    @Wallflower That's a different question which already has answers, usually stemming around defining a custom macro along the lines of either tex.stackexchange.com/questions/260566/… or tex.stackexchange.com/questions/352956/…
    – oliversm
    Jul 1, 2021 at 8:10
  • Thank you for the link!
    – Wallflower
    Jul 1, 2021 at 8:47
  • 1
    Hey Oliver. This trick didn't work for me. Is it possible that because I am using the Elsevier's cas-dc class file?
    – WhoCares
    Apr 18, 2022 at 12:13
  • 1
    @WhoCares the document classes beyond the standard few are a bit of a Wild West.
    – oliversm
    Apr 18, 2022 at 12:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .