This has probably been answered somewhere, but I can't find it from some searching. I sometimes want to write something like Leb for lebesgue measure, and I would like it to be non-italicized, so I usually use \text{Leb} in math mode, but this has the annoyance that it changes inside of an italicized (ams) theorem environment. I usually just hack this and write \text{\emph{Leb}} but clearly this is not ideal.

Is there a replacement for \text that won't inherit this italicizing? Alternatively, is there a more clever hack, in which I can make my macro detect if its going to be italicized and then automatically put in the \emph hack? Clearly the first would be ideal, but the second would also be acceptable.

  • 2
    Why are you not using \text{\textrm{Leb}} or \text{\textnormal{Leb}}? It always set "Leb" is roman (i.e. normal) font. The \emph hack is kind of ugly. It only works because an \emph inside a \emph is set in roman font again. – Martin Scharrer Apr 4 '11 at 12:43
  • Ah, see, I did not know about these. I'll give these a try, thanks! – Otis Apr 4 '11 at 13:02
  • 1
    Actually, the \textrm one does not work for me, but the text normal does. Thanks for the tip! – Otis Apr 4 '11 at 13:04
  • You are welcome. I added it as an answer now. – Martin Scharrer Apr 4 '11 at 13:27

You can use \textnormal to switch the font to normal non-italic text independent if the outer text is set in italic or not:


Alternatively you can use \mathrm which may make the fonts used more consistent, although this will only work within math mode.

  • @Martin: I think that in an \rm context, \mathrm and \textrm will use the same font. – Hendrik Vogt Feb 15 '13 at 16:52

I think what you want to do is declare a math operator, which will then be set upright. To your preamble add:


Then write \Leb in your text. It should be upright, even in theorem environments.

Minimal example:

$ \Leb  $ is upright and $Ent(\mu|\Leb)$ looks like $Ent(\mu|\nu)$
\item $\Leb(x)$
\item $\Leb x$
\item $\mu(x)$
\item $\mu x$
\item $\Leb\! x$

As you can see, there is a little difference in the spacing between $\mu x$ and $\Leb x$ which a \! roughly fixes.

  • But does this not mess up the spacing afterwards? I would like to write something like $Ent(\mu|\Leb)$ and have the Leb act just like it would with \nu in its place, in terms of spacing. Maybe I just got the wrong idea about how DeclareMathOperator works.. – Otis Apr 4 '11 at 13:01
  • @Otis why would it mess up the spacing? Things like \mathbin and \mathrel play with spacing, I believe, but this does not (as far as I know.) And if it does, you could always play with the spacing of the macro... – Seamus Apr 4 '11 at 13:18
  • 1
    \DeclareMathOperator defines an operator (I know: surprise!), and that does indeed have consequences for spacing. However, the spacing rules for math are all about spacing between objects, as summarized by the table on p 170 of the TeXbook (reproduced in section 23.6.1 of TeX by Topic). You will see that the differences in spacing around an operator and an ordinary atom are quite subtle. In particular, there is no difference in the example above, where a close atom follows the symbol. – Harald Hanche-Olsen Apr 4 '11 at 13:40
  • @Harald does amsmath define something like \DeclareMathOrd that would fix the spacing automatically? – Seamus Apr 4 '11 at 13:52
  • 1
    No, but you could convert your operator into an ordinary atom by surrounding it by braces. To change the control sequence to make an ordinary operator, use \edef\Leb{{\Leb}}. – Harald Hanche-Olsen Apr 4 '11 at 16:48

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.