Is there an an equivalent to the `\graphicspath{path}` command from LaTeX in Typst?

First, I’ll link this discussion because there is some relevant stuff in there:

This gives us some limitations, but also opportunities. Let’s say all your images are found in path/. Then you can create a file path/images.typ and define the following function there:

#let _image = image

#let image(file, ..args) = _image(file, ..args)

a call to this (not the builtin) image function will automatically treat the file path relative to the path/images.typ file!

What I usually do has a similar result, but I actually try to avoid to even use image paths across the whole project. Instead I define helper functions for my assets:

#let logo = image.with("logo.svg")
#let banner = image.with("banner.jpg")

Then I call these like assets.logo(height: 2cm). For the kinds of images I use in my documents that feels more useful to me, but it’s definitely an opinionated solution.

2 Likes