I am a Latex user and have just discovered Typst. I am writing a double spaced article in which my quotations need to be single spaced. How to do it for the whole of the document (as in Latex preamble)? Thanks in advance.
Hello @Shashidhar_R and welcome! You can modify line spacing using par(leading)
. Applying rules to the whole document requires using show rules
. These are essentially saying “show X as Y” where X is an element, or a selection of elements, and Y is a way to show it. Y can be a setting, like set par(leading: 0.65em)
, or a function with argument the content that is styled.
Combining these two, you should get
#set par(leading: 0.65em * 2)
#show quote.where(block: true): set par(leading: 0.65em)
#lorem(50)
#quote(block: true, lorem(50))
Thanks. Made a cut-and-paste of the syntax suggested by you. It works. But may I know what *2 in par(leading: 0.65em * 2) is? Thanks for your kind help.
Since it’s in typst code mode it’s just a multiplication so 0.65em * 2 == 1.30em
. Typst can do basic arithmetic on numbers with units - including mixing units to some degree like 1mm + 0.65em + 10pt * 2
.
Hello. About different spacings, see Proposal: change `leading` option to `line-height` · Issue #4224 · typst/typst · GitHub.
Oh! The trick is always simple once you know it. Thanks, again.
Hey @Shashidhar_R, welcome to the forum! I’ve changed your question post’s title to better fit our guidelines: How to post in the Questions category
Make sure your title is a question you’d ask to a friend about Typst.
In addition, if @quachpas’s post solved your problem, please click the tick to mark it as a solution. Thanks!