1

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}
  • What's the purpose of the tikzpicture? – egreg Dec 18 '13 at 23:42
  • probably nothing. Just because the inconsistency in font size that I encountered was inside a tikz node. In the actual code, of course, there are tikz drawings that I omitted since they are irrelevant. – eli Dec 18 '13 at 23:43
  • 1
    The fraction inside \underbrace is typeset as if it was under \displaystyle. Use \dfrac for the other fraction. – egreg Dec 18 '13 at 23:47
  • Thanks, problem solved! However, it's still good to know how you can change math font size inside a single formula repeatedly manually. – eli Dec 18 '13 at 23:57
5

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

  • The use of \vphantom{} was nice. In the second code, the proposed text style solution, if you replace YYY with yyy you see that the size of y in $\frac{y}{t}$ and yyy are different. This is not the case for the first solution. – eli Jan 6 '14 at 0:35
  • @eli That's what's supposed to happen: in a \tfrac the numerator and denominators are typeset in subscript size. – egreg Jan 6 '14 at 0:46
1

If TikZ is meaningless, it is an ordinary formula. Hence probably simply:

\documentclass{article}

\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}+
\[
\frac{\partial y}{\partial t}=\underbrace{\frac{AAA}{BB}}_{ \text{Text 1}}+
%\underbrace{YYY}_{Text 2}+\underbrace{ZZZ}_{Text 3}$
\underbrace{YYY}_{\text{Text 2}}+\underbrace{ZZZ}_{\text{Text 3}};
\]
%};


%\end{tikzpicture}

\end{document}

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.