How do I tell typst what the main file is?

Hi all. Typst is great, but I cannot figure out how to work well with a project that uses #include files. I have a main.typ, that includes several chapter or section files.

The problem: I open “main.typ”, and everything looks great. If I open one of the chapter files and I get errors, such as “the document does not contain a bibliography”. Obviously it is trying to compile the document on its own, rather than as an included file in main.typ.

Where it occurs: This occurs in neovim (with a standard typst setup). It also occurs in Edist (a native mac app for editing typst). I assume this happens in other editors too.

When I search online about this I see solutions for vscode for “pinning” the main file (using Tinymist). But this seems like the wrong place to solve this problem, as this only cures the issues for those using tinymist.

The question: So, is there a way to solve this in typst? If not, why not? Should I open a feature request?

Cheers,
Brett

Hi, welcome to the forum!

This does not answer your exact questions, but Neovim also has a tinymist.pinMain command. See Working with Multiple-Files Projects.

1 Like

Would you mind posting a stripped down example that generates the error message please. I suspect this discussion will raise awareness of any idiosyncrasies that can arise with multi-file documents.

1 Like