答案1
答案2
您可以将原始求和符号(设置为\nolimits
)包装为大运算符原子。
\documentclass{article}
\usepackage{amsmath}
\newcommand\primsum{\mathop{\sum\nolimits^{*}}}
\begin{document}
\[
\sum_{q\le Q}\frac{q}{\varphi(q)}\primsum_{\chi(\mathrm{mod}\ q)}
\]
\end{document}
编辑
按照我们贵妇芭芭拉·比顿 (Barbara Beeton) 的要求,这里有一个将和符号居中的版本,而不会因为星号而将其向左移动。
\documentclass{article}
\usepackage{mathtools}
\usepackage{suffix}
\newcommand\primsum{\mathop{\sum\nolimits^{*}}}
\WithSuffix\newcommand\primsum*{\mathop{\sum\nolimits^{\mathrlap{*}}}}
\begin{document}
\begin{align*}
\sum_{q\le Q}\frac{q}{\varphi(q)} &\primsum_{\chi(\mathrm{mod}\ q)} \\
\sum_{q\le Q}\frac{q}{\varphi(q)} &\primsum*_{\chi(\mathrm{mod}\ q)}
\end{align*}
\end{document}
答案3
困难的部分是让下标保持在求和符号的中央,而不考虑星号。但是,必须考虑星号的宽度,以避免与以下材料发生冲突。
这里的假设是仅使用下标。
\documentclass{article}
\usepackage{amsmath,mathtools}
\NewDocumentCommand{\primsum}{e{_}}{%
\mathchoice{\dprimsum{#1}}{\sum^{*}_{#1}}{\sum^{*}_{#1}}{\sum^{*}_{#1}}%
}
\NewDocumentCommand{\dprimsum}{m}{%
\IfNoValueTF{#1}{\sum^{*}}{\makedprimsum{#1}}%
}
\makeatletter
\newcommand{\makedprimsum}[1]{%
% typeset without the *
\sbox\z@{\scriptspace=0pt$\m@th\displaystyle\sum_{#1}$}%
% typeset with the * on either side
\sbox\tw@{\scriptspace=0pt$\m@th\displaystyle{}^{*}$$\m@th\displaystyle\sum\nolimits^*$}%
% print the main symbol
\mathop{{\sum}^{\mathrlap{*}}\kern-\scriptspace}_{#1}%
\ifdim\wd\z@>\wd\tw@
% we can ignore the width of *
\else
\kern0.5\dimexpr\wd\tw@-\wd\z@\relax
\fi
}
\makeatother
\begin{document}
\begin{gather*}
\primsum_{aaa}\Big| \\
\sum_{aaa}\Big| \\
\primsum_{aaaa}\Big| \\
\sum_{aaaa}\Big| \\
\primsum_{aaaaa}\Big| \\
\sum_{aaaaa}\Big| \\
\primsum_{aaaaaa}\Big| \\
\sum_{aaaaaa}\Big|
\end{gather*}
\begin{center}
$\primsum_{a}x\quad\scriptstyle\primsum_{a}x$
\end{center}
\end{document}