5

Is there a way to use both the fontspec and the xmpincl packages? Using PDFTeX returns

Fatal fontspec error: "cannot-use-pdftex"

The fontspec package requires either XeTeX or LuaTeX to function.

You must change your typesetting engine to, e.g., "xelatex" or "lualatex"

XeLaTeX and LuaLaTeX returns

Package xmpincl Error: latex is not supported by the \includexmp package.

  • My earlier comment was misleading, as karlkoeller's answer shows. (So I deleted it.) However, the point about hyperxmp being more flexible in terms of how you construct the document remains true, and the same goes for its being more user-friendly at the cost of being somewhat less flexible in terms of what you can include. – jon Dec 10 '13 at 17:34
7

Excluding pdflatex, which is not an option since it cannot be used together with fontspec, let's try to understand whether xelatex or lualatex can be used.

The file xmpincl.sty contains the following lines:

\RequirePackage{ifpdf}
\ifpdf\else
\PackageWarningNoLine{xmpincl}%
  {Only pdflatex is supported by the xmpincl package}
\newcommand{\includexmp}[1]{%
  \PackageError{xmpincl}%
  {latex is not supported by the \protect\includexmp\space package}%
  {You tried to include XMP metadata in DVI production.\MessageBreak
   That doesn't work, and I friendly tried to warn you.\MessageBreak
   Just continue and pretend nothing is wrong,\MessageBreak
   but please remove the package or switch to pdflatex.}
}
\relax\expandafter\endinput
\fi

This means that it returns an error when you use \includexmp if the \ifpdf test is false.

You can use the following minimal file to test whether \ifpdf returns true or false

\documentclass{article}
\usepackage{ifpdf}
\begin{document}
\ifpdf
\texttt{xmpincl} can be used
\else
\texttt{xmpincl} cannot be used
\fi
\end{document} 

With lualatex (beta-0.76.0-2013062820) I get

enter image description here

while with xelatex (3.1415926-2.5-0.9999.3) I get

enter image description here

This means that with an up-to-date luatex engine you should be able to use fontspec together with xmpincl.

  • 2
    Does LuaTeX have the appropriate primitives for xmpincl? – Joseph Wright Dec 10 '13 at 16:41
  • @JosephWright Well, I don't know. I've never used it. I just tried to see if the package issues the error when using LuaTeX. – karlkoeller Dec 10 '13 at 16:43
  • Hmm, I think this looks OK: the primitives needed seem to be ones retained in LuaTeX (\pdfobj, \pdfcatalog, \pdflastobj). – Joseph Wright Dec 10 '13 at 16:46
  • Well, I've deleted my comment as the 'never, unless extended' claim was at least partially wrong! +1 for testing.... – jon Dec 10 '13 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.