typst: Prime symbol broken with Libertinus Math

Description

The prime symbol seems incorrectly set in superscript when using Libertinus Math.

#show math.equation: set text(font: "Libertinus Math")

$
f(x) &= x^2 + 1 \
f'(x) &= 2 x
$

This happens in both the Web App and the command-line interface.

Web App: Screenshot 2023-12-04 at 21-38-53 scratchpad – Typst

Local: Screenshot from 2023-12-04 21-38-27

Reproduction URL

No response

Operating system

Web app, Linux

Typst version

  • I am using the latest version of Typst

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 21 (9 by maintainers)

Most upvoted comments

Related discussion for ConTeXT https://mailman.ntg.nl/archives/list/ntg-context@ntg.nl/thread/274EKUHM5JW3Z7Q25SLIF5OLUND4YRN2/

OTOH in pdflatex and xelatex, with or without newtx, it renders fine. I took a look at libertinus-otf and libertinus-type1 package sources and was unable to find anything ssty related.

I’m not sure whether you’re planning switching to Libertinus Math alongside https://github.com/typst/typst/issues/1257 but in that case it would be better to fix this OTB.

I don’t think there’s any plan to change the math font.

On Polytype, the self-proclaimed “Rosetta stone for typesetting engines”, I think this issue is manifesting itself.

The second item in their “Sample Gallery” shows Typst output for:

#[
    #show math.equation: set text(font: "Libertinus Math", size: 16pt)
    $
        f(x) &= a' + b'' + c''' \
        f'(x) &= x^2 + 1
    $
]

and it really highlights how “bad” the f'(x) looks when compared to the rendering for sile and xelatex.

I don’t know if the best response is to suggest to Polytype that they use the "ssty" mentioned above (or write f prime instead of f'), or if effort should be spent identifying some alternative fix

But since this seems like it might be presenting Typst in a poor light in a fairly visible website (Polytype was recently featured on hackernews), it might be worth looking into.

This is probably a font issue not a typesetting engine one. Whether it is a bug or a style choice I’m not actually sure. I’m the maintainer of Libertinus fonts project but was not the original author of the Math companion font. Either way please feel free to file an issue over here.