[Tex/LaTex] Effectively, how to do “Underbrace” under two “Underbraces”

horizontal alignmentmath-modetikz-pgfunderbrace

Goal: I am trying to find a way to write an equation for:

enter image description here

However, I fail, or at least so far could not find a way, to add the last layer in the bottom for "magnetic flux" using \underbrace.

Here is what I have so far,

$$
 \overbrace{ \underbrace{S^1_A \times  S^1_B}_{E} \times  \underbrace{S^1_C \times  \mathbb{R}}_{\mathbb{CP}^{N-1}}
 }^{\text{ABCDEFG}} 
$$

and my output is this:

enter image description here

Could you find a better way to do it? Effectively, how to do "Underbrace" under two "Underbraces"? Or maybe we can also try to use TikZ instead? (i.e. I don't mind to try other methods)

p.s. Another thing is that, in my case, the size of ABCDEFG is smaller than the S^1_A \times S^1_B \times S^1_C \times \mathbb{R} — is there a way to adjust the size of ABCDEFG and others?

Thank you for your help!!!

Best Answer

\documentclass{article}
\usepackage{mathtools,amssymb}
\begin{document}

\begin{gather*}
\overbrace{\underbrace{S^1_A \times S^1_B}_E\times
           \underbrace{S^1_C\times\mathbb{R}}_{\mathbb{CP}^{N-1}}}^{\text{ABCDEFG}} \\[-\normalbaselineskip]
\underbrace{\kern5em}_{\text{magnetic flux}}
\end{gather*}

\end{document}

enter image description here

Related Question