Thanks a lot for this tip kdv I'd been wondering how to get boxes around multiline equations.
Also, for alignment you can use the 'split' environment rather than 'gathered'.
\begin{equation*}
\addtolength{\fboxsep}{10pt}
\boxed{
\begin{split}
\int \frac{d^D P}{(2\pi)^D}...