[Tex/LaTex] Color box with rounded corners

colormdframedtcolorbox

Here's my MWE:

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\colorlet{LightLavender}{Lavender!40!}

\begin{document}

\colorbox{LightLavender}{hello} world

\end{document}

It produces something like this:

enter image description here

I'm wondering if it's possible to have the box have rounded corners. Ideally a solution would work in both text and math modes because I sometimes use it in equations to help designate which terms are alike/cancel out.

Best Answer

tcolorbox, with use in math environment(s):

\documentclass[dvipsnames]{article}
\usepackage[most]{tcolorbox}
\colorlet{LightLavender}{Lavender!40!}
\tcbset{on line, 
        boxsep=4pt, left=0pt,right=0pt,top=0pt,bottom=0pt,
        colframe=white,colback=LightLavender,  
        highlight math style={enhanced}
        }

\begin{document}
\tcbox{Hello} world! $\tcbhighmath{c^2} = a^2 + b^2$
\end{document}

enter image description here

Related Question