Skip to content

Misaligned superscripts and subscripts #539

Closed

Description

@Leedehai

Hi, while working on the physics package I discovered there's an issue of misaligned superscripts and subscripts, that are too sensitive[1] on the preceding symbol's height.

$ x^square, y^square, z^square, h^square, g^square, (1/2)^square $
$ x_square, y_square, z_square, h_square, g_square, (1/2)_square $

Rendered by Typst:
Screenshot 2023-04-02 at 21 34 18
This misalignment makes certain expressions not so pretty, e.g.
Screenshot 2023-04-02 at 22 15 09
Screenshot 2023-04-02 at 21 40 25

Below is the rendering done by Latex. They are aligned, and the position is not so sensitive on the preceding symbol's height, as expected and familiar with by most paper writers.

\documentclass{article}
\usepackage{amssymb}

\begin{document}

$$ x^\square, y^\square, z^\square, h^\square, g^\square, \bigg(\frac{1}{2}\bigg)^\square $$

$$ x_\square, y_\square, z_\square, h_\square, g_\square, \bigg(\frac{1}{2}\bigg)_\square $$

\end{document}

Screenshot 2023-04-02 at 21 37 41

Thanks! Typst is awesome and I very much like to see it succeed.

[1] Naturally, the superscript and subscript's vertical positions should pay some attention to the preceding symbol's height (say, a very tall symbol like a fraction frac(1,2), a sum or prod, or an integral symbol), but they need not be too sensitive on the preceding symbol's height, like the letters in the example.

Activity

  1. added
    bug
    math
    on Apr 3, 2023
  2. Leedehai commented on Apr 28, 2023

    @Leedehai
    ContributorAuthor

    A bit more examples :)
    LaTeX:

    $$ e_1 y_1 \delta_1 \beta_1, e_1^1 y_1^1 \delta_1^1 \beta_1^1 $$
    $$ e^1 y^1 \delta^1 \beta^1, e_1^1 y_1^1 \delta_1^1 \beta_1^1 $$
    $$ x^1 [x]^1 x_1 [x]_1 $$
    

    Screenshot 2023-04-27 at 22 08 31

    Typst:

    $ e_1 y_1 delta_1 beta_1, e_1^1 y_1^1 delta_1^1 beta_1^1 $
    $ e^1 y^1 delta^1 beta^1, e_1^1 y_1^1 delta_1^1 beta_1^1 $
    $ x^1 [x]^1 x_1 [x]_1 $
    

    Screenshot 2023-04-27 at 22 12 12

  3. Enivex commented on May 10, 2023

    @Enivex
    Collaborator

    As a workaround you can do this

    $ e zws_1 y zws_1 delta zws_1 beta zws_1, e zws_1^1 y zws_1^1 delta zws_1^1 beta zws_1^1 $
    $ e zws^1 y zws^1 delta zws^1 beta zws^1, e zws_1^1 y zws_1^1 delta zws_1^1 beta zws_1^1 $
    $ x zws^1 [x] zws^1 x zws_1 [x] zws_1 $
    

    image

  4. Leedehai commented on May 11, 2023

    @Leedehai
    ContributorAuthor

    Closing after PR #1129 was merged.

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