# Very short overbrace

Is there a good-looking way to produce an overbrace for a single letter? The overbrace produced by

$\overbrace{P}^{some annotation}$


is too wide for the single letter P. Note that the focus really lies upon the annotation, the reader has already seen the unannotated term and now gets to see an example which formal annotations are inserted where in the term.

Here is a simplified example from my sources. The overbraced P does not look good.

\documentclass{minimal}

\usepackage{proof}
\usepackage{mathtools}

\newcommand{\hoare}{\{#1\}\;#2\;\{#3\}}
\newcommand{\ctxt}{C:\langle#1,#2,#3\rangle}

\begin{document}

\begin{equation*}
\infer[Rule]
{\underbrace{\hoare P c Q}_{\ctxt{i}{x \cdot \mathrm{xs}}{o_2}}}
{ \overbrace{\hoare{P'}{c'}{Q'}}^{\ctxt{i+1}{\mathrm{xs}}{o_1}}
& R \implies \overbrace{P}^{\mathclap{\ctxt{o_1}{\text{a bit longer}}{o_2}}}
}
\end{equation*}

\end{document}

• If you make it shorter, it will not stand out enough. If you really need to annotate a single letter, do it after the equation: $P = U I ,$ where $P$ denoted the effective power.
– yo'
Sep 21 '15 at 7:10
• (sorry for a typo, it should of course be denotes)
– yo'
Sep 21 '15 at 7:37
• For very short items, \overbracket from mathtools generally looks better. It has two optional arguments; linewidth and bracket height. Sep 21 '15 at 7:43
• Putting the annotation after the equation won't work here, as the position is relevant. The annotations really are part of the term (a logical formula). Sep 21 '15 at 10:04
• overbracket looks strange if the annotation is much longer then the bracket. I think it is missing a tip, like the middle element of an overbrace. Sep 21 '15 at 10:07

\aoverbrace[U]{formula}^{brace-formula}

Where necessary, I also used \mathclap from mathtools so that the annotation does not introduce to much whitespace into the rest of the formula.
\newcommand{\shortoverbrace}{\aoverbrace[U]{#1}^{\mathclap{#2}}}%