52

Why does latex gzip the synctex file, and no other aux files? Ungzipping the file reveals it is around 40 kB, which isn't much. Is this "legacy" behaviour (when computers did not have much storage) or is there a benefit to gzipping that file?

3
  • 4
    You can stop it from gzipping though with the synctex=-1 option if I'm not mistaken.
    – marczellm
    May 28, 2013 at 19:11
  • @marczellm right synctex=positive number--> file.synctex.gz, synctex=negative number--> file.synctex and synctex=0 no synctex May 28, 2013 at 19:14
  • 3
    For a 64 page 262 KiB PDF file obtained from a 248 KiB LaTeX file I'm working on, the .synctex.gz file weighs 336 KiB, while the uncompressed file is 1.5 MiB. A 5:1 ratio.
    – egreg
    May 28, 2013 at 19:38

2 Answers 2

40

It's true that gzipping the .synctex file saves space on disk. For a 500 page book, the size is

-rw-r--r-- user group   3.9M May 29 01:16 foo.synctex.gz

while the unzipped file is

-rw-r--r-- user group    18M May 29 01:16 foo.synctex

The PDF file turns out to be only 2.2 MiB; the figures speak by themselves: the size grows very fast. Unzipping the file on the fly when requested by the software that does the synchronization between editor and PDF viewer is fast and doesn't create a noticeable overhead.

Modern computers don't have big space constraints on disk, but a 4.5 to 1 ratio should not be neglected, if it's reasonable to compress the file.

A similar thing happens with the .odt format used by word processors: it's just a compressed ZIP file under cover. The GNU program gzip may seem insignificant for smaller files, but has the advantage that decompression is fast.

8

Most probably the .synctex file is gzipped by default simply to save disk space.

Other auxiliary files are not gzipped as they are smaller in size and need to be read quickly during compilation (the .synctex file doesn't play a role during compilation, but is used by PDF readers to link back to your TeX code).

1
  • Just adding that most of the auxiliaries can not be created compressed by the current design. They are output via TeX's \openout mechanism and written during the compilation. Then they need to be read verbatim using \input. Thus it can be text files only at these ends. They could be compressed after they are created (out of TeX itself) and decompressed before they are read again but they would have to exist as decompressed files again so that would not save any space – on the contrary – and would just waste cycles.
    – The Vee
    Jun 20, 2017 at 7:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .