From 88afeeeafcf018e3eecbcc9be46e227eb312d45a Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Thu, 20 Aug 2015 07:56:09 +0200 Subject: [PATCH] Add a prettify-symbols-alist for (La)TeX * tex-mode.el (tex-prettify-symbols-alist): New variable holding an alist suitable as prettify-symbols-alist in (La)TeX modes. --- lisp/textmodes/tex-mode.el | 455 +++++++++++++++++++++++++++++++++++++ 1 file changed, 455 insertions(+) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 535b8857677..54783869403 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -2943,6 +2943,461 @@ There might be text before point." (setq-local syntax-propertize-function (syntax-propertize-rules doctex-syntax-propertize-rules))) +;;; Prettify Symbols Support + +(defvar tex-prettify-symbols-alist + '( ;; Lowercase Greek letters. + ("\\alpha" . ?α) + ("\\beta" . ?β) + ("\\gamma" . ?γ) + ("\\delta" . ?δ) + ("\\epsilon" . ?ε) + ("\\zeta" . ?ζ) + ("\\eta" . ?η) + ("\\theta" . ?θ) + ("\\iota" . ?ι) + ("\\kappa" . ?κ) + ("\\lambda" . ?λ) + ("\\mu" . ?μ) + ("\\nu" . ?ν) + ("\\xi" . ?ξ) + ;; There is no \omicron becase it looks like a latin o. + ("\\pi" . ?π) + ("\\rho" . ?ρ) + ("\\sigma" . ?σ) + ("\\tau" . ?τ) + ("\\upsilon" . ?υ) + ("\\phi" . ?φ) + ("\\chi" . ?χ) + ("\\psi" . ?ψ) + ("\\omega" . ?ω) + ;; Uppercase Greek letters. + ("\\Gamma" . ?Γ) + ("\\Delta" . ?Δ) + ("\\Lambda" . ?Λ) + ("\\Phi" . ?Φ) + ("\\Pi" . ?Π) + ("\\Psi" . ?Ψ) + ("\\Sigma" . ?Σ) + ("\\Theta" . ?Θ) + ("\\Upsilon" . ?Υ) + ("\\Xi" . ?Ξ) + ("\\Omega" . ?Ω) + + ;; Other math symbols (taken from leim/quail/latin-ltx.el). + ("\\Box" . ?□) + ("\\Bumpeq" . ?≎) + ("\\Cap" . ?⋒) + ("\\Cup" . ?⋓) + ("\\Diamond" . ?◇) + ("\\Downarrow" . ?⇓) + ("\\H{o}" . ?ő) + ("\\Im" . ?ℑ) + ("\\Join" . ?⋈) + ("\\Leftarrow" . ?⇐) + ("\\Leftrightarrow" . ?⇔) + ("\\Ll" . ?⋘) + ("\\Lleftarrow" . ?⇚) + ("\\Longleftarrow" . ?⇐) + ("\\Longleftrightarrow" . ?⇔) + ("\\Longrightarrow" . ?⇒) + ("\\Lsh" . ?↰) + ("\\Re" . ?ℜ) + ("\\Rightarrow" . ?⇒) + ("\\Rrightarrow" . ?⇛) + ("\\Rsh" . ?↱) + ("\\Subset" . ?⋐) + ("\\Supset" . ?⋑) + ("\\Uparrow" . ?⇑) + ("\\Updownarrow" . ?⇕) + ("\\Vdash" . ?⊩) + ("\\Vert" . ?‖) + ("\\Vvdash" . ?⊪) + ("\\aleph" . ?ℵ) + ("\\amalg" . ?∐) + ("\\angle" . ?∠) + ("\\approx" . ?≈) + ("\\approxeq" . ?≊) + ("\\ast" . ?∗) + ("\\asymp" . ?≍) + ("\\backcong" . ?≌) + ("\\backepsilon" . ?∍) + ("\\backprime" . ?‵) + ("\\backsim" . ?∽) + ("\\backsimeq" . ?⋍) + ("\\backslash" . ?\\) + ("\\barwedge" . ?⊼) + ("\\because" . ?∵) + ("\\beth" . ?ℶ) + ("\\between" . ?≬) + ("\\bigcap" . ?⋂) + ("\\bigcirc" . ?◯) + ("\\bigcup" . ?⋃) + ("\\bigstar" . ?★) + ("\\bigtriangledown" . ?▽) + ("\\bigtriangleup" . ?△) + ("\\bigvee" . ?⋁) + ("\\bigwedge" . ?⋀) + ("\\blacklozenge" . ?✦) + ("\\blacksquare" . ?▪) + ("\\blacktriangle" . ?▴) + ("\\blacktriangledown" . ?▾) + ("\\blacktriangleleft" . ?◂) + ("\\blacktriangleright" . ?▸) + ("\\bot" . ?⊥) + ("\\bowtie" . ?⋈) + ("\\boxminus" . ?⊟) + ("\\boxplus" . ?⊞) + ("\\boxtimes" . ?⊠) + ("\\bullet" . ?•) + ("\\bumpeq" . ?≏) + ("\\cap" . ?∩) + ("\\cdots" . ?⋯) + ("\\centerdot" . ?·) + ("\\checkmark" . ?✓) + ("\\chi" . ?χ) + ("\\circ" . ?∘) + ("\\circeq" . ?≗) + ("\\circlearrowleft" . ?↺) + ("\\circlearrowright" . ?↻) + ("\\circledR" . ?®) + ("\\circledS" . ?Ⓢ) + ("\\circledast" . ?⊛) + ("\\circledcirc" . ?⊚) + ("\\circleddash" . ?⊝) + ("\\clubsuit" . ?♣) + ("\\coloneq" . ?≔) + ("\\complement" . ?∁) + ("\\cong" . ?≅) + ("\\coprod" . ?∐) + ("\\cup" . ?∪) + ("\\curlyeqprec" . ?⋞) + ("\\curlyeqsucc" . ?⋟) + ("\\curlypreceq" . ?≼) + ("\\curlyvee" . ?⋎) + ("\\curlywedge" . ?⋏) + ("\\curvearrowleft" . ?↶) + ("\\curvearrowright" . ?↷) + ("\\dag" . ?†) + ("\\dagger" . ?†) + ("\\daleth" . ?ℸ) + ("\\dashv" . ?⊣) + ("\\ddag" . ?‡) + ("\\ddagger" . ?‡) + ("\\ddots" . ?⋱) + ("\\diamond" . ?⋄) + ("\\diamondsuit" . ?♢) + ("\\divideontimes" . ?⋇) + ("\\doteq" . ?≐) + ("\\doteqdot" . ?≑) + ("\\dotplus" . ?∔) + ("\\dotsquare" . ?⊡) + ("\\downarrow" . ?↓) + ("\\downdownarrows" . ?⇊) + ("\\downleftharpoon" . ?⇃) + ("\\downrightharpoon" . ?⇂) + ("\\ell" . ?ℓ) + ("\\emptyset" . ?∅) + ("\\eqcirc" . ?≖) + ("\\eqcolon" . ?≕) + ("\\eqslantgtr" . ?⋝) + ("\\eqslantless" . ?⋜) + ("\\equiv" . ?≡) + ("\\exists" . ?∃) + ("\\fallingdotseq" . ?≒) + ("\\flat" . ?♭) + ("\\forall" . ?∀) + ("\\frown" . ?⌢) + ("\\ge" . ?≥) + ("\\geq" . ?≥) + ("\\geqq" . ?≧) + ("\\geqslant" . ?≥) + ("\\gets" . ?←) + ("\\gg" . ?≫) + ("\\ggg" . ?⋙) + ("\\gimel" . ?ℷ) + ("\\gnapprox" . ?⋧) + ("\\gneq" . ?≩) + ("\\gneqq" . ?≩) + ("\\gnsim" . ?⋧) + ("\\gtrapprox" . ?≳) + ("\\gtrdot" . ?⋗) + ("\\gtreqless" . ?⋛) + ("\\gtreqqless" . ?⋛) + ("\\gtrless" . ?≷) + ("\\gtrsim" . ?≳) + ("\\gvertneqq" . ?≩) + ("\\hbar" . ?ℏ) + ("\\heartsuit" . ?♥) + ("\\hookleftarrow" . ?↩) + ("\\hookrightarrow" . ?↪) + ("\\iff" . ?⇔) + ("\\imath" . ?ı) + ("\\in" . ?∈) + ("\\infty" . ?∞) + ("\\int" . ?∫) + ("\\intercal" . ?⊺) + ("\\langle" . 10216) ; Literal ?⟨ breaks indentation. + ("\\lbrace" . ?{) + ("\\lbrack" . ?\[) + ("\\lceil" . ?⌈) + ("\\ldots" . ?…) + ("\\le" . ?≤) + ("\\leadsto" . ?↝) + ("\\leftarrow" . ?←) + ("\\leftarrowtail" . ?↢) + ("\\leftharpoondown" . ?↽) + ("\\leftharpoonup" . ?↼) + ("\\leftleftarrows" . ?⇇) + ;; ("\\leftparengtr" ?〈), see bug#12948. + ("\\leftrightarrow" . ?↔) + ("\\leftrightarrows" . ?⇆) + ("\\leftrightharpoons" . ?⇋) + ("\\leftrightsquigarrow" . ?↭) + ("\\leftthreetimes" . ?⋋) + ("\\leq" . ?≤) + ("\\leqq" . ?≦) + ("\\leqslant" . ?≤) + ("\\lessapprox" . ?≲) + ("\\lessdot" . ?⋖) + ("\\lesseqgtr" . ?⋚) + ("\\lesseqqgtr" . ?⋚) + ("\\lessgtr" . ?≶) + ("\\lesssim" . ?≲) + ("\\lfloor" . ?⌊) + ("\\lhd" . ?◁) + ("\\rhd" . ?▷) + ("\\ll" . ?≪) + ("\\llcorner" . ?⌞) + ("\\lnapprox" . ?⋦) + ("\\lneq" . ?≨) + ("\\lneqq" . ?≨) + ("\\lnsim" . ?⋦) + ("\\longleftarrow" . ?←) + ("\\longleftrightarrow" . ?↔) + ("\\longmapsto" . ?↦) + ("\\longrightarrow" . ?→) + ("\\looparrowleft" . ?↫) + ("\\looparrowright" . ?↬) + ("\\lozenge" . ?✧) + ("\\lq" . ?‘) + ("\\lrcorner" . ?⌟) + ("\\ltimes" . ?⋉) + ("\\lvertneqq" . ?≨) + ("\\maltese" . ?✠) + ("\\mapsto" . ?↦) + ("\\measuredangle" . ?∡) + ("\\mho" . ?℧) + ("\\mid" . ?∣) + ("\\models" . ?⊧) + ("\\mp" . ?∓) + ("\\multimap" . ?⊸) + ("\\nLeftarrow" . ?⇍) + ("\\nLeftrightarrow" . ?⇎) + ("\\nRightarrow" . ?⇏) + ("\\nVDash" . ?⊯) + ("\\nVdash" . ?⊮) + ("\\nabla" . ?∇) + ("\\napprox" . ?≉) + ("\\natural" . ?♮) + ("\\ncong" . ?≇) + ("\\ne" . ?≠) + ("\\nearrow" . ?↗) + ("\\neg" . ?¬) + ("\\neq" . ?≠) + ("\\nequiv" . ?≢) + ("\\newline" . ?
) + ("\\nexists" . ?∄) + ("\\ngeq" . ?≱) + ("\\ngeqq" . ?≱) + ("\\ngeqslant" . ?≱) + ("\\ngtr" . ?≯) + ("\\ni" . ?∋) + ("\\nleftarrow" . ?↚) + ("\\nleftrightarrow" . ?↮) + ("\\nleq" . ?≰) + ("\\nleqq" . ?≰) + ("\\nleqslant" . ?≰) + ("\\nless" . ?≮) + ("\\nmid" . ?∤) + ;; ("\\not" ?̸) ;FIXME: conflict with "NOT SIGN" ¬. + ("\\notin" . ?∉) + ("\\nparallel" . ?∦) + ("\\nprec" . ?⊀) + ("\\npreceq" . ?⋠) + ("\\nrightarrow" . ?↛) + ("\\nshortmid" . ?∤) + ("\\nshortparallel" . ?∦) + ("\\nsim" . ?≁) + ("\\nsimeq" . ?≄) + ("\\nsubset" . ?⊄) + ("\\nsubseteq" . ?⊈) + ("\\nsubseteqq" . ?⊈) + ("\\nsucc" . ?⊁) + ("\\nsucceq" . ?⋡) + ("\\nsupset" . ?⊅) + ("\\nsupseteq" . ?⊉) + ("\\nsupseteqq" . ?⊉) + ("\\ntriangleleft" . ?⋪) + ("\\ntrianglelefteq" . ?⋬) + ("\\ntriangleright" . ?⋫) + ("\\ntrianglerighteq" . ?⋭) + ("\\nvDash" . ?⊭) + ("\\nvdash" . ?⊬) + ("\\nwarrow" . ?↖) + ("\\odot" . ?⊙) + ("\\oint" . ?∮) + ("\\ominus" . ?⊖) + ("\\oplus" . ?⊕) + ("\\oslash" . ?⊘) + ("\\otimes" . ?⊗) + ("\\par" . ?
) + ("\\parallel" . ?∥) + ("\\partial" . ?∂) + ("\\perp" . ?⊥) + ("\\pitchfork" . ?⋔) + ("\\prec" . ?≺) + ("\\precapprox" . ?≾) + ("\\preceq" . ?≼) + ("\\precnapprox" . ?⋨) + ("\\precnsim" . ?⋨) + ("\\precsim" . ?≾) + ("\\prime" . ?′) + ("\\prod" . ?∏) + ("\\propto" . ?∝) + ("\\qed" . ?∎) + ("\\quad" . ? ) + ("\\rangle" . 10217) ; Literal ?⟩ breaks indentation. + ("\\rbrace" . ?}) + ("\\rbrack" . ?\]) + ("\\rceil" . ?⌉) + ("\\rfloor" . ?⌋) + ("\\rightarrow" . ?→) + ("\\rightarrowtail" . ?↣) + ("\\rightharpoondown" . ?⇁) + ("\\rightharpoonup" . ?⇀) + ("\\rightleftarrows" . ?⇄) + ("\\rightleftharpoons" . ?⇌) + ;; ("\\rightparengtr" ?⦔) ;; Was ?〉, see bug#12948. + ("\\rightrightarrows" . ?⇉) + ("\\rightthreetimes" . ?⋌) + ("\\risingdotseq" . ?≓) + ("\\rtimes" . ?⋊) + ("\\sbs" . ?﹨) + ("\\searrow" . ?↘) + ("\\setminus" . ?∖) + ("\\sharp" . ?♯) + ("\\shortmid" . ?∣) + ("\\shortparallel" . ?∥) + ("\\sim" . ?∼) + ("\\simeq" . ?≃) + ("\\smallamalg" . ?∐) + ("\\smallsetminus" . ?∖) + ("\\smallsmile" . ?⌣) + ("\\smile" . ?⌣) + ("\\spadesuit" . ?♠) + ("\\sphericalangle" . ?∢) + ("\\sqcap" . ?⊓) + ("\\sqcup" . ?⊔) + ("\\sqsubset" . ?⊏) + ("\\sqsubseteq" . ?⊑) + ("\\sqsupset" . ?⊐) + ("\\sqsupseteq" . ?⊒) + ("\\square" . ?□) + ("\\squigarrowright" . ?⇝) + ("\\star" . ?⋆) + ("\\straightphi" . ?φ) + ("\\subset" . ?⊂) + ("\\subseteq" . ?⊆) + ("\\subseteqq" . ?⊆) + ("\\subsetneq" . ?⊊) + ("\\subsetneqq" . ?⊊) + ("\\succ" . ?≻) + ("\\succapprox" . ?≿) + ("\\succcurlyeq" . ?≽) + ("\\succeq" . ?≽) + ("\\succnapprox" . ?⋩) + ("\\succnsim" . ?⋩) + ("\\succsim" . ?≿) + ("\\sum" . ?∑) + ("\\supset" . ?⊃) + ("\\supseteq" . ?⊇) + ("\\supseteqq" . ?⊇) + ("\\supsetneq" . ?⊋) + ("\\supsetneqq" . ?⊋) + ("\\surd" . ?√) + ("\\swarrow" . ?↙) + ("\\therefore" . ?∴) + ("\\thickapprox" . ?≈) + ("\\thicksim" . ?∼) + ("\\to" . ?→) + ("\\top" . ?⊤) + ("\\triangle" . ?▵) + ("\\triangledown" . ?▿) + ("\\triangleleft" . ?◃) + ("\\trianglelefteq" . ?⊴) + ("\\triangleq" . ?≜) + ("\\triangleright" . ?▹) + ("\\trianglerighteq" . ?⊵) + ("\\twoheadleftarrow" . ?↞) + ("\\twoheadrightarrow" . ?↠) + ("\\ulcorner" . ?⌜) + ("\\uparrow" . ?↑) + ("\\updownarrow" . ?↕) + ("\\upleftharpoon" . ?↿) + ("\\uplus" . ?⊎) + ("\\uprightharpoon" . ?↾) + ("\\upuparrows" . ?⇈) + ("\\urcorner" . ?⌝) + ("\\u{i}" . ?ĭ) + ("\\vDash" . ?⊨) + ("\\varprime" . ?′) + ("\\varpropto" . ?∝) + ;; ("\\varsigma" ?ς) ;FIXME: Looks reversed with the non\var. + ("\\vartriangleleft" . ?⊲) + ("\\vartriangleright" . ?⊳) + ("\\vdash" . ?⊢) + ("\\vdots" . ?⋮) + ("\\vee" . ?∨) + ("\\veebar" . ?⊻) + ("\\vert" . ?|) + ("\\wedge" . ?∧) + ("\\wp" . ?℘) + ("\\wr" . ?≀) + ("\\Bbb{N}" . ?ℕ) ; AMS commands for blackboard bold + ("\\Bbb{P}" . ?ℙ) ; Also sometimes \mathbb. + ("\\Bbb{R}" . ?ℝ) + ("\\Bbb{Z}" . ?ℤ) + ("--" . ?–) + ("---" . ?—) + ("\\ordfeminine" . ?ª) + ("\\ordmasculine" . ?º) + ("\\lambdabar" . ?ƛ) + ("\\celsius" . ?℃) + ("\\textmu" . ?µ) + ("\\textfractionsolidus" . ?⁄) + ("\\textbigcircle" . ?⃝) + ("\\textmusicalnote" . ?♪) + ("\\textdied" . ?✝) + ("\\textcolonmonetary" . ?₡) + ("\\textwon" . ?₩) + ("\\textnaira" . ?₦) + ("\\textpeso" . ?₱) + ("\\textlira" . ?₤) + ("\\textrecipe" . ?℞) + ("\\textinterrobang" . ?‽) + ("\\textpertenthousand" . ?‱) + ("\\textbaht" . ?฿) + ("\\textnumero" . ?№) + ("\\textdiscount" . ?⁒) + ("\\textestimated" . ?℮) + ("\\textopenbullet" . ?◦) + ("\\textlquill" . 8261) ; Literal ?⁅ breaks indentation. + ("\\textrquill" . 8262) ; Literal ?⁆ breaks indentation. + ("\\textcircledP" . ?℗) + ("\\textreferencemark" . ?※)) + "A `prettify-symbols-alist' usable for (La)TeX modes.") + (run-hooks 'tex-mode-load-hook) (provide 'tex-mode) -- 2.39.2