synctex - Synchronize TeXnology help file


Synchronize TeXnology help file .Pq synctexs are text files that help input/output synchronization during document preparation with the TeX typesetting system.


The structure of this file should not be considered public, in the sense that no one should need to parse its contents, except the synctex command line utility, and the synctex_parser library. Unless it is absolutely not avoidable, access to the contents of the synctex file should only be made through requests made to the synctex command line utility.


The element structure of a synctex file is a list of text line records as follows. .Sq * , .Sq + , and .Sq ? have their usual EBNF meanings: .Sq * means zero or more, .Sq + means one or more, and .Sq ? means zero or one .Pq i.e., optional .

-item -offset indent
.Li <SyncTeX> ::= .Pq The whole contents in 4 sections

-item -offset indent
.Li <Preamble>
.Li <Content>
.Li <Postamble>
.Li <Post Scriptum>

Each section starts with the first occurrence of a sectioning line, and ends with the next section, if any. In the following definitions, we do not mention the section ending condition.

5. The preamble

-item -offset indent
.Li <Preamble> ::=

-item -offset indent
.Li Qq SyncTeX Version: <Version Number> <EOL>
.Li <Input Line>*
.Li Qq Magnification: <TeX magnification> <EOL>
.Li Qq Unit: <unit in scaled point> <EOL>
.Li Qq X Offset: <horizontal offset in scaled point> <EOL>
.Li Qq Y Offset: <vertical offset in scaled point> <EOL>
.Li <Input Line> ::= .Qq Input: <tag> .Qq : <File Name> <EOL>

6. The content

-item -offset indent
.Li <Content> ::=

-item -offset indent
.Li <byte offset record>
.Li Qq Content: <EOL>
.Li <sheet(1)>
.Li <Input Line>*
.Li <sheet(2)>
.Li <Input Line>*
.Li ...
.Li <sheet(N)>
.Li <Input Line>*
.Li <byte offset record> ::= .Qq ! <byte offset> <end of record>

-item -offset indent
.Li <sheet(n)> ::=

-item -offset indent
.Li <byte offset record>
.Li Qq { <the integer n> <end of record>/
.Li <box content>*
.Li <byte offset record>
.Li Qq } <the integer n> <end of record>

The <box content> describes what is inside a box. It is either a vertical or horizontal box, with some records related to glue, kern or math nodes.

-item -offset indent
.Li <box content> ::=

-item -offset indent
.Li <vbox section>|<hbox section>
.Li |<void vbox record>|<void hbox record>
.Li |<current record>|<glue record>|<kern record>|<math record>
.Li <vbox section> ::=

-item -offset indent
.Li Qq [ <link> .Qq : <point> .Qq : <size> <end of record>
.Li <box content>*
.Li Qq ] <end of record>
.Li <hbox section> ::=

-item -offset indent
.Li Qq ( <link> .Qq : <point> .Qq : <size> <end of record>
.Li <box content>*
.Li Qq ) <end of record>

Void boxes:

-item -offset indent
.Li <void vbox record> ::= .Qq v <link> .Qq : <point> .Qq : <size> <end of record>
.Li <void hbox record> ::= .Qq h <link> .Qq : <point> .Qq : <size> <end of record>
.Li <size> ::= <Width> .Qq , <Height> .Qq , <Depth>
.Li <Width> ::= <integer>
.Li <Height> ::= <integer>
.Li <Depth> ::= <integer>
.Li <link> ::= <tag> .Qq , <line>( .Qq , <column>)?
.Li <line> ::= <integer>
.Li <column> ::= <integer>

The forthcoming records are basic one liners.

-item -offset indent
.Li <current record> ::= .Qq x <link> .Qq : <point> <end of record>
.Li <kern record> ::= .Qq k <link> .Qq : <point> .Qq : <Width> <end of record>
.Li <glue record> ::= .Qq g <link> .Qq : <point> <end of record>
.Li <math record> ::= .Qq $ <link> .Qq : <point> <end of record>

7. The postamble

The postamble closes the file If there is no postamble, it means that the typesetting process did not end correctly.

-item -offset indent
.Li <Postamble>::=

-item -offset indent
.Li <byte offset record>
.Li Qq Count: <Number fo records> <EOL>

8. The post scriptum

The post scriptum contains material possibly added by 3rd parties. It allows to append some transformation (shift and magnify). Typically, one applies a dvi to pdf filter with offset options and magnification, then he appends the same options to the synctex file, for example

d -offset indent synctex update -o foo.pdf -m 0.486 -x 9472573sp -y 13.3dd source.dvi

-item -offset indent
.Li <Post Scriptum>::=

-item -offset indent
.Li <byte offset record>
.Li Qq Post Scriptum: <EOL>
.Li Qq Magnification: <number> <EOL> .Pq Set additional magnification
.Li Qq X Offset: <dimension> <EOL> .Pq Set horizontal offset
.Li Qq Y Offset: <dimension> <EOL> .Pq Set vertical offset This second information will override the offset and magnification previously available in the preamble section. All the numbers are encoded using the decimal representation with "C" locale.


The <current record> is used to compute the visible size of hbox's. The byte offset is an implicit anchor to navigate the synctex file from sheet to sheet. .