# Changing the math font in pdflatex

After not-so-little effort, I managed to use a .otf I downloaded with the pdflatex engine. Once the .fd file is created, a simple \renewcommand{\rmdefault}{<MyFontFamilyName>} lets me use said font in the text.

However changing the value of \rmdefault has no effect in math mode. If I was using XeLaTeX, I'd use \setmathfont, but since I'm not doing that how can I get the font to work in math mode (including the letters of the greek alphabet)?

• you haven't said what 8bit font you made, in classic pdflatex encoding setup you would need a T1 encoded font for text, an OT1 font for fam0 (\mathrm and uppercase Greek) and OML encoded one for math italic, including lower case Greek, and possibly other encodings depending how many of the characters in the original font you need.(None of the standard pdflatex math fonts use more than 128 characters per font) – David Carlisle Jun 12 at 22:54
• If you just want to use your existing text font in math without setting up a new math font font set that's easier, does the font already include Greek? what encoding is it in? – David Carlisle Jun 12 at 23:03
• The font encoding is T1, and it does already include Greek letters. What's the difference between the output of \mathrm and regular text, and between math italic and regular italic (i.e. the one I get with \textit)? – noibe Jun 12 at 23:33
• T1 encoding does not include Greek. – David Carlisle Jun 13 at 0:09
• T1 is the encoding I chose when creating the tex font metrics with otftotfm. I think that the .otf includes greek because when I compile with XeLaTeX greek letters are available. To get them I could just run otftotfm again choosing a different encoding, but once I do that, how do I include it in my document? – noibe Jun 13 at 12:52

With mathastext the text font will be used for math. Make sure to place this package after the redefinition if the default font. If desired the italic option can be activated.

\documentclass{article}

\renewcommand{\rmdefault}{phv}

\usepackage[
%   italic,
symbolgreek
]{mathastext}

\begin{document}

text

$text \alpha$

\end{document}