brucemiller / LaTeXML

LaTeXML: a TeX and LaTeX to XML/HTML/ePub/MathML translator.
http://dlmf.nist.gov/LaTeXML/
Other
961 stars 101 forks source link

use Enclosed Alphanumerics for common \textcircled cases #2198

Closed dginev closed 1 year ago

dginev commented 1 year ago

Fixes #2122 .

Unicode seems to have dedicated circled characters for numbers 0 through 20, and the lower and upper English letters. This PR now uses them with \textcircled. For other cases, we continue to rely on the U+20DD combining character.

I am attaching a sample tex source and a screenshot of the HTML from a default Firefox view. Still renders a bit odd, but maybe better in the long run?

I also tried to add some baseline math attributes, ensuring that circled numbers reach MathML as <mn> rather than <mi> elements. Feedback is most welcome.

```tex \documentclass{article} \begin{document} \textcircled{0} \textcircled{1} \textcircled{2} \textcircled{3} \textcircled{4} \textcircled{5} \textcircled{6} \textcircled{7} \textcircled{8} \textcircled{9} \textcircled{10} \textcircled{11} \textcircled{12} \textcircled{13} \textcircled{14} \textcircled{15} \textcircled{16} \textcircled{17} \textcircled{18} \textcircled{19} \textcircled{20} \textcircled{a} \textcircled{b} \textcircled{c} \textcircled{d} \textcircled{e} \textcircled{f} \textcircled{g} \textcircled{h} \textcircled{i} \textcircled{j} \textcircled{k} \textcircled{l} \textcircled{m} \textcircled{n} \textcircled{o} \textcircled{p} \textcircled{q} \textcircled{r} \textcircled{s} \textcircled{t} \textcircled{u} \textcircled{v} \textcircled{w} \textcircled{x} \textcircled{y} \textcircled{z} \textcircled{A} \textcircled{B} \textcircled{C} \textcircled{D} \textcircled{E} \textcircled{F} \textcircled{G} \textcircled{H} \textcircled{I} \textcircled{J} \textcircled{K} \textcircled{L} \textcircled{M} \textcircled{N} \textcircled{O} \textcircled{P} \textcircled{Q} \textcircled{R} \textcircled{S} \textcircled{T} \textcircled{U} \textcircled{V} \textcircled{W} \textcircled{X} \textcircled{Y} \textcircled{Z} \textcircled{50} \textcircled{!} \[ \textcircled{2}\textcircled{z} + \textcircled{3}\textcircled{z} = \textcircled{5}\textcircled{z} \] \end{document} ``` ![Screenshot 2023-08-15 at 16-09-02 Untitled Document](https://github.com/brucemiller/LaTeXML/assets/348975/ea3bd4ba-8287-4e15-840b-8161cc941e60)
brucemiller commented 1 year ago

This is so silly, but since you've gone to the trouble, let's just be happy with our nice circled numbers!