You need to put group1, etc. in " quotes in the first three lines. To have the figures show up in the outlines, you’ll also need to add captions.
But figures are probably not what you want to use here. What’s the concrete use case? What are these different outlines? For headings you probably just need to find a clever target: ... for the outlines. You can use a selector to target headings that come before or after some point in your document, or headings with different supplements, or headings with particular labels…
Here is a real-life example. A book is very thick and deeply structured. There are two outlines: a brief one and a detailed one. The brief is located in the beginning and the detailed in the end.
Like @sijo said, it’d be better to specify the target parameter of outline. But if you are only looking to filter based on the heading level, then you might as well use depth
Amazing, thanks! But it turns out there is another issue now. What if I need to create a link to a heading? In such a case, I should use an individual label, like #link(<lorem>)[Link to Lorem], right?
Yep you cannot have several labels for the same thing…
One solution would be to remove the <group1> label for this heading and to make the outline with target: selector(<group1>).or(<lorem>). But that’s annoying to keep up to date.
Another solution maybe is to put the extra label just before the heading:
#metadata(none)<lorem>
= Lorem <group1>
I think that way the link might go to the right location, at least if the heading is not placed in a fancy unusual way.
Instead of labelling every single heading of each group individually, you should probably define a better target in the outline.
Is there a structured rule as to how you label headings by group?
I don’t know if this can interfere with other things, like the sticky property of headings… The metadata before the heading seemed less intrusive. But if it works it’s a nice solution.
[@quachpas] For me, there are two use cases to have multiple outlines.
The first use case is already illustrated by the screenshots above. This is when you need a brief outline and a detailed outline.
The second use case is when you need to combine headings arbitrary. E.g., you have a document with headings A, B, C, and so on, to Z. And your main outline includes all of them. But some sections may have special interest, and you may want to have a second outline specifically for them. In such a case, this can look like:
Main outline (26 elements):
A .....
B .....
C .....
D .....
E .....
.
.
.
Z .....
Additional outline (3 elements):
E .....
M .....
X .....
To put the request for more information in another way: what is your rationale for labelling something <group1>? Do all these headings have something in common that we could use in target?
If you mean something in common in their appearance, as if they are red or italic or have specific prefix, the answer is no. The appearance of group1-headings, group2-headings, and group3-headings is the same. The headings are separated into three groups soleley on which things they talk about.
Recently I asked a different question: How to create a link to a section in such a way that link text will be the same as the heading itself, and if the heading will be changed, link text will be updated automatically, i.e. instead of writing #link<lorem>)[Lorem], we could write just #link<lorem>)[] (https://forum.typst.app/t/1221). It was answered by @xkevio.
It seems that though #metadata and #[ ... ] solutions can work with xkevio’s solution in theory, it would be quite fragile. So currently I decided to use the target: selector(<...>).or(<...>) solution, mentioned by @sijo above.
If the headings are labelled based on their contents, I think you might as well have a super-heading grouping them. If you don’t like having a “chapter” heading, then you can reserve level 1 for invisible headings, and just use it for selection purposes, i.e. all select all headings after chapter, before next chapter.
You can reserve level 1 for invisible headings, and just use it for selection purposes, i.e. all select all headings after chapter, before next chapter.
This seems to be an interesting idea, but could you show how to do it? It seems it is not something built-in into the #outline function, and we need hand-script it, right?