From 6f2607b6183c0a935c229dba1e0bb715527a8f7f Mon Sep 17 00:00:00 2001 From: Tom 7 Date: Thu, 17 Sep 2026 18:22:41 -0400 Subject: [PATCH] =?UTF-8?q?Add=20support=20for=20superscript=20circle,=20w?= =?UTF-8?q?hich=20is=20a=20somewhat=20common=20way=20to=20make=20a=20degre?= =?UTF-8?q?e=20sign=20in=20TeX.=20There=20is=20a=20Latin-1=20codepoint=20f?= =?UTF-8?q?or=20this,=20so=20it's=20much=20better=20than=20showing=20e.g.?= =?UTF-8?q?=2015^=E2=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typeset_test.go | 2 ++ unicode.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/typeset_test.go b/typeset_test.go index 0408779..7d4a65f 100644 --- a/typeset_test.go +++ b/typeset_test.go @@ -158,6 +158,8 @@ func TestTextualScripts(t *testing.T) { {`e^{-\frac{x^2}{2}}`, "e^{-x²/2}"}, {`\lim_{n\to\infty} a_n`, "lim_{n→∞} aₙ"}, {`\sum_{p \text{ prime}} p`, "∑_{p prime} p"}, + {`15^\circ`, "15°"}, + {`15^{\degree}`, "15°"}, } for _, c := range cases { if got := render(t, c.in, inline); got != c.want { diff --git a/unicode.go b/unicode.go index 02787f4..4b52ca3 100644 --- a/unicode.go +++ b/unicode.go @@ -24,6 +24,8 @@ var superscriptMap = map[rune]rune{ 'α': 'ᵅ', 'β': 'ᵝ', 'γ': 'ᵞ', 'δ': 'ᵟ', 'θ': 'ᶿ', 'φ': 'ᵠ', 'χ': 'ᵡ', // special + '∘': '°', // e.g. 15^\circ -> degree sign + '°': '°', // degree is already a superscript glyph '′': '′', // prime is already a superscript glyph }