Take the 2-minute tour ×

I'd like to write e^x in LaTeX math mode where the e is written upright, rather than slanted, to indicate that it is not a variable. Kopka and Daly (4ed) pg. 285 do this with \me^x. When I try this I get the "undefined control sequence" error.

Q: Is \me a deprecated command?

Q: How can I do now what \me used to do?

share|improve this question
add comment

2 Answers 2

up vote 14 down vote accepted

You have to define yourself that command in your document preamble


Some comments

It's not necessary to declare this symbol as an ordinary symbol because by rule all math characters that are subject to alphabet changes are ordinary.

The construction \mathrm{e} is essentially equivalent to

\begingroup\mathgroup=0 e\endgroup

because the Roman math alphabet corresponds to the math group 0. Each math alphabet (\mathrm, \mathnormal, \mathbf and so on) corresponds to the choice of one among 16 math groups; \mathrm is 0, \mathnormal is 1, the others are from 4 onwards.

Each character has a \mathcode which, for e is "7165 which means

when an e is found in math mode, it should be an ordinary symbol, taken from the font in math group 1 at slot "65; but if \mathgroup is set to a non negative value, use the character at slot "65 from the font in the specified math group (this because of the first digit "7).

Thus calling \mathrm{e} is like asking for a math code "0065 (numbers preceded by " are hexadecimal): the first 0 means "ordinary symbol", the second one is the math group. With \mathbf{e} we would ask for "0465, according to the normal LaTeX setup.

Details about math codes are in the TeXbook or in TeX by Topic. Note that LaTeX calls \mathgroup the primitive \fam.

share|improve this answer
wouldn't \DeclareMathOperator{\me}{e} be preferred in this case though? –  lowndrul May 30 '11 at 20:32
@brianjd: Because this creates an atom of operator kind an the “e” should be ordinary, I think … –  Tobi May 30 '11 at 20:39
@brianjd No, as it would create a space in $\me x$ or $x\me$, which is clearly wrong. –  egreg May 30 '11 at 20:51
@brianjd: But e is not an operator, it's a number. –  Jeff Jul 12 '13 at 18:48
add comment

I do this using the unicode-math package to redefine the alphabet used for e as upright. That way, I can write \(e^{i \pi}\) and have everything typeset in just the right font shape.

My particular method of doing this is rather complicated (as I mix colours in as well: reals are redish and complex are a shade of purple) but the documentation for unicode-math is fairly straightforward. Here's a simple example



\(e^{i \pi} = -1\)


upright e


  1. You have to use xelatex or lualatex for this
  2. The above uses the STIX fonts, if you don't have them you'll need to change the example
  3. You have to be sneaky if you want to use both e and e in the same document (as bare symbols that is)
  4. Of course, \pi should have been upright as well (since it is also a constant) but that's a little more complicated
  5. Once you mix colours in, the whole thing can get a little silly!
share|improve this answer
It's actually sort of surprising that a mathematician would typeset e and i upright. I've only ever seen physicists do that. But that aside, you can do this without xelatex simply by writing \mathcode"65"65 in the preamble. Similarly for i. –  TH. May 30 '11 at 23:44
@TH. I do this in lectures to quickly distinguish between constants and variables (or local constants). I wouldn't do this in an article. I didn't know about the \mathcode trick, but I suspect it wouldn't work for the full range of what I do in lectures (such as colours). –  Loop Space May 31 '11 at 7:08
@TH. A better way to express your trick would be \mathcode`e=`e that carries more semantics. –  egreg Aug 21 '12 at 9:40
add comment

Your Answer


