I am using the move(image.. method to insert an external pdf into typst:
I would like to cross-reference a chapter in the included pdf from my document. Thinking of setting some type of invisible marker in the pdf, or other reference (h1 search?).
Is this possible? I have pdfXChange, so setting the marker would be no problem.
Hi there!
I don’t know if it’s precise enough for your use case, but it’s the easiest solution I can think of:
You could add a reference to the page in the PDF-document where the chapter begins and name the link manually. Here is an example code where you can add references with the referencer variable by giving it the page number to link to as the key and the label of the link as the value. Note that you have to set the end of the range in the for loop to the number of pages in the PDF document.
A reference to page 3: #link(<label-page-3>)[my reference to page 3]
A reference to page 5: #link(<label-page-5>)[my reference to page 5]
#let referencer = (
"3": <label-page-3>,
"5": <label-page-5>
)
// #referencer.at(str(3))
#for page in range(1, 10, inclusive: true) [
#if str(page) in referencer.keys() [
#image("my_pdf.pdf", page: page)
#referencer.at(str(page))
] else [
#image("my_pdf.pdf", page: page)
]
]
If you have a question about this solution or need a better solution, don’t hesitate to ask again