[texhax] Putting a prime on \sum
Michael Barr
barr at math.mcgill.ca
Wed Jan 6 14:03:57 CET 2010
I just got to this question so I don't know what the original was called.
Knuth raised this very question in The TeXBook and answered it (Exercise
18.44). The first answer was to use \mathop{{\sum}'}_... but that would
have the slightly unfortunate side-effect of centering the subscript under
the primed \sum, rather than under the \sum. He then goes on the discuss
a more complicated solution, which would not have that side-effect, but
since the TeXBook is available online, I won't copy it.
The following seemed to work too:
\def\sumprime_#1{\mathop{\sum_{#1}}\nolimits'} $$\s$$
$$\sumprime_{x\in A}$$
Perhaps someone well-versed in TeXarcana can explain why in Knuth's
wolution, the prime comes out to the right while in mine, if you eliminate
the \nolimits (that is, no limit switch), it comes out atop the
summation. Be that as it may, it appeared to work for me, without the
unfortunate displacement of the subscript. It has the disadvantage of
requiring a subscript. I have also not considered the problem of having
also a superscript. I guess you could use \@ifnextchar, with some
complication, to look ahead.
Michael Barr
More information about the texhax
mailing list