I'm trying to get a star in the right upper corner of a product symbol:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
First variant in equation is bad:
\begin{equation}\nonumber
\prod_{i\in I}^\star
\end{equation}
Second variant in equation is good:
\begin{equation}\nonumber
{\prod_{i\in I}}^\star
\quad\text{but not completely:\quad}
{\prod_{\text{long text under the symbol}}}^\star
\end{equation}
First variant inline is good: $\prod_{i\in I}^\star$ and the second is bas: ${\prod_{i\in I}}^\star$.
\end{document}
Here a picture:
How can I put this logic in a new command? And of course also solve the problem with the long text in equation.


\newcommand{\sprod}{\sideset{}{^*}\prod}– egreg Oct 19 '18 at 13:38\sidesetalways seems to place things in\displaystyle. It also screws up subscript placement for inline usage. – Steven B. Segletes Oct 19 '18 at 13:44