27
\documentclass{beamer} 
\usepackage{soul,color} 
\begin{document} 
\begin{frame} 
\hl{Hello World} 
\end{frame} 
\end{document}

I process this with pdflatex and I do not see the expected highlight. If I try to assign a color to overstrike same thing happens, as in

\setstcolor{red}
\st{Hello}

but \st{hello} by itself does overstrike hello in black when no color is set. Why is that and what is a work-around? Many That I tried do not work with long text.

The Soul Package Documentation, footnote 5, says something about needing a Postscript driver.

I do not have a problem using soul package outside of beamer.

1 Answer 1

39

beamer redefines nearly everything ... So we have to redefine \set@color and reset@color to its original definition before using \hl:

\documentclass{beamer}
\usepackage{soul}
\makeatletter
\let\HL\hl
\renewcommand\hl{%
  \let\set@color\beamerorig@set@color
  \let\reset@color\beamerorig@reset@color
  \HL}
\makeatother
\begin{document}
\begin{frame}   
Hello World
    
\hl{Hello World} 
\end{frame}
\end{document}

enter image description here

2
  • This works also e.g. for \ul{...}. Could you add a bit of explanation how? Thanks! Jul 9, 2018 at 21:20
  • To make it work for \ul, you would of course need to add something like \makeatletter \let\UL\ul \renewcommand\ul{\let\set@color\beamerorig@set@color \let\reset@color\beamerorig@reset@color \UL} \makeatother (so just replace \hl by \ul and \HL by \UL in the above code). Nov 18, 2022 at 21:05

You must log in to answer this question.

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