1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
.Dd Mar 13, 2012
.Dt SYNCTEX 5
.Os "Independant"
.\"
.\"
.Sh NAME
.Nm synctex
.Nd Synchronize TeXnology help file
.\"
.\"
.Sh DESCRIPTION
Synchronize TeXnology help file
.Pq synctexs
are text files that help input/output synchronization during document preparation with the TeX typesetting system.
.Sh 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.
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.
.\"
.Sh STRUCTURE
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 .
.Pp
.Bl -item -offset indent
.\"
.It
.Li <SyncTeX> ::=
.Pq The whole contents in 4 sections
.Bl -item -offset indent
.It
.Li <Preamble>
.It
.Li <Content>
.It
.Li <Postamble>
.It
.Li <Post Scriptum>
.El
.\"
.El
.Pp
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.
.Sh The preamble
.Bl -item -offset indent
.\"
.It
.Li <Preamble> ::=
.Bl -item -offset indent
.It
.Qq SyncTeX Version:
<Version Number> <EOL>
.It
.Li <Input Line>*
.It
.Qq Magnification:
<TeX magnification> <EOL>
.It
.Qq Unit:
<unit in scaled point> <EOL>
.It
.Qq X Offset:
<horizontal offset in scaled point> <EOL>
.It
.Qq Y Offset:
<vertical offset in scaled point> <EOL>
.El
.It
.Li <Input Line> ::=
.Qq Input:
<tag>
.Qq \&:
<File Name> <EOL>
.\"
.El
.Sh The content
.Bl -item -offset indent
.It
.Li <Content> ::=
.Bl -item -offset indent
.It
.Li <byte offset record>
.It
.Qq Content:
<EOL>
.It
.Li <sheet(1)>
.It
.Li <Input Line>*
.It
.Li <sheet(2)>
.It
.Li <Input Line>*
.It
.Li ...
.It
.Li <sheet(N)>
.It
.Li <Input Line>*
.El
.It
.Li <byte offset record> ::=
.Qq \&!
<byte offset> <end of record>
.Pp
.El
.Pp
.Bl -item -offset indent
.It
.Li <sheet(n)> ::=
.Bl -item -offset indent
.It
.Li <byte offset record>
.It
.Qq \&{
<the integer n> <end of record>/
.It
.Li <box content>*
.It
.Li <byte offset record>
.It
.Qq \&}
<the integer n> <end of record>
.El
.El
.Pp
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.
.Bl -item -offset indent
.It
.Li <box content> ::=
.Bl -item -offset indent
.It
.Li <vbox section>|<hbox section>
.It
.Li |<void vbox record>|<void hbox record>
.It
.Li |<current record>|<glue record>|<kern record>|<math record>
.El
.It
.Li <vbox section> ::=
.Bl -item -offset indent
.It
.Qq \&[
<link>
.Qq \&:
<point>
.Qq \&:
<size> <end of record>
.It
.Li <box content>*
.It
.Qq \&]
<end of record>
.El
.It
.Li <hbox section> ::=
.Bl -item -offset indent
.It
.Li \&(
<link>
.Qq \&:
<point>
.Qq \&:
<size> <end of record>
.It
.Li <box content>*
.It
.Qq \&)
<end of record>
.El
.El
.Pp
Void boxes:
.Bl -item -offset indent
.It
.Li <void vbox record> ::=
.Qq v
<link>
.Qq \&:
<point>
.Qq \&:
<size> <end of record>
.It
.Li <void hbox record> ::=
.Qq h
<link>
.Qq \&:
<point>
.Qq \&:
<size> <end of record>
.It
.Li <size> ::= <Width>
.Qq \&,
<Height>
.Qq \&,
<Depth>
.It
.Li <Width> ::= <integer>
.It
.Li <Height> ::= <integer>
.It
.Li <Depth> ::= <integer>
.It
.Li <link> ::= <tag>
.Qq \&,
<line>(
.Qq \&,
<column>)?
.It
.Li <line> ::= <integer>
.It
.Li <column> ::= <integer>
.El
.Pp
The forthcoming records are basic one liners.
.Bl -item -offset indent
.It
.Li <current record> ::=
.Qq x
<link>
.Qq \&:
<point> <end of record>
.It
.Li <kern record> ::=
.Qq k
<link>
.Qq \&:
<point>
.Qq \&:
<Width> <end of record>
.It
.Li <glue record> ::=
.Qq g
<link>
.Qq \&:
<point> <end of record>
.It
.Li <math record> ::=
.Qq $
<link>
.Qq \&:
<point> <end of record>
.El
.Pp
.\" .Sx underline, .Dq double quotes, .Pq enclosed in parenthesis
.Sh The postamble
The postamble closes the file
If there is no postamble, it means that the typesetting process did not end correctly.
.Bl -item -offset indent
.\"
.It
.Li <Postamble>::=
.Bl -item -offset indent
.It
.Li <byte offset record>
.It
.Qq Count:
<Number of records> <EOL>
.El
.El
.Sh 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
.Bd -literal -offset indent
synctex update -o foo.pdf -m 0.486 -x 9472573sp -y 13.3dd source.dvi
.Ed
.Bl -item -offset indent
.\"
.It
.Li <Post Scriptum>::=
.\"
.Bl -item -offset indent
.It
.Li <byte offset record>
.It
.Qq Post Scriptum:
<EOL>
.It
.Qq Magnification:
<number> <EOL>
.Pq Set additional magnification
.It
.Qq X Offset:
<dimension> <EOL>
.Pq Set horizontal offset
.It
.Qq Y Offset:
<dimension> <EOL>
.Pq Set vertical offset
.El
.El
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.
.Sh USAGE
.Pp
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.
.\" nroff -man synctex.5 | less
.\"groff -man -Tascii synctex.5 | less
.\"To convert a man page to plain pre-formatted text (e.g for spell checking) use:
.\"nroff -man synctex.5 | col -b > synctex.5.txt
.\"To convert it to Postscript (for printing or further conversion to pdf) use:
.\"groff -man -Tps synctex.5 > synctex.5.ps
.\"To convert the man page to html use:
.\"man2html synctex.5
|