[XeTeX] Conflict among XeLaTeX, LaTeX.mk, and pdfpages

Ulrike Fischer news3 at nililand.de
Tue Jan 2 15:21:05 CET 2018


Am Mon, 1 Jan 2018 17:22:12 -0600 (CST) schrieb
mskala at ansuz.sooke.bc.ca:

> I've run into a problem when using all three of XeLaTeX, LaTeX.mk, and
> pdfpages, in their current versions from the latest TeXLive.  It appears
> that in order to determine file dependencies, LaTeX.mk runs the TeX engine
> with the texdepends package (which is part of LaTeX.mk) wedged into the
> input file; then texdepends intercepts a bunch of internal macros used by
> various graphics packages including indirectly by pdfpages, and the result
> is a failure with "arithmetic overflow" when trying to include PDF files.

texdepends gets the test for the graphic existence wrong for xetex,
it assumes that the graphic is not there and set its size to 1pt
which then confuses pdfpages. It also gives errors if you set the
width of a graphic. This here could work (but I'm not sure that it
covers all cases):

\RequirePackage{texdepends}
\makeatletter
%
\def\TD at Gread@pdf#1{%
  \IfFileExists{\ifxetex \Gin at base\Gin at ext \else #1\fi}{% changed
    %\PackageWarning{texdepends}{Gread File '#1' exists}%
    \TD at orig@Gread at pdf{#1}%
  }{%
    \PackageWarning{texdepends}{No '#1' file \MessageBreak
      using 1 for graphic dimensions}%
    \setbox\@tempboxa\hbox{\relax}%
    \def\Gin at llx{1}\let\Gin at lly\Gin at llx
    \Gin at defaultbp\Gin at urx{\wd\@tempboxa}%
    \Gin at defaultbp\Gin at ury{\ht\@tempboxa}%
  }%
}%

\makeatother
\documentclass{article}

\usepackage{graphicx,pdfpages}

\begin{document}

\includegraphics[width=5cm]{example-image.pdf}

\includepdf{example-image}

\end{document}


-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/



More information about the XeTeX mailing list