synctex — Synchronize TeXnology help file
Contents
Basics
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 which are both
publicly available. 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.
Description
Synchronize TeXnology help file (synctexs) are text files that help input/output synchronization during
document preparation with the TeX typesetting system.
History
This document has been updated on Sat Apr 22 09:57:20 UTC 2017 to include \pdfxform support.
Independent Aug 30, 2022 SYNCTEX(5)
Name
synctex — Synchronize TeXnology help file
See Also
synctex(1) tex(1)
Structure
The element structure of a synctex file is a list of text line records as follows. ‘*’, ‘+’, and ‘?’
have their usual EBNF meanings: ‘*’ means zero or more, ‘+’ means one or more, and ‘?’ means zero or one
(i.e., optional).
<SyncTeX>::= (The whole contents in 4 sections)
<Preamble><Content><Postamble><PostScriptum>
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.
The Content
<Content>::=<byteoffsetrecord>
"Content:" <EOL>
(<Form(k)>|<InputLine>)*<sheet(1)>(<Form(k)>|<InputLine>)*<sheet(2)>(<Form(k)>|<InputLine>)*...<sheet(N)>(<Form(k)>|<InputLine>)*<byteoffsetrecord>::= "!" <byte offset> <end of record>
<sheet(n)>::=<byteoffsetrecord>
"{" <the integer n> <end of record>
<vboxsection>|<hboxsection><byteoffsetrecord>
"}" <the integer n> <end of record>
<Form>::=<byteoffsetrecord>
"<" <form tag> <end of record>
<vboxsection>|<hboxsection><byteoffsetrecord>
">" <end of record>
<formtag>::=<integer>
Forms are available with pdfTeX. All the numbers are integers encoded using the decimal representation
with "C" locale. 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.
<boxcontent>::=<vboxsection>|<hboxsection>|<voidvboxrecord>|<voidhboxrecord>|<currentrecord>|<gluerecord>|<kernrecord>|<mathrecord>|<formrefrecord>|<Form><vboxsection>::=
"[" <link> ":" <point> ":" <size> <end of record>
<boxcontent>*
"]" <end of record>
<hboxsection>::=( <link> ":" <point> ":" <size> <end of record>
<boxcontent>*
")" <end of record>
Void boxes:
<voidvboxrecord>::= "v" <link> ":" <point> ":" <size> <end of record>
<voidhboxrecord>::= "h" <link> ":" <point> ":" <size> <end of record>
<link>::=<tag> "," <line>( "," <column>)?
<point>::=<fullpoint>|<compressedpoint><fullpoint>::= <integer> "," <integer>
<compressedpoint>::= <integer> ",="
<line>::=<integer><column>::=<integer><size>::=<Width> "," <Height> "," <Depth>
<Width>::=<integer><Height>::=<integer><Depth>::=<integer>
The forthcoming records are basic one liners.
<currentrecord>::= "x" <link> ":" <point> <end of record>
<kernrecord>::= "k" <link> ":" <point> ":" <Width> <end of record>
<gluerecord>::= "g" <link> ":" <point> <end of record>
<mathrecord>::= "$" <link> ":" <point> <end of record>
<formrefrecord>::= "f" <form tag> ":" <point> <end of record>
The Post Scriptum
The post scriptum contains material possibly added by 3rd parties. It allows one 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
synctex update -o foo.pdf -m 0.486 -x 9472573sp -y 13.3dd source.dvi
<PostScriptum>::=<byteoffsetrecord>
"Post Scriptum:" <EOL>
"Magnification:" <number> <EOL> (Set additional magnification)
"X Offset:" <dimension> <EOL> (Set horizontal offset)
"Y Offset:" <dimension> <EOL> (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 Postamble
The postamble closes the file If there is no postamble, it means that the typesetting process did not end
correctly.
<Postamble>::=<byteoffsetrecord>
"Count:" <Number of records> <EOL>
The Preamble
<Preamble>::=
"SyncTeX Version:" <Version Number> <EOL>
<InputLine>*
"Magnification:" <TeX magnification> <EOL>
"Unit:" <unit in scaled point> <EOL>
"X Offset:" <horizontal offset in scaled point> <EOL>
"Y Offset:" <vertical offset in scaled point> <EOL>
<InputLine>::= "Input:" <tag> ":" <File Name> <EOL>
Usage
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. The second coordinate of a compressed point has
been replaced by a "=" character which means that it is the second coordinate of the last full point
available above.
