brucemiller / LaTeXML

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

Use smaller symbols for \triangleleft and \triangleright #2362

Open DominikPeters opened 1 month ago

DominikPeters commented 1 month ago

The current unicode symbols used by LaTeXML for \triangleleft and \triangleright are larger than the symbols used when LaTeX is used. I propose changing the unicode symbols U+25C1 ◁ White Left-Pointing Triangle to U+25C3 ◃ White Left-Pointing Small Triangle, and similarly for right-pointing.

Example document:

\documentclass{article}
\begin{document}
    Test string: $x \bigtriangleup y \bigtriangledown z \triangleleft w \triangleright v$
\end{document}

PDF:

image

LaTeXML:

image

LaTeXML with this pull request:

image
dginev commented 3 weeks ago

@DominikPeters this PR would also need a few of the tests updated to match the new characters - see a local make test run for details.

Btw the presented visual reasoning for transitioning to using the small Unicode character appears reasonable to me on a surface read. But @brucemiller may have more thoughts.

xworld21 commented 3 weeks ago

As further datapoint, unicode-math uses U+25C1, and in fact loading unicode-math makes the triangles bigger in the PDF output. Not sure if this is unicode-math redefining the macro, or instead altering the font maps.

brucemiller commented 3 weeks ago

Hmm, well, maybe.

Of course, Unicode symbols don't come with a size (nor TeX commands, for that matter); the fonts that render them do. And so different fonts will have different sizes. There may be a reasonable expectation of size, particularly expecting a set of shapes to have the same size, or relative sizes for normal compared to "big" or "small".

Given the somewhat random collection of symbols used in TeX, along with a different, though related, random collection in Unicode, it's kinda hard to come up with a completely consistent mapping. Apparently the unicode-math developer encountered the same mystery?

So, while the example you showed seems compelling --- and you may be quite correct --- I'd be interested in looking at all the various triangles, boxes, big, small, etc (as defined in a variety of style files) and comparing the observed relative sizes in both pdflatex and with common (eg STIX) unicode fonts.before deciding on changes,

xworld21 commented 3 weeks ago

I was curious so I checked: https://www.unicode.org/reports/tr25/ seems quite explicit about how big the triangles should be (see Table 2.5). Although I agree that one should check whether the fonts are following that idea or not. http://mirrors.ctan.org/macros/unicodetex/latex/unicode-math/unimath-symbols.pdf renders each character in several fonts (Latin Modern, STIX, Fira Math, etc). For U+25C1, it seems like they generally agree with the spec, that is, the left/right triangles are roughly the same size as their up/down counterparts. That should clarify the HTML side, at least.