add preambles, update iterm conf

This commit is contained in:
2023-12-14 23:37:16 -08:00
parent 196c9c767f
commit a51e8e3676
3 changed files with 52 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
# Copy to ~/.global.sage
from subprocess import run
ht_filename = "/tmp/mathtemp.html"
def wv(expr):
"""
View an expression as LaTeX -> mathjax+html in a browser tab
"""
with open(ht_filename, "w") as f:
f.write(f"""
<!DOCTYPE html>
<html>
<meta charset="UTF-8" />
<head><title>vis</title></head>
<body>
<div style="font-size:140%;margin-top:30px;">
$${latex(expr)}$$
</div>
</body>
<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>
</html>
""")
run(["open", ht_filename])