TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the \mathop command meant to be, officially?

I see it used in indexes of sums and limits to improve the spacing, e.g.

\sum_{n\mathop = 1}^\infty a_n

Why doesn't it just format it like this automatically? It looks so much better.

share|improve this question
You (or they) are doing it wrong... that is, the use of \mathop. Indices are set with different spacing around the relations/operators. You can use n\,=\,1 to get the same effect. – Werner Apr 16 '14 at 5:57
@Werner Why exactly is it wrong? Is this using \mathop or trying to change the spacing at all? – bwv869 Apr 16 '14 at 5:59
\mathop is meant to temporarily define a math operator (or function, say, like sup or inf or argmax/argmin), and here = is a relation. So, while the spacing better spacing may be achieved, the usage is technically incorrect. – Werner Apr 16 '14 at 6:05
up vote 9 down vote accepted

TeX sets \thickmuskip between the relational operator and most other math atoms in styles \displaystyle and \textstyle, but no space in script styles \scriptstyle and \scriptscriptstyle.

A \thinspace is also inserted in script styles between an operator atom (\mathop) and an ordinary atom (\mathord). Thus

\sum_{n \mathop{=} 1}

gets you the desired spacing:

mathop =


  • The relational symbol becomes an operator, a violation of a clean markup.
  • The spacing is too small in \displaystyle and \textstyle.
  • \mathop vertically centers the symbol, e.g.:

    \sum_{n \mathop{.} 1}


    The dot is moved to the math axis and becomes a "\cdot".

    This is not a problem for the equals sign, because this is usually already centered around the math axis.

The spacing can be manually fixed by adding \, as suggested in Werner's comment:

\sum_{n \,=\, 1}

thin spaces


  • It's more to the point.
  • Shorter for typing.

A small disadvantage remains:

  • Too large space in \displaystyle and \textstyle

There is a trick to circumvent the latter: \nonscript suppresses the following space in the script styles.


\[ \sum_{n \mrel= 1} \mrel= 1 \]


\thinmuskip is added in script styles, otherwise it is canceled by -\thinmuskip.


In LuaTeX the spacings between the math atoms can be configured very deeply. Also the cramped styles are available as commands. Cramped styles are used, if something is above the expression (denominator, \sqrt, ...). Then superscripts are lowered a bit. Cramped style is used in the subscript of \sum.

The following example configures a thin space between math atoms in \scriptstyle and cramped \scriptstyle, where a thick space would be set in \textstyle or \displaystyle.


    \csname luatexUmath#1#2spacing\endcsname\luatexcrampedscriptstyle=#3\relax
    \csname luatexUmath#1#2spacing\endcsname\scriptstyle=#3\relax

\[ \sum_{n = 1}^{n = 1} \]



  • LuaLaTeX uses a prefix luatex for new LuaTeX commands to avoid name clashes with existing macros.
  • There are 16 settings. The \@for loops avoid a long list of assignments.
share|improve this answer
Thanks! Would using \mathop also be incorrect in this context: \lim_{x\mathop \to \infty} f(x) ? I will use \, from now on, I don't actually see a difference in displaystyle. – bwv869 Apr 16 '14 at 7:47
@Oliver: At least \to is usually already vertically centered. In \displaystyle the space around = as \mathrel is larger than around = as \mathop. – Heiko Oberdiek Apr 16 '14 at 7:58

as stated by Werner in a comment, \mathop is intended to define operators like lim et al., while = is a relation.

as for the spacing, that was determined through knuth's examination of numerous examples published in the most carefully typeset journals of the early 20th century. these publications are cited in various writings by knuth. i recommend particularly his Gibbs lecture, published in the bulletin of the american mathematical society. (i'm not in a position to give a link right now, but it should be easy to find using google.)

Edit: Here is the link http://www.ams.org/journals/bull/1979-01-02/S0273-0979-1979-14598-1/S0273-0979-1979-14598-1.pdf

share|improve this answer
Can't find it on google or youtube unfortunately - would like to see it. – bwv869 Apr 16 '14 at 8:01
this is how to find it. (the tool i'm using doesn't show full urls, so i have to give a recipe.) go to ams.org/bull and choose "all available volumes". then choose year 1979, volume 1, issue 2, and search through the contents list for the article by knuth. (if someone can put the correct url into my answer, please do; i won't be able to until next month.) – barbara beeton Apr 16 '14 at 8:14
@Oliver -- thanks for the link. – barbara beeton Apr 16 '14 at 8:30

Here are four strategies. The first is what I like the best.


&\text{Normal: }   && \sum_{k=1}^{m}a_{k}\\
&\text{Modified: } && \sum_{\text{$k=1$}}^{m}a_{k}\\
&\text{Thin space: } && \sum_{k\,=\,1}^{m}a_{k}\\
&\text{Command: } && \sum_\su{k=1}^{m}a_{k}

enter image description here

share|improve this answer
Thanks. It's not as obvious close up but from a distance it seems obvious that the third is superior to the first, e.g. quickpic.info/z/i6.jpg – bwv869 Apr 16 '14 at 12:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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