2

This question already has an answer here:

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:

enter image description here

How can I put this logic in a new command? And of course also solve the problem with the long text in equation.

marked as duplicate by egreg amsmath Oct 19 '18 at 13:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • See also this question. – Karlo Oct 19 '18 at 13:34
  • \newcommand{\sprod}{\sideset{}{^*}\prod} – egreg Oct 19 '18 at 13:38
  • @egreg ...except that \sideset always seems to place things in \displaystyle. It also screws up subscript placement for inline usage. – Steven B. Segletes Oct 19 '18 at 13:44
1
\documentclass{article}    
\usepackage{mathtools}
\newcommand\prodstar{\mathop{{\prod\nolimits^{\mathrlap{\star}}}}}
\begin{document}
Prodstar in equation is good:
\begin{equation}\nonumber
\prodstar_{i\in I}
\qquad\text{smaller styles:}\qquad
\scriptstyle \prodstar_{i\in I}\qquad
\scriptscriptstyle \prodstar_{i\in I}
\end{equation}
Prodstar is still good:
\begin{equation}\nonumber
\prodstar_{i\in I}
\quad\text{yes, completely:\quad}
\prodstar_{\text{long text under the symbol}}
\end{equation}
Prodstar inline is good: $\prodstar_{i\in I}$ and in the second case: $\prodstar_{i\in I}$.
\end{document}

enter image description here

  • thank you for the exhaustive answer and some humour that makes it even better – PeptideChain Oct 19 '18 at 16:57
  • @PeptideChain The only issue that can arise is if you intend to use it with superscripts. In displaystyle, the limit will sit a little high (that can be fixed by \smashing the \mathrlap), in the smaller math styles, the superscript will clash with the star, unless space is manually added. – Steven B. Segletes Oct 19 '18 at 16:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.