Having a \dsum like we can have a \dfrac

enter image description here

In almost all cases the third setting is preferable to the first two






$\dsumx_{k=1}^{n} 2^k = \sum_{k=1}^{n} 2^k = 2^{n+1} - 1$

$\dsuml_{k=1}^{n} 2^k = \sum_{k=1}^{n} 2^k = 2^{n+1} - 1$

\[\sum_{k=1}^{n} 2^k = \sum_{k=1}^{n} 2^k = 2^{n+1} - 1\]

The first uses the display summation which is inappropriate for inline math.

The second uses the correct summation but the limits setting will still make the expression too tall to fit in an inline setting.

The third sets the expression as a display with appropriate summation layouts just using the standard \sum.

You can use xparse's e type parameter to parse it

enter image description here

This allows you to parse both \dsum_{k=1}^{n} and \dsum^{n}_{k=1}.


  • The extra brace group to ensure that \displaystyle stays local.
  • The e{^_} provides two arguments, #1 is the one given to ^ and #2 is the one given to _ (independent of the order they are provided in). If no parameters of either type are given \IfValueT{} will not execute its parameter. \IfValueT{} is a more efficient form of \IfValueTF{}{} and is useful when you only really need to do something under one condition.





$\sum_{k=1}^{n} 2^k = \dsum_{k=1}^{n} 2^k = \dsum^{n}_{k=1} 2^k = 2^{n+1} - 1$ .


I provide \dsum and \Dsum, depending on how you want the look of the \textstyle limits.

Sum and defined dsum and Dsum:\par
$\sum_{i=1}^2 x_i\quad \dsum_{i=1}^2 x_i \quad \Dsum_{i=1}^2 x_i $
\[\sum_{i=1}^2 x_i\quad \dsum_{i=1}^2 x_i \quad \Dsum_{i=1}^2 x_i\]

enter image description here

GuM asks that I comment on why I use the star version of \DeclareMathOperator. It is to designate that, in \displaystyle, that limits are placed above and below the operator, rather than placed as super/sub-scripts. If you remove the * you will see all limits in \dsum and \Dsum revert to super/sub-script limits.