# How to type primed sum?

I need to type a "primed sum" (a summation symbol with a ' at the top right corner of the summation symbol) in latex. How can I do this?

-

The amsmath package has documentation which suggests there are 2 choices, depending on whether your sum has limits or not.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\sum\nolimits'$ %if no limits in the sum
$\sideset{}{'}\sum_{n<k,\;\text{n odd}} nE_n$ %if limits in the sum
$\sum^{'}$
\end{document}

-
Thank you very much! –  averageman Sep 27 '11 at 17:36
Btw, how did you find this information? –  averageman Sep 27 '11 at 17:39
You're welcome. The amsmath package is the gold standard for the "correct" look when typesetting math, so I checked their documentation (I have a local copy but I linked you to the user documentation). Page 3 says integrals and sums are on page 19. I went to that page and found the sum with a prime mark mentioned. I used their example to create a MWE (to catch any mistakes). –  DJP Sep 27 '11 at 18:22

I would suggest typesetting the summation (together with its limits) first, and then add the prime:

\documentclass{article}
\begin{document}
$\sum_{i=1}^{10}{}^{'}f(x)$
\end{document}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​


If the summation limits are too wide, this may cause the prime to shift away (further to the right). However, some use of \mathclap (from the mathtools package) would be able to clear this problem. You didn't mention it, so I didn't include it here. Just know that it is possible.

-
This also works very well! –  averageman Sep 27 '11 at 17:40
Yes, I love that there are people at StackExchange who can give multiple ways to solving the same problem. You can learn a lot reading answers to things you already know. –  DJP Sep 27 '11 at 18:29

The amsmath manual (p. 15) recommends using sideset:

\usepackage{amsmath}
\sideset{}{'}\sum_{\text{whatever}} x


(This works when there are limits to the sum, unlike, er, \nolimits.)

-

If you are using in text formulas, this works:

$\sum^{'}$


otherwise, to have the best of both worlds (something under or over sum symbol and prime) in display mode you can write:

$$\sum^{\infty}_{i=1}\phantom{}^{'}$$

-
When I type this, I get the ' on top of the summation symbol and not to the right of it... –  averageman Sep 27 '11 at 17:18
Fixed, check now. –  Count Zero Sep 27 '11 at 17:38

Use \nolimits to force the prime to the right of the summation: \sum\nolimits', to use it as a symbol of its own, you have to wrap it inside \mathord{}:

\def\xsum{\mathop{\sum\nolimits'}}
$\sum^{a+b}_{x+y=c} \xsum^{a+b}_{x+y=c}$

-
That helps but create another problem. I still want to write something under the summation symbol (namely, the range over which the sum is taken). If I type "\nolimits", these things go to the bottow right corner of the summation symbol. Can I have both things at the same time? –  averageman Sep 27 '11 at 17:31
@averageman: see my updated answer. –  Khaled Hosny Sep 27 '11 at 18:20