Text in math mode should use text font
Nobody has claimed this yet.
- 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

This is not what I expect. In LaTeX, the input
Hello world, $\text{Hello world}$
will indeed render as
,
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.

Obviously this is an extreme example where the text and math fonts are wildly different, but it's still a problem.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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