[Tex/LaTex] Make several underbrace more compact (to look nice)

macrosmath-mode

Is there a way to make underbrace symbols thinner and reduce their (vertical) distance in order to achieve this:

enter image description here

I've tried one tikz-version of thinner braces. While zooming in one can see, that those are a workaround and don't look very nice.

\documentclass[15pt, a4paper]{scrartcl}
\usepackage{amsmath,amssymb,stmaryrd}       

\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\makeatletter
\def\Underbrace#1{%
  \@ifnextchar_{\tikz@@underbrace{#1}}{\tikz@@underbrace{#1}_{}}}
\def\tikz@@underbrace#1_#2{%
  \tikz[baseline=(a.base)] {\node[inner sep=2] (a) {\(#1\)};
  \draw[line cap=round,decorate,decoration={brace,amplitude=4pt}]
    (a.south east) -- node[pos=0.5,below,inner sep=7pt] {\(\scriptstyle #2\)} (a.south west);}}

\begin{document}

\[ p(x) \cdot x - \underbrace{r \cdot \Underbrace{\eta}_{\equiv 1} \cdot x}_{\text{variable costs}} \]

\end{document}

The result so far is:

enter image description here

Thank you

Best Answer

You could use the package MnSymbol, which allows for smaller braces. In addition you could use \smash so that the smaller brace is closer to the eta symbol. Finally, you could use the package mathtools and \clap to avoid too much space after the minus sign.

Here you have the code/pictures showing the 3 successive improvements I described:

\documentclass[15pt, a4paper]{scrartcl}
\usepackage{amsmath,mathtools}       
\usepackage{MnSymbol}
\begin{document}
\begin{align*} 
p(x)\cdot x-\underbrace{r\cdot\underbrace{\eta}_{\equiv1}
\cdot x}_{\text{variable costs}}\\[5pt]
%
p(x)\cdot x-\underbrace{r\cdot\underbrace{\smash{\eta}}_{\equiv1}
\cdot x}_{\text{variable costs}}\\[5pt]
%
p(x)\cdot x-\underbrace{r\cdot\underbrace{\smash{\eta}}_{\equiv1}
\cdot x}_{\clap{\scriptsize variable costs}}
\end{align*}
\end{document}

enter image description here

You can even use a second smash to lift the larger brace:

p(x)\cdot x-\underbrace{\smash{r\cdot\underbrace{\smash{\eta}}_{\equiv1}
\cdot x}\vspace{6mm}}_{\clap{\scriptsize variable costs}}

where you can play with the "6mm" value.

enter image description here