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

I apparently can't see the difference in a compilation (pdflatex) between \mathrm and \operatorname. So, as in the title the question is: is there a difference? Which one is preferable in what occasions?

share|improve this question
up vote 128 down vote accepted

There are many differences. The main one is in the fact that \mathrm{xyz} behaves like an ordinary letter, while \operatorname{xyz} behaves like function names such as \sin. Here's an illustration

$\sin x + \sin(x+y) + a\sin z$

$\mathrm{sin} x + \mathrm{sin}(x+y) + a\mathrm{sin}z$

enter image description here

where it's clear that the second line is wrongly typeset. Even if your "operator" requires parentheses after it, it should be \operatorname, as the third summand shows, where a thin space separates the coefficient from the operator.

Another subtle difference is in how some characters are interpreted in \mathrm and in \operatorname. Suppose you have an operator to be called "pre-norm", with a hyphen. Here's the example



enter image description here

and now it's clear what is to be used. Indeed \operatorname (and the same holds for macros defined with \DeclareMathOperator) treats in a special way punctuation symbols; \mathrm, instead, treats them as math symbols.

share|improve this answer


It is like math mode (no spaces), but in upright mode. The font size isn't changed.


The argument is written in upright mode but with some additional space before and behind.

The following example shows the differences:


enter image description here

share|improve this answer

In other LaTeX environments \mathrm{xyz} is useful. In MathJax v 2.0

$ i \\, \mathrm{sinh} \; $

gave the equivalent output as $ i \sinh x $. MathJax did not recognize \operatorname.

share|improve this answer
\operatorname is now supported with the ASMmath.js TeX extension. – ChrisR Dec 4 '13 at 16:10

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.