I am trying to highlight a text with reference. Without references, the below works fine. Could anyone know how to handle the highlighting the text containing citation and figure references? MWE is given below. Any help is highly appreciated.
\documentclass{article}
\usepackage{xcolor}
\usepackage{soul}
\newcommand{\hlc}[2][yellow]{{%
\colorlet{foo}{#1}%
\sethlcolor{foo}\hl{#2}}%
}
\begin{document}
\hlc[pink]{hello given by mattsson et al \cite{mattsson1998physical}}
\hlc[cyan!50]{hello}
\end{document}