# Boxed equation with number

My minimum working example:

\documentclass{report}

\usepackage{amsmath}

\begin{document}

\begin{center}
\boxed{K_{k+1}=P_ka_{k+1}^T(a_{k+1}P_ka_{k+1}^T+I_N)^{-1}}
\end{center}

\end{document}


The result:

Now how can I number this equation?

-

## 2 Answers

Just replace center environment with equation. I think it looks a little better with larger parentheses.

Edit: It might be easier to read as a fraction - except that it seems to be an equation about matrices ...

\documentclass{report}

\usepackage{amsmath}

\begin{document}

$$\boxed{K_{k+1}=P_ka_{k+1}^T\left(a_{k+1}P_ka_{k+1}^T+I_N\right)^{-1}}$$

$$\boxed{K_{k+1}=\frac{P_ka_{k+1}^T}{a_{k+1}P_ka_{k+1}^T+I_N}}$$

\end{document}


-

If you want a costumized box, you can use the empheq package by Morten Høgholm:

\documentclass{article}

\usepackage{mathtools}
\usepackage[
amsmath
]{empheq}
\usepackage{xcolor}

\definecolor{shadecolor}{cmyk}{0,0,0.45,0}
\definecolor{light-blue}{cmyk}{0.25,0,0,0}
\newsavebox{\mysaveboxM}
\newsavebox{\mysaveboxT}
\newcommand*\Garybox[2][A Nice Box]{%
\sbox{\mysaveboxM}{#2}%
\sbox{\mysaveboxT}{\fcolorbox{black}{light-blue}{#1}}%
\sbox{\mysaveboxM}{%
\parbox[b][\ht\mysaveboxM+0.5\ht\mysaveboxT+0.5\dp\mysaveboxT][b]{%
\wd\mysaveboxM}{#2}%
}%
\sbox{\mysaveboxM}{%
\fcolorbox{black}{shadecolor}{%
\makebox[\linewidth-17.5em]{\usebox{\mysaveboxM}}%
}%
}%
\usebox{\mysaveboxM}%
\makebox[0pt][r]{%
\makebox[\wd\mysaveboxM][c]{%
\raisebox{\ht\mysaveboxM-0.5\ht\mysaveboxT
+0.5\dp\mysaveboxT-0.5\fboxrule}{\usebox{\mysaveboxT}}%
}%
}%
}

\begin{document}

\begin{empheq}[box = {\Garybox[A Nice Box]}]{equation}
K_{k+1}
= P_{k}a_{k+1}^{T}\left(a_{k+1}P_{k}a_{k+1}^{T}+I_{N}\right)^{-1}
\end{empheq}

\end{document}


Note

The example can be found on page 23--24 of the package manual.

-