0

I am confused about the behavior of my ams align evironment. Minimalistic example:

\documentclass[english]{article}
\usepackage{amsmath}

\begin{document}


\begin{align*}
\rm{d}x_{\tau} &= R(u) v \rm{d} \tau, \\
\rm{d}v_{\tau} &= - R(u)\nabla U(x)\rm{d}\tau -\gamma v R(u) \rm{d}\tau + \sqrt{\frac{2\gamma R(u)}{\beta}}\rm{d}W_{\tau}
\end{align*}


\end{document}

Output:

enter image description here

Why are some symbols like "x" or "u" parsed differently, sometimes italic and sometimes not?

3
  • 4
    You should not be using \rm nowadays, and it does not take arguments. Use \mathrm{...} (rm has-been depreciated since 1993)
    – daleif
    Sep 3 at 11:56
  • 2
    @daleif Sorry to chirp in, but it's deprecated, not depreciated that means a very different thing.
    – egreg
    Sep 3 at 12:36
  • @egreg was on a new tablet. Predictive text wasn't trained, and I could not spell it anyway
    – daleif
    Sep 3 at 17:23

2 Answers 2

3

The commands \rm, \it, \bf and similar two-letter font changing commands have been deprecated for almost 30 years. Moreover, they didn't take arguments, being declarations. The correct syntax 30 years ago (or more) would have been {\rm d}. Never use them.

Make yourself a favor and use a different strategy, namely

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

so you get several advantages, among which

  • the spacing is good in (almost) every situation, automatically;
  • you can change to an italic “d” whenever you want, just by replacing \mathrm{d} with d.
\documentclass{article}
\usepackage{amsmath}

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

\begin{document}

\begin{align*}
\diff x_{\tau} &= R(u) v \diff\tau, \\
\diff v_{\tau} &= - R(u)\nabla U(x)\diff\tau -\gamma v R(u) \diff\tau
  + \sqrt{\frac{2\gamma R(u)}{\beta}}\diff W_{\tau}
\end{align*}

\end{document}

enter image description here

2
  • Thank you so much! Could you briefly explain what the syntax \mathop{}\!\mathrm{d} does?
    – reloh100
    Sep 3 at 14:42
  • @reloh100 It makes an empty operator, so a thin space is added if an ordinary symbol precedes \diff, but none for an operation symbol or delimiter. The (empty) operator is followed by an ordinary symbol, so TeX would add a thin space after it, which we remove by \!.
    – egreg
    Sep 3 at 15:02
1

You can use the fixdif package, which redefines \d macro in math mode.

\documentclass{article}
\usepackage{fixdif}
\usepackage{amsmath}
\begin{document}

\begin{align*}
  \d x_{\tau} &= R(u) v \d\tau, \\
  \d v_{\tau} &= - R(u)\nabla U(x)\d\tau -\gamma v R(u) \d\tau
    + \sqrt{\frac{2\gamma R(u)}{\beta}}\d W_{\tau}
\end{align*}

\end{document}

If you prefer the italic d for the differential operator, just use the normal option provided by the package.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .