This question is a generalization of
How to nicely lay out a parentheses-enclosed overbrace/underbrace?
Now we have parentheses with some parts of the content, of different heights, having an underbrace. Example:
\documentclass{minimal}
\begin{document}
$\left( 1 \cdot 2 \cdot \frac{3}{4} \cdot 5^2 \right)$
$\left( \underbrace{1}_{x} \cdot 2 \cdot \underbrace{\frac{3}{4}}_{\int y} \cdot 5^2 \right)$
\end{document}
produces:
which is very ugly. How can I make the underbraces ignored for the purposes of sizing the parentheses, but count for the space to the next line of text? The solution must allow me to write something like
$\magicparens{%
underbrace{1}_{x} \cdot 2 \cdot \underbrace{\frac{3}{4}}_{\int y} \cdot 5^2%
}$
and have it work. No manually specifying any sizes or lengths.
Bonus points for a second version which make all the underbraces vertically aligned.


\leftand\rightfor the parentheses”… Do you have some special reason for requiring auto-resizing parentheses? – GuM Oct 03 '17 at 17:51\[ \biggl(1 \cdot 2 \cdot \frac{3}{4} \cdot 5^2 \biggr) \biggl(\underbrace{1}_{x} \cdot 2 \cdot \underbrace{\frac{3}{4}}_{\int y} \cdot 5^2 \biggr) \]– Zarko Oct 03 '17 at 18:13\tfracis much too small when the rest of formulae is in\displaystyle. But maybe\mfracwould look fine. – Bernard Oct 03 '17 at 19:36\fracjust to create some height variation for the example. – einpoklum Oct 03 '17 at 21:47