How to number only the first and second order headings?

If I have the following type document:

#set heading(numbering: "1.1")

= Heading 1

== Heading 2

=== Heading 3

I get the following PDF:

1. Heading 1
1.1 Heading 2
1.1.1 Heading 3

However, I would like only the first and second order headings to be numbered, but not the subordinate headings:

1. Heading 1
1.1 Heading 2
Heading 3

You can use show-set rules to filter them:

#show heading.where(level: 1): set heading(numbering: "1.1")
#show heading.where(level: 2): set heading(numbering: "1.1")
// For higher levels
#set heading(numbering: none)

= Level 1
== Level 2
=== Level 3
==== Level 4

1 Like