Is there any way to display math expressions with a background color (highlight) using AMS-Tex or AMS-LaTeX . For example, using AMS-TeX/LaTeX, we can display a math expression in font color using \color[colorName]{mathExpression}
.
UPDATE Using the answer from @werner, I tried $\frac{\colorbox{yellow}{$a-b$}}{c-d}$
to highlight only the numerator but the size of a-b
is much larger than the demominator c-d
even with the setting of \setlength{\fboxsep}{1pt}
-in the preamble - as shown below. How can I get the desired output shown below:
xcolor
, you can use\colorbox{<color>}{$<math content>$}
. This uses a regular "framed box", so you can set the values of\fboxsep
to decrease the border.