But how should I handle packages? Where should I import them?
It would make sense to import them in the template, but this does not seem to work.
I have a project with the structure as in the website, i.e.
and it does not compile, because when I #include "chapters/chapter_1.typ"
it gives me error: unknown variable: dd even though the variable is defined in the package physika which I import in my template.typ and I import template.typ in my chapter_1.typ. If I import the package again in the chapter, everything works as expected.
Am I supposed to include every package in every chapter again? This seems like a non-optimal way to do this.
Interestingly, when I use dd in the main.typ, where physika is also not imported but template is (which is the same situation as in the chapter), everything works fine. So for some reason, the indirect import over the template works for the main function, but does not for the chapter-function. Why is that the case?
If you work with a really large™ document and everything is getting super slow (maybe because of many tables or graphics and complex layout), you might you want to compile single chapters while you work on them.
This can in principle be done by compiling just the chapter file – if it weren’t for references to sections/equations/… in other chapters.
A handy thing that can help you out here is adding this
#let no-ref(it) = {
show ref: _ => [[?]]
it
}
to your template. By writing
#show: no-ref
at the top of a chapter (right after importing the template), you can replace all references with a dummy temporarily.
Indeed, you can add this always to all chapters and just comment out the line show ref: _ => [[?]] in the template file when you want to go back to the full document.
This is no longer required in 0.12.0, as unknown references were downgraded to warnings, although this still helps to avoid the slew of warnings that may spam your diagnostic screen.
EDIT: I was wrong, it appears that this was not added in 0.12.0 for some reason.