#Document Index

1 messages · Page 1 of 1 (latest)

languid spruce
#

Is there a way to create an Index Page, referring to entries explicitly marked in the text of the document?

gloomy yacht
#

?render

#set page("a7")
#outline(title: [My cool labels], target: figure.where(kind: "my_outline"))

#show figure.where(kind: "my_outline"): it => {
  it.body
}
#let creative_name(content, caption) = figure(content, caption: caption, supplement: [], numbering: none, kind: "my_outline")

#creative_name([My very cool, referenced text], [Cool title])
#creative_name([My very cool, referenced text], [Cool title1])
#creative_name([My very cool, referenced text], [Cool title2])
gloomy yacht
#

If you want them numbered or all have a common text in front of them, you can play around with "supplement" and "numbering" of creative_name

languid spruce
#

That looks promising, thank you.

But it seems I cannot compile it. It complains about an "unexpected argument" in the call to outline(...) with the kind: "my_outline".
I am using the very current version from the git repositories main branch.

languid spruce
languid spruce
#

Ok, got it. Now it works in my document as well.

But there are still some problems. If I mark a word with #Index[MyEntryOne] (Index is what i changed creative_name to) in the text to put it into the index, the "MyEntryOne" is visible in the resulting document.

= Sample Code
This is a sample text to test the indexing functionality #Index[Function] of the Typst system.

In this sample, the resulting document contains the word "Function", which is intended to appear only in the index, also centered in the text flow (as the caption of the underlying figure.
I tried to hide the figure with

#show figure.where(kind: "my_index"): it => {}

But it still prints ist caption.

Is there a way to avoid the figure at all and put an invisible custom element into the text, that can be queried to generate the Index page later?

languid spruce
#

Ok, found out, why the hiding of the entries did not worked: I had the show in the wrong scope. Now it works fine. Thanks again!