summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-01-04 00:17:36 +0000
committerKarl Berry <karl@freefriends.org>2014-01-04 00:17:36 +0000
commitf5e68d092b878b0f0d86b10cbd8830cf08a153b8 (patch)
tree3af0704addd30b061b556c76697932eb61efbd8a /Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx
parent64cabb7b36a81f41f4bbe49f00cf5aa4fc83f66c (diff)
hyperxmp (3jan14)
git-svn-id: svn://tug.org/texlive/trunk@32560 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx')
-rw-r--r--Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx500
1 files changed, 356 insertions, 144 deletions
diff --git a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx
index 226b819a335..43a3102b9c6 100644
--- a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx
+++ b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2013 by Scott Pakin <scott+hyxmp@pakin.org>
+% Copyright (C) 2014 by Scott Pakin <scott+hyxmp@pakin.org>
% -------------------------------------------------------
%
% This file may be distributed and/or modified under the
@@ -22,7 +22,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{hyperxmp}
%<*package>
- [2013/07/18 v2.3b Store hyperref metadata in XMP format]
+ [2014/01/02 v2.4 Store hyperref metadata in XMP format]
%</package>
%
%<*driver>
@@ -44,6 +44,25 @@
\EnableCrossrefs
\CodelineIndex
\RecordChanges
+
+% Specify this document's metadata.
+\title{The \pkgname{hyperxmp} package\thanks{This document
+ corresponds to \pkgname{hyperxmp}~\fileversion, dated \filedate.}}
+\author{Scott Pakin \\ \texttt{scott+hyxmp@pakin.org}}
+\hypersetup{%
+ pdfauthor={Scott Pakin},
+ pdftitle={The hyperxmp package},
+ pdfsubject={LaTeX2e support for XMP metadata},
+ pdfkeywords={LaTeX, embedded metadata, XMP, PDF, copyright, license, comments},
+ pdfcopyright={Copyright (C) 2014, Scott Pakin},
+ pdflicenseurl={http://www.latex-project.org/lppl/},
+ pdfcaptionwriter={Scott Pakin},
+ pdfcontactemail={scott+hyxmp@pakin.org},
+ pdfcontacturl={http://www.pakin.org/\xmptilde scott/},
+ pdflang={en-US},
+ baseurl={http://www.ctan.org/tex-archive/macros/latex/contrib/hyperxmp/hyperxmp.pdf}
+}
+
\begin{document}
\DocInput{hyperxmp.dtx}
\Needspace{10\baselineskip}
@@ -62,7 +81,7 @@
%</driver>
% \fi
%
-% \CheckSum{1377}
+% \CheckSum{1432}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -91,28 +110,20 @@
% (\texttt{xdvipdfmx})}
% \changes{v1.2}{2010/06/07}{Added support for the Photoshop schema}
% \changes{v2.2}{2010/12/06}{Added support for the \protect\acro{IPTC} Photo Metadata schema}
+% \changes{v2.4}{2013/12/21}{Added support for the \protect\acro{PDF/A}
+% Identification schema, as requested by Florian Breitwieser}
%
% \GetFileInfo{hyperxmp.dtx}
%
-% \DoNotIndex{\#,\&,\<,\>,\^,\\,\_,\|,\ }
-% \DoNotIndex{\@cons,\@empty,\@ifpackageloaded,\@ifundefined}
-% \DoNotIndex{\@tempcnta,\@tempcntb}
-% \DoNotIndex{\advance,\afterassignment,\aftergroup}
-% \DoNotIndex{\begingroup,\bgroup}
-% \DoNotIndex{\catcode,\csname}
-% \DoNotIndex{\def,\divide}
-% \DoNotIndex{\edef,\egroup,\else,\endscname,\endgroup,\expandafter}
-% \DoNotIndex{\fi,\futurelet}
-% \DoNotIndex{\gdef,\global}
-% \DoNotIndex{\if,\ifcase,\ifnum,\ifx,\immediate}
-% \DoNotIndex{\let,\loop}
-% \DoNotIndex{\MessageBreak,\multiply}
-% \DoNotIndex{\newcommand,\noexpand}
-% \DoNotIndex{\or}
-% \DoNotIndex{\relax,\repeat}
-% \DoNotIndex{\space,\string}
-% \DoNotIndex{\the,\toks}
-% \DoNotIndex{\xdef}
+% \DoNotIndex{\!,\",\#,\^,\(,\),\*,\,,\<,\>,\\,\^,\_,\~,\ }
+% \DoNotIndex{\@cons,\@empty,\@ifpackageloaded,\@ifundefined,\@nil}
+% \DoNotIndex{\@tempcnta,\@tempcntb,\MessageBreak,\advance,\afterassignment}
+% \DoNotIndex{\aftergroup,\begingroup,\bgroup,\catcode,\csname,\def,\divide}
+% \DoNotIndex{\edef,\egroup,\else,\endcsname,\endgroup,\expandafter,\fi}
+% \DoNotIndex{\futurelet,\g@addto@macro,\gdef,\global,\if,\ifcase,\ifnum}
+% \DoNotIndex{\ifx,\immediate,\lccode,\let,\loop,\lowercase,\multiply}
+% \DoNotIndex{\newcommand,\noexpand,\or,\relax,\repeat,\space,\string,\the}
+% \DoNotIndex{\toks,\uccode,\uppercase,\usepackage,\xdef}
%
% ^^A Define a few logical styles.
% \DeclareRobustCommand{\term}[1]{#1\SortIndex{#1}{#1}}
@@ -177,24 +188,6 @@
% ^^A Pack figures a bit tighter onto the page.
% \renewcommand{\floatpagefraction}{0.8}
%
-% ^^A Specify this document's metadata.
-% \title{The \pkgname{hyperxmp} package\thanks{This document
-% corresponds to \pkgname{hyperxmp}~\fileversion, dated \filedate.}}
-% \author{Scott Pakin \\ \texttt{scott+hyxmp@pakin.org}}
-% \hypersetup{%
-% pdfauthor={Scott Pakin},
-% pdftitle={The hyperxmp package},
-% pdfsubject={LaTeX2e support for XMP metadata},
-% pdfkeywords={LaTeX, embedded metadata, XMP, PDF, copyright, license, comments},
-% pdfcopyright={Copyright (C) 2013, Scott Pakin},
-% pdflicenseurl={http://www.latex-project.org/lppl/},
-% pdfcaptionwriter={Scott Pakin},
-% pdfcontactemail={scott+hyxmp@pakin.org},
-% pdfcontacturl={http://www.pakin.org/~scott/},
-% pdflang={en-US},
-% baseurl={http://www.ctan.org/tex-archive/macros/latex/contrib/hyperxmp/hyperxmp.pdf}
-% }
-%
% \maketitle
% \sloppy
%
@@ -210,7 +203,7 @@
% \section{Introduction}
%
% Adobe Systems, Inc.\ has been promoting
-% \acro{XMP}~\cite{Adobe2010:XMP}---eXtensible Metadata Platform---as a
+% \acro{XMP}~\cite{Adobe2012:XMP}---eXtensible Metadata Platform---as a
% standard way to include metadata within a document. The idea behind
% \acro{XMP} is that it is an \acro{XML}-based description of various
% document attributes and is embedded as uncompressed, unencoded text
@@ -263,6 +256,15 @@
% \begin{itemize} \raggedright
% \item authors (\xmpterm{dc:creator})
% \item base \acro{URL} (\xmpterm{xmp:BaseURL})
+% \item contact address
+% (\xmpterm[CiAdrExtadr]{Iptc4xmpCore:CreatorContactInfo},
+% \xmpterm[CiAdrCity]{Iptc4xmpCore:CreatorContactInfo},
+% \xmpterm[CiAdrRegion]{Iptc4xmpCore:CreatorContactInfo},
+% \xmpterm[CiAdrPcode]{Iptc4xmpCore:CreatorContactInfo}, and
+% \xmpterm[CiAdrCtry]{Iptc4xmpCore:CreatorContactInfo})
+% \item contact email address(es) (\xmpterm[CiEmailWork]{Iptc4xmpCore:CreatorContactInfo})
+% \item contact telephone number(s) (\xmpterm[CiTelWork]{Iptc4xmpCore:CreatorContactInfo})
+% \item contact \acro{URL}(s) (\xmpterm[CiUrlWork]{Iptc4xmpCore:CreatorContactInfo})
% \item copyright (\xmpterm{dc:rights} and \xmpterm{xmpRights:Marked})
% \item date (\xmpterm{dc:date}, \xmpterm{xmp:CreateDate},
% \xmpterm{xmp:ModifyDate}, and \xmpterm{xmp:MetadataDate})
@@ -274,21 +276,12 @@
% \item \LaTeX\ file name (\xmpterm{dc:source})
% \item license \acro{URL} (\xmpterm{xmpRights:WebStatement})
% \item metadata writer (\xmpterm{photoshop:CaptionWriter})
-% \item \acro{PDF}-generating tool (\xmpterm{pdf:Producer} and
-% \xmpterm{xmp:CreatorTool})
% \item \acro{PDF} version (\xmpterm{pdf:PDFVersion})
+% \item \acro{PDF}-generating tool (\xmpterm{pdf:Producer} and \xmpterm{xmp:CreatorTool})
+% \item \acro{PDF/A} compliance level and version (\xmpterm{pdfaid:part} and \xmpterm{pdfaid:conformance})
% \item primary author's position/title (\xmpterm{photoshop:AuthorsPosition})
% \item summary (\xmpterm{dc:description})
% \item title (\xmpterm{dc:title})
-% \item contact address
-% (\xmpterm[CiAdrExtadr]{Iptc4xmpCore:CreatorContactInfo},
-% \xmpterm[CiAdrCity]{Iptc4xmpCore:CreatorContactInfo},
-% \xmpterm[CiAdrRegion]{Iptc4xmpCore:CreatorContactInfo},
-% \xmpterm[CiAdrPcode]{Iptc4xmpCore:CreatorContactInfo}, and
-% \xmpterm[CiAdrCtry]{Iptc4xmpCore:CreatorContactInfo})
-% \item contact telephone number(s) (\xmpterm[CiTelWork]{Iptc4xmpCore:CreatorContactInfo})
-% \item contact email address(es) (\xmpterm[CiEmailWork]{Iptc4xmpCore:CreatorContactInfo})
-% \item contact \acro{URL}(s) (\xmpterm[CiUrlWork]{Iptc4xmpCore:CreatorContactInfo})
% \end{itemize}
%
% \noindent
@@ -336,6 +329,7 @@
% \end{itemize}
%
% \noindent
+% \mbox{}\label{page:begin-new-options}
% \pkgname{hyperxmp} instructs \pkgname{hyperref} also to accept the
% following options, which have meaning only to \pkgname{hyperxmp}:
%
@@ -354,6 +348,7 @@
% \item \optname{pdflicenseurl}
% \item \optname{pdfmetalang}
% \end{itemize}
+% \label{page:end-new-options}
%
% \optname{pdfauthortitle} indicates the primary author's position or
% title. \optname{pdfcaptionwriter} specifies the name of the person
@@ -527,7 +522,7 @@
% contact address. Interestingly, Adobe Illustrator CS5 correctly
% displays the contact address.
% \DescribeMacro{\xmplinesep}
-% If your find Adobe Acrobat's behavior bothersome, you can redefine the
+% If you find Adobe Acrobat's behavior bothersome, you can redefine the
% |\xmplinesep| macro as a string to use as an address-line separator.
% For example, the following replaces all commas appearing in
% \optname{pdfcontactaddress}'s argument with semicolons:
@@ -590,10 +585,11 @@
% As of version~2.2 of \pkgname{hyperxmp}, it is acceptable to use
% |\xmpcomma| and |\xmpquote| within any \pkgname{hyperxmp} option, not
% just in those in which a comma normally serves as a separator
-% (i.e.,~lists and multiline fields). Outside of those cases,
-% |\xmpcomma| is treated as an ordinary comma, and |\xmpquote| returns
-% its argument unmodified. Hence, it is legitimate to use |\xmpcomma|
-% and |\xmpquote| in cases like the following
+% (i.e.,~lists and multiline fields). Outside of cases in which a comma
+% serves as a separator, |\xmpcomma| is treated as an ordinary comma,
+% and |\xmpquote| returns its argument unmodified. Hence, it is
+% legitimate to use |\xmpcomma| and |\xmpquote| in cases like the
+% following
%
% \begin{verbatim}
% pdfauthortitle={\xmpquote{Psychiatrist\xmpcomma\ Arkham Asylum}}
@@ -605,6 +601,15 @@
% doubt, use |\xmpcomma| and |\xmpquote|; it should always be safe
% to do so.
%
+% \DescribeMacro{\xmptilde}
+% Version~2.4 of \pkgname{hyperxmp} introduces a convenience macro
+% called |\xmptilde|. |\xmptilde| expands to a literal tilde character
+% instead of the nonbreaking space that ``|~|'' normally represents.
+% Use it to represent \acro{URL}s such as
+% \url{http://www.pakin.org/~scott/} (``|http://www.pakin.org/|\linebreak[0]|\xmptilde|
+% |scott/|'') in options such as \optname{baseurl},
+% \optname{pdfcontacturl} and \optname{pdflicenseurl}.
+%
%
% \StopEventually{^^A
% \section{Future Work}
@@ -653,12 +658,12 @@
% \newblock ISO \mbox{32000-1} standard document. Available from
% \url{http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf}.
%
-% \bibitem{Adobe2010:XMP}
+% \bibitem{Adobe2012:XMP}
% Adobe Systems, Inc., San Jose, California.
% \newblock {\em {XMP} Specification Part~1: Data model, Serialization, and Core
-% Properties}, July 2010.
+% Properties}, April 2012.
% \newblock Available from
-% \url{http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/XMPSpecificationPart1.pdf}.
+% \url{http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/cc-201306/XMPSpecificationPart1.pdf}.
%
% \bibitem{Downes1994:ATB15}
% Michael Downes.
@@ -680,10 +685,25 @@
% \newblock Available from
% \url{http://www.iana.org/assignments/language-subtag-registry}.
%
+% \bibitem{Leach2005:uuid}
+% Paul~J. Leach, Michael Mealling, and Rich Salz.
+% \newblock A {U}niversally {U}nique {ID}entifier ({UUID}) {URN} namespace.
+% \newblock Request for Comments 4122, Internet Engineering Task Force, Network
+% Working Group, July 2005.
+% \newblock Category: Standards Track. Available from
+% \url{http://www.ietf.org/rfc/rfc4122.txt}.
+%
+% \bibitem{PDFA2008:xmp-props}
+% PDF/A Competence Center, Berlin, Germany.
+% \newblock {\em {T}ech{N}ote~0008: Predefined {XMP} Properties in {PDF/A-1}},
+% March~20, 2008.
+% \newblock Available from
+% \url{http://www.pdfa.org/wp-content/uploads/2011/08/tn0008_predefined_xmp_properties_in_pdfa-1_2008-03-20.pdf}.
+%
% \bibitem{PDFA2008:ext-schemas}
% PDF/A Competence Center, Berlin, Germany.
-% \newblock {\em TechNote~0009: {XMP} Extension Schemas in {PDF/A-1}}, March~20,
-% 2008.
+% \newblock {\em {T}ech{N}ote~0009: {XMP} Extension Schemas in {PDF/A-1}},
+% March~20, 2008.
% \newblock Available from
% \url{http://www.pdfa.org/wp-content/uploads/2011/08/tn0009_xmp_extension_schemas_in_pdfa-1_2008-03-20.pdf}.
% \end{thebibliography}
@@ -717,7 +737,7 @@
% \end{macrocode}
% \end{macro}
%
-% \changes{v1.5}{2012/03/10}{Made the \acro{XMP} inclusion more robust.
+% \changes{v1.5}{2012/03/10}{Made the \protect\acro{XMP} inclusion more robust.
% Thanks to Heiko Oberdiek for the bug report and suggested modifications.}
%
% \begin{macro}{\hyxmp@at@end}
@@ -744,12 +764,12 @@
% An important design decision underlying \pkgname{hyperxmp} is that the
% package should integrate seamlessly with \pkgname{hyperref}. To that
% end, \pkgname{hyperxmp} takes its \acro{XMP} metadata from
-% \pkgname{hyperref}'s \optname{pdftitle}, \optname{pdfauthor},
-% \optname{pdfsubject}, \optname{pdfkeywords}, and \optname{pdflang}
-% options. It also introduces five new options: \optname{pdfcopyright},
-% \optname{pdflicenseurl}, \optname{pdfauthortitle},
-% \optname{pdfcaptionwriter}, and \optname{pdfmetalang}. For
-% consistency with \pkgname{hyperref}'s document-metadata naming
+% \pkgname{hyperref}'s \optname{baseurl}, \optname{pdfauthor},
+% \optname{pdfkeywords}, \optname{pdflang}, \optname{pdfproducer},
+% \optname{pdfsubject}, and \optname{pdftitle} options. It also
+% introduces a number of new options, which are listed
+% \vpagerefrange[above]{page:begin-new-options}{page:end-new-options}.
+% For consistency with \pkgname{hyperref}'s document-metadata naming
% conventions (which are in turn based on \LaTeX's document-metadata
% naming conventions), we do not prefix metadata-related macro names
% with our package-specific |\hyxmp@| prefix. That is, we use names
@@ -910,9 +930,9 @@
% \end{macrocode}
% \end{macro}
%
-% \changes{v2.1}{2012/09/16}{Enabled \pkgname{hyperxmp} and
-% \pkgname{hyperref} to be loaded in either order. This addresses a
-% bug report by Yury Donskoy}
+% \changes{v2.1}{2012/09/16}{Enabled \protect\pkgname{hyperxmp} and
+% \protect\pkgname{hyperref} to be loaded in either order. This addresses
+% a bug report by Yury Donskoy}
%
% We need to capture list arguments (viz.~\optname{pdfauthor} and
% \optname{pdfkeywords}) before \pkgname{hyperref} converts them to
@@ -1081,10 +1101,11 @@
%
% \begin{macro}{\hyxmp@find@metadata}
% \begin{macro}{\hyxmp@concated@metadata}
-% Issue a warning message if the author failed to include any metadata
-% at all. Note that we don't consider |\@pdfmetalang| as metadata as
-% that value is meaningful only when used in conjunction with other
-% information.
+% Issue a warning message if the author failed to specify any metadata
+% at all. This excludes metadata that is included automatically such as
+% the current timestamp. Note that we don't consider |\@pdfmetalang| as
+% metadata as that value is meaningful only when used in conjunction
+% with other information.
% \begin{macrocode}
\newcommand*{\hyxmp@find@metadata}{%
\edef\hyxmp@concated@metadata{%
@@ -1280,6 +1301,18 @@ disabled}%
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\xmptilde}
+% As a convenience for the user, we define |\xmptilde| as a category~12
+% (other) ``|~|'' character.
+% \changes{v2.4}{2014/01/01}{Added this macro}
+% \begin{macrocode}
+\bgroup
+ \catcode`\~=12%
+ \gdef\xmptilde{~}%
+\egroup
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\XMPTruncateList}
% \changes{v2.0}{2012/09/07}{Added this macro}
% \changes{v2.3b}{2013/07/18}{Made all definitions local to avoid
@@ -1535,7 +1568,7 @@ disabled}%
%
% \begin{macro}{\hyxmp@toxml}
% \changes{v2.0}{2012/08/02}{Added by Heiko Oberdiek}
-% Replace the characters ``\textless, ``\&'', and ``\textgreater'' with
+% Replace the characters ``\textless'', ``\&'', and ``\textgreater'' with
% \acro{XML} entities when using a non-native-\term{Unicode}
% \tex\ (\tex\ or \pdfTeX).
% \begin{macrocode}
@@ -1590,7 +1623,7 @@ disabled}%
% \begin{macro}{\hyxmp@toxml@unicodetex}
% \changes{v2.0}{2012/08/02}{Added by Heiko Oberdiek}
% \begin{macro}{\hyxmp@text}
-% Replace the characters ``\textless, ``\&'', and ``\textgreater'' with
+% Replace the characters ``\textless'', ``\&'', and ``\textgreater'' with
% \acro{XML} entities when using a native-\term{Unicode}
% \tex\ (\XeTeX\ or \LuaTeX).
% \begin{macrocode}
@@ -1779,9 +1812,10 @@ disabled}%
% \label{sec:uuid-gen}
%
% We use a linear congruential generator to produce pseudorandom
-% \acro{UUID}s. True, this method has its flaws but it's simple to
-% implement in \tex\ and is good enough for producing the \acro{XMP}
-% \xmpterm{xmpMM:DocumentID} and \xmpterm{xmpMM:InstanceID} fields.
+% version~4 \acro{UUID}s~\cite{Leach2005:uuid}. True, this method has
+% its flaws but it's simple to implement in \tex\ and is good enough for
+% producing the \acro{XMP} \xmpterm{xmpMM:DocumentID} and
+% \xmpterm{xmpMM:InstanceID} fields.
%
% \begin{macro}{\hyxmp@modulo@a}
% Replace the contents of |\@tempcnta| with the contents modulo~|#1|.
@@ -1895,24 +1929,38 @@ disabled}%
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\hyxmp@append@hex@iv}
-% Invoke |\hyxmp@append@hex| four times.
+% \begin{macro}{\hyxmp@append@hex@iii}
+% Invoke |\hyxmp@append@hex| three times.
% \begin{macrocode}
-\def\hyxmp@append@hex@iv#1{%
+\def\hyxmp@append@hex@iii#1{%
\hyxmp@append@hex#1%
\hyxmp@append@hex#1%
\hyxmp@append@hex#1%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\hyxmp@append@hex@iv}
+% Invoke |\hyxmp@append@hex| four times.
+% \begin{macrocode}
+\def\hyxmp@append@hex@iv#1{%
+ \hyxmp@append@hex@iii#1%
\hyxmp@append@hex#1%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\hyxmp@create@uuid}
-% Define macro~|#1| as a \acro{UUID} of the form
-% ``|uuid:|\textit{xxxxxxxx}|-|\textit{xxxx}|-|\textit{xxxx}|-|\textit{xxxxxxxxxxxx}''
-% in which each ``\textit{x}'' is a lowercase hexadecimal digit. We
+% As per the definition of a version~4
+% \acro{UUID}~\cite{Leach2005:uuid}, define macro~|#1| as a \acro{UUID}
+% of the form
+% ``|uuid:|\textit{xxxxxxxx}|-|\linebreak[0]\textit{xxxx}|-|\linebreak[0]\textit{4xxx}|-|\linebreak[0]\textit{yxxx}|-|\linebreak[0]\textit{xxxxxxxxxxxx}''
+% in which each ``\textit{x}'' is a lowercase hexadecimal digit and
+% ``\textit{y}'' is one of ``|8|'', ``|9|'', ``|a|'', or~``|b|''. We
% assume that the random-number generator is already seeded. Note that
% |\hyxmp@create@uuid| overwrites both |\@tempcnta| and |\@tempcntb|.
+% \changes{v2.4}{2014/01/02}{Modified this macro to produce a proper
+% version~4 (random or pseudorandom) \protect\acro{UUID}}
% \begin{macrocode}
\def\hyxmp@create@uuid#1{%
\def#1{uuid:}%
@@ -1920,8 +1968,22 @@ disabled}%
\hyxmp@append@hex@iv#1%
\g@addto@macro#1{-}%
\hyxmp@append@hex@iv#1%
+ \g@addto@macro#1{-4}%
+ \hyxmp@append@hex@iii#1%
\g@addto@macro#1{-}%
- \hyxmp@append@hex@iv#1%
+% \end{macrocode}
+% Randomly select one of ``|8|'', ``|9|'', ``|a|'', or~``|b|''.
+% \begin{macrocode}
+ \hyxmp@set@rand@num
+ \@tempcnta=\hyxmp@rand@num
+ \hyxmp@modulo@a{4}%
+ \ifcase\@tempcnta
+ \g@addto@macro#1{8}%
+ \or\g@addto@macro#1{9}%
+ \or\g@addto@macro#1{a}%
+ \or\g@addto@macro#1{b}%
+ \fi
+ \hyxmp@append@hex@iii#1%
\g@addto@macro#1{-}%
\hyxmp@append@hex@iv#1%
\hyxmp@append@hex@iv#1%
@@ -1950,16 +2012,11 @@ disabled}%
% \begin{macro}{\hyxmp@InstanceID}
% Seed the random-number generator with a function of the current
% filename, \acro{PDF} document title, \acro{PDF} author, and the
-% current day, month, year, and minutes since midnight, then invoke
-% |\hyxmp@create@uuid| to define |\hyxmp@InstanceID| as a random
-% \acro{UUID}.
+% current timestamp, then invoke |\hyxmp@create@uuid| to define
+% |\hyxmp@InstanceID| as a random \acro{UUID}.
% \begin{macrocode}
\newcommand*{\hyxmp@def@InstanceID}{%
- \edef\hyxmp@seed@string{%
- \jobname:\@pdftitle:\@pdfauthor:%
- \the\year/\the\month/\the\day:%
- \the\time
- }%
+ \edef\hyxmp@seed@string{\jobname:\@pdftitle:\@pdfauthor:\hyxmp@today}%
\expandafter\hyxmp@seed@rng\expandafter{\hyxmp@seed@string}%
\edef\hyxmp@rand@num{\the\@tempcnta}%
\hyxmp@create@uuid\hyxmp@InstanceID
@@ -1974,7 +2031,7 @@ disabled}%
% An \acro{XMP} packet ``shall consist of the following, in order: a
% header \acro{PI}, the serialized \acro{XMP} data model (the \acro{XMP}
% packet) with optional white-space padding, and a trailer
-% \acro{PI}''~\cite{Adobe2010:XMP}. (``\acro{PI}'' is an abbreviation
+% \acro{PI}''~\cite{Adobe2012:XMP}. (``\acro{PI}'' is an abbreviation
% for ``processing instructions''). The serialized \acro{XMP} includes
% blocks of \acro{XML} for various \acro{XMP} schemata: Adobe \acro{PDF}
% (Section~\ref{sec:adobe-pdf}), Dublin Core
@@ -1982,12 +2039,14 @@ disabled}%
% (Section~\ref{sec:xmp-rights}), \acro{XMP} Media Management
% (Section~\ref{sec:xmp-media}), \acro{XMP} Basic
% (Section~\ref{sec:xmp-basic}), Photoshop
-% (Section~\ref{sec:photoshop}), and \acro{IPTC} Photo Metadata
-% (Section~\ref{sec:photo-meta}). The |\hyxmp@construct@packet| macro
-% constructs the \acro{XMP} packet into |\hyxmp@xml|. It first writes
-% the appropriate \acro{XML} header, then calls the various
-% schema-writing macros, then injects |\hyxmp@padding| as padding, and
-% finally writes the appropriate \acro{XML} trailer.
+% (Section~\ref{sec:photoshop}), \acro{IPTC} Photo Metadata
+% (Section~\ref{sec:photo-meta}), and \acro{PDF/A} Identification
+% (Section~\ref{sec:pdfa-id}). The |\hyxmp@construct@packet| macro
+% (Section~\ref{sec:combining-schemata}) constructs the \acro{XMP}
+% packet into |\hyxmp@xml|. It first writes the appropriate \acro{XML}
+% header, then calls the various schema-writing macros, then injects
+% |\hyxmp@padding| as padding, and finally writes the appropriate
+% \acro{XML} trailer.
%
% \subsubsection{XMP utility functions}
%
@@ -2027,7 +2086,7 @@ disabled}%
% \begin{macro}{\hyxmp@xml}
% The \acro{XMP} specification recommends leaving approximately
% 2000~bytes of whitespace at the end of each \acro{XMP} packet to
-% facilitate editing the packet in place~\cite{Adobe2010:XMP}.
+% facilitate editing the packet in place~\cite{Adobe2012:XMP}.
% |\hyxmp@padding| is defined to contain 32~lines of 50~spaces and a
% newline apiece for a total of 1632 characters of whitespace.
% \begin{macrocode}
@@ -2047,19 +2106,116 @@ __________________________________________________^^J%
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\hyxmp@today}
-% Define today's date in \textit{YYYY}-\textit{MM}-\textit{DD} format.
+% \begin{macro}{\hyxmp@pdf@to@xmp@date}
+% Convert a timestamp from \acro{PDF}'s
+% |D:|\textsc{yyyymmdd}hhmmss|-|\textsc{tt}|'|tt|'| format
+% \expandafter\ifx\csname pdfcreationdate\endcsname\relax
+% \else
+% (e.g.,~\texttt{\pdfcreationdate})
+% \fi
+% to \acro{XMP}'s
+% \textsc{yyyy}|-|\textsc{mm}|-|\textsc{dd}|T|hh|:|mm|:|ss|+|\textsc{tt}|:|tt format
+% \makeatletter
+% \expandafter\ifx\csname pdfcreationdate\endcsname\relax
+% \unskip
+% \else
+% (e.g.,~\texttt{\expandafter\hyxmp@pdf@to@xmp@date\pdfcreationdate})^^A
+% \fi
+% \makeatother
+% ~\cite{Adobe2012:XMP}. This macro is fully expandable.^^A
+% \changes{v2.4}{2013/12/24}{Added this macro}
% \begin{macrocode}
-\xdef\hyxmp@today{\the\year}%
-\ifnum\month<10
- \xdef\hyxmp@today{\hyxmp@today-0\the\month}%
-\else
- \xdef\hyxmp@today{\hyxmp@today-\the\month}%
-\fi
-\ifnum\day<10
- \xdef\hyxmp@today{\hyxmp@today-0\the\day}%
+\def\hyxmp@pdf@to@xmp@date#1:#2#3#4#5#6#7#8#9{%
+ #2#3#4#5-#6#7-#8#9%
+ \hyxmp@parse@time
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\hyxmp@parse@time}
+% This is a helper function for |\hyxmp@pdf@to@xmp@date|.
+% |\hyxmp@pdf@to@xmp@date| proper parses only the year, month, and day
+% then calls |\hyxmp@parse@time|. |\hyxmp@parse@time| parses the
+% hours, minutes, and seconds then calls |\hyxmp@parse@tz@char|.
+% \changes{v2.4}{2013/12/24}{Added this macro}
+% \begin{macrocode}
+\def\hyxmp@parse@time#1#2#3#4#5#6{%
+ T#1#2:#3#4:#5#6%
+ \hyxmp@parse@tz@char
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\hyxmp@parse@tz@char}
+% This is another helper function for |\hyxmp@pdf@to@xmp@date|. So far,
+% the date and time have been parsed. |\hyxmp@parse@tz@char| parses the
+% first character of the timezone descriptor. This can be one of
+% ``|+|'' for eastern timezones (\mbox{UTC$+x$}, including Asia,
+% Oceania, and most of Europe), ``|-|'' for western timezones
+% (\mbox{UTC$-x$}, primarily the Americas), or ``|Z|'' for Zulu time
+% (\mbox{UTC$+0$}). Timezones beginning with ``|+|'' or ``|-|'' are
+% followed by an offset in hours and minutes (parsed by
+% |\hyxmp@parse@tz|; timezones beginning with ``|Z|'' are not.
+% \changes{v2.4}{2013/12/24}{Added this macro}
+% \begin{macrocode}
+\def\hyxmp@parse@tz@char#1{%
+ #1%
+ \ifx#1-%
+ \expandafter\hyxmp@parse@tz
+ \else
+ \ifx#1+%
+ \expandafter\hyxmp@parse@tz
+ \fi
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\hyxmp@parse@tz}
+% This is the final helper function for |\hyxmp@pdf@to@xmp@date|. It
+% parses the piece of the timezone comprising the offset from
+% Coordinated Universal Time, measured in hours and minutes.
+% \changes{v2.4}{2013/12/24}{Added this macro}
+% \begin{macrocode}
+\def\hyxmp@parse@tz#1'#2'{%
+ #1:#2%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\hyxmp@today@define}
+% Use \TeX's |\year|, |\month|, and |\day| primitives to define
+% |\hyxmp@today| as today's date in
+% \textsc{yyyy}-\textsc{mm}-\textsc{dd} format.
+% \changes{v2.4}{2013/12/21}{Added this macro}
+% \begin{macrocode}
+\def\hyxmp@today@define{%
+ \xdef\hyxmp@today{\the\year}%
+ \ifnum\month<10
+ \xdef\hyxmp@today{\hyxmp@today-0\the\month}%
+ \else
+ \xdef\hyxmp@today{\hyxmp@today-\the\month}%
+ \fi
+ \ifnum\day<10
+ \xdef\hyxmp@today{\hyxmp@today-0\the\day}%
+ \else
+ \xdef\hyxmp@today{\hyxmp@today-\the\day}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\hyxmp@today}
+% Define |\hyxmp@today| as the current date and (if available) time and
+% timezone in \acro{XMP} \xmpterm{Date} format~\cite{Adobe2012:XMP}.
+% \changes{v2.4}{2013/12/24}{Modified the code to parse the time and
+% timezone from \texttt{\string\string\string\pdfcreationdate}, as
+% proposed by Florian Breitwieser}
+% \begin{macrocode}
+\expandafter\ifx\csname pdfcreationdate\endcsname\relax
+ \hyxmp@today@define
\else
- \xdef\hyxmp@today{\hyxmp@today-\the\day}%
+ \edef\hyxmp@today{\expandafter\hyxmp@pdf@to@xmp@date\pdfcreationdate}%
\fi
% \end{macrocode}
% \end{macro}
@@ -2082,40 +2238,41 @@ __________________________________________________^^J%
% \begin{macrocode}
\newcommand*{\hyxmp@pdf@schema}{%
% \end{macrocode}
-% \begin{macro}{\hyxmp@have@any}
-% Include an Adobe \acro{PDF} schema block if at least one of
-% |\@pdfkeywords| and |\@pdfproducer| is defined.
-% \begin{macrocode}
- \let\hyxmp@have@any=!%
- \ifx\@pdfkeywords\@empty
- \ifx\@pdfproducer\@empty
- \let\hyxmp@have@any=\@empty
- \fi
- \fi
- \ifx\hyxmp@have@any\@empty
- \else
-% \end{macrocode}
% Add a block of \acro{XML} to |\hyxmp@xml| that lists the document's
-% keywords (the \xmpterm{pdf:Keywords} property) and the tools used to
-% produce the \acro{PDF} file (the \xmpterm{pdf:Producer} property).
+% keywords (the \xmpterm{pdf:Keywords} property), the tools used to
+% produce the \acro{PDF} file (the \xmpterm{pdf:Producer} property), and
+% the version of the \acro{PDF} standard adhered to (the
+% \xmpterm{pdf:PDFVersion} property). Unlike most of the other schemata
+% that \pkgname{hyperxmp} supports, the Adobe \acro{PDF} schema is
+% \emph{always} included in the document, even if all of its keys are
+% empty. This is because \acro{PDF/A}-1b requires the keywords and
+% producer to be the same in the \acro{XMP} metadata and the \acro{PDF}
+% metadata. Because \pkgname{hyperref} always specifies the
+% \pdfterm{Keywords} and \pdfterm{Producer} fields, even when they're
+% empty, \pkgname{hyperxmp} has to follow suit and define
+% \xmpterm{pdf:Keywords} and \xmpterm{pdf:Producer} in the \acro{XMP}
+% packet.
+% \changes{v2.4}{2013/12/21}{Made
+% \texttt{\string\string\string\hyxmp@pdf@schema}
+% \protect\emph{always} include the Adobe \protect\acro{PDF} schema,
+% even when empty. Florian Breitwieser noted that this is necessary
+% for \protect\acro{PDF/A}-1b compliance}
% \begin{macrocode}
- \hyxmp@add@to@xml{%
+ \hyxmp@add@to@xml{%
______<rdf:Description rdf:about=""^^J%
___________xmlns:pdf="http://ns.adobe.com/pdf/1.3/">^^J%
- }%
- \hyxmp@add@simple{pdf:Keywords}{\@pdfkeywords}%
- \hyxmp@add@simple{pdf:Producer}{\@pdfproducer}%
- \@ifundefined{pdfminorversion}{}{%
- \hyxmp@add@simple{pdf:PDFVersion}{1.\the\pdfminorversion}%
- }%
- \hyxmp@add@to@xml{%
+ }%
+ \hyxmp@add@simple@var{pdf:Keywords}{@pdfkeywords}%
+ \hyxmp@add@simple@var{pdf:Producer}{@pdfproducer}%
+ \@ifundefined{pdfminorversion}{}{%
+ \hyxmp@add@simple{pdf:PDFVersion}{1.\the\pdfminorversion}%
+ }%
+ \hyxmp@add@to@xml{%
______</rdf:Description>^^J%
- }%
- \fi
+ }%
}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
% \begin{macro}{\hyxmp@add@simple}
% \begin{macro}{\hyxmp@string}
@@ -2139,6 +2296,28 @@ _________<#1>\hyxmp@xmlified</#1>^^J%
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\hyxmp@add@simple@var}
+% Given an \acro{XMP} tag~(|#1|) and a variable name~(|#2|), if the
+% string is defined, add a begin tag, the string, and an end tag to the
+% packet. The ``|simple|'' in the macro name indicates that the string
+% is output without variations for different languages.
+% |\hyxmp@add@simple@var| differs from |\hyxmp@add@simple| in that the
+% former includes defined but empty values in the \acro{XMP} packet
+% while the latter excludes both undefined and defined but empty values.
+% \changes{v2.4}{2013/12/21}{Added this macro}
+% \begin{macrocode}
+\newcommand*{\hyxmp@add@simple@var}[2]{%
+ \expandafter\ifx\csname#2\endcsname\relax
+ \else
+ \hyxmp@xmlify{\csname#2\endcsname}%
+ \hyxmp@add@to@xml{%
+_________<#1>\hyxmp@xmlified</#1>^^J%
+ }%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
%
% \subsubsection{The Dublin Core schema}
% \label{sec:dublin-core}
@@ -2230,6 +2409,9 @@ _________</dc:#1>^^J%
% the source file with |.tex| appended.
% \changes{v2.0}{2012/08/26}{Added support for \xmpterm{dc:language}
% and \xmpterm{dc:source}}
+% \changes{v2.4}{2013/12/21}{Made \xmpterm{dc:language} a \xmpterm{Bag}
+% instead of an individual item so as to conform to the latest
+% \acro{XMP} specifications, a detail identified by Florian Breitwieser}
% \begin{macrocode}
\newcommand*{\hyxmp@dc@schema}{%
\hyxmp@add@to@xml{%
@@ -2243,7 +2425,7 @@ _________<dc:format>application/pdf</dc:format>^^J%
\hyxmp@list@to@xml{creator}{Seq}{\hyxmp@pdfauthor}%
\hyxmp@list@to@xml{subject}{Bag}{\hyxmp@pdfkeywords}%
\hyxmp@list@to@xml{date}{Seq}{\hyxmp@today}%
- \hyxmp@add@simple{dc:language}{\@pdflang}%
+ \hyxmp@list@to@xml{language}{Bag}{\@pdflang}%
\hyxmp@add@simple{dc:source}{\jobname.tex}%
\hyxmp@add@to@xml{%
______</rdf:Description>^^J%
@@ -2333,7 +2515,7 @@ ______</rdf:Description>^^J%
% |\hyxmp@xml| macro. According to the \acro{XMP} specification, the
% \xmpterm{xmpMM:DocumentID} property is supposed to uniquely identify a
% document, and the \xmpterm{xmpMM:InstanceID} property is supposed to
-% change with each save operation~\cite{Adobe2010:XMP}. As seen in
+% change with each save operation~\cite{Adobe2012:XMP}. As seen in
% Section~\ref{sec:uuid-gen}, we do what we can to honor this intention
% from within a \tex-based workflow.
% \changes{v1.4}{2011/05/29}{Renamed the \texttt{xapMM} namespace
@@ -2649,8 +2831,37 @@ ________________________</rdf:li>^^J%
% \end{macrocode}
% \end{macro}
%
+
+% \subsubsection{The PDF/A Identification schema}
+% \label{sec:pdfa-id}
+%
+% \begin{macro}{\hyxmp@pdfa@id@schema}
+% Add properties defined by the \acro{PDF/A} Identification
+% schema~\cite{PDFA2008:xmp-props} to the |\hyxmp@xml| macro. These
+% properties identify a document as conforming to a particular
+% \acro{PDF/A} standard. Currently, we assume \acro{PDF/A}-1b if any
+% \acro{PDF/A} compliance is detected.
+% \changes{v2.4}{2013/12/21}{Added this macro}
+% \begin{macrocode}
+\newcommand*{\hyxmp@pdfa@id@schema}{%
+ \ifHy@pdfa
+ \hyxmp@add@to@xml{%
+______<rdf:Description rdf:about=""^^J%
+____________xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/">^^J%
+ }%
+ \hyxmp@add@simple{pdfaid:part}{1}%
+ \hyxmp@add@simple{pdfaid:conformance}{B}%
+ \hyxmp@add@to@xml{%
+______</rdf:Description>^^J%
+ }%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
%
-% \subsubsection{Constructing the XMP packet}
+% \subsubsection{Combining schemata into an XMP packet}
+% \label{sec:combining-schemata}
%
% \begin{macro}{\hyxmp@bom}
% Define a macro for the \term{Unicode} byte-order marker (\acro{BOM}).
@@ -2698,6 +2909,7 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns\hyxmp@hash">^^J%
\hyxmp@photoshop@schema
\hyxmp@photometa@schema
\hyxmp@xmp@basic@schema
+ \hyxmp@pdfa@id@schema
\hyxmp@mm@schema
\hyxmp@add@to@xml{%
___</rdf:RDF>^^J%