I would like to ask that how can we use Latex delimiter \(\) instead of $…$ inside parameter of \hl{} highlight from soul package?
\documentclass[a5paper,12pt]{beamer}
\usepackage{soul,xcolor}
\sethlcolor{yellow}
\usepackage{amsmath}
\makeatletter
\let\HL\hl
\renewcommand\hl{%
\let\set@color\beamerorig@set@color
\let\reset@color\beamerorig@reset@color
\HL}
\makeatother
\begin{document}
\hl{This is a function $f^{3}$.} % this is okay
% \hl{This is a function (f^{3}).} % but this is not
\end{document}
\(...\)does not work." – Ulrike Fischer Dec 09 '21 at 18:53