[Tex/LaTex] consistent math font size in a formula

bracesfontsizemath-mode

I have a math formula, having three underbraces, enclosing three expressions, with explanations below
each brace, explaining what that quantity is. Since these expressions, as well as their explanations, have different widths and heights, LaTeX automatically adjusts the math font sizes. I want to prevent this so that the expressions above each brace have the same size, regardless of how big the brace is extended.

How can I ensure a consistent math font size in a formula?

\documentclass{standalone}

\usepackage{tikz,amsmath}
\usetikzlibrary{positioning}


\begin{document}

\begin{tikzpicture}[>=stealth]


\node (a) at (0,0) {$\frac{\partial y}{\partial t}=\underbrace{\frac{AAA}{BB}}_{ Text 1}+
\underbrace{YYY}_{Text 2}+\underbrace{ZZZ}_{Text 3}$
};


\end{tikzpicture}

\end{document}

Best Answer

The command \underbrace assumes it is used in a math display. Maybe it's a design error, but that's the way it is.

So you have two choices: either you go to display style or typeset the underbraced fraction in text style. I also add an adjustment to bring the three braces at the same level.

Everything in display style

\documentclass{standalone}

\usepackage{tikz,amsmath}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}[>=stealth]
\node (a) at (0,0) {$\displaystyle
  \frac{\partial y}{\partial t}=
  \underbrace{\frac{y}{t}}_{\text{Text 1}}+
  \underbrace{YYY\vphantom{\frac{y}{t}}}_{\text{Text 2}}+
  \underbrace{ZZZ\vphantom{\frac{y}{t}}}_{\text{Text 3}}$
};
\end{tikzpicture}

\end{document}

enter image description here

Underbraced fraction in text style

\documentclass{standalone}

\usepackage{tikz,amsmath}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}[>=stealth]
\node (a) at (0,0) {$
  \frac{\partial y}{\partial t}=
  \underbrace{\tfrac{y}{t}}_{\text{Text 1}}+
  \underbrace{YYY\vphantom{\tfrac{y}{t}}}_{\text{Text 2}}+
  \underbrace{ZZZ\vphantom{\tfrac{y}{t}}}_{\text{Text 3}}$
};
\end{tikzpicture}

\end{document}

enter image description here

Related Question