When using variable-size operators such as \prod, \sum, \bigcup, and \bigcap, their sizes are usually not quite predictable, which makes me pretty annoyed. I just want to make their sizes fixed throughout the document, e.g., the same vertical size as X_{1}^{1}.
I tried to renew the definition of \prod using \renewcommand and scalerel package:
\renewcommand{\prod}{{\scalerel*{\prod}{X_{1}^{1}}}}
but it throws an error:
TeX capacity exceeded, sorry [grouping levels=255]. \prod
It should be allowed to use \limits to put limits on the top and bottom of the symbol in display mode.
Any comment on this issue?
Edit:
I prepared an example demonstrating the issue:
\documentclass{article}
\usepackage{amsmath}
\usepackage{scalerel}
\newcommand{\set}[2]{\left{{#1}~\middle|~{#2}\right}}
\begin{document}
\begin{equation}
\prod_{\alpha \in A} X_{\alpha}
=
\set{x \in A\to \bigcup_{\alpha\in A} X_{\alpha}}{\forall \alpha \in A: x_{\alpha} = x(\alpha) \in X_{\alpha}}
\end{equation}
\begin{equation*}
\begin{array}{r@{~}l}
\prod_{\alpha \in A} X_{\alpha}
&=
\set{x \in A\to \bigcup_{\alpha\in A} X_{\alpha}}{\forall \alpha \in A: x_{\alpha} = x(\alpha) \in X_{\alpha}}\\
&=
\set{x \in A\to \bigcup_{\alpha\in A} X_{\alpha}}{\forall \alpha \in A: x_{\alpha} = x(\alpha) \in X_{\alpha}}
\end{array}
\end{equation*}
The above two equations show the inconsistent sizing of operators.
\newcommand{\prode}{\mathop{\scalerel*{\prod}{X_{1}^{1}}}}
\newcommand{\bigcupe}{\mathop{\scalerel*{\bigcup}{X_{1}^{1}}}}
The desired result is
\begin{equation*}
\begin{array}{r@{~}l}
\prode\limits_{\alpha \in A} X_{\alpha}
=
\set{x \in A\to \bigcupe\limits_{\alpha\in A} X_{\alpha}}{\forall \alpha \in A: x_{\alpha} = x(\alpha) \in X_{\alpha}}
\end{array}
\end{equation*}
\end{document}
In the last equation, I defined \prode and \bigcupe. But I just want to renew \prod and \bigcup. I think the error is caused by infinite loops.
Found solution:
I solved the problem by using \let found in Can I redefine a command to contain itself?
\let\oldprod\prod
\renewcommand{\prod}{\mathop{\scalerel*{\oldprod}{X_{1}^{1}}}}
\let\oldbigcup\bigcup
\renewcommand{\bigcup}{\mathop{\scalerel*{\oldbigcup}{X_{1}^{1}}}}
Thank you!




\sumand\prod] are usually not quite predictable"? FWIW, as long as you understand the difference between display math mode and inline math mode, there's absolutely nothing unpredictable about the sizes of\sumand\prod. – Mico Nov 22 '21 at 20:58\sum(and all the others) come in exactly two sizes, one for textstyle inline math and one for displaystyle. what is annoying you about that? Your redefinition is defining\prodin terms of itself so is an infinite loop, but the definition is not necessary. – David Carlisle Nov 22 '21 at 21:06\setthat way: the size of the braces and of the middle bar is way too big. – egreg Nov 22 '21 at 21:33arraywhich is intended for typesetting matrices and sets its content in inline mode if you used display math the operators would be display size in all cases and you would not be tempted to use \scalerel` – David Carlisle Nov 22 '21 at 22:12splitenvironment in place ofarray? – Hermis14 Nov 22 '21 at 22:24alignedsee my answer – David Carlisle Nov 22 '21 at 22:27