typst / typst/typst

_ and ^ eat newline in math

Open
#1,435 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug math syntax
Dominant language
Rust
Stars
56.1k
Forks
1.7k
Avg merge
3d 10h
Merged PRs (30d)
22

Description

Description
$
    a = b_ \
    c = d
$

will render as
image

The same is the case if _ is replaced with ^

This is not ideal, because it makes the output jump around whenever you add a sub- or superscript at the end of an existing line in an equation.

Reproduction URL

No response

Operating system

No response

Typst version
  • I am using the latest version of Typst

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the shown math snippet with the latest Typst and compare the layout with and without a trailing subscript or superscript. Trace the math handling for line breaks around trailing _ and ^; done means adding either at the end of a line no longer makes the rendered output jump unexpectedly while the equation still renders correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.