I want to typeset multiple books all of whose content is updated regularly.
I have managed to create the content of these books as typst files: book1.typ., book2.typ, etc. Each of these books has multiple chapters, a preface and a block with title page info.
I have typeset one of them by importing its content into a main typst file (main1.typ) using #include book1.typ.
Now I need to insert a certain content (for instance the copyrights page and the dedication page) into this imported file after the title page block and before the preface. How can I do it?
I don’t want to meddle with the book1.typ since i prefer that it handle only the essential content. Moreover the copyrights page and dedication page are almost same for all the books. Could someone help me with this?
Both the solutions are great. Is there no way to achieve this without adding any lines to the book1.typ file? A fully automatic solution would be great since it would spare me the effort of modifying my book1.typ file every time it is updated.
I mean, since you’re placing some content at specific places in your book (not just before and after your content), you need a way to indicate where to put this content, Typst can’t guess for you…
The solutions proposed are easy modifications of your book1.typ and you don’t have to touch them when you modify other parts of main.typor book1.typ.
If you really don’t want to modify book1.typ but there’s a way to identify the place to insert your dedication and copyright by examining the content, you might use a regex in a show (basically the second solution but using a regex instead of metadata to specify the insertion point). It’s more complicated in my opinion than just pasting a #metadata(none)<...> where you want it but it avoid modifying the file.