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

MathJax download cannot load in a local web page

我通过 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 文档中 link 的文件。我在其他地方看到了对 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>