Skip to main content

Module synctex

Module synctex 

Source
Expand description

SyncTeX output (\synctex, -synctex): the <job>.synctex.gz file with which editors and viewers map source lines to positions in the PDF and back.

The format is described in man 5 synctex. What LuaTeX records, and where, comes from the files it writes (observed):

  • The file starts with a preamble (SyncTeX Version:1, the Input: lines of the files read so far, Output:pdf, Magnification:, Unit:1 and zero offsets), then Content:. Each \input file gets the next tag; its Input: line names it with the current directory in front of a relative name (/dir/./doc.tex) and is written when the file is opened (in the preamble if no page has been shipped yet).
  • Each page is a sheet {n … }n holding the records of its boxes. Positions are in scaled points from the top left corner of the page, with the 1in origin (\pdfhorigin, \hoffset, …) included. A box resource is written inside the sheet of the page (or form) that first uses it, after its boxes, as a sheet numbered {n+1 … }n ({1 … }0 for an immediate one), with its bottom left corner at (0, \pageheight).
  • In vertical lists only boxes are recorded: [ for a vbox at its top left corner, ( for an hbox at its reference point, v/h for an empty one at the bottom of the space it takes, all with their width, height and depth. In horizontal lists: boxes (empty ones at their start), glue (g, where it ends; rule leaders too, box leaders give their boxes), rules (r, where they end, with their dimensions as stored, running ones as −2³⁰), math nodes ($, where they are) and some kerns (k, see Synctex::kern). A run of glyphs gives an x record where it ends, with the tag and line of the last record or kern: glyphs have no fields. Marks, inserts, adjusts, boundaries and local paragraph nodes do not end a run; other nodes do.
  • Nodes have the tag and line of the input when they were made (boxes when packaged, rules before their dimensions are scanned). Lua output and \scantokens text have tag 0 and count their own lines. Glue, kerns, rules and math nodes with tag or line 0 are not recorded and change nothing.
  • !n records mark byte offsets (from the previous one); Count: gives the number of records, x records not included.

The fields of the nodes are kept in crate::nodes::SyncFields while SyncTeX is on.

Structs§

Synctex
The SyncTeX state of a run.

Type Aliases§

Fields
Tag and line.