[Tex/LaTex] Non italic text in equations

amsmathequationsitalic

Everytime I use an equation I want the normal letters to be non-italic in the equation.
I've tried \usepackage{mathastext} which makes the equations look funny, the parenthesis becomes small etc.
I've tried \usepackage{eulervm} Which rotates the \leq.

The greek letters can stay italic, I've got another trick to make them non-italic. Is there a way only to make the normal text in the equation non-italic?

Best Answer

I don't know if an approach like this would cover all bases?

I tell LaTeX to make math letters using the {cmr}{m}{n} font style. However, this screws up Greek letters, so I have to define a special greeksymbols class that uses {cmm}{m}{it} and then, for each Greek symbol, point it to the greeksymbols font style.

EDITED to take campa's suggestion to add additional symbols to the mix, such as harpoons, \imath (upright style), \wp, and \vec (accent).

The key in adding such symbols is to look at the cm font tables in the TeXbook, (Appendix F), to determine the slot number and font family of the desired glyph. You also need to know the functional category of glyph, such as \mathrel, \mathbin, \mathchar, \mathord, etc. and add all that information into the \DeclareMathSymbol declaration.

EDITED to make the greek letters \mathord category, per egreg's recommendation.

\documentclass{article}
\DeclareSymbolFont{letters}{OT1}{cmr}{m}{n}
\DeclareSymbolFont{greeksymbols}{OML}{cmm}{m}{it}

%GREEKS
\DeclareMathSymbol{\alpha}{\mathord}{greeksymbols}{"0B}
\DeclareMathSymbol{\beta}{\mathord}{greeksymbols}{"0C}
\DeclareMathSymbol{\gamma}{\mathord}{greeksymbols}{"0D}
\DeclareMathSymbol{\delta}{\mathord}{greeksymbols}{"0E}
\DeclareMathSymbol{\epsilon}{\mathord}{greeksymbols}{"0F}
\DeclareMathSymbol{\zeta}{\mathord}{greeksymbols}{"10}
\DeclareMathSymbol{\eta}{\mathord}{greeksymbols}{"11}
\DeclareMathSymbol{\theta}{\mathord}{greeksymbols}{"12}
\DeclareMathSymbol{\iota}{\mathord}{greeksymbols}{"13}
\DeclareMathSymbol{\kappa}{\mathord}{greeksymbols}{"14}
\DeclareMathSymbol{\lambda}{\mathord}{greeksymbols}{"15}
\DeclareMathSymbol{\mu}{\mathord}{greeksymbols}{"16}
\DeclareMathSymbol{\nu}{\mathord}{greeksymbols}{"17}
\DeclareMathSymbol{\xi}{\mathord}{greeksymbols}{"18}
\DeclareMathSymbol{\pi}{\mathord}{greeksymbols}{"19}
\DeclareMathSymbol{\rho}{\mathord}{greeksymbols}{"1A}
\DeclareMathSymbol{\sigma}{\mathord}{greeksymbols}{"1B}
\DeclareMathSymbol{\tau}{\mathord}{greeksymbols}{"1C}
\DeclareMathSymbol{\upsilon}{\mathord}{greeksymbols}{"1D}
\DeclareMathSymbol{\phi}{\mathord}{greeksymbols}{"1E}
\DeclareMathSymbol{\chi}{\mathord}{greeksymbols}{"1F}
\DeclareMathSymbol{\psi}{\mathord}{greeksymbols}{"20}
\DeclareMathSymbol{\omega}{\mathord}{greeksymbols}{"21}
\DeclareMathSymbol{\varepsilon}{\mathord}{greeksymbols}{"22}
\DeclareMathSymbol{\vartheta}{\mathord}{greeksymbols}{"23}
\DeclareMathSymbol{\varpi}{\mathord}{greeksymbols}{"24}
\DeclareMathSymbol{\rho}{\mathord}{greeksymbols}{"25}
\DeclareMathSymbol{\varsigma}{\mathord}{greeksymbols}{"26}
\DeclareMathSymbol{\varphi}{\mathord}{greeksymbols}{"27}
%SYMBOLS
\DeclareMathSymbol{\leftharpoonup}{\mathrel}{greeksymbols}{"28}
\DeclareMathSymbol{\leftharpoondown}{\mathrel}{greeksymbols}{"29}
\DeclareMathSymbol{\rightharpoonup}{\mathrel}{greeksymbols}{"2A}
\DeclareMathSymbol{\rightharpoondown}{\mathrel}{greeksymbols}{"2B}
\DeclareMathSymbol{\wp}{\mathord}{greeksymbols}{"7D}
%OTHERS
\DeclareMathSymbol{\imath}{\mathalpha}{letters}{"10}
\DeclareMathAccent{\vec}{\mathaccent}{greeksymbols}{"7E}
\begin{document}
\[
z = \alpha x + \beta y^2
\]
\[
x \leftharpoonup y \leftharpoondown z \rightharpoonup \imath \rightharpoondown i
\]
\[
A = \wp(\vec B)
\]
\end{document}

enter image description here