4

When using a specific mono font in ConTeXt I want to have this font as \tt font which should also affect \mathtt. So how can I use my main tt font as math tt font?

MWE:

\definefontfamily [test] [rm] [TeX Gyre Pagella]
\definefontfamily [test] [mm] [TeX Gyre Pagella Math]
\definefontfamily [test] [tt] [Fira Mono]
\setupbodyfont    [test,12pt]

\starttext
Test \type{Text} with $\mathtt{TEST}$
\stoptext

which currently outputs:

strange mathtt

TeXnician
  • 33,589

1 Answers1

4

Set Fira Mono as fallback for the uppercasemonospace and lowercasemonospace range.

\definefontfamily [test] [rm] [TeX Gyre Pagella]
\definefallbackfamily [test] [mm] [Fira Mono] [offset=uppercasemonospace,range=uppercasenormal,force=yes]
\definefallbackfamily [test] [mm] [Fira Mono] [offset=lowercasemonospace,range=lowercasenormal,force=yes]
\definefontfamily [test] [mm] [TeX Gyre Pagella Math]
\definefontfamily [test] [tt] [Fira Mono]
\setupbodyfont    [test,12pt]

\starttext
Test \type{Text} with $\mathtt{TEST}$
\stoptext

enter image description here

Henri Menke
  • 109,596
  • Thanks for your answer. Is this documented anywhere (including the other possible options)? – TeXnician Apr 14 '19 at 07:50
  • @TeXnician https://wiki.contextgarden.net/Command/definefontfallback – Henri Menke Apr 14 '19 at 07:55
  • Thanks. Obviously I'm still missing some obvious associations :) – TeXnician Apr 14 '19 at 07:59
  • @TeXnician \definefontfamily and \definefallbackfamily only add name lookup on top of \definetypeface and \definefontfallback, respectively. My recommendation is to use the latter two, because name lookup is much slower than file lookup and relies on an up-to-date name database. – Henri Menke Apr 17 '19 at 23:08