Skip to content

Math limit formatting overlap #112

Closed

Description

@cmoog

Code

sup_(x in P_i)

LaTeX

Screenshot 2023-03-22 at 7 52 03 AM

Typst

Screenshot 2023-03-21 at 11 00 37 PM

Activity

  1. added
    bug
    math
    on Apr 5, 2023
  2. changed the title [-]bug: math limit formatting overlap[/-] [+]Math limit formatting overlap[/+] on Apr 5, 2023
  3. rpitasky commented on Apr 23, 2023

    @rpitasky
    Contributor

    I did some tracing of this bug and made some headway towards a potential fix; while I can’t fix it right now because of time constraints, I can dump my knowledge to reduce repeated effort.

    Some additional code needs to be added to handle this case in this function. LaTeX seems to skirt around this issue by having \sup be its own object and special-casing it out. I think that for Typst, the more elegant way to solve this problem is by first checking if the limits attachment are being added to text, then measuring how far the text dips below the baseline, and ensuring a specific amount of clearance is maintained. Because math layout is done after text shaping, this isn’t too hard to do, but it’ll be a bit of spaghetti code because the information about the font measurements is nested like five levels deep into the relevant objects.

  4. laurmaedje commented on Apr 23, 2023

    @laurmaedje
    Member

    Maybe the text's top-edge and bottom-edge should be tight bounding boxes in math.

  5. cmoog commented on Apr 23, 2023

    @cmoog
    ContributorAuthor

    Another issue shown in this example is the alignment / mis-alignment of the baseline of P with in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmath

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions