[Tex/LaTex] Avoiding errors with \includexmp{pdfa-1b}. Any list of best practices and working example(s) with complete .XMP file(s)

pdf-axmp

I am getting following error when trying to use some pdfa-1b stuff:

(/usr/local/texlive/2015basic/texmf-dist/tex/generic/pgf/frontendlayer/tikz/lib
raries/tikzlibrarytopaths.code.tex))) (./chronosyschr.tex)) (./longtable.sty) (./arydshln.sty) (./xmpincl.sty
(/usr/local/texlive/2015basic/texmf-dist/tex/latex/base/ifthen.sty))
! Missing $ inserted.
<inserted text> 
                $
l.274 \includexmp{pdfa-1b}

? 

Code in my .tex file as follows:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% XMP data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{xmpincl}

\providecommand{\xmpProducer}{LaTeX2e}
\providecommand{\xmpOrg}{MyOrg}
\providecommand{\xmpTitle}{\ttitle}
\providecommand{\xmpAuthor}{\tauthor, mymail@gmail.com}
\providecommand{\xmpKeywords}{\tkeywordsEn}

\includexmp{pdfa-1b}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% pdfInfo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pdfinfo{%
/Title    (\ttitle)
/Author   (\tauthor, mymail@gmail.com)
/Subject  (\ttitleEn)
/Keywords (\tkeywordsEn)
/ModDate  (\pdfcreationdate)
/Trapped  /False
}

XMP metadata examples (or XMP predefined schemas) are not readily available in documentation, apart from license.XMP, that works. But examples of actual usage and best practices with more complete metadata are missing.

And I am trying to use pdfa-1b.xmp file form GitHub repo:
https://github.com/bencomp/pdfx-ext/blob/master/pdfa-1b.xmp
(since whatever was provided by our faculty does not compile; and dropping its content into https://www.pdflib.com/knowledge-base/xmp-metadata/free-xmp-validator/ turned not valid).

And all extensive documentation lacks basic working examples… Or perhaps just looking at wrong pdfa-1b documentation / packages…

Thank you in advance for any useful answers.

Best Answer

The xmpincl package works with, e.g., the xmp file provided in the manual (see https://www.ctan.org/tex-archive/macros/latex/contrib/xmpincl?lang=en, it is the easiest to copy the xmp from the end of the .dtx file).

However, the pdfa-1b.xmp file contains some conditionals with @, therefore you need to surrond the \includexmp with \makeatletter and \makeatother. On my system for some reason the \ifx \@empty construct did not work (the else clause was executed), I replaced this in the xmp file with \ifx \undefined which did work.

MWE:

\documentclass{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% XMP data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{xmpincl}

\providecommand{\xmpProducer}{LaTeX2e}
\providecommand{\xmpOrg}{MyOrg}
\providecommand{\xmpTitle}{MyTitle}
\providecommand{\xmpAuthor}{MyAuthor, mymail@gmail.com}
\providecommand{\xmpKeywords}{MyKeywords}
\providecommand{\xmpSubject}{MySubject}
\providecommand{\xmpCreatorTool}{\pdftexbanner}
\providecommand{\convDate}{\pdfcreationdate}
\makeatletter
\includexmp{pdfa-1b}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% pdfInfo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pdfinfo{%
/Title    (MyTitle)
/Author   (MyAuthor, mymail@gmail.com)
/Subject  (MySubject)
/Keywords (MyKeywords)
/ModDate  (\pdfcreationdate)
/Trapped  /False
}
\begin{document}
Hello, world!
\end{document}

Snippet from the modified pdfa-1b.xmp:

\ifx\xmpJournalnumber\undefined\relax\else<prism:issn>\xmpJournalnumber</prism:issn>\fi
\ifx\xmpVolume\undefined\relax\else<prism:volume>\xmpVolume</prism:volume>\fi
\ifx\xmpIssue\undefined\relax\else<prism:number>\xmpIssue</prism:number>\fi

Result:

enter image description here