# How should I add a bit of space below a substack in an overset?

Consider the following equations:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$\int_Y \left( \int_X f(x,y)\,dy\right)dx \overset{\substack{\text{Fubini's} \\ \text{theorem}}}{=} \int_X \left( \int_Y f(x,y)\,dx\right)dy$

$\int_Y \left( \int_X f(x,y)\,dy\right)dx \overset{\text{Fubini's theorem}}{=} \int_X \left( \int_Y f(x,y)\,dx\right)dy$

\end{document}


When compiled, these result in:

As you can see, when we substack, there isn't enough vertical space between the "theorem" line and the equals sign. (Actually, it's arguable whether there's enough space when we don't substack...)

My question: What's the idiomatic way of ensuring there's enough space there?

• Probably better to write in words outside math instead. Things like like might be fine on a blackboard, but is too ugly on paper – daleif Oct 19 '19 at 10:59
• @daleif: Other graphical alternatives could also be an answer here, I suppose; but I disagree that it's better to have far-away justifications for equality transitions, or to have to break up all of my equations with lines of text. – einpoklum Oct 19 '19 at 11:27
• I'd just write "via Fubini's theorem we now have" on the line before. This also leaves room for a reference to the theorem. Also remember \intertext . You don't see proper published books typeset like this so one should not encourage students to write like this – daleif Oct 19 '19 at 14:36
• @daleif: But the equation line actually has multiple transitions, not just one of them. Also, it would be unclear whether I meant we have the left term via the theorem, or the right one. – einpoklum Oct 19 '19 at 16:17

Use some phantom space, such as \mathstrut:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\diff}{\mathop{}\!d}

\begin{document}

$\int_Y \biggl( \int_X f(x,y)\diff y\biggr)\diff x \overset{\substack{\text{Fubini's} \\ \text{theorem}\mathstrut}}{=} \int_X \biggl( \int_Y f(x,y)\diff x\biggr)\diff y$

\end{document}