How to receive a user supplied path in a package function?

Hi everyone,

I finally decided to try the package the system with my home cooked templates.

One of the templates takes the path to an image as an argument. My problem is that all paths seems to be relative to the package folder rather than the .typ file to compile.

Is it possible to :

  • Supply a path relative to the path of the file to compile, or failing that,
  • Supply an absolute path ?

Many thanks.

Packages cannot access project files, unless the package is installed inside of the project
If you want to pass an image to your template, you will have to read it in your project and pass the image object to the template

#let img = image("my_nice_image.png")
#show: my-template.with(img)

Works like a charm thank you very much!

Hey @Peio, welcome to the forum! I’ve changed your question post’s title to better fit our guidelines: How to post in the Questions category

For future posts, make sure your title is a question you’d ask to a friend about Typst. :wink: