Import Labels in Modules?

Is it possible to import labels in modules? I am trying to query a label that exists in another file, but the label doesn’t exist in the context.

import "other_file.typ": *

#context query(<mylabel>).first() // says array is empty

In other_file.typ:

$1+1=2$<mylabel>

I know I can use let-bindings instead of labels, but I’m wondering if this is possible, and if not, what the reason might be.

When querying, you can only query for elements and labels that are put into the final document (PDF).

So if “1+1=2” doesn’t show up in the document, you also cant query for it.

If you use include to include the other file, its contents get put into the document and you can query for them. import only imports the variables of the other file, and ignores plain content.

1 Like