ConTeXt 用 LuaTeX 编译 mathml

ConTeXt 用 LuaTeX 编译 mathml

我正在使用 ConTeXt 和 LuaTeX 编译 mathml。我想将 MathML 字体更改为 OTF 字体。请指教如何做到这一点。我在下面附上了一个示例代码。

\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

答案1

simplefonts模块已被取代\definefontfamily。该newmml模块仅适用于 MkII,并且只需mathml在 MkIV 中加载模块。

由于我不拥有您问题中的任何专有字体,因此我用 Open Sans 替换了 Futura,用 TeX Gyre Heros 替换了 Helvetica。为了显示 Unicode 数学字体效果良好,我选择了 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

在此处输入图片描述

相关内容