$\sin$ vs. $sin$ - history and usage 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.]
 A: $\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).
A: I've just read an article which at least partly answers my questions: https://nickhigham.wordpress.com/2016/01/28/typesetting-mathematics-according-to-the-iso-standard/.
A: This not about $\TeX$. It is a typographical convention designed to aid in understanding.  Remember books have been printed on paper centuries  before the computer era.
In any mathematical expression or formula, we use the signs, $+, -, /$ denoting arithmetical operations. But for some reasons (economy?) the symbol for multiplication, $\times$, is omitted. So the high school formula is never written as $(a+b)^2 = a^2 + b^2 + 2\times a\times b$.
 So  when we see $max$ in an expression typographers want to help the readers not to confuse with the product of $m$, $a$, and $x$.  
For this purpose all variable names (usually single letters) are written in italics and word-abbreviations such as max, min, deg,  tan, log, exp are written in upright fonts.
(I am told physicists following Einstein summation convention have to be pre-empt such an assumption in rare situations where no summation is intended).
Now $\TeX$ is smart enough to know that between two variables if there is no 
arithmetical operator it should be multiplication: that is why when we type spaces between two variables inside dollars that space is ignored by the $\TeX$ engine.
