How to master $\LaTeX$ in physics

This is a brief summary of Do’s and Don’ts when writing equations with $\LaTeX$ in physics.
In advance: use the $\LaTeX$-packages

\usepackage{physics}

\usepackage{siunitx}

Using those packages as a guide prevents about 90% of all common $\LaTeX$-NoGoes. Have a look at their documentation!

  Good Bad Explanation
Total derivative \dv{f}{x}: \(\displaystyle\frac{\operatorname{d}\!f}{\operatorname{d}\!x}\) \frac{df}{dx}: \(\displaystyle \frac{df}{dx}\) The “differential”-$\mathrm{d}$ should always be non-italic.
Total derivative (higher order) \dv[n]{f}{x}: \(\displaystyle\frac{\operatorname{d}^{n}\!f}{\operatorname{d}\!x^{n}}\) \frac{d^{n}f}{dx^{n}}: \(\displaystyle \frac{d^{n}f}{dx^{n}}\)  
Partial derivative      
Partial derivative (higher order)      
$1$-dimensional Integral \int\limits_{x_{1}}^{x_{2}} \dd{x} f(x) : \(\displaystyle \int\limits_{x_{1}}^{x_{2}}\!\!\operatorname{d}\!x\, f(x)\) \int_{x_{1}}^{x_{2}} dx f(x) : \(\displaystyle \int_{x_{1}}^{x_{2}} dx f(x)\)  
$n$-dimensional Integral \int\limits_{\R^{n}} \dd[n]{x} f(x): \(\displaystyle \int\limits_{\mathbb{R}^{n}}\!\!\operatorname{d}^{n}\!x\, f(x)\)    
Surface integral over a vector field \(\displaystyle \int\limits_{S}\!\!\operatorname{d}\!S\, \hat{\boldsymbol{n}}_{\perp S} \boldsymbol{\cdot} \boldsymbol{E}(\boldsymbol{r})\)    
Reserved mathematical letters (i.e.: Euler’s number $\mathrm{e}$, imaginary unit $\mathrm{i}$, …) \mathrm{e}^{\mathrm{i}x} = \cos(x) + \mathrm{i} \sin(x) : \(\mathrm{e}^{\mathrm{i}x} = \cos(x) + \mathrm{i} \sin(x)\) e^{ix} = cos(x) + i sin(x) : \(e^{ix} = cos(x) + i sin(x)\)  

This site is open-source .
Created in & with .
Credit goes to Patrick Haußmann, Niko Lang and Elijan J. Mastnak.