I want the size of background colore box to automatically match the "size" of formula to be displayed. What I get is a box spanning size of page. as in
\documentclass{article}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{framed}
\usepackage[createtips]{fancytooltips}
\colorlet{shadecolor}{yellow!50}
\begin{document}
\Huge
\keytip{M2} \begin{shaded}
\[
M= \begin{bmatrix}
\alpha & \beta \\
\gamma & \delta \\
\end{bmatrix}
\]
\end{shaded}
\end{document}