Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

enter image description here

Now how can I number this equation?

share|improve this question

2 Answers 2

up vote 14 down vote accepted

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}

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

\begin{equation}
\boxed{K_{k+1}=\frac{P_ka_{k+1}^T}{a_{k+1}P_ka_{k+1}^T+I_N}}
\end{equation}

\end{document}

enter image description here

share|improve this answer

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}

output

Note

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.