I cannot get it to work and I'm not sure what I'm doing wrong.
I've downloaded MathJax.js, created an html file and linked it to the js file appropriately. I even copied and pasted from a previously answered question on here and just changed the link from a vpn (the vpn didn't work either, but the question and response were over three years old) to the js file on my machine.
Here's what I have in my 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)
</body>
</html>
I would greatly appreciate any assistance.
Since HTML does not support embedded LaTeX, converting the LaTeX to MathML for use with MathJax is an acceptable means, however the problem then becomes one of converting the LaTeX to MathML and seamlessly converting the MathML for use by the HTML browser.
MathJax can display mathematical notation written in LaTeX or MathML markup. Because MathJax is meant only for math display, whereas LaTeX is a document layout language, MathJax only supports the subset of LaTeX used to describe mathematical notation.
There are a few problems.
For example
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
jax: ["input/TeX", "output/HTML-CSS"],
extensions: ["tex2jax.js"],
"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="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js"></script>
The definition of the Euler-Mascheroni constant is
$\gamma=\lim_{n\to\infty}\left(\sum_{k=1}^n\frac1k-ln(n)\right) $
Caveat. I don't know what latest.js
should do and you seem to be using a local installation so be sure to check the docs for that, http://docs.mathjax.org/en/latest/installation.html.
Here is a file I constructed from the documentation examples
<html>
<head>
<!-- See http://docs.mathjax.org/en/latest/web/start.html#using-mathjax-from-a-content-delivery-network-cdn -->
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
</head>
<body>
<p>
From the <a href="https://www.w3.org/Math/MJ/Overview.html">overview docs</a>, in MathML: Let's consider <math><mi>a</mi><mo>≠</mo><mn>0</mn></math>.
</p>
<p>
With <a href="http://docs.mathjax.org/en/latest/basic/mathematics.html">\(\LaTeX\) input</a>:
When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
</p>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With