# How do I change the standard “math font”?

What I can tell, the font you get, it looks like the standard, "bookish" font, only tilted. How can I get a monospace font with a straight spine, e.g., the font you get with texttt?

I'm happy with everything else, including the interface, so, when set up, I don't want to invoke this in any other way than the standard $...$ dance.

-

You could put

\DeclareSymbolFont{letters}{OT1}{cmtt}{m}{n}


in the preamble of your document. Though I'm not certain why you would want to use this as the default math font. Also, by making this declaration some symbols get rendered incorrectly:

\documentclass{article}
\usepackage{amsmath,amssymb}
\DeclareSymbolFont{letters}{OT1}{cmtt}{m}{n}

\begin{document}
Hello world:
$x^2 + y^2 = \tan(\theta)$
\end{document}


which gets rendered as:

There is another approach. But it requires a bit more work.

First, declare a symbol font name

\DeclareFontSubstitution{OT1}{cmtt}{m}{n}
\DeclareSymbolFont{myletters}{OT1}{cmtt}{m}{n}
\DeclareSymbolFontAlphabet{\mathnormal}{myletters}


But this is not sufficient to enact the changes you want. Now you've got to go through for every symbol you want set in this style and declare it:

\DeclareMathSymbol{a}{\mathalpha}{myletters}{a}
\DeclareMathSymbol{b}{\mathalpha}{myletters}{b}
\DeclareMathSymbol{c}{\mathalpha}{myletters}{c}
\DeclareMathSymbol{d}{\mathalpha}{myletters}{d}
\DeclareMathSymbol{e}{\mathalpha}{myletters}{e}


etc., and then

\DeclareMathSymbol{A}{\mathalpha}{myletters}{A}
\DeclareMathSymbol{B}{\mathalpha}{myletters}{B}
\DeclareMathSymbol{C}{\mathalpha}{myletters}{C}
\DeclareMathSymbol{D}{\mathalpha}{myletters}{D}
\DeclareMathSymbol{E}{\mathalpha}{myletters}{E}


etc. It's a lot of work. You'll be losing a lot work others have already done.

At this point, I find my answer bordering on the questionable. For example, even in the original solution I posted \tan got type-set in the usual default font, and none of the changes I'm suggesting above seem to change that.

-
I don't like the tilted bookish font, nothin' more advanced as that. –  Emanuel Berg Dec 13 '12 at 3:35

The mathastext package might meet your needs. The package will give you, by default, an upright roman font for math material, but otherwise it may do exactly what you're looking for.

The following MWE illustrates the package's default behavior:

\documentclass{article}
\usepackage{mathastext}
\begin{document}
Hello, Pythagoras. $a^2 + b^2 = c^2$. Goodbye, mathematics.
\end{document}


-

To get a typewriter font for the letters, digits, and a few symbols in math mode, you can use mathastext as advised in Mico's answer, with some additional set-up:

\documentclass{article}
\usepackage{mathastext}
\MTfamily{\ttdefault}\Mathastext % this tells mathastext to use typewriter
\begin{document}
Hello, Pythagoras. $a^2 + b^2 = c^2$. Goodbye, mathematics.
\end{document}


-
option defaultmathsizes would tell mathastext to use the standard choices of sizes for sub and sub-sub-scriptstyle. –  jfbu Mar 11 at 12:39
please don't give direct links like that; we're trying to distribute ctan's load. the “correct” address for that file is http://mirror.ctan.org/info/Free_Math_Font_Survey/survey.html –  wasteofspace Mar 11 at 15:32