Should I \mathrm the d in my integrals?
\documentclass{article}
\usepackage{amsmath}
\newcommand*\diff{\mathop{}\!\mathrm{d}}
\newcommand*\Diff[1]{\mathop{}\!\mathrm{d^#1}}
\begin{document}
\begin{align*}
\biggl(\int_{-\infty}^\infty e^{-x^2}\diff x\biggr)^2
&= \int_{-\infty}^\infty\int_{-\infty}^\infty e^{-(x^2+y^2)}\diff x\diff y \\
&= \int_0^{2\pi}\int_0^\infty e^{-r^2}r\diff r\diff\theta \\
&= \int_0^{2\pi}\biggl(-{e^{-r^2}\over2}\bigg\vert_{r=0}^{r=\infty}\,\biggr)\diff\theta\\
&= \pi \tag*{q.e.d.}\\
\end{align*}
%
\[ V(\mathbf{x}) = -\int_{\mathbf{R}^3}
\frac{G}{|\mathbf{x}-\mathbf{y}|}\,\rho(\mathbf{y})\,\Diff3\mathbf{y} \]
\end{document}
I found a TUGboat article some years ago which seems to deal with the spacing around the differential operator in the correct way (at least to me).
Example
\documentclass{article}
\makeatletter
\providecommand*{\dif}%
{\@ifnextchar^{\DIfF}{\DIfF^{}}}
\def\DIfF^#1{%
\mathop{\mathrm{\mathstrut d}}%
\nolimits^{#1}\gobblespace
}
\def\gobblespace{%
\futurelet\diffarg\opspace}
\def\opspace{%
\let\DiffSpace\!%
\ifx\diffarg(%
\let\DiffSpace\relax
\else
\ifx\diffarg\[%
\let\DiffSpace\relax
\else
\ifx\diffarg\{%
\let\DiffSpace\relax
\fi\fi\fi\DiffSpace}
\makeatother
\begin{document}
\[
\int x \dif x
\]
\end{document}
Update
As pointed out by Enrico Gregorio and implemented by Herbert Voß, the following will do:
\documentclass{article}
\newcommand*\dif{\mathop{}\!\mathrm{d}}
\begin{document}
\[
\int x \dif x
\]
\end{document}
Have a look at
http://ctan.sharelatex.com/tex-archive/macros/latex/contrib/physics/physics.pdf
2.5 Derivatives
I use it and i am very happy with this package.
EDIT:
\documentclass{article}
\usepackage{amsmath}
\usepackage{physics}
\usepackage{amssymb}
\begin{document}
\begin{align}
\left(\int\limits_{-\infty}^\infty e^{-x^2} \dd{x} \right)^2
&=\int\limits_{-\infty}^\infty \int\limits_{-\infty}^\infty {e^{-(x^2+y^2)}}\dd{x}\dd{y} \\
&=\int\limits_{0}^{2\pi} \int\limits_{0}^\infty e^{-r^2}r \dd{r}\dd{\theta} \\
&=\int\limits_{0}^{2\pi} {\left(\left.-\frac{e^{-r^2}}2\right|_{r=0}^{r=\infty}\right)}\dd{\theta} \\
&=\pi
\end{align}
\begin{equation}
V(x)=-\int\limits_{\mathbb R^3} \frac G{|x-y|}\rho(y) \dd[3]{y}
\end{equation}
\end{document}