mirror of
https://github.com/turtlebasket/env.git
synced 2026-03-04 19:44:26 -08:00
add preambles, update iterm conf
This commit is contained in:
28
preamble/sagemath/global.sage
Normal file
28
preamble/sagemath/global.sage
Normal 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])
|
||||
|
||||
Reference in New Issue
Block a user