go-synctex is a pure-Go (no cgo) parser for SyncTeX, the
.synctex.gz file TeX engines (pdflatex / xelatex /
lualatex) emit to link a .tex source line to the exact
spot on the PDF page — in both directions. It answers forward
queries ((file, line) → (page, x, y): jump the viewer to where a line was typeset)
and backward queries ((page, x, y) → (file, line): click a glyph and
jump back to the source). It depends on nothing but the standard library, guards against hostile
input with a decompression-size cap, and can scope Input: paths to a project root so
absolute host paths never leak to a client — 100% coverage, CI green across 6 arches.
SyncTeX file parsing ready
Reads .synctex.gz (and plain .synctex): the Version / Input:tag:path map, the Content: block, {page blocks and the node records ([, h, v, k, g, x) with their N,L:X,Y anchor prefix, up to Postamble:.
Forward search ready
(source file, line) → (page, x, y). Records are indexed per source file and binary-searched for the nearest line ≥ the query, so an editor can jump the PDF viewer to where a line was typeset.
Backward search ready
(page, x, y) → (source file, line). Picks the record closest to a clicked PDF coordinate, so a viewer can jump back to the source that produced a glyph — the full round-trip.
Hardening & path scoping ready
A 32 MB decompression cap defeats zip-bomb .synctex.gz inputs; WithProjectRoot drops Input: paths outside the project root and rewrites in-root paths relative-to-root so absolute host paths never leak to a client.
Coordinates & coverage ready
Anchors are exposed as raw SyncTeX scaled points (sp; PDF points = sp / 65536) so callers apply their own point/DPI scaling. 100% coverage including every error branch, gofmt + go vet clean, green across all six 64-bit Go arches.
Typed sp/point helpers & box dimensions planned
Possible future surface: a typed scaled-point/PDF-point helper, parsing the trailing W,H,D box dimensions (only the anchor is read today), and a streaming parse API for very large jobs.
- ready capability complete (exit criteria met, nothing material left)
- active in progress (substantial work shipped, not yet finished)
- planned not started yet (or downstream by design)
A pure-Go, cgo-free parser for TeX's SyncTeX output, so it cross-compiles and
embeds anywhere — inside an editor, a PDF viewer, or a build server — with nothing to install
alongside it. It reads .synctex.gz and plain .synctex, indexes the
records, and answers forward (source → PDF) and backward (PDF → source) queries, exposing anchors
as raw SyncTeX scaled points so callers apply their own point/DPI scaling. Hardened against
zip-bomb inputs and untrusted Input: paths, at 100% coverage across the six 64-bit Go
targets. Part of github.com/go-synctex.