You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used \underbrace on a matrix and found that the generous white
space at both sides of the matrix results in a brace too wide.
Therefore, I extended the original code to arrive at \scaledunderbrace, which allows to scale the relative width of
the brace with the help of an optional argument.
The implementation is naive, but variable-width under- (or
over-) thingies could be interesting for other users, too.
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{mathtools}
\makeatletter\newcommand*{\scaledunderbrace}[2][1.0]
{\setbox0=\hbox{$\m@th\displaystyle{#2}$}%\dimen0=\wd0
\dimen1=-#1\dimen0
\advance\dimen1 by\dimen0
\mathop{\vtop{\m@th\ialign{##\crcr$\hfil\box0\hfil$\crcr\noalign{\kern.7\fontdimen5\textfont2\nointerlineskip}%\kern.5\dimen1\hbox to #1\dimen0{\upbracefill}\crcr\noalign{\kern.5\fontdimen5\textfont2}}}}\limits}
\makeatother\begin{document}
Default \texttt{\string\underbrace} (from package \textsf{mathtools})
\begin{equation*}
\underbrace{\begin{pmatrix}0 & I \\ -I & 0\end{pmatrix}}_{\Sigma :=}\end{equation*}
New \texttt{\string\scaledunderbrace}
\begin{align*}
\scaledunderbrace[.667]{\begin{pmatrix}0 & I \\ -I & 0\end{pmatrix}}_{\Sigma :=} &&\scaledunderbrace{\begin{pmatrix}0 & I \\ -I & 0\end{pmatrix}}_{\Sigma :=} &&\scaledunderbrace[1.1]{\begin{pmatrix}0 & I \\ -I & 0\end{pmatrix}}_{\Sigma :=}\end{align*}
\end{document}
The text was updated successfully, but these errors were encountered:
I used
\underbrace
on a matrix and found that the generous whitespace at both sides of the matrix results in a brace too wide.
Therefore, I extended the original code to arrive at
\scaledunderbrace
, which allows to scale the relative width ofthe brace with the help of an optional argument.
The implementation is naive, but variable-width under- (or
over-) thingies could be interesting for other users, too.
The text was updated successfully, but these errors were encountered: