6

Possible Duplicate:
What’s the proper way to typeset a differential operator?

\newcommand{d}[1]{\:\textrm{d}{#1}} 

That is my new comamnd for writing the dx of an intergral. Just wanted to be able to type this in my code.

\d{x}  <<<where the x is the variable of integration>>>

What did I do wrong?

MaoYiyi
  • 1,135
  • 1
  • 11
  • 20

1 Answers1

9
\newcommand\d[1]{\:\textrm{d}#1} 
\renewcommand\d[1]{\:\textrm{d}#1} % if \d is already defined

only for a definition of an environment you use \newenvironment{env}. Another useful definition is:

\newcommand*\diff{\mathop{}\!\mathrm{d}}

in your definition you do not really need the argument and using \mathrm makes more sense, then it takes the d from the same math font and not from the text font

\documentclass{article}
\renewcommand\d[1]{\:\textrm{d}#1}
\newcommand*\diff{\mathop{}\!\mathrm{d}}
\begin{document}
$\d x \textrm{ or } \diff x  $
\end{document}