My body paragraphs are indented. Run-in headings then also indent. How do I prevent this (aside from manually removing indenting on every body paragraph which follows a run-in heading)?
I think your question is distinct enough that it warrants its own topic; this way people can better find it by the title. Feel free to change it if I didn’t get it right ![]()
Could you add an example of the layout you have? That will help us find the necessary changes to make it work.
This seems to work in this simple example:
#set par(first-line-indent: (amount: 2em, all: true))
#show par: it => {
if it.first-line-indent == (amount: 0pt, all: false) { return it }
let children = it.body.at("children", default: none)
if children == none or children.len() == 0 { return it }
let child = children.first().at("child", default: none)
if child == none { return it }
if child.func() != box { return it }
let body = child.at("body", default: none)
if body == none { return it }
if body.func() == figure and body.kind == "h2" {
return par(first-line-indent: 0pt, it.body)
}
return it
}
#show heading.where(level: 2): it => box(
figure(kind: "h2", supplement: none, it.body))
= A
#lorem(30)
== A1
#lorem(30)
Surely there’s a better way ![]()
Yes, you’ve summed up my problem correctly. Here’s my MWE:
#show heading.where(level: 1): it => upper(it.body)
#set par(first-line-indent: 1em)
= Heading
#lorem(20)
= Heading
#lorem(20)
Gives me:

I want it to look like:

The suggested solution looks clever, also much more complicated than it seems like it ought to be. Particularly if I have more than one style of run-in heading (which I generally do).
I agree, there should be an easier way.
Ah your problem is actually a bit different from what I thought: you’re not using first-line-indent: (all: true, ...). Then you can solve it by making sure that the headings are always in a “first paragraph” after a block:
#show heading.where(level: 1): it => block() + upper(it.body)
You can adjust the block() parameters to tune the spacing.
