# Typesetting of volume integral

This question has been bugging me for a long time: How do I properly typeset volume integrals? I would like to use the convention often used in Physics: d^3x=dV and \int dx f(x) instead of \int f(x) dx

Example:

    The kinetic energy is simply given by
$$T = \int\,\mathrm{d}^3\mathbf{x}\frac{\rho}{2} \mathbf{\dot x}^2 = \frac{3}{10}M\dot R^2\;.$$


But the integral looks somehow bad as the spacing between the x and the d is too big. How can I change this?

Maybe the following is what you're after:

I raised the 3 quite a bit and slightly moved it to the left; this way I could move the x much closer to the d. Here's the code for a command \d that takes one optional and one mandatory argument:

\documentclass{article}
\usepackage{calc}
\renewcommand*\d[2][]{%
\mathrm{d}%
\ifx\relax#1\relax\else
\rule{-0.05em}{1.9ex}^{#1}\!
\fi
#2\,
}
\begin{document}
$\int \d[3]{\mathbf{x}} \frac{\rho}{2} \mathbf{\dot x}^2 \qquad \int \d{\mathbf{y}} f(\mathbf{y})$
\end{document}


Note that this only works for "small" integration variables like x. Moreover, I removed the \, between \int and \mathrm{d} that you had and put it after the differential instead. You can of course adjust this to your needs.

• Thanks, that helps! A friend pointed out, though, that the "x" should not be bold, as it is not a vector in that context. What do you say to that? – user1834164 May 3 '13 at 6:54
• If the x in \dot x is bold, than I'd also make it bold in the differential. (Personally, as a mathematician, I make neither of them bold.) – Hendrik Vogt May 3 '13 at 7:35