1

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.

  • Please provide a complete Minimal non-Working Example (MnWE). A fragment of code, an obscurely-related subject and a rather confusing explanation is not a good basis on which to expect useful answers. Hope you may, but clarifying things would likely be a more productive strategy. See this meta question for some help on what's required. Why is 'EXAMPLE - .ZIP` capitalised and what does the question mean? – cfr Jun 11 '16 at 2:59
  • What, for example, are you actually trying to do? – cfr Jun 11 '16 at 3:01
  • I was trying to compile a pdfa-1b compliant PDF. Examples with valid XMP schemas are missing (except from the license.xmp). Some examples and best practices might be handy. Including explanation on how to include correct startingPage, endingPage, etc. – Erik Ušaj Jun 11 '16 at 12:41
  • Problem solved thanks to @marijn. However I as still wondering if ID value in < ? xpacket ? > is supposed to be auto-genereted or somehow provided – Erik Ušaj Jun 11 '16 at 13:38
2

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

  • Thank you. Wrapping \includexmp{pdfa-1b} between \makeatletter and \makeatother removed error missing $ . Moving forward I had to add some additional values with \provide command: \providecommand{\xmpAuthorURI}{} \providecommand{\xmpJournalnumber}{} \providecommand{\xmpVolume}{} \providecommand{\xmpIssue}{} \providecommand{\xmpCoverDisplayDate}{} \providecommand{\xmpCoverDate}{} \providecommand{\xmpJournaltitle}{} \providecommand{\xmpFirstpage}{} \providecommand{\xmpLastpage}{} \providecommand{\xmpDoi}{} – Erik Ušaj Jun 11 '16 at 12:18
  • 1
    @ErikUšaj for the empty commands you can also use the modification as described in my answer: replace every occurrence of \@empty in pdfa-1b.xmp by \undefined. This results in missing values being skipped (as is also intended by \@empty in the original pdfa-1b.xmp). When you do this once, you don't need to define {} commands in your LaTeX documents every time. – Marijn Jun 11 '16 at 14:34
  • This approach doesn't work with LuaLaTeX, right? – SeSodesa Mar 6 at 17:25
  • @TheSodesa that's right, the package manual states (in the source code) that Only pdflatex is supported by the xmpincl package. – Marijn Mar 6 at 21:23

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.