Skip to content

Superscripts in underlined text makes the underline change size and position #1210

Open

Description

@winneratwin

Description

When using super in underlined text the line underneath the text becomes thinner and moves up above the normal underline.

This is not an ideal reading experience when 1st has an inconsistent line underneath the st portion when one would expect it to continue in the same style/format as the number before it.

example code:
#underline[1#super[st], 2#super[nd], and 3#super[rd]]

result:
image

version:
typst 0.3.0 (4b17c3f5) a.k.a. the latest git commit as of time of writing

Reproduction URL

No response

Operating system

Linux

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on May 14, 2023
  2. added
    layout
    on May 20, 2023
  3. AndyBarcia commented on Jun 26, 2023

    @AndyBarcia
    Contributor

    This seems to be a problem in general when either stroke or offset are set to auto and the underline content has text with different font sizes.

    For example, the following code produces the following output:

    #underline[text #box(height: 10mm, fill: red)[box]]
    
    #underline[
      small
      #text(size: 32pt)[big] 
      small
    ]
    

    Captura desde 2023-06-26 18-39-15

    The problem is, how to select the underline width and offset with different font sizes? Do we select the biggest stroke in the text? What about the offset? Do we select the smaller one?

    Note: as a workaround, the offset and stroke can be set explicitly.

    #underline(stroke: 0.5pt, offset: 1.5pt)[
      1#super[st], 2#super[nd], and 3#super[rd]
    ]
    

    Captura desde 2023-06-26 18-49-18

  4. added
    text
    and removed
    layout
    on Nov 14, 2023
  5. changed the title [-]super in underlined text makes the underline change size and position[/-] [+]Superscripts in underlined text makes the underline change size and position[/+] on Jul 16, 2024
  6. Leedehai commented on Jan 9, 2026

    @Leedehai
    Contributor

    This issue has become obsolete:

    // Tried with typst 0.14.2
    #underline[1#super[st], 2#super[nd], and 3#super[rd]]
    Image
  7. bluss commented on Jan 10, 2026

    @bluss
    Contributor

    The example is obsolete but the issue is maybe not? The issue has at least changed.

    The underline is now good when the super is typographic and the underline is worse than before when not.

    #underline[1#super[st], 2#super[nd], and 3#super[rd~]]
    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

    bugtext

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions