[OS X TeX] XeTeX and pdfpages: no dice?
Bruno Voisin
bvoisin at mac.com
Wed Apr 11 18:44:31 EDT 2007
Le 11 avr. 07 à 18:01, Luis Sequeira a écrit :
> I am using XeLaTeX in order to keep my LaTeX source and meet the
> demands of the people who are to publish a little book that I co-
> authored (they require it not to look too different from other
> books in the same series, so a particular font is required, and
> stuff).
> There are a few separator pages that I need to insert, so I thought
> pdfpages was just the thing.
>
> It appears, though, that pdfpages is not compatible with XeLaTeX.
> Is there any way to replicate this functionality in XeLaTeX?
I don't think it is absolutely impossible to make pdfpages work with
XeLaTeX. But that's not easy.
pdfpages now uses separate driver definition files, and includes a
mechanism for selecting transparently the appropriate such file. The
problem is that only driver definition files for pdfTeX and VTeX are
provided, and that the selection mechanism is hidden from the user.
Looking at pppdftex.def, the driver definition file for pdfTeX, it
seems that, for pdfpages to be compatible with a given driver (for
XeLaTeX the xdvi-to-pdf converter, either XeLaTeX's built-in xdv2pdf
or the separate xdvipdfmx), this driver needs to only:
- Be able to include PDF files. Both xdv2pdf and xdvipdfmx do.
- Be recognized by the graphics package. That's the case: the
graphics package has an option [xetex] for xdv2pdf and an option
[dvipdfmx] for xdvipdfmx.
- Provide the variables \pdfpagewidth and \pdfpageheight. Both
xdv2pdf and xdvipdfmx do, I think.
- Provide facilities equivalent to pdfTeX's \pdfpageattr, \pdfannot,
\pdfthread and \pdfdest, so that one may implement the same
functionality as the following code from pppdftex.def:
> \def\AM at setlscape{\pdfpageattr{/Rotate 90}}
> \def\AM at linktodoc@special at begin{%
> \pdfannot width \wd\@tempboxa
> height \ht\@tempboxa
> depth \dp\@tempboxa
> {/Subtype /Link /Border [0 0 0]
> /A << /S /GoToR
> /F (\AM at linkfilename)
> /D [\AM at linktodoc@page at m@ne \AM at linktodocfit]
> \ifAM at newwindow/NewWindow true\fi >>}%
> }
> \let\AM at linktodoc@special at end\relax
> \def\AM at survey@special at begin{%
> \pdfannot width \wd\@tempboxa
> height \ht\@tempboxa
> depth \dp\@tempboxa
> {/Subtype /Link /Border [0 0 0]
> /A << /S /GoTo
> /D (pdfpages.\AM at linktodoc@page at m@ne) >>}%
> }
> \let\AM at survey@special at end\relax
> \def\AM at thread@special at begin{%
> \pdfthread width \wd\@tempboxa
> height \ht\@tempboxa
> depth \dp\@tempboxa
> attr {/I <<\threadinfodict>>}%
> name {\AM at threadname}%
> }
> \let\AM at thread@special at end\relax
> \def\AM at dest@special{\pdfdest name {\AM at linkname.\AM at page}
> \AM at linkfit}
> \def\AM at anchor@special{\pdfdest name {pdfpages.\the\count1} fit}
> \edef\AM at linkfit@special{fitr width\the\wd\@tempboxa\space
> height0pt depth\the\@tempdima}
That's the tricky bit. For one thing I don't whether xdv2pdf or
xdvipfmx offer these facilities, and even if they do you would need a
PDF expert (I'm not one) to implement the same functionality as above
using the syntax specific to these drivers (ie, xdv2pdf or xdvipdfmx).
Maybe you could try to contact the developer of the pdfpages package,
and get him interested enough in XeTeX or dvipdfmx that he provides,
or helps with the creation of, driver definition files ppxetex.def or
ppdvipdfmx.def.
Second difficulty: assuming these files exist and are put at the
appropriate place (probably /usr/local/texlive/texmf-local/tex/latex/
pdfpages/ on the Mac for TeXLive-2007), then you need to coerce
pdfpages into using them. Given how pdfpages.sty currently works, I
imagine this would mean writing, in the preamble of your LaTeX file,
something like:
\makeatletter
\gdef\AM at driver{xetex} % choose this if you use xdv2pdf
\gdef\AM at driver{dvipdfmx} % choose this if you use xdvipdfmx
\maketaother
Or even better:
- Convince the pdfpages author to allow the user to use options such
as [pdftex], [vtex], [xetex] etc. to select driver files explicitly.
- Convince this author to provide a configuration file pdfpages.cfg
performing automatic driver file selection, using the packages
ifpdf.sty, ifvtex.sty and ifxetex.sty instead of the current code
from pdfpages.sty:
> \begingroup
> \@ifundefined{pdfoutput}{%
> \@ifundefined{OpMode}{%
> \def\AM at driver{null}
> }{\gdef\AM at driver{vtex}}%
> }{\gdef\AM at driver{pdftex}}
> \endgroup
Hope this may help,
Bruno Voisin
------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/
More information about the MacOSX-TeX
mailing list