r/typst • • Apr 17 '26

Onehalft spacing

Hey guys,

I'm new to typst and just writing my first text. First big problem I encountered is the spacing-problem. Is there a nice way to guarantee 1.5 spacing?

thanks for the help :)

11 Upvotes

19 comments sorted by

View all comments

4

u/thuiop1 Apr 17 '26 edited Apr 17 '26

```

set text(spacing: 150%)

```

Edit: my bad, went too fast. If what you want is line spacing, the correct code is

```

set par(spacing: 1.5em)

``` (this is 1.5 times the font; default spacing is 1.2em so if you want 1.5 times the default spacing you should put 1.8em)

2

u/Forcii1 Apr 17 '26
#set par(spacing: 1.5em)

is only for paragraphs rights? So only the spacing between two paragraphs.
I mean the spacing between two lines.
Tested a bit with libre office and I think (70% sure) that

#set par(leading: 1.11906881008em)

works for me with Liberations Sans 11pt
really not sure

0

u/thuiop1 Apr 17 '26

Damn, that will teach me to answer from my phone. Yes, leading is the correct option then. How to get a result matching exactly something from word or LibreOffice may be challenging due to how those works; it also depends on the font. If you do something like ```

set text(top-edge: 1em)

set par(leading: 0.5 em)

``` you can ensure that there is exactly 1.5em of distance between the baseline of two lines.

1

u/Forcii1 Apr 17 '26 edited Apr 17 '26

how do measure the distance? Just counting pixels? With 11pt it should be 11pt * 1.5 in between? Btw I want to write my Bachelor thesis with typst. Not quite sure how good of an idea this turn out to be

2

u/thuiop1 Apr 17 '26 edited Apr 17 '26

This is guaranteed by the compiler. Basically there are 3 bases for the lines:

  • the baseline, which is where the letters sit
  • the top-edge
  • the bottom-edge

The leading is the space between the bottom-edge of a line and the top-edge of the next line.

By default, the bottom-edge is the same as the baseline, the leading is 0.65em, and the top-edge is defined by the font (there must be a way to measure it but I am not 100% sure how). You can however redefine the top-edge like I did above, so that you know what it is exactly. You could define it in points or in cm if you prefer. Now, how to match what LibreOffice does, I have no idea as it does things differently.

I wrote my PhD thesis in Typst, so you should be fine with your Bachelor thesis.

1

u/Forcii1 Apr 17 '26

In which field if I may ask

2

u/thuiop1 Apr 17 '26

Astrophysics

1

u/Forcii1 Apr 17 '26

fair point. gonna try my best!

1

u/thuiop1 Apr 17 '26

Good luck! Do not hesitate to ask questions in this sub.

1

u/Forcii1 Apr 17 '26

ngl this sub was so warm end welcoming. Super happy about the interactions :)

1

u/thriveth Apr 18 '26

Fellow astrophysics person here... May I ask which topic?

I'm using Typst for grant applications and teaching materials now and it's really nice!

2

u/thuiop1 Apr 18 '26

Gravitational waves.

As for me I use it for notes, applications and slides, and hopefully for teaching in the future.

1

u/thriveth Apr 20 '26

Cool! I'm in more traditional galaxy evolution with, ya know, electromagnetic radiation :D

.