[zz]Using SyncTeX with LaTeX

Using SyncTeX with LaTeX

 

23 Nov 09

SynchronisationWorking with LaTeX involves writing in one application (TeXShop, TextMate, etc.) and viewing your document in a pdf reader (Acrobat Reader, Skim, etc.). To see the result of your work, to correct or improve it, it is often practical to quickly go back and forth between the working text and the resulting pdf.

In a recent past, this involved using the package pdfsync with the command \usepackage{pdfsync} inserted in the preamble or configuring your text editor to use pdfsync by default. Starting with the 2008 distribution of TeX it is now possible to use SyncTeX, written by Jerôme Laurens, the creator of psfsync. SyncTeX replaces pdfsync.

The advantages of SyncTeX are many: you do not need to load pdfsync; synchronisation between the two files is more precise; compatibility issues are basically irrelevant; etc.

To enable synchronisation, SyncTeX creates an auxiliary file in the format nameofthefile.synctex.gz.

Several text editors use SyncTeX by default. In TeXShop for example, SyncTeX is used by default in Preferences>Composition>SyncMethod. SyncTeX is also invoked by default in Preferences>Engines>pdfTex. It is also used by default in TextMate. If SyncTex is not used by default you can always use the command -synctex=1 if you use the terminal or insert the following line in the preamble to force the use of SyncTeX.

\synctex=1

To deactivate SyncTeX, simply comment out the comment in the tex file or use -synctex=0 where you find synctex=1. In TextMate you just need to add -synctex=0 in the options of the Preferences in the LaTeX bundle.

To go from the tex file to the pdf file in TextMate simply do ⌃⌥⌘-o (the letter o, not zero); in TeXShop ⌘-click.

Conversely, to go from the pdf file to the tex file in TextMate do ⇧ ⌘-click; inTeXShop ⌘-click in the location of the pdf file that you want to land to in the tex file.

In Skim a small red dot shows up by default in the pdf file that you targeted. The color can be changed in Preferences. The frame marks will not be printed.

To make things easier, you can leave both files open if your monitor is big enough or if you use two monitors. But then do not forget that the pdf file you see is the last compilation before you started making changes in the tex file, unless your pdf reader is set up for automatic refresh.

SyncTeX works fine for me using XƎTeX and TextMate on Snow Leopard.

Some Interesting Links

原文地址:https://www.cnblogs.com/nn0p/p/2767965.html