如何更改MathJax的字体 [英] How to change font for MathJax

查看:604
本文介绍了如何更改MathJax的字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法获得MathJax来更改用于渲染用AsciiMath编写的公式的字体.我已经在StackOverflow和网络上的其他地方阅读了类似问题的答案:

I am unable to get MathJax to change the font that it is using to render formulas written in AsciiMath. I have read the answers to similar questions here at StackOverflow and other places on the web:

  • Styling MathJax
  • Changing mathjax's font size
  • MathJax font matching and pairing
  • Can MathJax use font xxxx?

这是我正在用作测试用例的完整HTML5文档:

Here is an entire HTML5 document that I am using as a test case:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>MathJax Font</title>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
    "CommonHTML" : { preferredFont:"Asana Math" }
});
</script>

<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=AM_CHTML"></script>
</head>

<body>
<p>`v = pi r^2`</p>
</body>
</html>

我做错了什么?请帮我更改MathJax的字体.

What am I doing wrong? Please help me change the font for MathJax.

推荐答案

我在 docs.mathjax.org/en/latest/output.html

CommonHTML输出处理器可在所有现代浏览器中产生高质量的输出,其结果在浏览器和操作系统之间是一致的.这是自MathJax v2.6起的MathJax的主要输出模式.它的主要优点是质量,一致性和速度以及对服务器端生成的支持.它的浏览器支持从IE9和等效的浏览器开始,并且在较旧的浏览器上正常降级. CommonHTML输出使用基于Web的字体,因此用户不必在计算机上安装数学字体.目前仅支持MathJax的默认TeX字体.

The CommonHTML output processor produces high-quality output in all modern browsers, with results that are consistent across browsers and operating systems. This is MathJax’s primary output mode since MathJax v2.6. Its major advantage is its quality, consistency, and speed as well as support for server-side generation. Its browser supports starts with IE9 and equivalent browsers and it degrades gracefully on older browsers. The CommonHTML output uses web-based fonts so that users don’t have to have math fonts installed on their computers. It currently only supports MathJax’s default TeX fonts.

我必须更改文件以使用HTML-CSS输出处理器而不是CommonHTML输出处理器.更改后,我的测试文件现在如下所示:

I had to change my file to use the HTML-CSS output processor instead of the CommonHTML output processor. After the change my test file now looks like this:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>MathJax Font</title>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
    "HTML-CSS" : {
        availableFonts : ["STIX"],
        preferredFont : "STIX",
        webFont : "STIX-Web",
        imageFont : null
    }
});
</script>

<script type="text/javascript"
    src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=AM_HTMLorMML"></script>
</head>

<body>
<p>`v = pi r^2`</p>
</body>
</html>

这篇关于如何更改MathJax的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆