In the code below, my aboxed block is misaligned and also of a different size font than the normal text. Can you help me re-align the aboxed block with the above line and also correct the size of the text?
Here is the code:
\documentclass[11pt,fleqn]{book}
\usepackage{xcolor}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage[framemethod=default]{mdframed}
\usepackage{mathtools}
\usepackage[most]{tcolorbox}
\tcbset{myformula/.style={
colback=blue!15,
colframe=blue!65,
}
}
\newenvironment{spread}[1]{%
\advance\jot#1% indeed
}{%
\ignorespacesafterend
}
\makeatletter
\patchcmd{\@Aboxed}{\boxed{#1#2}}{\colorbox{red!15}{$#1#2$}}{}{}%
\makeatother
\begin{document}
Solving for $Y_{3}$, we have
\begin{spread}{5pt}
\begin{tcolorbox}[ams align,myformula]
Y_{3}&=\frac{\dfrac{1+sC_{2}R_{2}}{R_{1}R_{2}}}{\dfrac{1+sC_{2}R_{2}}{R_{2}}+\dfrac{1}{R_{1}}+sC_{3}}\nonumber\\
&=\Aboxed{\frac{1+sC_{2}R_{2}}{R_{1}+sC_{2}R_{1}R_{2}+R_{2}+sC_{3}R_{1}R_{2}}}
\end{tcolorbox}
\end{spread}
\end{document}


\Aboxedbasically stands for aligned box thus it emits an&which messes up your alignment. You might need to just use the normal\boxedhere (anamsmathconstruction). Plus in your patching, the contents is forced into text-math mode, thus the cramped size – daleif Dec 08 '15 at 21:10\Aboxedis\Aboxed{x &= y}, i.e. making a box that crosses an alignment. Use it as intended, and it works, but I'm not sure if that's what you want. – Torbjørn T. Dec 08 '15 at 21:23\colorbox? I.e. that knows about the various modes? – daleif Dec 08 '15 at 21:36Aboxedto show up the correct size? – Joe Dec 08 '15 at 21:43\displaystyle. I can add an answer. – Torbjørn T. Dec 08 '15 at 21:43