3

I've set up a macro for differential parts as so:

\newcommand{\dd}[1]{\,\mathrm{d}#1}

which is useful for differentials at the end of integrals because of the space. (I realise the argument notation is superfluous in this case but I'm keeping it for my own reasons.)
The trouble is that if I have a differential standing all by itself I don't want to have the space there. Is there a way of defining a macro so that it can detect if there is a character of any kind in the space before it is called, and change its output accordingly?

Werner
  • 603,163
H3LK5
  • 31
  • Welcome to TeX.SX! Define \newcommand{\dd}{\mathop{}\!\mathrm{d}}; an argument is not necessary: \int f(x)\dd x will print as you want. And also \frac{\dd f}{\dd x}. See http://tex.stackexchange.com/questions/60545/should-i-mathrm-the-d-in-my-integrals, especially Herbert's answer. – egreg Apr 24 '14 at 21:25

0 Answers0