TeXShop Synchronization

From TeX on Mac OS X wiki

Jump to: navigation, search

With MacTeX-2008 the new SyncTeX technology has been introduced for source <-> preview synchronization, and TeXShop is preset to use it when typesetting in pdfTeX mode, but prior users may have problems because an updated version of TeXShop will not update user preferences as doing so would overwrite existing customisations.

Existing users

In order to get TeXShop's presets right, you need to move away ~/Library/Preferences/TeXShop.plist and ~/Library/TeXShop before launching the new TeXShop for the first time. In this way you will get these file and folder recreated with the appropriate presets when launching TeXShop. Of course, you'll need to merge back your previous changes if any afterwards.

Existing users may need to change the engine call for pdfTeX for LaTeX from

pdflatex --shell-escape

to

pdflatex --shell-escape --synctex=1

or similar and change the preferences in Misc to Sync Method:SyncTeX.

Note: If, like me (--Cfr 21:28, 14 October 2008 (UTC)), you read instructions only after playing around (if at all) and you have therefore already launched your new version of TeXShop for the first time, simply quit TeXShop, move your ~/Library/TeXShop folder aside and relaunch TeXShop. Pretending it is the first time works just as well. Continue by merging your previous changes etc. as instructed.

All users

Questions will arise soon on how to get TeXShop to use SyncTeX synchronisation in XeLaTeX and TeX mode and with the XeTeX and XeLaTeX engines as well. Here's how to do this.

Now, there are two tasks to look at:

  1. make the various (La)TeX executables (tex, pdftex, xetex, ...) create the SyncTeX data when processing a document, and
  2. make TeXShop use these data for source <-> preview synchronization.

The second task is taken care of in TeXShop Preferences > Misc > Sync Method: SyncTeX must be checked, which is the new default.

The first task is taken care of in TeXShop Preferences > Engine for the standard (i.e., not XeTeX) engines: for pdfTeX the instructions must be, for Tex,

pdftex --shell-escape --synctex=1

and for Latex,

pdflatex --shell-escape --synctex=1

which are the new defaults; for TeX + dvips + distiller the instructions must be, for TeX,

simpdftex etex --maxpfb --extratexopts "--synctex=1"

and for Latex,

simpdftex latex --maxpfb --extratexopts "--synctex=1"

which are not the defaults for now. Hence, you need to edit these yourself, by adding the flag

--extratexopts "--synctex=1"

in the two and by changing "tex" to "etex" in the first.

For XeTeX you need to edit the two engines XeTeX.engine and XeLaTeX.engine in ~/Library/TeXShop/Engines, by adding the flag --synctex=1 to the xetex and xelatex calls in them, so that XeTeX.engine reads

#!/bin/tcsh
 
set path= ($path /usr/texbin /usr/local/bin)
xetex --synctex=1 "$1"

and XeLaTeX.engine reads

#!/bin/tcsh
 
set path= ($path /usr/texbin /usr/local/bin)
xelatex --synctex=1 "$1"

The same applies to the alternative engines XeTeX-xdv2pdf.engine and XeLaTeX-xdv2pdf.engine, normally in ~/Library/TeXShop/Engines/Inactive/XeTeX, should you use them. (Note that the default XDVI-to-PDF driver invoked behind the scene by XeTeX has switched from the Mac-specific xdv2pdf to the cross-platform xdvipdfmx with MacTeX-2008.)

Personal tools