SYNCTEX

Section: File Formats (5)
Page Index

BSD mandoc
Independent  

NAME

synctex - Synchronize TeXnology help file  

DESCRIPTION

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

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.  

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>
<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.  

The preamble

<Preamble> ::=

Qq SyncTeX Version:
<Version Number> <EOL>
<Input Line>*
Qq Magnification:
<TeX magnification> <EOL>
Qq Unit:
<unit in scaled point> <EOL>
Qq X Offset:
<horizontal offset in scaled point> <EOL>
Qq Y Offset:
<vertical offset in scaled point> <EOL>

<Input Line> ::=
Qq Input: <tag> Qq : <File Name> <EOL>

 

The content

<Content> ::=

<byte offset record>
Qq Content:
<EOL>
(<Form(k)>|<Input Line>)*
<sheet(1)>
(<Form(k)>|<Input Line>)*
<sheet(2)>
(<Form(k)>|<Input Line>)*
...
<sheet(N)>
(<Form(k)>|<Input Line>)*

<byte offset record> ::=
Qq ! <byte offset> <end of record>

<sheet(n)> ::=

<byte offset record>
Qq {
<the integer n> <end of record>
<vbox section>|<hbox section>
<byte offset record>
Qq }
<the integer n> <end of record>

<Form> ::=

<byte offset record>
Qq <
<form tag> <end of record>
<vbox section>|<hbox section>
<byte offset record>
Qq >
<end of record>

<form tag> ::= <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.

<box content> ::=

<vbox section>|<hbox section>
|<void vbox record>|<void hbox record>
|<current record>|<glue record>|<kern record>
|<math record>|<form ref record>|<Form>

<vbox section> ::=

Qq [
<link> Qq : <point> Qq : <size> <end of record>
<box content>*
Qq ]
<end of record>

<hbox section> ::=

(
<link> Qq : <point> Qq : <size> <end of record>
<box content>*
Qq )
<end of record>

Void boxes:

<void vbox record> ::=
Qq v <link> Qq : <point> Qq : <size> <end of record>
<void hbox record> ::=
Qq h <link> Qq : <point> Qq : <size> <end of record>
<link> ::= <tag>
Qq , <line>( Qq , <column>)?
<point> ::= <full point>|<compressed point>
<full point> ::=
<integer> Qq , <integer>
<compressed point> ::=
<integer> Qq ,=
<line> ::= <integer>
<column> ::= <integer>
<size> ::= <Width>
Qq , <Height> Qq , <Depth>
<Width> ::= <integer>
<Height> ::= <integer>
<Depth> ::= <integer>

The forthcoming records are basic one liners.

<current record> ::=
Qq x <link> Qq : <point> <end of record>
<kern record> ::=
Qq k <link> Qq : <point> Qq : <Width> <end of record>
<glue record> ::=
Qq g <link> Qq : <point> <end of record>
<math record> ::=
Qq $ <link> Qq : <point> <end of record>
<form ref record> ::=
Qq f <form tag> Qq : <point> <end of record>

 

The postamble

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

<Postamble>::=

<byte offset record>
Qq Count:
<Number of records> <EOL>

 

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
synctex update -o foo.pdf -m 0.486 -x 9472573sp -y 13.3dd source.dvi

<Post Scriptum>::=

<byte offset record>
Qq Post Scriptum:
<EOL>
Qq Magnification:
<number> <EOL> (Set additional magnification)
Qq X Offset:
<dimension> <EOL> (Set horizontal offset)
Qq 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.  

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 Qq = character which means that it is the second coordinate of the last full point available above.  

SEE ALSO

synctex(1) tex(1)  

AUTHOR

The Synchronize TeXnology is essentially due to Jerome Laurens, with useful suggestions by some well known actors of the TeX world.  

HISTORY This document has been updated on Sat Apr 22 09:57:20 UTC 2017 to include \pdfxform support.


 

Index

NAME
DESCRIPTION
BASICS
STRUCTURE
The preamble
The content
The postamble
The post scriptum
USAGE
SEE ALSO
AUTHOR
HISTORY This document has been updated on Sat Apr 22 09:57:20 UTC 2017 to include \pdfxform support.