File paths such as /sections/preface/preface.typ"
are always relative to where they are used:
// a.typ
#let my-include(path) = include path
// b.typ
#import "@local/test-template:0.1.0": my-include
#include "foo.typ" // relative to b.typ
#my-include("foo.typ") // relative to a.typ
in your case, that means your (absolute) paths would be relative to (the package containing) functions.typ
. The way around this is to not pass paths, but content to your template:
before: ( //my list of files to include
preface: include "/sections/preface/preface.typ",
acknowledgement: include "/sections/preface/acknowledgement.typ",
contents: include "/sections/preface/contents.typ",
readers_guide: include "/sections/preface/readers_guide.typ",
),
Eventually, there should be a distinct path type that lets you pass paths to other places, while retaining what they’re relative to, but this doesn’t exist yet. You can read more on the topic here: