Skip to content

Instantly share code, notes, and snippets.

@stedolan
Created May 19, 2020 15:55
Show Gist options
  • Save stedolan/63180048bd59b3c22e96f24345f24afd to your computer and use it in GitHub Desktop.
Save stedolan/63180048bd59b3c22e96f24345f24afd to your computer and use it in GitHub Desktop.
(require 'quail)
(setf mathematical-symbol-table '(
("&&" ?∩ "\\cap")
("&&" ?∧ "\\land")
("&&" ?⊓ "\\sqcap")
("&&n" ?⋂ "\\bigcap")
("&&n" ?⋀ "\\bigland")
("&&n" ?⨅ "\\bigsqcap")
("||" ?∪ "\\cup")
("||" ?∨ "\\lor")
("||" ?⊔ "\\sqcup")
("||n" ?⋃ "\\bigcup")
("||n" ?⋁ "\\biglor")
("||n" ?⨆ "\\bigsqcup")
("<=" ?≤ "\\leq")
("(=" ?⊆ "\\subseteq")
("[=" ?⊑ "\\sqsubseteq")
("<=/" ?≰ "\\not\\leq")
("(=/" ?⊈ "\\not\\subseteq")
("[=/" ?⋢ "\\sqsubseteq")
(">=" ?≥ "\\geq")
(")=" ?⊇ "\\supseteq")
("]=" ?⊒ "\\sqsupseteq")
(">=/" ?≱ "\\not\\geq")
(")=/" ?⊉ "\\not\\supseteq")
("]=/" ?⋣ "\\not\\sqsupseteq")
("=/" ?≠ "\neq")
("=-" ?≡ "\\equiv")
("=-/" ?≢ "\\not\\equiv")
("=~" ?≅ "\\cong")
("=~" ?≃ "\\simeq")
("_0" ?₀ "_0")
("_1" ?₁ "_1")
("_2" ?₂ "_2")
("_3" ?₃ "_3")
("_4" ?₄ "_4")
("^0" ?⁰ "^0")
("^1" ?¹ "^1")
("^2" ?² "^2")
("^3" ?³ "^3")
("^4" ?⁴ "^4")
("^+" ?⁺ "^{+}")
("^-" ?⁻ "^{-}")
("|=" ?⊧ "\\models")
("|-" ?⊢ "\\vdash")
(",~" ?¬ "\\not")
(",A" ?∀ "\\forall")
(",E" ?∃ "\\exists")
(",E/" ?∄ "\\not\\exists")
(",e" ?∈ "\\in")
(",e/" ?∉ "\\notin")
;; Greek letters, upper and lower case
(";a" ?α "\\alpha")
(";b" ?β "\\beta")
(";c" ?γ "\\gamma")
(";g" ?γ "\\gamma")
(";d" ?δ "\\delta")
(";e" ?ε "\\epsilon")
(";z" ?ζ "\\zeta")
(";h" ?η "\\eta")
(";q" ?θ "\\theta")
(";i" ?ι "\\iota")
(";k" ?κ "\\kappa")
(";l" ?λ "\\lambda")
(";m" ?μ "\\mu")
(";n" ?ν "\\nu")
(";j" ?ξ "\\xi")
(";o" ?ο "\\omicron")
(";p" ?π "\\pi")
(";r" ?ρ "\\rho")
(";s" ?σ "\\sigma")
(";t" ?τ "\\tau")
(";y" ?υ "\\upsilon")
(";u" ?υ "\\upsilon")
(";f" ?φ "\\phi")
(";x" ?χ "\\chi")
(";v" ?ψ "\\psi")
(";w" ?ω "\\omega")
(";A" ?Α "\\Alpha")
(";B" ?Β "\\Beta")
(";C" ?Γ "\\Gamma")
(";G" ?Γ "\\Gamma")
(";D" ?Δ "\\Delta")
(";E" ?Ε "\\Epsilon")
(";Z" ?Ζ "\\Zeta")
(";H" ?Η "\\Eta")
(";Q" ?Θ "\\Theta")
(";I" ?Ι "\\Iota")
(";K" ?Κ "\\Kappa")
(";L" ?Λ "\\Lambda")
(";M" ?Μ "\\Mu")
(";N" ?Ν "\\Nu")
(";J" ?Ξ "\\Xi")
(";O" ?Ο "\\Omicron")
(";P" ?Π "\\Pi")
(";R" ?Ρ "\\Rho")
(";S" ?Σ "\\Sigma")
(";T" ?Τ "\\Tau")
(";Y" ?Υ "\\Upsilon")
(";U" ?Υ "\\Upsilon")
(";F" ?Φ "\\Phi")
(";X" ?Χ "\\Chi")
(";V" ?Ψ "\\Psi")
(";W" ?Ω "\\Omega")
;; Blackboard-bold (double-struck) letters, upper and lower case
(";AA" ?𝔸 "\\mathbb{A}")
(";BB" ?𝔹 "\\mathbb{B}")
(";CC" ?ℂ "\\mathbb{C}")
(";DD" ?𝔻 "\\mathbb{D}")
(";EE" ?𝔼 "\\mathbb{E}")
(";FF" ?𝔽 "\\mathbb{F}")
(";GG" ?𝔾 "\\mathbb{G}")
(";HH" ?ℍ "\\mathbb{H}")
(";II" ?𝕀 "\\mathbb{I}")
(";JJ" ?𝕁 "\\mathbb{J}")
(";KK" ?𝕂 "\\mathbb{K}")
(";LL" ?𝕃 "\\mathbb{L}")
(";MM" ?𝕄 "\\mathbb{M}")
(";NN" ?ℕ "\\mathbb{N}")
(";OO" ?𝕆 "\\mathbb{O}")
(";PP" ?ℙ "\\mathbb{P}")
(";QQ" ?ℚ "\\mathbb{Q}")
(";RR" ?ℝ "\\mathbb{R}")
(";SS" ?𝕊 "\\mathbb{S}")
(";TT" ?𝕋 "\\mathbb{T}")
(";UU" ?𝕌 "\\mathbb{U}")
(";VV" ?𝕍 "\\mathbb{V}")
(";WW" ?𝕎 "\\mathbb{W}")
(";XX" ?𝕏 "\\mathbb{X}")
(";YY" ?𝕐 "\\mathbb{Y}")
(";ZZ" ?ℤ "\\mathbb{Z}")
(";aa" ?𝕒 "\\mathbb{a}")
(";bb" ?𝕓 "\\mathbb{b}")
(";cc" ?𝕔 "\\mathbb{c}")
(";dd" ?𝕕 "\\mathbb{d}")
(";ee" ?𝕖 "\\mathbb{e}")
(";ff" ?𝕗 "\\mathbb{f}")
(";gg" ?𝕘 "\\mathbb{g}")
(";hh" ?𝕙 "\\mathbb{h}")
(";ii" ?𝕚 "\\mathbb{i}")
(";jj" ?𝕛 "\\mathbb{j}")
(";kk" ?𝕜 "\\mathbb{k}")
(";ll" ?𝕝 "\\mathbb{l}")
(";mm" ?𝕞 "\\mathbb{m}")
(";nn" ?𝕟 "\\mathbb{n}")
(";oo" ?𝕠 "\\mathbb{o}")
(";pp" ?𝕡 "\\mathbb{p}")
(";qq" ?𝕢 "\\mathbb{q}")
(";rr" ?𝕣 "\\mathbb{r}")
(";ss" ?𝕤 "\\mathbb{s}")
(";tt" ?𝕥 "\\mathbb{t}")
(";uu" ?𝕦 "\\mathbb{u}")
(";vv" ?𝕧 "\\mathbb{v}")
(";ww" ?𝕨 "\\mathbb{w}")
(";xx" ?𝕩 "\\mathbb{x}")
(";yy" ?𝕪 "\\mathbb{y}")
(";zz" ?𝕫 "\\mathbb{z}")
;; Caligraphic (script) letters, upper and lower case
(";;A" ?𝓐 "\\mathcal{A}")
(";;B" ?𝓑 "\\mathcal{B}")
(";;C" ?𝓒 "\\mathcal{C}")
(";;D" ?𝓓 "\\mathcal{D}")
(";;E" ?𝓔 "\\mathcal{E}")
(";;F" ?𝓕 "\\mathcal{F}")
(";;G" ?𝓖 "\\mathcal{G}")
(";;H" ?𝓗 "\\mathcal{H}")
(";;I" ?𝓘 "\\mathcal{I}")
(";;J" ?𝓙 "\\mathcal{J}")
(";;K" ?𝓚 "\\mathcal{K}")
(";;L" ?𝓛 "\\mathcal{L}")
(";;M" ?𝓜 "\\mathcal{M}")
(";;N" ?𝓝 "\\mathcal{N}")
(";;O" ?𝓞 "\\mathcal{O}")
(";;P" ?𝓟 "\\mathcal{P}")
(";;Q" ?𝓠 "\\mathcal{Q}")
(";;R" ?𝓡 "\\mathcal{R}")
(";;S" ?𝓢 "\\mathcal{S}")
(";;T" ?𝓣 "\\mathcal{T}")
(";;U" ?𝓤 "\\mathcal{U}")
(";;V" ?𝓥 "\\mathcal{V}")
(";;W" ?𝓦 "\\mathcal{W}")
(";;X" ?𝓧 "\\mathcal{X}")
(";;Y" ?𝓨 "\\mathcal{Y}")
(";;Z" ?𝓩 "\\mathcal{Z}")
(";;a" ?𝓪 "\\mathcal{a}")
(";;b" ?𝓫 "\\mathcal{b}")
(";;c" ?𝓬 "\\mathcal{c}")
(";;d" ?𝓭 "\\mathcal{d}")
(";;e" ?𝓮 "\\mathcal{e}")
(";;f" ?𝓯 "\\mathcal{f}")
(";;g" ?𝓰 "\\mathcal{g}")
(";;h" ?𝓱 "\\mathcal{h}")
(";;i" ?𝓲 "\\mathcal{i}")
(";;j" ?𝓳 "\\mathcal{j}")
(";;k" ?𝓴 "\\mathcal{k}")
(";;l" ?𝓵 "\\mathcal{l}")
(";;m" ?𝓶 "\\mathcal{m}")
(";;n" ?𝓷 "\\mathcal{n}")
(";;o" ?𝓸 "\\mathcal{o}")
(";;p" ?𝓹 "\\mathcal{p}")
(";;q" ?𝓺 "\\mathcal{q}")
(";;r" ?𝓻 "\\mathcal{r}")
(";;s" ?𝓼 "\\mathcal{s}")
(";;t" ?𝓽 "\\mathcal{t}")
(";;u" ?𝓾 "\\mathcal{u}")
(";;v" ?𝓿 "\\mathcal{v}")
(";;w" ?𝔀 "\\mathcal{w}")
(";;x" ?𝔁 "\\mathcal{x}")
(";;y" ?𝔂 "\\mathcal{y}")
(";;z" ?𝔃 "\\mathcal{z}")
(";1" ?⊤ "\\top")
(";0" ?⊥ "\\bot")
("->" ?→ "\\rightarrow")
("=>" ?⇒ "\\Rightarrow")
("==>" ?⟹ "\\Longrightarrow")
("-->" ?⟶ "\\longrightarrow")
("+o" ?⊕ "\\oplus")
("*o" ?⊛ "?")
("*" ?* "^{\\ast}")
("*x" ?× "\\times")
("*o" ?⊗ "\\otimes")
(",o" ?∘ "\\circ")
(",d" ?∂ "\\partial")
(";." ?⋅ "\\cdot")
("[|" ?⟦ "\\llbracket")
("|]" ?⟧ "\\rrbracket")
("[^" ?⌈ "\\lceil{}")
("^]" ?⌉ "\\rceil{}")
(",S" ?∫ "\\int")
))
(quail-define-package
"mathematical-symbols" "Mathematics" "⨕" t
"Input method for various mathematical symbols"
nil nil nil t t nil nil nil nil nil t)
(let ((rules (mapcar (lambda (x) (pcase x (`(,keys ,ch ,latex) (list keys ch))))
mathematical-symbol-table)))
(eval `(quail-define-rules . ,rules)))
(defun print-mathematical-symbol-table ()
(princ (mapconcat
(lambda (x) (pcase x (`(,keys ,ch ,latex) (format "%c %s\n" ch latex))))
mathematical-symbol-table "")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment