I am a lazy student who writes a lecture in LaTeX.

As I need many \sum\limits and \int\limits I tried to overwrite the command \sum\limits so I just have to write \sum. So I wrote


Now I get a lot of problems like

! TeX capacity exceeded, sorry [input stack size=5000].
\sum ->\sum
l.579 $$\sum
_{i=1}^m K_i B(t,t_i) + N B(t,T)$$"

Is there a possibility to short the \sum\limits command and get no problems in a way I tried?

Or should I define a completely new command like


Will this way work?

  • See if \def{\sum}{\sum\limits} works. But a new command should certainly work. – Mike Renfro Nov 19 '14 at 14:55
  • 4
    Circular definition. But please explain why you need \sum\limits all the time. There are good reasons not to use it. – daleif Nov 19 '14 at 15:00
  • 1
    When you \def\sum{\sum\limits}, you tell TeX that \sum expands to the two tokens \sum and \limits. This \sum then expands to \sum\limits, expanding to \sum\sum\limits, expanding to \sum\sum\sum\limits, ad nauseam. – Sean Allred Nov 19 '14 at 15:06
  • 3
    @MikeRenfro \def{ is a syntax error – David Carlisle Nov 19 '14 at 15:06
  • @DavidCarlisle Would \edef work here? Not saying this general concept is good practice, but would it work? – Sean Allred Nov 19 '14 at 15:07

This is as easy as




A summation $\sum_{i=1}^{n} a_{n}$ and an integral
\int_{0}^{1} x^2\,dx
also inline: $\int_{0}^{1} x^2\,dx$


However the result is typographically terrible. There is a very good reason why limits in inline formulas are typeset on the side of the symbol and integrals have the limits beside them.

If all of your integrals need limits underneath (in display mode), then use


but, please, for your readers' sake, don't set all limits above and below in inline formulas.

Here's a screenshot showing the horrible appearance.

enter image description here

Of course a definition such as


will horribly fail, as you discovered, because TeX will continue to substitute \sum with \sum\limits until exhausting its memory capacity.

You find a related trick in Is there any global settings to add \limits to evey \sum, \bigcup etc?

where an example of why using limits in inline formulas is bad, which I include here as well.


  • \slimits@ -- neat, didn't know about this one :) Also, I wouldn't call the screenshot 'horrible' -- even I'm not attuned enough to math texts to find this so repugnant. There are good reasons, but your screenshot doesn't show them. Adding a lines above and below your sum will demonstrate this better :) – Sean Allred Nov 19 '14 at 15:10
  • Would \newcounter\sumcounter\def\sum{\ifnum\sumcounter>0\sum\limits\stepcounter{\sumcounter}\else\relax\fi} or something work? – 1010011010 Nov 19 '14 at 15:14
  • @1010011010 What should that be supposed to do? – egreg Nov 19 '14 at 15:16
  • Is the question a dupe of the one you link to? – Joseph Wright Nov 19 '14 at 15:20
  • 2
    @1010011010 Absurd. – egreg Nov 19 '14 at 15:23

You can use \edef\sum in this way:

A summation $\sum_{i=1}^{n} a_{n}$ ...
  • Not at all recommended if amsmath is loaded. – egreg Nov 19 '14 at 18:13

When you \def\sum{\sum\limits}, you tell TeX that \sum expands to the two tokens \sum and \limits. This \sum then expands to \sum\limits, expanding to \sum\sum\limits, expanding to \sum\sum\sum\limits, ad nauseam.

Using the different name will resolve the issue, but I encourage you to not do this. There are many instances where such a shortcut will break in wholly unexpected ways (since you are using \limits without any real knowledge of what it does).


As \int is defined \intop\nolimits, you have at least two natural ways of obtaining limits placed where you want:









enter image description here

(I have no tools to crop the picture now).

  • even if you do have tools to crop, it becomes easier if you have \thispagestyle{empty}. – barbara beeton Nov 19 '14 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.