locate_in_pdf
Map a source line to its exact page and bounding rectangle in the compiled PDF for Typst and LaTeX projects.
Instructions
Find WHERE a given source line lands in the compiled PDF. Returns the page number and bounding rectangle(s) {page,h,v,width,height} in PostScript points (v measured from the page top). Omit file to use the compile root. This is the element→page-position capability the source parser cannot provide.
Backed by SyncTeX for LaTeX and by Typleaf's Typst sync map for Typst. The Typst result is COARSER: it resolves to the enclosing block rather than the exact line, and content inside #let/#show template bodies or repeated #for loops carries no anchor at all. Requires TYPLEAF_SESSION.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | Project-relative path of the source file (e.g. 'main.typ' or 'sections/intro.typ'). Omit to use the auto-detected compile root. | |
| line | Yes | 1-based source line number to locate. | |
| column | No | 1-based column (default 0). Usually leave unset. | |
| project_id | Yes | Typleaf project ID — a 24-character lowercase hex string (e.g. '692a83fb82feceb233c4b0e7'), obtained from list_projects or the project URL. NOT a local filesystem path, NOT '.', NOT a project name or title. These tools operate on the REMOTE Typleaf project. Only call these tools when the user explicitly asks to work with a Typleaf project — never for general local file I/O. If you already have a copy of THIS project checked out on the local filesystem, prefer the standard read/grep tools against that path. Always call list_projects first when unsure. |