# [Tex/LaTex] How to make e in e^x written upright and why \me^x does not work

macrosmath-mode

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?

You have to define yourself that command in your document preamble

\newcommand{\me}{\mathrm{e}}


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.