How to style all outlines that are not the table of contents?

I want to add a colon to the entries of all outlines that are not the table of contents in my document (index of figures, index of tables, index of algorithms…). Is there a solution that does not involve exhaustively iterating on all these types of outlines like what follows?

#show outline.where(target: figure.where(supplement: [Figure])).or(
  outline.where(target: figure.where(supplement: [Table]))).or(
  outline.where(target: figure.where(supplement: [Algorithm]))
  // and so on...
): out => {
  show outline.entry: ent => ent.indented(
    [#ent.prefix():], ent.inner()
  )
  out
}

You can set up a conditional show rule for the outline entries to add the colon depending on the outline target. This allows you to just exclude the outline entries of headings.

On another note, your show rule for the outline entry with a colon was missing the link to the element, see the docs on “Building an entry”.

#let colon-entry(it) = {
  link(
    it.element.location(),
    it.indented([#it.prefix():], it.inner())
  )
}

#show outline: out => {
  show outline.entry: it => if out.target == selector(heading) { it } else { colon-entry(it) }
  out 
}
1 Like