I like to format my integrals so that there is less space between the integral sign and the integrand, more space between the integrand and differential, and so that the differential is upright. However, it is tedious to type out the formatting repeatedly. I wrote a command,
\newcommand{\intf}[4]{\int_{#1}^{#2} \! #3 \, \mathrm{d}#4}
So that the properly-formatted integral is easier to type, e.g. typing in \[ \intf{a}{b}{x^2}{x} \] gives

However, this command requires 4 inputs. If I didn't want the upper or lower limits, I could omit their inputs but I would still need to write out the brackets, e.g. \intf{}{}{x^2}{x}.
In the long run, however, this gets tedious as well, and looks messy in the code! It would be super if I had some command where I could just write ^ and _ as necessary, e.g. \intf^{b}{x^2}{x}
So, I'm wondering two things: (a) Is there some preexisting package that has a pre-formatted integral command? (b) Is there an easy way to change the above command so that it can take modifications such as ^ and _ as required?
Thanks!




\intf_0^{\infty}{\!\intf_0^{\infty} e^{-x-y} dx} dy. Brilliant! – Delyle Apr 29 '14 at 16:10