-
Notifications
You must be signed in to change notification settings - Fork 9
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
Subscripts affect vertical alignment in an undesired way #44
Comments
Hmm. This occurs because each node gets its own bounding box and is aligned separately. But I agree that it's probably more desirable to align by baseline for diagrams in math mode. I'm not sure how this could be made automatic, since fundamentally each node exists in its own box, so baseline information is lost. In the meantime, a non-ideal workaround is to use #diagram($
#move(dy: .35em, $ limits(sum)_(i in U) F(U) $) edge("->") & F(U)
$) |
I may not have fully considered this yet, but here's a quick thought: could we allow an alignment pivot point that is different from the center of the bounding box? Consider a naive implementation for trimming attachments (see https://typst.app/project/rYLF85ECFVpZUGgR5w_G3p) :
Does it make sense to calculate the center of the bounding box for |
Not sure. With block math, it’s not only the attachments, but everything which affects the bounding box - including the #let eq = $ sum_(i in U) F(U)-->F(U) $
#let trimmed_eq = trim_attachments(eq)
#set rect(inset: 0pt, stroke: 0.5pt + red)
#rect(eq)
#rect(trimmed_eq)
#rect($ F(U)-->F(U) $) However, fletcher diagrams in math mode use inline math by default, exactly for this purpose of reusing the same baseline. However, it seems that when inline math is wrapped in a box, the baseline is not preserved: foo [$sum_(n=0) 1/n! x^n$] bar
foo [$limits(sum)_(n=0) 1/n! x^n$] bar
#set box(stroke: 0.5pt + red)
foo [#box[$sum_(n=0) 1/n! x^n$]] bar
foo [#box[$limits(sum)_(n=0) 1/n! x^n$]] bar So to fix this, I need to figure out how to wrap inline math nodes in a box (which is passed to cetz for drawing) while preserving the baseline. I'll ask in Discord: link to question. |
Recently, I noticed a workaround for obtaining baseline information in cetz-package/cetz#683. I'm curious if there's a similar method to "record" baseline information in Fletcher. Could you share any insights? Thank you! |
The vertical alignment of the subscripts seems to be off, which disrupts the readability of the formula. Here is the link of the code snippet: https://typst.app/project/rcUVH6fe_sLns_uLrFA4tE
Expected Behavior
The formula is expected to align with the baseline of$\sum$ , ignoring the subscripts $i \in U$ .
Current Behavior
The subscripts in the formula affect the vertical alignment, causing them to appear misaligned with the rest of the formula elements.
Is there a way to manually adjust or change the alignment for subscripts? Any guidance or documentation on this would be greatly appreciated. I'm also wondering if this misalignment should be adjusted to improve the default behavior.
The text was updated successfully, but these errors were encountered: