2

How I can highlight equation as given below:

enter image description here

6
  • 3
    Which part do you consider the highlight in the image?
    – Werner
    Commented Feb 16, 2018 at 17:51
  • 1
    Like this?
    – Ignasi
    Commented Feb 16, 2018 at 17:52
  • 1
    colored part of the above
    – new_born
    Commented Feb 16, 2018 at 17:53
  • 1
    @ Ignasi Like above
    – new_born
    Commented Feb 16, 2018 at 17:55
  • Like here?
    – user121799
    Commented Feb 16, 2018 at 17:58

1 Answer 1

6

You can play around with the spacing:

enter image description here

\documentclass{article}

\usepackage{xcolor,amsmath}
\DeclareMathOperator{\suc}{Suc}

\begin{document}

By applying rule~2 (\texttt{apply\_rupple\_step}), the left hand side of the step-case is rippled to:
\[
  \colorbox{orange}{\strut
    case $b'$ of $0 \Rightarrow (\suc a) \mid (\suc z) \Rightarrow \suc(\colorbox{white}{$\max a \lfloor z \rfloor$})$%
  }
  {} = \max \lfloor b' \rfloor
  \colorbox{orange}{\strut
    $\suc \colorbox{white}{a}$%
  }
\]

\end{document}

Ultimately you can just use \colorbox{<color>}{<stuff>} to highlight content. I've added \strut to ensure a consistent baseline height of the resulting coloured box, as well as using text where it seemed necessary. Note that <stuff> inside a \colorbox is set in text mode.

5
  • Is it possible to reduce the width and height of color spread?
    – new_born
    Commented Feb 16, 2018 at 18:11
  • I am using document class asmart in which text size is smaller
    – new_born
    Commented Feb 16, 2018 at 18:12
  • @new_born: You can replace the \struts with %. That should shrink things vertically.
    – Werner
    Commented Feb 16, 2018 at 18:12
  • missing $ error is showing. [ \colorbox{orange} { \strut (ht)^t = h^tg^tc } ]
    – new_born
    Commented Feb 17, 2018 at 6:37
  • @new_born: As mentioned at the end of the answer, <stuff> inside \colorbox is set in text mode. If you want to use math - like your use of superscripts - you need to surround it with $s.
    – Werner
    Commented Feb 17, 2018 at 7:02

You must log in to answer this question.

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