Here's something strange:


When I compile this, only the second one produces the desired result. The other gives me a tilde over the i! What gives?

  • 4
    Why should you define \Vi with \DeclareMathOperator? If your aim is to have an upright “i”, then \newcommand{\Vi}{\vec{\mathrm{i}}} is what you need. – egreg Sep 22 '15 at 14:53
  • I'm not sure... is there a better option? I just want something quicker to type than $\vec{i}$ as I write up exams, etc... Perhaps I'm missing the thrust of your question. – Shay Sep 22 '15 at 14:56
  • @Shay egreg is asking "Why did you choose to use \DeclareMathOperator?" What is your desired outcome? – darthbith Sep 22 '15 at 14:59
  • 3
    \DeclareMathOperator is for very particular objects such as \log, \max or \sin. You just need \newcommand{\Vi}{\vec{i}}, probably, or better, \newcommand{\Vi}{\vec{\imath}} – egreg Sep 22 '15 at 14:59
  • 1
    @egreg I guess \operator@font is interfering with the math accent. Did I just got lucky with tex.stackexchange.com/a/261966/82917? – campa Sep 22 '15 at 15:06

The \DeclareMathOperator function is for defining a quite narrow kind of objects; for instance \log, \exp, \sin or \max use (an equivalent form of) it. So it's for defining function symbols that should consist of letters in the same shape as normal text, as opposed to math italic.

Basically \DeclareMathOperator{\foo}{blurb} does something like


(I just omit irrelevant technical complications). The \mathop bit is what produces the peculiar spacing around operator names; for instance there is a space in $\log x$, but not in $\log(xy)$. Of course,\mathrm` is what selects upright letters.

The input




enter image description here

but as soon as we uncomment the loading of amsmath we get

enter image description here

The tilde instead of an arrow is a “feature”1 in amsmath, then.

What you need is


or, maybe better,


where the “i” loses its dot.

enter image description here

1 It's not the only “feature” of amsmath related to math accents. The word “feature” is used in its common meaning of “bug”.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.