MathJax 下载无法在本地网页中加载



我通过Git下载了MathJax的最新副本,将其安装在某个地方,并编写了以下文档:

<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Notes - Wenke's Patterns in Prehistory</title>
<script id="MathJax-script" async src="../../../../MathJax/e5/tex-chtml.js">
</script>
</head>
<body>
$ e^i $
</body>
</html>

当我尝试在浏览器中运行它时,控制台会打印消息Loading failed for the <script> with source “file:///home/username/underconstruction/MathJax/e5/tex-chtml.js”..

我相信下载附带的README.md文件表明tex-chtml.js应该是要在HTML文档中链接的文件。 我在其他地方看到过对MathJax.js文件的引用,但这不包括在我的下载中。

指定位置 ("../..")文件"tex-chtml.js"相对于包含 $e^i$ 的 HTML 页面的位置。该文件可能不存在,如警告消息所示。如果指定相对于当前 HTML 页面的路径,还要确保本地主机和服务器上的相对路径相同。

在 https://www.mathjax.org 上给出了使用MathJax的简单方法。 你不需要从任何地方下载MathJax。只需在 HTML 文件中包含以下行:

<head>    
<script>
MathJax = {tex: {inlineMath: [['$', '$'], ['\(', '\)']]}};
</script> 
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</head>

最新更新