Can hyperxmp
embed the document's abstract as an XMP metadata in LaTeX? If not, can anyone suggest a way on how I can execute this?
[Tex/LaTex] How to embed abstract as an XMP metadata
hyperxmpmetadataxmp
hyperxmpmetadataxmp
Can hyperxmp
embed the document's abstract as an XMP metadata in LaTeX? If not, can anyone suggest a way on how I can execute this?
Best Answer
Currently, there are
twothree packages that I am aware of that will embed XMP:hyperxmp
xmpincl
andpdfx
. The advantage of the first is that it is easy to use; the second is perhaps more extensible.Another consideration is that, according to (a fairly quick glance at the three files that comprise) the XMP specification, there is no innate "abstract" property. Your two most suitable options are:
dc:description
, which is (supposed to be) 'an account of the resource'; anddc:subject
, which is (supposed to be) 'the topic of the resource', adding the following comment: 'Typically, the subject will be represented using keywords, key phrases, or classification codes....'With
hyperxmp
, these are already mapped to specific options.xmpincl
expects you to do what you want and what you are required to do, and provides very little help to make sure things turn out OK.Hyperxmp is designed to be used with
hyperref
, and it maps these two fields in the following way:dc:description
topdfsubject
dc:subject
topdfkeywords
This suggests that the easiest way to embed the abstract is to put it in
hyperref
'spdfsubject
as mediated byhyperxmp
. Something like this:This seems to work. However, I am on Linux and cannot easily see what happens to this file with Adobe Acrobat.
pdfinfo
returns the following:I would be curious to have someone confirm that things are as they should be in a more XMP-aware environment. Note also that there are some special rules to observe about including commas in fields that are comma-separated (e.g.,
pdfauthor
andpdfkeywords
); consult the manual for more information.XMPincl is less user-friendly, at least at first. You must set up an
.xmp
file, which you then include. Using the package in your LaTeX document is easy. The author recommends calling the package before\documentclass
, so a simple file would look like this:However, you need to have also a file in the same directory (which I happen to have called)
example.xmp
, which should look something like this:pdfinfo -meta
gives me:So this works as well. A drawback is that if you use
hyperref
also, there's no (easy?) way to re-use the metadata as I did with thehyperxmp
example above. That means you're going to be putting them in thehyperref
fields anyway (or at least some of these entries).PDFX also allows for adding metadata via XMP (it relies on
xmpincl
) The manual is quite helpful, and suggests as I did above to use what amounts to asdc:description
via the\Subject
command ofpdfx
. The other key thing to be aware of is that you should call the XMP data file the same name as the actual.tex
file, but with the extension.xmpdata
. That is, if your file is calledmyfile.tex
, name the metadata filemyfile.xmpdata
. (Note: this is easily accomplished with the\jobname
primitive, which the example below uses.)Here's an example file constructed mostly from the package's manual:
This will produce a file called
pdfa.xmpi
(It is PDF/A because of the options [not] used.) And the XMP data produced is valid according to http://www.pdflib.com/knowledge-base/xmp-metadata/free-xmp-validator/Thus, I would suggest either
hyperxmp
orpdfx
as a good method for embedding things like the abstract in the metadata.