Csikos Bela
11. Oktober 2016 um 21:52
Dear list members:

I would like to set up Tex Gyre Adventor sans serif font as my math font (even if it doesn't have
math symbols). I have two questions related to this problem.

1. In latex I can specify math font versions, define a specific font as math serif / normal, another as math
sans serif etc. (http://milde.users.sourceforge.net/LUCR/Math/math-font-selection.xhtml). Is this possible
in context, and if yes, how?
ConTeXt doesn’t use the same style switches as LaTeX.
2. If I specify Tex Gyre Adventor as default math font in context, I get compile error.
Here is a MWE, file name is mathfont.tex:

--------
\definefontfamily [mathfont] [sf] [Tex Gyre Bonum]
\definefontfamily [mathfont] [mm] [Tex Gyre Adventor]
\setupbodyfont[mathfont,10pt]

\starttext

Normal text.

\math{Inline math expression.}

Normal text.

\stoptext
--------
1. sf is not a valid argument for the second argument of \definefontfamily

2. You need a real math font for mathematics, a text font doesn’t work because it lacks many parameter for math mode.

3. You can use the font fallback mechanism to replace certain character in the math font with characters from a text font.

\definefontfamily     [mathfont] [rm] [Tex Gyre Bonum]
\definefallbackfamily [mathfont] [mm] [Tex Gyre Adventor] [preset=math:lowercaseitalic]
\definefallbackfamily [mathfont] [mm] [Tex Gyre Adventor] [tf=style:italic,range=0x068,offset=0x0210E]% Planck constant
\definefontfamily     [mathfont] [mm] [Tex Gyre Pagella Math]

\setupbodyfont[mathfont,10pt]

\starttext

Normal text.

\math{a + b = c}

\stoptext

Wolfgang