1

I am using ConTeXt with LuaTeX to compile mathml. I would like to change the MathML fonts to a OTF Font. Please advice how this could be done. I have included a sample code below.

\usemodule[mathml]
\usemodule[newmml]
\setupbodyfontenvironment[default][em=italic]
\usemodule[simplefonts][size=10pt]
\setmainfont[Futura]
\setsansfont[Helvetica]
\setmonofont[Helvetica]
\starttext
This is sample text
\xmlprocessdata{}{
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mi>a</mi><mo>+</mo><mi>b</mi>
</mrow>
</math>
}{}
\stoptext
  • Wouldn't this be easiest to do afterwards via CSS? – Loop Space Jun 20 '14 at 6:45
  • Which version of ConTeXt are you using (see output of context --version)? The above example works fine for me (with ConTeXt MkIV 2014.04.24). – Aditya Jun 20 '14 at 13:05
  • Or is the question simply asking how to use Opentype Math fonts? – Aditya Jun 20 '14 at 13:09
  • I am using ConTeXt MkIV, the opentype mathfont is not applied to the math equations when I compile and create pdf. I like to know the macro to apply the fonts for math equations – Rasul Jun 20 '14 at 13:59
  • 1
    You have not set an math font! Use \setmathfont[...] to set the math font. By the way, in recent versions of context, the functionality of the simpleslides module is now part of te core, but with a slightly different syntax – Aditya Jun 21 '14 at 21:01
3

The simplefonts module has been superseded by \definefontfamily. The newmml module is MkII-only and just loads the mathml module in MkIV.

Because I don't own any of the proprietary typefaces in your question I substituted Futura with Open Sans and Helvetica with TeX Gyre Heros. To show that Unicode math fonts work well, I selected TeX Gyre Pagella Math.

\usemodule[mathml]
\definefontfamily [mainface] [rm] [Open Sans]
\definefontfamily [mainface] [ss] [TeX Gyre Heros]
\definefontfamily [mainface] [tt] [TeX Gyre Heros]
\definefontfamily [mainface] [mm] [TeX Gyre Pagella Math]
\setupbodyfont[mainface]
\starttext
This is sample text
\xmlprocessdata{}{
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
  <mrow>
  <mi>a</mi><mo>+</mo><mi>b</mi>
  </mrow>
  </math>
}{}
\stoptext

enter image description here

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.