Arrows in-text not vertically positioned properly?

I have the following raw text in my Typst document:
(solid → liquid → gas → plasma)

However it renders like this:
screenshot of render

The arrows appear to be slightly lower than I would expect.

Is this just an artifact of the font used, or something else?

// Body Text Style
  set text(font: "Libertinus Serif", size: 11pt, lang: "en")
  set par(justify: true, leading: 0.65em)

Can I fix it without altering the entire font of the book? If not, I will just live with it :-)

(In case you’re wondering why this font - TLDR: I started the project in LibreOffice Writer. After inserting the ~20th image and fighting with many page reflow/anchor/placement issues, the document started crashing LO Writer, at which point I used pandoc + Gemini to convert it to Typst via VSCode (local, not web). So it’s sort of an artifact of beginning in the wrong way :-P)))

Hello, I seem to be unable to reproduce the issue with the code sample provided (with or without the two provided set rules), this is what I see:

If you’re unable to narrow down which show/set rules cause this behavior, you can try shifting the baseline of arrows explicitly:

#show sym.arrow: set text(baseline: -1pt)

as an FYI, libertinus serif is the default typst font :slight_smile:

Also using text.fallback or just checking embedded fonts in PDF can show which one is used.

Thanks this is itself very helpful debugging! Helps me know it’s not only the font, so I should be able to fix it in my code somewhere.

That begged the question if the function that this text is appearing within is actually the culprit.

With a bit more debugging like @aarnet did, I find that in my regular text, the arrows are “normal” (vertically centered), but inside my #showybox() they’re lowered.

Here’s the code for my #showybox():

// fancy boxes for infoboxes etc.
#import "@preview/showybox:2.0.4": *
// from here: https://typst.app/universe/package/showybox/

// ....

#let infobox(txt) = {
  showybox(
    frame: (
    //border-color: red.darken(50%),
    //title-color: red.lighten(60%),
    body-color: blue.lighten(95%)
    ),
  shadow: (
    offset: 3pt,
    ),
  [
    #align(center)[
      #text( size:13pt, font: "Liberation Serif",
        txt
      )
    #v(0.5em)
    ]
  ]
  )
}

and in the main text the arrows look centered, but they’re lower in the showybox:

I’m not seeing anything obviously incorrect here, although it now seems connected to the showybox somehow.

It is the font, you use “Liberation Sans” inside the box.

#text(font: "Liberation Serif")[(solid → liquid → gas → plasma)]

#text(font: "Libertinus Serif")[(solid → liquid → gas → plasma)]

2 Likes

Since it’s connected to the font, another way of fixing the issue (instead of adjusting the baseline) is to change the font, but only for arrows:

#show sym.arrow: set text(font: "Libertinus Serif")
1 Like

Oh you’re right! I read too fast and thought they were the same font. Thank you for catching that, much appreciated.

This is a good workaround, I shall use it - thank you.