Shujun Tan
Shujun Tan

Reputation: 21

How to change the paragraph spacing in Typst?

How to change the paragraph spacing in Typst? Do we have any codes to perform it? It seems the function par() is not the case.......

I tried to look for the relevant codes, but I failed to find them. Any suggestions, mates?

Upvotes: 2

Views: 2005

Answers (2)

Aromia
Aromia

Reputation: 1

Since this the first result appeared on google when I searched "typst double line spacing", here is a solution to double spacing for you:

#set par(
  justify: true,
  leading: 2em,
  spacing: 3em
)

#show heading: it => [
  #set par(
    leading: 1em,
    spacing: 1em
  )
  #it.body
]

I added the show rule for headings since if there is a 2-line or 3-line heading, it will also have a huge spacing.

Upvotes: 0

ntjess
ntjess

Reputation: 1450

Do you mean the spacing between paragraphs, or lines in the paragraph?

leading controls the spacing between lines:

#set par(leading: 2em)
#lorem(100)

enter image description here

A block's spacing controls the distance between paragraphs:

#set block(spacing: 4em)
#lorem(30)

#lorem(30)

enter image description here

Upvotes: 4

Related Questions