This question already has an answer here:

I am looking for a way to have LaTeX render strings of more than one letter as upright (in math mode). For example, I want it to render

  • $Hom$ as $\mathrm{Hom}$,
  • $apple$ as $\mathrm{apple}$,
  • $apple + orange$ as $\mathrm{apple} + \mathrm{orange}$,

while rendering

  • $a$ and $a + o$ as normal.

The answers at Use \mathrm by default are close to what I want, but they fail the last example.

marked as duplicate by Paul Gessler, egreg fonts Feb 16 '15 at 8:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    don't do this:-) better to declare \Hom as a math operatpr and use like \log and \sin – David Carlisle Feb 27 '14 at 23:41
  • 1
  • @DavidCarlisle, I have an unusual use case in mind (rendering math on a web-based wiki), where for practical purposes this would be very useful. – user573 Feb 28 '14 at 0:35
  • @Werner, this doesn't answer my question. – user573 Feb 28 '14 at 0:36
  • As the interletter spacing is not quite the same as ordinary text, you could try simply \textrm{string}. – Bernard Feb 28 '14 at 1:36