What's the equivalent of MS Word's 1.5 line spacing?

A while back I worked on making an equivalent to my CS department’s messy Word templates for our projects and settled on Typst (producing this monstrosity). One of the few snags I ran into is the fact that Typst and Word (and LaTeX) calculate line spacing (aka leading) differently:

As you can imagine, even for people using LaTeX there’s confusion on how exactly to replicate Word’s (or something close to it’s) behaviour, and tons of discussions on what the spacing macros actually do anyways…but LaTeX and Word’s definitions are somewhat similar so it’s (sort of) easy to fix.

How would one go across doing the same in Typst?

(As for my Typst recreation of the Word doc, I got some example text from Wikipedia and fiddled with par.leading in a demo document until they looked similar—it ended up being 12.6pt, but this wouldn’t generalise to different fonts/sizes etc.)

1 Like

I was one of those confused people. The solution (or a workaround) I’m currently using is described here: Wrong leading formatting in Paragraph · Issue #159 · typst/typst · GitHub :

#let leading = 1.5em
#let leading = leading - 0.75em // "Normalization"
#set block(spacing: leading)
#set par(spacing: leading)
#set par(leading: leading)

There is also a proposal to add baseline-to-baseline distance setting: Proposal: change `leading` option to `line-height` · Issue #4224 · typst/typst · GitHub. I will be very happy if it will be implemented, because this is probably the only thing that I don’t agree with Typst (the leading definition).

You should use em unit instead, because it’s font size dependent. For the default Typst 0.12.0-rc1 document, 12.6pt can be represented as 1.145em.

#context 1.145em.to-absolute()

image

1 Like

You might also have to set top-edge to 1em or something similar to get reproducible results between fonts.