Best way to structure multi-volume works

I am writing a language teaching-learning curriculum with Typst. The expected output is multi-volume / multi-format (vastly different layout: book-like layouts and slides)

  1. a curriculum (driven from external data source)
  2. a dictionary (driven from external data source)
  3. a teacher’s guide
  4. teacher’s slides for lessons
  5. a student’s workbook

These are tightly coupled to one another (e.g., the teacher’s guide may reference (curriculum) “Skill 3.2” and “page 65 of student’s workbook” and these numbering are dynamic). This will take up three years of my life, so I want to investigate some manageable way of handling the typesetting, so I can “just write”.

I can see this being done in one of two ways:

  • single document, post-process splitting. I’ll keep page numbers for each work in separate indices, and cut up the PDF manually.
    • (+): all references are internal references
    • (-): no way to change document type (i.e., touying slides have to be managed separately). Typst had been extremely fast for me even on large complex documents, so I think the friction from compiling all documents every time is negligible.
  • external index. Each output is its own Typst file, and at each typeset run there is also an external index being written to and referenced from.
    • (+): flexibility for each document
    • (-): I think this introduces lots of room for error, dependencies becomes cyclic etc.

I’m leaning towards a single document, and handle irregular materials manually at some later stage. Thoughts / suggestions / comments on considerations entirely amiss?

The single-document approach seems impractical, since you would have to split up the resulting PDF afterwards.

As far as I know, it is not possible to reference labels that are outside of the document typst is compiling at one time. Some kind of shell escape would be necessary to query from other typst files.

You might want to have a look at Prequery

Years before I found out about Typst, I tried to do something very similar and never found a suitable solution. You might try looking into the sys function, though.

There is definitely good reason to keep it all in a single document if possible. It reduces the opportunity for drift between views and versions.

Assuming you are using the command line compiler, you might be able to use --input view=guide to pass the view variable to your Typst file. From there, use conditionals to decide what to print and where.

There are trade-offs, of course, but if you want to keep it all in one file, I think passing parameters through the command line would be the easiest way to do it.