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.

6
  • 6
    It doesn't look like a minus sign, it is one. Use \textrm (and the amsmath package so it gets smaller in subscripts) Feb 6, 2014 at 11:42
  • 3
  • @DavidCarlisle, thank you - for the record (I'm sure you know this) mathtools does the job just as well as amsmath (can't remember why I switched from amsmath to mathtools, but that's another story.
    – Chris H
    Feb 6, 2014 at 11:56
  • @HeikoOberdiek, that's a good question with some interesting material in the answers - almost required reading I think. Now I know the "why" behind my question - htanks.
    – Chris H
    Feb 6, 2014 at 11:58
  • 2
    @ChrisH mathtools loads amsmath and fixes some bugs Feb 6, 2014 at 12:43

1 Answer 1

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.

4
  • 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, 2014 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, 2014 at 8:21
  • In the case of all sans serif, textual sub/superscripts should be sans serif as well.
    – egreg
    Feb 13, 2014 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, 2014 at 10:29

You must log in to answer this question.

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