Closed Tweoss closed 5 months ago
How does your typst-side template look like?
There is a long-term issue (feature) in typst, that typst will resolve the path inside of a eval relative to the "eval site".
If you use mimath/mitext
, whose the "eval site" is inside of the mitex package, then iftypst
block can only read files inside of the mitex package.
packages/mitex/mitex.typ
file.packages/mitex/
directory.If you uses mitex-convert
, and evaluate the converted code in your typst files, then you can load images.
/main.typ
./
.#import "/packages/mitex/lib.typ": *
#let res = mitex-convert(mode: "text", read("main.tex"))
#eval(res, mode: "markup", scope: mitex-scope)
It seems to me that the web demo is able to import both a bibliography and another template file.
The web demo is exactly using the trick here:
https://github.com/mitex-rs/underleaf/blob/main/fixtures/underleaf/ieee/main.typ
Ah, lovely! Thank you so much, importing the image and displaying works perfectly now! (as well as json data files)
Is it possible to load an image in a
iftypst
block?I've been able to use
typst.ts
withmapShadow
in the browser to render images. However, when I try to put this image in aiftypst
block, I get a"failed to load file (access denied)", trace: [Call(Some("mimath"))], hints: ["cannot read file outside of project root"
error.It seems to me that the web demo is able to import both a bibliography and another template file. However, I cannot figure out where in
packages/mitex-web/src
this virtual file system is handled. It appears that there is a VFS for the sidebar directory view, but I cannot tell how this integrates withmitex
. Is there some documentation on this?