Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use smaller symbols for \triangleleft and \triangleright #2362

Closed

Conversation

DominikPeters
Copy link

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
Copy link
Collaborator

dginev commented May 5, 2024

@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.

@dginev dginev requested a review from brucemiller May 5, 2024 15:18
@xworld21
Copy link
Contributor

xworld21 commented May 5, 2024

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
Copy link
Owner

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
Copy link
Contributor

xworld21 commented May 9, 2024

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.

@brucemiller
Copy link
Owner

Hmm. Thanks for the links @xworld21 that should have clarified things, but alas!!!! So, if you look at the basic cm fonts, the \lefttriangle, \righttriangle come from cmmi while the \bigtriangleup, \bigtriangledown come from cmsy and are decidedly larger than the former two. Curiously, the tables in the unimath-symbols.pdf show them all similar size for each font shown (but different sizes across different fonts), and have "(large)" in the description of the left & right triangles. So, clearly, you'll get different relative sizes for things when you select special fonts.
But it also appears that for cm fonts, Knuth intended to have the left & right smaller than the up down, even adding "big" to the names. So, I guess I have to concede that @DominikPeters is right here...

@xworld21
Copy link
Contributor

So, clearly, you'll get different relative sizes for things when you select special fonts.

Will this be addressed in your new approach to fonts? It sounds like you need a secondary font map 'glyph -> unicode' which uses the right codepoint depending on the actual font (and keep track of the font itself on top of the font family). This would probably matter also for the chancery vs roundhand script characters.

@brucemiller
Copy link
Owner

brucemiller commented Sep 22, 2024 via email

@brucemiller brucemiller mentioned this pull request Sep 24, 2024
@xworld21
Copy link
Contributor

the chancery/roundhand distinction. The latter is a special case, but I think it it will fit the scheme, once I'm in a position to test.

I have spotted a few other things in glyphtounicode.tex, like some fonts swapping \phi and \varphi. I haven't actually tried the fonts, but it's something to keep in mind, at least.

@brucemiller
Copy link
Owner

I've made an alternative PR #2422, that uses an intermediate size U+22B2, U+22B3 for the triangles, and also updates the affected tests. @DominikPeters Let me know if this looks reasonable to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants