4

I want to highlight some text using package soul. However, I fail setting the color transparency, which is normally possible by writing !trans_value after the color. As soon as I add this transparency value to the color:

  \begingroup
  \sethlcolor{red!30}%
  \hl{some text here}%
  \endgroup

It only colors the white spaces between the words. How can I fix this?

2 Answers 2

7

A workaround:

\documentclass{article}
\usepackage{xcolor}
\usepackage{soul}

\colorlet{soulred}{red!30}

\begin{document}

\begingroup
  \sethlcolor{soulred}%
  \hl{some text here}%
\endgroup

\end{document}

Result

BTW, the part after ! in xcolor's color expressions has nothing to do with transparency. It means rather mixing with another color: 30 % red + 70 % white.

5
\documentclass{article}
\usepackage{xcolor,soul}
\begin{document}
\colorlet{usercolorname}{red!30}
\sethlcolor{usercolorname}
\hl{some text here}
\end{document}

enter image description here

You must log in to answer this question.

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