产品符号右上角星号的格式

产品符号右上角星号的格式

我试图在产品符号的右上角添加一颗星:

\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}

这是一张图片:

在此处输入图片描述

我怎样才能将此逻辑放入新命令中?当然,还要解决方程式中长文本的问题。

答案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}

在此处输入图片描述

相关内容