[Tex/LaTex] Error when adding xmp metadata with xelatex and pdfx

hyperrefpdf-apdfxxetexxmp

I want to create a pdf according to the PDF/A-1b standard with xelatex and pdfx but I get an error message now when I add my metadata.

Using XMP template file: pdfa.xmp
! Argument of " has an extra }.
<inserted text> 
                \par 
l.769  \includexmp{\xmp@template}

!  ==> Fatal error occurred, no output PDF file produced!

This is a minimal example:

\documentclass[twoside,a4paper,DIV15,parskip=off,9pt]{scrbook}
\usepackage[T1]{fontenc} % is oriented to output, that is, what fonts to use for printing characters (first load fontenc)
\usepackage[utf8]{inputenc} % allows the user to input accented characters directly from the keyboard
\usepackage{libertine} % libertine font as pbk (=Garamond font, ugm) substitution
\renewcommand{\familydefault}{pbk} % to change the headers and body texts
\usepackage[sc]{mathpazo} % palatino font as pbk (=Optima font, pbk) substitution

% ------
% Clickable URLs
\usepackage[
linktocpage=false,      % no page numbers are clickable
colorlinks=false,       % no color
breaklinks=true,        % break URLs
bookmarks,              % creates bookmarks in pdf
hyperfootnotes=true,    % clickable footnotes
pdfborder={0 0 0},      % for removing borders around links
bookmarksnumbered=true, % If Acrobat bookmarks are requested, include section numbers.
bookmarksopen=false,    % If Acrobat bookmarks are requested, show them with all the subtrees expanded.
%hidelinks=true,
%linkcolor=blue,
%citecolor=blue,
%urlcolor=blue
pdfpagemode={UseOutlines}, % show pdf bookmarks (indices) on startup; does not function all the time
pdftitle={Stammbaum der Familie Neumann}, % title
pdfauthor={Sebastian Neumann}, % author
pdfkeywords={Genealogy, Family tree, Neumann}, % subject of the document
pdfsubject={Stammbaum, Neumann, Genealogie}, % list of keywords
pdfmenubar=true,        % make PDF viewer’s menu bar visible
pdfpagelabels]
{hyperref}
%\usepackage{url} % Urls become clickable
\urlstyle{same} % Font style same as text style
%\urlstyle{rm}

%-------
% Optimization for PDF/A-1b Standard
\usepackage{xmpincl} % to read in xmpdata
\usepackage[a-1b]{pdfx}
\includexmp{/path/to/foo.xmpdata}

\begin{document}
foobar
\end{document}

My xmpdata looks like this. I have create it according to the pdfx manual here, page 3-4:

\Title{title}
\Author{me}
\Keywords{keyword1\sep keyword2\sep keyword3}
\Subject{bla\sep bla\sep bla}
\Publisher{}
\Copyright{a copyright statement}
\CopyrightURL{test}
\Copyrighted{True}
\PublicationType{book}
\Volume{1}

What do I do wrong?

Edit:

I changed the code below the hyperref. This is now my minimal example:

\documentclass[twoside,a4paper,DIV15,parskip=off,9pt]{scrbook}
\usepackage[T1]{fontenc} % is oriented to output, that is, what fonts to use for printing characters (first load fontenc)
\usepackage[utf8]{inputenc} % allows the user to input accented characters directly from the keyboard
\usepackage{libertine} % libertine font as pbk (=Garamond font, ugm) substitution
\renewcommand{\familydefault}{pbk} % to change the headers and body texts
\usepackage[sc]{mathpazo} % palatino font as pbk (=Optima font, pbk) substitution

% ------
% Clickable URLs
\usepackage[
linktocpage=false,      % no page numbers are clickable
colorlinks=false,       % no color
breaklinks=true,        % break URLs
bookmarks,              % creates bookmarks in pdf
hyperfootnotes=true,    % clickable footnotes
pdfborder={0 0 0},      % for removing borders around links
bookmarksnumbered=true, % If Acrobat bookmarks are requested, include section numbers.
bookmarksopen=false,    % If Acrobat bookmarks are requested, show them with all the subtrees expanded.
%hidelinks=true,
%linkcolor=blue,
%citecolor=blue,
%urlcolor=blue
pdfpagemode={UseOutlines}, % show pdf bookmarks (indices) on startup; does not function all the time
pdftitle={Stammbaum der Familie Neumann}, % title
pdfauthor={Sebastian Neumann}, % author
pdfkeywords={Genealogy, Family tree, Neumann}, % subject of the document
pdfsubject={Stammbaum, Neumann, Genealogie}, % list of keywords
pdfmenubar=true,        % make PDF viewer’s menu bar visible
pdfpagelabels]
{hyperref}
%\usepackage{url} % Urls become clickable
\urlstyle{same} % Font style same as text style
%\urlstyle{rm}

%-------
% Optimization for PDF/A-1b Standard
\usepackage[a-1b]{pdfx}

\usepackage{filecontents}
\begin{filecontents}{\jobname.xmpdata}
\Title{title}
\Author{me}
\Keywords{keyword1\sep keyword2\sep keyword3}
\Subject{bla\sep bla\sep bla}
\Publisher{test}
\Copyright{a copyright statement}
\CopyrightURL{test}
\Copyrighted{True}
\PublicationType{book}
\Volume{1}
\end{filecontents}

Everything is now in one file.

Edit:

This is my output.

 *File List*
 scrbook.cls    2015/10/03 v3.19a KOMA-Script document class (book)
scrkbase.sty    2015/10/03 v3.19a KOMA-Script package (KOMA-Script-dependent ba
sics and keyval usage)
 scrbase.sty    2015/10/03 v3.19a KOMA-Script package (KOMA-Script-independent 
basics and keyval usage)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
scrlfile.sty    2015/10/03 v3.19a KOMA-Script package (loading files)
tocbasic.sty    2015/10/03 v3.19a KOMA-Script package (handling toc-files)
   size9.clo    1999/11/11 v1.4a NON-Standard LaTeX file (size option)
typearea.sty    2015/10/03 v3.19a KOMA-Script package (type area)
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
inputenc.sty    2015/03/17 v1.2c Input encoding file
    utf8.def    2015/09/07 v1.1p UTF-8 support for inputenc
   t1enc.dfu    2015/09/07 v1.1p UTF-8 support for inputenc
  ot1enc.dfu    2015/09/07 v1.1p UTF-8 support for inputenc
  omsenc.dfu    2015/09/07 v1.1p UTF-8 support for inputenc
libertine.sty    2014/11/25 (Bob Tennent) Supports Libertine and Biolinum fonts
 for all LaTeX engines.
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
 xkeyval.sty    2014/12/03 v2.7a package option processing (HA)
 xkeyval.tex    2014/12/03 v2.7a key=value parser (HA)
textcomp.sty    2005/09/27 v1.99g Standard LaTeX package
  ts1enc.def    2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
  ts1enc.dfu    2015/09/07 v1.1p UTF-8 support for inputenc
mweights.sty    2013/07/21 (Bob Tennent) Support package for multiple-weight fo
nt packages. 
 fontenc.sty
fontaxes.sty    2014/03/23 v1.0d Font selection axes
LinLibertine_I.tex
mathpazo.sty    2005/04/12 PSNFSS-v9.2a Palatino w/ Pazo Math (D.Puga, WaS) 
hyperref.sty    2012/11/06 v6.83m Hypertext links for LaTeX
hobsub-hyperref.sty    2012/05/28 v1.13 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty    2012/05/28 v1.13 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2012/05/28 v1.13 Construct package bundles (HO)
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
  ifvtex.sty    2010/03/01 v1.5 Detect VTeX and its facilities (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable calculations with integers (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty    2011/11/25 v1.13 Implements pdfTeX's escape features (HO)
bigintcalc.sty    2012/04/08 v1.3 Expandable calculations on big integers (HO)
  bitset.sty    2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty    2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty    2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
 hopatch.sty    2012/05/28 v1.2 Wrapper for package hooks (HO)
xcolor-patch.sty    2011/01/30 xcolor patch
atveryend.sty    2011/06/30 v1.8 Hooks at the very end of document (HO)
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
refcount.sty    2011/10/16 v3.4 Data extraction from label references (HO)
 hycolor.sty    2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
 auxhook.sty    2011/03/04 v1.3 Hooks for auxiliary files (HO)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
  pd1enc.def    2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
 hpdftex.def    2012/11/06 v6.83m Hyperref driver for pdfTeX
rerunfilecheck.sty    2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
    pdfx.sty    2015/02/17 v1.5.3 PDF/X and PDF/A support (CVR/HTH/RRM/PS)
   puenc.def    2012/11/06 v6.83m Hyperref: PDF Unicode definition (HO)
    8bit.def    2008/03/30 v1.1d Input encoding file
    8bit.def    2008/03/30 v1.1d Input encoding file
    utf8.def    2015/09/07 v1.1p UTF-8 support for inputenc
   t1enc.dfu    2015/09/07 v1.1p UTF-8 support for inputenc
  ot1enc.dfu    2015/09/07 v1.1p UTF-8 support for inputenc
  omsenc.dfu    2015/09/07 v1.1p UTF-8 support for inputenc
  ts1enc.dfu    2015/09/07 v1.1p UTF-8 support for inputenc
    utf8.def    2015/09/07 v1.1p UTF-8 support for inputenc
   t1enc.dfu    2015/09/07 v1.1p UTF-8 support for inputenc
  ot1enc.dfu    2015/09/07 v1.1p UTF-8 support for inputenc
  omsenc.dfu    2015/09/07 v1.1p UTF-8 support for inputenc
  ts1enc.dfu    2015/09/07 v1.1p UTF-8 support for inputenc
 xmpincl.sty    2008/05/10 v2.2 Include XMP data in pdflatex
  ifthen.sty    2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
    8bit.def    2008/03/30 v1.1d Input encoding file
filecontents.sty    2011/10/08 v1.3 Create an external file from within a LaTeX
 document
  ts1cmr.fd    2014/09/29 v2.5h Standard LaTeX font definitions
   t1pbk.fd    2001/06/04 font definitions for T1/pbk.
 nameref.sty    2012/10/27 v2.43 Cross-referencing by name of section
gettitlestring.sty    2010/12/03 v1.4 Cleanup title references (HO)

Edit3:

Oh, I do now realise that I started with pdflatex, but later migrated the project to xelatex!

Best Answer

You are mixing xmpincl and pdfx expectations about how the XMP file will be found and created. The command \includexmp is from xmpincl, and pdfx wants nothing to do with it. pdfx provides a simplified interface, but it has strict requirements:

  1. Your .xmpdata file must have the same name as the main .tex file (if using the filecontents package, then use \jobname.xmpdata as the file name);

  2. You don't actually load the .xmpdata file, which means it must be in the same directory as the main .tex file; and

  3. You do not need to load xmpincl explicitly, and gain nothing from doing so.

If I comply with these pointers, your example file works for me.

Edit OK, so the above file may not be quite minimal, but it still works for me. For convenience, I'm posting below the exact file I used, which includes the \listfiles command so that we can compare file versions. From the error message you provide, I think you may have an outdated version of the file (version 1.3, perhaps?)

\listfiles
\documentclass[twoside,a4paper,DIV15,parskip=off,9pt]{scrbook}
\usepackage[T1]{fontenc} % is oriented to output, that is, what fonts to use for printing characters (first load fontenc)
\usepackage[utf8]{inputenc} % allows the user to input accented characters directly from the keyboard
\usepackage{libertine} % libertine font as pbk (=Garamond font, ugm) substitution
\renewcommand{\familydefault}{pbk} % to change the headers and body texts
\usepackage[sc]{mathpazo} % palatino font as pbk (=Optima font, pbk) substitution

% ------
% Clickable URLs
\usepackage[
linktocpage=false,      % no page numbers are clickable
colorlinks=false,       % no color
breaklinks=true,        % break URLs
bookmarks,              % creates bookmarks in pdf
hyperfootnotes=true,    % clickable footnotes
pdfborder={0 0 0},      % for removing borders around links
bookmarksnumbered=true, % If Acrobat bookmarks are requested, include section numbers.
bookmarksopen=false,    % If Acrobat bookmarks are requested, show them with all the subtrees expanded.
%hidelinks=true,
%linkcolor=blue,
%citecolor=blue,
%urlcolor=blue
pdfpagemode={UseOutlines}, % show pdf bookmarks (indices) on startup; does not function all the time
pdftitle={Stammbaum der Familie Neumann}, % title
pdfauthor={Sebastian Neumann}, % author
pdfkeywords={Genealogy, Family tree, Neumann}, % subject of the document
pdfsubject={Stammbaum, Neumann, Genealogie}, % list of keywords
pdfmenubar=true,        % make PDF viewer’s menu bar visible
pdfpagelabels]
{hyperref}
%\usepackage{url} % Urls become clickable
\urlstyle{same} % Font style same as text style
%\urlstyle{rm}

%-------
% Optimization for PDF/A-1b Standard
\usepackage[a-1b]{pdfx}

\usepackage{filecontents}% NOTE: I'd still put this before `pdfx` as advised....
\begin{filecontents}{\jobname.xmpdata}
\Title{title}
\Author{me}
\Keywords{keyword1\sep keyword2\sep keyword3}
\Subject{bla\sep bla\sep bla}
\Publisher{test}
\Copyright{a copyright statement}
\CopyrightURL{test}
\Copyrighted{True}
\PublicationType{book}
\Volume{1}
\end{filecontents}

\begin{document}
foobar
\end{document}

Running pdflatex on the file gives me this list of files (incidentally, this is another reason for an MWE: reduce extraneous bloat in questions and answers):

 *File List*
 scrbook.cls    2015/10/03 v3.19a KOMA-Script document class (book)
scrkbase.sty    2015/10/03 v3.19a KOMA-Script package (KOMA-Script-dependent ba
sics and keyval usage)
 scrbase.sty    2015/10/03 v3.19a KOMA-Script package (KOMA-Script-independent 
basics and keyval usage)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
scrlfile.sty    2015/10/03 v3.19a KOMA-Script package (loading files)
tocbasic.sty    2015/10/03 v3.19a KOMA-Script package (handling toc-files)
   size9.clo    1999/11/11 v1.4a NON-Standard LaTeX file (size option)
typearea.sty    2015/10/03 v3.19a KOMA-Script package (type area)
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
inputenc.sty    2015/03/17 v1.2c Input encoding file
    utf8.def    2015/12/03 v1.1r UTF-8 support for inputenc
   t1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  ot1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  omsenc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
libertine.sty    2014/11/25 (Bob Tennent) Supports Libertine and Biolinum fonts
 for all LaTeX engines.
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
 xkeyval.sty    2014/12/03 v2.7a package option processing (HA)
 xkeyval.tex    2014/12/03 v2.7a key=value parser (HA)
textcomp.sty    2005/09/27 v1.99g Standard LaTeX package
  ts1enc.def    2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
  ts1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
mweights.sty    2013/07/21 (Bob Tennent) Support package for multiple-weight fo
nt packages. 
 fontenc.sty
fontaxes.sty    2014/03/23 v1.0d Font selection axes
LinLibertine_I.tex
mathpazo.sty    2005/04/12 PSNFSS-v9.2a Palatino w/ Pazo Math (D.Puga, WaS) 
hyperref.sty    2012/11/06 v6.83m Hypertext links for LaTeX
hobsub-hyperref.sty    2012/05/28 v1.13 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty    2012/05/28 v1.13 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2012/05/28 v1.13 Construct package bundles (HO)
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
  ifvtex.sty    2010/03/01 v1.5 Detect VTeX and its facilities (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable calculations with integers (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty    2011/11/25 v1.13 Implements pdfTeX's escape features (HO)
bigintcalc.sty    2012/04/08 v1.3 Expandable calculations on big integers (HO)
  bitset.sty    2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty    2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty    2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
 hopatch.sty    2012/05/28 v1.2 Wrapper for package hooks (HO)
xcolor-patch.sty    2011/01/30 xcolor patch
atveryend.sty    2011/06/30 v1.8 Hooks at the very end of document (HO)
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
refcount.sty    2011/10/16 v3.4 Data extraction from label references (HO)
 hycolor.sty    2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
 auxhook.sty    2011/03/04 v1.3 Hooks for auxiliary files (HO)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
  pd1enc.def    2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
 hpdftex.def    2012/11/06 v6.83m Hyperref driver for pdfTeX
rerunfilecheck.sty    2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
    pdfx.sty    2016/02/04 v1.5.6 PDF/X and PDF/A support (CVR/HTH/RRM/PS)
   puenc.def    2012/11/06 v6.83m Hyperref: PDF Unicode definition (HO)
stringenc.sty    2011/12/02 v1.10 Convert strings between diff. encodings (HO)
  l8uenc.def
se-pdfdoc.def    2011/12/02 v1.10 stringenc: PDFDocEncoding
    8bit.def    2008/03/30 v1.1d Input encoding file
tx-pdfx-xmpmetadata.xmpdata
    8bit.def    2008/03/30 v1.1d Input encoding file
    utf8.def    2015/12/03 v1.1r UTF-8 support for inputenc
   t1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  ot1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  omsenc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  ts1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
    utf8.def    2015/12/03 v1.1r UTF-8 support for inputenc
   t1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  ot1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  omsenc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  ts1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
    utf8.def    2015/12/03 v1.1r UTF-8 support for inputenc
   t1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  ot1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  omsenc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  ts1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
    utf8.def    2015/12/03 v1.1r UTF-8 support for inputenc
   t1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  ot1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  omsenc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  ts1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
    utf8.def    2015/12/03 v1.1r UTF-8 support for inputenc
   t1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  ot1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  omsenc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  ts1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
    utf8.def    2015/12/03 v1.1r UTF-8 support for inputenc
   t1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  ot1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  omsenc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
  ts1enc.dfu    2015/12/03 v1.1r UTF-8 support for inputenc
 xmpincl.sty    2008/05/10 v2.2 Include XMP data in pdflatex
  ifthen.sty    2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
    8bit.def    2008/03/30 v1.1d Input encoding file
filecontents.sty    2011/10/08 v1.3 Create an external file from within a LaTeX
 document
  ts1cmr.fd    2014/09/29 v2.5h Standard LaTeX font definitions
   t1pbk.fd    2001/06/04 font definitions for T1/pbk.
 nameref.sty    2012/10/27 v2.43 Cross-referencing by name of section
gettitlestring.sty    2010/12/03 v1.4 Cleanup title references (HO)
tx-pdfx-xmpmetadata.out
tx-pdfx-xmpmetadata.out
 ***********

So, my pdfx is version 1.5.6 from 2016. The previous version on CTAN looks like it was 1.3 from 2008.

Related Question