Skip to content

Right alignment inside a box causes trailing punctuation to be pushed outside of the box #702

Open

Description

@betoma

When content within a box is aligned to the right and ends with a hyphen or other punctuation (has been confirmed for periods, commas, colons, and semicolons), the trailing punctuation isn't "counted" as part of the box and thus overlaps with the following element. This doesn't occur without right alignment or when the punctuation is at the beginning of the content instead.

Compare the following minimal example:

#box(align(right,[a-]))#box([nii])
#box(align(right,[a]))#box([-nii])
#box([a-])#box([nii])
#box([a])#box([-nii])

which is rendered as follows:
image

Activity

  1. laurmaedje commented on Apr 10, 2023

    @laurmaedje
    Member

    This is probably due to overhang for paragraphs. In that sense, this is related to #311: Both have the problems that things that should apply to whole paragraphs shouldn't necessarily apply to short segments of text.

  2. added
    bug
    layout
    text
    on Apr 11, 2023
  3. EpicEricEE commented on Nov 24, 2024

    @EpicEricEE
    Contributor

    This can also interfere with spacing in math mode due to the center alignment:

    #let rel1 = math.class("relation", "--")
    #let rel2 = math.class("relation", text(overhang: false, "--"))
    
    $ a rel1 b \
      a rel2 b $

    image

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

    buglayouttext

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions