# When should math be upright?

Is there any standards for when math is supposed to be upright?

E.g.

The f in f(x) is in italics but cos in \cos x is upright. As I see it, both are functions?

\int f(x) \, dx OR \int f(x) \, mathrm{d}x?

P(Y=y) OR \text{P}(Y=y) OR p(Y=y) OR \text{p}(Y=y) for probabilities?

-
Some cases are guideline-dependent, for example the 'd' in 'dx' is upright following ISO, but italic following the traditions of pure maths typography. – Joseph Wright Nov 15 '11 at 10:53
related question: tex.stackexchange.com/questions/33120/… – matth Nov 15 '11 at 12:07