如何更改MathJax的字体

如何更改MathJax的字体

本文介绍了如何更改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:

这是我正在用作测试用例的完整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

我必须更改文件以使用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的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 11:15