One thing newcomers to TeX or MathJax often get wrong is that they
write something like $sin(x)$ instead of $\sin(x)$ - the point being
that common mathematical functions with names consisting of several
letters are usually typeset in non-italic letters as opposed to the
names of variables. So, if you write sin
you'll get $sin$ typeset as if you meant to multiply the variables
$s$, $i$, and $n$ while with
\sin it looks much better.
[In case this is new to you: Should you need something like
$\operatorname{diag}$ where \diag
is not defined, you can for example use \operatorname{diag}.]
This is for example explained in Knuth's TeX book in the chapter about the "fine points of mathematics typing". However, there are at least two other situations where I think non-italics are also to be used:
The Leibniz notation should not be used like this: $\frac{{\color{red}d}^2y}{{\color{red}d}x^2}$, but rather like so: $\frac{\mathrm{{\color{red}d}}^2y}{\mathrm{{\color{red}d}}x^2}$, because we're not talking about a variable $d$ but an operator $\mathrm d$.
Well-known constants should not be typeset in italics because, well, they're not variables. So, Euler's identity is not ${\color{red}e}^{{\color{red}i}\pi}-1=0$ but $\mathrm{\color{red}e}^{\mathrm{\color{red}i}\pi}-1=0$.
[For the record, Knuth's TeX book doesn't agree with this.]
I've already learned from this question that in case of the Leibniz notation there's actually an international standard saying it should be done like this, but that still leaves a couple of questions open for me:
What is the history of these typographical conventions? (Or maybe one should better ask when and why typesetters started to use italics for variables.)
Does the ISO-80000-2:2009 standard (which sadly is not accessible to mere mortals) say something about $\mathrm e$ vs. $e$ and $\mathrm i$ vs. $i$?
How do publishers of mathematical books or papers deal with this? Have you ever encountered one who insisted on getting things like the above "right" one way or the other?
[My apologies for cramming several questions into one, but I think they are all intimately related.]
$\LaTeX$ was set down while the conventions were different, and to preserve the older texts, the rules have not been changed. However, it could be possible for someone to write some .sty file that implements the sort of definitions at the particular date, eg math2000.sty or something, with
\renewcommand{vec}[1]{\mathbf{#1}}and\newcommand{dif}[1]{\mathrm{d}#1}and\newcommand{ddif}[2]{\frac{\mathrm{d}#1}{\mathrm{d}#2}.Then you put something like
ddif{q}{t}to get the desired result.Because the thing has a date in it, and invoked by
\usepackage{}then it is more robust to formatting changes &c.But
\operatorname{}is a bit long, and i reassign this to\fn{}, eg\fn{isi}(values).