4

I am using beamer in Latex to make a presentation. I use a block for definition like:

 \begin{block}{P1}
 \justifying
  Some text here
 \end{block}

Let us say I wish to highlight a word "Some". By highlight, I mean something like which is performed by \hl{text}. However, hl does not work in a block in latex. So what should I do, if I want to highlight text in block in beamer.

I don't want to change the color of text but I want to highlight it as shown in attached image. alert changes the text color. hl does not work in a block. So how should I do it? enter image description here

  • 3
    Hello, did you consider using the \alert{text} command which colors your text using the colors defined by the beamer theme ? – J Coulet Nov 19 '18 at 12:13
  • @JCoulet alert changes the text color, but I want too highlight it like a marker does. I have edited the question to show what exactly I want – ShiS Nov 19 '18 at 14:47
  • Did that image come out of Cool Text Highlighting in LaTeX? That's a neat one! Still, if soul's \hl does not work in your case, most of those answers will also not work, for they rely on soul. – gusbrs Nov 19 '18 at 15:10
4

You can apply the answer https://tex.stackexchange.com/a/41693/36296 to your problem:

\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}
 \begin{block}{P1}
  Some \hl{text} here
 \end{block}
\end{frame}

\end{document}

enter image description here

  • Is it possible to change the color of highlighter, which is yellow here to some other color? – ShiS Nov 19 '18 at 15:21
  • 1
    @ShiS Have a look into the documentation of the soul package texdoc.net/texmf-dist/doc/latex/soul/soul.pdf – user36296 Nov 19 '18 at 15:23
  • If possible, can you direct me to a specific page where it is given in this document – ShiS Nov 19 '18 at 15:25
  • 2
    @ShiS start with the "Short introduction and common rules" section – user36296 Nov 19 '18 at 15:27
  • 1
    @Raaja I think a quote from the answer I link to explains it pretty good: "beamer redefines nearly anything" :) – user36296 Nov 19 '18 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.