221

I stumbled upon these SyncTeX files in my directories and wanted to know what they are for. I searched this site and the internet and I think I have some vague understanding of what it is but I'm still not very satisfied with my actual knowledge. I've found many questions about configuring SyncTeX but none about what it is and what it does.

So, could someone explain what is SyncTeX and what does it do exactly and/or point to some general purpose documentation?

franz
  • 2,397
  • 1
    may wanna look at this: http://ftp.uni-erlangen.de/mirrors/CTAN/support/synctex-parser/README – Rico Jun 10 '13 at 15:55
  • 9
    A primary source of information is Jérôme Laurens's article on TUGboat – egreg Jun 10 '13 at 15:56
  • 2
  • 2
    Above link is to OLD 1.16 (2008-2011) since 2011 its hosted at GitHub version1.22 can be found at http://www.tug.org/svn/texlive/trunk/Build/source/texk/web2c/synctexdir/ –  Oct 11 '18 at 19:01
  • Regarding synctex and plain tex -- in TeX Live, my goal is for "tex" to be TeX, i.e., to let DEK still invoke "tex" and get his program. To get an extended non-ini engine, plain TeX macros, DVI output by default, "etex" is available. This is actually pdftex with the DVI default, not the pure e-TeX, because some of the non-PDF features in pdftex have come to be commonly used and useful. Breitenlohner said ok to that ... – Karl Berry Nov 17 '17 at 19:25

1 Answers1

200

SyncTeX is a utility written by Jérôme Laurens which enables synchronization between your source document and the PDF output. If your editor/viewer supports it, then you can click in your source and jump to the equivalent place in the PDF or click in the PDF and it will jump to the appropriate place in your source document.

In TeXShop, for example, Command-click does the navigation. Other editor/viewer pairs may implement the exact commands slightly differently.

The files that it creates store all of the synchronization data that make this magic possible. Gzipped versions of these files are created if you pass the --synctex=1 option to e.g. the pdflatex command (and other engines similarly); non-zipped versions can be created with --synctex=-1, although for a large document these files can be quite large, so the zipped ones are generally to be preferred. See

Usually this is part of the default setting for the compilation command within most TeX-aware editors.

Alan Munn
  • 218,180
  • Also note that the only engine (I'm aware of) which doesn't support synctexing is (plain) tex. – karlkoeller Jun 10 '13 at 16:14
  • @karlkoeller At least in TeX Live, the tex program has few of the "extended features"; it supports, however, options such as -enc or -mltex (when called as INITEX). – egreg Jun 10 '13 at 16:21
  • so synctex does just synchronize source code with pdf output? Also, it just works when you are previewing your pdf into the editor, not when you open it in an external viewer, right? – franz Jun 10 '13 at 20:27
  • 1
    @franz It all depends on whether the previewer and the editor can communicate with SyncTeX. For instance I use Aquamacs and Skim; the communication between the two applications is flawless. – egreg Jun 10 '13 at 20:30
  • 2
    @egreg I think I understand now. BTW before asking the question I had a vague idea but it was completely wrong :D – franz Jun 10 '13 at 20:35
  • 1
    I don't use SyncTeX but a coauthor of mine does. Based on what you've written above, @Alan Munn, am I correct in thinking that *.synctex.gz are generated files that I can safely remove from version control? – Psychonaut Jun 29 '16 at 11:41
  • 2
    @Psychonaut Yes, I would see no problem with that. (I'm not sure why you wouldn't use it, though. It's very helpful.) – Alan Munn Jun 29 '16 at 12:30