Skip to content

Instantly share code, notes, and snippets.

@Nikolaj-K
Last active May 25, 2020 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nikolaj-K/00e425a2857cd4a0991f504d14276c30 to your computer and use it in GitHub Desktop.
Save Nikolaj-K/00e425a2857cd4a0991f504d14276c30 to your computer and use it in GitHub Desktop.
Minimal LaTeX rendering html scheme via MathJax for live viewing in a browser
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<!-- The following three lines are optional and taken directly from https://getbootstrap.com/docs/3.4/getting-started/>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
<!-- Browser support tools, also optional -->
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
</head>
<!-- A style value is also optional. Color picker here: https://www.w3schools.com/colors/colors_picker.asp-->
<body style="background-color:#eef2ff;">
<br>
Save this code as textfile with file ending html.<br>
Then just drag and drop the file into your browser.<br>
or explicitly enter the filepath into the browser bar, e.g. <i>file:///Users/Nikolaj-K/Documents/mathjax.html</i><br>
You'll find some html basics at
<a href="https://www.w3schools.com/">w3schools.com</a>.<br>
<br>
Now we can express random ideas like<br>
<br>
\(
\forall A.\ \emptyset \in A\ \lor\ \exists (f: A \to \bigcup A).\ \forall (x \in A).\ f(x) \in x
\)
<br>
<br>
or self-evident truths <a href="https://youtu.be/az2WOnxsLhc">such as</a><br>
<br>
\(
\int_0^\infty \dfrac{ {\mathrm d}x }{ 1 - {\mathrm e}^{2\pi\sqrt{x}} } = -\dfrac{1}{12}
\)
<br>
<br>
Or how about
<code>
Integrate[1 / (1-Exp[2Pi Sqrt@x]), {x, 0, Infinity}]
</code>
.
<br>
<br>
MathJax go brrrr!<br>
<br>
<br>
<br>
The minimal required html code to make \(a^2+b^2=c^2\) work is just the script element with mathjax.
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment