-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
fix(math): Math font size must follow the document font size #2149
base: master
Are you sure you want to change the base?
fix(math): Math font size must follow the document font size #2149
Conversation
Math formula in block quotes, footnotes, and even headers shall use the current document font size, not some hard-coded 10pt default.
These tests use document font size at 11pt, but formulas would be typeset at 10pt as the math.font.size default was hard-coded. It now follows the current document font size, so enforce it back to 10pt in order for the test to pass unchanged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definitely needs fixing, but just hard coding a link to font.size
seems too aggressive and might trip up in some cases.
@@ -42,9 +42,13 @@ function package.declareSettings (_) | |||
}) | |||
SILE.settings:declare({ | |||
parameter = "math.font.size", | |||
type = "integer", | |||
default = 10, | |||
type = "number or integer", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should consider whether we ought to allow relative values here such that formulas would track changes to the document font size in a relative way.
}) | ||
SILE.settings:registerHook ("font.size", function (size) | ||
-- Follow document font size changes | ||
SILE.settings:set("math.font.size", size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do allow a relative value (e.g. 1.2em
) then this would need to adjust to compute the difference (or just not change it at all, but we would have to review if we are using :absolute()
where necessary) not just hard code a value.
Even if not, we probably want to figure out how to remove this hook if the user resets font.size
after having set math.font.size
at any point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW there's a whole lot of issues hiding behind math.font.size eventually.
Consider legit MathML <mpadded width="3em" lspace="0.7em">...</mpadded>
= the unit is evaluated with respect to font.size but math.font.size might have been the intent... The MathML spec is not very precise here (it's even unclear whether the scale-down should be taken into account.) (N.B. Basic mpadded support is in-progress in #2151)
My guts feelings (after I hit the problem under a different angle in mpadded) is that math.font.size should always be in a font relative unit, and affect font.size inside the math equation.
Or should be wholly dimissed - after all we don't really do such things for verbatim/monospace fonts either, and the question of scaling appropriately different fonts is more general (= on which basis? em-size ? ex-height ? capital-height? etc.) - CSS has some good pointers here, for once.
Closes #2145