[XeTeX] Re: xelatex and pdfsync

Jonathan Kew jonathan_kew at sil.org
Mon Oct 18 21:46:52 CEST 2004


Hi Dick,

> A user just wrote complaining that pdfsync fails with xelatex. Sure 
> enough,
> my experiments show that pdfsync.sty is loaded, but no source.pdfsync 
> file
> is created. Do you know why?

Pdfsync, as it stands, can't work with xelatex. It depends on 
pdfTeX-specific extensions (\pdflastxpos, \pdflastypos, etc) to do its 
stuff, so it can't work with other engines. In fact, judging by this 
fragment I found in the pdfsync source:

\ifx\pdfsavepos\undefined%
   \wlog{****  pdfsync.sty: Synchronization is only available with pdf. 
Use a dvi viewer instead.}%

it should be writing a warning message in the .log to confirm that it 
isn't working. Similarly, it won't work if the user chooses a 
TeX->dvips->ghostscript path rather than a pdfTeX engine, unless the 
necessary pdf extensions are emulated there with macros and 
\special{}s.

It would be possible to implement pdfsync functionality with the 
current xetex engine by taking advantage of the pdfmark support, but it 
would require a rewrite of the .sty file. This could be done by making 
use of the fact that xdv2pdf records the location and text of all 
\special{} commands that begin "pdf:" in an auxiliary file 
\jobname.pdf.marks, and then proceeds to run xdv2pdf_mergemarks to 
incorporate what information it can from the "marks" file into the main 
.pdf document. (This how hyperref links and bookmarks are handled.)

xdv2pdf_mergemarks is just a Perl script, and it wouldn't be too hard 
to extend it to also create a .pdfsync file, if appropriate information 
was written out using "pdf:"-prefixed \special commands. If I had some 
free time, I'd implement it... but I don't know if/when that might 
happen. (I'm copying the XeTeX mailing list in the hope that perhaps 
someone else will care to try.)

Jonathan



More information about the XeTeX mailing list