0

I cannot highlight an equation by \hl from the soul package!

Is there no way to highlight an equation?

4
  • Please tell us more about the equation/formula you wish to highlight. In particular, is it an inline equation or a displayed equation?
    – Mico
    Commented Jan 24 at 1:28
  • any equation that can be inserted in \begin{equation}.......\end{equation} Commented Jan 24 at 4:38
  • 1
    @InzoBabaria, things will be easier for all of us if you provide code. Even with a „simple“ environment like yours you can mess up. Kindly follow these steps: tex.meta.stackexchange.com/questions/228/… . Thank you
    – MS-SPO
    Commented Jan 24 at 4:43
  • See eg tex.stackexchange.com/a/533379/2388 Commented Jan 24 at 7:48

1 Answer 1

3

Try this:

enter image description here

Code (use the package empheq):

\documentclass{article} % or some other suitable document class
\usepackage{empheq,xcolor}
\newcommand*\mybox[1]{%
    \colorbox{cyan!30}{\hspace{1em}#1\hspace{1em}}}
\begin{document}
    \begin{empheq}[box=\mybox]{align}
        ax^2+bx+c=0\\
        x=\frac{-b \pm \sqrt{b^2-4ac}}{2a}
    \end{empheq}
    
    \begin{empheq}[box=\mybox]{align*}
        ax^2+bx+c=0\\
        x=\frac{-b \pm \sqrt{b^2-4ac}}{2a}
    \end{empheq}
\end{document}

You must log in to answer this question.

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