# How to highlight equations in mathematics?

How I can highlight equation as given below:

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

You can play around with the spacing:

\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.

• Is it possible to reduce the width and height of color spread? – new_born Feb 16 '18 at 18:11
• I am using document class asmart in which text size is smaller – new_born Feb 16 '18 at 18:12
• @new_born: You can replace the \struts with %. That should shrink things vertically. – Werner Feb 16 '18 at 18:12
• missing $error is showing. [ \colorbox{orange} { \strut (ht)^t = h^tg^tc } ] – new_born Feb 17 '18 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 Feb 17 '18 at 7:02