If there is a piece of text, how can I turn it into an indented style like the first line hanging in word.
You have a few options here:
- If you want to replicate your example image precisely, you should use an enumerated list which automatically features a hanging indent.
- In normal paragraphs, you can set the
hanging-indent
parameter which will indent all but the first line. - Maybe you want to also, or exclusively, indent the first line in which case there’s a
first-line-indent
parameter¹.
#set page(width: 9cm, height: auto)
// No indentation at all:
People are not born knowing the truth, who can be without doubt.
// Hanging indentation as part of the enumerated list:
+ People are not born knowing the truth, who can be without doubt.
#set par(hanging-indent: 1em)
// Paragraph hanging indentation:
People are not born knowing the truth, who can be without doubt.
#set par(first-line-indent: 1em, hanging-indent: 0em)
// Paragraph first-line indentation:
People are not born knowing the truth, who can be without doubt.
¹Behavior of first line indentation in paragraphs seems limiting · Issue #311 · typst/typst · GitHub
1 Like
I want to point out that hanging-indent
in this case doesn’t have to be explicitly set, since it’s set to 0pt
by default. It’s also more common to zero-out something by using 0pt
.
In this case, it does have to be set since this represents code from the same document. If it was a stand-alone declaration, you would be correct.
Oh, yeah, sure. I got standalone version in mind.