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

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

| improve this answer | |
  • Thanks for your answer. Is this documented anywhere (including the other possible options)? – TeXnician Apr 14 '19 at 7:50
  • Thanks. Obviously I'm still missing some obvious associations :) – TeXnician Apr 14 '19 at 7: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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.