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

问题描述 投票:0回答:1

我通过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文件的引用,但该文件未包含在我的下载文件中。

mathjax
1个回答
0
投票

您指定文件“ 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>
© www.soinside.com 2019 - 2024. All rights reserved.