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?
6 Answers
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}
-
-
1You'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).– DJPCommented Sep 27, 2011 at 18:22
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
.)
-
Works well! But not in situations like
\left( \sideset{}{^{*}}\sum_{whateverwhatever} \right)
... Commented Jul 2, 2018 at 19:39 -
Issues with brackets are addressed here: tex.stackexchange.com/questions/412575 Commented Jul 3, 2018 at 9:11
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)
\mbox{\quad or \quad}
\sum_{i=1}^{10}{\vphantom{\sum}}' 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.
-
-
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.– DJPCommented Sep 27, 2011 at 18:29
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:
\begin{equation}
\sum^{\infty}_{i=1}\phantom{}^{'}
\end{equation}
-
When I type this, I get the ' on top of the summation symbol and not to the right of it... Commented Sep 27, 2011 at 17:18
-
Yes I agree with Ant and to give more information you can read Mathmode.pdf, the very fine document of Herbert Voss. You can read this document with the command texdoc mathmode.pdf
in a terminal
About \sideset
This is a command for a very special purpose, to combine over/under limits with superscript/subscripts for the sum-symbol. For example: it is not possible to place the prime for the equation 35.4 near to the sum symbol, because it becomes an upper limit when writing without an preceeding {}.Now it is possible to write the equation \ref{eq:sideset} in a proper way with the command \verb|\sideset{}{'}| before the sum symbol:
\begin{equation}
\sideset{}{'}\sum_{n<k\atop n\ \textrm{odd}}nE_{n}
\end{equation}
-
This doesn't seem any different from what is suggested in Ant's answer.– Werner ♦Commented Mar 15, 2016 at 19:23
-
@Werner yes but I wanted to cite the document of Herbert because we can find a lot of things about Math. and I added the description of sideset. Commented Mar 16, 2016 at 19:08
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? Commented Sep 27, 2011 at 17:31
-