Problem
Let’s say I import a template which also styles the numbering of a numbered list. Then, somewhere in my document, I want to have a numbered list with explicit numbering set, which does not affect the numbering of the sub-lists.
The contents of the template.typ file:
#let template(
// ... some other parameters
body,
) = {
// ... some code defining the template
// In this example, the numbering is set to "I."
// But this can also be any other numbering pattern as well.
set enum(numbering: "I.")
// ... the rest of the template
body
}
The contents of the main.typ file:
#import "template.typ": template
#show: template.with(
// ... some arguments
)
// ... some markup defining the document
#[
#set enum(numbering: "a)")
+ First list item
+ First sub-list item
+ Second sub-list item
// ... other sub-list items
+ Second list item
// ... another sub-list
// ... other list items with sub-lists
]
// ... the rest of the document
In this example, the numbering for both the main list and the sub-lists is “a)”, which is correct for the main list but incorrect for the sub-lists. I want the sub-lists numbering to be the same as the one set by the template (“I.”).
Nonoptimal solutions
To my knowledge, there are two ways I could approach this, but I like neither of them.
Using the enum function
Instead of using the dedicated syntax (markup) to define a numbered list, I could use the enum function (code), but this looks ugly in my opinion, especially for long lists:
#enum(numbering: "a)")[
First list item
+ First sub-list item
+ Second sub-list item
// ... other sub-list items
][
Second list item
// ... another sub-list
]
// ... other list items with sub-lists
Rewriting the set rule for each sub-list
I could also rewrite the template’s set rule for each sub-list individually, but a bit tedious and also creates a dependency on the template, so you have to update each set rule whenever you want to change it:
#[
#set enum(numbering: "a)")
+ First list item #[
#set enum(numbering: "I.")
+ First sub-list item
+ Second sub-list item
// ... other sub-list items
]
+ Second list item
// ... another sub-list
// ... other list items with sub-lists
]