add preambles, update iterm conf

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

View File

@ -1214,7 +1214,7 @@
<key>Print In Black And White</key>
<true/>
<key>ShowFullScreenTabBar</key>
<false/>
<true/>
<key>SoundForEsc</key>
<false/>
<key>SplitPaneDimmingAmount</key>

23
preamble/latex/global.sty Normal file
View File

@ -0,0 +1,23 @@
\newcommand{\pderiv}[1] {\frac{\partial}{\partial #1}}
\newcommand{\pderivf}[2] {\frac{\partial #1}{\partial #2}}
\newcommand{\pderivs}[1] {\frac{\partial^2}{\partial {#1}^2}}
\newcommand{\pderivfs}[2] {\frac{\partial {#1}^2}{\partial {#2}^2}}
\newcommand{\pderivho}[2] {\frac{\partial^2}{\partial #1 \partial {#2}}}
\newcommand{\pderivfho}[3] {\frac{\partial^2 #1}{\partial #2 \partial #3}}
\newcommand{\deriv}[1] {\frac{\mathrm{d}}{\mathrm{d} #1}}
\newcommand{\derivs}[1] {\frac{\mathrm{d}^2}{\mathrm{d} {#1}^2}}
\newcommand{\derivf}[2] {\frac{\mathrm{d} #1}{\mathrm{d} #2}}
\newcommand{\derivfs}[2] {\frac{\mathrm{d} {#1}^2}{\mathrm{d} {#2}^2}}
\newcommand{\paren}[1] {\left( #1 \right)}
\newcommand{\anglebrack}[1] {\left\langle #1 \right\rangle}
\newcommand{\abrack}[1] {\left\langle #1 \right\rangle}
\newcommand{\curly}[1] {\left\{ #1 \right\}}
\newcommand{\curlybrack}[1] {\left\{ #1 \right\}}
\newcommand{\cbrack}[1] {\left\{ #1 \right\}}
\newcommand{\squarebrack}[1] {\left[ #1 \right]}
\newcommand{\sqbrack}[1] {\left[ #1 \right]}
\newcommand{\sbrack}[1] {\left[ #1 \right]}
\newcommand{\brackets}[1] {\left[ #1 \right]}
\newcommand{\d}[1]{\mathrm{d}#1}
\newcommand{\bb}[1] {\mathbb{#1}}

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])