Testing MathJax

TL;DJ MathJax is a nice tool to add equations on websites! I learned about it from this Twitter post.

Here’s a test of an equation I used in a previous post but pasted as a PNG instead of knowing how to write the equation

$$P ∝ {1\over λ^4}.$$

This is text after the equation. In the first edit I just did a few carriage returns in the top sentence, and the formula was still below all the text. Now this is a new text block and it will show after.

This is the code I used to get the formula above.

  <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>
<body>
<p>
  $$P ∝ {1\over λ^4}.$$
</p>

It’s from a larger chunk of code provided in jsbin from the getting started page on mathjax; I choose to skip the html sections that I think are already addressed in the website, and my assumption was that I can just run the inline script instead of adding global sections.

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>MathJax example</title>
  <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>
<body>
<p>
  $$P ∝ {1\over λ^4}.$$
  </p>
</body>
</html>

I did have to get the lambda sign and I took that from the keyboard instead of the equation editor in Word, which is what I used to make the PNG.

From the top taskbar in macOS clicking the flag for keyboard options &gt; Show Emoji &amp; Symbols

From the top taskbar in macOS clicking the flag for keyboard options > Show Emoji & Symbols