#set page(paper: "a4")
This is the *config.typ* file.
main.typ:
#include "config.typ"
This is the *main.typ* file.
I noticed that when previewing the main.typ file there’s a page break after the contents of the config.typ file. Why? How can this be avoided?
This is likely not the best way to configure the layout of a document in Typst, however I still think an #input(file.typ) function could be helpful in some scenarios as also suggested in this GitHub issue.
My objective with this functionality (if it exists) would be to split a very long main.typ file into several smaller Typst files so that the project could be “organized better”. Is that possible? Any help is appreciated!
A crucial difference to remember is that include evaluates the file and returns content, whereas import will return a module (from which you can select functions, etc.). See Scripting – Typst Documentation.
Thank you for the explanation! Though I still find it a bit “confusing” that a page break is blindly inserted even though the page layout is already conforming.
Are you maybe looking for how to make a template? Page setup could be part of a template, that you define in the template but import and apply in the document.