How to apply titlecase to headings in Document Outline?

I would do it manually, I don’t recommend the following. There is a very hacky way to do it. You can modify the example in How to display chapter numbers in PDF bookmarks? - #4 by bluss from @Y.D.X and @bluss.

#import "@preview/titleize:0.1.1": string-to-titlecase, titlecase


// Remove original headings from bookmarks. We will add new ones later.
#set heading(bookmarked: false)
#show heading: it => if it.numbering == none {
  // This heading has been processed. Keep it untouched.
  it
} else {
  let (numbering, body, ..args) = it.fields()
  let _ = args.remove("label", default: none)

  // Render the numbering manually
  let numbered-body = block({
    counter(heading).display(numbering)
    [ ] // space in the bookmark
    string-to-titlecase(body.text)
  })

  // regular heading
  it

  // Add our bookmarked, hidden heading
  show heading: none
  heading(..args, outlined: false, bookmarked: true, numbering: none, numbered-body)
}

#show heading: titlecase
#set heading(numbering: "I.I")

#outline()

= simple heading

== simple heading2

= simple heading3
1 Like