typst / typst/typst

Text in math mode should use text font

Open
#366 52 comments 85 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I became aware of this while trying to understand https://github.com/typst/typst/issues/355

If I change the text font to "Comic Neue" (Only to get a distinctly different font)

Hello world, $"Hello world"$, $#text(font: "Comic Neue")[Hello world]$

will render as

image

This is not what I expect. In LaTeX, the input

Hello world, $\text{Hello world}$

will indeed render as

image,

correctly using the text font when displaying text in math mode.


Why is this the correct behavior? Because it is common to write something like

And therefore, if $ f(a) > 0 quad "and" quad f'(a) > 0, $ we have

where the text is part of the, well, text. When this is typeset using the math font it looks very awkward.

image

Obviously this is an extreme example where the text and math fonts are wildly different, but it's still a problem.

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

The issue does not name specific files, tests, or entry points. Start by tracing how quoted text and text elements are rendered inside math mode, then verify that text uses the configured text font while mathematical content remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.