Appendices: best way to reference them (and reference each other)

Hello, I have the following layout of documents:

  • A main paper, which references several appendices.
  • Some of these appendices also refer to other appendices.
  • The main paper has its own bibliography, and so do some appendices.

What is the best way to refer to appendices from:

  • Within the main paper
  • Within another appendix

In the end for the final submitted paper I would still want a pdf that shows
main paper → appendix A → appendix B → …

I read about include, but that does not work in this case since I have multiple bibliographies. It also conflicts with the fact that appendix B refers to appendix A (this would mean if the main paper references both A and B, A is included twice (once original reference and once through B)).

What is the best way to approach this? Without too much manual referencing.
Are there any guides out there on how to do this properly?

I have implement this using a function and show rule. You can look at the code of bookly, elsearticle or elsepub templates available on Typst universe.

Here is how it is implemented:

// Appendix
#let appendix(body) = {
  set heading(numbering: "A.1.", supplement: [Appendix])
  // Reset heading counter
  counter(heading).update(0)

  // Equation numbering
  let numbering-eq = (..n) => {
    let h1 = counter(heading).get().first()
    numbering("(A.1a)", h1, ..n)
  }
  set math.equation(numbering: numbering-eq)

  // Figure and Table numbering
  let numbering-fig = n => {
    let h1 = counter(heading).get().first()
    numbering("A.1", h1, n)
  }
  set figure(numbering: numbering-fig)

  isappendix.update(true)

  body
}

This looks neat, though how exactly should this be used?
Something like appendix(include "app-a.typ") (not sure if that is even valid syntax)
Also, isappendix declaration seems to be missing from your snippet.

EDIT: appendix(include "app-a.typ") does seem to work, but it does not update the headers and equation numbering in the document. It also seems to mess with the outline function (appendix outline includes main paper headings). It also does not work with multiple bibliographies.

All of this is making me wonder if my approach in general is just wrong?

Actually, you can structure your paper like this:

// Template initialization
#show: paper.with(...)

// Put main content here
...

// Start appendix
#show: appendix

#include "appendixA.typ"
#include "appendixB.typ"

// Display bibliography
#bibliography(...)

That does not seem to fix any of the issues I stated in my previous edited comment unfortunately.

Can you provide an MWE, because the code snippet I provided works perfectly with my templates.

Did you import your template into your appendix typ files ? It could be the root of your problem.

Not sure if there’s an easy way to share complete typst projects, but here is a MWE:

// main.typ
#import "assets/template.typ": *
#set text(lang: "en")
#show: tech-doc

#set document(
  date: datetime(day: 4, month: 2, year: 2026),
  title: [Title],
  author: "ISOREX",
  keywords: ("a", "b", "c"),
)

#let version = [0.1]

#align(center)[
  #title()
]

#author-info(version: "0.6")

== Abstract
#lorem(100)

= Chapter 1
#lorem(100) @ref-b

#figure(
  rect(), caption: []
)

#lorem(100)

#pagebreak()
// #bibliography("assets/references.yml") // <-- multiple bibliographies not yet supported

#show: appendix

#include "app-1.typ"
// app-1.typ
#import "assets/template.typ": *
#set text(lang: "en")
#show: tech-doc

#set document(
  date: datetime(day: 7, month: 1, year: 2026),
  title: [Project M],
  description: [Calculations],
  author: "ISOREX",
)

#title-page(version: "0.1")

#set page(numbering: "I")

#outline(depth: 2)

#pagebreak()

#set page(numbering: "1")
#counter(page).update(1)

#set math.equation(
  numbering: "(1)",
  supplement: "Eq."
)

#show ref: it => {
  // provide custom reference for equations
  if it.element != none and it.element.func() == math.equation {
    // optional: wrap inside link, so whole label is linked
    link(it.target)[#it]
  } else {
    it
  }
}

#set heading(numbering: "1.")

= Chapter 1
#lorem(100) @ref-a

#figure(
  rect(), caption: []
)

#bibliography("assets/references.yml")
// assets/template.typ
#let tech-doc(doc) = {
  // Prevents table from breaking across pages
  show table: set block(breakable: false)

  // Add appendix to outline
  show outline.entry: it => {
    if it.element.supplement != [Appendix] { return it }
    [Appendix #it.prefix(): #it.inner()]
  }

  show "+-": "±"
  show table.cell.where(y: 0): strong

  doc
}


#let author-info(version: "0.1") = {
  set table(stroke: 0pt)
    table(
      columns: (1fr,) * 4,
      [Author], [#context document.author.first()], [ID], [012345],
      [Start date], [02/02/2026], [End date], [03/07/2026],
      [Version],
      [#version],
      [Date of issue],
      [#context document.date.display("[day]/[month]/[year]")],
    )
}

#let title-page(version: "0.1") = {
  let subtitle(content) = {
    set text(size: 20pt, style: "italic")
    block[#content]
  }
  show title: set text(size: 32pt)

  align(center + horizon)[
    #title[#context document.title]
    #subtitle[#context document.description ]
  ]

  align(bottom)[
    #author-info(version: version)
  ]

  pagebreak()
}

// Appendix
#let appendix(body) = {
  set heading(numbering: "A.1.", supplement: [Appendix])
  // Reset heading counter
  counter(heading).update(0)

  // Equation numbering
  let numbering-eq = (..n) => {
    let h1 = counter(heading).get().first()
    numbering("(A.1a)", h1, ..n)
  }
  set math.equation(numbering: numbering-eq)

  // Figure and Table numbering
  let numbering-fig = n => {
    let h1 = counter(heading).get().first()
    numbering("A.1", h1, n)
  }
  set figure(numbering: numbering-fig)

  // isappendix.update(true) // <-- where is this used?

  body
}
// assets/references.yml
ref-a:
  type: web
  author:
    - Wikipedia
  title: Reference A
  url:
    value: https://en.wikipedia.org/wiki/some-reference-a
    date: 2026-01-07

ref-b:
  type: web
  author:
    - Wikipedia
  title: Reference B
  url:
    value: https://en.wikipedia.org/wiki/some-reference-b
    date: 2026-01-07

I did notice that figures do have their numbering updated, but headings do not. The outline issue is also present here:

Bibliographies also do not work yet.

Actually, there are several problems in your code. You can see the modified version here Typst app.

You have a problem to solve with your outline. I fix one but not all.
In app-1.typ, you don’t need to call #show: tech-doc. Furthermore, you call #set heading(numbering: "1.") before = Chapter 1. This is the reason why your heading is not properly updated.

Thanks. I also noticed that the multiple bibliography issue will be solved in 1.5 so with that I think this should be solved.
Hopefully 1.5 lands soon!

At the moment, you can use Alexandria for managing multiplie bibliographies.