[pdftex] SyncTeX and output-directory option

Martin Reinders martin at helios.de
Thu Jan 21 13:10:26 CET 2010

On 25.03.2009 10:44 Uhr, I wrote:
> I just started experimenting with SyncTex and have the following
> problem:
> To keep generated files separate from the source files, I use the
> pdflatex -output-directory=DIR option, e.g.
>   pdflatex -synctex=1 -output-directory=output main.tex
> However, the SyncTeX file "main.synctex.gz" is always created in the
> source directory and not in the specified output directory.
> Therefore the PDF viewer (e.g. Skim.app on Mac OS X) does not find
> the SyncTeX file (it is searched only in the same directory as the
> PDF file).
> Moving the SyncTeX file into the output directory does not work,
> because many file paths are relative to the current directory.
> So I would like to suggest that a future version of SyncTeX creates
> the SyncTeX file in the specified output directory, with file paths
> relative to that directory.
> Of course, I could write a script that moves the SyncTeX file and
> fixes all relative paths. This should not be too difficult, but
> perhaps somebody had the same problem and can suggest another
> solution.

I just upgraded to TeXLive 2009 and noticed that the SyncTeX file is now created in the specified output directory, so it is in the same directory as the PDF file and therefore found by the viewer application.

However, synchronisation does still not work, because all the "Input:" paths are relative to the source directory, e.g.


I have written a Perl script that changes the paths to be relative to the output directory:


and then the synchronization works.


More information about the pdftex mailing list