Strange indent when a theorem in theorem(theoretic package)

#import "@preview/theoretic:0.2.0" as theoretic
#set par(first-line-indent: (amount: 2em, all: true))
#theoretic.theorem[#lorem(10) #theoretic.theorem[1111]]

I want the 2 theorem have the same indent and keep them nested.

Put a block in the second theorem can do this, but I don’t know why.

Hi @LRoInT!

Typst interprets the content of your inner theorem as normal text, not as a paragraph. The theorem function uses a block element, and inside it the text needs either a parbreak or a block-level elment to be interpreted as a paragraph. See the docs.

Hmm, this is not very nice that it sometimes gets the paragraph indent, based on whether it has a paragraph break or not in it. You can work around this by modifying the fmt-body function:

#import "@preview/theoretic:0.2.0"

#set par(first-line-indent: (amount: 2em, all: true))
#let theorem = theoretic.theorem.with(
  fmt-body: (body, solution) => { theoretic.fmt-body(body, solution); parbreak(); },
)

#lorem(30)

#block[
  #theorem[#lorem(10)]
  #theorem[
    1111

    #lorem(20)
  ]
]

(I should probably update the package to do this by default)


Unrelated, but I would recommend you don’t nest the theorems (there is no benefit to it). If you want to group theorems somehow, why not wrap them both in some outer block?