Subject: bug#77381: [PATCH] extend tex--prettify-symbols-alist

From: "Paul D. Nelson" <[email-masked]>
Date: Mon, 31 Mar 2025 22:38:39 +0200

Hi Arash, 

Thanks for your feedback concerning the accented characters --
I had no idea one could do this in "modern" (La)TeX.  Please find
attached the updated patch.  Any further feedback would be welcome.

Paul

>From 0da9f4fe0da7491fce2ec7d4e663fc9c5f062c43 Mon Sep 17 00:00:00 2001
From: Paul Nelson <[email-masked]>
Date: Sun, 30 Mar 2025 13:31:58 +0200
Subject: [PATCH] Extend tex--prettify-symbols-alist

* lisp/textmodes/tex-mode.el (tex--prettify-symbols-alist): Add
further math symbols, quotes and fractions.
---
 lisp/textmodes/tex-mode.el | 120 ++++++++++++++++++++++++++++++++++---
 1 file changed, 113 insertions(+), 7 deletions(-)

diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index ad1d4fa1f88..ea1bf3807c3 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -3185,9 +3185,14 @@ tex--prettify-symbols-alist
     ("\\bigcap" . ?⋂)
     ("\\bigcirc" . ?◯)
     ("\\bigcup" . ?⋃)
+    ("\\bigodot" . ?⨀)
+    ("\\bigoplus" . ?⨁)
+    ("\\bigotimes" . ?⨂)
+    ("\\bigsqcup" . ?⨆)
     ("\\bigstar" . ?★)
     ("\\bigtriangledown" . ?▽)
     ("\\bigtriangleup" . ?△)
+    ("\\biguplus" . ?⨄)
     ("\\bigvee" . ?⋁)
     ("\\bigwedge" . ?⋀)
     ("\\blacklozenge" . ?✦)
@@ -3204,12 +3209,11 @@ tex--prettify-symbols-alist
     ("\\bullet" . ?•)
     ("\\bumpeq" . ?≏)
     ("\\cap" . ?∩)
+    ("\\cdot" . ?⋅)
     ("\\cdots" . ?⋯)
     ("\\centerdot" . ?·)
     ("\\checkmark" . ?✓)
     ("\\chi" . ?χ)
-    ("\\cdot" . ?⋅)
-    ("\\cdots" . ?⋯)
     ("\\circ" . ?∘)
     ("\\circeq" . ?≗)
     ("\\circlearrowleft" . ?↺)
@@ -3286,11 +3290,15 @@ tex--prettify-symbols-alist
     ("\\hookleftarrow" . ?↩)
     ("\\hookrightarrow" . ?↪)
     ("\\iff" . ?⇔)
+    ("\\iiiint" . ?⨌)
+    ("\\iiint" . ?∭)
+    ("\\iint" . ?∬)
     ("\\imath" . ?ı)
     ("\\in" . ?∈)
     ("\\infty" . ?∞)
     ("\\int" . ?∫)
     ("\\intercal" . ?⊺)
+    ("\\jmath" . ?ȷ)
     ("\\langle" . 10216)          ; Literal ?⟨ breaks indentation.
     ("\\lbrace" . ?{)
     ("\\lbrack" . ?\[)
@@ -3323,6 +3331,7 @@ tex--prettify-symbols-alist
     ("\\rhd" . ?▷)
     ("\\ll" . ?≪)
     ("\\llcorner" . ?⌞)
+    ("\\lll" . ?⋘)
     ("\\lnapprox" . ?⋦)
     ("\\lneq" . ?≨)
     ("\\lneqq" . ?≨)
@@ -3400,6 +3409,8 @@ tex--prettify-symbols-alist
     ("\\nvdash" . ?⊬)
     ("\\nwarrow" . ?↖)
     ("\\odot" . ?⊙)
+    ("\\oiiint" . ?∰)
+    ("\\oiint" . ?∯)
     ("\\oint" . ?∮)
     ("\\ominus" . ?⊖)
     ("\\oplus" . ?⊕)
@@ -3508,10 +3519,12 @@ tex--prettify-symbols-alist
     ("\\vDash" . ?⊨)
     ("\\varepsilon" . ?ε)
     ("\\varphi" . ?φ)
+    ("\\varpi" . ?ϖ)
     ("\\varprime" . ?′)
     ("\\varpropto" . ?∝)
     ("\\varrho" . ?ϱ)
     ("\\varsigma" . ?ς)
+    ("\\vartheta" . ?ϑ)
     ("\\vartriangleleft" . ?⊲)
     ("\\vartriangleright" . ?⊳)
     ("\\vdash" . ?⊢)
@@ -3522,19 +3535,60 @@ tex--prettify-symbols-alist
     ("\\wedge" . ?∧)
     ("\\wp" . ?℘)
     ("\\wr" . ?≀)
-    ("\\Bbb{N}" . ?ℕ)			; AMS commands for blackboard bold
-    ("\\Bbb{P}" . ?ℙ)			; Also sometimes \mathbb.
+    ("\\Bbb{A}" . ?𝔸)			; AMS commands for blackboard bold
+    ("\\Bbb{B}" . ?𝔹)			; Also sometimes \mathbb.
+    ("\\Bbb{C}" . ?ℂ)
+    ("\\Bbb{D}" . ?𝔻)
+    ("\\Bbb{E}" . ?𝔼)
+    ("\\Bbb{F}" . ?𝔽)
+    ("\\Bbb{G}" . ?𝔾)
+    ("\\Bbb{H}" . ?ℍ)
+    ("\\Bbb{I}" . ?𝕀)
+    ("\\Bbb{J}" . ?𝕁)
+    ("\\Bbb{K}" . ?𝕂)
+    ("\\Bbb{L}" . ?𝕃)
+    ("\\Bbb{M}" . ?𝕄)
+    ("\\Bbb{N}" . ?ℕ)
+    ("\\Bbb{O}" . ?𝕆)
+    ("\\Bbb{P}" . ?ℙ)
     ("\\Bbb{Q}" . ?ℚ)
     ("\\Bbb{R}" . ?ℝ)
+    ("\\Bbb{S}" . ?𝕊)
     ("\\Bbb{T}" . ?𝕋)
+    ("\\Bbb{U}" . ?𝕌)
+    ("\\Bbb{V}" . ?𝕍)
+    ("\\Bbb{W}" . ?𝕎)
+    ("\\Bbb{X}" . ?𝕏)
+    ("\\Bbb{Y}" . ?𝕐)
     ("\\Bbb{Z}" . ?ℤ)
-    ("\\mathbb{N}" . ?ℕ)			; AMS commands for blackboard bold
-    ("\\mathbb{P}" . ?ℙ)			; Also sometimes \mathbb.
+    ("\\mathbb{A}" . ?𝔸)			; AMS commands for blackboard bold
+    ("\\mathbb{B}" . ?𝔹)			; Also sometimes \mathbb.
+    ("\\mathbb{C}" . ?ℂ)
+    ("\\mathbb{D}" . ?𝔻)
+    ("\\mathbb{E}" . ?𝔼)
+    ("\\mathbb{F}" . ?𝔽)
+    ("\\mathbb{G}" . ?𝔾)
+    ("\\mathbb{H}" . ?ℍ)
+    ("\\mathbb{I}" . ?𝕀)
+    ("\\mathbb{J}" . ?𝕁)
+    ("\\mathbb{K}" . ?𝕂)
+    ("\\mathbb{L}" . ?𝕃)
+    ("\\mathbb{M}" . ?𝕄)
+    ("\\mathbb{N}" . ?ℕ)
+    ("\\mathbb{O}" . ?𝕆)
+    ("\\mathbb{P}" . ?ℙ)
     ("\\mathbb{Q}" . ?ℚ)
     ("\\mathbb{R}" . ?ℝ)
+    ("\\mathbb{S}" . ?𝕊)
     ("\\mathbb{T}" . ?𝕋)
+    ("\\mathbb{U}" . ?𝕌)
+    ("\\mathbb{V}" . ?𝕍)
+    ("\\mathbb{W}" . ?𝕎)
+    ("\\mathbb{X}" . ?𝕏)
+    ("\\mathbb{Y}" . ?𝕐)
     ("\\mathbb{Z}" . ?ℤ)
     ("\\pm" . ?±)
+    ("\\pounds" . ?£)
     ("\\|" . ?‖)
     ("\\varkappa" . ?ϰ)
     ;; caligraphic
@@ -3738,7 +3792,59 @@ tex--prettify-symbols-alist
     ("\\textdivorced" . ?⚮)
     ("\\textlbrackdbl" . 10214) ; Literal ?⟦ breaks indentation
     ("\\textrbrackdbl" . 10215) ; Literal ?⟧ breaks indentation
-    ("\\textinterrobangdown" . ?⸘))
+    ("\\textinterrobangdown" . ?⸘)
+
+    ;; TeX quotes
+    ("``" . ?“)
+    ("''" . ?”)
+
+    ;; Unicode Fractions
+    ("\\frac{1}{2}" . "½")
+    ("\\frac{1}{3}" . "⅓")
+    ("\\frac{2}{3}" . "⅔")
+    ("\\frac{1}{4}" . "¼")
+    ("\\frac{3}{4}" . "¾")
+    ("\\frac{1}{5}" . "⅕")
+    ("\\frac{2}{5}" . "⅖")
+    ("\\frac{3}{5}" . "⅗")
+    ("\\frac{4}{5}" . "⅘")
+    ("\\frac{1}{6}" . "⅙")
+    ("\\frac{5}{6}" . "⅚")
+    ("\\frac{1}{7}" . "⅐")
+    ("\\frac{1}{8}" . "⅛")
+    ("\\frac{3}{8}" . "⅜")
+    ("\\frac{5}{8}" . "⅝")
+    ("\\frac{7}{8}" . "⅞")
+    ("\\frac{1}{9}" . "⅑")
+    ("\\frac{1}{10}" . "⅒")
+    ("\\tfrac{1}{2}" . "½")
+    ("\\tfrac{1}{3}" . "⅓")
+    ("\\tfrac{2}{3}" . "⅔")
+    ("\\tfrac{1}{4}" . "¼")
+    ("\\tfrac{3}{4}" . "¾")
+    ("\\tfrac{1}{5}" . "⅕")
+    ("\\tfrac{2}{5}" . "⅖")
+    ("\\tfrac{3}{5}" . "⅗")
+    ("\\tfrac{4}{5}" . "⅘")
+    ("\\tfrac{1}{6}" . "⅙")
+    ("\\tfrac{5}{6}" . "⅚")
+    ("\\tfrac{1}{7}" . "⅐")
+    ("\\tfrac{1}{8}" . "⅛")
+    ("\\tfrac{3}{8}" . "⅜")
+    ("\\tfrac{5}{8}" . "⅝")
+    ("\\tfrac{7}{8}" . "⅞")
+    ("\\tfrac{1}{9}" . "⅑")
+    ("\\tfrac{1}{10}" . "⅒")
+
+    ;; Other symbols
+    ("\\S" . ?§)
+    ("\\Finv" . ?Ⅎ)
+    ("\\Game" . ?⅁)
+    ("\\ " . 9141) ; Literal ?⎵ breaks indentation
+    ("\\lvert" . ?|)
+    ("\\rvert" . ?|)
+    ("\\lVert" . ?‖)
+    ("\\rVert" . ?‖))
   "A `prettify-symbols-alist' usable for (La)TeX modes.")
 
 (defun tex--prettify-symbols-compose-p (_start end _match)
-- 
2.39.3 (Apple Git-145)