3

Is there a way to modify sum so that \sum_{...} behaves as \sum_{\substack{...}}? It is of course possible to have a command containing the underscore, but I'm interested in if the underscore can be preserved.

1
  • Are you able and willing to compile your document with LuaLaTeX?
    – Mico
    Commented Jun 12 at 19:06

1 Answer 1

5

I think something like this should work. My guess is it will break something...

\documentclass{article}
\usepackage{amsmath}

\NewCommandCopy{\origsum}{\sum}

\RenewDocumentCommand{\sum}{e{_^}}{%
  \origsum
  \IfValueT{#1}{_{\substack{#1}}}
  \IfValueT{#2}{^{#2}}
  }

\begin{document}

$abc\sum^\infty_{x\in X} def\sum_{x\in X\\ x\in X}^\infty ghi$

\[abc\sum_{x\in X}^\infty def\sum_{x\in X\\ x\in X}^\infty ghi\]

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .