You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
references to labels in #include documents bomb on standalone #1276
I am re-doing a largeish handbook from LaTeX/LyX in typst.
In LyX the concept of “child document” allows referencing labels in other (child) documents even when compiling a (child) document standalone (for speed).
When I try to do this in typst it generates errors when the labels are missing (standalone). It works very well when doing the master document (with the required) #includes.
I would not mind a warning on compilation and perhaps an obvious text being inserted, ie bold and uppercase MISSINGLABEL in the PDF, perhaps even in red or something.
Use Case
This would allow to generate #include’d files to be compiled standalone.
Activity
Enivex commentedon May 21, 2023
This should be achievable right now by creating a custom ref function that uses https://typst.app/docs/reference/meta/query/ to check for the existence of the label. Though I haven't actually tried.
It wouldn't be a bad idea to have an optional fallback value for #ref so it fails more gracefully.
ondohotola commentedon May 21, 2023
Great,
could you perhaps do that? It’s way beyond my capabilities.
Enivex commentedon May 21, 2023
Proof of concept:
main.typ
child.typ
Compiled main.typ

Compiled child.typ

laurmaedje commentedon May 21, 2023
Could probably also use a ref show rule instead of a custom ref function.
Enivex commentedon May 21, 2023
I considered the possibility, but I didn't know exactly how to make it work.
ondohotola commentedon May 23, 2023
@Enivex posted the solution to the Discord (which I have slightly adapted:
main.typ
child.typ
which does the trick very nicely indeed.
Thank you very much.
feat: remove option to print bibliography standalone chapter