10

A simple question I think, but if I write $\omega{\mathrm{anti-Stokes}}$, the hyphen looks an awful lot like a minus sign. If I naively try $\omega{\mathrm{anti\hyp{}Stokes}}$ (I think \hyp{} requires \usepackage{hyphenat}) I get the same result - I'm not actually surprised, presumably it sets the same character.

A full MWE:

\documentclass{standalone}
\begin{document}
$\omega_{\mathrm{anti-Stokes}}$
anti-Stokes
\end{document}

output

The minus sign looks like a rather thin en-dash instead of a hyphen.

Chris H
  • 8,705

1 Answers1

5

This is to summarise the answers in the comments, and avoid leaving the question unanswered.

As discussed in more detail in the answers to Difference between various methods for producing text in math mode, there are several ways to produce upright letters in maths mode. Heiko Oberdiek's answer is particularly worth a read for the curious or confused.

Relevant here is that \mathrm is meant for setting upright characters in maths mode, and therefore uses the maths roman font, spacing and encoding. On the other hand \textrm uses the text roman font and the font parameters of the current text mode font, i.e. - will be encoded as a hyphen rather than a minus sign when using \textrm. Because \textrm inherits its parameters from the surrounding text, it doesn't guarantee an upright shape: for example in a theorem environment it will inherit italic shape. \textnormal uses \normalfont, only the size then changes

\textrm and \textnormal, in the absence of the amsmath package do not scale in subscripts, so amsmath must be loaded in cases like this, either directly or by another package such as mathtools which fixes some bugs in amsmath.

Chris H
  • 8,705
  • 1
    \textrm does not guarantee upshape: in a theorem statement you'd get your subscript in italics. Use \textnormal which does the right thing. – egreg Feb 12 '14 at 17:25
  • thanks @egreg, I've edited that in. But if I understand correctly (and it's more than possible that I don't) \textnormal doesn't guarantee anything much - in particular after \renewcommand{\familydefault}{\sfdefault} for example, wouldn't \textnormal give you sans serif, regardless of the maths font used? – Chris H Feb 13 '14 at 08:21
  • In the case of all sans serif, textual sub/superscripts should be sans serif as well. – egreg Feb 13 '14 at 10:07
  • @egreg, I would say only if maths is sans serif, but this isn't the issue I thought it was given that I'd forgotten that beamer (the only time I use sans serif and LaTeX) uses sans serif for maths. – Chris H Feb 13 '14 at 10:29