[texhax] Putting a prime on \sum

Barbara Beeton bnb at ams.org
Wed Jan 6 14:49:16 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.

just a comment here ... the *source* of
the texbook is available online.  if there
are any pdf copies online, they are in
violation of the copyright and should be
removed.  sorry.

regarding the position of the prime:

    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.

in display mode, the convention for the
upper limit (and a prime is considered
in this case to be a "limit") is above,
not to the right, of the sum.  since
you've used \sumprime in a display, the
\nolimits is required to ensure the
correct positioning.

    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.

i'll leave this for someone else.
						-- bb


More information about the texhax mailing list