Open Fabioni opened 5 months ago
TL;DR: it looks quite contrived.
It appears this is the result of the different glyph renderings of the underbraces. If one looks at it closely, one can notice the underbraces all look a bit differently.
In fact, if I make the middle term narrower, the middle underbrace will use nearly the same glyph as the other two, and then the heights of all three look aligned:
// Fig 1 (original)
$ underbrace(p(y^*|mu), "aleatoric") thick underbrace(p(mu|x^*, theta), "distributional") thick underbrace(p(theta|cal(D)), "epistemic") $
// Fig 2 (modified)
$ underbrace(p(y^*|mu), "aleatoric") thick underbrace(p(mu|x^*), "distributional") thick underbrace(p(theta|cal(D)), "epistemic") $
Fig 1: Fig 2:
Each term is made of three frames stacked vertically downward: the term itself, the underbrace, and the annotation text. In Fig 1, typst::math::stretch::stretch_glyph()
used a glyph that was "assemble from parts" for the middle underbrace, and "pre-made variant" for the other two. In Fig 2, all three underbraces are "pre-made variant". Note that though the stretching is horizontal, for some reasons (due to the font?) the resulting underbrace frames differ vertically, too:
From left to right, the underbrace frames' height()
s are:
3.4699999999999998pt
, 2.4399999999999995pt
, 3.38pt
;3.4699999999999998pt
, 3.4699999999999998pt
, 3.38pt
.It's not all. From left to right, the underbrace frames' baseline()
s are:
-0.67pt
, -1.09pt
, -0.7000000000000001pt
;-0.67pt
, -0.67pt
, -0.7000000000000001pt
.In light of this, a sensible solution could be: instead of vertically stacking the frames freely according to their heights, we define a "quantumized" ladder of heights. For example, if the underbrace is 2pt ~ 4pt in height, we wrap the underbrace inside a frame that is 4pt in height; if the underbrace is 4pt ~ 6pt in height, we wrap the underbrace inside a frame that is 6pt in height, etc. The specific numbers are TBD.
This seems to be a font issue. Here's the same thing using Stix Two Math
Not exactly aligned, but close enough.
The font I am using is "New Computer Modern", probably a font many people use, especially in math heavy writings
The font I am using is "New Computer Modern", probably a font many people use, especially in math heavy writings
Doesn't change the fact that the font has several issues. Though it has improved significantly over time.
Are your images from latex rendered using the same font through luatex/xetex?
It is even a used font in the Typst documentation, I think many people start from the guide for latex users: https://typst.app/docs/guides/guide-for-latex-users/.
You say this font has many problems, what alternative do you suggest?
The image from latex was just screenshotted from another paper, so I can't tell.
It is even a used font in the Typst documentation, I think many people start from the guide for latex users: https://typst.app/docs/guides/guide-for-latex-users/.
You say this font has many problems, what alternative do you suggest?
I mentioned Stix Two Math as one alternative
The image from latex was just screenshotted from another paper, so I can't tell.
Then it's not really a fair comparison, because it's likely the Type 1 font Computer Modern rendered through pdftex. A proper one would involve using New Computer Modern Math through the unicode-math package with luatex or xetex.
Though it's a font issue, I still wish to fix it in Typst [1] by changing how the typst::math::underover::stack()
stacks up the frames - for example, we can add a param to this function that tells it whether (and how large) the frame heights should be "quantumized" as mentioned above.
Thoughts?
[1] Because we don't know whether this font, or other possible fonts, can fix this.
Then it's not really a fair comparison
@Enivex, it is not about comparing against Latex, it is just about making Typst a good product. The screenshot from Latex was just to explain how I think the formula should look like. Next time I give you a hand made drawing if you wish...
Then it's not really a fair comparison
@Enivex, it is not about comparing against Latex, it is just about making Typst a good product. The screenshot from Latex was just to explain how I think the formula should look like. Next time I give you a hand made drawing if you wish...
There was never any confusion as to what you meant. I don't think it looks great either.
My point is simply that we have to separate typst issues from font issues that have to be fixed upstream.
I've gone through the effort of comparing them:
LuaTeX + NCMM
LuaTeX + STM
Typst + NCMM
Typst + STM
As you can see, NCMM is wonky in Typst, but it's also wonky to a lesser extent in LuaTeX. In comparison, Stix is only slightly off in Typst, and seemingly perfect in LuaTeX.
It may be a bit from column A and some from column B.
Description
I think it would be nicer if the text of the
underbrace
s would be on the same height. Notice that the word "distributional" is slightly higher than "aleatoric" and "epistemic"This is from Typst:
using:
This is from Latex:
Reproduction URL
No response
Operating system
Web app
Typst version