# Adapting bigcup size to array without distortions

I want to have a cup command that adapts to the size of an array on its left (Something like left and right for the parenthesis), while keeping the same font for the letters and the thickness of the line. I tried using bigcup with the scalerel package but the line and the subscript become too wide. I report here a minimal example to show what is the result:

\documentclass{article}
\usepackage{scalerel}
\begin{document}
$\scalerel{ \bigcup\limits_{x \in X} } { \left\{ f(x) \begin{array}{| l} a \\ % first row b \\ % second row c \\ % third row d \\ % fourth row e \\ % fifth row \dots \\ % etc. z \\ % n-th row \end{array} \right\} }$
\end{document}


The size obtained is the right one, however the size of font x \in X becomes too big and the line too thick.

How can I have a similar result without these distortions?

• I've taken the liberty of augmenting your code so that it can be compiled without guessing as to which packages might be needed. Feel free to revert. – Mico Feb 25 at 11:28
• Just out of idle curiosity: Is there a reason for not employing a more conventional-looking solution, such as $\bigcup_{x\in X} \{\, f(x) \mid a,b,c,\dots,z \,\}$? – Mico Feb 25 at 11:34
• Hey, thank you for the support and the edit, I really appreciate! The reason is that a, b, c, etc. stands for very long conditions that do not fit inside a single line and are clearer if they are split into multiple lines. – Briomkez Feb 25 at 12:03
• Depending on just how many rows there are in the array, the \bigcup symbol just might become absurdly large. Is there maybe an upper limit on the permissible enlargement of the symbol? – Mico Feb 25 at 16:31
• Is it absolutely necessary to have the cup scale with the array? (Instead of just scaling by a fixed amount to make an ultra large cup to use with arrays.) – Pippip19 Feb 25 at 20:19

I think scaling with the array size you will always be up against the fact that the entire contents of the scalerel box, including the subscript, are scaled, leading to inconsistent script sizes (and probably ridiculously size cups as well).

I would suggest instead using the \scaleobj command also provided by the scalerel package, which functions similar to \scalebox from the graphicx package. While scaling up the entire cup plus subscript, you can scale the subscript alone in the other direction. To get the subscript sitting nicely under the cup after the inner scaling, a \raisebox and \smash can be added:

\documentclass{article}
\usepackage{scalerel}
\newcommand\hugecup{%
\scaleobj{2.5}{%
\bigcup\limits_{\smash{\raisebox{.25\baselineskip}{$$\scaleobj{0.425}{x\in X}$$}}}
}
}
\begin{document}
$\hugecup \left\{ f(x) \begin{array}{| l} a \\ % first row b \\ % second row c \\ % third row d \\ % fourth row e \\ % fifth row \dots \\ % etc. z \\ % n-th row \end{array} \right\}$
\end{document}


Output:

The values used are just what I thought looked sensible for a range of different (large) arrays; you may wish to tweak these.

• Very nice your answer. My best compliments. – Sebastiano Feb 25 at 21:15