6

I'm trying to use typewriter font in math mode using iwona fonts, but the result ends up being typeset in the iwona text font. Here's an example:

\documentclass{article}
\usepackage[math]{iwona}
\usepackage[T1]{fontenc}
\begin{document}
\noindent
Math: $x^2+y^2=z^2$.\\
Texttt: \texttt{abcdefghijklmnopqrstuvwyz} \\
Mathtt: $\mathtt{abcdefghijklmnopqrstuvwyz}$
\end{document}

I would like the Mathtt line to look just like the Texttt line. Any ideas how to achieve this?

2
  • You can use \texttt{} in math mode. Is that an option for you, or do you need it in \mathtt? Jun 3, 2013 at 15:04
  • 1
    @StevenB.Segletes, in a few instances, the things I want typeset in mathtt will be in exponents or bases, in which case the sizes will be wrong. Try $x^{\texttt{y}}$ to see what I mean.
    – Pat Morin
    Jun 3, 2013 at 15:11

2 Answers 2

5

It seems like a bug in the iwona package.

\documentclass{article}
\usepackage[math]{iwona}
\SetMathAlphabet{\mathtt}{iwona}{OT1}{\ttdefault}{m}{n}
\usepackage[T1]{fontenc}
\begin{document}
\noindent
Math: $x^2+y^2=z^2$.\\
Texttt: \texttt{abcdefghijklmnopqrstuvwyz} \\
Mathtt: $\mathtt{abcdefghijklmnopqrstuvwyz}$
\end{document}

The package has \rmdefault instead of \ttdefault, which explains the unexpected behavior.

enter image description here

3
  • Thanks. This is even better (mathastext.sty isn't in the distribution I'm using).
    – Pat Morin
    Jun 3, 2013 at 19:39
  • @PatMorin I consider it a bug, as it does something completely unexpected. I can understand using \rmdefault for \mathrm, \mathit and \mathsf, as the default font is Iwona (which is sans serif) but not for \mathtt, which doesn't make sense.
    – egreg
    Jun 4, 2013 at 14:29
  • I don't disagree. It certainly wasn't what I was expecting.
    – Pat Morin
    Jun 4, 2013 at 18:11
6

This will give you typewriter text in \mathtt, while leaving the remainder of math mode unchanged (I believe).

EDITED to place fontenc first in line of the packages, which was suggested in a nice comment by jfbu, so as to make sure mathastext got applied to the OT1 math exclusions.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[math]{iwona}
\usepackage[italic]{mathastext}
\begin{document}
\noindent
Math: $x^2+y^2=z^2$.\\
Texttt:~ \texttt{abcdefghijklmnopqrstuvwxyz} \\
Mathtt: $\mathtt{abcdefghijklmnopqrstuvwxyz}$\\

$x^{y\mathtt{y}}$
\end{document}

enter image description here

1
  • 1
    it is better to move \usepackage[T1]{fontenc} to before mathastext, else the "mathastextification" will not apply to <, >, \ , |, {, } which are not available in OT1 encoding (except for mono-type fonts).
    – user4686
    Nov 10, 2015 at 20:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .