6

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.

Emanuel Berg
  • 1,827

4 Answers4

4

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}

enter image description here

Mico
  • 506,678
3

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:

enter image description here

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.

A.Ellett
  • 50,533
1

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}

mathastext tt

  • option defaultmathsizes would tell mathastext to use the standard choices of sizes for sub and sub-sub-scriptstyle. –  Mar 11 '14 at 12:39
0

You can also take a look at this font survey for (La)TeX: http://mirror.ctan.org/info/Free_Math_Font_Survey/survey.html

There you will find a lot of math (and text) fonts. Maybe some of them will suit your needs.

Alexis
  • 439
  • 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 '14 at 15:32
  • I think this list should be kept up to date. – marczellm Mar 11 '14 at 15:54