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:
Is there a command that is supposed to be used to encapsulate math names consisting of more than one character?
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"
.
\DeclareMathOperator
more often.\operatorname{SQRT}(x)=x^{1/2}
is more mathematically sound. ;-)\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.\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.