Although many have attempted to explain the difference among \mathrm
, \textrm
, \textnormal
and \text
(and others?), I found them misleading.
See for example the LaTeX's Wiki \mathrm
explanation
Why is it wrong? Let's try all of them within an article
and a beamer
and you'll see the difference and, therefore, error.
equation.tex
\begin{eqnarray*}
\int_1^9\! \cos{x} \,\mathrm{d}x & & \textrm{this is textrm}\
\sum_1^9 y & & \textsf{this is textsf}\
\prod_1^9 z & & \textnormal{this is textnormal}\
\bigcup_1^9 w & & \text{and this is just text}
\end{eqnarray*}
article.tex
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\input {equation}
\end{document}
And until here everything looks fine...
beamer.tex
\documentclass{beamer}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{frame}
\input{equation}
\end{frame}
\end{document}
And here we can clearly see that \mathrm
does not behave as expected, i.e. does not provide a function aspect to the d. Does anyone know what am I supposed to use here instead? Just \text
?? o.O
Moreover, I cannot see any difference between \textnormal
and \text
.
Finally, \textrm
looks useless..
\text
picks up any setting outside of math mode. Issue\itshape
before\input
to see (also affects\textrm
).beamer
's font set up is rather odd and should not at all be taken as giving 'guidance' on normal input for LaTeX. (I can't do much about that at this point.)\mathsf
\mathrm
does not behave as expected..." To me the expected result of\mathrm
is upright roman font. Also "\textrm
looks useless" : why so? Your beamer example shows that it allows you to typeset upright roman font, even when the environment (in this case, thebeamer
class) tries to enforce sans serif fonts. As I understand it, the wikibook mistakes\mathrm
(roman font) for\textnormal
(upright font).\mathrm
was to reproduce the font type of cosine function shown above. So, have undefined functions to be enclosed in a\textnormal
environment? Is this the common practice? And what about\text
? Is it used for normal text?