diff --git a/README.md b/README.md index 705e035..511ad48 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ configure the whole document and `attachment` helper function. Important argumen - `abstract`: A record with `primary` and `secondary` abstracts. Each has `text` (content) and `keywords` (array) as well as `title`, `lang` and `keyword-title`. - `bibliography`: Result of `bibliography("path/to/file.yml")` or `none`. -- `attachments`: Tuple of `attachment(...)` items (tables, figures). +- `attachments`: Tuple of `attachment(...)` items (tables, figures). All attachments must be referenced in the document body to appear in the outline. - `display-documentary`: Whether to display the documentary page at the end. Defaults to `true`. - `description`: Document description for PDF metadata. Defaults to `none`. - Positional argument: the document body follows the `ludf.with(...)` call. diff --git a/src/lib.typ b/src/lib.typ index 26eb35e..42db58c 100644 --- a/src/lib.typ +++ b/src/lib.typ @@ -272,12 +272,26 @@ // Table of contents. // Uppercase 1st level headings in ToC - show outline.entry.where(level: 1): it => { upper(it) } + // show outline.entry.where(level: 1): it => { upper(it) } + + // Format attachment entries in outline + show outline.entry: it => { + let el = it.element + if el.func() == figure { + let num = numbering(el.numbering, ..el.counter.at(el.location())) + let pg = counter(page).at(el.location()).first() + return block[#link( + el.location(), + )[#num #el.supplement. #el.caption.body] #box(width: 1fr, it.fill) #pg] + } + it + } outline( depth: 3, indent: 1cm, title: text(size: 14pt, outline-title), + target: selector(heading).or(figure.where(kind: "attachment")), ) // Display the paper's contents.