4

The following code results in the following output.

\documentclass{standalone}
\usepackage{amsmath}
\begin{document}
${\underbrace{\left(a^k\right)}_{\text{very long text}}}^{s}$
\end{document}

enter image description here

How can I get the exponent s close to the bracket?

1
  • use mathtools and wrap the \text{...} in \mathclap – daleif Jan 6 '15 at 10:26
5

You can use \mathrlap from mathtools to make the exponent zero width:

\documentclass{standalone}
\usepackage{amsmath,mathtools}
\begin{document}

$\underbrace{(a^k)^{\mathrlap{s}}}_{\text{very long text}}$

\end{document}

Avoid \left( and \right) in that context. If you've read that you should always use them, then forget it: it's not true. If your editor adds them automatically, change this setting as soon as possible.

enter image description here

As hawk eye barbara beeton remarks, there is a small asymmetry, which may or may not be desirable.

In order to get perfect symmetry in the underbrace, we need to remove the additional space that TeX inserts when a sub/superscript is added. I'll show both version one above the other, so you can decide what'e better.

\documentclass{article}
\usepackage{amsmath,mathtools}
\begin{document}

$\underbrace{(a^k)^{\mathrlap{s}}\kern-\scriptspace}_{\text{very long text}}$

$\underbrace{(a^k)^{\mathrlap{s}}}_{\text{very long text}}$

\end{document}

The \scriptspace parameter is 0.5pt, which is small but noticeable indeed.

enter image description here

2
  • it's probably an illusion, but the brace appears to be positioned just a little to the right, not quite centered. – barbara beeton Jan 6 '15 at 15:22
  • @barbarabeeton You always surprise me. ;-) There's \scriptspace, of course! – egreg Jan 6 '15 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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