0

enter image description here How to obtain the above right image with Tex?
If too difficult, you may also present a solution with straight lines.
If you know a better alternative, then by all means present it.
The solution will be used in situations where the usual underbrace leads to look that is either crammed or yields large white-space gaps.
The following link may be useful for a solution: https://tex.stackexchange.com/a/25513/120150

Bart
  • 397

1 Answers1

5

This just copies the definition of \underbrace adding an extra argument to hold the text and then finally using the text rather than the central part of the brace.

enter image description here

\documentclass{article}

\makeatletter
\def\zzunderbrace#1#2{\mathop{\vtop{\m@th\ialign{##\crcr
   $\hfil\displaystyle{#1}\hfil$\crcr
   \noalign{\kern3\p@\nointerlineskip}%
   \zzupbracefill{#2}\crcr\noalign{\kern3\p@}}}}\limits}

\def\zzupbracefill#1{$\m@th \setbox\z@\hbox{$\braceld$}%
  \bracelu\leaders\vrule \@height\ht\z@ \@depth\z@\hfill
  \,\lower .1em\hbox{\scriptsize#1}\,%
  \leaders\vrule \@height\ht\z@ \@depth\z@\hfill\braceru$}
\makeatletter

\begin{document}

$\zzunderbrace{A+B+C+D+E+F}{some text}$
\end{document}
David Carlisle
  • 757,742
  • Thanks. And still works when I raise/lower the text with a \raisebox. Perhaps silly question: but do the 'zz' have a particular meaning? – Bart Aug 13 '19 at 12:43
  • @Bart no, just a hidden fingerprint for me:-) if you search this site for zz you may find several of my answers:-) – David Carlisle Aug 13 '19 at 12:47
  • A few weeks later. I tried adapting your solution to mathtool's underbracket, unfortunately unsuccessful. If you/someone still reads this, could you post a solution for underbracket? Thanks in advance. N.B. I believe the '\makeatletter' in the above solution should be closed with a '\makeatother' instead of with a second '\makeatletter' – Bart Aug 27 '19 at 13:06