[OS X TeX] A short note on synchronization

Bruno Voisin bvoisin at me.com
Fri Sep 5 11:47:14 CEST 2008


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. I suspect questions will arise soon  
on how to get TeXShop to use it in TeX and Ghostscript mode and with  
the XeTeX and XeLaTeX engines as well. Here's how to do this.

First, 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.

Now, there are two tasks to look at: make the various (La)TeX  
executables (tex, pdftex, xetex, ...) create the SyncTeX data when  
processing a document, and 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 second 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.)

Hope this helps some,

Bruno Voisin



More information about the macostex-archives mailing list