Skip to content

Conversation

@Omikhleia
Copy link
Member

@Omikhleia Omikhleia commented Aug 23, 2025

Math formula in block quotes, footnotes, headers, etc. now adapt to the current document size instead of using a fixed value. The adjustment is based on the eye (ex-height) for consistent optical alignment.

Closes #2145

Better approach than #2149 :

Advantages

  • The user can still set math.font.size to a fixed value (globally or temporarily), and then this will be used.
  • Otherwise, adjustment is to the ex-height, matching the surrounding font (esp. interesting for inline formulas etc.)

Scenario

{.unnumbered .notoc}
## Regarding Euler's $`e^{\mathrm{i}\pi} + 1 = 0`

Some people say $`e^{\mathrm{i}\pi} + 1 = 0` is one of the most beautiful equation in mathematics.

> But all I want to check here is that $`e^{\mathrm{i}\pi} + 1 = 0` honors the current document font size.[^euler]

[^euler]: And $`e^{\mathrm{i}\pi} + 1 = 0` in a footnote is even smaller.

Run with -u inputters.djot temp/euler-identity.dj -O papersize=a7 -Olandscape=true -c resilient.book

I.e. adaptation between default text (Gentium) and math (Libertinus).

image

Caveat

  • In ex-height adjustment mode (default), performances are slightly degraded. We could do some better font caching, but that's a more general question, somewhat orthogonal to that specific case here. I might open a dedicated issue for discussion.
  • Existing tests will fail -- But ideally one would want to make a global pass with all of the proposed math-related PRs for this milestone, after CI/tests: fonts SBL_Hbrw and AmiriQuran's addresses changed and now CI breaks #2297 is also fixed.

@Omikhleia Omikhleia added this to the v0.15.14 milestone Aug 23, 2025
@Omikhleia Omikhleia self-assigned this Aug 23, 2025
@Omikhleia Omikhleia added the bug Software bug issue label Aug 23, 2025
@Omikhleia Omikhleia requested a review from a team as a code owner August 23, 2025 21:15
@Omikhleia Omikhleia added the modules:packages Issue relates to core or 3rd party packages label Aug 23, 2025
@Omikhleia Omikhleia added this to Math Aug 23, 2025
@github-project-automation github-project-automation bot moved this to In progress in Math Aug 23, 2025
@Omikhleia Omikhleia marked this pull request as draft August 23, 2025 21:23
Math formula in block quotes, footnotes, headers, etc. now adapt
to the current document size instead of using a fixed value.
The adjustment is based on the eye (ex-height) for consistent
optical alignment.
@Omikhleia Omikhleia force-pushed the fix-2149-another-approach branch from 4388f51 to 9ab215f Compare August 23, 2025 21:25
@Omikhleia Omikhleia marked this pull request as ready for review August 23, 2025 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Software bug issue modules:packages Issue relates to core or 3rd party packages

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

Math font size does not follow the current normal text size

2 participants