Answering this question could involve saying something about MathJax. It depends on what turns out to be the answer. I am interested in how things should be done in the LaTeX side, though.

LaTeX, as far as I understand, mostly describes how things should look like, instead of what they mean or what they are. There are exceptions, like math vs text mode, or \title{}.

When writing the name of a function that consists of more than one character I have been using \operatorname{}. For example \operatorname{SQRT}(x)=x^2. This seems to work. For example, MathJax produces <mi>SQRT</mi> for the name of the function.

My questions are:

  1. Is there a command that is supposed to be used to encapsulate math names consisting of more than one character?

  2. Is \operatorname{} the one for that in all cases?

The reason why I became unsure and need either confirmation or direction, is that when I use it in a subscript like X_{\operatorname{abc}} then MathJax produces <msub><mi>X</mi><mrow class="MJX-TeXAtom-ORD"><mi>abc</mi></mrow></msub>, in which the <mi>abc</mi> is subordinated to an mrow of class="MJX-TeXAtom-ORD".

  • 2
    I use \DeclareMathOperator more often.
    – user156344
    May 7, 2019 at 15:54
  • 2
    Welcome to TeX-SE! I believe that \operatorname{SQRT}(x)=x^{1/2} is more mathematically sound. ;-)
    – user121799
    May 7, 2019 at 15:55
  • Welcome to TeX.SX! When you want a math operator, then \operatorname is the way to go. In LaTeX you could use \DeclareMathOperator\SQRT{SQRT} then use \SQRT from that point on. Other (non-operator) applications would require other commands. \mathrm, as JouleV suggested, would produce a different spacing than \operatorname (in LaTeX at least). The subscript, though, is not an operator, so probably \mathrm is better. May 7, 2019 at 15:57
  • @JouleV Haven't tried \DeclareMathOperator. In the case of \mathrm note that both in LaTeX understood as a way to describe how things should look like, it produces different output than other functions. As a way to enclose things for what they mean (although LaTeX may not care too much) note how MathJax translates \mathrm{xyz} as <mi>x</mi><mi>y</mi><mi>z</mi>, three letters multiplied together.
    – user188415
    May 7, 2019 at 16:01
  • 1
    mathjax rendering is off topic here (as it doesn't use tex) but the generated mathml that you show look OK to me, the mrow around the mi isn't needed but is harmless and automatically converted documents often have extra markup added as generating minimal markup is trick and not usually required May 7, 2019 at 20:36

1 Answer 1


As far as I know: yes. \operatorname is the right one (because of its name, of course :)))

However, I don't prefer using this command. I usually use something like

$\SQRT(x)=x^2\quad\SQRT x=x^2$

for the ease in typing in my documents. AFAIK the above code is equivalent to


However, to create upright letters (for variable name for example, not for operations), one should use \mathrm. The reason is the space around the text. Remember that \mathrm and \operatorname are really different! (and \text is even more).

IMHO you should not take MathJax to do some comparisons here. MathJax is actually not LaTeX and not related to/based on LaTeX.

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.