1

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.

  • 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. –  Feb 28 '14 at 00:35
  • @Werner, this doesn't answer my question. –  Feb 28 '14 at 00:36
  • As the interletter spacing is not quite the same as ordinary text, you could try simply \textrm{string}. – Bernard Feb 28 '14 at 01:36
  • If others will contribute to the wiki, there seems to be an even stronger case against it since you cannot expect users to be careful of your short-cuts. That is, isn't there even more need for robustness in that case? – cfr Mar 01 '14 at 02:18
  • @cfr, there is nothing to be careful about, in the sense that these "shortcuts" (which probably should actually be the default behaviour of LaTeX) do not break anything. –  Mar 01 '14 at 14:57
  • Really? $(x + y/2)(y/2 + x) = x^2 + y^2/4 + xy$ should render the final term in upright by default? – cfr Mar 01 '14 at 17:32
  • @cfr, that should be written as $x y$. –  Mar 01 '14 at 21:15
  • Kopka and Daly write xy. Is that wrong or deprecated? I don't know about maths, but it would be extremely awkward to write that in first order predicate calculus, for example. $Pxyz$ makes a lot more sense semantically than $P x y z$. – cfr Mar 01 '14 at 23:04
  • If this is for the web, do you need a mathjax solution (which is off topic actually) of a tex one (which would be unlikely to work with mathjax?) – David Carlisle Feb 07 '15 at 23:14
  • @DavidCarlisle, I'm looking for a TeX solution. –  Feb 08 '15 at 00:08
  • shame, it would be easier in mathjax as you could use a regular expression replace to add the markup on the fly:-) It's no doubt possible in tex but it's so far against TeX's normal working it would be like breqn and work in isolation but be incompatible with more or less everything, the entire tex math mode layout is built on the idea that white space in the source is ignored and you want to make it affect font choice. – David Carlisle Feb 08 '15 at 00:13
  • Heiko's answer at the proposed duplicate answers this question. – Paul Gessler Feb 16 '15 at 07:56

0 Answers0