How to have first line indent in a new paragraph after a math block?

Hello. I always use first line indents for my paragraphs. When I write equations in an article, sometimes I add a new paragraph immediately after a math block, like this:

    Lorem ipsum dolor sit amet 
             a^2+b^2=c
    New paragraph should be indented. Lorem ipsum dolor sit amet

Right now Typst seems to not support this, and doesn’t indent my new paragraph after the math block no matter what I do. Here’s what I’ve tried:

#set par(first-line-indent: 2em)
#lorem(30)
$ A xor B dot.circle C = D^2 mod F^2 $

#parbreak()
New paragraph (No indent)

Second paragraph (Indent appears)

If I were writing in markdown, I would’ve just put a tab before the newline and most software would acknowledge it. Does anyone know how to do this? I am very new to Typst.

You’re right, Typst currently only indents successive paragraphs, and doesn’t indent the first paragraph after block content. To work around this, you can use the h function (horizontal space function):

#set par(first-line-indent: 2em)
#lorem(30)
$ A xor B dot.circle C = D^2 mod F^2 $

#h(2em) New paragraph (now with indent)

Second paragraph (Indent appears)

If you only use one block equation at a time and a paragraph always follows a block equation, you can use a show rule to make this change for all paragraphs:

#set par(first-line-indent: 2em)

#show math.equation: it => {
  it
  if it.block {
    h(2em)
  }
}

#lorem(30)
$ A xor B dot.circle C = D^2 mod F^2 $

New paragraph (now with indent, even without `h` in front)

Second paragraph (Indent appears)
1 Like