My following LaTeX file in MikTeX' TeXworks editor on my Windows 8.1 is showing the highlighted
content with different sizes when the highlighted content is inside quadratic formula but not when it's outside the quadratic formula - even though I'm using fboxsep
in the preamble of the TeX file. I expected the third display below of the quadratic formula to be of the same size as of the second display.
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{color}
\setlength{\fboxsep}{0pt}
\newcommand{\highlight}[1]{\text{\colorbox{yellow}{$#1$}}}
\begin{document}
This \(\frac{-b\pm \sqrt{b2- 4ac}}{2a}\) and \(\frac{-b\pm \sqrt{\highlight{b2- 4ac}}}{2a}\) Vs. \(\frac{-b\pm \sqrt{\colorbox{yellow}{\(b2- 4ac\)}}}{2a}\) is a test. Also a test: \( \sqrt{\colorbox{yellow}{\(b2- 4ac\)}}\) vs \(\sqrt{\highlight{b2- 4ac}}\)
\end{document}