我无法让它工作,我不确定我做错了什么。
我已经下载了 MathJax.js,创建了一个 html 文件并将其适当地链接到 js 文件。我什至从这里复制并粘贴了之前回答的问题,然后将链接从 VPN(VPN 也不起作用,但问题和响应已经存在三年多了)更改为我机器上的 js 文件。
这是我的 html 中的内容:
<html>
<head>
<title>MathJax</title>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({"HTML-CSS": { preferredFont: "TeX", availableFonts: ["STIX","TeX"] },
tex2jax: { inlineMath: [ ["$", "$"], ["\\\\(","\\\\)"] ], displayMath: [ ["$$","$$"], ["\\[", "\\]"] ], processEscapes: true, ignoreClass: "tex2jax_ignore|dno" },
TeX: { noUndefined: { attributes: { mathcolor: "red", mathbackground: "#FFEEEE", mathsize: "90%" } } },
messageStyle: "none"
});
</script>
<script type="text/javascript" src="MathJax.js"></script>
<script type="text/javascript" src="latest.js"></script>
</head>
<body>
The definition of the Euler-Mascheroni constant is
\gamma=\lim_{n\to\infty}\left(\sum_{k=1}^n\frac1k-ln(n)\right) …Run Code Online (Sandbox Code Playgroud) 这是一个 Rails 中的应用程序。
这是我在“路线”中的内容:
resources :destinations
Run Code Online (Sandbox Code Playgroud)
这是我在“destinations_controller”中的内容:
def show
@destination = Destination.find(params[:id])
end
Run Code Online (Sandbox Code Playgroud)
这是我在“views/destinations/show.html.erb”中的内容:
<h2><%= @destination.latitude %></h2>
<script>
var dest_lat = <%= @destination.latitude %>
</script>
Run Code Online (Sandbox Code Playgroud)
这是我在“application.js”中的内容:
var dest_location = {dest_lat};
Run Code Online (Sandbox Code Playgroud)
这是我第三次构建这个应用程序。最初,我没有收到任何错误,所有编码都工作正常......几个小时。然后,在我不进行任何更改的情况下,@destination.latitude 中的值仍然出现在 h2 标记中,但我开始收到错误:
Uncaught ReferenceError: dest_lat is not defined
Run Code Online (Sandbox Code Playgroud)
带有显示其在“application.js”中使用的链接,并且该应用程序停止工作。
为什么?
任何帮助表示赞赏。