| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 2011-2023 by Scott Pakin <[email protected]> |
| 4 |
% -------------------------------------------------------------- |
| 5 |
% |
| 6 |
% This file may be distributed and/or modified under the |
| 7 |
% conditions of the LaTeX Project Public License, either version 1.3c |
| 8 |
% of this license or (at your option) any later version. |
| 9 |
% The latest version of this license is in: |
| 10 |
% |
| 11 |
% http://www.latex-project.org/lppl.txt |
| 12 |
% |
| 13 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 14 |
% version 2008/05/04 or later. |
| 15 |
% |
| 16 |
% \fi |
| 17 |
% |
| 18 |
% \iffalse |
| 19 |
%<*driver> |
| 20 |
\ProvidesFile{hyperxmp.dtx} |
| 21 |
%</driver> |
| 22 |
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] |
| 23 |
%<package>\ProvidesPackage{hyperxmp} |
| 24 |
%<*package> |
| 25 |
[2024/03/17 v5.13 Store hyperref metadata in XMP format] |
| 26 |
%</package> |
| 27 |
% |
| 28 |
%<*driver> |
| 29 |
\bgroup |
| 30 |
\catcode`\&=11 |
| 31 |
\gdef\levelchar{&} |
| 32 |
\egroup |
| 33 |
\documentclass{ltxdoc} |
| 34 |
\usepackage[T1]{fontenc} |
| 35 |
\usepackage[english]{babel} |
| 36 |
\usepackage{graphicx} |
| 37 |
\usepackage[cmyk]{xcolor} |
| 38 |
\usepackage{tocbibind} |
| 39 |
\usepackage{microtype} |
| 40 |
\usepackage{needspace} |
| 41 |
\usepackage{varioref} |
| 42 |
\usepackage{fancyvrb} |
| 43 |
\usepackage{multicol} |
| 44 |
\usepackage{makeidx} |
| 45 |
\usepackage{mmap} |
| 46 |
\usepackage{enumitem} |
| 47 |
\usepackage{listings} |
| 48 |
\usepackage[labelformat=simple]{subcaption} |
| 49 |
\renewcommand\thesubfigure{(\alph{subfigure})} |
| 50 |
\usepackage{array} |
| 51 |
\usepackage{booktabs} |
| 52 |
\usepackage{marginfix} |
| 53 |
\usepackage{ifmtarg} |
| 54 |
\usepackage{iftex} |
| 55 |
\input{hyperxmp-stds} |
| 56 |
\expandafter\ifx\csname wantpdfstandards\endcsname\relax |
| 57 |
\usepackage{hyperref} |
| 58 |
\else |
| 59 |
\usepackage[pdfa]{hyperref} |
| 60 |
\fi |
| 61 |
\usepackage{hyperxmp} |
| 62 |
\EnableCrossrefs |
| 63 |
\CodelineIndex |
| 64 |
\RecordChanges |
| 65 |
|
| 66 |
% Specify this document's metadata. |
| 67 |
\GetFileInfo{hyperxmp.dtx} |
| 68 |
\title{The \pkgname{hyperxmp} package\thanks{This document |
| 69 |
corresponds to \pkgname{hyperxmp}~\fileversion, dated \filedate.}} |
| 70 |
\author{Scott Pakin \\ \texttt{[email protected]}} |
| 71 |
\makeatletter |
| 72 |
\edef\versionnumber{\expandafter\@gobble\fileversion} % Drop the "v" in the file version. |
| 73 |
\makeatother |
| 74 |
\hypersetup{% |
| 75 |
pdfauthor={Scott Pakin}, |
| 76 |
pdftitle={The hyperxmp package}, |
| 77 |
pdfsubject={LaTeX2e support for XMP metadata}, |
| 78 |
pdfkeywords={LaTeX, embedded metadata, XMP, PDF, copyright, license, comments}, |
| 79 |
pdfcopyright={Copyright (C) 2011-2023, Scott Pakin}, |
| 80 |
pdflicenseurl={http://www.latex-project.org/lppl/}, |
| 81 |
pdfcaptionwriter={Scott Pakin}, |
| 82 |
pdfcontactemail={[email protected]}, |
| 83 |
pdfcontacturl={http://www.pakin.org/\xmptilde scott/}, |
| 84 |
pdfversionid={\versionnumber}, |
| 85 |
pdflang={en-US}, |
| 86 |
pdftrapped={False}, |
| 87 |
pdfstartpage={}, |
| 88 |
pdfsource={hyperxmp.dtx}, |
| 89 |
pdfurl={http://mirror.ctan.org/macros/latex/contrib/hyperxmp/hyperxmp.pdf}, |
| 90 |
baseurl={http://mirror.ctan.org/macros/latex/contrib/hyperxmp/} |
| 91 |
} |
| 92 |
|
| 93 |
% Specify some additional hyperref configuration. |
| 94 |
\hypersetup{% |
| 95 |
unicode, |
| 96 |
bookmarksopen, |
| 97 |
bookmarksopenlevel=2, |
| 98 |
bookmarksnumbered |
| 99 |
} |
| 100 |
|
| 101 |
% Redefine \changes to properly sort v5.10 *after* v5.9. |
| 102 |
\makeatletter |
| 103 |
\let\orig@changes=\changes |
| 104 |
\def\discard@suffix#1\relax{} |
| 105 |
\def\pad@minor@ver v#1.#2\relax{% |
| 106 |
\afterassignment\discard@suffix |
| 107 |
\@tempcnta=#2\relax |
| 108 |
\edef\new@change@ver{% |
| 109 |
v#1.% |
| 110 |
\ifnum\@tempcnta<10 |
| 111 |
0#2 |
| 112 |
\else |
| 113 |
#2 |
| 114 |
\fi |
| 115 |
}% |
| 116 |
} |
| 117 |
\renewcommand{\changes}[2]{% |
| 118 |
\pad@minor@ver#1\relax |
| 119 |
\orig@changes{\new@change@ver=#1}{#2}% |
| 120 |
} |
| 121 |
\makeatother |
| 122 |
|
| 123 |
\begin{document} |
| 124 |
\DocInput{hyperxmp.dtx} |
| 125 |
\Needspace{10\baselineskip} |
| 126 |
\renewcommand*{\glossaryname}{Change History} |
| 127 |
\PrintChanges |
| 128 |
\Needspace{12\baselineskip} |
| 129 |
\PrintIndex |
| 130 |
\end{document} |
| 131 |
%</driver> |
| 132 |
% \fi |
| 133 |
% |
| 134 |
% \CheckSum{2859} |
| 135 |
% |
| 136 |
% \CharacterTable |
| 137 |
% {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 |
| 138 |
% Lower-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 |
| 139 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 140 |
% Exclamation \! Double quote \" Hash (number) \# |
| 141 |
% Dollar \$ Percent \% Ampersand \& |
| 142 |
% Acute accent \' Left paren \( Right paren \) |
| 143 |
% Asterisk \* Plus \+ Comma \, |
| 144 |
% Minus \- Point \. Solidus \/ |
| 145 |
% Colon \: Semicolon \; Less than \< |
| 146 |
% Equals \= Greater than \> Question mark \? |
| 147 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 148 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 149 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 150 |
% Right brace \} Tilde \~} |
| 151 |
% |
| 152 |
% |
| 153 |
% \changes{v1.0}{2006/05/14}{Initial version} |
| 154 |
% \changes{v2.0}{2012/08/02}{Heiko Oberdiek's major rewrite of the code |
| 155 |
% to better support native-Unicode \string\TeX\ implementations |
| 156 |
% (\string\XeTeX\ and \string\LuaTeX)} |
| 157 |
% \changes{v2.0}{2012/08/26}{Added support for the \protect\acro{XMP} Basic |
| 158 |
% schema and miscellaneous other bits of metadata} |
| 159 |
% \changes{v1.2}{2010/06/04}{Added support for the \protect\XeTeX\ backend |
| 160 |
% (\texttt{xdvipdfmx})} |
| 161 |
% \changes{v1.2}{2010/06/07}{Added support for the Photoshop schema} |
| 162 |
% \changes{v2.2}{2010/12/06}{Added support for the \protect\acro{IPTC} Photo Metadata schema} |
| 163 |
% \changes{v2.4}{2013/12/21}{Added support for the \protect\acro{PDF/A} |
| 164 |
% Identification schema, as requested by Florian Breitwieser} |
| 165 |
% \changes{v2.5}{2014/06/19}{Enabled ``\texttt{\string\string\string\_}'' |
| 166 |
% to work within email addresses, as requested by Leonid Sinev} |
| 167 |
% \changes{v2.6}{2014/09/24}{Added support for a new \protect\optname{pdfdate} |
| 168 |
% key to explicitly specify the document date (and optionally time)} |
| 169 |
% \changes{v2.9}{2016/04/25}{Force inclusion of \protect\xmpprop{dc:creator}, |
| 170 |
% \protect\xmpprop{dc:title}, and \protect\xmpprop{dc:description}---even if |
| 171 |
% empty---when \protect\pkgname{hyperref} is loaded with the |
| 172 |
% \protect\optname{pdfa} option (suggested by Leonid Sinev)} |
| 173 |
% \changes{v2.9}{2016/04/26}{Introduced the \protect\optname{pdftype} |
| 174 |
% package option, which enables an author to specify the type of |
| 175 |
% document being produced} |
| 176 |
% \changes{v3.0}{2016/07/02}{Made the code compatible with \string\LuaTeX~0.85. |
| 177 |
% Thanks to Robert Schlicht, Leonid Sinev, and David Carlisle for bug |
| 178 |
% reports and to Leonid Sinev for helping test the new |
| 179 |
% \protect\pkgname{hyperxmp} code} |
| 180 |
% \changes{v3.4}{2017/11/04}{Use \protect\pkgname{ifmtarg} to test for |
| 181 |
% empty arguments, including non-empty but all spaces} |
| 182 |
% \changes{v4.0}{2019/03/14}{Include all metadata within a single |
| 183 |
% \protect\xmpterm{rdf:Description} block} |
| 184 |
% \changes{v4.1}{2019/04/05}{Updated the documentation to refer to |
| 185 |
% \protect\cs{pdfnumpages} by its correct name. Thanks to Volker RW Schaa |
| 186 |
% for catching the discrepancy} |
| 187 |
% \changes{v5.0}{2020/02/15}{Added support for \protect\acro{PDF/UA} |
| 188 |
% standards, as requested by Robin Schwab} |
| 189 |
% \changes{v5.0}{2020/02/26}{Added support for \protect\acro{PDF/X} |
| 190 |
% standards, as requested by Robin Schwab} |
| 191 |
% \changes{v5.0}{2020/03/17}{Don't set any document dates (creation, |
| 192 |
% modification, or metadata) from \string\optname{pdfdate}} |
| 193 |
% \changes{v5.2}{2020/04/29}{Introduced the \protect\optname{pdfidentifier} |
| 194 |
% package option, which enables an author to specify a unique identifier |
| 195 |
% for the document} |
| 196 |
% \changes{v5.5}{2020/07/23}{Introduced the \protect\optname{pdfpubstatus} |
| 197 |
% package option, which enables an author to specify the document's |
| 198 |
% publication status. Thanks to Robin Schwab for pointing me to the |
| 199 |
% Journal Article Versions recommendation~\protect\cite{NISO2008:jav}} |
| 200 |
% \changes{v5.5}{2020/07/25}{Automatically assign |
| 201 |
% \protect\optname{pdfnumpages} and \protect\optname{pdfbytes} under |
| 202 |
% \protect\pdfLaTeX\ and \protect\LuaLaTeX} |
| 203 |
% \changes{v5.5}{2020/09/23}{Defer \protect\cs{AtEndPreamble} execution |
| 204 |
% until the end of the document. This enables |
| 205 |
% \protect\pkgname{hyperxmp} itself to be loaded from |
| 206 |
% \protect\cs{AtEndPreamble}, as is done by |
| 207 |
% \protect\pkgname{doclicense}~v2.2.0. Thanks to Tommaso Pecorella |
| 208 |
% for the bug report and help testing} |
| 209 |
% |
| 210 |
% ^^A \GetFileInfo{hyperxmp.dtx} |
| 211 |
% |
| 212 |
% \DoNotIndex{\,,\&,\ ,\!,\",\#,\(,\),\*,\<,\>,\\,\^,\~,\^,\_} |
| 213 |
% \DoNotIndex{\@cons,\@empty,\@firstofone,\@firstoftwo,\@gobble,\@gobbletwo} |
| 214 |
% \DoNotIndex{\@ifpackageloaded,\@ifundefined,\@nil,\@secondoftwo} |
| 215 |
% \DoNotIndex{\@tempcnta,\@tempcntb,\MessageBreak,\advance,\afterassignment} |
| 216 |
% \DoNotIndex{\aftergroup,\begin,\begingroup,\bgroup,\catcode,\csname,\def} |
| 217 |
% \DoNotIndex{\divide,\do,\edef,\egroup,\else,\end,\endcsname,\endgroup} |
| 218 |
% \DoNotIndex{\expandafter,\fi,\futurelet,\g@addto@macro,\gdef,\global} |
| 219 |
% \DoNotIndex{\hbox,\if,\ifcase,\ifnum,\ifx,\immediate,\lccode,\let,\loop} |
| 220 |
% \DoNotIndex{\lowercase,\multiply,\newcommand,\noexpand,\or,\relax,\repeat} |
| 221 |
% \DoNotIndex{\space,\string,\the,\toks,\uccode,\uppercase,\usepackage} |
| 222 |
% \DoNotIndex{\xdef} |
| 223 |
% |
| 224 |
% ^^A Define a few logical styles. |
| 225 |
% \DeclareRobustCommand{\term}[1]{#1\SortIndex{#1}{#1}} |
| 226 |
% \DeclareRobustCommand{\pkgname}[1]{^^A |
| 227 |
% \mbox{\textsf{#1}}^^A |
| 228 |
% \SortIndex{#1}{\textsf{#1} (package)}^^A |
| 229 |
% \index{packages=\textsf{#1}}^^A |
| 230 |
% } |
| 231 |
% \DeclareRobustCommand{\clsname}[1]{^^A |
| 232 |
% \mbox{\textsf{#1}}^^A |
| 233 |
% \SortIndex{#1}{\textsf{#1} (class)}^^A |
| 234 |
% \index{classes=\textsf{#1}}^^A |
| 235 |
% } |
| 236 |
% \makeatletter |
| 237 |
% \DeclareRobustCommand{\xmpprop}[2][]{^^A XMP property |
| 238 |
% \def\xmppropopt{#1}^^A |
| 239 |
% \ifx\xmppropopt\@empty |
| 240 |
% \mbox{\textsf{#2}}^^A |
| 241 |
% \else |
| 242 |
% \mbox{\textsf{#2}}.\mbox{\textsf{#1}}^^A |
| 243 |
% \SortIndex{#1}{\textsf{#1}}^^A |
| 244 |
% \fi |
| 245 |
% \SortIndex{#2}{\textsf{#2}}^^A |
| 246 |
% \index{properties, \acrostyle{XMP}=\textsf{#2}}^^A |
| 247 |
% } |
| 248 |
% \DeclareRobustCommand{\xmpterm}[1]{^^A All other XMP terms |
| 249 |
% \mbox{\textsf{#1}}^^A |
| 250 |
% \SortIndex{#1}{\textsf{#1}}^^A |
| 251 |
% } |
| 252 |
% \makeatother |
| 253 |
% \index{XMP=\acrostyle {XMP}&properties|see{properties, \acrostyle{XMP}}} |
| 254 |
% \DeclareRobustCommand{\pdfterm}[1]{^^A |
| 255 |
% \mbox{\textsf{#1}}^^A |
| 256 |
% \SortIndex{#1}{\textsf{#1}}^^A |
| 257 |
% \index{PDF=\acrostyle{PDF}=\textsf{#1}}^^A |
| 258 |
% } |
| 259 |
% \DeclareRobustCommand{\cmdname}[1]{\mbox{\texttt{#1}}\SortIndex{#1}{\texttt{#1}}} |
| 260 |
% \DeclareRobustCommand{\optname}[1]{^^A |
| 261 |
% \mbox{\textsf{#1}}^^A |
| 262 |
% \SortIndex{#1}{\textsf{#1} (option)}^^A |
| 263 |
% \index{options=\textsf{#1}}^^A |
| 264 |
% } |
| 265 |
% ^^A \moptname is the same as \optname but additionally typesets the |
| 266 |
% ^^A option name in the margin. |
| 267 |
% \DeclareRobustCommand{\moptname}[1]{^^A |
| 268 |
% \optname{#1}^^A |
| 269 |
% \marginpar{\raggedleft\strut\mbox{\textsf{#1}}}^^A |
| 270 |
% } |
| 271 |
% \DeclareRobustCommand{\acrostyle}[1]{\textsc{\MakeLowercase{#1}}} |
| 272 |
% \DeclareRobustCommand{\acro}[1]{^^A |
| 273 |
% \mbox{\acrostyle{#1}}^^A |
| 274 |
% \SortIndex{#1}{\acrostyle{#1}}^^A |
| 275 |
% } |
| 276 |
% \newcounter{note} |
| 277 |
% \newcommand{\usagenote}[1]{^^A |
| 278 |
% \refstepcounter{note}^^A |
| 279 |
% \Needspace{\baselineskip}^^A |
| 280 |
% \belowpdfbookmark{Note \thenote: #1}{note.\thenote}^^A |
| 281 |
% \paragraph{Note~\thenote: #1}% |
| 282 |
% } |
| 283 |
% |
| 284 |
% ^^A Define some other shortcut macros. |
| 285 |
% \DeclareRobustCommand{\tex}{^^A |
| 286 |
% \texorpdfstring{\TeX\SortIndex{TeX}{\TeX}}{TeX}^^A |
| 287 |
% } |
| 288 |
% \DeclareRobustCommand{\XeTeXlogo}{^^A |
| 289 |
% X\lower0.5ex\hbox{\kern-.15em\reflectbox{E}}\kern-0.1667em\TeX |
| 290 |
% } |
| 291 |
% \DeclareRobustCommand{\XeTeX}{^^A |
| 292 |
% \texorpdfstring{\XeTeXlogo\SortIndex{XeTeX}{\XeTeXlogo}}{XeTeX}^^A |
| 293 |
% } |
| 294 |
% \DeclareRobustCommand{\XeLaTeXlogo}{^^A |
| 295 |
% X\lower0.5ex\hbox{\kern-.15em\reflectbox{E}}\kern-0.1667em\LaTeX |
| 296 |
% } |
| 297 |
% \DeclareRobustCommand{\XeLaTeX}{^^A |
| 298 |
% \texorpdfstring{\XeLaTeXlogo\SortIndex{XeLaTeX}{\XeLaTeXlogo}}{XeLaTeX}^^A |
| 299 |
% } |
| 300 |
% \DeclareRobustCommand{\LuaTeXlogo}{Lua\TeX} |
| 301 |
% \DeclareRobustCommand{\LuaTeX}{^^A |
| 302 |
% \texorpdfstring{\LuaTeXlogo\SortIndex{LuaTeX}{\LuaTeXlogo}}{LuaTeX}^^A |
| 303 |
% } |
| 304 |
% \DeclareRobustCommand{\LuaLaTeXlogo}{Lua\LaTeX} |
| 305 |
% \DeclareRobustCommand{\LuaLaTeX}{^^A |
| 306 |
% \texorpdfstring{\LuaLaTeXlogo\SortIndex{LuaLaTeX}{\LuaLaTeXlogo}}{LuaLaTeX}^^A |
| 307 |
% } |
| 308 |
% \DeclareRobustCommand{\pdfTeXlogo}{pdf\TeX} |
| 309 |
% \DeclareRobustCommand{\pdfTeX}{^^A |
| 310 |
% \texorpdfstring{\pdfTeXlogo\SortIndex{pdfTeX}{\pdfTeXlogo}}{pdfTeX}^^A |
| 311 |
% } |
| 312 |
% \DeclareRobustCommand{\pdfLaTeXlogo}{pdf\LaTeX} |
| 313 |
% \DeclareRobustCommand{\pdfLaTeX}{^^A |
| 314 |
% \texorpdfstring{\pdfLaTeXlogo\SortIndex{pdfLaTeX}{\pdfLaTeXlogo}}{pdfLaTeX}^^A |
| 315 |
% } |
| 316 |
% \DeclareRobustCommand{\Dvips}{^^A |
| 317 |
% \texorpdfstring{Dvips\SortIndex{dvips}{\texttt{dvips}}}{Dvips}^^A |
| 318 |
% } |
| 319 |
% \DeclareRobustCommand{\progname}[1]{^^A |
| 320 |
% \mbox{\texttt{#1}}\SortIndex{#1}{\texttt{#1}}^^A |
| 321 |
% } |
| 322 |
% \DeclareRobustCommand{\Lua}{^^A |
| 323 |
% Lua\index{Lua}^^A |
| 324 |
% } |
| 325 |
% \DeclareRobustCommand{\Koma}{^^A |
| 326 |
% Koma^^A |
| 327 |
% \SortIndex{Koma}{Koma (class)}^^A |
| 328 |
% \index{classes&Koma}^^A |
| 329 |
% } |
| 330 |
% \DeclareRobustCommand{\ACMclass}{^^A |
| 331 |
% \acro{ACM}^^A |
| 332 |
% \index{classes&ACM=\acrostyle{ACM}}^^A |
| 333 |
% } |
| 334 |
% |
| 335 |
% ^^A Define an environment just like macro but for Lua functions. |
| 336 |
% \makeatletter |
| 337 |
% \newenvironment{luafunc}{^^A |
| 338 |
% \begingroup |
| 339 |
% \catcode`\_=11 |
| 340 |
% \def\PrintMacroName##1{\strut\MacroFont\string##1\ }^^A |
| 341 |
% \def\SpecialIndex@##1##2{^^A |
| 342 |
% \@bsphack |
| 343 |
% \special@index{\string##1\actualchar |
| 344 |
% \string\verb\quotechar*\verbatimchar##1\verbatimchar##2}^^A |
| 345 |
% \@esphack |
| 346 |
% }^^A |
| 347 |
% \begin{macro}^^A |
| 348 |
% }{^^A |
| 349 |
% \end{macro}^^A |
| 350 |
% \endgroup |
| 351 |
% } |
| 352 |
% \makeatother |
| 353 |
% |
| 354 |
% ^^A Typeset a PDF standard name, indexing only the standard type but |
| 355 |
% ^^A not the subtype or year. |
| 356 |
% \makeatletter |
| 357 |
% \newcommand*{\PDFstd}[4]{^^A |
| 358 |
% \mbox{^^A |
| 359 |
% \acro{PDF/#1}-\oldstylenums{#2}^^A |
| 360 |
% #3^^A |
| 361 |
% \@ifnotmtarg{#4}{:\oldstylenums{#4}}^^A |
| 362 |
% }^^A |
| 363 |
% } |
| 364 |
% \makeatother |
| 365 |
% |
| 366 |
% ^^A Index schemata. |
| 367 |
% \DeleteShortVerb{\|} |
| 368 |
% \makeatletter |
| 369 |
% \newenvironment{schemadesc}[2][]{^^A |
| 370 |
% \@ifmtarg{#1}{^^A |
| 371 |
% \index{#2 schema|(}^^A |
| 372 |
% \index{schemata|(}^^A |
| 373 |
% \def\closeschemedesc{^^A |
| 374 |
% \index{schemata|)}^^A |
| 375 |
% \index{#2 schema|)}^^A |
| 376 |
% }^^A |
| 377 |
% }{^^A |
| 378 |
% \index{#1 schema=#2 schema|(}^^A |
| 379 |
% \index{schemata=#2|(}^^A |
| 380 |
% \def\closeschemedesc{^^A |
| 381 |
% \index{schemata=#2|)}^^A |
| 382 |
% \index{#1 schema=#2 schema|)}^^A |
| 383 |
% }^^A |
| 384 |
% }^^A |
| 385 |
% }{^^A |
| 386 |
% \closeschemedesc |
| 387 |
% } |
| 388 |
% \newcommand{\schema}[2][]{^^A |
| 389 |
% \@ifmtarg{#1}{^^A |
| 390 |
% \kern0pt^^A |
| 391 |
% \index{#2 schema}^^A |
| 392 |
% \index{schemata}^^A |
| 393 |
% #2^^A |
| 394 |
% }{^^A |
| 395 |
% \kern0pt^^A |
| 396 |
% \index{#1 schema=#2 schema}^^A |
| 397 |
% \index{schemata=#2}^^A |
| 398 |
% #2^^A |
| 399 |
% }^^A |
| 400 |
% } |
| 401 |
% \makeatother |
| 402 |
% \MakeShortVerb{\|} |
| 403 |
% |
| 404 |
% ^^A Pack figures a bit tighter onto the page. |
| 405 |
% \renewcommand{\floatpagefraction}{0.8} |
| 406 |
% |
| 407 |
% ^^A Help \pageref refer to arbitrary content. |
| 408 |
% \newcounter{pagelabel} |
| 409 |
% |
| 410 |
% \maketitle |
| 411 |
% \sloppy |
| 412 |
% |
| 413 |
% \begin{abstract} |
| 414 |
% \pkgname{hyperxmp} makes it easy for an author to include \acro{XMP} |
| 415 |
% metadata in a \acro{PDF} document produced by \LaTeX\@. \pkgname{hyperxmp} |
| 416 |
% integrates seamlessly with \pkgname{hyperref} and requires virtually |
| 417 |
% no modifications to a document that already specifies document |
| 418 |
% metadata through \pkgname{hyperref}'s mechanisms. |
| 419 |
% \end{abstract} |
| 420 |
% |
| 421 |
% \section{Introduction} |
| 422 |
% |
| 423 |
% Adobe Systems, Inc.\ has been promoting |
| 424 |
% \acro{XMP}~\cite{Adobe2012:XMP}---eXtensible Metadata Platform---as a |
| 425 |
% standard way to include metadata within a document. The idea behind |
| 426 |
% \acro{XMP} is that it is an \acro{XML}-based description of various |
| 427 |
% document attributes and is embedded as uncompressed, unencoded text |
| 428 |
% within the document it describes. By storing the metadata this way it |
| 429 |
% is independent of the document's file format. That is, regardless of |
| 430 |
% whether a document is in \acro{PDF}, \acrostyle{JPEG}, |
| 431 |
% \acrostyle{HTML}, or any other format, it is trivial for a program (or |
| 432 |
% human) to locate, extract, and---using any standard \acro{XML} |
| 433 |
% parser---process the embedded \acro{XMP} metadata. |
| 434 |
% |
| 435 |
% As of this writing there are few tools that actually do process |
| 436 |
% \acro{XMP}\@. However, it is easy to imagine future support existing |
| 437 |
% in file browsers for displaying not only a document's filename but |
| 438 |
% also its title, list of authors, description, and other metadata. |
| 439 |
% |
| 440 |
% \paragraph{This is too abstract! Give me an example.} |
| 441 |
% Consider a \LaTeX\ document with three authors---Jack Napier, Edward |
| 442 |
% Nigma, and Harvey Dent---named in the \LaTeX\ source in the usual way: |
| 443 |
% ``\verb|\author{|\texttt{Jack Napier \cs{and} Edward Nigma \cs{and} |
| 444 |
% Harvey Dent}\verb|}|''. With \pkgname{hyperxmp}, the generated |
| 445 |
% \acro{PDF} file will contain, among other information, the following |
| 446 |
% stanza of \acro{XMP} code embedded within it: |
| 447 |
% |
| 448 |
% \begin{verbatim} |
| 449 |
% <dc:creator> |
| 450 |
% <rdf:Seq> |
| 451 |
% <rdf:li>Jack Napier</rdf:li> |
| 452 |
% <rdf:li>Edward Nigma</rdf:li> |
| 453 |
% <rdf:li>Harvey Dent</rdf:li> |
| 454 |
% </rdf:Seq> |
| 455 |
% </dc:creator> |
| 456 |
% \end{verbatim} |
| 457 |
% |
| 458 |
% In the preceding code, the |dc| namespace refers to the |
| 459 |
% \href{http://purl.org/DC/}{\schema{Dublin Core} schema}, a collection |
| 460 |
% of metadata properties. The \xmpprop{dc:creator} property surrounds |
| 461 |
% the list of authors. The \textsf{rdf} namespace is the |
| 462 |
% \href{http://www.w3.org/RDF/}{Resource Description Framework}, which |
| 463 |
% defines \xmpterm{rdf:Seq} as an ordered list of values. Each author |
| 464 |
% is represented by an individual list item (\xmpterm{rdf:li}), making |
| 465 |
% it easy for an \acro{XML} parser to separate the authors' names. |
| 466 |
% |
| 467 |
% Remember that \acro{XMP} code is stored as \emph{metadata}. It does |
| 468 |
% not appear when viewing or printing the \acro{PDF} file. Rather, it |
| 469 |
% is intended to make it easy for computer applications to identify and |
| 470 |
% categorize the document. |
| 471 |
% |
| 472 |
% \subsection{Supported metadata} |
| 473 |
% |
| 474 |
% \pkgname{hyperxmp} knows how to embed all of the following types of |
| 475 |
% metadata within a document: |
| 476 |
% |
| 477 |
% \label{page:begin-metadata-list} |
| 478 |
% \begin{itemize} \raggedright |
| 479 |
% \item address of primary author |
| 480 |
% (\xmpprop[CiAdrExtadr]{Iptc4xmpCore:CreatorContactInfo}, |
| 481 |
% \xmpprop[CiAdrCity]{Iptc4xmpCore:CreatorContactInfo}, |
| 482 |
% \xmpprop[CiAdrRegion]{Iptc4xmpCore:CreatorContactInfo}, |
| 483 |
% \xmpprop[CiAdrPcode]{Iptc4xmpCore:CreatorContactInfo}, and |
| 484 |
% \xmpprop[CiAdrCtry]{Iptc4xmpCore:CreatorContactInfo}) |
| 485 |
% \item author(s) (\xmpprop{dc:creator}) |
| 486 |
% \item base \acro{URL} for relative references (\xmpprop{xmp:BaseURL}) |
| 487 |
% \item book edition (\xmpprop{prism:bookEdition}) |
| 488 |
% \item copyright (\xmpprop{dc:rights} and \xmpprop{xmpRights:Marked}) |
| 489 |
% \item date (\xmpprop{dc:date}, \xmpprop{xmp:CreateDate}, |
| 490 |
% \xmpprop{xmp:ModifyDate}, and \xmpprop{xmp:MetadataDate}) |
| 491 |
% \item \acro{DOI} (\xmpprop{prism:doi}) |
| 492 |
% \item email address(es) of primary author (\xmpprop[CiEmailWork]{Iptc4xmpCore:CreatorContactInfo}) |
| 493 |
% \item file format (\xmpprop{dc:format}) |
| 494 |
% \item file name of main \LaTeX\ source file (\xmpprop{dc:source}) |
| 495 |
% \item file size in bytes (\xmpprop{prism:byteCount}) |
| 496 |
% \item \acro{ISBN} (\xmpprop{prism:isbn}) |
| 497 |
% \item \acro{ISSN}---both print (\xmpprop{prism:issn}) and electronic (\xmpprop{prism:eIssn}) |
| 498 |
% \item issue number of parent publication (\xmpprop{prism:number}) |
| 499 |
% \item journal article version (\xmpprop{jav:journal\_article\_version}) |
| 500 |
% \item keywords (\xmpprop{pdf:Keywords} and \xmpprop{dc:subject}) |
| 501 |
% \item language used (\xmpprop{dc:language}) |
| 502 |
% \item license \acro{URL} (\xmpprop{xmpRights:WebStatement}) |
| 503 |
% \item metadata writer (\xmpprop{photoshop:CaptionWriter}) |
| 504 |
% \item page count (\xmpprop{prism:pageCount}) |
| 505 |
% \item page range(s) (\xmpprop{prism:pageRange}) |
| 506 |
% \item \acro{PDF} version (\xmpprop{pdf:PDFVersion}) |
| 507 |
% \item \acro{PDF}-generating tool (\xmpprop{pdf:Producer} and \xmpprop{xmp:CreatorTool}) |
| 508 |
% \item \acro{PDF/A} version and conformance level (\xmpprop{pdfaid:part} and \xmpprop{pdfaid:conformance}) |
| 509 |
% \item \acro{PDF/UA} version (\xmpprop{pdfuaid:part}) |
| 510 |
% \item \acro{PDF/X} standard compliance (\xmpprop{pdfxid:GTS\_PDFXVersion}) |
| 511 |
% \item position/title of primary author (\xmpprop{photoshop:AuthorsPosition}) |
| 512 |
% \item publication name of parent publication (\xmpprop{prism:publicationName}) |
| 513 |
% \item publisher of the document (\xmpprop{dc:publisher}) |
| 514 |
% \item rendition variation of the document (\xmpprop{xmpMM:RenditionClass}) |
| 515 |
% \item summary (\xmpprop{dc:description}) |
| 516 |
% \item subtitle (\xmpprop{prism:subtitle}) |
| 517 |
% \item telephone number(s) of primary author (\xmpprop[CiTelWork]{Iptc4xmpCore:CreatorContactInfo}) |
| 518 |
% \item title (\xmpprop{dc:title}) |
| 519 |
% \item trapping of colors (\xmpprop{pdf:trapped}) |
| 520 |
% \item type of document (\xmpprop{dc:type}) |
| 521 |
% \item type of parent publication (\xmpprop{prism:aggregationType}) |
| 522 |
% \item unique identifier for the document (\xmpprop{dc:identifier}) |
| 523 |
% \item \acro{URL} of the document (\xmpprop{prism:url}) |
| 524 |
% \item \acro{URL}(s) of the primary author (\xmpprop[CiUrlWork]{Iptc4xmpCore:CreatorContactInfo}) |
| 525 |
% \item \acro{UUID} for the document (\xmpprop{xmpMM:DocumentID}) |
| 526 |
% \item \acro{UUID} for the document instance (\xmpprop{xmpMM:InstanceID}) |
| 527 |
% \item version identifier for the document (\xmpprop{xmpMM:VersionID}) |
| 528 |
% \item volume number of parent publication (\xmpprop{prism:volume}) |
| 529 |
% \end{itemize} |
| 530 |
% \label{page:end-metadata-list} |
| 531 |
% |
| 532 |
% \noindent |
| 533 |
% More types of metadata may be added in a future release. |
| 534 |
% |
| 535 |
% \subsection{Comparisons with similar packages} |
| 536 |
% |
| 537 |
% \paragraph{\textsf{xmpincl}} |
| 538 |
% In short, \pkgname{xmpincl} is more flexible but \pkgname{hyperxmp} is |
| 539 |
% easier to use. With \pkgname{xmpincl}, the author manually constructs |
| 540 |
% a file of arbitrary \acro{XMP} data and the package merely embeds it |
| 541 |
% within the generated \acro{PDF} file. With \pkgname{hyperxmp}, the |
| 542 |
% author specifies values for various predefined metadata types and the |
| 543 |
% package formats those values as \acro{XMP} and embeds the result |
| 544 |
% within the generated \acro{PDF} file. |
| 545 |
% |
| 546 |
% \pkgname{xmpincl} can embed \acro{XMP} only when running under \pdfLaTeX\ and |
| 547 |
% only when in \acro{PDF}-generating mode. \pkgname{hyperxmp} additionally |
| 548 |
% works with a few other \acro{PDF}-producing \LaTeX\ backends. |
| 549 |
% |
| 550 |
% \pkgname{hyperxmp} and \pkgname{xmpincl} can complement each other. |
| 551 |
% An author may want to use \pkgname{hyperxmp} to produce a basic set of |
| 552 |
% \acro{XMP} code, then extract the \acro{XMP} code from the \acro{PDF} file with a text |
| 553 |
% editor, augment the \acro{XMP} code with any metadata not supported by |
| 554 |
% \pkgname{hyperxmp}, and use \pkgname{xmpincl} to include the modified |
| 555 |
% \acro{XMP} code in the \acro{PDF} file. |
| 556 |
% |
| 557 |
% \paragraph{\textsf{pdfx}} |
| 558 |
% The main difference between \pkgname{hyperxmp} and \pkgname{pdfx} is |
| 559 |
% that \pkgname{hyperxmp} tries to integrate as seamlessly as possible |
| 560 |
% into an existing document. It leverages \pkgname{hyperref}'s |
| 561 |
% \cs{hypersetup} command and many of \cs{hypersetup}'s options and |
| 562 |
% defines its own options in a compatible manner. In contrast, |
| 563 |
% \pkgname{pdfx} requires the user to create a separate |
| 564 |
% |\jobname.xmpdata| file containing \pkgname{pdfx}-defined commands for |
| 565 |
% each metadata element. |
| 566 |
% |
| 567 |
% \iffalse |
| 568 |
%<*listings> |
| 569 |
% \fi |
| 570 |
\newsavebox{\pdfxbox} |
| 571 |
\begin{lrbox}{\pdfxbox} |
| 572 |
\begin{lstlisting}[ |
| 573 |
language=tex, |
| 574 |
columns=fullflexible, |
| 575 |
linewidth=14pc, |
| 576 |
frame=single, |
| 577 |
basicstyle=\footnotesize, |
| 578 |
showlines, |
| 579 |
morekeywords={\Title,\Author,\Language,\Keywords,\Publisher,\sep} |
| 580 |
] |
| 581 |
|
| 582 |
\Title{Baking through the ages} |
| 583 |
\Author{A. Baker\sep C. Kneader} |
| 584 |
\Language{en-GB} |
| 585 |
\Keywords{cookies\sep muffins\sep cakes} |
| 586 |
\Publisher{Baking International} |
| 587 |
|
| 588 |
\end{lstlisting} |
| 589 |
\end{lrbox} |
| 590 |
|
| 591 |
\newsavebox{\hyxmpbox} |
| 592 |
\begin{lrbox}{\hyxmpbox} |
| 593 |
\begin{lstlisting}[ |
| 594 |
language=tex, |
| 595 |
columns=fullflexible, |
| 596 |
linewidth=13pc, |
| 597 |
frame=single, |
| 598 |
basicstyle=\footnotesize, |
| 599 |
morekeywords={\hypersetup} |
| 600 |
] |
| 601 |
\hypersetup{% |
| 602 |
pdftitle={Baking through the ages}, |
| 603 |
pdfauthor={A. Baker, C. Kneader}, |
| 604 |
pdflang={en-GB}, |
| 605 |
pdfkeywords={cookies, muffins, cakes}, |
| 606 |
pdfpublisher={Baking International} |
| 607 |
} |
| 608 |
\end{lstlisting} |
| 609 |
\end{lrbox} |
| 610 |
% \iffalse |
| 611 |
%</listings> |
| 612 |
% \fi |
| 613 |
% |
| 614 |
% Figure~\ref{fig:pdfx-hyxmp} adapts an example appearing in the |
| 615 |
% \pkgname{pdfx} manual to \pkgname{hyperxmp}. |
| 616 |
% \begin{figure} |
| 617 |
% \centering |
| 618 |
% \subcaptionbox{\pkgname{pdfx} (separate \texttt{.xmpdata} file) |
| 619 |
% \label{fig:ph-pdfx}}{% |
| 620 |
% \usebox{\pdfxbox}% |
| 621 |
% } |
| 622 |
% \hfil |
| 623 |
% \subcaptionbox{\pkgname{hyperxmp} (main document) |
| 624 |
% \label{fig:ph-hyxmp}}{% |
| 625 |
% \usebox{\hyxmpbox}} |
| 626 |
% \caption{Comparison of \pkgname{pdfx} and \pkgname{hyperxmp}} |
| 627 |
% \label{fig:pdfx-hyxmp} |
| 628 |
% \end{figure} |
| 629 |
% The two are comparable line-by-line in terms of how one specifies the |
| 630 |
% title, author, document language, keywords, and publisher. However, |
| 631 |
% \pkgname{hyperxmp} implicitly writes a wealth of additional metadata |
| 632 |
% into the \acro{XMP} packet such as the document date, creation date, |
| 633 |
% creator tool, file format, \acro{PDF} version, and unique document and |
| 634 |
% instance IDs. In fact, if a document omits all of the code shown in |
| 635 |
% Figure~\ref{fig:ph-hyxmp}, it will still store the \cs{title} and |
| 636 |
% \cs{author} data in the \acro{XMP} packet. |
| 637 |
% |
| 638 |
% One can therefore summarize the difference between \pkgname{hyperxmp} |
| 639 |
% and \pkgname{pdfx} as follows: \pkgname{pdfx} requires the author to |
| 640 |
% be fully explicit about the document's metadata while |
| 641 |
% \pkgname{hyperxmp} allows some metadata to be specified implicitly, |
| 642 |
% automatically inferring it when possible. In general, |
| 643 |
% \pkgname{hyperxmp} tries to simplify the author's task as much as |
| 644 |
% possible. |
| 645 |
% |
| 646 |
% |
| 647 |
% \section{Usage} |
| 648 |
% |
| 649 |
% \pkgname{hyperxmp} works by postprocessing some of the package options |
| 650 |
% honored by \pkgname{hyperref}. To use \pkgname{hyperxmp}, merely put |
| 651 |
% a |\usepackage{hyperxmp}| in your document's preamble. That line can |
| 652 |
% appear anywhere \emph{after} the |\usepackage{hyperref}| but |
| 653 |
% \emph{before} \pkgname{hyperref}'s \acro{PDF} options are specified |
| 654 |
% with |\hypersetup|. \pkgname{hyperxmp} will construct its \acro{XMP} |
| 655 |
% data using the following \pkgname{hyperref} options: |
| 656 |
% |
| 657 |
% \begin{multicols}{3} |
| 658 |
% \raggedcolumns |
| 659 |
% \begin{itemize} |
| 660 |
% \item \optname{baseurl} |
| 661 |
% \item \optname{pdfauthor} |
| 662 |
% \item \optname{pdfcreationdate} |
| 663 |
% \item \optname{pdfkeywords} |
| 664 |
% \item \optname{pdflang} |
| 665 |
% \item \optname{pdfmoddate} |
| 666 |
% \item \optname{pdfproducer} |
| 667 |
% \item \optname{pdfsubject} |
| 668 |
% \item \optname{pdftitle} |
| 669 |
% \item \optname{pdftrapped} |
| 670 |
% \end{itemize} |
| 671 |
% \end{multicols} |
| 672 |
% |
| 673 |
% \noindent |
| 674 |
% \mbox{}\label{page:begin-new-options} |
| 675 |
% \pkgname{hyperxmp} instructs \pkgname{hyperref} also to accept the |
| 676 |
% following options, which have meaning only to \pkgname{hyperxmp}: |
| 677 |
% |
| 678 |
% \begin{multicols}{3} |
| 679 |
% \raggedcolumns |
| 680 |
% \begin{itemize} |
| 681 |
% \item \optname{pdfaconformance} |
| 682 |
% \item \optname{pdfapart} |
| 683 |
% \item \optname{pdfauthortitle} |
| 684 |
% \item \optname{pdfbookedition} |
| 685 |
% \item \optname{pdfbytes} |
| 686 |
% \item \optname{pdfcaptionwriter} |
| 687 |
% \item \optname{pdfcontactaddress} |
| 688 |
% \item \optname{pdfcontactcity} |
| 689 |
% \item \optname{pdfcontactcountry} |
| 690 |
% \item \optname{pdfcontactemail} |
| 691 |
% \item \optname{pdfcontactphone} |
| 692 |
% \item \optname{pdfcontactpostcode} |
| 693 |
% \item \optname{pdfcontactregion} |
| 694 |
% \item \optname{pdfcontacturl} |
| 695 |
% \item \optname{pdfcopyright} |
| 696 |
% \item \optname{pdfdate} |
| 697 |
% \item \optname{pdfdocumentid} |
| 698 |
% \item \optname{pdfdoi} |
| 699 |
% \item \optname{pdfeissn} |
| 700 |
% \item \optname{pdfidentifier} |
| 701 |
% \item \optname{pdfinstanceid} |
| 702 |
% \item \optname{pdfisbn} |
| 703 |
% \item \optname{pdfissn} |
| 704 |
% \item \optname{pdfissuenum} |
| 705 |
% \item \optname{pdflicenseurl} |
| 706 |
% \item \optname{pdfmetadate} |
| 707 |
% \item \optname{pdfmetalang} |
| 708 |
% \item \optname{pdfnumpages} |
| 709 |
% \item \optname{pdfpagerange} |
| 710 |
% \item \optname{pdfpublication} |
| 711 |
% \item \optname{pdfpublisher} |
| 712 |
% \item \optname{pdfpubstatus} |
| 713 |
% \item \optname{pdfpubtype} |
| 714 |
% \item \optname{pdfrendition} |
| 715 |
% \item \optname{pdfsource} |
| 716 |
% \item \optname{pdfsubtitle} |
| 717 |
% \item \optname{pdftype} |
| 718 |
% \item \optname{pdfuapart} |
| 719 |
% \item \optname{pdfurl} |
| 720 |
% \item \optname{pdfversionid} |
| 721 |
% \item \optname{pdfvolumenum} |
| 722 |
% \item \optname{pdfxstandard} |
| 723 |
% \end{itemize} |
| 724 |
% \end{multicols} |
| 725 |
% \label{page:end-new-options} |
| 726 |
% |
| 727 |
% |
| 728 |
% \subsection{Option descriptions} |
| 729 |
% |
| 730 |
% The document title is specified as normal for \pkgname{hyperref} with |
| 731 |
% \moptname{pdftitle}, but see Note~\ref{note:multilingual} on |
| 732 |
% page~\pageref{note:multilingual} for instructions on how to specify a |
| 733 |
% title in multiple languages. If \optname{pdftitle} is not specified |
| 734 |
% it will inherit its value from the document's \cs{title}. |
| 735 |
% \pkgname{hyperxmp} introduces a complementary \moptname{pdfsubtitle} |
| 736 |
% option: |
| 737 |
% |
| 738 |
% \begin{verbatim} |
| 739 |
% pdftitle={Frankenstein}, |
| 740 |
% pdfsubtitle={The Modern Prometheus}, |
| 741 |
% \end{verbatim} |
| 742 |
% |
| 743 |
% Unfortunately, the subtitle can appear in only one language. It |
| 744 |
% assumed to be the same language as the document language |
| 745 |
% (\optname{pdflang}) but can be overridden by preceding the text with a |
| 746 |
% bracketed \acro{ISO} \mbox{639-1} two-letter language code and an |
| 747 |
% optional \acro{ISO} \mbox{3166-1} two-letter region code. See the |
| 748 |
% example below for \optname{pdfpublication}. |
| 749 |
% |
| 750 |
% \pkgname{hyperref}'s \moptname{pdfauthor} option specifies the |
| 751 |
% document's author(s). See Note~\ref{note:literal-commas} on |
| 752 |
% page~\pageref{note:literal-commas} for a discussion of the correct |
| 753 |
% syntax. If \optname{pdfauthor} is not specified it will inherit its |
| 754 |
% value from the document's \cs{author}. \moptname{pdfauthortitle} |
| 755 |
% indicates the primary author's position or title. |
| 756 |
% \moptname{pdfcaptionwriter} specifies the name of the person who added |
| 757 |
% the metadata to the document. |
| 758 |
% |
| 759 |
% The next eight items describe how to contact the person or institution |
| 760 |
% responsible for the document (the ``contact''). |
| 761 |
% \moptname{pdfcontactaddress} is the contact's street address and can |
| 762 |
% include the institution name if the contact is an institution; |
| 763 |
% \moptname{pdfcontactcity} is the contact's city; |
| 764 |
% \moptname{pdfcontactcountry} is the contact's country; |
| 765 |
% \moptname{pdfcontactemail} is the contact's email address (or |
| 766 |
% multiple, comma-separated email addresses); \moptname{pdfcontactphone} |
| 767 |
% is the contact's telephone number (or multiple, comma-separated |
| 768 |
% telephone numbers); \moptname{pdfcontactpostcode} is the contact's |
| 769 |
% postal code; \moptname{pdfcontactregion} is the contact's state or |
| 770 |
% province; and \moptname{pdfcontacturl} is the contact's \acro{URL} (or |
| 771 |
% multiple, comma-separated \acro{URL}s). |
| 772 |
% |
| 773 |
% \Needspace{2\baselineskip} |
| 774 |
% \moptname{pdfcopyright} defines the copyright text, and |
| 775 |
% \moptname{pdflicenseurl} identifies a \acro{URL} that points to the |
| 776 |
% document's license agreement. |
| 777 |
% |
| 778 |
% \moptname{pdfmetalang} indicates the natural language in which certain |
| 779 |
% metadata---specifically, the document's title, subject, and copyright |
| 780 |
% statement---are written. The language should be specified using an |
| 781 |
% \acro{IETF} language tag~\cite{IANA2011:lang-tags}, for example, |
| 782 |
% ``|en|'' for English, ``|en-US|'' for specifically United States |
| 783 |
% English, ``|de|'' for German, and so forth. If \optname{pdfmetalang} |
| 784 |
% is not specified, \pkgname{hyperxmp} assumes the metadata language is |
| 785 |
% the same as the document language (\pkgname{hyperref}'s |
| 786 |
% \moptname{pdflang} option). If neither \optname{pdfmetalang} nor |
| 787 |
% \optname{pdflang} is specified, \pkgname{hyperxmp} uses only |
| 788 |
% ``\xmpterm{x-default}'' as the metadata language. |
| 789 |
% |
| 790 |
% \acro{XMP} can include a universally unique identifier (\acro{UUID}) |
| 791 |
% for each document and for each instance of a given document. By |
| 792 |
% default, \pkgname{hyperxmp} assigns a version~4 (i.e.,~pseudorandom) |
| 793 |
% \acro{UUID}~\cite{Leach2005:uuid} for each of these. However, a |
| 794 |
% document can alternatively specify a particular document identifier |
| 795 |
% using \moptname{pdfdocumentid} and (not normally recommended) a |
| 796 |
% particular instance identifier using \moptname{pdfinstanceid}. These |
| 797 |
% should be of the form |
| 798 |
% \texttt{uuid:}\textit{xxxxxxxx}\texttt{-}\textit{xxxx}\texttt{-}\textit{xxxx}\texttt{-}\textit{xxxx}\texttt{-}\textit{xxxxxxxxxxxx}, |
| 799 |
% where ``\textit{x}'' is a lowercase hexadecimal number. For example, |
| 800 |
% \texttt{uuid:53ab7f19-a48c-5177-8bb2-403ad907f632} is a valid argument |
| 801 |
% to \optname{pdfdocumentid} (or \optname{pdfinstanceid}). See Leach, |
| 802 |
% Mealling, and Salz's \acro{UUID} specification document for details on |
| 803 |
% how to produce the various forms of |
| 804 |
% \acro{UUID}s~\cite{Leach2005:uuid}. A more freeform mechanism than |
| 805 |
% \optname{pdfinstanceid} for versioning documents is available via |
| 806 |
% \moptname{pdfversionid}. The version specified by |
| 807 |
% \optname{pdfversionid} can be incremented as~|1|, |2|, |3|,~\dots; |
| 808 |
% identified with a hierarchical numbering scheme (e.g.,~this document |
| 809 |
% is versioned \texttt{\versionnumber} to match the package version); or |
| 810 |
% labeled using any other approach. One possibility is to use a |
| 811 |
% revision number or commit hash from the version-control software |
| 812 |
% maintaining the document. For example, the |\gitVer| macro from the |
| 813 |
% \pkgname{gitver} package is an expandable (see |
| 814 |
% Note~\ref{note:expandable} on page~\pageref{note:expandable}) version |
| 815 |
% of the current \href{https://git-scm.com/}{Git} hash that can suitably |
| 816 |
% be passed to \optname{pdfversionid}. If not specified, |
| 817 |
% \optname{pdfversionid} defaults to~|1|. |
| 818 |
% |
| 819 |
% Already-published documents can be identified in a number of ways. |
| 820 |
% \moptname{pdfisbn} specifies the \acro{ISBN}. \moptname{pdfissn} |
| 821 |
% refers to the \acro{ISSN} of the \emph{print} version of the document |
| 822 |
% while \moptname{pdfeissn} refers to the \acro{ISSN} of the |
| 823 |
% \emph{electronic} version of the document. \moptname{pdfdoi} |
| 824 |
% specifies the \acro{DOI} and should include only the \acro{DOI} name |
| 825 |
% without any \acro{URL} prefix. For example, specify |
| 826 |
% |pdfdoi={10.1145/3149526.3149532}|, \emph{not} |
| 827 |
% |pdfdoi={https://doi.org/10.1145/3149526.3149532}|. |
| 828 |
% \moptname{pdfurl} points to the complete \acro{URL} for the document. |
| 829 |
% In contrast, \moptname{baseurl} points one level up and is used to |
| 830 |
% resolve relative \acro{URL}s. |
| 831 |
% |
| 832 |
% \moptname{pdfidentifier} provides an alternative mechanism to uniquely |
| 833 |
% identify a document. Its advantage relative to \optname{pdfisbn}, |
| 834 |
% \optname{pdfissn}, \optname{pdfdoi}, etc.\ is its flexibility; any of |
| 835 |
% a wide variety of identification types can be used.\footnote{See, for |
| 836 |
% example, |
| 837 |
% \url{https://www.iana.org/assignments/urn-namespaces/urn-namespaces.xhtml} |
| 838 |
% for the \texttt{urn:} \acro{URI} scheme and |
| 839 |
% \url{http://info-uri.info/registry/} for the \texttt{info:} |
| 840 |
% \acro{URI} scheme.} \optname{pdfidentifier}'s disadvantage is that |
| 841 |
% it allows only a single identifier per document. For example, a |
| 842 |
% document could use |pdfidentifier=urn:iso:std:32000:ed-1:v1:en| to |
| 843 |
% identify itself as version~1 of English-language \acro{ISO} standard |
| 844 |
% 32000-1, but then this same document could not also use |
| 845 |
% \optname{pdfidentifier} to identify itself by \acro{DOI} |
| 846 |
% (|info:doi/|\dots), \acro{ISBN} (|urn:ISSN:|\dots), etc. (It can |
| 847 |
% still use the options described in the previous paragraph, though.) If |
| 848 |
% \optname{pdfidentifier} is not specified explicitly, |
| 849 |
% \pkgname{hyperxmp} will use the first non-empty value out of the |
| 850 |
% \acro{DOI}, electronic \acro{ISSN}, print \acro{ISSN}, and \acro{ISBN} |
| 851 |
% or skip the identifier entirely if all of those are empty. |
| 852 |
% |
| 853 |
% Already-published documents can further be identified by the |
| 854 |
% publication in which they appear. \moptname{pdfpublication} specifies |
| 855 |
% the title of the journal, magazine, or other parent document. The |
| 856 |
% title language is assumed to be the same as the document language |
| 857 |
% (\optname{pdflang}) but can be overridden by preceding the text with a |
| 858 |
% bracketed \acro{ISO} \mbox{639-1} two-letter language code and an |
| 859 |
% optional \acro{ISO} \mbox{3166-1} two-letter region code. For |
| 860 |
% example, |pdfpublication={[fr]Charlie Hedbo}| indicates a |
| 861 |
% French-language title. Were the language or pronunciation differences |
| 862 |
% significant, |fr-FR| would indicate specifically the French spoken in |
| 863 |
% France, as opposed to that spoken in, say, Canada (|fr-CA|) or Belgium |
| 864 |
% (|fr-BE|). The publisher itself can be named using |
| 865 |
% \moptname{pdfpublisher}. |
| 866 |
% |
| 867 |
% \moptname{pdfpubtype} indicates the type of publication in which the |
| 868 |
% document was published. This should be one of the \acro{PRISM} |
| 869 |
% aggregation types~\cite{PRISM2012:cont-voc} such as |book|, |journal|, |
| 870 |
% |magazine|, |manual|, |report|, or |whitepaper|. |
| 871 |
% |
| 872 |
% For publications in journals, magazines, and similar periodicals, a |
| 873 |
% document can specify the volume number with \moptname{pdfvolumenum} |
| 874 |
% and the issue number within the volume with \moptname{pdfissuenum}. |
| 875 |
% \moptname{pdfpagerange} indicates the page numbers at which the |
| 876 |
% document appears within the publication. The intention is that this |
| 877 |
% be a comma-separated list of dash-separated ranges, as in |
| 878 |
% |pdfpagerange={1,4-5}|. See Note~\ref{note:page-counting} on |
| 879 |
% page~\pageref{note:page-counting} for advice on how to assign |
| 880 |
% \optname{pdfpagerange} semi-automatically. A journal article's |
| 881 |
% publication status can be indicated with \moptname{pdfpubstatus}. |
| 882 |
% This option expects to take one of the values listed in |
| 883 |
% Table~\ref{tbl:jav}. See the \acro{NISO}/\acro{ALPSP} Journal Article |
| 884 |
% Versions recommendation~\cite{NISO2008:jav} for an explanation of each |
| 885 |
% of those values and when to use them. |
| 886 |
% |
| 887 |
% \begin{table} |
| 888 |
% \centering |
| 889 |
% \caption{Valid arguments for \optname{pdfpubstatus}} |
| 890 |
% \label{tbl:jav} |
| 891 |
% \begin{tabular}{@{}>{\ttfamily}ll@{}} |
| 892 |
% \toprule |
| 893 |
% \multicolumn{1}{@{}l}{Value} & Meaning \\ |
| 894 |
% \midrule |
| 895 |
% AO & Author's Original \\ |
| 896 |
% SMUR & Submitted Manuscript Under Review \\ |
| 897 |
% AM & Accepted Manuscript \\ |
| 898 |
% P & Proof \\ |
| 899 |
% VoR & Version of Record \\ |
| 900 |
% CVoR & Corrected Version of Record \\ |
| 901 |
% EVoR & Enhanced Version of Record \\ |
| 902 |
% \bottomrule |
| 903 |
% \end{tabular} |
| 904 |
% \end{table} |
| 905 |
% |
| 906 |
% For books, \moptname{pdfbookedition} names the edition of the book. |
| 907 |
% This is specified as text, not a number. As with |
| 908 |
% \optname{pdfpublication} (above), \optname{pdfbookedition} accepts a |
| 909 |
% bracketed language code, as in |pdfbookedition={[en]Second| |
| 910 |
% |edition}|. |
| 911 |
% |
| 912 |
% \acro{XMP} metadata can include a number of dates (in fact, |
| 913 |
% timestamps, as they include both date and time components). |
| 914 |
% \moptname{pdfdate} specifies the document date. It is analogous to the |
| 915 |
% \LaTeX\ |\date| command, and, like |\date|, defaults to the date the |
| 916 |
% document was built. It must be specified in either \acro{XMP} |
| 917 |
% format~\cite{Adobe2012:XMP} or \acro{PDF} format~\cite{Adobe2008:PDF}. |
| 918 |
% \acro{XMP} dates are written in the form |
| 919 |
% \textsc{yyyy}|-|\textsc{mm}|-|\textsc{dd}|T|hh|:|mm|:|ss|+|\textsc{tt}|:|tt.\footnote{Although |
| 920 |
% allowed by \acro{XMP}, \pkgname{hyperxmp} does not currently accept |
| 921 |
% fractions of a second in timestamps.} A W3C |
| 922 |
% recommendation~\cite{Wolf1997:date-time} discusses this format in more |
| 923 |
% detail, but as an example, 14~hours, 15~minutes, 9~seconds past |
| 924 |
% midnight U.S. Mountain Daylight Time (UTC-6) on the 23rd day of |
| 925 |
% September in the year~2014 should be written as |
| 926 |
% \texttt{2014-09-23T14:15:09-06:00}. This can be truncated (with loss |
| 927 |
% of information) to \texttt{2014-09-23T14:15:09}, |
| 928 |
% \texttt{2014-09-23T14:15}, \texttt{2014-09-23}, \texttt{2014-09}, |
| 929 |
% or \texttt{2014} but no other subsets. \acro{PDF} dates are written |
| 930 |
% in the form |D:|\textsc{yyyymmdd}hhmmss|+|\textsc{tt}|'|tt|'|. The |
| 931 |
% same date in the preceding example would be written as |
| 932 |
% \texttt{D:20140923141509-06'00'} in \acro{PDF} format. |
| 933 |
% |
| 934 |
% The document's creation date, modification date, and metadata date are |
| 935 |
% normally set automatically, but \moptname{pdfcreationdate}, |
| 936 |
% \moptname{pdfmoddate}, and \moptname{pdfmetadate} can be used to |
| 937 |
% override the defaults. Like \optname{pdfdate}, \optname{pdfmetadate} |
| 938 |
% can be specified in either \acro{XMP} or \acro{PDF} format. However, |
| 939 |
% because \pkgname{hyperref} defines \optname{pdfcreationdate} and |
| 940 |
% \optname{pdfmoddate} and expects these to be written as \acro{PDF} |
| 941 |
% dates, \pkgname{hyperxmp} concomitantly accepts these two dates only |
| 942 |
% in \acro{PDF} format as well. Note that it's rare that a document |
| 943 |
% would need to specify any of \optname{pdfcreationdate}, |
| 944 |
% \optname{pdfmoddate}, or \optname{pdfmetadate}. |
| 945 |
% |
| 946 |
% \moptname{pdftype} describes the type of document being produced. |
| 947 |
% This refers to ``the nature or genre of the |
| 948 |
% resource''~\cite{Adobe2012:XMP} such as |poem|, |novel| or |working| |
| 949 |
% |paper|, as opposed to the file format (always |application/pdf| when |
| 950 |
% generated by \pkgname{hyperxmp}). Although \optname{pdftype} can be |
| 951 |
% assigned an arbitrary piece of text, the \acro{XMP} specification |
| 952 |
% recommends selecting types from a ``controlled vocabulary'' such as |
| 953 |
% the \acro{DCMI} Type Vocabulary~\cite{DCMI2012:meta-terms}. The |
| 954 |
% \acro{DCMI} Type Vocabulary currently consists of only |Collection|, |
| 955 |
% |Dataset|, |Event|, |Image|, |InteractiveResource|, |MovingImage|, |
| 956 |
% |PhysicalObject|, |Service|, |Software|, |Sound|, |StillImage|, and |
| 957 |
% |Text|. \optname{pdftype} defaults to |Text|, which refers to |
| 958 |
% ``books, letters, dissertations, poems, newspapers, articles, archives |
| 959 |
% of mailing lists,''~\cite{DCMI2012:meta-terms} and other forms of |
| 960 |
% text---all things \LaTeX\ is commonly used to typeset. |
| 961 |
% |
| 962 |
% Sometimes a base document is rendered in different forms. |
| 963 |
% \moptname{pdfrendition} indicates the particular rendition the current |
| 964 |
% document instance represents. The value should come from the |
| 965 |
% following controlled vocabulary~\cite{Adobe2012:XMP}: |default|, |
| 966 |
% |draft|, |low-res|, |proof|, |screen|, and |thumbnail|. |
| 967 |
% \pkgname{hyperxmp}'s default value is |default|, which indicates the |
| 968 |
% master document, unless the \optname{draft} option is passed to |
| 969 |
% |\documentclass|, in which case \pkgname{hyperxmp} defaults to |
| 970 |
% |draft|. |
| 971 |
% |
| 972 |
% \pkgname{hyperxmp} honors \pkgname{hyperref}'s \moptname{pdftrapped} |
| 973 |
% option. A document can indicate whether it employs |
| 974 |
% \href{https://en.wikipedia.org/wiki/Trap_(printing)}{color trapping} |
| 975 |
% by specifying \optname{pdftrapped}=|True| or |
| 976 |
% \optname{pdftrapped}=|False|. (\optname{pdftrapped}=|Unknown| is also |
| 977 |
% allowed.) |
| 978 |
% |
| 979 |
% \moptname{pdfapart} and \moptname{pdfaconformance}, are used in |
| 980 |
% conjunction with \pkgname{hyperref}'s \optname{pdfa} option to claim a |
| 981 |
% particular \acro{PDF/A} standard by which the document abides. They |
| 982 |
% default to \optname{pdfapart}=|1| and \optname{pdfaconformance}=|B|, |
| 983 |
% indicating the \PDFstd{A}{1}{b}{} standard. These can be changed |
| 984 |
% (with caution) to assert that the document abides by a different |
| 985 |
% standard (e.g.,~\PDFstd{A}{2}{u}{}). A document that conforms to the |
| 986 |
% \acro{PDF/UA} standard can use \moptname{pdfuapart} to indicate the |
| 987 |
% \acro{PDF/UA} conformance level. For example, \optname{pdfuapart}=|1| |
| 988 |
% asserts that the document respects \PDFstd{UA}{1}{}{}. |
| 989 |
% \moptname{pdfxstandard} indicates the particular \acro{PDF/X} standard |
| 990 |
% by which the document abides. Unlike \optname{pdfapart} and |
| 991 |
% \optname{pdfaconformance}, which accept a number and a letter, |
| 992 |
% respectively, \optname{pdfxstandard} expects a textual identification |
| 993 |
% of a standard name. The following are the acceptable \acro{PDF/X} |
| 994 |
% standard names as of at the time of this writing. |
| 995 |
% |
| 996 |
% ^^A This list needs to be kept up-to-date with the standards checked |
| 997 |
% ^^A by \@pdfxstandard. |
| 998 |
% \begin{multicols}{3} |
| 999 |
% \raggedcolumns |
| 1000 |
% \begin{itemize}[noitemsep] |
| 1001 |
% \item \PDFstd{X}{1}{a}{2001} |
| 1002 |
% \item \PDFstd{X}{1}{a}{2003} |
| 1003 |
% \item \PDFstd{X}{3}{}{2002} |
| 1004 |
% \item \PDFstd{X}{3}{}{2003} |
| 1005 |
% \item \PDFstd{X}{4}{}{} |
| 1006 |
% \item \PDFstd{X}{4}{p}{} |
| 1007 |
% \item \PDFstd{X}{5}{g}{} |
| 1008 |
% \item \PDFstd{X}{5}{n}{} |
| 1009 |
% \item \PDFstd{X}{5}{pg}{} |
| 1010 |
% \end{itemize} |
| 1011 |
% \end{multicols} |
| 1012 |
% |
| 1013 |
% For example, one can specify \optname{pdfxstandard}=|{PDF/X-4}| or |
| 1014 |
% \optname{pdfxstandard}=|{PDF/X-3:2003}|, but specifying |
| 1015 |
% \optname{pdfxstandard}=|{PDF/X-3}| will not pass \acro{PDF/X} |
| 1016 |
% validation. Note that at the time of this writing the use of the |
| 1017 |
% \PDFstd{X}{4}{p}{}, \PDFstd{X}{5}{n}{}, and \PDFstd{X}{5}{pg}{} |
| 1018 |
% standards has not been tested. |
| 1019 |
% |
| 1020 |
% \subsubsection*{Rarely needed options} |
| 1021 |
% |
| 1022 |
% \moptname{pdfsource} overrides the name of the \LaTeX\ source file. |
| 1023 |
% It defaults to |\jobname.tex| but can be replaced by any other string. |
| 1024 |
% If \optname{pdfsource} is given an empty argument, no document source |
| 1025 |
% will be specified at all. |
| 1026 |
% |
| 1027 |
% The number of pages in the published, print version of the document |
| 1028 |
% can be expressed with \moptname{pdfnumpages}. This is computed |
| 1029 |
% automatically when the document is built using either \pdfLaTeX\ or |
| 1030 |
% \LuaLaTeX\@. |
| 1031 |
% |
| 1032 |
% The \moptname{pdfbytes} option expresses the document's file size in |
| 1033 |
% bytes. The intention is for this to be used to display an estimate of |
| 1034 |
% download time to a user or to serve as a quick check on whether a file |
| 1035 |
% was transmitted correctly between systems. \optname{pdfbytes} is |
| 1036 |
% computed automatically by both \pdfLaTeX\ and \LuaLaTeX, using the |
| 1037 |
% file size from the previous build of the document. |
| 1038 |
% |
| 1039 |
% \bigskip |
| 1040 |
% |
| 1041 |
% It is usually more convenient to provide values for all of the options |
| 1042 |
% presented in this section using \pkgname{hyperref}'s |\hypersetup| |
| 1043 |
% command than on the |\usepackage| command line. See |
| 1044 |
% \href{http://mirrors.ctan.org/macros/latex/contrib/hyperref/hyperref.pdf}{the |
| 1045 |
% \pkgname{hyperref} manual} for more information. |
| 1046 |
% |
| 1047 |
% |
| 1048 |
% \subsection{A complete example} |
| 1049 |
% |
| 1050 |
% The following is a sample \LaTeX\ document that provides values for |
| 1051 |
% most of the metadata options that \pkgname{hyperxmp} recognizes: |
| 1052 |
% |
| 1053 |
% \Needspace{4\baselineskip} |
| 1054 |
% \refstepcounter{pagelabel} |
| 1055 |
% \label{page:begin-sample-doc} |
| 1056 |
% \begin{verbatim} |
| 1057 |
% \documentclass{article} |
| 1058 |
% \usepackage[utf8]{inputenc} |
| 1059 |
% \usepackage[unicode]{hyperref} |
| 1060 |
% \usepackage{hyperxmp} |
| 1061 |
% |
| 1062 |
% \title{% |
| 1063 |
% On a heuristic viewpoint concerning the production and |
| 1064 |
% transformation of light} |
| 1065 |
% \author{Albert Einstein} |
| 1066 |
% \date{March 17, 1905} |
| 1067 |
% |
| 1068 |
% \hypersetup{% |
| 1069 |
% pdftitle={% |
| 1070 |
% On a heuristic viewpoint concerning the production and |
| 1071 |
% transformation of light}, |
| 1072 |
% pdfsubtitle={[en-US]Putting that bum Maxwell in his place}, |
| 1073 |
% pdfauthor={Albert Einstein}, |
| 1074 |
% pdfauthortitle={\xmpquote{Technical Assistant\xmpcomma\ Level III}}, |
| 1075 |
% pdfdate={1905-03-17}, |
| 1076 |
% pdfcopyright={Copyright (C) 1905, Albert Einstein}, |
| 1077 |
% pdfsubject={photoelectric effect}, |
| 1078 |
% pdfkeywords={energy quanta, Hertz effect, quantum physics}, |
| 1079 |
% pdflicenseurl={http://creativecommons.org/licenses/by-nc-nd/3.0/}, |
| 1080 |
% pdfcaptionwriter={Scott Pakin}, |
| 1081 |
% pdfcontactaddress={Kramgasse 49}, |
| 1082 |
% pdfcontactcity={Bern}, |
| 1083 |
% pdfcontactpostcode={3011}, |
| 1084 |
% pdfcontactcountry={Switzerland}, |
| 1085 |
% pdfcontactphone={031 312 00 91}, |
| 1086 |
% pdfcontactemail={[email protected]}, |
| 1087 |
% pdfcontacturl={% |
| 1088 |
% http://einstein.biz/, |
| 1089 |
% https://www.facebook.com/AlbertEinstein |
| 1090 |
% }, |
| 1091 |
% pdfdocumentid={uuid:6d1ac9ec-4ff2-515a-954b-648eeb4853b0}, |
| 1092 |
% pdfversionid={2.998e8}, |
| 1093 |
% pdfpublication={[de]Annalen der Physik}, |
| 1094 |
% pdfpublisher={Wiley-VCH}, |
| 1095 |
% pdfpubtype={journal}, |
| 1096 |
% pdfvolumenum={322}, |
| 1097 |
% pdfissuenum={6}, |
| 1098 |
% pdfpagerange={132-148}, |
| 1099 |
% pdfissn={0003-3804}, |
| 1100 |
% pdfeissn={1521-3889}, |
| 1101 |
% pdfpubstatus={VoR}, |
| 1102 |
% pdflang={en}, |
| 1103 |
% pdfmetalang={en}, |
| 1104 |
% pdfurl={http://www.physik.uni-augsburg.de/annalen/history/einstein-papers/1905_17_132-148.pdf}, |
| 1105 |
% pdfdoi={10.1002/andp.19053220607}, |
| 1106 |
% pdfidentifier={info:lccn/50013519} |
| 1107 |
% } |
| 1108 |
% \XMPLangAlt{de}{pdftitle={Über einen die Erzeugung und Verwandlung des |
| 1109 |
% Lichtes betreffenden heuristischen Gesichtspunkt}} |
| 1110 |
% |
| 1111 |
% \begin{document} |
| 1112 |
% \maketitle |
| 1113 |
% A profound formal difference exists between the theoretical |
| 1114 |
% concepts that physicists have formed about gases and other |
| 1115 |
% ponderable bodies, and Maxwell's theory of electromagnetic |
| 1116 |
% processes in so-called empty space\dots |
| 1117 |
% \end{document} |
| 1118 |
% \end{verbatim} |
| 1119 |
% \refstepcounter{pagelabel} |
| 1120 |
% \label{page:end-sample-doc} |
| 1121 |
% |
| 1122 |
% Compile the document to \acro{PDF} using any of the following |
| 1123 |
% approaches: |
| 1124 |
% |
| 1125 |
% \begin{itemize} |
| 1126 |
% \item \pdfLaTeX |
| 1127 |
% \item \LuaLaTeX |
| 1128 |
% \item \XeLaTeX |
| 1129 |
% \item \LaTeX~$+$ \term{Dvipdfm} |
| 1130 |
% \item \LaTeX~$+$ \Dvips~$+$ \term{Ghostscript} |
| 1131 |
% \item \LaTeX~$+$ \Dvips~$+$ Adobe Acrobat Distiller |
| 1132 |
% \end{itemize} |
| 1133 |
% |
| 1134 |
% \noindent |
| 1135 |
% The \LaTeX~$+$ \Dvips~$+$ \term{Ghostscript} path stores the |
| 1136 |
% \acro{XMP} packet in a compressed stream, which implies that a |
| 1137 |
% \acro{PDF} reader is needed to access it. Ideally, \acro{XMP} |
| 1138 |
% metadata should be stored uncompressed so it can be extracted as |
| 1139 |
% ordinary text. Unfortunately, as of 2022-10-07, Ghostscript has no |
| 1140 |
% plans to support uncompressed metadata streams |
| 1141 |
% (\href{https://bugs.ghostscript.com/show_bug.cgi?id=705962}{Ghostscript |
| 1142 |
% bug report~\#705962}). It is possible to leave \emph{all} streams |
| 1143 |
% uncompressed by passing |-dCompressStreams=false| to \term{Ghostscript} |
| 1144 |
% (e.g.,~via the \progname{ps2pdf} wrapper script), but this leads to |
| 1145 |
% larger file sizes. |
| 1146 |
% |
| 1147 |
% \bigskip |
| 1148 |
% |
| 1149 |
% Once the document is compiled, the resulting \acro{PDF} file will |
| 1150 |
% contain an \acro{XMP} packet that looks something like that shown in |
| 1151 |
% Appendix~\ref{sec:sample-packet}. Figure~\ref{fig:xmp-metadata-1} is |
| 1152 |
% a screenshot of the \acro{XMP} metadata as it appears in Adobe |
| 1153 |
% Acrobat's ``Advanced'' metadata dialog box. Further clicking on the |
| 1154 |
% ``Advanced'' item within that dialog box displays all of the |
| 1155 |
% document's metadata sorted by schema as shown in |
| 1156 |
% Figure~\ref{fig:xmp-metadata-2}. |
| 1157 |
% |
| 1158 |
% \begin{figure}[htbp] |
| 1159 |
% \includegraphics[width=\linewidth]{einstein1} |
| 1160 |
% \caption{\acro{XMP} metadata as it appears in Adobe Acrobat} |
| 1161 |
% \label{fig:xmp-metadata-1} |
| 1162 |
% \end{figure} |
| 1163 |
% |
| 1164 |
% \begin{figure}[htbp] |
| 1165 |
% \includegraphics[width=\linewidth]{einstein2} |
| 1166 |
% \caption{Additional \acro{XMP} metadata as it appears in Adobe Acrobat} |
| 1167 |
% \label{fig:xmp-metadata-2} |
| 1168 |
% \end{figure} |
| 1169 |
% |
| 1170 |
% |
| 1171 |
% \subsection{Usage notes} |
| 1172 |
% |
| 1173 |
% \usagenote{Conflicting metadata in PDF/A documents} |
| 1174 |
% \label{note:meta-conflicts} |
| 1175 |
% A \acro{PDF} file includes an \pdfterm{Info} dictionary containing |
| 1176 |
% \pdfterm{Author}, \pdfterm{Title}, \pdfterm{Subject}, and |
| 1177 |
% \pdfterm{Keywords} keys. The \pkgname{hyperref} package's |
| 1178 |
% \optname{pdfauthor}, \optname{pdftitle}, \optname{pdfsubject}, and |
| 1179 |
% \optname{pdfkeywords} options assign values to those keys. The |
| 1180 |
% \pkgname{hyperxmp} package additionally uses those options to assign |
| 1181 |
% values to various \acro{XMP} metadata: \xmpprop{dc:creator}, |
| 1182 |
% \xmpprop{dc:title}, \xmpprop{dc:description}, and |
| 1183 |
% \xmpprop{pdf:Keywords}. The \acro{PDF/A} specification indicates that |
| 1184 |
% values that appear in both the \acro{PDF} \pdfterm{Info} dictionary |
| 1185 |
% and \acro{XMP} packet must match. The problem is that in \acro{XMP}, |
| 1186 |
% the author and keywords can be proper lists, as in |
| 1187 |
% |
| 1188 |
% \Needspace{7\baselineskip} |
| 1189 |
% \begin{verbatim} |
| 1190 |
% <dc:creator> |
| 1191 |
% <rdf:Seq> |
| 1192 |
% <rdf:li>Curly Howard</rdf:li> |
| 1193 |
% <rdf:li>Larry Fine</rdf:li> |
| 1194 |
% <rdf:li>Moe Howard</rdf:li> |
| 1195 |
% </rdf:Seq> |
| 1196 |
% </dc:creator> |
| 1197 |
% \end{verbatim} |
| 1198 |
% |
| 1199 |
% \noindent |
| 1200 |
% while in \acro{PDF}, the author and keywords are specified as flat |
| 1201 |
% strings. Alas, there is no definition of how a list should be |
| 1202 |
% collapsed to a flat string: ``\texttt{Curly Howard, Larry Fine, Moe |
| 1203 |
% Howard}'' or ``\texttt{Curly Howard; Larry Fine; Moe Howard}'' or |
| 1204 |
% something else. I have not yet found a form of flat string that |
| 1205 |
% passes all \acro{PDF/A} validators. Furthermore, when Adobe |
| 1206 |
% Acrobat---at least Adobe Acrobat DC (2019) and earlier |
| 1207 |
% versions---converts a \acro{PDF} file to \acro{PDF/A} format, it does |
| 1208 |
% so by discarding all but the first author, which is an unsatisfying |
| 1209 |
% solution. |
| 1210 |
% |
| 1211 |
% Starting with version~4.0, \pkgname{hyperxmp}'s solution is to |
| 1212 |
% suppress writing metadata to the \acro{PDF} \pdfterm{Info} dictionary |
| 1213 |
% and write it only to the \acro{XMP} packet. (\pkgname{hyperxmp}~v5.0+ |
| 1214 |
% is more sophisticated. It suppresses only the author and keyword |
| 1215 |
% lists.) This appears to pacify \acro{PDF/A} validators yet retains |
| 1216 |
% the author and keyword lists in their non-truncated form. If desired, |
| 1217 |
% the \pdfterm{Info} dictionary can be retained by passing the |
| 1218 |
% \moptname{keeppdfinfo}\label{page:keeppdfinfo} option to |
| 1219 |
% \cs{hypersetup}. |
| 1220 |
% |
| 1221 |
% \usagenote{Acrobat multiline-field bug} |
| 1222 |
% The \acro{IPTC} Photo Metadata schema states that ``the [contact] |
| 1223 |
% address is a multiline field''~\cite{IPTC2010:photo-meta}. |
| 1224 |
% \pkgname{hyperxmp} converts commas in \optname{pdfcontactaddress}'s |
| 1225 |
% argument to line breaks in the generated \acro{XML}\@. Unfortunately, |
| 1226 |
% A bug in Adobe Acrobat---at least in Adobe Acrobat DC (2019) and |
| 1227 |
% earlier versions---causes that \acro{PDF} reader to discard line |
| 1228 |
% breaks in the contact address. Interestingly, Adobe Illustrator CS5 |
| 1229 |
% correctly displays the contact address. If you find Adobe Acrobat's |
| 1230 |
% behavior bothersome, you can redefine the |
| 1231 |
% \DescribeMacro{\xmplinesep}|\xmplinesep| macro as a string to use as |
| 1232 |
% an address-line separator. For example, the following replaces all |
| 1233 |
% commas appearing in \optname{pdfcontactaddress}'s argument with |
| 1234 |
% semicolons: |
| 1235 |
% |
| 1236 |
% \begin{verbatim} |
| 1237 |
% \renewcommand*{\xmlinesep}{;} |
| 1238 |
% \end{verbatim} |
| 1239 |
% |
| 1240 |
% \usagenote{Object compression} |
| 1241 |
% One intention of \acro{XMP} is that metadata embedded in a file be |
| 1242 |
% readable even without knowledge of the file's format. That is, the |
| 1243 |
% metadata are expected to appear as plain text. Although |
| 1244 |
% \pkgname{hyperxmp} does its best to honor that intention, it faces |
| 1245 |
% a few challenges: |
| 1246 |
% |
| 1247 |
% \begin{enumerate} |
| 1248 |
% \item When run with versions of \LuaLaTeX\ earlier than 0.85, |
| 1249 |
% \pkgname{hyperxmp} leaves all \acro{PDF} objects uncompressed. This |
| 1250 |
% is due to \LuaLaTeX\ treating object compression as a global |
| 1251 |
% parameter, unlike \pdfLaTeX, which treats it as a local parameter. |
| 1252 |
% Hence, when \pkgname{hyperxmp} requests that the \acro{XMP} packet |
| 1253 |
% be left uncompressed, \LuaLaTeX\ in fact leaves \emph{all} |
| 1254 |
% \acro{PDF} streams uncompressed. Beginning with version~3.0, |
| 1255 |
% \pkgname{hyperxmp} includes a workaround that correctly leaves only |
| 1256 |
% the \acro{XMP} metadata uncompressed, but this workaround is |
| 1257 |
% implemented only for \LuaLaTeX\ v0.85 onwards. |
| 1258 |
% |
| 1259 |
% \item \XeLaTeX\ (or, more precisely, the \cmdname{xdvipdfmx} back end) |
| 1260 |
% exhibits the opposite problem. It compresses \emph{all} \acro{PDF} |
| 1261 |
% objects, including the ones containing \acro{XMP} metadata. While |
| 1262 |
% Adobe Acrobat can still detect and utilize the \acro{XMP} metadata, |
| 1263 |
% non-\acro{PDF}-aware applications are unlikely to see the metadata. |
| 1264 |
% Three options to consider are to (1)~use a different program |
| 1265 |
% (e.g.,~\LuaLaTeX), (2)~pass the |--output-driver="xdvipdfmx -z0"| |
| 1266 |
% option to \XeLaTeX\ to instruct \cmdname{xdvipdfmx} to turn off all |
| 1267 |
% compression (which will of course make the \acro{PDF} file |
| 1268 |
% substantially larger), or (3)~postprocess the generated \acro{PDF} |
| 1269 |
% file by loading it into the commercial version of Adobe Acrobat and |
| 1270 |
% re-saving it with the Save As\dots\ menu option. |
| 1271 |
% \end{enumerate} |
| 1272 |
% |
| 1273 |
% \usagenote{Literal commas} |
| 1274 |
% \label{note:literal-commas} |
| 1275 |
% \pkgname{hyperxmp} splits the \optname{pdfauthor} and |
| 1276 |
% \optname{pdfkeywords} lists at commas. Therefore, when specifying |
| 1277 |
% \optname{pdfauthor} and \optname{pdfkeywords}, you should separate |
| 1278 |
% items with commas. Also, omit ``|and|'' and other text that does not |
| 1279 |
% belong to any list item. The following examples should serve as |
| 1280 |
% clarification: |
| 1281 |
% |
| 1282 |
% \begin{description} |
| 1283 |
% \item[Wrong:] |pdfauthor={Jack Napier, Edward Nigma,| |
| 1284 |
% \textcolor{red}{\texttt{and}} |Harvey Dent}| |
| 1285 |
% \item[Wrong:] |pdfauthor={Jack Napier|\textcolor{red}{\texttt{;}} |
| 1286 |
% |Edward Nigma|\textcolor{red}{\texttt{;}} |
| 1287 |
% |Harvey Dent}| |
| 1288 |
% \item[Right:] |pdfauthor={Jack Napier, Edward Nigma, Harvey Dent}| |
| 1289 |
% \end{description} |
| 1290 |
% |
| 1291 |
% \noindent |
| 1292 |
% \DescribeMacro{\xmpcomma} |
| 1293 |
% \DescribeMacro{\xmpquote} |
| 1294 |
% If you need to include a literal comma within an author or keyword |
| 1295 |
% list (where commas normally separate list items) or a street address |
| 1296 |
% (where commas normally separate lines), use the |\xmpcomma| macro to |
| 1297 |
% represent it, and wrap the entire entry containing the comma within |
| 1298 |
% |\xmpquote{|\dots|}| as shown below: |
| 1299 |
% |
| 1300 |
% \begin{verbatim} |
| 1301 |
% pdfauthor={\xmpquote{Jack Napier\xmpcomma\ Jr.}, |
| 1302 |
% \xmpquote{Edward Nigma\xmpcomma\ PhD}, |
| 1303 |
% \xmpquote{Harvey Dent\xmpcomma\ Esq.}} |
| 1304 |
% |
| 1305 |
% pdfcontactaddress={Office of the President, |
| 1306 |
% \xmpquote{Wayne Enterprises\xmpcomma\ Inc.}, |
| 1307 |
% One Wayne Blvd} |
| 1308 |
% \end{verbatim} |
| 1309 |
% |
| 1310 |
% As of version~2.2 of \pkgname{hyperxmp}, it is acceptable to use |
| 1311 |
% |\xmpcomma| and |\xmpquote| within any \pkgname{hyperxmp} option, not |
| 1312 |
% just in those in which a comma normally serves as a separator |
| 1313 |
% (i.e.,~lists and multiline fields). Outside of cases in which a comma |
| 1314 |
% serves as a separator, |\xmpcomma| is treated as an ordinary comma, |
| 1315 |
% and |\xmpquote| returns its argument unmodified. Hence, it is |
| 1316 |
% legitimate to use |\xmpcomma| and |\xmpquote| in cases like the |
| 1317 |
% following |
| 1318 |
% |
| 1319 |
% \begin{verbatim} |
| 1320 |
% pdfauthortitle={\xmpquote{Psychiatrist\xmpcomma\ Arkham Asylum}} |
| 1321 |
% \end{verbatim} |
| 1322 |
% |
| 1323 |
% \noindent |
| 1324 |
% (Like most \pkgname{hyperxmp} options, \optname{pdfauthortitle} |
| 1325 |
% inserts its argument unmodified in an \acro{XMP} tag.) When in |
| 1326 |
% doubt, use |\xmpcomma| and |\xmpquote|; it should always be safe |
| 1327 |
% to do so. |
| 1328 |
% |
| 1329 |
% \DescribeMacro{\xmptilde} |
| 1330 |
% Version~2.4 of \pkgname{hyperxmp} introduces a convenience macro |
| 1331 |
% called |\xmptilde|. |\xmptilde| expands to a literal tilde character |
| 1332 |
% instead of the nonbreaking space that ``|~|'' normally represents. |
| 1333 |
% Use it to represent \acro{URL}s such as |
| 1334 |
% \url{http://www.pakin.org/~scott/} (``|http://www.pakin.org/|\linebreak[0]|\xmptilde| |
| 1335 |
% |scott/|'') in options such as \optname{baseurl}, |
| 1336 |
% \optname{pdfcontacturl} and \optname{pdflicenseurl}. |
| 1337 |
% |
| 1338 |
% \usagenote{Unicode support} |
| 1339 |
% \term{Unicode} support is provided via the \pkgname{hyperref} package. |
| 1340 |
% If you specify \optname{unicode}|=true| either as a \pkgname{hyperref} |
| 1341 |
% option or as an argument to the |\hypersetup| command, the document |
| 1342 |
% can include \term{Unicode} characters in its \acro{XMP} fields. |
| 1343 |
% |
| 1344 |
% \usagenote{Automatically specified metadata} |
| 1345 |
% \pkgname{hyperxmp} attempts to identify certain metadata |
| 1346 |
% automatically. The hope is that in many cases, an author can simply |
| 1347 |
% include |\usepackage{hyperxmp}| in a document's preamble and benefit |
| 1348 |
% from a modicum of \acro{XMP} metadata with no additional effort. |
| 1349 |
% |
| 1350 |
% Currently, \optname{pdftitle} defaults to the document's title as |
| 1351 |
% specified by |\title{|\dots|}|. \optname{pdfauthor} defaults to the |
| 1352 |
% document's author(s) as specified by |\author{|\dots|}|. |
| 1353 |
% \optname{pdfdate} defaults to the current date and time. |
| 1354 |
% \optname{pdfmetalang} defaults to the same value as \optname{pdflang} |
| 1355 |
% if non-empty, ``\xmpterm{x-default}'' otherwise. \pkgname{hyperxmp} |
| 1356 |
% recognizes some class-specific metadata as well, such as that provided |
| 1357 |
% via the \Koma\ letter classes (e.g.,~\clsname{scrlttr2}) and the |
| 1358 |
% \ACMclass\ article class (\clsname{acmart}). |
| 1359 |
% |
| 1360 |
% If a document uses either the \pkgname{babel} or \pkgname{polyglossia} |
| 1361 |
% packages it is recommended that it \emph{not} explicitly set |
| 1362 |
% \optname{pdflang}. \optname{pdflang} accepts only a single language |
| 1363 |
% name while \pkgname{hyperxmp} can automatically query \pkgname{babel} |
| 1364 |
% and \pkgname{polyglossia} for a list of all languages used in the |
| 1365 |
% document and include this list in an \acro{XMP} \xmpprop{dc:language} |
| 1366 |
% element. |
| 1367 |
% |
| 1368 |
% \usagenote{Multilingual metadata} |
| 1369 |
% \label{note:multilingual} |
| 1370 |
% The \optname{pdfmetalang} option specifies the language in which the |
| 1371 |
% document's metadata is written. It defaults to the value of |
| 1372 |
% \optname{pdflang}, which specifies the document language. |
| 1373 |
% \DescribeMacro{\XMPLangAlt} As of version~3.3 of \pkgname{hyperxmp}, |
| 1374 |
% it is possible to include certain metadata---specifically, the |
| 1375 |
% document's title, subject, and copyright statement---in more than one |
| 1376 |
% language. The |\XMPLangAlt| macro provides this functionality. Usage |
| 1377 |
% is as follows: |
| 1378 |
% |
| 1379 |
% \bigskip |
| 1380 |
% \indent |
| 1381 |
% |\XMPLangAlt| \marg{language} |{| \meta{option}|=|\meta{text},~\dots\ |}| |
| 1382 |
% \bigskip |
| 1383 |
% |
| 1384 |
% \noindent |
| 1385 |
% where \meta{language} is an \acro{ISO} \mbox{639-1} two-letter country |
| 1386 |
% code with an optional \acro{ISO} \mbox{3166-1} two-letter region code |
| 1387 |
% (e.g.,~``|en|'' for English or ``|en-US|'' for specifically US |
| 1388 |
% English); \meta{option} is one of ``|pdftitle|'', ``|pdfsubject|'', or |
| 1389 |
% ``|pdfcopyright|''; and \meta{text} is the text as expressed in the |
| 1390 |
% specified language. By way, of example, the following code provides |
| 1391 |
% the document title in English then specifies an alternative title to |
| 1392 |
% use in four other languages: |
| 1393 |
% |
| 1394 |
% \begin{verbatim} |
| 1395 |
% \hypersetup{% |
| 1396 |
% pdfmetalang={en}, |
| 1397 |
% pdftitle={English title} |
| 1398 |
% } |
| 1399 |
% \XMPLangAlt{de}{pdftitle={Deutscher Titel}} |
| 1400 |
% \XMPLangAlt{fr}{pdftitle={Titre fran\c{c}ais}} |
| 1401 |
% \XMPLangAlt{it}{pdftitle={Titolo italiano}} |
| 1402 |
% \XMPLangAlt{rm}{pdftitle={Titel rumantsch}} |
| 1403 |
% \end{verbatim} |
| 1404 |
% |
| 1405 |
% \usagenote{Expandable arguments} |
| 1406 |
% \label{note:expandable} |
| 1407 |
% All arguments passed to \pkgname{hyperxmp} options must be expandable, |
| 1408 |
% in \tex\ terminology. This implies that any macros that are used in |
| 1409 |
% arguments are limited to a relatively small set of operations (such as |
| 1410 |
% conditionals and macro expansion) and must produce a string of text. |
| 1411 |
% Code (such as macro definitions and arithmetic operations) will be |
| 1412 |
% written to \acro{XMP} as code, not as the result of executing the |
| 1413 |
% code. |
| 1414 |
% |
| 1415 |
% By way of example, the macros provided by the \pkgname{texdate} |
| 1416 |
% package for typesetting dates are not expandable (at least at the time |
| 1417 |
% of this writing). Hence, the |\printfdate{Y}| in the following code |
| 1418 |
% snippet is not replaced by the current year, as one might expect: |
| 1419 |
% |
| 1420 |
% \begin{verbatim} |
| 1421 |
% \usepackage{texdate} |
| 1422 |
% \initcurrdate |
| 1423 |
% \hypersetup{% |
| 1424 |
% pdfcopyright={Copyright \textcopyright\ \printfdate{Y}, Scott Pakin} |
| 1425 |
% } |
| 1426 |
% \end{verbatim} |
| 1427 |
% |
| 1428 |
% \noindent |
| 1429 |
% Rather, it generates a \xmpprop{dc:rights} tag of the form |
| 1430 |
% ``\texttt{Copyright \textcopyright\ =2=0=by-1by=0\the\year, Scott |
| 1431 |
% Pakin}''. The garbage in that line corresponds to the remnants of |
| 1432 |
% the |\printfdate| code after expanding all of the \tex\ primitives and |
| 1433 |
% certain other control sequences it uses to the empty string. For |
| 1434 |
% example, ``|\global\advance\texd@yr| |by-1|'' expands to ``|by-1|''. |
| 1435 |
% |
| 1436 |
% It is not possible to determine a~priori whether or not a macro is |
| 1437 |
% expandable. The best advice is to carefully inspect the \acro{XMP} |
| 1438 |
% package in the output file to ensure that any macros used in arguments |
| 1439 |
% to \pkgname{hyperxmp} options produced the expected output. |
| 1440 |
% |
| 1441 |
% \usagenote{Semi-automatic page ranges} |
| 1442 |
% \label{note:page-counting} |
| 1443 |
% Although \optname{pdfpagerange} is intended to refer to pages in the |
| 1444 |
% final, published version of a document, it would be convenient for |
| 1445 |
% them to be generated automatically when producing a standalone |
| 1446 |
% \acro{PDF} file that is not intended to be incorporated into a book, |
| 1447 |
% journal, or other publication (or if it is known that the pages will |
| 1448 |
% not be renumbered for publication). One approach is to use the |
| 1449 |
% \pkgname{totpages} package help generate \optname{pdfpagerange}. For |
| 1450 |
% documents numbered from~1 to~$n$, a simple |
| 1451 |
% |
| 1452 |
% \Needspace{3\baselineskip} |
| 1453 |
% \begin{verbatim} |
| 1454 |
% \hypersetup{% |
| 1455 |
% pdfpagerange={1-\ref*{TotPages}} |
| 1456 |
% } |
| 1457 |
% \end{verbatim} |
| 1458 |
% |
| 1459 |
% \noindent |
| 1460 |
% should suffice. A bit more effort is needed for documents that change |
| 1461 |
% numbering schemes, such as using lowercase Roman numerals for the |
| 1462 |
% front matter and Arabic numerals for the main matter and back matter. |
| 1463 |
% One approach is to use \cs{label} to mark the first and last page of |
| 1464 |
% each numbering scheme and specify \optname{pdfpagerange} as in the |
| 1465 |
% following: |
| 1466 |
% |
| 1467 |
% \Needspace{6\baselineskip} |
| 1468 |
% \begin{verbatim} |
| 1469 |
% \hypersetup{% |
| 1470 |
% pdfpagerange={% |
| 1471 |
% \pageref*{page:begin-front}-\pageref*{page:end-front},% |
| 1472 |
% 1-\pageref*{TotPages}% |
| 1473 |
% } |
| 1474 |
% } |
| 1475 |
% \end{verbatim} |
| 1476 |
% |
| 1477 |
% I don't know how unnumbered pages (e.g.,~blank pages and the title |
| 1478 |
% page) are supposed to be handled. I suppose blank pages can be |
| 1479 |
% omitted from \optname{pdfpagerange}, and the title page can be either |
| 1480 |
% omitted or listed as \texttt{title}, for example. |
| 1481 |
% |
| 1482 |
% It appears that at least with version~2.00 of \pkgname{totpages}, the |
| 1483 |
% |TotPages| label is not defined until after the |\begin{document}|. |
| 1484 |
% Consequently, using |TotPages| within a \cs{hypersetup} invocation in |
| 1485 |
% the document's preamble will produce ``|??|'' as the page count in the |
| 1486 |
% \acro{XMP} packet. The solution is either to assign |
| 1487 |
% \optname{pdfpagerange} after the |\begin{document}| or to ask |
| 1488 |
% \LaTeX\ to do that on your behalf: |
| 1489 |
% |
| 1490 |
% \begin{verbatim} |
| 1491 |
% \AtBeginDocument{% |
| 1492 |
% \hypersetup{% |
| 1493 |
% pdfpagerange={1-\ref*{TotPages}} |
| 1494 |
% }% |
| 1495 |
% } |
| 1496 |
% \end{verbatim} |
| 1497 |
% |
| 1498 |
% \usagenote{Automatic computation of the PDF byte count} |
| 1499 |
% \label{note:auto-byte-count} |
| 1500 |
% |
| 1501 |
% The \schema[PRISM Basic Metadata]{\protect\acro{PRISM} Basic Metadata} |
| 1502 |
% schema~\cite{PRISM2012:basic-meta} defines a \xmpprop{prism:byteCount} |
| 1503 |
% property that indicates the \acro{PDF} file size in bytes. |
| 1504 |
% \pkgname{hyperxmp} computes this value automatically when the document |
| 1505 |
% is built using \LuaLaTeX\ but not when using any other \TeX\ engine. |
| 1506 |
% Note that \pkgname{hyperxmp} uses the file size from the |
| 1507 |
% \emph{previous} run of \LuaLaTeX\ because the new \acro{PDF} file is |
| 1508 |
% not yet complete. Consequently, one extra compilation is needed for |
| 1509 |
% the byte count to converge relative to the the number of compilations |
| 1510 |
% that would otherwise be required. |
| 1511 |
% |
| 1512 |
% Starting with \pkgname{hyperxmp}~v5.9, the \pkgname{hyperxmp} |
| 1513 |
% distribution includes a Perl\index{Perl} script called |
| 1514 |
% \progname{hyperxmp-add-bytecount} that edits a \acro{PDF} file in |
| 1515 |
% place, adding or replacing the \xmpprop{prism:byteCount} property with |
| 1516 |
% one that specifies the final file size.\footnote{The script was in |
| 1517 |
% fact introduced with \progname{hyperxmp}~v5.8 and was then called |
| 1518 |
% \texttt{add\_byteCount}.} Run the script as |
| 1519 |
% ``\progname{hyperxmp-add-bytecount} \meta{filename.pdf}''. |
| 1520 |
% |
| 1521 |
% The \progname{latexmk} build tool can be configured to run |
| 1522 |
% \progname{hyperxmp-add-bytecount} automatically every time a \acro{PDF} file |
| 1523 |
% is generated. Simply add the code shown in Figure~\ref{fig:latexmkrc} |
| 1524 |
% to your \progname{latexmk} configuration file. See |
| 1525 |
% \href{http://mirrors.ctan.org/support/latexmk/latexmk.pdf}{the |
| 1526 |
% \progname{latexmk} manual} for information on configuration-file |
| 1527 |
% naming on different operating systems and explanations of the hook |
| 1528 |
% functions used in Figure~\ref{fig:latexmkrc}. |
| 1529 |
% |
| 1530 |
% \changes{v5.8}{2020/11/18}{Distribute an |
| 1531 |
% \protect\progname{add\_byteCount} script and document some sample |
| 1532 |
% \protect\progname{latexmk} configuration code that invokes it. |
| 1533 |
% Thanks to John Collins for providing both of those} |
| 1534 |
% \changes{v5.9}{2020/11/22}{At Karl Berry's request, rename |
| 1535 |
% \protect\progname{add\_byteCount} to the less generic-sounding |
| 1536 |
% \protect\progname{hyperxmp-add-bytecount}} |
| 1537 |
% |
| 1538 |
% \iffalse |
| 1539 |
%<*listings> |
| 1540 |
% \fi |
| 1541 |
\newsavebox{\latexmkrcbox} |
| 1542 |
\begin{lrbox}{\latexmkrcbox} |
| 1543 |
\begin{lstlisting}[ |
| 1544 |
language=perl, |
| 1545 |
columns=fullflexible, |
| 1546 |
linewidth=19pc, |
| 1547 |
frame=single, |
| 1548 |
basicstyle=\footnotesize, |
| 1549 |
showstringspaces=false, |
| 1550 |
upquote=true, |
| 1551 |
literate={-}{-}{1} |
| 1552 |
] |
| 1553 |
foreach my $cmd ( "latex", "lualatex", "pdflatex", "xelatex", |
| 1554 |
"dvipdf", "xdvipdfmx", "ps2pdf" ) { |
| 1555 |
${$cmd} = "internal mycmd ${$cmd}"; |
| 1556 |
} |
| 1557 |
|
| 1558 |
sub mycmd { |
| 1559 |
my $retval = system @_; |
| 1560 |
if ( $$Pdest =~ /\.pdf$/ ) { |
| 1561 |
system 'hyperxmp-add-bytecount', $$Pdest; |
| 1562 |
} |
| 1563 |
return $retval; |
| 1564 |
} |
| 1565 |
\end{lstlisting} |
| 1566 |
\end{lrbox} |
| 1567 |
% \iffalse |
| 1568 |
%</listings> |
| 1569 |
% \fi |
| 1570 |
% |
| 1571 |
% \begin{figure} |
| 1572 |
% \centering |
| 1573 |
% \usebox{\latexmkrcbox} |
| 1574 |
% \caption{ \progname{latexmk} configuration-file code for |
| 1575 |
% automatically invoking \progname{hyperxmp-add-bytecount} every time a |
| 1576 |
% \acro{PDF} file is generated} |
| 1577 |
% \label{fig:latexmkrc} |
| 1578 |
% \end{figure} |
| 1579 |
% |
| 1580 |
% Even though \pkgname{hyperxmp} can compute the byte count |
| 1581 |
% automatically when run from \LuaLaTeX, users of \progname{latexmk} |
| 1582 |
% need to use configuration-file code like that shown in |
| 1583 |
% Figure~\ref{fig:latexmkrc}. Otherwise, \progname{latexmk} would |
| 1584 |
% compile the document one time too few for the byte count to |
| 1585 |
% converge. It is recommended that those who use both \progname{latexmk} |
| 1586 |
% and \pkgname{hyperxmp} configure \progname{latexmk} to be |
| 1587 |
% \pkgname{hyperxmp}-aware. |
| 1588 |
% |
| 1589 |
% |
| 1590 |
% \StopEventually{^^A |
| 1591 |
% \section{Help Wanted} |
| 1592 |
% |
| 1593 |
% \paragraph{Comma handling} |
| 1594 |
% Ideally, \texttt{\string\xmpquote} should automatically replace all |
| 1595 |
% commas with \texttt{\string\xmpcomma}. Unfortunately, my \tex\ skills |
| 1596 |
% are insufficient to pull that off. If you know a way to make |
| 1597 |
% \texttt{\string\xmpquote\string{Hello, world\string}} work with both |
| 1598 |
% \term{Unicode} and non-\term{Unicode} encodings and with all |
| 1599 |
% \tex\ engines (\pdfTeX, \LuaTeX, \XeTeX, etc.), please send me a code |
| 1600 |
% patch. |
| 1601 |
% |
| 1602 |
% \appendix |
| 1603 |
% |
| 1604 |
% \section{Sample XMP Packet} |
| 1605 |
% \label{sec:sample-packet} |
| 1606 |
% |
| 1607 |
% The following is an example of a complete \acro{XMP} packet as may be |
| 1608 |
% produced by \pkgname{hyperxmp}. This packet corresponds to the |
| 1609 |
% metadata included in the sample \LaTeX\ document presented |
| 1610 |
% \vpagerefrange{page:begin-sample-doc}{page:end-sample-doc}. For |
| 1611 |
% clarity, metadata values, either specified explicitly by the document |
| 1612 |
% or introduced automatically by \pkgname{hyperxmp}, are colored blue. |
| 1613 |
% |
| 1614 |
% \input{einstein-xmp} |
| 1615 |
% |
| 1616 |
% \begin{thebibliography}{99} |
| 1617 |
% \bibitem{NISO2008:jav} |
| 1618 |
% Beverley Acreman, Claire Bird, Catherine Jones, Peter McCracken, Cliff Morgan, |
| 1619 |
% John Ober, Evan Owens, T.~Scott Plutchak, Bernie Rous, and Andrew Wray. |
| 1620 |
% \newblock {J}ournal {A}rticle {V}ersions ({JAV}): Recommendations of the |
| 1621 |
% {NISO}/{ALPSP} {JAV} {T}echnical {W}orking {G}roup. |
| 1622 |
% \newblock Recommended practice, National Information Standards Organization, |
| 1623 |
% Baltimore, Maryland, USA, April 2008. |
| 1624 |
% \newblock ISBN~\mbox{978-1-880124-79-6}. |
| 1625 |
% \newblock Available from |
| 1626 |
% \url{https://www.niso.org/sites/default/files/2017-08/RP-8-2008.pdf}. |
| 1627 |
% |
| 1628 |
% \bibitem{Adobe2010:pdfmark} |
| 1629 |
% Adobe Systems, Inc., San Jose, California. |
| 1630 |
% \newblock \emph{{A}dobe {A}crobat~{X} {SDK} Help, pdfmark Reference}. |
| 1631 |
% \newblock Available from |
| 1632 |
% \url{http://www.adobe.com/devnet/acrobat/documentation.html}. |
| 1633 |
% |
| 1634 |
% \bibitem{Adobe1996:postscript} |
| 1635 |
% {Adobe Systems, Inc.} |
| 1636 |
% \newblock \emph{{P}ost{S}cript Language Reference Manual}. |
| 1637 |
% \newblock Addison-Wesley, 2nd edition, January 1996, ISBN: \mbox{0-201-18127-4}. |
| 1638 |
% |
| 1639 |
% \bibitem{Adobe2008:PDF} |
| 1640 |
% Adobe Systems, Inc., San Jose, California. |
| 1641 |
% \newblock \emph{Document Management---Portable Document Format---Part 1: |
| 1642 |
% PDF~1.7}, July 2008. |
| 1643 |
% \newblock ISO \mbox{32000-1} standard document. Available from |
| 1644 |
% \url{http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf}. |
| 1645 |
% |
| 1646 |
% \bibitem{Adobe2012:XMP} |
| 1647 |
% Adobe Systems, Inc., San Jose, California. |
| 1648 |
% \newblock \emph{{XMP} Specification Part~1: Data model, Serialization, and Core |
| 1649 |
% Properties}, April 2012. |
| 1650 |
% \newblock Available from |
| 1651 |
% \url{http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/cc-201306/XMPSpecificationPart1.pdf}. |
| 1652 |
% |
| 1653 |
% \bibitem{DCMI2012:meta-terms} |
| 1654 |
% DCMI Usage Board |
| 1655 |
% \newblock \emph{DCMI Metadata Terms}, June~14, 2012. |
| 1656 |
% \newblock Available from \url{http://dublincore.org/documents/dcmi-terms/}. |
| 1657 |
% |
| 1658 |
% \bibitem{Downes1994:ATB15} |
| 1659 |
% Michael Downes. |
| 1660 |
% \newblock Around the bend~\#15, answers, 4th (last) installment. |
| 1661 |
% \newblock \href{news:comp.text.tex}{\texttt{comp.text.tex}} newsgroup posting, |
| 1662 |
% January~3, 1994. |
| 1663 |
% \newblock Archived by Google at |
| 1664 |
% \url{http://groups.google.com/group/comp.text.tex/msg/7da7643b9e8f3b48}. |
| 1665 |
% |
| 1666 |
% \bibitem{PRISM2012:basic-meta} |
| 1667 |
% International Digital Enterprise Alliance, Inc. |
| 1668 |
% \newblock \emph{Publishing Requirements for Industry Standard Metadata, |
| 1669 |
% Version~3.0: {PRISM} Basic Metadata Specification}, October~12, 2012. |
| 1670 |
% \newblock Available from |
| 1671 |
% \url{http://www.prismstandard.org/specifications/3.0/PRISM_Basic_Metadata_3.0.htm}. |
| 1672 |
% |
| 1673 |
% \bibitem{PRISM2012:cont-voc} |
| 1674 |
% International Digital Enterprise Alliance, Inc. |
| 1675 |
% \newblock \emph{Publishing Requirements for Industry Standard Metadata, |
| 1676 |
% Version~3.0: {PRISM} Controlled Vocabularies Specification}, October~4, 2012. |
| 1677 |
% \newblock Available from |
| 1678 |
% \url{http://www.prismstandard.org/specifications/3.0/PRISM_CV_Spec_3.0.pdf}. |
| 1679 |
% |
| 1680 |
% \bibitem{IPTC2010:photo-meta} |
| 1681 |
% International Press Telecommunications Council. |
| 1682 |
% \newblock \emph{{IPTC} Photo Metadata: Core 1.1/Extension 1.1}, July 2010. |
| 1683 |
% \newblock Revision~1. Available from |
| 1684 |
% \url{http://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata-201007_1.pdf}. |
| 1685 |
% |
| 1686 |
% \bibitem{IANA2011:lang-tags} |
| 1687 |
% {Internet Assigned Numbers Authority}. |
| 1688 |
% \newblock Language subtag registry, January~11, 2011. |
| 1689 |
% \newblock Available from |
| 1690 |
% \url{http://www.iana.org/assignments/language-subtag-registry}. |
| 1691 |
% |
| 1692 |
% \bibitem{Leach2005:uuid} |
| 1693 |
% Paul~J. Leach, Michael Mealling, and Rich Salz. |
| 1694 |
% \newblock A {U}niversally {U}nique {ID}entifier ({UUID}) {URN} namespace. |
| 1695 |
% \newblock Request for Comments 4122, Internet Engineering Task Force, Network |
| 1696 |
% Working Group, July 2005. |
| 1697 |
% \newblock Category: Standards Track. Available from |
| 1698 |
% \url{http://www.ietf.org/rfc/rfc4122.txt}. |
| 1699 |
% |
| 1700 |
% \bibitem{PDFA2008:xmp-props} |
| 1701 |
% PDF/A Competence Center, Berlin, Germany. |
| 1702 |
% \newblock \emph{{T}ech{N}ote~0008: Predefined {XMP} Properties in {PDF/A-1}}, |
| 1703 |
% March~20, 2008. |
| 1704 |
% \newblock Available from |
| 1705 |
% \url{http://www.pdfa.org/wp-content/uploads/2011/08/tn0008_predefined_xmp_properties_in_pdfa-1_2008-03-20.pdf}. |
| 1706 |
% |
| 1707 |
% \bibitem{PDFA2008:ext-schemas} |
| 1708 |
% PDF/A Competence Center, Berlin, Germany. |
| 1709 |
% \newblock \emph{{T}ech{N}ote~0009: {XMP} Extension Schemas in {PDF/A-1}}, |
| 1710 |
% March~20, 2008. |
| 1711 |
% \newblock Available from |
| 1712 |
% \url{http://www.pdfa.org/wp-content/uploads/2011/08/tn0009_xmp_extension_schemas_in_pdfa-1_2008-03-20.pdf}. |
| 1713 |
% |
| 1714 |
% \bibitem{Wolf1997:date-time} |
| 1715 |
% Misha Wolf and Charles Wicksteed. |
| 1716 |
% \newblock Date and time formats. |
| 1717 |
% \newblock Note NOTE-datetime, World Wide Web Consortium (W3C), September~15, |
| 1718 |
% 1997. |
| 1719 |
% \newblock Available from \url{http://www.w3.org/TR/NOTE-datetime}. |
| 1720 |
% \end{thebibliography} |
| 1721 |
% } |
| 1722 |
% |
| 1723 |
% |
| 1724 |
% \section{Implementation} |
| 1725 |
% |
| 1726 |
% This section presents the commented \LaTeX\ source code for |
| 1727 |
% \pkgname{hyperxmp}. Read this section only if you want to learn how |
| 1728 |
% \pkgname{hyperxmp} is implemented. |
| 1729 |
% |
| 1730 |
% \bigskip |
| 1731 |
% |
| 1732 |
% One thing to bear in mind when reading the \pkgname{hyperxmp} source |
| 1733 |
% code is that different actions occur at different times throughout |
| 1734 |
% document processing: |
| 1735 |
% |
| 1736 |
% \begin{enumerate} |
| 1737 |
% \item |\usepackage{hyperxmp}|: \pkgname{hyperxmp} parses package |
| 1738 |
% options, defines a number of commands, loads various helper |
| 1739 |
% packages, and assigns default values to most \acro{XMP} fields. |
| 1740 |
% |
| 1741 |
% \item |\begin{document}|: \pkgname{hyperxmp} loads certain packages |
| 1742 |
% such as \pkgname{hyperref} and \pkgname{ifdraft} and queries |
| 1743 |
% natural-language information from \pkgname{babel} and |
| 1744 |
% \pkgname{polyglossia} that becomes available only at the end of |
| 1745 |
% the preamble. |
| 1746 |
% |
| 1747 |
% \item |\end{document}|: \pkgname{hyperxmp} finalizes certain data |
| 1748 |
% that are known only at the end of the document, such as the page |
| 1749 |
% count, and writes the \acro{XMP} packet to the \acro{PDF} file. |
| 1750 |
% \end{enumerate} |
| 1751 |
% |
| 1752 |
% \iffalse |
| 1753 |
%<*package> |
| 1754 |
% \fi |
| 1755 |
% |
| 1756 |
% \subsection{Initial preparation} |
| 1757 |
% \label{sec:initial-prep} |
| 1758 |
% |
| 1759 |
% \changes{v5.11}{2022/10/02}{Disable \protect\pkgname{hyperxmp} if |
| 1760 |
% \LaTeX3 document metadata is available. Document metadata implies |
| 1761 |
% the presence of PDF management, which completely breaks |
| 1762 |
% \protect\pkgname{hyperxmp}} |
| 1763 |
% \begin{macrocode} |
| 1764 |
\IfDocumentMetadataTF{% |
| 1765 |
\PackageWarning |
| 1766 |
{hyperxmp} |
| 1767 |
{Disabling hyperxmp because it is incompatible with PDF management} |
| 1768 |
}{} |
| 1769 |
\IfDocumentMetadataTF{\endinput}{} |
| 1770 |
% \end{macrocode} |
| 1771 |
% |
| 1772 |
% \changes{v1.2}{2011/04/17}{Made the package compatible with \pkgname{ngerman}. |
| 1773 |
% Thanks to Tobias Mueller for the bug report.} |
| 1774 |
% |
| 1775 |
% \begin{macro}{\hyxmp@dq@code} |
| 1776 |
% The \pkgname{ngerman} package redefines |
| 1777 |
% ``\,{\fontencoding{T1}\selectfont\textquotedbl}\,'' as an active |
| 1778 |
% character, which causes problems for \pkgname{hyperxmp} when it tries |
| 1779 |
% to use that character. We therefore save the double-quote character's |
| 1780 |
% current category code in |\hyxmp@dq@code| and mark the character as |
| 1781 |
% category code~12 (``other''). The original category code is restored |
| 1782 |
% at the end of the package code (Section~\ref{sec:clean-up}). |
| 1783 |
% \begin{macrocode} |
| 1784 |
\edef\hyxmp@dq@code{\the\catcode`\"} |
| 1785 |
\catcode`\"=12 |
| 1786 |
% \end{macrocode} |
| 1787 |
% \end{macro} |
| 1788 |
% |
| 1789 |
% \changes{v1.5}{2012/03/10}{Made the \protect\acro{XMP} inclusion more robust. |
| 1790 |
% Thanks to Heiko Oberdiek for the bug report and suggested modifications.} |
| 1791 |
% |
| 1792 |
% \begin{macro}{\hyxmp@at@end} |
| 1793 |
% The |\hyxmp@at@end| macro includes code at the end of the document. |
| 1794 |
% When available (as is the case in most modern \tex\ backends), |
| 1795 |
% \cs{AtEndDocument} works well enough. Otherwise, we invoke |
| 1796 |
% \cs{AtEndDvi} from the \pkgname{atenddvi} package, which is robust but |
| 1797 |
% requires an addition \LaTeX\ run. |
| 1798 |
% \changes{v5.3}{2020/05/29}{Use \protect\cs{AtEndDocument} in all |
| 1799 |
% \protect\tex\ back ends that provide it. Thanks to Nelson Posse |
| 1800 |
% Lago for pointing out why \protect\pkgname{atenddvi} is best avoided |
| 1801 |
% if possible} |
| 1802 |
% \changes{v5.11}{2022/10/16}{Use \protect\cs{AddToHook} when available. |
| 1803 |
% This addresses a bug reported on \protect\TeX\ StackExchange by joHub |
| 1804 |
% and solved by Ulrike Fischer} |
| 1805 |
% \begin{macrocode} |
| 1806 |
\@ifundefined{AddToHook}{% |
| 1807 |
\@ifundefined{AtEndDocument}{% |
| 1808 |
\RequirePackage{atenddvi} |
| 1809 |
\let\hyxmp@at@end=\AtEndDvi |
| 1810 |
}{% |
| 1811 |
\let\hyxmp@at@end=\AtEndDocument |
| 1812 |
} |
| 1813 |
}{% |
| 1814 |
\def\hyxmp@at@end{\AddToHook{shipout/lastpage}} |
| 1815 |
} |
| 1816 |
% \end{macrocode} |
| 1817 |
% \end{macro} |
| 1818 |
% |
| 1819 |
% \begin{macro}{\hyxmp@set@jobname} |
| 1820 |
% Given an expanded \cs{jobname} followed by \cs{relax}, invoke the |
| 1821 |
% \cs{hyxmp@set@jobname@dbl} macro if the job name is surrounded by |
| 1822 |
% double quotes and the \cs{hyxmp@set@jobname@plain} macro otherwise. |
| 1823 |
% \begin{macrocode} |
| 1824 |
\def\hyxmp@set@jobname#1\relax{% |
| 1825 |
\@ifnextchar"{\hyxmp@set@jobname@dbl}{\hyxmp@set@jobname@plain}#1\relax |
| 1826 |
} |
| 1827 |
% \end{macrocode} |
| 1828 |
% \end{macro} |
| 1829 |
% |
| 1830 |
% \begin{macro}{\hyxmp@set@jobname@dbl} |
| 1831 |
% \begin{macro}{\hyxmp@jobname} |
| 1832 |
% Set \cs{hyxmp@jobname} to to |#1|, discarding the surrounding double |
| 1833 |
% quotes. |
| 1834 |
% \begin{macrocode} |
| 1835 |
\def\hyxmp@set@jobname@dbl"#1"\relax{\xdef\hyxmp@jobname{#1}} |
| 1836 |
% \end{macrocode} |
| 1837 |
% \end{macro} |
| 1838 |
% \end{macro} |
| 1839 |
% |
| 1840 |
% \begin{macro}{\hyxmp@set@jobname@plain} |
| 1841 |
% \begin{macro}{\hyxmp@jobname} |
| 1842 |
% Set \cs{hyxmp@jobname} to to |#1|. |
| 1843 |
% \begin{macrocode} |
| 1844 |
\def\hyxmp@set@jobname@plain#1\relax{\xdef\hyxmp@jobname{#1}} |
| 1845 |
% \end{macrocode} |
| 1846 |
% \end{macro} |
| 1847 |
% \end{macro} |
| 1848 |
% |
| 1849 |
% Define \cs{hyxmp@jobname} as a sanitized version of \cs{jobname}. The |
| 1850 |
% problem with using \cs{jobname} directly is that it surrounds the |
| 1851 |
% filename with double quotes if it contains a space character. For |
| 1852 |
% example, a source file named \texttt{my-file.tex} results in a |
| 1853 |
% \cs{jobname} of ``\texttt{my-file}'', but a source file named |
| 1854 |
% \texttt{my file.tex} results in a \cs{jobname} of ``|"my file"|''. |
| 1855 |
% Trying to access |"my file".log| (as is done on |
| 1856 |
% page~\pageref{page:jobname-log}) will fail because the filename does |
| 1857 |
% not in fact contain literal double quotes. |
| 1858 |
% \changes{v5.5}{2020/07/28}{Correctly handle source files with spaces |
| 1859 |
% in their name. Thanks to Peter Dyballa for the bug report} |
| 1860 |
% \begin{macrocode} |
| 1861 |
\expandafter\hyxmp@set@jobname\jobname\relax |
| 1862 |
% \end{macrocode} |
| 1863 |
% |
| 1864 |
% \begin{macro}{\hyxmp@aep@toks} |
| 1865 |
% In order for \pkgname{hyperxmp} to be loaded safely during |
| 1866 |
% \cs{AtEndPreamble} we need to ensure that we perform no |
| 1867 |
% \cs{AtEndPreamble} actions until all top-level macro definitions have |
| 1868 |
% been made. The most straightforward approach would be to move all of |
| 1869 |
% \pkgname{hyperxmp}'s \cs{AtEndPreamble} stanzas to the end of the |
| 1870 |
% package. However, this degrades readability of the source code. For |
| 1871 |
% instance, an \cs{AtEndPreamble} stanza related to integration with |
| 1872 |
% \pkgname{hyperref} could no longer appear in the ``Integration with |
| 1873 |
% \pkgname{hyperref}'' section (Section~\ref{sec:hyperref-int}). Hence, |
| 1874 |
% we instead store in a token list, \cs{hyxmp@aep@toks}, each |
| 1875 |
% \cs{AtEndPreamble} stanza as we encounter it. This token list is |
| 1876 |
% evaluated as one of the package's final actions |
| 1877 |
% (Section~\ref{sec:clean-up}). |
| 1878 |
% \begin{macrocode} |
| 1879 |
\newtoks{\hyxmp@aep@toks} |
| 1880 |
% \end{macrocode} |
| 1881 |
% \end{macro} |
| 1882 |
% |
| 1883 |
% |
| 1884 |
% \subsection{Integration with \textsf{hyperref}} |
| 1885 |
% \label{sec:hyperref-int} |
| 1886 |
% |
| 1887 |
% An important design decision underlying \pkgname{hyperxmp} is that the |
| 1888 |
% package should integrate seamlessly with \pkgname{hyperref}. To that |
| 1889 |
% end, \pkgname{hyperxmp} takes \acro{XMP} metadata from |
| 1890 |
% \pkgname{hyperref}'s \optname{baseurl}, \optname{pdfauthor}, |
| 1891 |
% \optname{pdfkeywords}, \optname{pdflang}, \optname{pdfproducer}, |
| 1892 |
% \optname{pdfsubject}, \optname{pdftrapped}, and \optname{pdftitle} |
| 1893 |
% options. It also introduces a number of new options, which are listed |
| 1894 |
% \vpagerefrange[above]{page:begin-new-options}{page:end-new-options}. |
| 1895 |
% For consistency with \pkgname{hyperref}'s document-metadata naming |
| 1896 |
% conventions (which are in turn based on \LaTeX's document-metadata |
| 1897 |
% naming conventions), we do not prefix metadata-related macro names |
| 1898 |
% with our package-specific |\hyxmp@| prefix. That is, we use names |
| 1899 |
% like |\@pdfcopyright| instead of |\hyxmp@pdfcopyright|. |
| 1900 |
% |
| 1901 |
% \bigskip |
| 1902 |
% |
| 1903 |
% We load a bunch of helper packages: \pkgname{kvoptions} for |
| 1904 |
% package-option processing, \pkgname{pdfescape} and \pkgname{stringenc} |
| 1905 |
% for re-encoding \term{Unicode} strings, \pkgname{intcalc} for |
| 1906 |
% performing integer calculations (division and modulo), \pkgname{iftex} |
| 1907 |
% for determining which \tex\ engine is being used, \pkgname{ifmtarg} |
| 1908 |
% for testing if a macro argument is empty or all spaces, |
| 1909 |
% \pkgname{etoolbox} for dynamically patching existing commands |
| 1910 |
% (specifically, \pkgname{hyperref}'s |\PDF@FinishDoc|), and |
| 1911 |
% \pkgname{ifthen} for convenient string comparisons. |
| 1912 |
% \begin{macrocode} |
| 1913 |
\RequirePackage{kvoptions} |
| 1914 |
\RequirePackage{pdfescape} |
| 1915 |
\RequirePackage{stringenc} |
| 1916 |
\RequirePackage{intcalc} |
| 1917 |
\RequirePackage{iftex} |
| 1918 |
\RequirePackage{ifmtarg} |
| 1919 |
\RequirePackage{etoolbox} |
| 1920 |
\RequirePackage{ifthen} |
| 1921 |
% \end{macrocode} |
| 1922 |
% |
| 1923 |
% There are a few places where \pkgname{hyperxmp} can take advantage of |
| 1924 |
% \LuaTeX\ features. To simplify the use of \LuaTeX\ we load the |
| 1925 |
% \pkgname{luacode} package. |
| 1926 |
% \begin{macrocode} |
| 1927 |
\ifLuaTeX |
| 1928 |
\RequirePackage{luacode} |
| 1929 |
\fi |
| 1930 |
% \end{macrocode} |
| 1931 |
% |
| 1932 |
% \begin{macro}{\@ifmtargexp} |
| 1933 |
% \begin{macro}{\@ifnotmtargexp} |
| 1934 |
% |\@ifmtarg| and |\@ifnotmtarg| do not expand their first argument. |
| 1935 |
% Define |\@ifmtargexp| and |\@ifnotmtargexp| as expanding versions of |
| 1936 |
% those macros. |
| 1937 |
% \begin{macrocode} |
| 1938 |
\def\@ifmtargexp#1{\expandafter\@ifmtarg\expandafter{#1}} |
| 1939 |
\def\@ifnotmtargexp#1{\expandafter\@ifnotmtarg\expandafter{#1}} |
| 1940 |
% \end{macrocode} |
| 1941 |
% \end{macro} |
| 1942 |
% \end{macro} |
| 1943 |
% |
| 1944 |
% \begin{macro}{\@if@def@and@nonempty} |
| 1945 |
% This macro combines \cs{@ifundefined} and \cs{@ifmtargexp}. If the |
| 1946 |
% macro named |#1| is both defined and non-empty, evaluate~|#2|. |
| 1947 |
% Otherwise, evaluate~|#3|. |
| 1948 |
% \changes{v5.3}{2020/06/07}{Added this macro} |
| 1949 |
% \begin{macrocode} |
| 1950 |
\newcommand*{\@if@def@and@nonempty}[3]{% |
| 1951 |
\@ifundefined{#1}{#3}{% |
| 1952 |
\expandafter\@ifmtargexp\expandafter{\csname#1\endcsname}{#3}{#2}% |
| 1953 |
}% |
| 1954 |
} |
| 1955 |
% \end{macrocode} |
| 1956 |
% \end{macro} |
| 1957 |
% |
| 1958 |
% \begin{macro}{\hyxmp@pdfstringdef} |
| 1959 |
% \begin{macro}{\hyxmp@textunderscore} |
| 1960 |
% Because \pkgname{hyperxmp} uses underscores to represent hard spaces, |
| 1961 |
% we need ``|\_|'' to map initially to something other than an |
| 1962 |
% underscore, in particular the \acro{ASCII} \acro{NAK}~(|^^U|) |
| 1963 |
% character. To accomplish this, we wrap \pkgname{hyperref}'s |
| 1964 |
% |\pdfstringdef| macro with our own version that temporarily does the |
| 1965 |
% proper substitution. Later in the execution, after underscores have |
| 1966 |
% been replaced with spaces, we replace \acro{NAK} characters with |
| 1967 |
% underscores. |
| 1968 |
% \changes{v2.5}{2014/06/19}{Added this macro} |
| 1969 |
% \begin{macrocode} |
| 1970 |
\newcommand{\hyxmp@pdfstringdef}[2]{% |
| 1971 |
\let\hyxmp@textunderscore=\textunderscore |
| 1972 |
\let\textunderscore=\hyxmp@uscore |
| 1973 |
\pdfstringdef{#1}{#2}% |
| 1974 |
\let\textunderscore=\hyxmp@textunderscore |
| 1975 |
} |
| 1976 |
% \end{macrocode} |
| 1977 |
% \end{macro} |
| 1978 |
% \end{macro} |
| 1979 |
% |
| 1980 |
% \begin{macro}{\@pdfdatetime} |
| 1981 |
% Prepare to store the document's date and (optionally) time. Whether |
| 1982 |
% specified by the author in \acro{XMP} format or \acro{PDF} format |
| 1983 |
% (see Section~\ref{sec:date-manip}) we always store |\@pdfdatetime| as |
| 1984 |
% an \acro{XMP}-format string. |
| 1985 |
% \begin{macrocode} |
| 1986 |
\def\@pdfdatetime{} |
| 1987 |
\define@key{Hyp}{pdfdate}{% |
| 1988 |
\begingroup |
| 1989 |
\Hy@unicodefalse |
| 1990 |
% \end{macrocode} |
| 1991 |
% \begin{macro}{\next} |
| 1992 |
% Expand \optname{pdfdate}'s argument and convert it to \acro{XMP} format. |
| 1993 |
% \begin{macrocode} |
| 1994 |
\edef\next{% |
| 1995 |
\noexpand\hyxmp@pdfstringdef\noexpand\@pdfdatetime{% |
| 1996 |
\noexpand\hyxmp@as@xmp@date{#1}}% |
| 1997 |
}% |
| 1998 |
\next |
| 1999 |
\endgroup |
| 2000 |
} |
| 2001 |
% \end{macrocode} |
| 2002 |
% \end{macro} |
| 2003 |
% \end{macro} |
| 2004 |
% |
| 2005 |
% \begin{macro}{\@pdfmetadatetime} |
| 2006 |
% Prepare to store the document's metadata date and (optionally) time. |
| 2007 |
% Whether specified by the author in \acro{XMP} format or \acro{PDF} |
| 2008 |
% format (see Section~\ref{sec:date-manip}) we always store |
| 2009 |
% |\@pdfmetadatetime| as an \acro{XMP}-format string. |
| 2010 |
% \begin{macrocode} |
| 2011 |
\def\@pdfmetadatetime{} |
| 2012 |
\define@key{Hyp}{pdfmetadate}{% |
| 2013 |
\begingroup |
| 2014 |
\Hy@unicodefalse |
| 2015 |
% \end{macrocode} |
| 2016 |
% \begin{macro}{\next} |
| 2017 |
% Expand \optname{pdfmetadate}'s argument and convert it to \acro{XMP} format. |
| 2018 |
% \begin{macrocode} |
| 2019 |
\edef\next{% |
| 2020 |
\noexpand\hyxmp@pdfstringdef\noexpand\@pdfmetadatetime{% |
| 2021 |
\noexpand\hyxmp@as@xmp@date{#1}}% |
| 2022 |
}% |
| 2023 |
\next |
| 2024 |
\endgroup |
| 2025 |
} |
| 2026 |
% \end{macrocode} |
| 2027 |
% \end{macro} |
| 2028 |
% \end{macro} |
| 2029 |
% |
| 2030 |
% \begin{macro}{\@pdfcopyright} |
| 2031 |
% Prepare to store the document's copyright statement. |
| 2032 |
% \begin{macrocode} |
| 2033 |
\def\@pdfcopyright{} |
| 2034 |
\define@key{Hyp}{pdfcopyright}{\hyxmp@pdfstringdef\@pdfcopyright{#1}} |
| 2035 |
% \end{macrocode} |
| 2036 |
% \end{macro} |
| 2037 |
% |
| 2038 |
% \begin{macro}{\@pdftype} |
| 2039 |
% Prepare to store the document's logical type, which defaults to ``|Text|''. |
| 2040 |
% \begin{macrocode} |
| 2041 |
\def\@pdftype{Text} |
| 2042 |
\define@key{Hyp}{pdftype}{\hyxmp@pdfstringdef\@pdftype{#1}} |
| 2043 |
% \end{macrocode} |
| 2044 |
% \end{macro} |
| 2045 |
% |
| 2046 |
% \begin{macro}{\@pdflicenseurl} |
| 2047 |
% Prepare to store the \acro{URL} containing the document's license |
| 2048 |
% agreement. |
| 2049 |
% \begin{macrocode} |
| 2050 |
\def\@pdflicenseurl{} |
| 2051 |
\define@key{Hyp}{pdflicenseurl}{\hyxmp@pdfstringdef\@pdflicenseurl{#1}} |
| 2052 |
% \end{macrocode} |
| 2053 |
% \end{macro} |
| 2054 |
% |
| 2055 |
% \begin{macro}{\@pdfauthortitle} |
| 2056 |
% Prepare to store the author's position/title (e.g.,~Staff Writer). |
| 2057 |
% \begin{macrocode} |
| 2058 |
\def\@pdfauthortitle{} |
| 2059 |
\define@key{Hyp}{pdfauthortitle}{\hyxmp@pdfstringdef\@pdfauthortitle{#1}} |
| 2060 |
% \end{macrocode} |
| 2061 |
% \end{macro} |
| 2062 |
% |
| 2063 |
% \begin{macro}{\@pdfcaptionwriter} |
| 2064 |
% Prepare to store the name of the person who inserted the |
| 2065 |
% \pkgname{hyperxmp} metadata. |
| 2066 |
% \begin{macrocode} |
| 2067 |
\def\@pdfcaptionwriter{} |
| 2068 |
\define@key{Hyp}{pdfcaptionwriter}{\hyxmp@pdfstringdef\@pdfcaptionwriter{#1}} |
| 2069 |
% \end{macrocode} |
| 2070 |
% \end{macro} |
| 2071 |
% |
| 2072 |
% \begin{macro}{\@pdfmetalang} |
| 2073 |
% Prepare to store the natural language of the document's metadata, |
| 2074 |
% typically as an \acro{ISO}~\mbox{639-1} two-letter abbreviation. |
| 2075 |
% \begin{macrocode} |
| 2076 |
\def\@pdfmetalang{} |
| 2077 |
\define@key{Hyp}{pdfmetalang}{\hyxmp@pdfstringdef\@pdfmetalang{#1}} |
| 2078 |
% \end{macrocode} |
| 2079 |
% \end{macro} |
| 2080 |
% |
| 2081 |
% \begin{macro}{\hyxmp@no@bad@parts} |
| 2082 |
% Complain about a bad \optname{pdfapart} or \optname{pdfuapart} if given |
| 2083 |
% trailing non-digits after a part number. |
| 2084 |
% \begin{macrocode} |
| 2085 |
\def\hyxmp@no@bad@parts#1\relax{% |
| 2086 |
\@ifnotmtarg{#1}{% |
| 2087 |
\PackageWarning{hyperxmp}{pdfapart and pdfuapart must be numeric}% |
| 2088 |
}% |
| 2089 |
} |
| 2090 |
% \end{macrocode} |
| 2091 |
% \end{macro} |
| 2092 |
% |
| 2093 |
% \begin{macro}{\@hyxmp@count} |
| 2094 |
% \changes{v5.11}{2022/10/02}{Added this macro to fix a bug with |
| 2095 |
% \protect\optname{pdfapart}. Thanks to John H. Lienhard and |
| 2096 |
% Kartik Singhal for their bug reports} |
| 2097 |
% Define a temporary counter. The code previously used \cs{@tempcnta}, |
| 2098 |
% but this is no longer safe within \cs{pdfstringdef} as of more recent |
| 2099 |
% versions of \pkgname{hyperref}. |
| 2100 |
% \begin{macrocode} |
| 2101 |
\newcount\@hyxmp@count |
| 2102 |
% \end{macrocode} |
| 2103 |
% \end{macro} |
| 2104 |
% |
| 2105 |
% \begin{macro}{\@pdfapart} |
| 2106 |
% Prepare to store the \acro{PDF/A} part ID, which defaults to~``1'' |
| 2107 |
% if \optname{pdfa} is passed to \pkgname{hyperref}. |
| 2108 |
% \begin{macrocode} |
| 2109 |
\def\@pdfapart{} |
| 2110 |
\define@key{Hyp}{pdfapart}{% |
| 2111 |
\afterassignment\hyxmp@no@bad@parts\@hyxmp@count=0#1\relax |
| 2112 |
\hyxmp@pdfstringdef\@pdfapart{\the\@hyxmp@count}% |
| 2113 |
} |
| 2114 |
% \end{macrocode} |
| 2115 |
% \end{macro} |
| 2116 |
% |
| 2117 |
% \begin{macro}{\@pdfaconformance} |
| 2118 |
% Prepare to store the \acro{PDF/A} conformance ID, which defaults to~``b'' |
| 2119 |
% if \optname{pdfa} is passed to \pkgname{hyperref} and |\@pdfapart| is |
| 2120 |
% empty. |
| 2121 |
% \begin{macrocode} |
| 2122 |
\def\@pdfaconformance{} |
| 2123 |
\define@key{Hyp}{pdfaconformance}{% |
| 2124 |
\uppercase{\hyxmp@pdfstringdef\@pdfaconformance{#1}}% |
| 2125 |
} |
| 2126 |
% \end{macrocode} |
| 2127 |
% \end{macro} |
| 2128 |
% |
| 2129 |
% \begin{macro}{\@pdfuapart} |
| 2130 |
% Prepare to store the \acro{PDF/UA} part ID. |
| 2131 |
% \begin{macrocode} |
| 2132 |
\def\@pdfuapart{} |
| 2133 |
\define@key{Hyp}{pdfuapart}{% |
| 2134 |
\afterassignment\hyxmp@no@bad@parts\@hyxmp@count=0#1\relax |
| 2135 |
\hyxmp@pdfstringdef\@pdfuapart{\the\@hyxmp@count}% |
| 2136 |
} |
| 2137 |
% \end{macrocode} |
| 2138 |
% \end{macro} |
| 2139 |
% |
| 2140 |
% \begin{macro}{\hyxmp@set@pdfx@major} |
| 2141 |
% Parse \optname{pdfxstandard} as ``|PDF/X-|\meta{major}\meta{other}'', |
| 2142 |
% setting |\hyxmp@pdfx@major| to \meta{major}. |
| 2143 |
% \begin{macrocode} |
| 2144 |
\newcommand*{\hyxmp@set@pdfx@major}[1]{\hyxmp@set@pdfx@major@i#1!} |
| 2145 |
% \end{macrocode} |
| 2146 |
% \end{macro} |
| 2147 |
% |
| 2148 |
% \begin{macro}{\hyxmp@set@pdfx@major@i} |
| 2149 |
% This is the first helper macro for |\hyxmp@set@pdfx@major|. It stores |
| 2150 |
% the \acro{PDF/X} major version in |\@hyxmp@count|. |
| 2151 |
% \begin{macrocode} |
| 2152 |
\def\hyxmp@set@pdfx@major@i PDF/X-{% |
| 2153 |
\afterassignment\hyxmp@set@pdfx@major@ii |
| 2154 |
\@hyxmp@count=% |
| 2155 |
} |
| 2156 |
% \end{macrocode} |
| 2157 |
% \end{macro} |
| 2158 |
% |
| 2159 |
% \begin{macro}{\hyxmp@set@pdfx@major@ii} |
| 2160 |
% \begin{macro}{\hyxmp@pdfx@major} |
| 2161 |
% This is the second helper macro for |\hyxmp@set@pdfx@major|. It |
| 2162 |
% copies the \acro{PDF/X} major version from |\@hyxmp@count| to |
| 2163 |
% |\@hyxmp@pdfx@major| and discards the rest of the \acro{PDF/X} |
| 2164 |
% standard string. |
| 2165 |
% \begin{macrocode} |
| 2166 |
\def\hyxmp@set@pdfx@major@ii#1!{% |
| 2167 |
\edef\hyxmp@pdfx@major{\the\@hyxmp@count}% |
| 2168 |
} |
| 2169 |
% \end{macrocode} |
| 2170 |
% \end{macro} |
| 2171 |
% \end{macro} |
| 2172 |
% |
| 2173 |
% \begin{macro}{\hyxmp@check@std} |
| 2174 |
% \changes{v5.0}{2020/03/10}{Added this macro} |
| 2175 |
% Compare a user-provided string to a fixed string. (Assumption: Both |
| 2176 |
% are names of \acro{PDF/X} standard versions.) If they match, undefine |
| 2177 |
% |\next|, which we assume was previously defined to issue an |
| 2178 |
% ``unrecognized standard'' warning message. |
| 2179 |
% \begin{macrocode} |
| 2180 |
\newcommand*\hyxmp@check@std[2]{% |
| 2181 |
\ifthenelse{\equal{#1}{#2}}% |
| 2182 |
{\global\let\next=\relax}% |
| 2183 |
{}% |
| 2184 |
}% |
| 2185 |
% \end{macrocode} |
| 2186 |
% \end{macro} |
| 2187 |
% |
| 2188 |
% \begin{macro}{\@pdfxstandard} |
| 2189 |
% Prepare to store the \acro{PDF/X} standard. |
| 2190 |
% \changes{v5.0}{2020/03/10}{Added this macro} |
| 2191 |
% \begin{macrocode} |
| 2192 |
\def\@pdfxstandard{} |
| 2193 |
\def\hyxmp@pdfx@major{} |
| 2194 |
\define@key{Hyp}{pdfxstandard}{% |
| 2195 |
\hyxmp@pdfstringdef\@pdfxstandard{#1}% |
| 2196 |
% \end{macrocode} |
| 2197 |
% \begin{macro}{\next} |
| 2198 |
% Issue a warning message if the \acro{PDF/X} standard named by the user |
| 2199 |
% does not appear in a list of known \acro{PDF/X} standards. This is to |
| 2200 |
% caution the user that \pkgname{hyperxmp} generates standard-specific |
| 2201 |
% \acro{XMP} metadata and it can only guess at the correct format for |
| 2202 |
% new standard versions. (See the comments on |
| 2203 |
% page~\pageref{page:pdfx-id-schema} above the definition of |
| 2204 |
% |\hyxmp@pdfx@id@schema|, for example.) |
| 2205 |
% \begin{macrocode} |
| 2206 |
\gdef\next{% |
| 2207 |
\PackageWarning{hyperxmp}{Unrecognized PDF/X standard `#1'}% |
| 2208 |
}% |
| 2209 |
\hyxmp@check@std{#1}{PDF/X-1a:2001}% |
| 2210 |
\hyxmp@check@std{#1}{PDF/X-1a:2003}% |
| 2211 |
\hyxmp@check@std{#1}{PDF/X-3:2002}% |
| 2212 |
\hyxmp@check@std{#1}{PDF/X-3:2003}% |
| 2213 |
\hyxmp@check@std{#1}{PDF/X-4}% |
| 2214 |
\hyxmp@check@std{#1}{PDF/X-4p}% |
| 2215 |
\hyxmp@check@std{#1}{PDF/X-5g}% |
| 2216 |
\hyxmp@check@std{#1}{PDF/X-5n}% |
| 2217 |
\hyxmp@check@std{#1}{PDF/X-5pg}% |
| 2218 |
\next |
| 2219 |
% \end{macrocode} |
| 2220 |
% \begin{macro}{\hyxmp@pdfx@major} |
| 2221 |
% Parse the \acro{PDF/X} major version number from |
| 2222 |
% \optname{pdfxstandard} and assign it to |\hyxmp@pdfx@major|. |
| 2223 |
% \begin{macrocode} |
| 2224 |
\hyxmp@set@pdfx@major{#1}% |
| 2225 |
} |
| 2226 |
% \end{macrocode} |
| 2227 |
% \end{macro} |
| 2228 |
% \end{macro} |
| 2229 |
% \end{macro} |
| 2230 |
% |
| 2231 |
% \begin{macro}{\@pdfsource} |
| 2232 |
% Prepare to store the document's source, which defaults to the value of |
| 2233 |
% |\jobname|. |
| 2234 |
% \changes{v3.3}{2017/07/16}{Added this macro and the corresponding |
| 2235 |
% \protect\optname{pdfsource} option, at Niklas Beisert's request} |
| 2236 |
% \begin{macrocode} |
| 2237 |
\edef\@pdfsource{\[email protected]} |
| 2238 |
\define@key{Hyp}{pdfsource}{\hyxmp@pdfstringdef\@pdfsource{#1}} |
| 2239 |
% \end{macrocode} |
| 2240 |
% \end{macro} |
| 2241 |
% |
| 2242 |
% \begin{macro}{\hyxmp@DocumentID} |
| 2243 |
% Prepare to store a \acro{UUID} that represents the document. |
| 2244 |
% \changes{v3.5}{2018/11/27}{Added the \protect\optname{pdfdocumentid} |
| 2245 |
% option, at Michael Osipov's request} |
| 2246 |
% \begin{macrocode} |
| 2247 |
\def\hyxmp@DocumentID{} |
| 2248 |
\define@key{Hyp}{pdfdocumentid}{\hyxmp@pdfstringdef\hyxmp@DocumentID{#1}} |
| 2249 |
% \end{macrocode} |
| 2250 |
% \end{macro} |
| 2251 |
% |
| 2252 |
% \begin{macro}{\hyxmp@InstanceID} |
| 2253 |
% Prepare to store a \acro{UUID} that represents the current instance of |
| 2254 |
% the document. |
| 2255 |
% \changes{v3.5}{2018/11/27}{Added the \protect\optname{pdfinstanceid} |
| 2256 |
% option, at Michael Osipov's request} |
| 2257 |
% \begin{macrocode} |
| 2258 |
\def\hyxmp@InstanceID{} |
| 2259 |
\define@key{Hyp}{pdfinstanceid}{\hyxmp@pdfstringdef\hyxmp@InstanceID{#1}} |
| 2260 |
% \end{macrocode} |
| 2261 |
% \end{macro} |
| 2262 |
% |
| 2263 |
% \begin{macro}{\@pdfversionid} |
| 2264 |
% Prepare to store a string that represents the current version of |
| 2265 |
% the document. It defaults to ``|1|''. |
| 2266 |
% \begin{macrocode} |
| 2267 |
\def\@pdfversionid{1} |
| 2268 |
\define@key{Hyp}{pdfversionid}{\hyxmp@pdfstringdef\@pdfversionid{#1}} |
| 2269 |
% \end{macrocode} |
| 2270 |
% \end{macro} |
| 2271 |
% |
| 2272 |
% \begin{macro}{\ifdraft} |
| 2273 |
% \changes{v5.2}{2020/04/18}{Define \protect\cs{ifdraft} only locally, at |
| 2274 |
% Niklas Beisert's request} |
| 2275 |
% \changes{v5.6}{2020/10/05}{Make conditional the loading of the |
| 2276 |
% \protect\pkgname{ifdraft} package. Thanks to Tobias Pape for |
| 2277 |
% reporting the incompatibility between \protect\pkgname{hyperxmp} and |
| 2278 |
% \protect\pkgname{ifdraft}} |
| 2279 |
% \changes{v5.13}{2024/03/17}{Rewrite \protect\pkgname{ifdraft} handling |
| 2280 |
% to avoid loading a package within a group, which \protect\LaTeX\ |
| 2281 |
% soon will stop supporting. Thanks to Ulrike Fischer and Boris Veytsman |
| 2282 |
% for bringing this to my attention} |
| 2283 |
% \begin{macro}{\next} |
| 2284 |
% Use the \pkgname{ifdraft} package to determine if this is a draft or |
| 2285 |
% final document. The challenge here is that we want to use |
| 2286 |
% \pkgname{ifdraft} if it's already loaded, load it if not, and not |
| 2287 |
% break any incompatible, author-defined \cs{ifdraft} macros that may |
| 2288 |
% occur either before or after the |\usepackage{hyperxmp}|. Our |
| 2289 |
% solution works as follows: |
| 2290 |
% |
| 2291 |
% \begin{itemize} |
| 2292 |
% \item If \pkgname{ifdraft} is already loaded, \cs{next} is defined |
| 2293 |
% as a no-op. |
| 2294 |
% \item If \pkgname{ifdraft} is not (yet) loaded, the code backs up |
| 2295 |
% then undefines \cs{ifdraft}, which may be author-defined. It then |
| 2296 |
% loads \pkgname{ifdraft} and defines \cs{next} to ``unload'' the |
| 2297 |
% package by setting the package's author-visible commands to |
| 2298 |
% \cs{relax}. |
| 2299 |
% \item Below, after \cs{ifdraft} is used to define |
| 2300 |
% \cs{@pdfrendition}, \cs{next} is invoked to unload a |
| 2301 |
% \pkgname{hyperxmp}-loaded \pkgname{ifdraft}. Finally, \cs{ifdraft} |
| 2302 |
% is restored to its original definition. |
| 2303 |
% \end{itemize} |
| 2304 |
% \begin{macrocode} |
| 2305 |
\let\hyxmp@orig@ifdraft=\ifdraft |
| 2306 |
\@ifpackageloaded{ifdraft}{% |
| 2307 |
\let\next=\relax |
| 2308 |
}{% |
| 2309 |
\let\ifdraft=\relax |
| 2310 |
\RequirePackage{ifdraft}% |
| 2311 |
\def\next{% |
| 2312 |
\expandafter\let\csname [email protected]\endcsname=\relax |
| 2313 |
\let\ifdraft=\relax |
| 2314 |
\let\ifoptiondraft=\relax |
| 2315 |
\let\ifoptionfinal=\relax |
| 2316 |
}% |
| 2317 |
}% |
| 2318 |
% \end{macrocode} |
| 2319 |
% \begin{macro}{\@pdfrendition} |
| 2320 |
% \changes{v5.0}{2020/02/27}{Added the \protect\optname{pdfrendition} |
| 2321 |
% option} |
| 2322 |
% Prepare to store a tag describing how this rendition of the document |
| 2323 |
% differs from the master. The default value is |default|, which |
| 2324 |
% indicates the master document, except in the case of |
| 2325 |
% |\documentclass[draft]|, for which |\@pdfrendition| defaults to |
| 2326 |
% |draft|. |
| 2327 |
% \begin{macrocode} |
| 2328 |
\ifdraft{% |
| 2329 |
\def\@pdfrendition{draft}% |
| 2330 |
}{% |
| 2331 |
\def\@pdfrendition{default}% |
| 2332 |
} |
| 2333 |
\next |
| 2334 |
\let\ifdraft=\hyxmp@orig@ifdraft |
| 2335 |
\define@key{Hyp}{pdfrendition}{\hyxmp@pdfstringdef\@pdfrendition{#1}} |
| 2336 |
% \end{macrocode} |
| 2337 |
% \end{macro} |
| 2338 |
% \end{macro} |
| 2339 |
% \end{macro} |
| 2340 |
% |
| 2341 |
% \begin{macro}{\@pdfpublication} |
| 2342 |
% Prepare to store the name of the publication in which the |
| 2343 |
% document was published. |
| 2344 |
% \begin{macrocode} |
| 2345 |
\def\@pdfpublication{} |
| 2346 |
\define@key{Hyp}{pdfpublication}{\hyxmp@pdfstringdef\@pdfpublication{#1}} |
| 2347 |
% \end{macrocode} |
| 2348 |
% \end{macro} |
| 2349 |
% |
| 2350 |
% \begin{macro}{\@pdfpubtype} |
| 2351 |
% Prepare to store the type of the publication in which the |
| 2352 |
% document was published. |
| 2353 |
% \begin{macrocode} |
| 2354 |
\def\@pdfpubtype{} |
| 2355 |
\define@key{Hyp}{pdfpubtype}{\hyxmp@pdfstringdef\@pdfpubtype{#1}} |
| 2356 |
% \end{macrocode} |
| 2357 |
% \end{macro} |
| 2358 |
% |
| 2359 |
% \begin{macro}{\@pdfbytes} |
| 2360 |
% Prepare to store the size of the file in bytes. |
| 2361 |
% \begin{macrocode} |
| 2362 |
\def\@pdfbytes{} |
| 2363 |
\define@key{Hyp}{pdfbytes}{\hyxmp@pdfstringdef\@pdfbytes{#1}} |
| 2364 |
% \end{macrocode} |
| 2365 |
% \end{macro} |
| 2366 |
% |
| 2367 |
% \begin{macro}{\@pdfnumpages} |
| 2368 |
% Prepare to store the number of pages in the file. |
| 2369 |
% \begin{macrocode} |
| 2370 |
\def\@pdfnumpages{} |
| 2371 |
\define@key{Hyp}{pdfnumpages}{\hyxmp@pdfstringdef\@pdfnumpages{#1}} |
| 2372 |
% \end{macrocode} |
| 2373 |
% \end{macro} |
| 2374 |
% |
| 2375 |
% \begin{macro}{\@pdfissn} |
| 2376 |
% Prepare to store the \acro{ISSN} of the publication in which the |
| 2377 |
% document was published. |
| 2378 |
% \begin{macrocode} |
| 2379 |
\def\@pdfissn{} |
| 2380 |
\define@key{Hyp}{pdfissn}{\hyxmp@pdfstringdef\@pdfissn{#1}} |
| 2381 |
% \end{macrocode} |
| 2382 |
% \end{macro} |
| 2383 |
% |
| 2384 |
% \begin{macro}{\@pdfeissn} |
| 2385 |
% Prepare to store the \acro{ISSN} of the electronic version of the |
| 2386 |
% publication in which the document was published. |
| 2387 |
% \begin{macrocode} |
| 2388 |
\def\@pdfeissn{} |
| 2389 |
\define@key{Hyp}{pdfeissn}{\hyxmp@pdfstringdef\@pdfeissn{#1}} |
| 2390 |
% \end{macrocode} |
| 2391 |
% \end{macro} |
| 2392 |
% |
| 2393 |
% \begin{macro}{\@pdfisbn} |
| 2394 |
% Prepare to store the \acro{ISBN} of the publication in which the |
| 2395 |
% document was published. |
| 2396 |
% \begin{macrocode} |
| 2397 |
\def\@pdfisbn{} |
| 2398 |
\define@key{Hyp}{pdfisbn}{\hyxmp@pdfstringdef\@pdfisbn{#1}} |
| 2399 |
% \end{macrocode} |
| 2400 |
% \end{macro} |
| 2401 |
% |
| 2402 |
% \begin{macro}{\@pdfbookedition} |
| 2403 |
% Prepare to store the edition of the book in which the document |
| 2404 |
% was published. |
| 2405 |
% \begin{macrocode} |
| 2406 |
\def\@pdfbookedition{} |
| 2407 |
\define@key{Hyp}{pdfbookedition}{\hyxmp@pdfstringdef\@pdfbookedition{#1}} |
| 2408 |
% \end{macrocode} |
| 2409 |
% \end{macro} |
| 2410 |
% |
| 2411 |
% \begin{macro}{\@pdfpublisher} |
| 2412 |
% Prepare to store the name of the document's publisher. |
| 2413 |
% \begin{macrocode} |
| 2414 |
\def\@pdfpublisher{} |
| 2415 |
\define@key{Hyp}{pdfpublisher}{\hyxmp@pdfstringdef\@pdfpublisher{#1}} |
| 2416 |
% \end{macrocode} |
| 2417 |
% \end{macro} |
| 2418 |
% |
| 2419 |
% \begin{macro}{\@pdfvolumenum} |
| 2420 |
% Prepare to store the volume identifier of the publication in which the |
| 2421 |
% document was published. |
| 2422 |
% \begin{macrocode} |
| 2423 |
\def\@pdfvolumenum{} |
| 2424 |
\define@key{Hyp}{pdfvolumenum}{\hyxmp@pdfstringdef\@pdfvolumenum{#1}} |
| 2425 |
% \end{macrocode} |
| 2426 |
% \end{macro} |
| 2427 |
% |
| 2428 |
% \begin{macro}{\@pdfissuenum} |
| 2429 |
% Prepare to store the identifier of the issue within a volume of the |
| 2430 |
% publication in which the document was published. |
| 2431 |
% \begin{macrocode} |
| 2432 |
\def\@pdfissuenum{} |
| 2433 |
\define@key{Hyp}{pdfissuenum}{\hyxmp@pdfstringdef\@pdfissuenum{#1}} |
| 2434 |
% \end{macrocode} |
| 2435 |
% \end{macro} |
| 2436 |
% |
| 2437 |
% \begin{macro}{\@pdfpagerange} |
| 2438 |
% Prepare to store the document's range of pages within the publication |
| 2439 |
% in which the document was published. |
| 2440 |
% \begin{macrocode} |
| 2441 |
\def\@pdfpagerange{} |
| 2442 |
\define@key{Hyp}{pdfpagerange}{\hyxmp@pdfstringdef\@pdfpagerange{#1}} |
| 2443 |
% \end{macrocode} |
| 2444 |
% \end{macro} |
| 2445 |
% |
| 2446 |
% \begin{macro}{\@pdfdoi} |
| 2447 |
% Prepare to store a \acro{DOI} that represents the current instance of |
| 2448 |
% the document. |
| 2449 |
% \begin{macrocode} |
| 2450 |
\def\@pdfdoi{} |
| 2451 |
\define@key{Hyp}{pdfdoi}{\hyxmp@pdfstringdef\@pdfdoi{#1}} |
| 2452 |
% \end{macrocode} |
| 2453 |
% \end{macro} |
| 2454 |
% |
| 2455 |
% \begin{macro}{\@pdfurl} |
| 2456 |
% Prepare to store a \acro{URL} that represents where the document |
| 2457 |
% can be found. Note that we do not prepend \optname{baseurl} to |
| 2458 |
% the value provided. |
| 2459 |
% \begin{macrocode} |
| 2460 |
\def\@pdfurl{} |
| 2461 |
\define@key{Hyp}{pdfurl}{\hyxmp@pdfstringdef\@pdfurl{#1}} |
| 2462 |
% \end{macrocode} |
| 2463 |
% \end{macro} |
| 2464 |
% |
| 2465 |
% \begin{macro}{\@pdfidentifier} |
| 2466 |
% Prepare to store an identifier that uniquely represents the document. |
| 2467 |
% \begin{macrocode} |
| 2468 |
\def\@pdfidentifier{} |
| 2469 |
\define@key{Hyp}{pdfidentifier}{\hyxmp@pdfstringdef\@pdfidentifier{#1}} |
| 2470 |
% \end{macrocode} |
| 2471 |
% \end{macro} |
| 2472 |
% |
| 2473 |
% \begin{macro}{\@pdfsubtitle} |
| 2474 |
% Prepare to store the document's subtitle. |
| 2475 |
% \begin{macrocode} |
| 2476 |
\def\@pdfsubtitle{} |
| 2477 |
\define@key{Hyp}{pdfsubtitle}{\hyxmp@pdfstringdef\@pdfsubtitle{#1}} |
| 2478 |
% \end{macrocode} |
| 2479 |
% \end{macro} |
| 2480 |
% |
| 2481 |
% \begin{macro}{\@pdfpubstatus} |
| 2482 |
% Prepare to store the document's journal article version. |
| 2483 |
% \begin{macrocode} |
| 2484 |
\def\@pdfpubstatus{} |
| 2485 |
\define@key{Hyp}{pdfpubstatus}{\hyxmp@pdfstringdef\@pdfpubstatus{#1}} |
| 2486 |
% \end{macrocode} |
| 2487 |
% \end{macro} |
| 2488 |
% |
| 2489 |
% The following eight macros---|\@pdfcontactaddress|, |
| 2490 |
% |\@pdfcontactcity|, |\@pdfcontactregion|, |\@pdfcontactpostcode|, |
| 2491 |
% |\@pdfcontactcountry|, |\@pdfcontactphone|, |\@pdfcontactemail|, and |
| 2492 |
% |\@pdfcontacturl|---together specify how to contact the person or |
| 2493 |
% institution responsible for the document. |
| 2494 |
% |
| 2495 |
% \begin{macro}{\@pdfcontactaddress} |
| 2496 |
% Prepare to store a street address for the document's contact |
| 2497 |
% person\slash institution. The \acro{IPTC} standard defines this as |
| 2498 |
% follows: |
| 2499 |
% |
| 2500 |
% \begin{quote} |
| 2501 |
% The contact information address part. Comprises an optional company |
| 2502 |
% name and all required information to locate the building or postbox |
| 2503 |
% to which mail should be sent. To that end, the address is a |
| 2504 |
% multiline field. |
| 2505 |
% \end{quote} |
| 2506 |
% |
| 2507 |
% For consistency with the rest of \pkgname{hyperxmp}, we use commas to |
| 2508 |
% separate terms, in this case, lines of the address. The author can |
| 2509 |
% use |\xmpquote| and |\xmpcomma| to include literal commas. |
| 2510 |
% \begin{macrocode} |
| 2511 |
\def\@pdfcontactaddress{} |
| 2512 |
\define@key{Hyp}{pdfcontactaddress}{% |
| 2513 |
\let\xmpcomma=\hyxmp@comma |
| 2514 |
\def\xmpquote##1{##1}% |
| 2515 |
\hyxmp@pdfstringdef\@pdfcontactaddress{#1}% |
| 2516 |
\def\xmpcomma{,}% |
| 2517 |
\let\xmpquote=\relax |
| 2518 |
} |
| 2519 |
% \end{macrocode} |
| 2520 |
% \end{macro} |
| 2521 |
% |
| 2522 |
% \begin{macro}{\@pdfcontactcity} |
| 2523 |
% Prepare to store the city of the document's contact person\slash |
| 2524 |
% institution. |
| 2525 |
% \begin{macrocode} |
| 2526 |
\def\@pdfcontactcity{} |
| 2527 |
\define@key{Hyp}{pdfcontactcity}{\hyxmp@pdfstringdef\@pdfcontactcity{#1}} |
| 2528 |
% \end{macrocode} |
| 2529 |
% \end{macro} |
| 2530 |
% |
| 2531 |
% \begin{macro}{\@pdfcontactregion} |
| 2532 |
% Prepare to store the state or province of the document's contact |
| 2533 |
% person\slash institution. |
| 2534 |
% \begin{macrocode} |
| 2535 |
\def\@pdfcontactregion{} |
| 2536 |
\define@key{Hyp}{pdfcontactregion}{\hyxmp@pdfstringdef\@pdfcontactregion{#1}} |
| 2537 |
% \end{macrocode} |
| 2538 |
% \end{macro} |
| 2539 |
% |
| 2540 |
% \begin{macro}{\@pdfcontactpostcode} |
| 2541 |
% Prepare to store the postal code of the document's contact |
| 2542 |
% person\slash institution. |
| 2543 |
% \begin{macrocode} |
| 2544 |
\def\@pdfcontactpostcode{} |
| 2545 |
\define@key{Hyp}{pdfcontactpostcode}{\hyxmp@pdfstringdef\@pdfcontactpostcode{#1}} |
| 2546 |
% \end{macrocode} |
| 2547 |
% \end{macro} |
| 2548 |
% |
| 2549 |
% \begin{macro}{\@pdfcontactcountry} |
| 2550 |
% Prepare to store the country of the document's contact person\slash |
| 2551 |
% institution. |
| 2552 |
% \begin{macrocode} |
| 2553 |
\def\@pdfcontactcountry{} |
| 2554 |
\define@key{Hyp}{pdfcontactcountry}{\hyxmp@pdfstringdef\@pdfcontactcountry{#1}} |
| 2555 |
% \end{macrocode} |
| 2556 |
% \end{macro} |
| 2557 |
% |
| 2558 |
% \begin{macro}{\@pdfcontactphone} |
| 2559 |
% Prepare to store the telephone number of the document's contact |
| 2560 |
% person\slash institution. |
| 2561 |
% \begin{macrocode} |
| 2562 |
\def\@pdfcontactphone{} |
| 2563 |
\define@key{Hyp}{pdfcontactphone}{\hyxmp@pdfstringdef\@pdfcontactphone{#1}} |
| 2564 |
% \end{macrocode} |
| 2565 |
% \end{macro} |
| 2566 |
% |
| 2567 |
% \begin{macro}{\@pdfcontactemail} |
| 2568 |
% Prepare to store the email address of the document's contact |
| 2569 |
% person\slash institution. |
| 2570 |
% \begin{macrocode} |
| 2571 |
\def\@pdfcontactemail{} |
| 2572 |
\define@key{Hyp}{pdfcontactemail}{\hyxmp@pdfstringdef\@pdfcontactemail{#1}} |
| 2573 |
% \end{macrocode} |
| 2574 |
% \end{macro} |
| 2575 |
% |
| 2576 |
% \begin{macro}{\@pdfcontacturl} |
| 2577 |
% Prepare to store the \acro{URL} of the document's contact person\slash |
| 2578 |
% institution. |
| 2579 |
% \begin{macrocode} |
| 2580 |
\def\@pdfcontacturl{} |
| 2581 |
\define@key{Hyp}{pdfcontacturl}{\hyxmp@pdfstringdef\@pdfcontacturl{#1}} |
| 2582 |
% \end{macrocode} |
| 2583 |
% \end{macro} |
| 2584 |
% |
| 2585 |
% \begin{macro}{\hyxmp@no@info@lists} |
| 2586 |
% Suppress \pkgname{hyperref} from writing \pdfterm{Author} and |
| 2587 |
% \pdfterm{Keywords} into the \pdfterm{Info} dictionary. This prevents |
| 2588 |
% conflicts between the \acro{PDF} metadata and the \acro{XMP} metadata |
| 2589 |
% that cause \acro{PDF/A} validation to fail. The \acro{PDF} metadata |
| 2590 |
% can be restored by passing the \optname{keeppdfinfo} option to |
| 2591 |
% |\hypersetup|. |
| 2592 |
% \changes{v4.0}{2019/03/31}{Added this macro} |
| 2593 |
% \changes{v5.0}{2020/03/10}{Renamed this macros from |
| 2594 |
% \protect\cs{hyxmp@suppress@pdf@metadata} and rewrote it to replace, |
| 2595 |
% if possible, only \protect\pdfterm{Author} and \protect\pdfterm{Keywords}} |
| 2596 |
% \begin{macrocode} |
| 2597 |
\def\hyxmp@no@info@lists{% |
| 2598 |
% \end{macrocode} |
| 2599 |
% \begin{macro}{\hyxmp@suppress@pdf@info} |
| 2600 |
% \begin{macro}{\next} |
| 2601 |
% If |\patchcmd| fails for any reason---most likely, a modification to |
| 2602 |
% the \pkgname{hyperref} package---our fallback is to prevent |
| 2603 |
% \pkgname{hyperref} from writing \emph{any} data to the \acro{PDF} |
| 2604 |
% \pdfterm{Info} dictionary. |
| 2605 |
% \begin{macrocode} |
| 2606 |
\def\hyxmp@suppress@pdf@info{% |
| 2607 |
\global\let\PDF@FinishDoc=\@empty |
| 2608 |
\PackageWarningNoLine{hyperxmp}{% |
| 2609 |
Suppressing the _entire_ PDF Info dictionary.\MessageBreak |
| 2610 |
Please notify the hyperxmp maintainer% |
| 2611 |
}% |
| 2612 |
}% |
| 2613 |
\let\next=\relax |
| 2614 |
\patchcmd |
| 2615 |
{\PDF@FinishDoc}% |
| 2616 |
{/Author(\@pdfauthor)}% |
| 2617 |
{}% |
| 2618 |
{}% |
| 2619 |
{\let\next=\hyxmp@suppress@pdf@info}% |
| 2620 |
\patchcmd |
| 2621 |
{\PDF@FinishDoc}% |
| 2622 |
{/Keywords(\@pdfkeywords)}% |
| 2623 |
{}% |
| 2624 |
{}% |
| 2625 |
{\let\next=\hyxmp@suppress@pdf@info}% |
| 2626 |
\next |
| 2627 |
} |
| 2628 |
% \end{macrocode} |
| 2629 |
% \end{macro} |
| 2630 |
% \end{macro} |
| 2631 |
% \end{macro} |
| 2632 |
% \begin{macrocode} |
| 2633 |
\define@key{Hyp}{keeppdfinfo}[true]{% |
| 2634 |
\gdef\hyxmp@no@info@lists{}% |
| 2635 |
} |
| 2636 |
% \end{macrocode} |
| 2637 |
% |
| 2638 |
% \changes{v2.1}{2012/09/16}{Enabled \protect\pkgname{hyperxmp} and |
| 2639 |
% \protect\pkgname{hyperref} to be loaded in either order. This addresses |
| 2640 |
% a bug report by Yury Donskoy} |
| 2641 |
% |
| 2642 |
% We need to capture list arguments (viz.~\optname{pdfauthor} and |
| 2643 |
% \optname{pdfkeywords}) before \pkgname{hyperref} converts them to |
| 2644 |
% \term{PDFDocEncoding}. Otherwise, |\xmpcomma| is permanently replaced |
| 2645 |
% with a comma, and we lose our ability to change it to a |
| 2646 |
% |\hyxmp@comma|. We therefore need to augment \pkgname{hyperref}'s |
| 2647 |
% option processing with our own. Because \pkgname{hyperref} has not |
| 2648 |
% yet been loaded we need to ensure that our augmentation gets loaded in |
| 2649 |
% the future: after the |\usepackage{hyperref}| but before options are |
| 2650 |
% passed to that package. |
| 2651 |
% |
| 2652 |
% For lack of a better approach, \pkgname{hyperxmp} redefines |
| 2653 |
% |\ProcessKeyvalOptions| to alter the way \pkgname{hyperref} processes |
| 2654 |
% \optname{pdfauthor} and \optname{pdfkeywords}. This is somewhat |
| 2655 |
% heavy-handed as it gets executed for \emph{every} subsequently loaded |
| 2656 |
% package that uses |\ProcessKeyvalOptions|, but at least it does what |
| 2657 |
% we need. \pkgname{hyperxmp} also redefines |\hypersetup| to do the |
| 2658 |
% same thing. This is required in case \pkgname{hyperref} is loaded |
| 2659 |
% before \pkgname{hyperxmp}. |
| 2660 |
% |
| 2661 |
% \changes{v5.12}{2023/09/10}{Require that \pkgname{hyperref} be loaded |
| 2662 |
% before \pkgname{hyperxmp}} |
| 2663 |
% \begin{center} |
| 2664 |
% \fbox{% |
| 2665 |
% \begin{minipage}{0.75\linewidth} |
| 2666 |
% \paragraph{New in v5.12} |
| 2667 |
% \pkgname{hyperref} must be loaded \emph{before} \pkgname{hyperxmp}. |
| 2668 |
% This is because recent changes in \pkgname{hyperref} and the |
| 2669 |
% \LaTeX\ kernel prevent \pkgname{hyperxmp} from hooking into |
| 2670 |
% \pkgname{hyperref}'s internals if \pkgname{hyperref} is loaded |
| 2671 |
% first. |
| 2672 |
% \end{minipage}% |
| 2673 |
% } |
| 2674 |
% \end{center} |
| 2675 |
% |
| 2676 |
% \begin{macrocode} |
| 2677 |
\@ifpackageloaded{hyperref}{% |
| 2678 |
}{% |
| 2679 |
\PackageError{hyperxmp}% |
| 2680 |
{hyperref must be loaded before hyperxmp}% |
| 2681 |
{Recent versions of hyperref and the LaTeX kernel inhibit\MessageBreak |
| 2682 |
hyperxmp's ability to hook into hyperref's internals unless\MessageBreak |
| 2683 |
hyperref is loaded first.} |
| 2684 |
} |
| 2685 |
% \end{macrocode} |
| 2686 |
% |
| 2687 |
% \begin{macro}{\hyxmp@pdfauthor} |
| 2688 |
% \begin{macro}{\hyxmp@pdfkeywords} |
| 2689 |
% Prepare to store the name of the author and a list of keywords. |
| 2690 |
% \begin{macrocode} |
| 2691 |
\def\hyxmp@pdfauthor{} |
| 2692 |
\def\hyxmp@pdfkeywords{} |
| 2693 |
% \end{macrocode} |
| 2694 |
% \end{macro} |
| 2695 |
% \end{macro} |
| 2696 |
% |
| 2697 |
% \begin{macro}{\hyxmp@redefine@Hyp} |
| 2698 |
% If not already redefined, redefine \pkgname{hyperref}'s |
| 2699 |
% \optname{pdfauthor} and \optname{pdfkeywords} options to properly |
| 2700 |
% handle |\xmpcomma| and |\xmpquote|. |
| 2701 |
% \changes{v2.1}{2012/09/16}{Added this macro} |
| 2702 |
% \begin{macrocode} |
| 2703 |
\newcommand*{\hyxmp@redefine@Hyp}{% |
| 2704 |
% \end{macrocode} |
| 2705 |
% \begin{macro}{\hyxmp@Hyp@pdfauthor} |
| 2706 |
% Store the old definition of |\KV@Hyp@pdfauthor| in |
| 2707 |
% |\hyxmp@Hyp@pdfauthor|, but only if we see that |\KV@Hyp@pdfauthor| is |
| 2708 |
% defined and |\hyxmp@Hyp@pdfauthor| isn't. Otherwise, we'd be defining |
| 2709 |
% |\hyxmp@Hyp@pdfauthor| in terms of itself and creating an infinite |
| 2710 |
% loop. |
| 2711 |
% \begin{macrocode} |
| 2712 |
\@ifundefined{KV@Hyp@pdfauthor}{}{% |
| 2713 |
\@ifundefined{hyxmp@Hyp@pdfauthor}{% |
| 2714 |
\expandafter\let\expandafter\hyxmp@Hyp@pdfauthor |
| 2715 |
\csname KV@Hyp@pdfauthor\endcsname |
| 2716 |
}{}% |
| 2717 |
}% |
| 2718 |
% \end{macrocode} |
| 2719 |
% \Needspace{6\baselineskip} |
| 2720 |
% \begin{macro}{\KV@Hyp@pdfauthor} |
| 2721 |
% \begin{macro}{\xmpcomma} |
| 2722 |
% \begin{macro}{\xmpquote} |
| 2723 |
% \begin{macro}{\hyxmp@and} |
| 2724 |
% \begin{macro}{\and} |
| 2725 |
% \begin{macro}{\hyxmp@pdfauthor} |
| 2726 |
% \begin{macro}{\@pdfauthor} |
| 2727 |
% Redefine |\KV@Hyp@pdfauthor| to process its argument twice. The first |
| 2728 |
% time, |\xmpcomma| is defined as a placeholder character |
| 2729 |
% (|\hyxmp@comma|) and |\xmpquote| as the identity function. The result |
| 2730 |
% is stored in |\hyxmp@pdfauthor| for use in structured lists (those |
| 2731 |
% surrounding each entry with |<rdf:li>|). The second time, |\xmpcomma| |
| 2732 |
% is defined as an ordinary comma, and |\xmpquote| is defined as a macro |
| 2733 |
% that puts its argument within double quotes. The result is stored in |
| 2734 |
% |\@pdfauthor| for use in unstructured lists (those in which the entire |
| 2735 |
% list appears within a single pair of tags). In case |
| 2736 |
% \optname{pdfauthor} is left unspecified and we copy |\author|'s |
| 2737 |
% argument to \optname{pdfauthor}, we temporarily redefine |\and| as the |
| 2738 |
% list separator when producing a structured list and as ``|and|'' when |
| 2739 |
% producing an unstructured list. |
| 2740 |
% \begin{macrocode} |
| 2741 |
\define@key{Hyp}{pdfauthor}{% |
| 2742 |
\let\xmpcomma=\hyxmp@comma |
| 2743 |
\def\xmpquote####1{####1}% |
| 2744 |
\let\hyxmp@and=\and |
| 2745 |
\def\and{,}% |
| 2746 |
\hyxmp@Hyp@pdfauthor{##1}% |
| 2747 |
\global\let\hyxmp@pdfauthor=\@pdfauthor |
| 2748 |
\def\and{and\space}% |
| 2749 |
\def\xmpcomma{,}% |
| 2750 |
\def\xmpquote####1{"####1"}% |
| 2751 |
\hyxmp@Hyp@pdfauthor{##1}% |
| 2752 |
\def\xmpcomma{,}% |
| 2753 |
\let\xmpquote=\relax |
| 2754 |
\let\and=\hyxmp@and |
| 2755 |
}% |
| 2756 |
% \end{macrocode} |
| 2757 |
% \begin{macro}{\hyxmp@Hyp@pdfkeywords} |
| 2758 |
% The previous block of code now repeats for the keyword list, starting |
| 2759 |
% by storing the old definition of |\KV@Hyp@pdfkeywords| in |
| 2760 |
% |\hyxmp@Hyp@pdfkeywords|. |
| 2761 |
% \begin{macrocode} |
| 2762 |
\@ifundefined{KV@Hyp@pdfkeywords}{}{% |
| 2763 |
\@ifundefined{hyxmp@Hyp@pdfkeywords}{% |
| 2764 |
\expandafter\let\expandafter\hyxmp@Hyp@pdfkeywords |
| 2765 |
\csname KV@Hyp@pdfkeywords\endcsname |
| 2766 |
}{}% |
| 2767 |
}% |
| 2768 |
% \end{macrocode} |
| 2769 |
% \begin{macro}{\KV@Hyp@pdfkeywords} |
| 2770 |
% \begin{macro}{\xmpcomma} |
| 2771 |
% \begin{macro}{\xmpquote} |
| 2772 |
% \begin{macro}{\hyxmp@pdfkeywords} |
| 2773 |
% \begin{macro}{\@pdfkeywords} |
| 2774 |
% Redefine |\KV@Hyp@pdfkeywords| to process its argument twice. The |
| 2775 |
% first time, |\xmpcomma| is defined as a placeholder character |
| 2776 |
% (|\hyxmp@comma|) and |\xmpquote| as the identity function. The |
| 2777 |
% result is stored in |\hyxmp@pdfkeywords| for use in structured lists |
| 2778 |
% (those surrounding each entry with |<rdf:li>|). The second time, |
| 2779 |
% |\xmpcomma| is defined as an ordinary comma, and |\xmpquote| is |
| 2780 |
% defined as a macro that puts its argument within double quotes. The |
| 2781 |
% result is stored in |\@pdfkeywords| for use in unstructured lists |
| 2782 |
% (those in which the entire list appears within a single pair of tags). |
| 2783 |
% \begin{macrocode} |
| 2784 |
\define@key{Hyp}{pdfkeywords}{% |
| 2785 |
\let\xmpcomma=\hyxmp@comma |
| 2786 |
\def\xmpquote####1{####1}% |
| 2787 |
\hyxmp@Hyp@pdfkeywords{##1}% |
| 2788 |
\global\let\hyxmp@pdfkeywords=\@pdfkeywords |
| 2789 |
\def\xmpcomma{,}% |
| 2790 |
\def\xmpquote####1{"####1"}% |
| 2791 |
\hyxmp@Hyp@pdfkeywords{##1}% |
| 2792 |
\def\xmpcomma{,}% |
| 2793 |
\let\xmpquote=\relax |
| 2794 |
}% |
| 2795 |
} |
| 2796 |
% \end{macrocode} |
| 2797 |
% \end{macro} |
| 2798 |
% \end{macro} |
| 2799 |
% \end{macro} |
| 2800 |
% \end{macro} |
| 2801 |
% \end{macro} |
| 2802 |
% \end{macro} |
| 2803 |
% \end{macro} |
| 2804 |
% \end{macro} |
| 2805 |
% \end{macro} |
| 2806 |
% \end{macro} |
| 2807 |
% \end{macro} |
| 2808 |
% \end{macro} |
| 2809 |
% \end{macro} |
| 2810 |
% \end{macro} |
| 2811 |
% \end{macro} |
| 2812 |
% |
| 2813 |
% \begin{macro}{\hyxmp@ProcessKeyvalOptions} |
| 2814 |
% \changes{v2.0}{2012/09/05}{Added this macro} |
| 2815 |
% \changes{v5.11}{2022/10/02}{Bug fix: Restore |
| 2816 |
% \protect\cs{ProcessKeyvalOptions} after first use. Thanks to |
| 2817 |
% Ulrike Fischer for the bug report} |
| 2818 |
% \begin{macro}{\ProcessKeyvalOptions} |
| 2819 |
% \changes{v2.0}{2012/09/05}{Added this macro} |
| 2820 |
% Redefine \pkgname{kvoptions}'s |\ProcessOptions| command to invoke |
| 2821 |
% |\hyxmp@redefine@Hyp| before performing its normal option processing. |
| 2822 |
% \begin{macrocode} |
| 2823 |
\let\hyxmp@ProcessKeyvalOptions=\ProcessKeyvalOptions |
| 2824 |
\renewcommand*{\ProcessKeyvalOptions}{% |
| 2825 |
\global\let\ProcessKeyvalOptions=\hyxmp@ProcessKeyvalOptions |
| 2826 |
\hyxmp@redefine@Hyp |
| 2827 |
\hyxmp@ProcessKeyvalOptions |
| 2828 |
} |
| 2829 |
% \end{macrocode} |
| 2830 |
% \end{macro} |
| 2831 |
% \end{macro} |
| 2832 |
% |
| 2833 |
% \begin{macro}{\hyxmp@hypersetup} |
| 2834 |
% \changes{v2.1}{2012/09/16}{Added this macro} |
| 2835 |
% \begin{macro}{\hypersetup} |
| 2836 |
% \changes{v2.1}{2012/09/16}{Added this macro} |
| 2837 |
% Redefine \pkgname{hyperref}'s |\hypersetup| command to invoke |
| 2838 |
% |\hyxmp@redefine@Hyp| before performing its normal option processing. |
| 2839 |
% \begin{macrocode} |
| 2840 |
\let\hyxmp@hypersetup=\hypersetup |
| 2841 |
\def\hypersetup{% |
| 2842 |
\hyxmp@redefine@Hyp |
| 2843 |
\hyxmp@hypersetup |
| 2844 |
} |
| 2845 |
% \end{macrocode} |
| 2846 |
% \end{macro} |
| 2847 |
% \end{macro} |
| 2848 |
% |
| 2849 |
% \begin{macro}{\hyxmp@concated@metadata} |
| 2850 |
% \begin{macro}{\hyxmp@aep@toks} |
| 2851 |
% Assume that if the document loaded either \pkgname{babel} or |
| 2852 |
% \pkgname{polyglossia} it will eventually define one or more languages |
| 2853 |
% that \pkgname{hyperxmp} can list within a \xmpprop{dc:language} |
| 2854 |
% element. As explained in Section~\ref{sec:initial-prep}, we defer the |
| 2855 |
% invocation of \cs{AtEndPreamble} to the end of the file. |
| 2856 |
% \begin{macrocode} |
| 2857 |
\edef\hyxmp@concated@metadata{} |
| 2858 |
\expandafter\hyxmp@aep@toks\expandafter=\expandafter{% |
| 2859 |
\the\hyxmp@aep@toks |
| 2860 |
\AtEndPreamble{% |
| 2861 |
\@ifpackageloaded{babel}{% |
| 2862 |
\edef\hyxmp@concated@metadata{babel}% |
| 2863 |
}{% |
| 2864 |
\@ifpackageloaded{polyglossia}{% |
| 2865 |
\edef\hyxmp@concated@metadata{polyglossia}% |
| 2866 |
}{% |
| 2867 |
}% |
| 2868 |
}% |
| 2869 |
}% |
| 2870 |
} |
| 2871 |
% \end{macrocode} |
| 2872 |
% \end{macro} |
| 2873 |
% \end{macro} |
| 2874 |
% |
| 2875 |
% \begin{macro}{\hyxmp@warn@if@no@metadata} |
| 2876 |
% \begin{macro}{\hyxmp@concated@metadata} |
| 2877 |
% Issue a warning message if the author failed to specify any metadata |
| 2878 |
% at all. This excludes metadata that is included automatically such as |
| 2879 |
% the current timestamp. Note that we don't consider |\@pdfmetalang| as |
| 2880 |
% metadata as that value is meaningful only when used in conjunction |
| 2881 |
% with other information. We also don't examine |\@pdfapart| or |
| 2882 |
% |\@pdfaconformance| because those have nonempty default values. |
| 2883 |
% \begin{macrocode} |
| 2884 |
\newcommand*{\hyxmp@warn@if@no@metadata}{% |
| 2885 |
\edef\hyxmp@concated@metadata{% |
| 2886 |
\hyxmp@concated@metadata |
| 2887 |
\@baseurl |
| 2888 |
\@pdfauthor |
| 2889 |
\@pdfauthortitle |
| 2890 |
\@pdfbookedition |
| 2891 |
\@pdfbytes |
| 2892 |
\@pdfcaptionwriter |
| 2893 |
\@pdfcontactaddress |
| 2894 |
\@pdfcontactcity |
| 2895 |
\@pdfcontactcountry |
| 2896 |
\@pdfcontactemail |
| 2897 |
\@pdfcontactphone |
| 2898 |
\@pdfcontactpostcode |
| 2899 |
\@pdfcontactregion |
| 2900 |
\@pdfcontacturl |
| 2901 |
\@pdfcopyright |
| 2902 |
\@pdfcreationdate |
| 2903 |
\@pdfdatetime |
| 2904 |
\@pdfdoi |
| 2905 |
\@pdfeissn |
| 2906 |
\@pdfidentifier |
| 2907 |
\@pdfisbn |
| 2908 |
\@pdfissn |
| 2909 |
\@pdfissuenum |
| 2910 |
\@pdfkeywords |
| 2911 |
\@pdflang |
| 2912 |
\@pdflicenseurl |
| 2913 |
\@pdfmetadatetime |
| 2914 |
\@pdfmoddate |
| 2915 |
\@pdfnumpages |
| 2916 |
\@pdfpagerange |
| 2917 |
\@pdfpublication |
| 2918 |
\@pdfpubtype |
| 2919 |
\@pdfsubject |
| 2920 |
\@pdfsubtitle |
| 2921 |
\@pdftitle |
| 2922 |
\@pdfuapart |
| 2923 |
\@pdfurl |
| 2924 |
\@pdfvolumenum |
| 2925 |
\@pdfxstandard |
| 2926 |
}% |
| 2927 |
\ifx\hyxmp@concated@metadata\@empty |
| 2928 |
\PackageWarningNoLine{hyperxmp}{% |
| 2929 |
\[email protected] did not specify any metadata to\MessageBreak |
| 2930 |
include in the XMP packet.\space\space Please see the\MessageBreak |
| 2931 |
hyperxmp documentation for instructions on how to\MessageBreak |
| 2932 |
provide metadata values to hyperxmp}% |
| 2933 |
\fi |
| 2934 |
} |
| 2935 |
% \end{macrocode} |
| 2936 |
% \end{macro} |
| 2937 |
% \end{macro} |
| 2938 |
% |
| 2939 |
% \begin{macro}{\hyxmp@check@standards} |
| 2940 |
% Most \acro{PDF} standards require that certain metadata be present. |
| 2941 |
% If compliance with a \acro{PDF} standard is claimed but any of the |
| 2942 |
% metadata it requires are absent, issue a warning message. |
| 2943 |
% \changes{v5.0}{2020/03/11}{Added this macro} |
| 2944 |
% \begin{macrocode} |
| 2945 |
\newcommand*{\hyxmp@check@standards}{% |
| 2946 |
% \end{macrocode} |
| 2947 |
% If the \optname{pdfa} option was passed to \pkgname{hyperref} but |
| 2948 |
% |\@pdfapart| is not set, set it to~|1| and |\@pdfaconformance| to~|B|. |
| 2949 |
% \begin{macrocode} |
| 2950 |
\ifHy@pdfa |
| 2951 |
\@ifmtargexp{\@pdfapart}{% |
| 2952 |
\PackageWarningNoLine{hyperxmp}{% |
| 2953 |
`pdfa' was passed to hyperref, but `pdfapart' was\MessageBreak |
| 2954 |
not specified.\space\space Setting pdfapart to `1' and\MessageBreak |
| 2955 |
pdfaconformance to `B'% |
| 2956 |
}% |
| 2957 |
\gdef\@pdfapart{1}% |
| 2958 |
\gdef\@pdfaconformance{B}% |
| 2959 |
}% |
| 2960 |
{}% |
| 2961 |
\fi |
| 2962 |
% \end{macrocode} |
| 2963 |
% |
| 2964 |
% \begin{macro}{\hyxmp@standards} |
| 2965 |
% We define |\hyxmp@standards| to be non-empty if \emph{any} \acro{PDF} |
| 2966 |
% standard is claimed (currently, \acro{PDF/A}, \acro{PDF/X}, or |
| 2967 |
% \acro{PDF/UA}. |
| 2968 |
% \begin{macrocode} |
| 2969 |
\edef\hyxmp@standards{% |
| 2970 |
\@pdfapart |
| 2971 |
\@pdfxstandard |
| 2972 |
\@pdfuapart |
| 2973 |
}% |
| 2974 |
% \end{macrocode} |
| 2975 |
% Check that a document title was provided and is non-empty. |
| 2976 |
% \begin{macrocode} |
| 2977 |
\@ifnotmtargexp{\hyxmp@standards}{% |
| 2978 |
\@ifmtargexp{\@pdftitle}{% |
| 2979 |
\PackageWarningNoLine{hyperxmp}{% |
| 2980 |
Missing pdftitle (required for PDF standards\MessageBreak |
| 2981 |
compliance)% |
| 2982 |
}% |
| 2983 |
}% |
| 2984 |
{}% |
| 2985 |
}% |
| 2986 |
} |
| 2987 |
% \end{macrocode} |
| 2988 |
% \end{macro} |
| 2989 |
% \end{macro} |
| 2990 |
% |
| 2991 |
% \begin{macro}{\hyxmp@aep@toks} |
| 2992 |
% Right before we reach the |\begin{document}| we check if |
| 2993 |
% \pkgname{hyperref} was loaded. In normal usage, the document will |
| 2994 |
% already have done a |\usepackage{hyperref}| because otherwise, |
| 2995 |
% \cs{hypersetup} will not have been defined, and only a limited amount |
| 2996 |
% of metadata will be included. However, in case the author is relying |
| 2997 |
% exclusively on \pkgname{hyperxmp}'s automatically detected metadata, |
| 2998 |
% we'll need to load \pkgname{hyperref} now. As explained in |
| 2999 |
% Section~\ref{sec:initial-prep}, we defer the invocation of |
| 3000 |
% \cs{AtEndPreamble} to the end of the file. |
| 3001 |
% \changes{v5.5}{2020/06/24}{Load \protect\pkgname{hyperref} automatically |
| 3002 |
% if the document does not do so explicitly, as requested by Robin Schwab} |
| 3003 |
% \begin{macrocode} |
| 3004 |
\expandafter\hyxmp@aep@toks\expandafter=\expandafter{% |
| 3005 |
\the\hyxmp@aep@toks |
| 3006 |
\AtEndPreamble{% |
| 3007 |
\RequirePackage{hyperref}% |
| 3008 |
% \end{macrocode} |
| 3009 |
% Older versions of \pkgname{hyperref} write the \pdfterm{Info} |
| 3010 |
% dictionary to the \acro{PDF} file at the end of the document. Newer |
| 3011 |
% versions of \pkgname{hyperref} write the \pdfterm{Info} dictionary to |
| 3012 |
% the \acro{PDF} file at the \emph{beginning} of the document. For |
| 3013 |
% compatibility with both old and new \pkgname{hyperref} implementations |
| 3014 |
% we suppress writing the \pdfterm{Info} dictionary here, at the |
| 3015 |
% beginning of the document. |
| 3016 |
% \changes{v4.1}{2019/04/02}{Invoke |
| 3017 |
% \protect\cs{hyxmp@no@info@lists} at the beginning of the |
| 3018 |
% document, for compatibility with both newer and older versions of |
| 3019 |
% \protect\pkgname{hyperref}} |
| 3020 |
% \begin{macrocode} |
| 3021 |
\hyxmp@no@info@lists |
| 3022 |
% \end{macrocode} |
| 3023 |
% If \optname{pdftitle} is undefined but the author invoked \cs{title}, |
| 3024 |
% we copy the latter to the former. This addresses two problems: |
| 3025 |
% (1)~handling \LaTeX\ classes in which \cs{maketitle} clears \cs{title} |
| 3026 |
% and (2)~ensuring that \pkgname{hyperref} writes the same title to the |
| 3027 |
% \acro{PDF} \pdfterm{Info} dictionary that \pkgname{hyperxmp} writes to |
| 3028 |
% the \acro{XMP} packet. We do likewise for \cs{author}~$\rightarrow$ |
| 3029 |
% \optname{pdfauthor}. |
| 3030 |
% |
| 3031 |
% One tricky bit is that the standard \LaTeX\ classes do not define |
| 3032 |
% \cs{@title} and \cs{@author} as empty strings but rather as calls to |
| 3033 |
% \cs{@latex@warning@no@line} that complain about a missing |
| 3034 |
% title/author. Hence, we can't simply test if the title and author are |
| 3035 |
% empty because they're not. Instead, we first locally redefine |
| 3036 |
% \cs{@latex@warning@no@line} to discard its argument then test if any |
| 3037 |
% text remains. |
| 3038 |
% \changes{v5.5}{2020/07/24}{Copy \protect\cs{title} to |
| 3039 |
% \protect\optname{pdftitle} and \protect\cs{author} to |
| 3040 |
% \protect\optname{pdfauthor} at the start of the document to improve |
| 3041 |
% consistency between \protect\acro{XMP} and \protect\acro{PDF} metadata} |
| 3042 |
% \begin{macrocode} |
| 3043 |
\begingroup |
| 3044 |
\let\@latex@warning@no@line=\@gobble |
| 3045 |
\hyxmp@use@first@valid{pdftitle}{\@pdftitle}{% |
| 3046 |
\scr@subject@var,% |
| 3047 |
\@title |
| 3048 |
}% |
| 3049 |
\hyxmp@use@first@valid{pdfauthor}{\@pdfauthor}{% |
| 3050 |
\scr@fromname@var,% |
| 3051 |
\@author |
| 3052 |
}% |
| 3053 |
\endgroup |
| 3054 |
}% |
| 3055 |
} |
| 3056 |
% \end{macrocode} |
| 3057 |
% \end{macro} |
| 3058 |
% |
| 3059 |
% When we reach the |\end{document}| we need to gather up the metadata |
| 3060 |
% specified explicitly by the user, infer additional metadata where |
| 3061 |
% possible, and write the \acro{XMP} packet to the \acro{PDF} file. |
| 3062 |
% \changes{v1.3}{2011/04/25}{Introduced the \protect\optname{pdfmetalang} |
| 3063 |
% package option, which enables an author to specify the language in which he |
| 3064 |
% wrote the document's metadata} |
| 3065 |
% \changes{v2.0}{2012/08/02}{New \cs{AtBeginDocument} code from Heiko |
| 3066 |
% Oberdiek to properly encode \cs{@pdfmetalang}} |
| 3067 |
% \changes{v3.3}{2017/07/21}{Don't overwrite an existing |
| 3068 |
% \protect\optname{pdfmetalang} with \protect\optname{pdflang} or |
| 3069 |
% \protect\xmpterm{x-default}. This addresses a bug report by Niklas |
| 3070 |
% Beisert} |
| 3071 |
% \changes{v5.4}{2020/06/18}{Moved the automatic assignment of |
| 3072 |
% \protect\cs{@pdflang} and \protect\cs{@pdfmetalang} from |
| 3073 |
% \protect\cs{hyxmp@auto@assign@data} to within a call to |
| 3074 |
% \protect\cs{hyxmp@at@end}} |
| 3075 |
% \changes{v5.5}{2020/07/21}{Move most of the \protect\cs{AtEndPreamble} |
| 3076 |
% code to \protect\cs{hyxmp@at@end}} |
| 3077 |
% \begin{macrocode} |
| 3078 |
\hyxmp@at@end{% |
| 3079 |
% \end{macrocode} |
| 3080 |
% Fill in any missing metadata we can using values provided by the author |
| 3081 |
% via mechanisms other than the \cs{hypersetup} command. |
| 3082 |
% \begin{macrocode} |
| 3083 |
\hyxmp@auto@assign@data |
| 3084 |
% \end{macrocode} |
| 3085 |
% If the document claims to comply with one or more \acro{PDF} |
| 3086 |
% standards, check that all of the requisite metadata are present. |
| 3087 |
% \begin{macrocode} |
| 3088 |
\hyxmp@check@standards |
| 3089 |
% \end{macrocode} |
| 3090 |
% We can finally construct the \acro{XMP} packet and write it to the |
| 3091 |
% \acro{PDF} document catalog. |
| 3092 |
% \begin{macrocode} |
| 3093 |
\hyxmp@warn@if@no@metadata |
| 3094 |
\hyxmp@embed@packet |
| 3095 |
} |
| 3096 |
% \end{macrocode} |
| 3097 |
% |
| 3098 |
% |
| 3099 |
% \subsection{Advanced metadata detection} |
| 3100 |
% |
| 3101 |
% \pkgname{hyperxmp} strives to be as convenient and user-friendly as |
| 3102 |
% possible. To that end, we try to automatically detect as much |
| 3103 |
% metadata as possible. The author can of course augment or override |
| 3104 |
% autodetected metadata by explicitly providing values to |
| 3105 |
% \cs{hypersetup}, but the hope is that we can save the author some |
| 3106 |
% effort in many cases. |
| 3107 |
% |
| 3108 |
% In this section, we identify additional metadata we can use. Most of |
| 3109 |
% the functionality is class- or package-specific. For example, we |
| 3110 |
% check for phone numbers provided to the \Koma\ letter classes via |
| 3111 |
% |\setkomavar{fromphone}{|\dots|}| and/or |
| 3112 |
% |\setkomavar{frommobilephone}{|\dots|}|, street addresses provided to |
| 3113 |
% the \ACMclass\ article class via \cs{affiliation}, and languages |
| 3114 |
% the \pkgname{polyglossia} package is instructed to load via |
| 3115 |
% \cs{setdefaultlanguage} and \cs{setotherlanguage}. |
| 3116 |
% |
| 3117 |
% \begin{macro}{\hyxmp@set@koma@phones} |
| 3118 |
% \changes{v5.3}{2020/06/07}{Added this macro} |
| 3119 |
% \changes{v5.5}{2020/07/08}{Support hyperlinks and other markup in |
| 3120 |
% \protect\texttt{frommobilephone} and \protect\texttt{fromphone}, |
| 3121 |
% as requested by Robin Schwab} |
| 3122 |
% \begin{macro}{\hyxmp@koma@phones} |
| 3123 |
% Define \cs{hyxmp@koma@phones} as a comma-separated list of the phone |
| 3124 |
% numbers provided to a \Koma\ letter class (mobile and landline). |
| 3125 |
% \begin{macrocode} |
| 3126 |
\newcommand*{\hyxmp@set@koma@phones}{% |
| 3127 |
\begingroup |
| 3128 |
\Hy@unicodefalse |
| 3129 |
\@if@def@and@nonempty{scr@frommobilephone@var}{% |
| 3130 |
\@if@def@and@nonempty{scr@fromphone@var}{% |
| 3131 |
\hyxmp@pdfstringdef\hyxmp@koma@phones{\scr@frommobilephone@var,\scr@fromphone@var}% |
| 3132 |
}{% |
| 3133 |
\hyxmp@pdfstringdef\hyxmp@koma@phones{\scr@frommobilephone@var}% |
| 3134 |
}% |
| 3135 |
}{% |
| 3136 |
\@if@def@and@nonempty{scr@fromphone@var}{% |
| 3137 |
\hyxmp@pdfstringdef\hyxmp@koma@phones{\scr@fromphone@var}% |
| 3138 |
}{% |
| 3139 |
}% |
| 3140 |
}% |
| 3141 |
\endgroup |
| 3142 |
} |
| 3143 |
% \end{macrocode} |
| 3144 |
% \end{macro} |
| 3145 |
% \end{macro} |
| 3146 |
% |
| 3147 |
% \begin{macro}{\hyxmp@use@first@valid} |
| 3148 |
% Given a \pkgname{hyperxmp} option~(|#1|), its current value~(|#2|), |
| 3149 |
% and a comma-separated list of option names~(|#3|), if the current |
| 3150 |
% value is empy, invoke \cs{hypersetup} to set the option to the first |
| 3151 |
% non-empty item in the list. If all items in the list are empty, do |
| 3152 |
% nothing. |
| 3153 |
% \changes{v5.3}{2020/05/29}{Added this macro} |
| 3154 |
% \begin{macrocode} |
| 3155 |
\newcommand*{\hyxmp@use@first@valid}[3]{% |
| 3156 |
\@ifmtargexp{#2}{% |
| 3157 |
\hyxmp@use@first@valid@i{#1}#3,!,% |
| 3158 |
}% |
| 3159 |
{}% |
| 3160 |
} |
| 3161 |
% \end{macrocode} |
| 3162 |
% \end{macro} |
| 3163 |
% |
| 3164 |
% \begin{macro}{\hyxmp@use@first@valid@i} |
| 3165 |
% This macro performs all the work for \cs{hyxmp@use@first@valid}. It |
| 3166 |
% loops over a comma-separated list of macros~(|#2|), stopping when it |
| 3167 |
% encounters an end-of-list marker~(``|!|''). The first list element |
| 3168 |
% that is neither undefined nor empty is assigned to a given option |
| 3169 |
% name~(|#1|) using \cs{hypersetup}. |
| 3170 |
% \begin{macrocode} |
| 3171 |
\def\hyxmp@use@first@valid@i#1#2,{% |
| 3172 |
\def\next{\hyxmp@use@first@valid@i{#1}}% |
| 3173 |
\ifx#2!% |
| 3174 |
\let\next=\relax |
| 3175 |
\else |
| 3176 |
\ifx#2\undefined |
| 3177 |
\else |
| 3178 |
\@ifnotmtargexp{#2}{% |
| 3179 |
\hypersetup{#1={#2}}% |
| 3180 |
\def\next##1!,{}% |
| 3181 |
}% |
| 3182 |
\fi |
| 3183 |
\fi |
| 3184 |
\next |
| 3185 |
} |
| 3186 |
% \end{macrocode} |
| 3187 |
% \end{macro} |
| 3188 |
% |
| 3189 |
% \begin{macro}{\hyxmp@auto@assign@data} |
| 3190 |
% If certain metadata are unspecified, try to specify meaningful values |
| 3191 |
% using data provided by author via other means (e.g.,~\cs{title} for |
| 3192 |
% the document's title). |
| 3193 |
% \begin{macrocode} |
| 3194 |
\newcommand*{\hyxmp@auto@assign@data}{% |
| 3195 |
% \end{macrocode} |
| 3196 |
% If \cs{@pdflang} is not set, see if we can detect the document |
| 3197 |
% language via either the \pkgname{babel} or \pkgname{polyglossia} |
| 3198 |
% packages. |
| 3199 |
% \begin{macrocode} |
| 3200 |
\@if@def@and@nonempty{@pdflang}{% |
| 3201 |
\let\hyxmp@dc@lang=\@pdflang |
| 3202 |
}{% |
| 3203 |
\hyxmp@detect@langs |
| 3204 |
}% |
| 3205 |
% \end{macrocode} |
| 3206 |
% Replace an empty \cs{@pdfmetalang}. If \cs{@pdflang} is defined, use |
| 3207 |
% that as the metadata language. Otherwise, use \xmpterm{x-default}. |
| 3208 |
% \begin{macrocode} |
| 3209 |
\ifx\@pdfmetalang\@empty |
| 3210 |
\ifx\@pdflang\@empty |
| 3211 |
\let\@pdfmetalang=\hyxmp@x@default |
| 3212 |
\else |
| 3213 |
\edef\@pdfmetalang{\@pdflang}% |
| 3214 |
\fi |
| 3215 |
\fi |
| 3216 |
% \end{macrocode} |
| 3217 |
% Identify various author-provided information that can be co-opted |
| 3218 |
% for use as \acro{XMP} metadata. |
| 3219 |
% \changes{v2.7}{2016/02/01}{Automatically use \cs{title} and \cs{author} |
| 3220 |
% if \protect\optname{pdftitle} and \protect\optname{pdfauthor} are left |
| 3221 |
% unspecified. Thanks to Maciej Radziejewski for the suggestion} |
| 3222 |
% \changes{v5.3}{2020/05/29}{Consider other author-provided sources of |
| 3223 |
% metadata. Thanks to Robin Schwab for proposing that |
| 3224 |
% \protect\pkgname{hyperxmp} use the \Koma\ letter classes's metadata} |
| 3225 |
% \changes{v5.5}{2020/07/24}{Moved the language-detection and |
| 3226 |
% \protect\XeTeX\ date-detection code here from the |
| 3227 |
% \protect\cs{hyxmp@at@end} block} |
| 3228 |
% \changes{v5.5}{2020/07/24}{Use \protect\LuaTeX\ mechanisms, when available, |
| 3229 |
% to automatically compute the page count} |
| 3230 |
% \changes{v5.5}{2020/07/24}{Moved title and author autodetection to the |
| 3231 |
% \protect\cs{AtEndPreamble}} |
| 3232 |
% \begin{macrocode} |
| 3233 |
\hyxmp@use@first@valid{pdfcontactemail}{\@pdfcontactemail}{% |
| 3234 |
\scr@fromemail@var |
| 3235 |
}% |
| 3236 |
\hyxmp@set@koma@phones |
| 3237 |
\hyxmp@use@first@valid{pdfcontactphone}{\@pdfcontactphone}{% |
| 3238 |
\hyxmp@koma@phones |
| 3239 |
}% |
| 3240 |
\hyxmp@use@first@valid{pdfcontacturl}{\@pdfcontacturl}{% |
| 3241 |
\scr@fromurl@var |
| 3242 |
}% |
| 3243 |
\hyxmp@use@first@valid{pdfsubtitle}{\@pdfsubtitle}{% |
| 3244 |
\@subtitle |
| 3245 |
}% |
| 3246 |
\hyxmp@use@first@valid{pdfpublisher}{\@pdfpublisher}{% |
| 3247 |
\@publishers |
| 3248 |
}% |
| 3249 |
% \end{macrocode} |
| 3250 |
% We handle the \clsname{acmart} class specially. \clsname{acmart} |
| 3251 |
% stores author-provided contact information in a structured format that |
| 3252 |
% we can process fairly easily. Note that if the author is not using |
| 3253 |
% the \clsname{acmart} class, \cs{hyxmp@parse@acmart} will have been |
| 3254 |
% redefined to do nothing. |
| 3255 |
% \begin{macrocode} |
| 3256 |
\hyxmp@parse@acmart |
| 3257 |
% \end{macrocode} |
| 3258 |
% Most \acro{PDF} standards dictate that if the same metadata appear in |
| 3259 |
% both the \acro{XMP} packet and the \acro{PDF} \pdfterm{Info} |
| 3260 |
% dictionary, the metadata must match. This requirement poses a problem |
| 3261 |
% for a user-unspecified \optname{pdfcreationdate} in the context of |
| 3262 |
% \XeLaTeX\@. In this case we explicitly define |\@pdfcreationdate| as |
| 3263 |
% |\hyxmp@today@pdf| to prevent the \cmdname{xdvipdfmx} back-end |
| 3264 |
% processor from detecting a missing \pdfterm{CreationDate} in the |
| 3265 |
% \pdfterm{Info} dictionary and adding its own---typically a few seconds |
| 3266 |
% after \pkgname{hyperxmp} has constructed an \xmpprop{xmp:CreateDate} |
| 3267 |
% for the \acro{XMP} metadata and leading to a metadata mismatch. |
| 3268 |
% \begin{macrocode} |
| 3269 |
\@ifundefined{XeTeXversion}{}{% |
| 3270 |
\@ifmtargexp{\@pdfcreationdate}{% |
| 3271 |
\let\@pdfcreationdate=\hyxmp@today@pdf |
| 3272 |
}% |
| 3273 |
{}% |
| 3274 |
}% |
| 3275 |
% \end{macrocode} |
| 3276 |
% Query the document currently being built for page and byte counts. |
| 3277 |
% \begin{macrocode} |
| 3278 |
\hyxmp@query@self |
| 3279 |
} |
| 3280 |
% \end{macrocode} |
| 3281 |
% \end{macro} |
| 3282 |
% |
| 3283 |
% Determine the size of the output file from the \emph{previous} run of |
| 3284 |
% \LuaLaTeX\@. This action has to be performed before the |
| 3285 |
% |\begin{document}| because at that point the size of the output file |
| 3286 |
% is reset to zero. We use |\jobname.pdf| as the name of the output |
| 3287 |
% file because |status.output_file_name| is not defined at this point. |
| 3288 |
% |
| 3289 |
% It's possible to use \pdfLaTeX's \cs{pdffilesize} primitive to query |
| 3290 |
% the size of |\jobname.pdf| under \pdfLaTeX\@. Unfortunately, doing so |
| 3291 |
% has a side effect of making \progname{latexmk} view the |
| 3292 |
% \acro{PDF} file as an input file, which puts \progname{latexmk} in an |
| 3293 |
% infinite build loop. (This was the case for \pkgname{hyperxmp} v5.5 |
| 3294 |
% and v5.6.) See the discussion at |
| 3295 |
% \url{https://github.com/borisveytsman/acmart/issues/413} for more |
| 3296 |
% information. |
| 3297 |
% \changes{v5.7}{2020/11/01}{Do not automatically compute the |
| 3298 |
% \protect\acro{PDF} file size under \protect\pdfLaTeX\ because this confuses |
| 3299 |
% \protect\progname{latexmk}. Thanks to John Collins, Nelson Posse Lago, |
| 3300 |
% Derek Dreyer, and the other contributors to |
| 3301 |
% \protect\href{https://github.com/borisveytsman/acmart/issues/413}{\protect\pkgname{acmart} issue \#413}, |
| 3302 |
% ``Latexmk goes into an infinite loop even on sample files from ACM''} |
| 3303 |
% \changes{v5.8}{2020/11/05}{Take |
| 3304 |
% \protect\mbox{\protect\texttt{-\kern0pt-output-directory}} into |
| 3305 |
% consideration when querying the output file size. Thanks to John |
| 3306 |
% Collins for pointing out that the user can change the output |
| 3307 |
% directory} |
| 3308 |
% \begin{macrocode} |
| 3309 |
\ifLuaTeX |
| 3310 |
% \end{macrocode} |
| 3311 |
% Now that we know we're running \LuaLaTeX\ we define a Lua function, |
| 3312 |
% |get_pdf_size|, that takes the base name of the output file and |
| 3313 |
% returns the number of bytes in the corresponding \acro{PDF} file. One |
| 3314 |
% difficulty is that, at the time of this writing, \LuaTeX\ lacks a |
| 3315 |
% mechanism for querying the full name of the output file. Our |
| 3316 |
% workaround is a tad kludgy but seems to work. We walk the list of |
| 3317 |
% command-line arguments for |
| 3318 |
% \mbox{``|-\kern0pt-output-directory=|\meta{dir}''}. (We in fact |
| 3319 |
% accept either one or two initial dashes and abbreviations as terse as |
| 3320 |
% \mbox{``|-output-d|''}.) Then, we concatenate the output directory |
| 3321 |
% (or ``|.|'' if unspecified), a path separator, the given base name of |
| 3322 |
% the job, and a ``|.pdf|'' extension. Alas, different operating |
| 3323 |
% systems use different path separators so we have to query the |
| 3324 |
% operating-system type to select an appropriate separator: ``|\|'' on |
| 3325 |
% Windows/\acro{DOS} and ``|/|'' on everything else. |
| 3326 |
% |
| 3327 |
% |get_pdf_size| is called regardless of whether we're producing |
| 3328 |
% \acro{PDF} or \acro{DVI} output. We assume that even if the user |
| 3329 |
% specified |--output-format=dvi|, the user's intention is eventually to |
| 3330 |
% convert the document to \acro{PDF}. |
| 3331 |
% \begin{macrocode} |
| 3332 |
\begin{luacode*} |
| 3333 |
function get_pdf_size (bname) |
| 3334 |
% \end{macrocode} |
| 3335 |
% Search the list of command-line arguments for the output directory. |
| 3336 |
% \begin{macrocode} |
| 3337 |
local odir = "" |
| 3338 |
for _, opt in ipairs(arg) do |
| 3339 |
local m = string.match(opt, "%-output%-d.-=(.*)") |
| 3340 |
if m then |
| 3341 |
odir = m |
| 3342 |
end |
| 3343 |
end |
| 3344 |
% \end{macrocode} |
| 3345 |
% Set the path separator to either ``|/|'' or ``|\|'', depending on the |
| 3346 |
% operating system. |
| 3347 |
% \begin{macrocode} |
| 3348 |
local sep = "/" |
| 3349 |
if os.type == "windows" or os.type == "msdos" then |
| 3350 |
sep = "\\\\" |
| 3351 |
end |
| 3352 |
% \end{macrocode} |
| 3353 |
% Concatenate the output directory, path separator, base name, and |
| 3354 |
% \texttt{.pdf} extension. Do not insert a path separator if either |
| 3355 |
% (1)~no output directory was specified, (2)~the output directory |
| 3356 |
% already ends with the path separator, or (3)~the output directory ends |
| 3357 |
% in a colon (and is therefore a relative directory) on |
| 3358 |
% Windows/\acro{DOS}. As a few examples, |
| 3359 |
% |
| 3360 |
% \bigskip |
| 3361 |
% \noindent |
| 3362 |
% \begingroup |
| 3363 |
% \let\bs=\textbackslash |
| 3364 |
% \begin{tabular}{@{\quad\textbullet~}l@{~+~}l@{~+~}l@{~+~``\texttt{.pdf}''~=~}l@{}} |
| 3365 |
% ``'' & ``\texttt{/}'' & ``\texttt{myfile}'' |
| 3366 |
% & ``\texttt{myfile.pdf}'' \\ |
| 3367 |
% ``\texttt{/docs}'' & ``\texttt{/}'' & ``\texttt{myfile}'' |
| 3368 |
% & ``\texttt{/docs/myfile.pdf}'' \\ |
| 3369 |
% ``\texttt{/docs/}'' & ``\texttt{/}'' & ``\texttt{myfile}'' |
| 3370 |
% & ``\texttt{/docs/myfile.pdf}'' \\ |
| 3371 |
% ``\texttt{C:\bs docs}'' & ``\texttt{\bs}'' & ``\texttt{myfile}'' |
| 3372 |
% & ``\texttt{C:\bs docs\bs myfile.pdf}'' \\ |
| 3373 |
% ``\texttt{C:\bs docs\bs}'' & ``\texttt{\bs}'' & ``\texttt{myfile}'' |
| 3374 |
% & ``\texttt{C:\bs docs\bs myfile.pdf}'' \\ |
| 3375 |
% ``\texttt{C:\bs}'' & ``\texttt{\bs}'' & ``\texttt{myfile}'' |
| 3376 |
% & ``\texttt{C:\bs myfile.pdf}'' \\ |
| 3377 |
% ``\texttt{C:}'' & ``\texttt{\bs}'' & ``\texttt{myfile}'' |
| 3378 |
% & ``\texttt{C:myfile.pdf}'' \\ |
| 3379 |
% \end{tabular} |
| 3380 |
% \endgroup |
| 3381 |
% \bigskip |
| 3382 |
% \begin{macrocode} |
| 3383 |
local dlast = string.sub(odir, -1) |
| 3384 |
if odir == "" or dlast == sep or (dlast == ":" and sep == "\\\\") then |
| 3385 |
sep = "" |
| 3386 |
end |
| 3387 |
local fname = odir .. sep .. bname .. ".pdf" |
| 3388 |
% \end{macrocode} |
| 3389 |
% Query the file size and return it. |
| 3390 |
% \begin{macrocode} |
| 3391 |
local nbytes = lfs.attributes(fname, "size") |
| 3392 |
return nbytes |
| 3393 |
end |
| 3394 |
\end{luacode*} |
| 3395 |
% \end{macrocode} |
| 3396 |
% Now that we've defined |get_pdf_size| we invoke it, passing it |
| 3397 |
% \cs{hyxmp@jobname} as the base name of the job. (Recall that |
| 3398 |
% \cs{hyxmp@jobname} is the same as \cs{jobname} but with any |
| 3399 |
% surrounding double quotes removed.) We store |get_pdf_size|'s |
| 3400 |
% output---which will be empty if the \acro{PDF} file doesn't yet |
| 3401 |
% exist---in \cs{hyxmp@prev@pdf@size}. |
| 3402 |
% \begin{macrocode} |
| 3403 |
\xdef\hyxmp@prev@pdf@size{% |
| 3404 |
\luadirect{ |
| 3405 |
nbytes = get_pdf_size("\hyxmp@jobname") |
| 3406 |
if nbytes then |
| 3407 |
tex.write(nbytes) |
| 3408 |
end |
| 3409 |
}% |
| 3410 |
}% |
| 3411 |
\fi |
| 3412 |
% \end{macrocode} |
| 3413 |
% |
| 3414 |
% \begin{macro}{\hyxmp@query@self} |
| 3415 |
% Query the document currently being built to acquire page and byte counts. |
| 3416 |
% \changes{v5.5}{2020/07/25}{Added this macro} |
| 3417 |
% \begin{macrocode} |
| 3418 |
\newcommand*{\hyxmp@query@self}{% |
| 3419 |
% \end{macrocode} |
| 3420 |
% \LaTeX's |totalpages| counter tracks the number of pages written. We |
| 3421 |
% use this mechanism to assign \cs{@pdfnumpages}. |
| 3422 |
% \changes{v5.11}{2022/10/16}{Use \protect\cs{thetotalpages} to compute |
| 3423 |
% the page count in an engine-independent manner. Thanks to Ulrike |
| 3424 |
% Fischer for recommending this mechanism} |
| 3425 |
% \begin{macrocode} |
| 3426 |
\@if@def@and@nonempty{@pdfnumpages}{% |
| 3427 |
}{% |
| 3428 |
\xdef\@pdfnumpages{\thetotalpages}% |
| 3429 |
}% |
| 3430 |
% \end{macrocode} |
| 3431 |
% If \optname{pdfbytes} hasn't been set, set it to the output file's size |
| 3432 |
% from the previous run. |
| 3433 |
% \begin{macrocode} |
| 3434 |
\hyxmp@use@first@valid{pdfbytes}{\@pdfbytes}{% |
| 3435 |
\hyxmp@prev@pdf@size |
| 3436 |
}% |
| 3437 |
} |
| 3438 |
% \end{macrocode} |
| 3439 |
% \end{macro} |
| 3440 |
% |
| 3441 |
% \begin{macro}{\hyxmp@parse@acmart} |
| 3442 |
% The \clsname{acmart} class stores a rich set of author metadata in its |
| 3443 |
% \cs{addresses} macro. \cs{hyxmp@parse@acmart} extracts the contact |
| 3444 |
% information for the first author and converts that to \acro{XMP} |
| 3445 |
% metadata. |
| 3446 |
% \changes{v5.3}{2020/05/30}{Added this macro} |
| 3447 |
% \begin{macrocode} |
| 3448 |
\newcommand*{\hyxmp@parse@acmart}{% |
| 3449 |
\begingroup |
| 3450 |
% \end{macrocode} |
| 3451 |
% \begin{macro}{\@author} |
| 3452 |
% \clsname{acmart} has already invoked |
| 3453 |
% |\hypersetup{pdfauthor=|\dots|}| to specify the complete list of |
| 3454 |
% authors. At this point, |\@author| is defined to produce a warning |
| 3455 |
% message. We locally redefine it to do nothing. |
| 3456 |
% \begin{macrocode} |
| 3457 |
\let\@author=\@gobble |
| 3458 |
% \end{macrocode} |
| 3459 |
% \end{macro} |
| 3460 |
% \begin{macro}{\email} |
| 3461 |
% \begin{macro}{\hyxmp@address@val} |
| 3462 |
% Within \cs{addresses}, \cs{email} is defined to accept two arguments, |
| 3463 |
% the second of which is the author's email address. |
| 3464 |
% \begin{macrocode} |
| 3465 |
\def\email##1##2{% |
| 3466 |
\def\hyxmp@address@val{##2}% |
| 3467 |
\hyxmp@use@first@valid{pdfcontactemail}{\@pdfcontactemail}{% |
| 3468 |
\hyxmp@address@val |
| 3469 |
}% |
| 3470 |
}% |
| 3471 |
% \end{macrocode} |
| 3472 |
% \end{macro} |
| 3473 |
% \end{macro} |
| 3474 |
% \begin{macro}{\streetaddress} |
| 3475 |
% \begin{macro}{\hyxmp@address@val} |
| 3476 |
% \cs{streetaddress} wraps the author's street address. |
| 3477 |
% \begin{macrocode} |
| 3478 |
\def\streetaddress##1{% |
| 3479 |
\def\hyxmp@address@val{##1}% |
| 3480 |
\hyxmp@use@first@valid{pdfcontactaddress}{\@pdfcontactaddress}{% |
| 3481 |
\hyxmp@address@val |
| 3482 |
}% |
| 3483 |
}% |
| 3484 |
% \end{macrocode} |
| 3485 |
% \end{macro} |
| 3486 |
% \end{macro} |
| 3487 |
% \begin{macro}{\city} |
| 3488 |
% \begin{macro}{\hyxmp@address@val} |
| 3489 |
% \cs{city} wraps the author's city name. |
| 3490 |
% \begin{macrocode} |
| 3491 |
\def\city##1{% |
| 3492 |
\def\hyxmp@address@val{##1}% |
| 3493 |
\hyxmp@use@first@valid{pdfcontactcity}{\@pdfcontactcity}{% |
| 3494 |
\hyxmp@address@val |
| 3495 |
}% |
| 3496 |
}% |
| 3497 |
% \end{macrocode} |
| 3498 |
% \end{macro} |
| 3499 |
% \end{macro} |
| 3500 |
% \begin{macro}{\state} |
| 3501 |
% \begin{macro}{\hyxmp@address@val} |
| 3502 |
% \cs{state} wraps the author's state or region name. |
| 3503 |
% \begin{macrocode} |
| 3504 |
\def\state##1{% |
| 3505 |
\def\hyxmp@address@val{##1}% |
| 3506 |
\hyxmp@use@first@valid{pdfcontactregion}{\@pdfcontactregion}{% |
| 3507 |
\hyxmp@address@val |
| 3508 |
}% |
| 3509 |
}% |
| 3510 |
% \end{macrocode} |
| 3511 |
% \end{macro} |
| 3512 |
% \end{macro} |
| 3513 |
% \begin{macro}{\country} |
| 3514 |
% \begin{macro}{\hyxmp@address@val} |
| 3515 |
% \cs{country} wraps the author's country name. |
| 3516 |
% \begin{macrocode} |
| 3517 |
\def\country##1{% |
| 3518 |
\def\hyxmp@address@val{##1}% |
| 3519 |
\hyxmp@use@first@valid{pdfcontactcountry}{\@pdfcontactcountry}{% |
| 3520 |
\hyxmp@address@val |
| 3521 |
}% |
| 3522 |
}% |
| 3523 |
% \end{macrocode} |
| 3524 |
% \end{macro} |
| 3525 |
% \end{macro} |
| 3526 |
% \begin{macro}{\postcode} |
| 3527 |
% \begin{macro}{\hyxmp@address@val} |
| 3528 |
% \cs{postcode} wraps the author's postal code. |
| 3529 |
% \begin{macrocode} |
| 3530 |
\def\postcode##1{% |
| 3531 |
\def\hyxmp@address@val{##1}% |
| 3532 |
\hyxmp@use@first@valid{pdfcontactpostcode}{\@pdfcontactpostcode}{% |
| 3533 |
\hyxmp@address@val |
| 3534 |
}% |
| 3535 |
}% |
| 3536 |
% \end{macrocode} |
| 3537 |
% \end{macro} |
| 3538 |
% \end{macro} |
| 3539 |
% \begin{macro}{\affiliation} |
| 3540 |
% We want to produce \acro{XMP} metadata for only a single affiliation. |
| 3541 |
% Although \cs{hyxmp@use@first@valid} will ensure that only the first |
| 3542 |
% email, city, country, etc.\ encountered is considered, we run the |
| 3543 |
% first of one affiliation defining, say, a city and state but no |
| 3544 |
% country and a subsequent affiliation defining a country. In that |
| 3545 |
% case, the \acro{XMP} would include the first author's city and state |
| 3546 |
% and the subsequent author's country. Hence, we define |
| 3547 |
% \cs{affiliation} to ``self destruct'' after its first use, discarding |
| 3548 |
% all further affiliations. |
| 3549 |
% \begin{macrocode} |
| 3550 |
\def\affiliation##1##2{% |
| 3551 |
##2% |
| 3552 |
\let\affiliation=\@gobbletwo |
| 3553 |
}% |
| 3554 |
% \end{macrocode} |
| 3555 |
% \end{macro} |
| 3556 |
% |
| 3557 |
% We want to evaluate \cs{addresses} with the preceding local |
| 3558 |
% definitions in effect, but we don't want to typeset any text appearing |
| 3559 |
% in the string. Hence, we ``typeset'' \cs{addresses} within a box that |
| 3560 |
% is subsequently discarded. |
| 3561 |
% \begin{macrocode} |
| 3562 |
\setbox0=\hbox{\addresses}% |
| 3563 |
\endgroup |
| 3564 |
% \end{macrocode} |
| 3565 |
% |
| 3566 |
% \clsname{acmart} supports other relevant metadata in addition to the |
| 3567 |
% authors' mailing addresses. For instance, papers accepted for |
| 3568 |
% publication indicate their \acro{DOI} number. However, papers under |
| 3569 |
% review will contain either a placeholder \acro{DOI}, |
| 3570 |
% ``10.1145/nnnnnnn.nnnnnnn'', or the example \acro{DOI} specified in |
| 3571 |
% the \clsname{acmart} example document, ``10.1145/1122445.1122456''. |
| 3572 |
% We ignore both of those \acro{DOI}s. |
| 3573 |
% \changes{v5.4}{2020/06/16}{Bug fix: Correct a missing ``else'' argument |
| 3574 |
% in two invocations of \protect\cs{@if@def@and@nonempty}} |
| 3575 |
% \begin{macrocode} |
| 3576 |
\@if@def@and@nonempty{@acmDOI}{% |
| 3577 |
\IfSubStr{\@acmDOI}{10.1145/1122445.1122456}{}{% |
| 3578 |
\IfSubStr{\@acmDOI}{10.1145/nnnnnnn.nnnnnnn}{}{% |
| 3579 |
\hyxmp@use@first@valid{pdfdoi}{\@pdfdoi}{% |
| 3580 |
\@acmDOI |
| 3581 |
}% |
| 3582 |
}% |
| 3583 |
}% |
| 3584 |
}% |
| 3585 |
{}% |
| 3586 |
% \end{macrocode} |
| 3587 |
% \begin{macro}{\hyxmp@strip@isbn@date} |
| 3588 |
% \begin{macro}{\hyxmp@acm@isbn} |
| 3589 |
% Papers appearing in conference proceedings specify the proceedings' |
| 3590 |
% \acro{ISBN}. As with \cs{@acmDOI} above, we ignore both the |
| 3591 |
% placeholder \acro{ISBN}, ``978-x-xxxx-xxxx-x/YY/MM'', and the example |
| 3592 |
% \acro{ISBN}, ``978-1-4503-XXXX-X/18/06''. We also strip off the |
| 3593 |
% ``\texttt{/}\meta{year}\texttt{/}\meta{month}'' suffix so as to |
| 3594 |
% include a true \acro{ISBN} in the \acro{XMP} metadata. |
| 3595 |
% \begin{macrocode} |
| 3596 |
\@if@def@and@nonempty{@acmISBN}{% |
| 3597 |
\IfSubStr{\@acmISBN}{XXXX}{}{% |
| 3598 |
\IfSubStr{\@acmISBN}{xxxx}{}{% |
| 3599 |
\def\hyxmp@strip@isbn@date##1/##2!{##1}% |
| 3600 |
\edef\hyxmp@acm@isbn{% |
| 3601 |
\expandafter\hyxmp@strip@isbn@date\@acmISBN/!% |
| 3602 |
}% |
| 3603 |
\hyxmp@use@first@valid{pdfisbn}{\@pdfisbn}{% |
| 3604 |
\hyxmp@acm@isbn |
| 3605 |
}% |
| 3606 |
}% |
| 3607 |
}% |
| 3608 |
}% |
| 3609 |
{}% |
| 3610 |
% \end{macrocode} |
| 3611 |
% \end{macro} |
| 3612 |
% \end{macro} |
| 3613 |
% \begin{macro}{\hyxmp@acm@publisher} |
| 3614 |
% The publisher is of course \acro{ACM}. |
| 3615 |
% \begin{macrocode} |
| 3616 |
\def\hyxmp@acm@publisher{Association for Computing Machinery}% |
| 3617 |
\hyxmp@use@first@valid{pdfpublisher}{\@pdfpublisher}{% |
| 3618 |
\hyxmp@acm@publisher |
| 3619 |
}% |
| 3620 |
% \end{macrocode} |
| 3621 |
% Use the journal name if defined, otherwise the book name (for |
| 3622 |
% conference proceedings). |
| 3623 |
% \begin{macrocode} |
| 3624 |
\hyxmp@use@first@valid{pdfpublication}{\@pdfpublication}{% |
| 3625 |
\@journalName,% |
| 3626 |
\@acmBooktitle,% |
| 3627 |
\@acmConference |
| 3628 |
}% |
| 3629 |
% \end{macrocode} |
| 3630 |
% \end{macro} |
| 3631 |
% \begin{macro}{\hyxmp@acm@pubtype} |
| 3632 |
% \clsname{acmart} makes clear whether it's typesetting a journal |
| 3633 |
% article. If it's not a journal, we assume it's a book (conference |
| 3634 |
% proceedings). |
| 3635 |
% \begin{macrocode} |
| 3636 |
\if@ACM@journal |
| 3637 |
\def\hyxmp@acm@pubtype{journal}% |
| 3638 |
\else |
| 3639 |
\def\hyxmp@acm@pubtype{book}% |
| 3640 |
\fi |
| 3641 |
\hyxmp@use@first@valid{pdfpubtype}{\@pdfpubtype}{% |
| 3642 |
\hyxmp@acm@pubtype |
| 3643 |
}% |
| 3644 |
% \end{macrocode} |
| 3645 |
% \end{macro} |
| 3646 |
% Journal articles have a volume and issue number. |
| 3647 |
% \begin{macrocode} |
| 3648 |
\hyxmp@use@first@valid{pdfvolumenum}{\@pdfvolumenum}{% |
| 3649 |
\@acmVolume |
| 3650 |
}% |
| 3651 |
\hyxmp@use@first@valid{pdfissuenum}{\@pdfissuenum}{% |
| 3652 |
\@acmNumber |
| 3653 |
}% |
| 3654 |
} |
| 3655 |
% \end{macrocode} |
| 3656 |
% \end{macro} |
| 3657 |
% |
| 3658 |
% Nullify \cs{hyxmp@parse@acmart} if the author is not using the |
| 3659 |
% \clsname{acmart} class. |
| 3660 |
% \begin{macrocode} |
| 3661 |
\@ifclassloaded{acmart}{}{\let\hyxmp@parse@acmart=\relax} |
| 3662 |
% \end{macrocode} |
| 3663 |
% |
| 3664 |
% \begin{macro}{\hyxmp@dc@lang} |
| 3665 |
% \cs{hyxmp@dc@lang} is a comma-separated list of all languages used in |
| 3666 |
% the document. |
| 3667 |
% \begin{macrocode} |
| 3668 |
\let\hyxmp@dc@lang=\@empty |
| 3669 |
% \end{macrocode} |
| 3670 |
% \end{macro} |
| 3671 |
% |
| 3672 |
% \begin{macro}{\hyxmp@detect@langs} |
| 3673 |
% If \optname{pdflang} was not specified, try to determine the document |
| 3674 |
% language(s) using either \pkgname{babel}'s or \pkgname{polyglossia}'s |
| 3675 |
% definitions. |
| 3676 |
% \changes{v5.3}{2020/06/08}{Acquire the default language from the |
| 3677 |
% \protect\pkgname{polyglossia} package, if loaded. Thanks to |
| 3678 |
% Robin Schwab for bringing that package to my attention} |
| 3679 |
% \changes{v5.4}{2020/06/16}{Refactored language detection into a |
| 3680 |
% separate command} |
| 3681 |
% \changes{v5.5}{2020/07/21}{Set the language(s) immediately instead of |
| 3682 |
% deferring them to \protect\cs{hyxmp@set@dc@lang}} |
| 3683 |
% \begin{macrocode} |
| 3684 |
\newcommand*{\hyxmp@detect@langs}{% |
| 3685 |
\@ifundefined{mainbcp47id}{% |
| 3686 |
\@ifundefined{LocaleForEach}{% |
| 3687 |
% \end{macrocode} |
| 3688 |
% The document doesn't appear to have loaded either \pkgname{babel} or |
| 3689 |
% \pkgname{polyglossia}. In this case we have one small task to do. In |
| 3690 |
% older versions of \pkgname{hyperref}, \cs{@pdflang} is set to |
| 3691 |
% \cs{@empty} if \optname{pdflang} is not specified. In newer versions |
| 3692 |
% of \pkgname{hyperref}, \cs{@pdflang} is set to \cs{relax} if |
| 3693 |
% \optname{pdflang} is not specified. The latter is a bit problematic |
| 3694 |
% for \pkgname{hyperxmp} because it makes \cs{@pdflang} non-expandable, |
| 3695 |
% which causes a literal ``\cs{@pdflang}'' to be written as \acro{XMP} |
| 3696 |
% metadata. To avoid that situation we explicitly set \cs{@pdflang} to |
| 3697 |
% \cs{@empty} to avoid problems with non-expandable symbols. |
| 3698 |
% \changes{v2.3a}{2013/04/16}{Bug fix: Redefine \cs{@pdflang} as |
| 3699 |
% \cs{@empty} when \protect\pkgname{hyperref} has set |
| 3700 |
% it to \cs{relax}} |
| 3701 |
% \begin{macrocode} |
| 3702 |
\let\@pdflang=\@empty |
| 3703 |
}{% |
| 3704 |
% \end{macrocode} |
| 3705 |
% \changes{v5.4}{2020/06/17}{Added support for \protect\pkgname{babel}} |
| 3706 |
% \changes{v5.5}{2020/07/16}{Store the main language in \protect\cs{@pdflang}. |
| 3707 |
% Thanks to Javier Bezos for his help with the \protect\pkgname{hyperxmp} |
| 3708 |
% code and for modifying \protect\pkgname{babel} for |
| 3709 |
% \protect\pkgname{hyperxmp}'s benefit} |
| 3710 |
% \begin{macro}{\hyxmp@dc@lang} |
| 3711 |
% \begin{macro}{\hyxmp@lang@tag} |
| 3712 |
% \begin{macro}{\hyxmp@lang@name} |
| 3713 |
% \begin{macro}{\@pdflang} |
| 3714 |
% Use \pkgname{babel}'s \cs{LocaleForEach} and \cs{getlocaleproperty} to |
| 3715 |
% set \cs{@pdflang} to the document's main language and |
| 3716 |
% \cs{hyxmp@dc@lang} to a comma-separated list of all languages used. |
| 3717 |
% \begin{macrocode} |
| 3718 |
\BabelEnsureInfo |
| 3719 |
\LocaleForEach{% |
| 3720 |
\getlocaleproperty\hyxmp@lang@tag{##1}{identification/tag.bcp47}% |
| 3721 |
\ifx\hyxmp@dc@lang\@empty |
| 3722 |
\xdef\hyxmp@dc@lang{\hyxmp@lang@tag}% |
| 3723 |
\else |
| 3724 |
\xdef\hyxmp@dc@lang{\hyxmp@dc@lang,\hyxmp@lang@tag}% |
| 3725 |
\fi |
| 3726 |
\def\hyxmp@lang@name{##1}% |
| 3727 |
\ifx\hyxmp@lang@name\bbl@main@language |
| 3728 |
\edef\@pdflang{\hyxmp@lang@tag}% |
| 3729 |
\fi |
| 3730 |
}% |
| 3731 |
}% |
| 3732 |
}{% |
| 3733 |
% \end{macrocode} |
| 3734 |
% \end{macro} |
| 3735 |
% \end{macro} |
| 3736 |
% \end{macro} |
| 3737 |
% \end{macro} |
| 3738 |
% Use \pkgname{polyglossia}'s \cs{mainbcp47id} as the document's main |
| 3739 |
% language and its \cs{xpg@bcp@loaded} as a comma-separated list of all |
| 3740 |
% document languages. |
| 3741 |
% \begin{macrocode} |
| 3742 |
\xdef\@pdflang{\csname mainbcp47id\endcsname}% |
| 3743 |
\edef\hyxmp@dc@lang{\xpg@bcp@loaded}% |
| 3744 |
}% |
| 3745 |
} |
| 3746 |
% \end{macrocode} |
| 3747 |
% \end{macro} |
| 3748 |
% |
| 3749 |
% |
| 3750 |
% \subsection{Manipulating author-supplied data} |
| 3751 |
% |
| 3752 |
% The author provides metadata information to \pkgname{hyperxmp} via |
| 3753 |
% package options to \pkgname{hyperref} or via \pkgname{hyperref}'s |
| 3754 |
% |\hypersetup| command. The functions in this section convert |
| 3755 |
% author-supplied lists (e.g.,~|pdfkeywords={foo, bar, baz}|) into |
| 3756 |
% \LaTeX\ lists (e.g.,~|\@elt {foo}| |\@elt {bar}| |\@elt {baz}|) that |
| 3757 |
% can be more easily manipulated (Section~\ref{sec:list-manip}); parse |
| 3758 |
% dates in both \acro{PDF} and \acro{XMP} formats |
| 3759 |
% (Section~\ref{sec:date-manip}; trim spaces off the ends of strings |
| 3760 |
% (Section~\ref{sec:trim-spaces}); convert text to \acro{XML} |
| 3761 |
% (e.g.,~from |<[email protected]>| to |
| 3762 |
% |<[email protected]>|) (Section~\ref{sec:text-xml}); |
| 3763 |
% simplify the pretty-printing of a begin tag, \acro{XML} text, and end |
| 3764 |
% tag (Section~\ref{sec:output-xml}; and provide metadata in multiple |
| 3765 |
% languages (Section~\ref{sec:lang-alt}). |
| 3766 |
% |
| 3767 |
% \subsubsection{List manipulation} |
| 3768 |
% \label{sec:list-manip} |
| 3769 |
% |
| 3770 |
% We define a macro for converting a list of comma-separated elements |
| 3771 |
% (e.g.,~the list of \acro{PDF} keywords) to a list of \LaTeX\ |
| 3772 |
% |\@elt|-separated elements. |
| 3773 |
% |
| 3774 |
% \begin{macro}{\hyxmp@commas@to@list} |
| 3775 |
% Given a macro name~(|#1|) and a comma-separated list~(|#2|), define |
| 3776 |
% the macro name as the elements of the list, each preceded by |\@elt|. |
| 3777 |
% (Executing the macro therefore applies |\@elt| to each element in |
| 3778 |
% turn.) |
| 3779 |
% \begin{macrocode} |
| 3780 |
\newcommand*{\hyxmp@commas@to@list}[2]{% |
| 3781 |
\gdef#1{}% |
| 3782 |
\expandafter\hyxmp@commas@to@list@i\expandafter#1#2,,% |
| 3783 |
} |
| 3784 |
% \end{macrocode} |
| 3785 |
% \end{macro} |
| 3786 |
% |
| 3787 |
% \begin{macro}{\hyxmp@commas@to@list@i} |
| 3788 |
% \begin{macro}{\next} |
| 3789 |
% Recursively construct macro~|#1| from comma-separated list~|#2|. Stop |
| 3790 |
% if |#2| is empty. |
| 3791 |
% \begin{macrocode} |
| 3792 |
\def\hyxmp@commas@to@list@i#1#2,{% |
| 3793 |
\gdef\hyxmp@sublist{#2}% |
| 3794 |
\ifx\hyxmp@sublist\@empty |
| 3795 |
\let\next=\relax |
| 3796 |
\else |
| 3797 |
\hyxmp@trimspaces\hyxmp@sublist |
| 3798 |
\@cons{#1}{{\hyxmp@sublist}}% |
| 3799 |
\def\next{\hyxmp@commas@to@list@i{#1}}% |
| 3800 |
\fi |
| 3801 |
\next |
| 3802 |
} |
| 3803 |
% \end{macrocode} |
| 3804 |
% \end{macro} |
| 3805 |
% \end{macro} |
| 3806 |
% |
| 3807 |
% \begin{macro}{\xmpcomma} |
| 3808 |
% Because \pkgname{hyperxmp} splits lists at commas, a comma cannot |
| 3809 |
% normally be used within a list. We there provide an |\xmpcomma| macro |
| 3810 |
% that can expand to either a true comma or a placeholder character |
| 3811 |
% depending on the situation. Here, we bind it to a comma so it can be |
| 3812 |
% used in \emph{any} \pkgname{hyperxmp} option, not just those that treat |
| 3813 |
% commas specially. |
| 3814 |
% \changes{v2.0}{2012/08/25}{Added this macro} |
| 3815 |
% \changes{v2.2}{2012/12/07}{Changed the default from |
| 3816 |
% \texttt{\string\string\string\relax} to an ordinary comma} |
| 3817 |
% \begin{macrocode} |
| 3818 |
\def\xmpcomma{,}% |
| 3819 |
% \end{macrocode} |
| 3820 |
% \end{macro} |
| 3821 |
% |
| 3822 |
% \begin{macro}{\hyxmp@comma} |
| 3823 |
% This is what |\xmpcomma| maps to during list construction. We assume |
| 3824 |
% that documents will never otherwise use an \acro{ETX} (|^^C|) |
| 3825 |
% character in their \acro{XMP} metadata. |
| 3826 |
% \changes{v2.0}{2012/08/25}{Added this macro} |
| 3827 |
% \begin{macrocode} |
| 3828 |
\bgroup |
| 3829 |
\catcode`\^^C=11 |
| 3830 |
\gdef\hyxmp@comma{^^C} |
| 3831 |
\egroup |
| 3832 |
% \end{macrocode} |
| 3833 |
% \end{macro} |
| 3834 |
% |
| 3835 |
% \begin{macro}{\hyxmp@uscore} |
| 3836 |
% This is what |\_| temporarily maps to during packet construction. |
| 3837 |
% Because underscores are replaced by spaces, we need a mechanism to |
| 3838 |
% preserve user-specified underscores (e.g.,~in email addresses). We |
| 3839 |
% assume that documents will never otherwise use an \acro{NAK} (|^^U|) |
| 3840 |
% character in their \acro{XMP} metadata. |
| 3841 |
% \changes{v2.5}{2014/06/19}{Added this macro} |
| 3842 |
% \begin{macrocode} |
| 3843 |
\bgroup |
| 3844 |
\catcode`\^^U=11 |
| 3845 |
\gdef\hyxmp@uscore{^^U} |
| 3846 |
\egroup |
| 3847 |
% \end{macrocode} |
| 3848 |
% \end{macro} |
| 3849 |
% |
| 3850 |
% \begin{macro}{\xmpquote} |
| 3851 |
% Adobe Acrobat likes to see double quotes around list elements that |
| 3852 |
% contain commas when the entire list appears within a single \acro{XMP} |
| 3853 |
% tag (e.g.,~|<pdf:Keywords>|). However, it doesn't like to see double |
| 3854 |
% quotes around list elements that contain commas when the list is |
| 3855 |
% broken up into individual components (i.e.,~using |<rdf:li>| tags). |
| 3856 |
% We therefore introduce an |\xmpquote| macro that quotes or doesn't |
| 3857 |
% quote its argument based on context. Here, we bind |\xmpquote| to |
| 3858 |
% |\relax| to prevent it from prematurely quoting or not quoting. |
| 3859 |
% \changes{v2.0}{2012/09/10}{Added this macro} |
| 3860 |
% \begin{macrocode} |
| 3861 |
\let\xmpquote=\relax |
| 3862 |
% \end{macrocode} |
| 3863 |
% \end{macro} |
| 3864 |
% |
| 3865 |
% \begin{macro}{\xmptilde} |
| 3866 |
% As a convenience for the user, we define |\xmptilde| as a category~12 |
| 3867 |
% (other) ``|~|'' character. |
| 3868 |
% \changes{v2.4}{2014/01/01}{Added this macro} |
| 3869 |
% \begin{macrocode} |
| 3870 |
\bgroup |
| 3871 |
\catcode`\~=12% |
| 3872 |
\gdef\xmptilde{~}% |
| 3873 |
\egroup |
| 3874 |
% \end{macrocode} |
| 3875 |
% \end{macro} |
| 3876 |
% |
| 3877 |
% \begin{macro}{\XMPTruncateList} |
| 3878 |
% \changes{v2.0}{2012/09/07}{Added this macro} |
| 3879 |
% \changes{v2.3b}{2013/07/18}{Made all definitions local to avoid |
| 3880 |
% spurious \texttt{Too many unprocessed floats} errors when running |
| 3881 |
% with \string\pkgname{memoir}} |
| 3882 |
% \changes{v4.0}{2019/03/31}{Deprecated this macro} |
| 3883 |
% \begin{macro}{\hyxmp@temp@str} |
| 3884 |
% \begin{macro}{\hyxmp@temp@list} |
| 3885 |
% \begin{macro}{\@elt} |
| 3886 |
% As a workaround for the inability of older Adobe Acrobat versions to |
| 3887 |
% display author lists correctly we introduce a hack that replaces a |
| 3888 |
% list with its first element. One can then write |
| 3889 |
% ``|\XMPTruncateList{pdfauthor}|'' and have Adobe Acrobat display the |
| 3890 |
% author list correctly. |
| 3891 |
% \begin{macrocode} |
| 3892 |
\newcommand{\XMPTruncateList}[1]{{% |
| 3893 |
\PackageWarning{hyperxmp}{% |
| 3894 |
\noexpand\XMPTruncateList has been deprecated since\MessageBreak |
| 3895 |
hyperxmp 4.0 and may be removed in future\MessageBreak |
| 3896 |
versions of the package. \noexpand\XMPTruncateList\MessageBreak |
| 3897 |
was found}% |
| 3898 |
\edef\hyxmp@temp@str{\csname hyxmp@#1\endcsname}% |
| 3899 |
\hyxmp@commas@to@list{\hyxmp@temp@list}{\hyxmp@temp@str}% |
| 3900 |
\def\@elt##1{% |
| 3901 |
\expandafter\gdef\csname @#1\endcsname{##1}% |
| 3902 |
\let\@elt=\@gobble |
| 3903 |
} |
| 3904 |
\hyxmp@temp@list |
| 3905 |
}} |
| 3906 |
% \end{macrocode} |
| 3907 |
% \end{macro} |
| 3908 |
% \end{macro} |
| 3909 |
% \end{macro} |
| 3910 |
% \end{macro} |
| 3911 |
% |
| 3912 |
% |
| 3913 |
% \subsubsection{Date manipulation} |
| 3914 |
% \label{sec:date-manip} |
| 3915 |
% |
| 3916 |
% \pkgname{hyperxmp} needs to manipulate two types of date (really, |
| 3917 |
% timestamp) formats: \acro{PDF} format and \acro{XMP} format. |
| 3918 |
% \acro{PDF} timestamps are of the form |
| 3919 |
% ``|D:|\textsc{yyyymmdd}hhmmss|+|\textsc{tt}|'|tt|'|'' |
| 3920 |
% \makeatletter |
| 3921 |
% \@ifundefined{pdffeedback}{^^A |
| 3922 |
% \@ifundefined{pdfcreationdate}{^^A |
| 3923 |
% }{^^A |
| 3924 |
% (e.g.,~\texttt{\pdfcreationdate})^^A |
| 3925 |
% }^^A |
| 3926 |
% }{^^A |
| 3927 |
% (e.g.,~\texttt{\pdffeedback creationdate})^^A |
| 3928 |
% } |
| 3929 |
% \makeatother |
| 3930 |
% ~\cite{Adobe2008:PDF}, while \acro{XMP} timestamps are of the form |
| 3931 |
% ``\textsc{yyyy}|-|\textsc{mm}|-|\textsc{dd}|T|hh|:|mm|:|ss|+|\textsc{tt}|:|tt'' |
| 3932 |
% \makeatletter |
| 3933 |
% \@ifundefined{pdffeedback}{^^A |
| 3934 |
% \@ifundefined{pdfcreationdate}{^^A |
| 3935 |
% \unskip |
| 3936 |
% }{^^A |
| 3937 |
% (e.g.,~\texttt{\expandafter\hyxmp@pdf@to@xmp@date\pdfcreationdate})^^A |
| 3938 |
% }^^A |
| 3939 |
% }{^^A |
| 3940 |
% (e.g.,~\texttt{\expandafter\hyxmp@pdf@to@xmp@date\pdffeedback creationdate})^^A |
| 3941 |
% }^^A |
| 3942 |
% \makeatother |
| 3943 |
% ~\cite{Adobe2012:XMP}. The |\hyxmp@as@pdf@date| and |
| 3944 |
% |\hyxmp@as@xmp@date| macros defined in this section facilitate |
| 3945 |
% timestamp conversions to \acro{PDF} and \acro{XMP} formats, |
| 3946 |
% respectively. |
| 3947 |
% |
| 3948 |
% \begin{macro}{\hyxmp@first@char} |
| 3949 |
% \begin{macro}{\hyxmp@first@char@i} |
| 3950 |
% Return the first character of a string. This macro is fully expandable. |
| 3951 |
% \begin{macrocode} |
| 3952 |
\def\hyxmp@first@char#1{\hyxmp@first@char@i#1\relax} |
| 3953 |
\def\hyxmp@first@char@i#1#2\relax{#1} |
| 3954 |
% \end{macrocode} |
| 3955 |
% \end{macro} |
| 3956 |
% \end{macro} |
| 3957 |
% |
| 3958 |
% \begin{macro}{\hyxmp@as@xmp@date} |
| 3959 |
% If necessary, convert a timestamp to \acro{XMP} format. That is, if |
| 3960 |
% the timestamp is in \acro{PDF} format, convert it; otherwise, leave it |
| 3961 |
% unmodified. This macro is fully expandable. |
| 3962 |
% \changes{v3.2}{2017/02/20}{Added this macro} |
| 3963 |
% \begin{macrocode} |
| 3964 |
\def\hyxmp@as@xmp@date#1{% |
| 3965 |
\expandafter\ifnum\expandafter`\hyxmp@first@char@i#1\relax=`D |
| 3966 |
\hyxmp@pdf@to@xmp@date{#1}% |
| 3967 |
\else |
| 3968 |
#1% |
| 3969 |
\fi |
| 3970 |
} |
| 3971 |
% \end{macrocode} |
| 3972 |
% \end{macro} |
| 3973 |
% |
| 3974 |
% \begin{macro}{\hyxmp@pdf@to@xmp@date} |
| 3975 |
% Convert a timestamp from \acro{PDF} format to \acro{XMP} format. This |
| 3976 |
% macro is fully expandable. |
| 3977 |
% \changes{v2.4}{2013/12/24}{Added this macro} |
| 3978 |
% \begin{macrocode} |
| 3979 |
\def\hyxmp@pdf@to@xmp@date#1:#2#3#4#5#6#7#8#9{% |
| 3980 |
#2#3#4#5-#6#7-#8#9% |
| 3981 |
\hyxmp@parse@time |
| 3982 |
} |
| 3983 |
% \end{macrocode} |
| 3984 |
% \end{macro} |
| 3985 |
% |
| 3986 |
% \begin{macro}{\hyxmp@parse@time} |
| 3987 |
% This is a helper function for |\hyxmp@pdf@to@xmp@date|. |
| 3988 |
% |\hyxmp@pdf@to@xmp@date| proper parses only the year, month, and day |
| 3989 |
% then calls |\hyxmp@parse@time|. |\hyxmp@parse@time| parses the |
| 3990 |
% hours, minutes, and seconds then calls |\hyxmp@parse@tz@char|. |
| 3991 |
% \changes{v2.4}{2013/12/24}{Added this macro} |
| 3992 |
% \begin{macrocode} |
| 3993 |
\def\hyxmp@parse@time#1#2#3#4#5#6{% |
| 3994 |
T#1#2:#3#4:#5#6% |
| 3995 |
\hyxmp@parse@tz@char |
| 3996 |
} |
| 3997 |
% \end{macrocode} |
| 3998 |
% \end{macro} |
| 3999 |
% |
| 4000 |
% \begin{macro}{\hyxmp@parse@tz@char} |
| 4001 |
% This is another helper function for |\hyxmp@pdf@to@xmp@date|. So far, |
| 4002 |
% the date and time have been parsed. |\hyxmp@parse@tz@char| parses the |
| 4003 |
% first character of the timezone descriptor. This can be one of |
| 4004 |
% ``|+|'' for eastern timezones (\mbox{UTC$+x$}, including Asia, |
| 4005 |
% Oceania, and most of Europe), ``|-|'' for western timezones |
| 4006 |
% (\mbox{UTC$-x$}, primarily the Americas), or ``|Z|'' for Zulu time |
| 4007 |
% (\mbox{UTC$+0$}). Timezones beginning with ``|+|'' or ``|-|'' are |
| 4008 |
% followed by an offset in hours and minutes (parsed by |
| 4009 |
% |\hyxmp@parse@tz|; timezones beginning with ``|Z|'' are not. |
| 4010 |
% \changes{v2.4}{2013/12/24}{Added this macro} |
| 4011 |
% \begin{macrocode} |
| 4012 |
\def\hyxmp@parse@tz@char#1{% |
| 4013 |
#1% |
| 4014 |
\ifx#1-% |
| 4015 |
\expandafter\hyxmp@parse@tz |
| 4016 |
\else |
| 4017 |
\ifx#1+% |
| 4018 |
\expandafter\hyxmp@parse@tz |
| 4019 |
\fi |
| 4020 |
\fi |
| 4021 |
} |
| 4022 |
% \end{macrocode} |
| 4023 |
% \end{macro} |
| 4024 |
% |
| 4025 |
% \begin{macro}{\hyxmp@parse@tz} |
| 4026 |
% This is the final helper function for |\hyxmp@pdf@to@xmp@date|. It |
| 4027 |
% parses the piece of the timezone comprising the offset from |
| 4028 |
% Coordinated Universal Time, measured in hours and minutes. |
| 4029 |
% \changes{v2.4}{2013/12/24}{Added this macro} |
| 4030 |
% \begin{macrocode} |
| 4031 |
\def\hyxmp@parse@tz#1'#2'{% |
| 4032 |
#1:#2% |
| 4033 |
} |
| 4034 |
% \end{macrocode} |
| 4035 |
% \end{macro} |
| 4036 |
% |
| 4037 |
% \begin{macro}{\hyxmp@as@pdf@date} |
| 4038 |
% If necessary, convert a timestamp to \acro{PDF} format. That is, if |
| 4039 |
% the timestamp is in \acro{XMP} format, convert it; otherwise, leave it |
| 4040 |
% unmodified. This macro is fully expandable. |
| 4041 |
% \changes{v3.2}{2017/02/20}{Added this macro} |
| 4042 |
% \begin{macrocode} |
| 4043 |
\def\hyxmp@as@pdf@date#1{% |
| 4044 |
\expandafter\ifx\hyxmp@first@char@i#1\relax D% |
| 4045 |
#1% |
| 4046 |
\else |
| 4047 |
\hyxmp@xmp@to@pdf@date{#1}% |
| 4048 |
\fi |
| 4049 |
} |
| 4050 |
% \end{macrocode} |
| 4051 |
% \end{macro} |
| 4052 |
% |
| 4053 |
% \begin{macro}{\hyxmp@xmp@to@pdf@date} |
| 4054 |
% Convert a timestamp from \acro{XMP} format to \acro{PDF} format. This |
| 4055 |
% macro is fully expandable. |
| 4056 |
% \changes{v2.4}{2013/12/24}{Added this macro} |
| 4057 |
% \begin{macrocode} |
| 4058 |
\def\hyxmp@xmp@to@pdf@date#1{% |
| 4059 |
D:\hyxmp@xmp@to@pdf@date@i#1\relax\relax |
| 4060 |
} |
| 4061 |
% \end{macrocode} |
| 4062 |
% \end{macro} |
| 4063 |
% |
| 4064 |
% \begin{macro}{\hyxmp@xmp@to@pdf@date@i} |
| 4065 |
% Parse the year for |\hyxmp@xmp@to@pdf@date|. |
| 4066 |
% \begin{macrocode} |
| 4067 |
\def\hyxmp@xmp@to@pdf@date@i#1#2#3#4#5#6{% |
| 4068 |
#1#2#3#4% |
| 4069 |
\ifx#5-% |
| 4070 |
\expandafter\hyxmp@xmp@to@pdf@date@ii\expandafter#6% |
| 4071 |
\fi |
| 4072 |
} |
| 4073 |
% \end{macrocode} |
| 4074 |
% \end{macro} |
| 4075 |
% |
| 4076 |
% \begin{macro}{\hyxmp@xmp@to@pdf@date@ii} |
| 4077 |
% Parse the month for |\hyxmp@xmp@to@pdf@date|. |
| 4078 |
% \begin{macrocode} |
| 4079 |
\def\hyxmp@xmp@to@pdf@date@ii#1#2#3#4{% |
| 4080 |
#1#2% |
| 4081 |
\ifx#3-% |
| 4082 |
\expandafter\hyxmp@xmp@to@pdf@date@iii\expandafter#4% |
| 4083 |
\fi |
| 4084 |
} |
| 4085 |
% \end{macrocode} |
| 4086 |
% \end{macro} |
| 4087 |
% |
| 4088 |
% \begin{macro}{\hyxmp@xmp@to@pdf@date@iii} |
| 4089 |
% Parse the day for |\hyxmp@xmp@to@pdf@date|. |
| 4090 |
% \begin{macrocode} |
| 4091 |
\def\hyxmp@xmp@to@pdf@date@iii#1#2#3#4{% |
| 4092 |
#1#2% |
| 4093 |
\ifx#3T% |
| 4094 |
\expandafter\hyxmp@xmp@to@pdf@date@iv\expandafter#4% |
| 4095 |
\fi |
| 4096 |
} |
| 4097 |
% \end{macrocode} |
| 4098 |
% \end{macro} |
| 4099 |
% |
| 4100 |
% \begin{macro}{\hyxmp@xmp@to@pdf@date@iv} |
| 4101 |
% Parse the hour for |\hyxmp@xmp@to@pdf@date|. |
| 4102 |
% \begin{macrocode} |
| 4103 |
\def\hyxmp@xmp@to@pdf@date@iv#1#2#3#4{% |
| 4104 |
#1#2% |
| 4105 |
\ifx#3:% |
| 4106 |
\expandafter\hyxmp@xmp@to@pdf@date@v\expandafter#4% |
| 4107 |
\fi |
| 4108 |
} |
| 4109 |
% \end{macrocode} |
| 4110 |
% \end{macro} |
| 4111 |
% |
| 4112 |
% \begin{macro}{\hyxmp@xmp@to@pdf@date@v} |
| 4113 |
% Parse the minute for |\hyxmp@xmp@to@pdf@date|. |
| 4114 |
% \begin{macrocode} |
| 4115 |
\def\hyxmp@xmp@to@pdf@date@v#1#2#3#4{% |
| 4116 |
#1#2% |
| 4117 |
\ifx#3:% |
| 4118 |
\expandafter\hyxmp@xmp@to@pdf@date@vi\expandafter#4% |
| 4119 |
\fi |
| 4120 |
} |
| 4121 |
% \end{macrocode} |
| 4122 |
% \end{macro} |
| 4123 |
% |
| 4124 |
% \begin{macro}{\hyxmp@gobbletwo} |
| 4125 |
% This is exactly the same as \LaTeXe's |\@gobbletwo| but needs to be a |
| 4126 |
% different literal for |\hyxmp@xmp@to@pdf@date@vii|'s pattern-matching |
| 4127 |
% to work. |
| 4128 |
% \begin{macrocode} |
| 4129 |
\let\hyxmp@gobbletwo=\@gobbletwo |
| 4130 |
% \end{macrocode} |
| 4131 |
% \end{macro} |
| 4132 |
% |
| 4133 |
% \begin{macro}{\hyxmp@xmp@to@pdf@date@vi} |
| 4134 |
% Parse the second for |\hyxmp@xmp@to@pdf@date|. The challenge here is |
| 4135 |
% that we need to handle four cases for the character following the |
| 4136 |
% seconds---``|+|'', ``|-|'', ``|Z|'', and no character---without sacrificing |
| 4137 |
% expandability. Our tricky solution is to insert a |\@gobbletwo| as a |
| 4138 |
% sentinel and let |\hyxmp@xmp@to@pdf@date@vi| discard everything up to |
| 4139 |
% that sentinel (i.e.,~all the other conditionals). |
| 4140 |
% \begin{macrocode} |
| 4141 |
\def\hyxmp@xmp@to@pdf@date@vi#1#2#3#4{% |
| 4142 |
#1#2% |
| 4143 |
\ifx#3+% |
| 4144 |
+\expandafter\hyxmp@xmp@to@pdf@date@vii |
| 4145 |
\fi |
| 4146 |
\ifx#3-% |
| 4147 |
-\expandafter\hyxmp@xmp@to@pdf@date@vii |
| 4148 |
\fi |
| 4149 |
\ifx#3Z% |
| 4150 |
Z% |
| 4151 |
\fi |
| 4152 |
\ifx#3\relax |
| 4153 |
\expandafter\hyxmp@gobbletwo |
| 4154 |
\fi |
| 4155 |
\@gobbletwo #4% |
| 4156 |
} |
| 4157 |
% \end{macrocode} |
| 4158 |
% \end{macro} |
| 4159 |
% |
| 4160 |
% \begin{macro}{\hyxmp@xmp@to@pdf@date@vii} |
| 4161 |
% Parse the time-zone hours for |\hyxmp@xmp@to@pdf@date|. |
| 4162 |
% \begin{macrocode} |
| 4163 |
\def\hyxmp@xmp@to@pdf@date@vii#1\@gobbletwo#2#3#4#5{% |
| 4164 |
#2#3% |
| 4165 |
\ifx#4:% |
| 4166 |
\expandafter\hyxmp@xmp@to@pdf@date@viii\expandafter#5% |
| 4167 |
\fi |
| 4168 |
} |
| 4169 |
% \end{macrocode} |
| 4170 |
% \end{macro} |
| 4171 |
% |
| 4172 |
% \begin{macro}{\hyxmp@xmp@to@pdf@date@viii} |
| 4173 |
% Parse the time-zone minutes for |\hyxmp@xmp@to@pdf@date|. |
| 4174 |
% \begin{macrocode} |
| 4175 |
\def\hyxmp@xmp@to@pdf@date@viii#1#2#3#4{% |
| 4176 |
'#1#2'% |
| 4177 |
} |
| 4178 |
% \end{macrocode} |
| 4179 |
% \end{macro} |
| 4180 |
% |
| 4181 |
% \begin{macro}{\hyxmp@today@xmp@define} |
| 4182 |
% Use \tex\ primitives to define a given macro as today's date in |
| 4183 |
% \textsc{yyyy}-\textsc{mm}-\textsc{dd}|T|hh|:|mm|Z| format. |
| 4184 |
% \changes{v2.4}{2013/12/21}{Added this macro} |
| 4185 |
% \changes{v3.0}{2016/07/03}{Modified to accept the name of a macro |
| 4186 |
% to define} |
| 4187 |
% \changes{v3.2}{2017/02/21}{Modified to include hours and minutes} |
| 4188 |
% \changes{v5.0}{2020/03/16}{Modified to specify UTC} |
| 4189 |
% \begin{macrocode} |
| 4190 |
\def\hyxmp@today@xmp@define#1{% |
| 4191 |
% \end{macrocode} |
| 4192 |
% The date is a straightforward representation of \tex's |\year|, |
| 4193 |
% |\month|, and |\day| primitives, with the latter two zero-padded to |
| 4194 |
% two digits apiece. |
| 4195 |
% \begin{macrocode} |
| 4196 |
\xdef#1{\the\year}% |
| 4197 |
\ifnum\month<10 |
| 4198 |
\xdef#1{#1-0\the\month}% |
| 4199 |
\else |
| 4200 |
\xdef#1{#1-\the\month}% |
| 4201 |
\fi |
| 4202 |
\ifnum\day<10 |
| 4203 |
\xdef#1{#1-0\the\day}% |
| 4204 |
\else |
| 4205 |
\xdef#1{#1-\the\day}% |
| 4206 |
\fi |
| 4207 |
% \end{macrocode} |
| 4208 |
% \tex\ does not provide the time in terms of separate hours and minutes |
| 4209 |
% but rather as the total number of minutes since midnight (|\time|). |
| 4210 |
% There's no mechanism in \tex\ to query the number of seconds since |
| 4211 |
% midnight or the timezone so we omit those fields when defining |
| 4212 |
% macro~|#1|. |
| 4213 |
% \begin{macrocode} |
| 4214 |
\@hyxmp@count=\time |
| 4215 |
\divide\@hyxmp@count by 60 |
| 4216 |
\ifnum\@hyxmp@count<10 |
| 4217 |
\xdef#1{#1T0\the\@hyxmp@count}% |
| 4218 |
\else |
| 4219 |
\xdef#1{#1T\the\@hyxmp@count}% |
| 4220 |
\fi |
| 4221 |
\multiply\@hyxmp@count by -60 |
| 4222 |
\advance\@hyxmp@count by \time |
| 4223 |
\ifnum\@hyxmp@count<10 |
| 4224 |
\xdef#1{#1:0\the\@hyxmp@count}% |
| 4225 |
\else |
| 4226 |
\xdef#1{#1:\the\@hyxmp@count}% |
| 4227 |
\fi |
| 4228 |
\xdef#1{#1Z}% |
| 4229 |
} |
| 4230 |
% \end{macrocode} |
| 4231 |
% \end{macro} |
| 4232 |
% |
| 4233 |
% \begin{macro}{\hyxmp@try@today} |
| 4234 |
% If |\hyxmp@today@xmp| is still empty and |#1| is defined, evaluate |#2|. |
| 4235 |
% Otherwise, do nothing. |
| 4236 |
% \begin{macrocode} |
| 4237 |
\def\hyxmp@try@today#1#2{% |
| 4238 |
\@ifmtargexp{\hyxmp@today@xmp}{% |
| 4239 |
\@ifundefined{#1}{}{#2}% |
| 4240 |
}% |
| 4241 |
{}% |
| 4242 |
} |
| 4243 |
% \end{macrocode} |
| 4244 |
% \end{macro} |
| 4245 |
% |
| 4246 |
% \begin{macro}{\hyxmp@today@xmp} |
| 4247 |
% Define |\hyxmp@today@xmp| as the current date and (if available) time and |
| 4248 |
% timezone in \acro{XMP} \xmpterm{Date} format~\cite{Adobe2012:XMP}. |
| 4249 |
% \changes{v2.4}{2013/12/24}{Modified the code to parse the time and |
| 4250 |
% timezone from \texttt{\string\string\string\pdfcreationdate}, as |
| 4251 |
% proposed by Florian Breitwieser} |
| 4252 |
% \changes{v5.0}{2020/03/15}{Support \string\XeTeX's \string\cs{filemoddate}} |
| 4253 |
% \begin{macrocode} |
| 4254 |
\def\hyxmp@today@xmp{} |
| 4255 |
% \end{macrocode} |
| 4256 |
% Case 1: |\pdfcreationdate| is defined (\pdfLaTeX\ and pre-0.85 \LuaLaTeX). |
| 4257 |
% \begin{macrocode} |
| 4258 |
\hyxmp@try@today{pdfcreationdate}{% |
| 4259 |
\edef\hyxmp@today@xmp{\expandafter\hyxmp@pdf@to@xmp@date\pdfcreationdate}% |
| 4260 |
} |
| 4261 |
% \end{macrocode} |
| 4262 |
% Case 2: |\pdffeedback| is defined (\LuaLaTeX~0.85+). |
| 4263 |
% \begin{macrocode} |
| 4264 |
\hyxmp@try@today{pdffeedback}{% |
| 4265 |
\edef\hyxmp@today@xmp{\expandafter\hyxmp@pdf@to@xmp@date\pdffeedback creationdate}% |
| 4266 |
} |
| 4267 |
% \end{macrocode} |
| 4268 |
% \begin{macro}{\hyxmp@timestamp} |
| 4269 |
% Case 3: |\filemoddate| is defined (\XeLaTeX). |
| 4270 |
% In this case, we treat the timestamp of the job's |.log| file as the |
| 4271 |
% current date/time. |
| 4272 |
% \label{page:jobname-log} |
| 4273 |
% \changes{v5.1}{2020/04/08}{Don't rely on |
| 4274 |
% \string\cs{jobname}\string\texttt{.aux} existing to query the |
| 4275 |
% current time under \string\XeLaTeX\string\@. Instead, use |
| 4276 |
% \string\cs{jobname}\string\texttt{.log}. Thanks to Ulrike Fischer |
| 4277 |
% for the bug report and for her suggestion to use the log file.} |
| 4278 |
% \begin{macrocode} |
| 4279 |
\hyxmp@try@today{filemoddate}{% |
| 4280 |
\edef\hyxmp@today@xmp{\filemoddate{\[email protected]}}% |
| 4281 |
\edef\next{% |
| 4282 |
\edef\noexpand\hyxmp@today@xmp{\noexpand\hyxmp@as@xmp@date{\hyxmp@today@xmp}}% |
| 4283 |
}% |
| 4284 |
\next |
| 4285 |
}% |
| 4286 |
% \end{macrocode} |
| 4287 |
% Case 4: None of the above. |
| 4288 |
% Do the best we can using the available \tex\ primitives (|\year|, |
| 4289 |
% |\month|, |\day|, and |\time|. |
| 4290 |
% \begin{macrocode} |
| 4291 |
\hyxmp@try@today{year}{% |
| 4292 |
\hyxmp@today@xmp@define\hyxmp@today@xmp |
| 4293 |
} |
| 4294 |
% \end{macrocode} |
| 4295 |
% \end{macro} |
| 4296 |
% \end{macro} |
| 4297 |
% |
| 4298 |
% \begin{macro}{\hyxmp@today@pdf} |
| 4299 |
% Define |\hyxmp@today@pdf| as the current date and (if available) time |
| 4300 |
% and timezone in \acro{PDF} date format~\cite{Adobe2008:PDF}. To do so |
| 4301 |
% we simply convert |\hyxmp@today@xmp|, defined above, from \acro{XMP} |
| 4302 |
% to \acro{PDF} using |\hyxmp@xmp@to@pdf@date|. |
| 4303 |
% \changes{v5.0}{2020/03/16}{Added this macro} |
| 4304 |
% \begin{macrocode} |
| 4305 |
\expandafter\edef\expandafter\hyxmp@today@pdf\expandafter{% |
| 4306 |
\expandafter\hyxmp@xmp@to@pdf@date\expandafter{\hyxmp@today@xmp}% |
| 4307 |
} |
| 4308 |
% \end{macrocode} |
| 4309 |
% \end{macro} |
| 4310 |
% |
| 4311 |
% |
| 4312 |
% \subsubsection{Trimming leading and trailing spaces} |
| 4313 |
% \label{sec:trim-spaces} |
| 4314 |
% |
| 4315 |
% To make it easier for \acro{XMP} processors to manipulate our output we |
| 4316 |
% define a |\hyxmp@trimspaces| macro to strip leading and trailing |
| 4317 |
% spaces from various data fields. |
| 4318 |
% |
| 4319 |
% \begin{macro}{\hyxmp@trimspaces} |
| 4320 |
% Redefine a macro as its previous value but without leading or trailing |
| 4321 |
% spaces. This code---as well as that for its helper macros, |
| 4322 |
% |\hyxmp@trimb| and |\hyxmp@trimc|---was taken almost verbatim from a |
| 4323 |
% solution to an \emph{Around the Bend} puzzle~\cite{Downes1994:ATB15}. |
| 4324 |
% Inline comments are also taken from the solution text. |
| 4325 |
% \begin{macrocode} |
| 4326 |
\catcode`\Q=3 |
| 4327 |
% \end{macrocode} |
| 4328 |
% |\hyxmp@trimspaces\x| redefines |\x| to have the same replacement text |
| 4329 |
% sans leading and trailing space tokens. |
| 4330 |
% \begin{macrocode} |
| 4331 |
\newcommand{\hyxmp@trimspaces}[1]{% |
| 4332 |
% \end{macrocode} |
| 4333 |
% Use grouping to emulate a multi-token |afterassignment| queue. |
| 4334 |
% \begin{macrocode} |
| 4335 |
\begingroup |
| 4336 |
% \end{macrocode} |
| 4337 |
% Put ``|\toks 0 {|'' into the |afterassignment| queue. |
| 4338 |
% \begin{macrocode} |
| 4339 |
\aftergroup\toks\aftergroup0\aftergroup{% |
| 4340 |
% \end{macrocode} |
| 4341 |
% Apply |\hyxmp@trimb| to the replacement text of |#1|, adding a leading |
| 4342 |
% |\noexpand| to prevent brace stripping and to serve another purpose |
| 4343 |
% later. |
| 4344 |
% \begin{macrocode} |
| 4345 |
\expandafter\hyxmp@trimb\expandafter\noexpand#1Q Q}% |
| 4346 |
% \end{macrocode} |
| 4347 |
% Transfer the trimmed text back into |#1|. |
| 4348 |
% \begin{macrocode} |
| 4349 |
\edef#1{\the\toks0}% |
| 4350 |
} |
| 4351 |
% \end{macrocode} |
| 4352 |
% \end{macro} |
| 4353 |
% |
| 4354 |
% \begin{macro}{\hyxmp@trimb} |
| 4355 |
% |\hyxmp@trimb| removes a trailing space if present, then calls |
| 4356 |
% |\hyxmp@trimc| to clean up any leftover bizarre |Q|s, and trim a |
| 4357 |
% leading space. In order for |\hyxmp@trimc| to work properly we need to |
| 4358 |
% put back a |Q| first. |
| 4359 |
% \begin{macrocode} |
| 4360 |
\def\hyxmp@trimb#1 Q{\hyxmp@trimc#1Q} |
| 4361 |
% \end{macrocode} |
| 4362 |
% \end{macro} |
| 4363 |
% |
| 4364 |
% \begin{macro}{\hyxmp@trimc} |
| 4365 |
% Execute |\vfuzz| assignment to remove leading space; the |\noexpand| |
| 4366 |
% will now prevent unwanted expansion of a macro or other expandable |
| 4367 |
% token at the beginning of the trimmed text. The |\endgroup| will feed |
| 4368 |
% in the |\aftergroup| tokens after the |\vfuzz| assignment is |
| 4369 |
% completed. |
| 4370 |
% \begin{macrocode} |
| 4371 |
\def\hyxmp@trimc#1Q#2{\afterassignment\endgroup \vfuzz\the\vfuzz#1} |
| 4372 |
\catcode`\Q=11 |
| 4373 |
% \end{macrocode} |
| 4374 |
% \end{macro} |
| 4375 |
% |
| 4376 |
% |
| 4377 |
% \subsubsection{Converting text to XML} |
| 4378 |
% \label{sec:text-xml} |
| 4379 |
% |
| 4380 |
% The ``|<|'', ``|>|'', and ``|&|'' characters are significant to \acro{XML}. |
| 4381 |
% We therefore need to escape them in any author-supplied text. |
| 4382 |
% |
| 4383 |
% \begin{macro}{\ifhyxmp@unicodetex} |
| 4384 |
% \changes{v2.0}{2012/08/02}{Added by Heiko Oberdiek} |
| 4385 |
% \begin{macro}{\hyxmp@unicodetextrue} |
| 4386 |
% \begin{macro}{\hyxmp@unicodetexfalse} |
| 4387 |
% \XeTeX\ and \LuaTeX\ natively support \term{Unicode}. We define the |
| 4388 |
% conditional |\ifhyxmp@unicodetex| to check for these so we can |
| 4389 |
% properly handle encoding conversions. The trick here is that |
| 4390 |
% \term{Unicode} \tex\ implementations compare decimal~64 to |
| 4391 |
% hexadecimal~40 (decimal~64), specified with four carets, and take the |
| 4392 |
% \textsc{true} branch; non-\term{Unicode} \tex\ implementations compare |
| 4393 |
% decimal~64 to character~``|^|'' (decimal~94), ignore the ``|^^0040|'' |
| 4394 |
% and the rest of the \textsc{true} branch, and take the \textsc{false} |
| 4395 |
% branch. |
| 4396 |
% \begin{macrocode} |
| 4397 |
\newif\ifhyxmp@unicodetex |
| 4398 |
\ifnum64=`\^^^^0040\relax |
| 4399 |
\hyxmp@unicodetextrue |
| 4400 |
\else |
| 4401 |
\hyxmp@unicodetexfalse |
| 4402 |
\fi |
| 4403 |
% \end{macrocode} |
| 4404 |
% \end{macro} |
| 4405 |
% \end{macro} |
| 4406 |
% \end{macro} |
| 4407 |
% |
| 4408 |
% \begin{macro}{\SE->pdfdoc@03} |
| 4409 |
% Preserve \acro{ETX} (|^^C|), which is normally an invalid character in |
| 4410 |
% \term{PDFDocEncoding}. We use it in \pkgname{hyperxmp} (and |
| 4411 |
% specifically in |\hyxmp@xmlify| below) as a list-element separator. |
| 4412 |
% \begin{macrocode} |
| 4413 |
\expandafter\def\csname SE->pdfdoc@03\endcsname{0003} |
| 4414 |
% \end{macrocode} |
| 4415 |
% \end{macro} |
| 4416 |
% |
| 4417 |
% \begin{macro}{\SE->pdfdoc@15} |
| 4418 |
% Preserve \acro{NAK} (|^^U|), which is normally an invalid character in |
| 4419 |
% \term{PDFDocEncoding}. We use it in \pkgname{hyperxmp} (and |
| 4420 |
% specifically in |\hyxmp@xmlify| below) as a placeholder for an |
| 4421 |
% underscore character. |
| 4422 |
% \begin{macrocode} |
| 4423 |
\expandafter\def\csname SE->pdfdoc@15\endcsname{0015} |
| 4424 |
% \end{macrocode} |
| 4425 |
% \end{macro} |
| 4426 |
% |
| 4427 |
% \begin{macro}{\hyxmp@xmlify} |
| 4428 |
% \changes{v2.0}{2012/08/02}{Completely rewritten by Heiko Oberdiek to |
| 4429 |
% better support Unicode-enabled \TeX\ programs} |
| 4430 |
% \begin{macro}{\hyxmp@xmlified} |
| 4431 |
% \begin{macro}{\hyxmp@text} |
| 4432 |
% Given a piece of text defined using |\pdfstringdef| (i.e.,~with many |
| 4433 |
% special characters redefined to have category code~11), set |
| 4434 |
% |\hyxmp@xmlified| to the same text but with all occurrences of~``|<|'' |
| 4435 |
% replaced with~|<|, all occurrences of~``|>|'' replaced with~|>|, |
| 4436 |
% and all occurrences of~``|&|'' replaced with~|&|. |
| 4437 |
% \begin{macrocode} |
| 4438 |
\newcommand*{\hyxmp@xmlify}[1]{% |
| 4439 |
\gdef\hyxmp@xmlified{}% |
| 4440 |
% \end{macrocode} |
| 4441 |
% Escaped \acro{PDF} string~$\rightarrow$ \term{PDFDocEncoding}/\term{Unicode} |
| 4442 |
% \begin{macrocode} |
| 4443 |
\EdefUnescapeString\hyxmp@text{#1}% |
| 4444 |
\ifhyxmp@unicodetex |
| 4445 |
% \end{macrocode} |
| 4446 |
% \term{PDFDocEncoding}/\term{Unicode}~$\rightarrow$ \acro{UTF-32BE} |
| 4447 |
% \begin{macrocode} |
| 4448 |
\hyxmp@is@unicode\hyxmp@text{% |
| 4449 |
\StringEncodingConvert |
| 4450 |
\hyxmp@text\hyxmp@text{utf16be}{utf32be}% |
| 4451 |
}{% |
| 4452 |
\ifXeTeX |
| 4453 |
\hyxmp@xetex@crap |
| 4454 |
\else |
| 4455 |
\StringEncodingConvert |
| 4456 |
\hyxmp@text\hyxmp@text{pdfdoc}{utf32be}% |
| 4457 |
\fi |
| 4458 |
}% |
| 4459 |
% \end{macrocode} |
| 4460 |
% \acro{UTF-32BE}~$\rightarrow$ \acro{UTF-32BE} as hex string |
| 4461 |
% \begin{macrocode} |
| 4462 |
\EdefEscapeHex\hyxmp@text{\hyxmp@text}% |
| 4463 |
% \end{macrocode} |
| 4464 |
% \acro{UTF-32BE}~$\rightarrow$ \acro{XML} in \acro{ASCII} |
| 4465 |
% \begin{macrocode} |
| 4466 |
\edef\hyxmp@text{% |
| 4467 |
\expandafter |
| 4468 |
}\expandafter\hyxmp@toxml@unicodetex\hyxmp@text |
| 4469 |
\relax\relax\relax\relax\relax\relax\relax\relax |
| 4470 |
\else |
| 4471 |
% \end{macrocode} |
| 4472 |
% \term{PDFDocEncoding}/\term{Unicode}~$\rightarrow$ \acro{UTF-8} |
| 4473 |
% \begin{macrocode} |
| 4474 |
\hyxmp@is@unicode\hyxmp@text{% |
| 4475 |
\StringEncodingConvert |
| 4476 |
\hyxmp@text\hyxmp@text{utf16be}{utf8}% |
| 4477 |
}{% |
| 4478 |
\StringEncodingConvert |
| 4479 |
\hyxmp@text\hyxmp@text{pdfdoc}{utf8}% |
| 4480 |
}% |
| 4481 |
% \end{macrocode} |
| 4482 |
% \acro{UTF-8}~$\rightarrow$ \acro{UTF-8} as hex string |
| 4483 |
% \begin{macrocode} |
| 4484 |
\EdefEscapeHex\hyxmp@text{\hyxmp@text}% |
| 4485 |
% \end{macrocode} |
| 4486 |
% \acro{UTF-8} as hex string~$\rightarrow$ \acro{XML} in \acro{UTF-8} |
| 4487 |
% as hex string |
| 4488 |
% \begin{macrocode} |
| 4489 |
\edef\hyxmp@text{% |
| 4490 |
\expandafter\hyxmp@toxml\hyxmp@text\@empty\@empty |
| 4491 |
}% |
| 4492 |
% \end{macrocode} |
| 4493 |
% \acro{XML} in \acro{UTF-8} as hex string~$\rightarrow$ \acro{XML} |
| 4494 |
% in \acro{UTF-8} |
| 4495 |
% \begin{macrocode} |
| 4496 |
\EdefUnescapeHex\hyxmp@text{\hyxmp@text}% |
| 4497 |
\fi |
| 4498 |
\global\let\hyxmp@xmlified\hyxmp@text |
| 4499 |
} |
| 4500 |
% \end{macrocode} |
| 4501 |
% \end{macro} |
| 4502 |
% \end{macro} |
| 4503 |
% \end{macro} |
| 4504 |
% |
| 4505 |
% \begin{macro}{\hyxmp@is@unicode} |
| 4506 |
% \changes{v2.0}{2012/08/02}{Added by Heiko Oberdiek} |
| 4507 |
% \begin{macro}{\hyxmp@@is@unicode} |
| 4508 |
% Given a string and two expressions, evaluate the first expression if |
| 4509 |
% the string is \acro{UTF-16BE}-encoded and the second expression if not. |
| 4510 |
% \begin{macrocode} |
| 4511 |
\begingroup |
| 4512 |
\lccode`\<=254 % |
| 4513 |
\lccode`\>=255 % |
| 4514 |
\catcode254=12 % |
| 4515 |
\catcode255=12 % |
| 4516 |
\lowercase{\endgroup |
| 4517 |
\def\hyxmp@is@unicode#1{% |
| 4518 |
\expandafter\hyxmp@@is@unicode#1<>\@nil |
| 4519 |
}% |
| 4520 |
\def\hyxmp@@is@unicode#1<>#2\@nil{% |
| 4521 |
\ifx\\#1\\% |
| 4522 |
\expandafter\@firstoftwo |
| 4523 |
\else |
| 4524 |
\expandafter\@secondoftwo |
| 4525 |
\fi |
| 4526 |
}% |
| 4527 |
} |
| 4528 |
% \end{macrocode} |
| 4529 |
% \end{macro} |
| 4530 |
% \end{macro} |
| 4531 |
% |
| 4532 |
% \begin{macro}{\hyxmp@toxml} |
| 4533 |
% \changes{v2.0}{2012/08/02}{Added by Heiko Oberdiek} |
| 4534 |
% Replace the characters ``\textless'', ``\&'', and ``\textgreater'' with |
| 4535 |
% \acro{XML} entities when using a non-native-\term{Unicode} |
| 4536 |
% \tex\ (\tex\ or \pdfTeX). |
| 4537 |
% \begin{macrocode} |
| 4538 |
\def\hyxmp@toxml#1#2{% |
| 4539 |
\ifx#1\@empty |
| 4540 |
\else |
| 4541 |
\ifnum"#1#2=`\& % |
| 4542 |
26616D703B% & |
| 4543 |
\else\ifnum"#1#2=`\< % |
| 4544 |
266C743B% < |
| 4545 |
\else\ifnum"#1#2=`\> % |
| 4546 |
2667743B% > |
| 4547 |
\else |
| 4548 |
% \end{macrocode} |
| 4549 |
% \cmdname{dvips} wraps text when generating most PostScript code but |
| 4550 |
% preserves line breaks within strings. Unfortunately, \cmdname{dvips} |
| 4551 |
% fails to observe the special case in the PostScript specification that |
| 4552 |
% ``[b]alanced pairs of parentheses in the string require no special |
| 4553 |
% treatment''~\cite{Adobe1996:postscript}. Consequently, \acro{XMP} |
| 4554 |
% data containing parentheses (e.g.,~``\texttt{Copyright (C) 1605 Miguel |
| 4555 |
% de Cervantes}'') confuse \cmdname{dvips} into thinking that the |
| 4556 |
% string has ended after the closing parenthesis and that line breaks |
| 4557 |
% can subsequently be injected safely into the document at arbitrary |
| 4558 |
% points for formatting purposes. This leads to erroneous display by |
| 4559 |
% \acro{PDF} viewers, which honor line breaks within \acro{XMP} tags. |
| 4560 |
% The solution is to insert a backslash before all parentheses when in |
| 4561 |
% \texttt{pdfmark}-generating mode to convince \cmdname{dvips} that the |
| 4562 |
% entire \acro{XMP} packet must be treated as a single, |
| 4563 |
% not-to-be-modified string. |
| 4564 |
% \changes{v2.0}{2012/08/22}{Escaped parentheses written with |
| 4565 |
% \texttt{pdfmark}s to prevent \cmdname{dvips} from line-wrapping the |
| 4566 |
% \protect\acro{XMP} packet} |
| 4567 |
% \begin{macrocode} |
| 4568 |
\@ifundefined{pdfmark}{% |
| 4569 |
#1#2% |
| 4570 |
}{% |
| 4571 |
\ifnum"#1#2=`\( % |
| 4572 |
5C28% \( |
| 4573 |
\else\ifnum"#1#2=`\) % |
| 4574 |
5C29% \) |
| 4575 |
\else |
| 4576 |
#1#2% |
| 4577 |
\fi\fi |
| 4578 |
}% |
| 4579 |
\fi\fi\fi |
| 4580 |
\expandafter\hyxmp@toxml |
| 4581 |
\fi |
| 4582 |
} |
| 4583 |
% \end{macrocode} |
| 4584 |
% \end{macro} |
| 4585 |
% |
| 4586 |
% \begin{macro}{\hyxmp@toxml@unicodetex} |
| 4587 |
% \changes{v2.0}{2012/08/02}{Added by Heiko Oberdiek} |
| 4588 |
% \begin{macro}{\hyxmp@text} |
| 4589 |
% Replace the characters ``\textless'', ``\&'', and ``\textgreater'' with |
| 4590 |
% \acro{XML} entities when using a native-\term{Unicode} |
| 4591 |
% \tex\ (\XeTeX\ or \LuaTeX). |
| 4592 |
% \begin{macrocode} |
| 4593 |
\def\hyxmp@toxml@unicodetex#1#2#3#4#5#6#7#8{% |
| 4594 |
\ifx#1\relax |
| 4595 |
\else |
| 4596 |
\ifnum"#1#2#3#4#5#6#7#8>127 % |
| 4597 |
\uccode`\*="#1#2#3#4#5#6#7#8\relax |
| 4598 |
\uppercase{% |
| 4599 |
\edef\hyxmp@text{\hyxmp@text *}% |
| 4600 |
}% |
| 4601 |
\else\ifnum"#7#8=`\< % |
| 4602 |
\edef\hyxmp@text{\hyxmp@text <}% |
| 4603 |
\else\ifnum"#7#8=`\& % |
| 4604 |
\edef\hyxmp@text{\hyxmp@text &}% |
| 4605 |
\else\ifnum"#7#8=`\> % |
| 4606 |
\edef\hyxmp@text{\hyxmp@text >}% |
| 4607 |
\else\ifnum"#7#8=`\ % |
| 4608 |
\edef\hyxmp@text{\hyxmp@text\space}% |
| 4609 |
\else |
| 4610 |
\uccode`\*="#7#8\relax |
| 4611 |
\uppercase{% |
| 4612 |
\edef\hyxmp@text{\hyxmp@text *}% |
| 4613 |
}% |
| 4614 |
\fi\fi\fi\fi\fi |
| 4615 |
\expandafter\hyxmp@toxml@unicodetex |
| 4616 |
\fi |
| 4617 |
} |
| 4618 |
% \end{macrocode} |
| 4619 |
% \end{macro} |
| 4620 |
% \end{macro} |
| 4621 |
% |
| 4622 |
% \begin{macro}{\hyxmp@skipzeros} |
| 4623 |
% \changes{v2.0}{2012/08/02}{Added by Heiko Oberdiek} |
| 4624 |
% Skip over leading zeroes in the input argument. |
| 4625 |
% \begin{macrocode} |
| 4626 |
\def\hyxmp@skipzeros#1{% |
| 4627 |
\ifx#10% |
| 4628 |
\expandafter\hyxmp@skipzeros |
| 4629 |
\fi |
| 4630 |
} |
| 4631 |
% \end{macrocode} |
| 4632 |
% \end{macro} |
| 4633 |
% |
| 4634 |
% \begin{macro}{\x} |
| 4635 |
% \begin{macro}{\hyxmp@xetex@crap} |
| 4636 |
% \changes{v2.0}{2012/08/02}{Added by Heiko Oberdiek} |
| 4637 |
% \begin{macro}{\hyxmp@try} |
| 4638 |
% \begin{macro}{\hyxmp@crap@result} |
| 4639 |
% \begin{macro}{\hyxmp@text} |
| 4640 |
% In the case of \XeTeX, the strings defined by |\pdfstringdef| can |
| 4641 |
% contain big characters. In this case, the string is treated as |
| 4642 |
% \term{Unicode}. |
| 4643 |
% \begin{macrocode} |
| 4644 |
\begingroup |
| 4645 |
\def\x#1{\endgroup |
| 4646 |
\def\hyxmp@xetex@crap{% |
| 4647 |
\edef\hyxmp@try{% |
| 4648 |
\expandafter\hyxmp@SpaceOther\hyxmp@text#1\@nil |
| 4649 |
}% |
| 4650 |
\let\hyxmp@crap@result=N% |
| 4651 |
\expandafter\hyxmp@crap@test\hyxmp@try\relax |
| 4652 |
\ifx\hyxmp@crap@result Y% |
| 4653 |
\let\hyxmp@text\@empty |
| 4654 |
\expandafter\hyxmp@crap@convert\hyxmp@try\relax |
| 4655 |
\else |
| 4656 |
\StringEncodingConvert\hyxmp@text\hyxmp@text{pdfdoc}{utf32be}% |
| 4657 |
\fi |
| 4658 |
}% |
| 4659 |
} |
| 4660 |
\x{ } |
| 4661 |
% \end{macrocode} |
| 4662 |
% \end{macro} |
| 4663 |
% \end{macro} |
| 4664 |
% \end{macro} |
| 4665 |
% \end{macro} |
| 4666 |
% \end{macro} |
| 4667 |
% |
| 4668 |
% \begin{macro}{\hyxmp@SpaceOther} |
| 4669 |
% Re-encode all spaces in a string with category code~12 (``other''). |
| 4670 |
% \changes{v2.0}{2012/08/02}{Added by Heiko Oberdiek} |
| 4671 |
% \begin{macrocode} |
| 4672 |
\begingroup |
| 4673 |
\catcode`\~=12 % |
| 4674 |
\lccode`\~=`\ % |
| 4675 |
\lowercase{\endgroup |
| 4676 |
\def\hyxmp@SpaceOther#1 #2\@nil{% |
| 4677 |
#1% |
| 4678 |
\ifx\relax#2\relax |
| 4679 |
\expandafter\@gobble |
| 4680 |
\else |
| 4681 |
~% |
| 4682 |
\expandafter\@firstofone |
| 4683 |
\fi |
| 4684 |
{\hyxmp@SpaceOther#2\@nil}% |
| 4685 |
}% |
| 4686 |
} |
| 4687 |
% \end{macrocode} |
| 4688 |
% \end{macro} |
| 4689 |
% |
| 4690 |
% |
| 4691 |
% \begin{macro}{\hyxmp@crap@test} |
| 4692 |
% Determine if we need to treat a string as \term{Unicode}. |
| 4693 |
% \changes{v2.0}{2012/08/02}{Added by Heiko Oberdiek} |
| 4694 |
% \begin{macrocode} |
| 4695 |
\def\hyxmp@crap@test#1{% |
| 4696 |
\ifx#1\relax |
| 4697 |
\else |
| 4698 |
\ifnum`#1>127 % |
| 4699 |
\let\hyxmp@crap@result=Y% |
| 4700 |
\expandafter\expandafter\expandafter\hyxmp@skiptorelax |
| 4701 |
\else |
| 4702 |
\expandafter\expandafter\expandafter\hyxmp@crap@test |
| 4703 |
\fi |
| 4704 |
\fi |
| 4705 |
} |
| 4706 |
% \end{macrocode} |
| 4707 |
% \end{macro} |
| 4708 |
% |
| 4709 |
% \begin{macro}{\hyxmp@skiptorelax} |
| 4710 |
% Discard all tokens up to and including the first |\relax|. |
| 4711 |
% \changes{v2.0}{2012/08/02}{Added by Heiko Oberdiek} |
| 4712 |
% \begin{macrocode} |
| 4713 |
\def\hyxmp@skiptorelax#1\relax{} |
| 4714 |
% \end{macrocode} |
| 4715 |
% \end{macro} |
| 4716 |
% |
| 4717 |
% \begin{macro}{\hyxmp@crap@convert} |
| 4718 |
% \changes{v2.0}{2012/08/02}{Added by Heiko Oberdiek} |
| 4719 |
% \begin{macro}{\hyxmp@num} |
| 4720 |
% \begin{macro}{\hyxmp@text} |
| 4721 |
% Convert a hexadecimal string to a number. |
| 4722 |
% \begin{macrocode} |
| 4723 |
\def\hyxmp@crap@convert#1{% |
| 4724 |
\ifx#1\relax |
| 4725 |
\else |
| 4726 |
\edef\hyxmp@num{\number`#1}% |
| 4727 |
\ifnum\hyxmp@num>"FFFFFF % |
| 4728 |
\lccode`\!=\intcalcDiv{\hyxmp@num}{\number"1000000}\relax |
| 4729 |
\lowercase{\edef\hyxmp@text{\hyxmp@text!}}% |
| 4730 |
\edef\hyxmp@num{\intcalcMod{\hyxmp@num}{\number"1000000}}% |
| 4731 |
\else |
| 4732 |
\edef\hyxmp@text{\hyxmp@text\hyxmp@zero}% |
| 4733 |
\fi |
| 4734 |
\ifnum\hyxmp@num>"FFFF % |
| 4735 |
\lccode`\!=\intcalcDiv{\hyxmp@num}{\number"10000}\relax |
| 4736 |
\lowercase{\edef\hyxmp@text{\hyxmp@text!}}% |
| 4737 |
\edef\hyxmp@num{\intcalcMod{\hyxmp@num}{\number"10000}}% |
| 4738 |
\else |
| 4739 |
\edef\hyxmp@text{\hyxmp@text\hyxmp@zero}% |
| 4740 |
\fi |
| 4741 |
\ifnum\hyxmp@num>"FF % |
| 4742 |
\lccode`\!=\intcalcDiv{\hyxmp@num}{\number"100}\relax |
| 4743 |
\lowercase{\edef\hyxmp@text{\hyxmp@text!}}% |
| 4744 |
\edef\hyxmp@num{\intcalcMod{\hyxmp@num}{\number"100}}% |
| 4745 |
\else |
| 4746 |
\edef\hyxmp@text{\hyxmp@text\hyxmp@zero}% |
| 4747 |
\fi |
| 4748 |
\ifnum\hyxmp@num>0 % |
| 4749 |
\lccode`\!=\hyxmp@num\relax |
| 4750 |
\lowercase{\edef\hyxmp@text{\hyxmp@text!}}% |
| 4751 |
\else |
| 4752 |
\edef\hyxmp@text{\hyxmp@text\hyxmp@zero}% |
| 4753 |
\fi |
| 4754 |
\expandafter\hyxmp@crap@convert |
| 4755 |
\fi |
| 4756 |
} |
| 4757 |
% \end{macrocode} |
| 4758 |
% \end{macro} |
| 4759 |
% \end{macro} |
| 4760 |
% \end{macro} |
| 4761 |
% |
| 4762 |
% \begin{macro}{\hyxmp@zero} |
| 4763 |
% Define a null character with category code~12 (``other''). |
| 4764 |
% \changes{v2.0}{2012/08/02}{Added by Heiko Oberdiek} |
| 4765 |
% \begin{macrocode} |
| 4766 |
\begingroup |
| 4767 |
\catcode0=12 % |
| 4768 |
\gdef\hyxmp@zero{^^00}% |
| 4769 |
\endgroup |
| 4770 |
% \end{macrocode} |
| 4771 |
% \end{macro} |
| 4772 |
% |
| 4773 |
% |
| 4774 |
% \subsubsection{Outputting structured XML} |
| 4775 |
% \label{sec:output-xml} |
| 4776 |
% |
| 4777 |
% An \acro{XMP} packet consists of structured \acro{XML} data. We |
| 4778 |
% define some helper routines to handle the repetitive tasks of |
| 4779 |
% indenting a consistent number of spaces, inserting begin and end tags, |
| 4780 |
% and escaping arbitrary text as necessary for \acro{XML} compatibility. |
| 4781 |
% |
| 4782 |
% \begin{macro}{\hyxmp@extra@indent} |
| 4783 |
% This macro is used internally to increase the amount of indentation |
| 4784 |
% when writing certain \acro{XML} data. It is normally defined as empty |
| 4785 |
% but can temporarily be redefined to a sequence of |\space| characters. |
| 4786 |
% \begin{macrocode} |
| 4787 |
\newcommand*{\hyxmp@extra@indent}{} |
| 4788 |
% \end{macrocode} |
| 4789 |
% \end{macro} |
| 4790 |
% |
| 4791 |
% \begin{macro}{\hyxmp@add@simple} |
| 4792 |
% Given an \acro{XMP} tag~(|#1|) and a string~(|#2|), if the string is |
| 4793 |
% nonempty, add a begin tag, the string, and an end tag to the packet. |
| 4794 |
% The ``|simple|'' in the macro name indicates that the string is output |
| 4795 |
% without variations for different languages. |
| 4796 |
% \changes{v2.0}{2012/08/25}{Added this macro} |
| 4797 |
% \changes{v5.0}{2020/02/21}{Insert the tag name (\string\texttt{\#1}) |
| 4798 |
% verbatim} |
| 4799 |
% \begin{macrocode} |
| 4800 |
\newcommand*{\hyxmp@add@simple}[2]{% |
| 4801 |
\@ifnotmtargexp{#2}{% |
| 4802 |
\hyxmp@xmlify{#2}% |
| 4803 |
\hyxmp@add@to@xml{\hyxmp@extra@indent______<}% |
| 4804 |
\xdef\hyxmp@xml{\hyxmp@xml#1}% |
| 4805 |
\hyxmp@add@to@xml{>\hyxmp@xmlified</}% |
| 4806 |
\xdef\hyxmp@xml{\hyxmp@xml#1>^^J}% |
| 4807 |
}% |
| 4808 |
} |
| 4809 |
% \end{macrocode} |
| 4810 |
% \end{macro} |
| 4811 |
% |
| 4812 |
% \begin{macro}{\hyxmp@add@simple@var} |
| 4813 |
% Given an \acro{XMP} tag~(|#1|) and a variable name~(|#2|), if the |
| 4814 |
% string is defined, add a begin tag, the string, and an end tag to the |
| 4815 |
% packet. The ``|simple|'' in the macro name indicates that the string |
| 4816 |
% is output without variations for different languages. |
| 4817 |
% |\hyxmp@add@simple@var| differs from |\hyxmp@add@simple| in that the |
| 4818 |
% former includes defined but empty values in the \acro{XMP} packet |
| 4819 |
% while the latter excludes both undefined and defined but empty values. |
| 4820 |
% \changes{v2.4}{2013/12/21}{Added this macro} |
| 4821 |
% \begin{macrocode} |
| 4822 |
\newcommand*{\hyxmp@add@simple@var}[2]{% |
| 4823 |
\expandafter\ifx\csname#2\endcsname\relax |
| 4824 |
\else |
| 4825 |
\hyxmp@xmlify{\csname#2\endcsname}% |
| 4826 |
\hyxmp@add@to@xml{% |
| 4827 |
\hyxmp@extra@indent______<#1>\hyxmp@xmlified</#1>^^J% |
| 4828 |
}% |
| 4829 |
\fi |
| 4830 |
} |
| 4831 |
% \end{macrocode} |
| 4832 |
% \end{macro} |
| 4833 |
% |
| 4834 |
% \begin{macro}{\hyxmp@add@simple@lang} |
| 4835 |
% Given an \acro{XMP} tag~(|#1|) and a string~(|#2|), if the string is |
| 4836 |
% nonempty, add a begin tag, the string, and an end tag to the packet. |
| 4837 |
% The ``|simple|'' in the macro name indicates that the string is output |
| 4838 |
% without variations for different languages. However, if the string |
| 4839 |
% begins with a language code in square brackets, specify that as the |
| 4840 |
% (sole) language for the tag. |
| 4841 |
% \changes{v4.0}{2019/03/12}{Added this macro} |
| 4842 |
% \begin{macrocode} |
| 4843 |
\newcommand*{\hyxmp@add@simple@lang}[2]{% |
| 4844 |
\@ifnotmtarg{#2}{% |
| 4845 |
\hyxmp@xmlify{#2}% |
| 4846 |
\expandafter\hyxmp@add@simple@lang@i\hyxmp@xmlified\relax{#1}% |
| 4847 |
}% |
| 4848 |
} |
| 4849 |
% \end{macrocode} |
| 4850 |
% \end{macro} |
| 4851 |
% |
| 4852 |
% \begin{macro}{\hyxmp@add@simple@lang@i} |
| 4853 |
% This is a helper macro for |\hyxmp@add@simple@lang|. It takes an |
| 4854 |
% optional language code (in brackets), text up to |\relax|, and a tag, |
| 4855 |
% and typesets the text within the \acro{XML} tag. |
| 4856 |
% \begin{macrocode} |
| 4857 |
\newcommand*{\hyxmp@add@simple@lang@i}{% |
| 4858 |
\@ifnextchar[\hyxmp@add@simple@lang@ii{\hyxmp@add@simple@lang@ii[\@pdfmetalang]}% |
| 4859 |
} |
| 4860 |
% \end{macrocode} |
| 4861 |
% \end{macro} |
| 4862 |
% |
| 4863 |
% \begin{macro}{\hyxmp@add@simple@lang@ii} |
| 4864 |
% This is another helper macro for |\hyxmp@add@simple@lang|. It takes |
| 4865 |
% an mandatory language code (in brackets; can be empty), text up to |
| 4866 |
% |\relax|, and a tag, and typesets the text within the \acro{XML} tag. |
| 4867 |
% \begin{macrocode} |
| 4868 |
\def\hyxmp@add@simple@lang@ii[#1]#2\relax#3{% |
| 4869 |
\@ifnotmtarg{#2}{% |
| 4870 |
\hyxmp@xmlify{#2}% |
| 4871 |
\@ifmtarg{#1}{% |
| 4872 |
\hyxmp@add@to@xml{% |
| 4873 |
______<#3>\hyxmp@xmlified</#3>^^J% |
| 4874 |
}% |
| 4875 |
}{% |
| 4876 |
\hyxmp@add@to@xml{% |
| 4877 |
______<#3 xml:lang="#1">\hyxmp@xmlified</#3>^^J% |
| 4878 |
}% |
| 4879 |
}% |
| 4880 |
}% |
| 4881 |
} |
| 4882 |
% \end{macrocode} |
| 4883 |
% \end{macro} |
| 4884 |
% |
| 4885 |
% \begin{macro}{\hyxmp@add@simple@pfx} |
| 4886 |
% Given an \acro{XMP} tag~(|#1|), a---typically hard-wired---prefix |
| 4887 |
% string~(|#2|), and a main string~(|#2|), if the main string is |
| 4888 |
% nonempty, add a begin tag, both strings, and an end tag to the packet. |
| 4889 |
% The ``|simple|'' in the macro name indicates that the string is output |
| 4890 |
% without variations for different languages. |
| 4891 |
% \changes{v5.2}{2020/04/29}{Added this macro} |
| 4892 |
% \begin{macrocode} |
| 4893 |
\newcommand*{\hyxmp@add@simple@pfx}[3]{% |
| 4894 |
\@ifnotmtargexp{#3}{% |
| 4895 |
\hyxmp@add@to@xml{\hyxmp@extra@indent______<}% |
| 4896 |
\xdef\hyxmp@xml{\hyxmp@xml#1}% |
| 4897 |
\hyxmp@pdfstringdef\hyxmp@iprefix{#2}% |
| 4898 |
\hyxmp@xmlify{\hyxmp@iprefix}% |
| 4899 |
\hyxmp@add@to@xml{>\hyxmp@xmlified}% |
| 4900 |
\hyxmp@xmlify{#3}% |
| 4901 |
\hyxmp@add@to@xml{\hyxmp@xmlified</}% |
| 4902 |
\xdef\hyxmp@xml{\hyxmp@xml#1>^^J}% |
| 4903 |
}% |
| 4904 |
} |
| 4905 |
% \end{macrocode} |
| 4906 |
% \end{macro} |
| 4907 |
% |
| 4908 |
% |
| 4909 |
% \subsubsection{Providing metadata in multiple languages} |
| 4910 |
% \label{sec:lang-alt} |
| 4911 |
% |
| 4912 |
% Certain \acro{XMP} tags---\xmpprop{dc:title}, |
| 4913 |
% \xmpprop{dc:description}, and \xmpprop{dc:rights} (and others? Let me |
| 4914 |
% know.)---can be expressed in multiple languages. The same text is |
| 4915 |
% used for both language \optname{pdfmetalang} (default: |
| 4916 |
% \optname{pdflang}) and language ``\xmpterm{x-default}''. To express |
| 4917 |
% the same metadata in multiple languages, we provide an |\XMPLangAlt| |
| 4918 |
% macro to construct a list of alternative forms for a piece of |
| 4919 |
% metadata. |
| 4920 |
% |
| 4921 |
% \begin{macro}{\hyxmp@alt@title} |
| 4922 |
% \begin{macro}{\hyxmp@alt@description} |
| 4923 |
% \begin{macro}{\hyxmp@alt@rights} |
| 4924 |
% Each of these macros is a list in which each element is of the form |
| 4925 |
% ``|\do| \meta{language} \meta{text}'' in which \meta{language} is an |
| 4926 |
% \acro{ISO} \mbox{639-1} two-letter country code with an optional |
| 4927 |
% \acro{ISO} \mbox{3166-1} two-letter region code. For example, |
| 4928 |
% |\hyxmp@alt@title| may contain an element, ``|\do| |{es-MX}| |
| 4929 |
% |{Este| |es| |mi| |documento}|''. |
| 4930 |
% \begin{macrocode} |
| 4931 |
\def\hyxmp@alt@title{} |
| 4932 |
\def\hyxmp@alt@description{} |
| 4933 |
\def\hyxmp@alt@rights{} |
| 4934 |
% \end{macrocode} |
| 4935 |
% \end{macro} |
| 4936 |
% \end{macro} |
| 4937 |
% \end{macro} |
| 4938 |
% |
| 4939 |
% \begin{macro}{\hyxmp@LA@accept} |
| 4940 |
% This macro wraps |\define@key| to make the option ``|#1|=\meta{value}'' |
| 4941 |
% append \meta{value} to list~|#2|. |
| 4942 |
% \begin{macrocode} |
| 4943 |
\newcommand{\hyxmp@LA@accept}[2]{% |
| 4944 |
\define@key{hyxmp@LA}{#1}{% |
| 4945 |
% \end{macrocode} |
| 4946 |
% \begin{macro}{\hyxmp@value} |
| 4947 |
% As Niklas Beisert observed, if the option passed to the current key |
| 4948 |
% contains \LaTeX\ code, this code will be included in the \acro{XMP} |
| 4949 |
% packet, which is undesirable. Hence, we first clean up the string |
| 4950 |
% using |\hyxmp@pdfstringdef|. |
| 4951 |
% \begin{macrocode} |
| 4952 |
\hyxmp@pdfstringdef\hyxmp@value{##1}% |
| 4953 |
\xdef#2{#2\noexpand\do {\hyxmp@cur@lang} {\hyxmp@value}}% |
| 4954 |
} |
| 4955 |
} |
| 4956 |
% \end{macrocode} |
| 4957 |
% \end{macro} |
| 4958 |
% \end{macro} |
| 4959 |
% |
| 4960 |
% Define \meta{key}=\meta{value} options for appending to each of the |
| 4961 |
% |\hyxmp@alt|\meta{tag} lists. |
| 4962 |
% \begin{macrocode} |
| 4963 |
\hyxmp@LA@accept{pdftitle}{\hyxmp@alt@title} |
| 4964 |
\hyxmp@LA@accept{pdfsubject}{\hyxmp@alt@description} |
| 4965 |
\hyxmp@LA@accept{pdfcopyright}{\hyxmp@alt@rights} |
| 4966 |
% \end{macrocode} |
| 4967 |
% |
| 4968 |
% \begin{macro}{\XMPLangAlt} |
| 4969 |
% Argument~|#1| is a language expressed as a two-letter country code and |
| 4970 |
% optional two-letter region code. Argument~|#2| is a list of |
| 4971 |
% \meta{key}=\meta{value} pairs. Keys correspond to |\hypersetup| |
| 4972 |
% options such as ``|pdftitle|'', ``|pdfsubject|'', and |
| 4973 |
% ``|pdfcopyright|''. Values are the alternative-language form of the |
| 4974 |
% text provided for the corresponding option. |
| 4975 |
% \changes{v3.3}{2017/07/22}{Added this macro based on a request---and |
| 4976 |
% some code---by Niklas Beisert to support metadata expressed in multiple |
| 4977 |
% languages} |
| 4978 |
% \begin{macrocode} |
| 4979 |
\newcommand{\XMPLangAlt}[2]{% |
| 4980 |
\let\do=\relax |
| 4981 |
% \end{macrocode} |
| 4982 |
% \begin{macro}{\hyxmp@cur@lang} |
| 4983 |
% Store the provided language, which will be used during option processing. |
| 4984 |
% \begin{macrocode} |
| 4985 |
\edef\hyxmp@cur@lang{#1}% |
| 4986 |
\setkeys{hyxmp@LA}{#2}% |
| 4987 |
} |
| 4988 |
% \end{macrocode} |
| 4989 |
% \end{macro} |
| 4990 |
% \end{macro} |
| 4991 |
% |
| 4992 |
% |
| 4993 |
% \subsection{UUID generation} |
| 4994 |
% \label{sec:uuid-gen} |
| 4995 |
% |
| 4996 |
% We use a linear congruential generator to produce pseudorandom |
| 4997 |
% version~4 \acro{UUID}s~\cite{Leach2005:uuid}. True, this method has |
| 4998 |
% its flaws but it's simple to implement in \tex\ and is good enough for |
| 4999 |
% producing the \acro{XMP} \xmpprop{xmpMM:DocumentID} and |
| 5000 |
% \xmpprop{xmpMM:InstanceID} fields. |
| 5001 |
% |
| 5002 |
% \begin{macro}{\hyxmp@modulo@a} |
| 5003 |
% Replace the contents of |\@hyxmp@count| with the contents modulo~|#1|. |
| 5004 |
% Note that |\@tempcntb| is overwritten in the process. |
| 5005 |
% \begin{macrocode} |
| 5006 |
\def\hyxmp@modulo@a#1{% |
| 5007 |
\@tempcntb=\@hyxmp@count |
| 5008 |
\divide\@tempcntb by #1 |
| 5009 |
\multiply\@tempcntb by #1 |
| 5010 |
\advance\@hyxmp@count by -\@tempcntb |
| 5011 |
} |
| 5012 |
% \end{macrocode} |
| 5013 |
% \end{macro} |
| 5014 |
% |
| 5015 |
% \begin{macro}{\hyxmp@big@prime} |
| 5016 |
% \begin{macro}{\hyxmp@big@prime@ii} |
| 5017 |
% Define a couple of large prime numbers that can still be stored in a |
| 5018 |
% \tex\ counter. |
| 5019 |
% \begin{macrocode} |
| 5020 |
\def\hyxmp@big@prime{536870923} |
| 5021 |
\def\hyxmp@big@prime@ii{536870027} |
| 5022 |
% \end{macrocode} |
| 5023 |
% \end{macro} |
| 5024 |
% \end{macro} |
| 5025 |
% |
| 5026 |
% \begin{macro}{\hyxmp@seed@rng} |
| 5027 |
% \begin{macro}{\hyxmp@one@token} |
| 5028 |
% Seed \pkgname{hyperxmp}'s random-number generator from a given piece |
| 5029 |
% of text. |
| 5030 |
% \begin{macrocode} |
| 5031 |
\def\hyxmp@seed@rng#1{% |
| 5032 |
\@hyxmp@count=\hyxmp@big@prime |
| 5033 |
\futurelet\hyxmp@one@token\hyxmp@seed@rng@i#1\@empty |
| 5034 |
} |
| 5035 |
% \end{macrocode} |
| 5036 |
% \end{macro} |
| 5037 |
% \end{macro} |
| 5038 |
% |
| 5039 |
% \begin{macro}{\hyxmp@seed@rng@i} |
| 5040 |
% \begin{macro}{\hyxmp@one@token} |
| 5041 |
% \begin{macro}{\next} |
| 5042 |
% Do all of the work for |\hyxmp@seed@rng|. For each character code $c$ |
| 5043 |
% of the input text, assign $\mathtt{\string\@hyxmp@count} \leftarrow 3 |
| 5044 |
% \cdot \mathtt{\string\@hyxmp@count} + c |
| 5045 |
% \pmod{\mathtt{\string\hyxmp@big@prime}}$. |
| 5046 |
% \begin{macrocode} |
| 5047 |
\def\hyxmp@seed@rng@i{% |
| 5048 |
\ifx\hyxmp@one@token\@empty |
| 5049 |
\let\next=\relax |
| 5050 |
\else |
| 5051 |
\def\next##1{% |
| 5052 |
\multiply\@hyxmp@count by 3 |
| 5053 |
\advance\@hyxmp@count by `##1 |
| 5054 |
\hyxmp@modulo@a{\hyxmp@big@prime}% |
| 5055 |
\futurelet\hyxmp@one@token\hyxmp@seed@rng@i |
| 5056 |
}% |
| 5057 |
\fi |
| 5058 |
\next |
| 5059 |
} |
| 5060 |
% \end{macrocode} |
| 5061 |
% \end{macro} |
| 5062 |
% \end{macro} |
| 5063 |
% \end{macro} |
| 5064 |
% |
| 5065 |
% \begin{macro}{\hyxmp@set@rand@num} |
| 5066 |
% \begin{macro}{\hyxmp@rand@num} |
| 5067 |
% Advance |\hyxmp@rand@num| to the next pseudorandom number in the |
| 5068 |
% sequence. Specifically, we assign $\mathtt{\string\hyxmp@rand@num} |
| 5069 |
% \leftarrow 3 \cdot \mathtt{\string\hyxmp@rand@num} + |
| 5070 |
% \mathtt{\string\hyxmp@big@prime@ii} |
| 5071 |
% \pmod{\mathtt{\string\hyxmp@big@prime}}$. Note that both |\@hyxmp@count| |
| 5072 |
% and |\@tempcntb| are overwritten in the process. |
| 5073 |
% \begin{macrocode} |
| 5074 |
\def\hyxmp@set@rand@num{% |
| 5075 |
\@hyxmp@count=\hyxmp@rand@num |
| 5076 |
\multiply\@hyxmp@count by 3 |
| 5077 |
\advance\@hyxmp@count by \hyxmp@big@prime@ii |
| 5078 |
\hyxmp@modulo@a{\hyxmp@big@prime}% |
| 5079 |
\xdef\hyxmp@rand@num{\the\@hyxmp@count}% |
| 5080 |
} |
| 5081 |
% \end{macrocode} |
| 5082 |
% \end{macro} |
| 5083 |
% \end{macro} |
| 5084 |
% |
| 5085 |
% \begin{macro}{\hyxmp@append@hex} |
| 5086 |
% Append a randomly selected hexadecimal digit to macro~|#1|. Note that |
| 5087 |
% both |\@hyxmp@count| and |\@tempcntb| are overwritten in the process. |
| 5088 |
% \begin{macrocode} |
| 5089 |
\def\hyxmp@append@hex#1{% |
| 5090 |
\hyxmp@set@rand@num |
| 5091 |
\@hyxmp@count=\hyxmp@rand@num |
| 5092 |
\hyxmp@modulo@a{16}% |
| 5093 |
\ifnum\@hyxmp@count<10 |
| 5094 |
\xdef#1{#1\the\@hyxmp@count}% |
| 5095 |
\else |
| 5096 |
% \end{macrocode} |
| 5097 |
% There \emph{must} be a better way to handle the numbers~10--15 than |
| 5098 |
% with |\ifcase|. |
| 5099 |
% \begin{macrocode} |
| 5100 |
\advance\@hyxmp@count by -10 |
| 5101 |
\ifcase\@hyxmp@count |
| 5102 |
\xdef#1{#1a}% |
| 5103 |
\or\xdef#1{#1b}% |
| 5104 |
\or\xdef#1{#1c}% |
| 5105 |
\or\xdef#1{#1d}% |
| 5106 |
\or\xdef#1{#1e}% |
| 5107 |
\or\xdef#1{#1f}% |
| 5108 |
\fi |
| 5109 |
\fi |
| 5110 |
} |
| 5111 |
% \end{macrocode} |
| 5112 |
% \end{macro} |
| 5113 |
% |
| 5114 |
% \begin{macro}{\hyxmp@append@hex@iii} |
| 5115 |
% Invoke |\hyxmp@append@hex| three times. |
| 5116 |
% \begin{macrocode} |
| 5117 |
\def\hyxmp@append@hex@iii#1{% |
| 5118 |
\hyxmp@append@hex#1% |
| 5119 |
\hyxmp@append@hex#1% |
| 5120 |
\hyxmp@append@hex#1% |
| 5121 |
} |
| 5122 |
% \end{macrocode} |
| 5123 |
% \end{macro} |
| 5124 |
% |
| 5125 |
% \begin{macro}{\hyxmp@append@hex@iv} |
| 5126 |
% Invoke |\hyxmp@append@hex| four times. |
| 5127 |
% \begin{macrocode} |
| 5128 |
\def\hyxmp@append@hex@iv#1{% |
| 5129 |
\hyxmp@append@hex@iii#1% |
| 5130 |
\hyxmp@append@hex#1% |
| 5131 |
} |
| 5132 |
% \end{macrocode} |
| 5133 |
% \end{macro} |
| 5134 |
% |
| 5135 |
% \begin{macro}{\hyxmp@create@uuid} |
| 5136 |
% As per the definition of a version~4 |
| 5137 |
% \acro{UUID}~\cite{Leach2005:uuid}, define macro~|#1| as a \acro{UUID} |
| 5138 |
% of the form |
| 5139 |
% ``|uuid:|\textit{xxxxxxxx}|-|\linebreak[0]\textit{xxxx}|-|\linebreak[0]\textit{4xxx}|-|\linebreak[0]\textit{yxxx}|-|\linebreak[0]\textit{xxxxxxxxxxxx}'' |
| 5140 |
% in which each ``\textit{x}'' is a lowercase hexadecimal digit and |
| 5141 |
% ``\textit{y}'' is one of ``|8|'', ``|9|'', ``|a|'', or~``|b|''. We |
| 5142 |
% assume that the random-number generator is already seeded. Note that |
| 5143 |
% |\hyxmp@create@uuid| overwrites both |\@hyxmp@count| and |\@tempcntb|. |
| 5144 |
% \changes{v2.4}{2014/01/02}{Modified this macro to produce a proper |
| 5145 |
% version~4 (random or pseudorandom) \protect\acro{UUID}} |
| 5146 |
% \begin{macrocode} |
| 5147 |
\def\hyxmp@create@uuid#1{% |
| 5148 |
\def#1{uuid:}% |
| 5149 |
\hyxmp@append@hex@iv#1% |
| 5150 |
\hyxmp@append@hex@iv#1% |
| 5151 |
\g@addto@macro#1{-}% |
| 5152 |
\hyxmp@append@hex@iv#1% |
| 5153 |
\g@addto@macro#1{-4}% |
| 5154 |
\hyxmp@append@hex@iii#1% |
| 5155 |
\g@addto@macro#1{-}% |
| 5156 |
% \end{macrocode} |
| 5157 |
% Randomly select one of ``|8|'', ``|9|'', ``|a|'', or~``|b|''. |
| 5158 |
% \begin{macrocode} |
| 5159 |
\hyxmp@set@rand@num |
| 5160 |
\@hyxmp@count=\hyxmp@rand@num |
| 5161 |
\hyxmp@modulo@a{4}% |
| 5162 |
\ifcase\@hyxmp@count |
| 5163 |
\g@addto@macro#1{8}% |
| 5164 |
\or\g@addto@macro#1{9}% |
| 5165 |
\or\g@addto@macro#1{a}% |
| 5166 |
\or\g@addto@macro#1{b}% |
| 5167 |
\fi |
| 5168 |
\hyxmp@append@hex@iii#1% |
| 5169 |
\g@addto@macro#1{-}% |
| 5170 |
\hyxmp@append@hex@iv#1% |
| 5171 |
\hyxmp@append@hex@iv#1% |
| 5172 |
\hyxmp@append@hex@iv#1% |
| 5173 |
} |
| 5174 |
% \end{macrocode} |
| 5175 |
% \end{macro} |
| 5176 |
% |
| 5177 |
% \begin{macro}{\hyxmp@def@DocumentID} |
| 5178 |
% \begin{macro}{\hyxmp@DocumentID} |
| 5179 |
% \begin{macro}{\hyxmp@seed@string} |
| 5180 |
% Seed the random-number generator with a function of the current |
| 5181 |
% filename, \acro{PDF} document title, and \acro{PDF} author, then invoke |
| 5182 |
% |\hyxmp@create@uuid| to define |\hyxmp@DocumentID| as a random \acro{UUID}. |
| 5183 |
% \changes{v3.4}{2017/11/04}{Correctly handle an author field of all spaces. |
| 5184 |
% Bug reported by Ga\"etan Leurent} |
| 5185 |
% \begin{macrocode} |
| 5186 |
\newcommand*{\hyxmp@def@DocumentID}{% |
| 5187 |
\edef\hyxmp@seed@string{\hyxmp@jobname:\@pdftitle:\@pdfauthor:}% |
| 5188 |
\expandafter\hyxmp@seed@rng\expandafter{\hyxmp@seed@string}% |
| 5189 |
\edef\hyxmp@rand@num{\the\@hyxmp@count}% |
| 5190 |
\hyxmp@create@uuid\hyxmp@DocumentID |
| 5191 |
} |
| 5192 |
% \end{macrocode} |
| 5193 |
% \end{macro} |
| 5194 |
% \end{macro} |
| 5195 |
% \end{macro} |
| 5196 |
% |
| 5197 |
% \begin{macro}{\hyxmp@def@InstanceID} |
| 5198 |
% \begin{macro}{\hyxmp@InstanceID} |
| 5199 |
% \begin{macro}{\hyxmp@seed@string} |
| 5200 |
% Seed the random-number generator with a function of the current |
| 5201 |
% filename, \acro{PDF} document title, \acro{PDF} author, and the |
| 5202 |
% current timestamp, then invoke |\hyxmp@create@uuid| to define |
| 5203 |
% |\hyxmp@InstanceID| as a random \acro{UUID}. For the current |
| 5204 |
% timestamp, we use both the document-specified timestamp from |
| 5205 |
% \optname{pdfdate} and the \tex\ time. The former can be more precise |
| 5206 |
% (to sub-seconds) but may be less random (as it depends on manual |
| 5207 |
% document modifications) while the latter is typically less precise (to |
| 5208 |
% minutes) but may be more random (as it is updated automatically). |
| 5209 |
% \changes{v3.5}{2018/11/27}{Seed with the \protect\TeX\ timestamp in |
| 5210 |
% addition to the document-specified timestamp} |
| 5211 |
% \begin{macrocode} |
| 5212 |
\newcommand*{\hyxmp@def@InstanceID}{% |
| 5213 |
\hyxmp@today@xmp@define{\hyxmp@seed@string}% |
| 5214 |
\edef\hyxmp@seed@string{% |
| 5215 |
\hyxmp@jobname:\@pdftitle:\@pdfauthor:\hyxmp@today@xmp:\hyxmp@seed@string |
| 5216 |
}% |
| 5217 |
\expandafter\hyxmp@seed@rng\expandafter{\hyxmp@seed@string}% |
| 5218 |
\edef\hyxmp@rand@num{\the\@hyxmp@count}% |
| 5219 |
\hyxmp@create@uuid\hyxmp@InstanceID |
| 5220 |
} |
| 5221 |
% \end{macrocode} |
| 5222 |
% \end{macro} |
| 5223 |
% \end{macro} |
| 5224 |
% \end{macro} |
| 5225 |
% |
| 5226 |
% |
| 5227 |
% \subsection{Constructing the XMP packet} |
| 5228 |
% |
| 5229 |
% An \acro{XMP} packet ``shall consist of the following, in order: a |
| 5230 |
% header \acro{PI}, the serialized \acro{XMP} data model (the \acro{XMP} |
| 5231 |
% packet) with optional white-space padding, and a trailer |
| 5232 |
% \acro{PI}''~\cite{Adobe2012:XMP}. (``\acro{PI}'' is an abbreviation for |
| 5233 |
% ``processing instructions''). The serialized \acro{XMP} includes blocks |
| 5234 |
% of \acro{XML} for various \acro{XMP} schemata: |
| 5235 |
% ^^A |
| 5236 |
% \schema[Adobe PDF]{Adobe \protect\acro{PDF}} (Section~\ref{sec:adobe-pdf}), |
| 5237 |
% \schema{Dublin Core} (Section~\ref{sec:dublin-core}), |
| 5238 |
% \schema[XMP Rights Management]{\protect\acro{XMP} Rights Management} (Section~\ref{sec:xmp-rights}), |
| 5239 |
% \schema[XMP Media Management]{\protect\acro{XMP} Media Management} (Section~\ref{sec:xmp-media}), |
| 5240 |
% \schema[XMP Basic]{\protect\acro{XMP} Basic} (Section~\ref{sec:xmp-basic}), |
| 5241 |
% \schema{Photoshop} (Section~\ref{sec:photoshop}), |
| 5242 |
% \index{PDF/A Identification schema=\acro {PDF/A} Identification schema} |
| 5243 |
% \index{PDF/X Identification schema=\acro {PDF/X} Identification schema} |
| 5244 |
% \index{PDF/UA Identification schema=\acro {PDF/UA} Identification schema} |
| 5245 |
% \index{schemata&PDF/A Identification=\acro {PDF/A} Identification} |
| 5246 |
% \index{schemata&PDF/X Identification=\acro {PDF/X} Identification} |
| 5247 |
% \index{schemata&PDF/UA Identification=\acro {PDF/UA} Identification} |
| 5248 |
% \acro{PDF}\textsc{/*} Identification (Section~\ref{sec:pdfX-id}), |
| 5249 |
% \schema[IPTC Photo Metadata]{\protect\acro{IPTC} Photo Metadata} (Section~\ref{sec:photo-meta}), |
| 5250 |
% \schema[PRISM Basic Metadata]{\protect\acro{PRISM} Basic Metadata} (Section~\ref{sec:prism-meta}), |
| 5251 |
% \schema{Journal Article Versions} (Section~\ref{sec:niso-jav-meta}), and |
| 5252 |
% \schema[XMP Paged-Text]{\protect\acro{XMP} Paged-Text} (Section~\ref{sec:xmp-paged-text}). |
| 5253 |
% ^^A |
| 5254 |
% The |\hyxmp@construct@packet| macro |
| 5255 |
% (Section~\ref{sec:combining-schemata}) constructs the \acro{XMP} packet |
| 5256 |
% into |\hyxmp@xml|. It first writes the appropriate \acro{XML} header, |
| 5257 |
% then calls the various schema-writing macros, then injects |
| 5258 |
% |\hyxmp@padding| as padding, and finally writes the appropriate |
| 5259 |
% \acro{XML} trailer. |
| 5260 |
% |
| 5261 |
% \subsubsection{XMP utility functions} |
| 5262 |
% |
| 5263 |
% \begin{macro}{\hyxmp@add@to@xml} |
| 5264 |
% Given a piece of text, replace all underscores with category-code~11 |
| 5265 |
% (``other'') spaces and all |^C| characters with commas, then append |
| 5266 |
% the result to the |\hyxmp@xml| macro. |
| 5267 |
% \changes{v2.0}{2012/08/24}{Updated also to replace commas} |
| 5268 |
% \changes{v2.5}{2014/06/19}{Updated also to replace underscores and to |
| 5269 |
% modify only the text being added, not the already-modified text} |
| 5270 |
% \changes{v2.8}{2014/04/05}{Corrected inadvertent lowercasing of non-Latin |
| 5271 |
% characters when run under \XeLaTeX\ or \LuaLaTeX\ (bug reported by |
| 5272 |
% Leonid Sinev)} |
| 5273 |
% \begin{macrocode} |
| 5274 |
\newcommand*{\hyxmp@add@to@xml}[1]{% |
| 5275 |
\bgroup |
| 5276 |
\@hyxmp@count=0 |
| 5277 |
\ifhyxmp@unicodetex |
| 5278 |
\@tempcntb=65536% |
| 5279 |
\else |
| 5280 |
\@tempcntb=256% |
| 5281 |
\fi |
| 5282 |
\loop |
| 5283 |
\lccode\@hyxmp@count=\@hyxmp@count |
| 5284 |
\advance\@hyxmp@count by 1 |
| 5285 |
\ifnum\@hyxmp@count<\@tempcntb |
| 5286 |
\repeat |
| 5287 |
\lccode`\_=`\ \relax |
| 5288 |
\lccode`\^^C=`\,\relax |
| 5289 |
\lccode`\^^U=`\_\relax |
| 5290 |
\lowercase{\xdef\hyxmp@new@xml{#1}}% |
| 5291 |
\xdef\hyxmp@xml{\hyxmp@xml\hyxmp@new@xml}% |
| 5292 |
\egroup |
| 5293 |
} |
| 5294 |
% \end{macrocode} |
| 5295 |
% \end{macro} |
| 5296 |
% |
| 5297 |
% \begin{macro}{\hyxmp@hash} |
| 5298 |
% Define a category-code~11 (``other'') version of the ``|#|'' character. |
| 5299 |
% \begin{macrocode} |
| 5300 |
\bgroup |
| 5301 |
\catcode`\#=11 |
| 5302 |
\gdef\hyxmp@hash{#} |
| 5303 |
\egroup |
| 5304 |
% \end{macrocode} |
| 5305 |
% \end{macro} |
| 5306 |
% |
| 5307 |
% \begin{macro}{\hyxmp@padding} |
| 5308 |
% \begin{macro}{\hyxmp@xml} |
| 5309 |
% The \acro{XMP} specification recommends leaving approximately |
| 5310 |
% 2000~bytes of whitespace at the end of each \acro{XMP} packet to |
| 5311 |
% facilitate editing the packet in place~\cite{Adobe2012:XMP}. |
| 5312 |
% |\hyxmp@padding| is defined to contain 32~lines of 63~spaces and a |
| 5313 |
% newline apiece for a total of 2048 characters of whitespace. |
| 5314 |
% \begin{macrocode} |
| 5315 |
\bgroup |
| 5316 |
\xdef\hyxmp@xml{}% |
| 5317 |
\hyxmp@add@to@xml{% |
| 5318 |
_______________________________________________________________^^J% |
| 5319 |
} |
| 5320 |
\xdef\hyxmp@padding{\hyxmp@xml}% |
| 5321 |
\egroup |
| 5322 |
\xdef\hyxmp@padding{\hyxmp@padding\hyxmp@padding} |
| 5323 |
\xdef\hyxmp@padding{\hyxmp@padding\hyxmp@padding} |
| 5324 |
\xdef\hyxmp@padding{\hyxmp@padding\hyxmp@padding} |
| 5325 |
\xdef\hyxmp@padding{\hyxmp@padding\hyxmp@padding} |
| 5326 |
\xdef\hyxmp@padding{\hyxmp@padding\hyxmp@padding} |
| 5327 |
% \end{macrocode} |
| 5328 |
% \end{macro} |
| 5329 |
% \end{macro} |
| 5330 |
% |
| 5331 |
% \begin{macro}{\hyxmp@x@default} |
| 5332 |
% Define an \xmpterm{x-default} string that we can use in comparisons |
| 5333 |
% with |\@pdfmetalang|. |
| 5334 |
% \begin{macrocode} |
| 5335 |
\newcommand*{\hyxmp@x@default}{x-default} |
| 5336 |
% \end{macrocode} |
| 5337 |
% \end{macro} |
| 5338 |
% |
| 5339 |
% |
| 5340 |
% \subsubsection{The Adobe PDF schema} |
| 5341 |
% \label{sec:adobe-pdf} |
| 5342 |
% |
| 5343 |
% \begin{schemadesc}[Adobe PDF]{Adobe \protect\acro{PDF}} |
| 5344 |
% |
| 5345 |
% Older versions of \pkgname{hyperref} defined a default producer; newer |
| 5346 |
% versions do not. Instead, they let the \tex\ engine define the |
| 5347 |
% producer itself. This poses a problem for \acro{PDF/A} compliance |
| 5348 |
% because \pkgname{hyperxmp} sees an empty producer and therefore omits |
| 5349 |
% writing a \xmpprop{pdf:Producer} to the \acro{XMP} packet, causing a |
| 5350 |
% mismatch between the data in the \acro{XMP} packet and the data in the |
| 5351 |
% \acro{PDF} \pdfterm{Info} dictionary. To ensure consistency between |
| 5352 |
% \acro{XMP} and \pdfterm{Info}, we explicitly define our own default |
| 5353 |
% |\@pdfproducer| here. |
| 5354 |
% |
| 5355 |
% \begin{macro}{\@pdfproducer} |
| 5356 |
% \begin{macro}{\hyxmp@define@pdfproducer} |
| 5357 |
% Define |\@pdfproducer| using the banner string if available or the |
| 5358 |
% \tex\ engine's version number if not. |
| 5359 |
% \changes{v5.0}{2020/03/01}{Added this macro} |
| 5360 |
% \changes{v5.1}{2020/04/06}{Check for \string\LuaTeX\ before checking for |
| 5361 |
% \string\pdfTeX\ to work around \string\pkgname{luatex85}'s confusing |
| 5362 |
% \string\pkgname{iftex} by defining \string\cs{pdftexversion}. Thanks |
| 5363 |
% to Robin Schwab for the bug report} |
| 5364 |
% \begin{macrocode} |
| 5365 |
\newcommand*{\hyxmp@define@pdfproducer}{% |
| 5366 |
\gdef\@pdfproducer{TeX} |
| 5367 |
\ifLuaTeX |
| 5368 |
\expandafter\hyxmp@banner@to@producer\expandafter{\luatexbanner}% |
| 5369 |
\else |
| 5370 |
\ifPDFTeX |
| 5371 |
\expandafter\hyxmp@banner@to@producer\expandafter{\pdftexbanner}% |
| 5372 |
\else |
| 5373 |
\ifXeTeX |
| 5374 |
\edef\@pdfproducer{XeTeX version \the\XeTeXversion\XeTeXrevision}% |
| 5375 |
\fi |
| 5376 |
\fi |
| 5377 |
\fi |
| 5378 |
} |
| 5379 |
% \end{macrocode} |
| 5380 |
% \end{macro} |
| 5381 |
% \end{macro} |
| 5382 |
% |
| 5383 |
% \begin{macro}{\@pdfproducer} |
| 5384 |
% \begin{macro}{\hyxmp@banner@to@producer} |
| 5385 |
% Define |\@pdfproducer| as the \tex\ engine's banner string |
| 5386 |
% \ifPDFTeX |
| 5387 |
% (e.g.,~``\texttt{\pdftexbanner}''), |
| 5388 |
% \else |
| 5389 |
% \ifLuaTeX |
| 5390 |
% (e.g.,~``\texttt{\luatexbanner}''), |
| 5391 |
% \else |
| 5392 |
% (e.g.,~``\texttt{This is pdfTeX, Version 3.14159265-2.6-1.40.20 |
| 5393 |
% (TeX Live 2019/Debian) kpathsea version 6.3.1}''), |
| 5394 |
% \fi |
| 5395 |
% \fi |
| 5396 |
% removing the initial ``\texttt{This is}'' if possible (specifically, |
| 5397 |
% when $\varepsilon$-\TeX's\index{e-TeX=$\varepsilon$-\TeX} |
| 5398 |
% |\scantokens| primitive is available). |
| 5399 |
% \changes{v5.1}{2020/04/03}{Prevent the category code of ``@'' from |
| 5400 |
% propagating past the \cs{begin}\string\texttt{\{document\}}. |
| 5401 |
% Thanks to Robert Schlicht for noticing this catcode ``leak'' and |
| 5402 |
% providing a correction} |
| 5403 |
% \begin{macrocode} |
| 5404 |
\def\hyxmp@banner@to@producer#1{% |
| 5405 |
\ifx\scantokens\relax |
| 5406 |
\gdef\@pdfproducer{#1}% |
| 5407 |
\else |
| 5408 |
{\scantokens{\makeatletter\hyxmp@remove@this#1\relax}}% |
| 5409 |
\fi |
| 5410 |
} |
| 5411 |
% \end{macrocode} |
| 5412 |
% \end{macro} |
| 5413 |
% \end{macro} |
| 5414 |
% |
| 5415 |
% \begin{macro}{\@pdfproducer} |
| 5416 |
% \begin{macro}{\hyxmp@remove@this} |
| 5417 |
% Define |\@pdfproducer| as a given banner string with the initial |
| 5418 |
% ``\texttt{This is}'' stripped off the beginning. |
| 5419 |
% \begin{macrocode} |
| 5420 |
\def\hyxmp@remove@this This is #1\relax{\gdef\@pdfproducer{#1}} |
| 5421 |
% \end{macrocode} |
| 5422 |
% \end{macro} |
| 5423 |
% \end{macro} |
| 5424 |
% |
| 5425 |
% If \optname{pdfproducer} wasn't specified and \pkgname{hyperref} |
| 5426 |
% didn't already define |\@pdfproducer|---old versions of |
| 5427 |
% \pkgname{hyperref} did; newer ones don't---try to assign a meaningful |
| 5428 |
% producer string and use that. |
| 5429 |
% \changes{v5.0}{2020/03/02}{Define a default producer} |
| 5430 |
% \begin{macrocode} |
| 5431 |
\AtBeginDocument{% |
| 5432 |
\ifx\@pdfproducer\relax |
| 5433 |
\hyxmp@define@pdfproducer |
| 5434 |
\fi |
| 5435 |
} |
| 5436 |
% \end{macrocode} |
| 5437 |
% |
| 5438 |
% \begin{macro}{\hyxmp@assign@major@minor} |
| 5439 |
% Assign |\hyxmp@major@minor| to be the \acro{PDF} version targeted by |
| 5440 |
% the running \TeX\ engine. |
| 5441 |
% \changes{v5.2}{2020/05/10}{Added this macro. \string\pkgname{hyperxmp} |
| 5442 |
% now correctly specifies \string\xmpprop{pdf:PDFVersion} when |
| 5443 |
% generating \string\acro{PDF}~2.0+. Thanks to Ulrike Fischer for |
| 5444 |
% alerting me to \string\acro{PDF}~2.0's availability in the |
| 5445 |
% \string\TeX\ ecosystem and informing me how to activate it} |
| 5446 |
% \begin{macro}{\hyxmp@major@minor} |
| 5447 |
% \begin{macrocode} |
| 5448 |
\newcommand*{\hyxmp@assign@major@minor}{% |
| 5449 |
\@ifundefined{pdfvariable}{% |
| 5450 |
\@ifundefined{pdfminorversion}{% |
| 5451 |
% \end{macrocode} |
| 5452 |
% Case 1: Neither |\pdfvariable| nor |\pdfminorversion| is defined |
| 5453 |
% (\XeLaTeX\ and regular \LaTeX). |
| 5454 |
% \begin{macrocode} |
| 5455 |
}{% |
| 5456 |
% \end{macrocode} |
| 5457 |
% Case 2: |\pdfminorversion| is defined (\pdfLaTeX\ and pre-0.85 \LuaLaTeX). |
| 5458 |
% \begin{macrocode} |
| 5459 |
\xdef\hyxmp@major@minor{\the\pdfminorversion}% |
| 5460 |
\@ifundefined{pdfmajorversion}{% |
| 5461 |
% \end{macrocode} |
| 5462 |
% Case 2(a): |\pdfmajorversion| is not defined (older versions of |
| 5463 |
% \pdfLaTeX\ and \LuaLaTeX). |
| 5464 |
% \begin{macrocode} |
| 5465 |
\xdef\hyxmp@major@minor{1.\hyxmp@major@minor}% |
| 5466 |
}{% |
| 5467 |
% \end{macrocode} |
| 5468 |
% Case 2(b): |\pdfmajorversion| is defined (\pdfLaTeX~1.40.21+). |
| 5469 |
% \begin{macrocode} |
| 5470 |
\xdef\hyxmp@major@minor{\the\pdfmajorversion.\hyxmp@major@minor}% |
| 5471 |
}% |
| 5472 |
}% |
| 5473 |
}{% |
| 5474 |
% \end{macrocode} |
| 5475 |
% Case 3: |\pdfvariable| is defined (\LuaLaTeX~0.85+). |
| 5476 |
% \begin{macrocode} |
| 5477 |
\xdef\hyxmp@major@minor{\the\pdfvariable majorversion.\the\pdfvariable minorversion}% |
| 5478 |
}% |
| 5479 |
} |
| 5480 |
% \end{macrocode} |
| 5481 |
% \end{macro} |
| 5482 |
% \end{macro} |
| 5483 |
% |
| 5484 |
% \begin{macro}{\hyxmp@pdf@schema} |
| 5485 |
% Add properties defined by the Adobe \acro{PDF} schema to the |\hyxmp@xml| |
| 5486 |
% macro. |
| 5487 |
% \begin{macrocode} |
| 5488 |
\newcommand*{\hyxmp@pdf@schema}{% |
| 5489 |
% \end{macrocode} |
| 5490 |
% Add a block of \acro{XML} to |\hyxmp@xml| that lists the document's |
| 5491 |
% keywords (the \xmpprop{pdf:Keywords} property), the tools used to |
| 5492 |
% produce the \acro{PDF} file (the \xmpprop{pdf:Producer} property), and |
| 5493 |
% the version of the \acro{PDF} standard adhered to (the |
| 5494 |
% \xmpprop{pdf:PDFVersion} property). Unlike most of the other schemata |
| 5495 |
% that \pkgname{hyperxmp} supports, the Adobe \acro{PDF} schema is |
| 5496 |
% \emph{always} included in the document, even if all of its keys are |
| 5497 |
% empty. This is because \PDFstd{A}{1}{b}{} requires the keywords and |
| 5498 |
% producer to be the same in the \acro{XMP} metadata and the \acro{PDF} |
| 5499 |
% metadata. Because \pkgname{hyperref} always specifies the |
| 5500 |
% \pdfterm{Keywords} and \pdfterm{Producer} fields, even when they're |
| 5501 |
% empty, \pkgname{hyperxmp} has to follow suit and define |
| 5502 |
% \xmpprop{pdf:Keywords} and \xmpprop{pdf:Producer} in the \acro{XMP} |
| 5503 |
% packet. |
| 5504 |
% \changes{v2.4}{2013/12/21}{Made |
| 5505 |
% \texttt{\string\string\string\hyxmp@pdf@schema} |
| 5506 |
% \protect\emph{always} include the Adobe \protect\acro{PDF} schema, |
| 5507 |
% even when empty. Florian Breitwieser noted that this is necessary |
| 5508 |
% for \protect\PDFstd{A}{1}{b}{} compliance} |
| 5509 |
% \changes{v5.0}{2020/02/28}{Honor \protect\optname{pdftrapped}} |
| 5510 |
% \begin{macrocode} |
| 5511 |
\hyxmp@add@simple@var{pdf:Producer}{@pdfproducer}% |
| 5512 |
\hyxmp@add@simple@var{pdf:Keywords}{@pdfkeywords}% |
| 5513 |
\hyxmp@add@simple{pdf:Trapped}{\@pdftrapped}% |
| 5514 |
\hyxmp@assign@major@minor |
| 5515 |
\hyxmp@add@simple@var{pdf:PDFVersion}{hyxmp@major@minor}% |
| 5516 |
} |
| 5517 |
% \end{macrocode} |
| 5518 |
% \end{macro} |
| 5519 |
% |
| 5520 |
% \end{schemadesc} |
| 5521 |
% |
| 5522 |
% |
| 5523 |
% \subsubsection{The Dublin Core schema} |
| 5524 |
% \label{sec:dublin-core} |
| 5525 |
% |
| 5526 |
% \begin{schemadesc}{Dublin Core} |
| 5527 |
% |
| 5528 |
% \begin{macro}{\ifhyxmp@multi@langs} |
| 5529 |
% \begin{macro}{\hyxmp@multi@langstrue} |
| 5530 |
% \begin{macro}{\hyxmp@multi@langsfalse} |
| 5531 |
% These macros are used locally to \cs{hyxmp@rdf@dc}. If the property |
| 5532 |
% being processed has values in different languages, |
| 5533 |
% \cs{ifhyxmp@multi@langs} evaluates to \textsc{true}. If it has a |
| 5534 |
% value in only a single language, \cs{ifhyxmp@multi@langs} evaluates to |
| 5535 |
% \textsc{false}. |
| 5536 |
% \begin{macrocode} |
| 5537 |
\newif\ifhyxmp@multi@langs |
| 5538 |
% \end{macrocode} |
| 5539 |
% \end{macro} |
| 5540 |
% \end{macro} |
| 5541 |
% \end{macro} |
| 5542 |
% |
| 5543 |
% \begin{macro}{\hyxmp@rdf@dc} |
| 5544 |
% Given an optional |\if|\meta{something} statement (|#1|), a Dublin Core |
| 5545 |
% property~(|#2|) and a macro containing some |\pdfstringdef|-defined |
| 5546 |
% text~(|#3|), append the appropriate block of \acro{XML} to the |\hyxmp@xml| |
| 5547 |
% macro. |
| 5548 |
% \changes{v1.4}{2011/06/12}{Included metadata in the \xmpterm{x-default} |
| 5549 |
% language regardless of the specified metadata language} |
| 5550 |
% \changes{v3.3}{2017/07/22}{Bug fix: Output the metadata language as |
| 5551 |
% correct \noexpand\acro{XML} even when \noexpand\pkgname{hyperref} is |
| 5552 |
% loaded with the \noexpand\optname{unicode} option} |
| 5553 |
% \changes{v5.5}{2020/07/17}{List \protect\xmpterm{x-default} alternatives |
| 5554 |
% before language-specific alternatives, as dictated by the |
| 5555 |
% \protect\acro{XMP} specification~\protect\cite{Adobe2012:XMP}} |
| 5556 |
% \changes{v5.5}{2020/07/21}{Rewrite the core part of this macro to |
| 5557 |
% divide it into four, cleanly defined cases} |
| 5558 |
% \begin{macrocode} |
| 5559 |
\newcommand*{\hyxmp@rdf@dc}[3][\iffalse]{% |
| 5560 |
% \end{macrocode} |
| 5561 |
% Set |\@tempswatrue| only if the given text is nonempty or the provided |
| 5562 |
% conditional evaluates to \textsc{true}. |
| 5563 |
% \begin{macrocode} |
| 5564 |
\@ifmtargexp{#3}{\@tempswafalse}{\@tempswatrue}% |
| 5565 |
#1 |
| 5566 |
\@tempswatrue |
| 5567 |
\fi |
| 5568 |
% \end{macrocode} |
| 5569 |
% Append the corresponding \acro{XML} only if |\@tempswatrue|. |
| 5570 |
% \begin{macrocode} |
| 5571 |
\if@tempswa |
| 5572 |
\hyxmp@xmlify{#3}% |
| 5573 |
% \end{macrocode} |
| 5574 |
% \begin{macro}{\hyxmp@value} |
| 5575 |
% Store the \acro{XML}-ified version of |#3| in |\hyxmp@value| so we can |
| 5576 |
% reuse |\hyxmp@xmlifiied| if necessary. |
| 5577 |
% \begin{macrocode} |
| 5578 |
\let\hyxmp@value=\hyxmp@xmlified |
| 5579 |
\hyxmp@add@to@xml{% |
| 5580 |
______<dc:#2>^^J% |
| 5581 |
________<rdf:Alt>^^J% |
| 5582 |
}% |
| 5583 |
% \end{macrocode} |
| 5584 |
% Record whether property~|#2| has definitions in multiple languages. |
| 5585 |
% \begin{macrocode} |
| 5586 |
\@if@def@and@nonempty{hyxmp@alt@#2}{% |
| 5587 |
\hyxmp@multi@langstrue |
| 5588 |
}{% |
| 5589 |
\hyxmp@multi@langsfalse |
| 5590 |
}% |
| 5591 |
% \end{macrocode} |
| 5592 |
% There are now four cases to consider: the cross product of |
| 5593 |
% \{\optname{pdfmetalang}~$=$ ``\xmpterm{x-default}'', |
| 5594 |
% \optname{pdfmetalang}~$\neq$ ``\xmpterm{x-default}''\} and |
| 5595 |
% \{\cs{XMPLangAlt} was specified, \cs{XMPLangAlt} was not specified\}. |
| 5596 |
% We handle each of these in turn. |
| 5597 |
% \begin{macrocode} |
| 5598 |
\ifx\@pdfmetalang\hyxmp@x@default |
| 5599 |
\ifhyxmp@multi@langs |
| 5600 |
% \end{macrocode} |
| 5601 |
% \textbf{Case~1}: No \optname{pdfmetalang} but \cs{XMPLangAlt}. |
| 5602 |
% We consider this an error because the \xmpterm{x-default} language will |
| 5603 |
% not have a matching non-default language, in violation of the |
| 5604 |
% \acro{XMP} specification's guidance~\cite[p.~23]{Adobe2012:XMP}: |
| 5605 |
% |
| 5606 |
% \begin{quote} |
| 5607 |
% \sffamily |
| 5608 |
% |
| 5609 |
% An \textbf{xml:lang} value of ``x-default'' may be used to |
| 5610 |
% explicitly denote a default item. If used, the ``x-default'' item |
| 5611 |
% shall be first in the array and its simple text value should be |
| 5612 |
% repeated in another item in which \textbf{xml:lang} specifies its |
| 5613 |
% actual language. However, an ``x-default'' item may be the only |
| 5614 |
% item, in which case there is only a default value in no defined |
| 5615 |
% language. |
| 5616 |
% \end{quote} |
| 5617 |
% \begin{macrocode} |
| 5618 |
\PackageError{hyperxmp}% |
| 5619 |
{\string\XMPLangAlt\space was used without specifying |
| 5620 |
pdfmetalang\MessageBreak |
| 5621 |
or pdflang}% |
| 5622 |
{Be sure to assign a language code to the pdfmetalang key and/or a |
| 5623 |
document\MessageBreak |
| 5624 |
language to the pdflang key (e.g., \string\hypersetup{pdfmetalang={en}}).}% |
| 5625 |
\else |
| 5626 |
% \end{macrocode} |
| 5627 |
% \textbf{Case~2}: No \optname{pdfmetalang} and no \cs{XMPLangAlt}. |
| 5628 |
% Here we specify only \xmpterm{x-default} as the language, as per the |
| 5629 |
% guidance quoted above. |
| 5630 |
% \begin{macrocode} |
| 5631 |
\hyxmp@add@to@xml{% |
| 5632 |
__________<rdf:li xml:lang="\hyxmp@x@default">\hyxmp@value</rdf:li>^^J% |
| 5633 |
}% |
| 5634 |
\fi |
| 5635 |
\else |
| 5636 |
\ifhyxmp@multi@langs |
| 5637 |
% \end{macrocode} |
| 5638 |
% \textbf{Case~3}: Both \optname{pdfmetalang} and \cs{XMPLangAlt}. In |
| 5639 |
% this case, we include an \xmpterm{x-default} followed by the |
| 5640 |
% \optname{pdfmetalang} language, followed by all of the language |
| 5641 |
% alternatives. |
| 5642 |
% \begin{macrocode} |
| 5643 |
\hyxmp@xmlify{\@pdfmetalang}% |
| 5644 |
\hyxmp@add@to@xml{% |
| 5645 |
__________<rdf:li xml:lang="\hyxmp@x@default">\hyxmp@value</rdf:li>^^J% |
| 5646 |
__________<rdf:li xml:lang="\hyxmp@xmlified">\hyxmp@value</rdf:li>^^J% |
| 5647 |
}% |
| 5648 |
\def\do##1##2{ |
| 5649 |
\hyxmp@xmlify{##2}% |
| 5650 |
\hyxmp@add@to@xml{% |
| 5651 |
__________<rdf:li xml:lang="##1">\hyxmp@xmlified</rdf:li>^^J% |
| 5652 |
}% |
| 5653 |
}% |
| 5654 |
\csname hyxmp@alt@#2\endcsname |
| 5655 |
\else |
| 5656 |
% \end{macrocode} |
| 5657 |
% \textbf{Case~4}: \optname{pdfmetalang} but no \cs{XMPLangAlt}. To |
| 5658 |
% reduce redundancy we omit the \xmpterm{x-default} and include the |
| 5659 |
% single language in which the text appears. |
| 5660 |
% \begin{macrocode} |
| 5661 |
\hyxmp@xmlify{\@pdfmetalang}% |
| 5662 |
\hyxmp@add@to@xml{% |
| 5663 |
__________<rdf:li xml:lang="\hyxmp@xmlified">\hyxmp@value</rdf:li>^^J% |
| 5664 |
}% |
| 5665 |
\fi |
| 5666 |
\fi |
| 5667 |
% \end{macrocode} |
| 5668 |
% Complete this \acro{XMP} element. |
| 5669 |
% \begin{macrocode} |
| 5670 |
\hyxmp@add@to@xml{% |
| 5671 |
________</rdf:Alt>^^J% |
| 5672 |
______</dc:#2>^^J% |
| 5673 |
}% |
| 5674 |
\fi |
| 5675 |
}% |
| 5676 |
% \end{macrocode} |
| 5677 |
% \end{macro} |
| 5678 |
% \end{macro} |
| 5679 |
% |
| 5680 |
% \begin{macro}{\hyxmp@list@to@xml} |
| 5681 |
% Given an optional |\if|\meta{something} statement (|#1|), a Dublin Core |
| 5682 |
% property~(|#2|), an \acro{RDF} array~(|#3|), and a macro containing a |
| 5683 |
% comma-separated list~(|#4|), append the appropriate block of \acro{XML} to |
| 5684 |
% the |\hyxmp@xml| macro. |
| 5685 |
% \changes{v2.0}{2012/08/02}{Modified by Heiko Oberdiek to use the new |
| 5686 |
% \term{Unicode}-processing macros} |
| 5687 |
% \begin{macrocode} |
| 5688 |
\newcommand*{\hyxmp@list@to@xml}[4][\iffalse]{% |
| 5689 |
% \end{macrocode} |
| 5690 |
% Set |\@tempswatrue| only if the given list is nonempty or the provided |
| 5691 |
% conditional evaluates to \textsc{true}. |
| 5692 |
% \begin{macrocode} |
| 5693 |
\@ifmtargexp{#4}{\@tempswafalse}{\@tempswatrue}% |
| 5694 |
#1 |
| 5695 |
\@tempswatrue |
| 5696 |
\fi |
| 5697 |
% \end{macrocode} |
| 5698 |
% Append the corresponding \acro{XML} only if |\@tempswatrue|. |
| 5699 |
% \begin{macrocode} |
| 5700 |
\if@tempswa |
| 5701 |
\hyxmp@add@to@xml{% |
| 5702 |
______<dc:#2>^^J% |
| 5703 |
________<rdf:#3>^^J% |
| 5704 |
}% |
| 5705 |
\bgroup |
| 5706 |
% \end{macrocode} |
| 5707 |
% \begin{macro}{\@elt} |
| 5708 |
% Re-encode the text from \term{Unicode} if necessary. Then redefine |
| 5709 |
% |\@elt| to \acro{XML}-ify each element of the list and append it to |
| 5710 |
% |\hyxmp@xmlified|. |
| 5711 |
% \begin{macrocode} |
| 5712 |
\hyxmp@xmlify{#4}% |
| 5713 |
\hyxmp@commas@to@list\hyxmp@list{\hyxmp@xmlified}% |
| 5714 |
\def\@elt##1{% |
| 5715 |
\hyxmp@add@to@xml{% |
| 5716 |
__________<rdf:li>##1</rdf:li>^^J% |
| 5717 |
}% |
| 5718 |
}% |
| 5719 |
\hyxmp@list |
| 5720 |
\egroup |
| 5721 |
\hyxmp@add@to@xml{% |
| 5722 |
________</rdf:#3>^^J% |
| 5723 |
______</dc:#2>^^J% |
| 5724 |
}% |
| 5725 |
\fi |
| 5726 |
} |
| 5727 |
% \end{macrocode} |
| 5728 |
% \end{macro} |
| 5729 |
% \end{macro} |
| 5730 |
% |
| 5731 |
% \begin{macro}{\hyxmp@singleton@dc} |
| 5732 |
% Given an optional list type (|Seq| or |Bag|), a Dublin Core property, |
| 5733 |
% and a string, append a block of \acro{XML} representing a one-element |
| 5734 |
% list consisting of the given string. |
| 5735 |
% \changes{v4.1}{2019/04/05}{Added this macro} |
| 5736 |
% \begin{macrocode} |
| 5737 |
\newcommand{\hyxmp@singleton@dc}[3][Bag]{% |
| 5738 |
\@ifnotmtargexp{#3}{% |
| 5739 |
\hyxmp@xmlify{#3}% |
| 5740 |
\hyxmp@add@to@xml{% |
| 5741 |
______<dc:#2>^^J% |
| 5742 |
________<rdf:#1>^^J% |
| 5743 |
__________<rdf:li>\hyxmp@xmlified</rdf:li>^^J% |
| 5744 |
________</rdf:#1>^^J% |
| 5745 |
______</dc:#2>^^J% |
| 5746 |
}% |
| 5747 |
} |
| 5748 |
} |
| 5749 |
% \end{macrocode} |
| 5750 |
% \end{macro} |
| 5751 |
% |
| 5752 |
% \begin{macro}{\hyxmp@cond@dc@identifier} |
| 5753 |
% Conditionally add a \xmpprop{dc:identifier} tag. Given a prefix |
| 5754 |
% string~(|#1|) and a main string~(|#2|), wrap these in a |
| 5755 |
% \xmpprop{dc:identifier} if the main string is nonempty and |
| 5756 |
% |\hyxmp@xmlified| \emph{is} empty (implying the |
| 5757 |
% \xmpprop{dc:identifier} has not yet been written). |
| 5758 |
% \changes{v5.2}{2020/04/29}{Added this macro} |
| 5759 |
% \begin{macrocode} |
| 5760 |
\newcommand*{\hyxmp@cond@dc@identifier}[2]{% |
| 5761 |
\ifx\hyxmp@xmlified\@empty |
| 5762 |
\@ifnotmtargexp{#2}{% |
| 5763 |
\hyxmp@add@simple@pfx{dc:identifier}{#1}{#2}% |
| 5764 |
}% |
| 5765 |
\fi |
| 5766 |
} |
| 5767 |
% \end{macrocode} |
| 5768 |
% \end{macro} |
| 5769 |
% |
| 5770 |
% \begin{macro}{\hyxmp@dc@schema} |
| 5771 |
% Add properties defined by the Dublin Core schema to the |\hyxmp@xml| |
| 5772 |
% macro. Specifically, we add entries for the \xmpprop{dc:title} |
| 5773 |
% property if the author specified a \optname{pdftitle}, the |
| 5774 |
% \xmpprop{dc:description} property if the author specified a |
| 5775 |
% \optname{pdfsubject}, the \xmpprop{dc:rights} property if the author |
| 5776 |
% specified a \optname{pdfcopyright}, the \xmpprop{dc:creator} property |
| 5777 |
% if the author specified a \optname{pdfauthor}, the |
| 5778 |
% \xmpprop{dc:subject} property if the author specified |
| 5779 |
% \optname{pdfkeywords}, the \xmpprop{dc:language} property if the |
| 5780 |
% author specified \optname{pdflang}, the \xmpprop{dc:type} property if |
| 5781 |
% the author specified \optname{pdftype}, and the |
| 5782 |
% \xmpprop{dc:identifier} if the author specified |
| 5783 |
% \optname{pdfidentifier} or if we can derive it from other options. We |
| 5784 |
% also specify the \xmpprop{dc:source} property using the base name of |
| 5785 |
% the source file with |.tex| appended and the \xmpprop{dc:date} |
| 5786 |
% property using the date the document was run through \LaTeX---unless |
| 5787 |
% the author specified \optname{pdfdate}, in which case we use that. |
| 5788 |
% \changes{v2.0}{2012/08/26}{Added support for \xmpprop{dc:language} |
| 5789 |
% and \xmpprop{dc:source}} |
| 5790 |
% \changes{v2.4}{2013/12/21}{Made \xmpprop{dc:language} a \xmpterm{Bag} |
| 5791 |
% instead of an individual item so as to conform to the latest |
| 5792 |
% \acro{XMP} specifications, a detail identified by Florian Breitwieser} |
| 5793 |
% \changes{v5.3}{2020/06/13}{Include all languages used in the document |
| 5794 |
% in \protect\xmpprop{dc:language}} |
| 5795 |
% \changes{v5.4}{2020/06/18}{Bug fix: Use \protect\cs{hyxmp@today@xmp} |
| 5796 |
% as the date only if \protect\cs{@pdfdatetime} is undefined} |
| 5797 |
% \begin{macrocode} |
| 5798 |
\newcommand*{\hyxmp@dc@schema}{% |
| 5799 |
\hyxmp@add@simple{dc:format}{application/pdf}% |
| 5800 |
\hyxmp@rdf@dc[\ifHy@pdfa]{title}{\@pdftitle}% |
| 5801 |
\hyxmp@rdf@dc[\ifHy@pdfa]{description}{\@pdfsubject}% |
| 5802 |
\hyxmp@rdf@dc{rights}{\@pdfcopyright}% |
| 5803 |
\hyxmp@singleton@dc{publisher}{\@pdfpublisher}% |
| 5804 |
\@ifmtargexp{\@pdfdatetime}{% |
| 5805 |
\hyxmp@singleton@dc[Seq]{date}{\hyxmp@today@xmp}% |
| 5806 |
}{% |
| 5807 |
\hyxmp@singleton@dc[Seq]{date}{\@pdfdatetime}% |
| 5808 |
}% |
| 5809 |
\hyxmp@singleton@dc{type}{\@pdftype}% |
| 5810 |
\hyxmp@list@to@xml[\ifHy@pdfa]{creator}{Seq}{\hyxmp@pdfauthor}% |
| 5811 |
\hyxmp@list@to@xml{subject}{Bag}{\hyxmp@pdfkeywords}% |
| 5812 |
\ifx\@pdfsource\@empty |
| 5813 |
\else |
| 5814 |
\hyxmp@add@simple{dc:source}{\@pdfsource}% |
| 5815 |
\fi |
| 5816 |
\hyxmp@list@to@xml{language}{Bag}{\hyxmp@dc@lang}% |
| 5817 |
% If |\@pdfidentifier| is empty, try setting it to each of |\@pdfdoi|, |
| 5818 |
% |\@pdfeissn|, |\@pdfissn|, and |\@pdfisbn|, in turn, with proper |
| 5819 |
% syntactic adjustments. |
| 5820 |
% \begin{macrocode} |
| 5821 |
\@ifmtargexp{\@pdfidentifier}{% |
| 5822 |
\let\hyxmp@xmlified=\@empty |
| 5823 |
\hyxmp@cond@dc@identifier{info:doi/}{\@pdfdoi}% |
| 5824 |
\hyxmp@cond@dc@identifier{urn:ISSN:}{\@pdfeissn}% |
| 5825 |
\hyxmp@cond@dc@identifier{urn:ISSN:}{\@pdfissn}% |
| 5826 |
\hyxmp@cond@dc@identifier{urn:ISBN:}{\@pdfisbn}% |
| 5827 |
}{% |
| 5828 |
\hyxmp@add@simple{dc:identifier}{\@pdfidentifier}% |
| 5829 |
}% |
| 5830 |
} |
| 5831 |
% \end{macrocode} |
| 5832 |
% \end{macro} |
| 5833 |
% |
| 5834 |
% \end{schemadesc} |
| 5835 |
% |
| 5836 |
% |
| 5837 |
% \subsubsection{The XMP Rights Management schema} |
| 5838 |
% \label{sec:xmp-rights} |
| 5839 |
% |
| 5840 |
% \begin{schemadesc}[XMP Rights Management]{\protect\acro{XMP} Rights Management} |
| 5841 |
% |
| 5842 |
% \begin{macro}{\hyxmp@xmpRights@schema} |
| 5843 |
% Add properties defined by the \acro{XMP} Rights Management schema to the |
| 5844 |
% |\hyxmp@xml| macro. Currently, these are only the |
| 5845 |
% \xmpprop{xmpRights:Marked} property and the |
| 5846 |
% \xmpprop{xmpRights:WebStatement} property. If the author specified a |
| 5847 |
% copyright statement we mark the document as copyrighted. If the |
| 5848 |
% author specified a license statement we include the \acro{URL} in the |
| 5849 |
% metadata. |
| 5850 |
% \changes{v1.4}{2011/05/29}{Renamed the \texttt{xapRights} namespace |
| 5851 |
% prefix to \texttt{xmpRights}} |
| 5852 |
% \changes{v2.0}{2012/08/25}{Modified to include |
| 5853 |
% \xmpprop{xmpRights:Marked} only when \optname{pdfcopyright} is |
| 5854 |
% specified and \xmpprop{xmpRights:WebStatement} only when |
| 5855 |
% \optname{pdflicenseurl} is specified} |
| 5856 |
% \begin{macrocode} |
| 5857 |
\newcommand*{\hyxmp@xmpRights@schema}{% |
| 5858 |
% \end{macrocode} |
| 5859 |
% \begin{macro}{\hyxmp@legal} |
| 5860 |
% Set |\hyxmp@rights| to |YES| if either \optname{pdfcopyright} or |
| 5861 |
% \optname{pdflicenseurl} was specified. |
| 5862 |
% \begin{macrocode} |
| 5863 |
\let\hyxmp@rights=\@empty |
| 5864 |
\ifx\@pdflicenseurl\@empty |
| 5865 |
\else |
| 5866 |
\def\hyxmp@rights{YES}% |
| 5867 |
\fi |
| 5868 |
\ifx\@pdfcopyright\@empty |
| 5869 |
\else |
| 5870 |
\def\hyxmp@rights{YES}% |
| 5871 |
\fi |
| 5872 |
% \end{macrocode} |
| 5873 |
% Include the license-statement \acro{URL} and/or the copyright |
| 5874 |
% indication. The copyright statement itself is included by |
| 5875 |
% |\hyxmp@dc@schema| in Section~\ref{sec:dublin-core}. |
| 5876 |
% \begin{macrocode} |
| 5877 |
\ifx\hyxmp@rights\@empty |
| 5878 |
\else |
| 5879 |
\ifx\@pdfcopyright\@empty |
| 5880 |
\else |
| 5881 |
\hyxmp@add@simple{xmpRights:Marked}{True}% |
| 5882 |
\fi |
| 5883 |
\hyxmp@add@simple{xmpRights:WebStatement}{\@pdflicenseurl}% |
| 5884 |
\fi |
| 5885 |
} |
| 5886 |
% \end{macrocode} |
| 5887 |
% \end{macro} |
| 5888 |
% \end{macro} |
| 5889 |
% |
| 5890 |
% \end{schemadesc} |
| 5891 |
% |
| 5892 |
% |
| 5893 |
% \subsubsection{The XMP Media Management schema} |
| 5894 |
% \label{sec:xmp-media} |
| 5895 |
% |
| 5896 |
% \begin{schemadesc}[XMP Media Management]{\protect\acro{XMP} Media Management} |
| 5897 |
% |
| 5898 |
% \begin{macro}{\hyxmp@aep@toks} |
| 5899 |
% Once we reach the end of the preamble and know that \cs{@pdftitle} and |
| 5900 |
% \cs{@pdfauthor} are no longer expected to change we use those macros |
| 5901 |
% (and others) to define one \acro{UUID} for the document |
| 5902 |
% (\cs{hyxmp@DocumentID}) and one for the document instance |
| 5903 |
% (\cs{hyxmp@InstanceID}). As explained in |
| 5904 |
% Section~\ref{sec:initial-prep}, we defer the invocation of |
| 5905 |
% \cs{AtEndPreamble} to the end of the file. |
| 5906 |
% \changes{v5.7}{2020/10/13}{As requested by Moritz Heckscher, define |
| 5907 |
% \protect\cs{hyxmp@DocumentID} and \protect\cs{hyxmp@InstanceID} at |
| 5908 |
% the end of the preamble instead of at the end of the document} |
| 5909 |
% \begin{macrocode} |
| 5910 |
\expandafter\hyxmp@aep@toks\expandafter=\expandafter{% |
| 5911 |
\the\hyxmp@aep@toks |
| 5912 |
\AtEndPreamble{% |
| 5913 |
\@ifmtargexp{\hyxmp@DocumentID}{\hyxmp@def@DocumentID}{}% |
| 5914 |
\@ifmtargexp{\hyxmp@InstanceID}{\hyxmp@def@InstanceID}{}% |
| 5915 |
}% |
| 5916 |
} |
| 5917 |
% \end{macrocode} |
| 5918 |
% \end{macro} |
| 5919 |
% |
| 5920 |
% \begin{macro}{\hyxmp@mm@schema} |
| 5921 |
% Add properties defined by the \acro{XMP} Media Management schema to |
| 5922 |
% the |\hyxmp@xml| macro. According to the \acro{XMP} specification, |
| 5923 |
% the \xmpprop{xmpMM:DocumentID} property is supposed to uniquely |
| 5924 |
% identify a document, and the \xmpprop{xmpMM:InstanceID} property is |
| 5925 |
% supposed to change with each save operation~\cite{Adobe2012:XMP}. As |
| 5926 |
% seen in Section~\ref{sec:uuid-gen}, we do what we can to honor this |
| 5927 |
% intention from within a \tex-based workflow. We additionally support |
| 5928 |
% the \xmpprop{xmpMM:VersionID} property, whose value is supplied by |
| 5929 |
% the author using \optname{pdfversionid}. |
| 5930 |
% \changes{v1.4}{2011/05/29}{Renamed the \texttt{xapMM} namespace |
| 5931 |
% prefix to \texttt{xmpMM}} |
| 5932 |
% \changes{v3.5}{2018/11/27}{Generate \protect\cs{hyxmp@DocumentID} and |
| 5933 |
% \protect\cs{hyxmp@InstanceID} only if the document does not already |
| 5934 |
% define these using the \protect\optname{pdfdocumentid} and |
| 5935 |
% \protect\optname{pdfinstanceid} options} |
| 5936 |
% \changes{v4.0}{2019/03/09}{Include \protect\xmpprop{xmpMM:VersionID} in |
| 5937 |
% the \protect\acro{XMP} packet} |
| 5938 |
% \begin{macrocode} |
| 5939 |
\gdef\hyxmp@mm@schema{% |
| 5940 |
\hyxmp@add@simple{xmpMM:DocumentID}{\hyxmp@DocumentID}% |
| 5941 |
\hyxmp@add@simple{xmpMM:InstanceID}{\hyxmp@InstanceID}% |
| 5942 |
\hyxmp@add@simple{xmpMM:VersionID}{\@pdfversionid}% |
| 5943 |
\hyxmp@add@simple{xmpMM:RenditionClass}{\@pdfrendition}% |
| 5944 |
} |
| 5945 |
% \end{macrocode} |
| 5946 |
% \end{macro} |
| 5947 |
% |
| 5948 |
% \end{schemadesc} |
| 5949 |
% |
| 5950 |
% |
| 5951 |
% \subsubsection{The XMP Basic schema} |
| 5952 |
% \label{sec:xmp-basic} |
| 5953 |
% |
| 5954 |
% \begin{schemadesc}[XMP Basic]{\protect\acro{XMP} Basic} |
| 5955 |
|
| 5956 |
% \begin{macro}{\hyxmp@xmp@basic@schema} |
| 5957 |
% Add properties defined by the \acro{XMP} Basic schema to the |
| 5958 |
% |\hyxmp@xml| macro. These include a bunch of dates (all set to the |
| 5959 |
% same value) and the base \acro{URL} for the document if specified with |
| 5960 |
% \optname{baseurl}. |
| 5961 |
% \changes{v2.0}{2012/08/26}{Added this macro} |
| 5962 |
% \changes{v3.0}{2016/07/04}{Made the \protect\acro{XMP} |
| 5963 |
% \protect\xmpprop{xmp:CreateDate}, \protect\xmpprop{xmp:ModifyDate}, |
| 5964 |
% and \protect\xmpprop{xmp:MetadataDate} match the \protect\acro{PDF} |
| 5965 |
% \protect\pdfterm{CreationDate}} |
| 5966 |
% \changes{v3.2}{2017/01/22}{Honor \string\pkgname{hyperref}'s |
| 5967 |
% \string\optname{pdfcreationdate} and \string\optname{pdfmoddate} |
| 5968 |
% options plus a new \string\optname{pdfmetadate} option. Leonid |
| 5969 |
% Sinev requested this additional control and helped test the resulting |
| 5970 |
% \protect\pkgname{hyperxmp} code} |
| 5971 |
% \begin{macrocode} |
| 5972 |
\newcommand*{\hyxmp@xmp@basic@schema}{% |
| 5973 |
% \end{macrocode} |
| 5974 |
% For the document's creation date, use the user-specified |
| 5975 |
% |\@pdfcreationdate| if defined and non-empty. Otherwise use our |
| 5976 |
% fabricated |\hyxmp@today@xmp|. |
| 5977 |
% \begin{macrocode} |
| 5978 |
\@ifmtargexp{\@pdfcreationdate}{% |
| 5979 |
\hyxmp@add@simple{xmp:CreateDate}{\hyxmp@today@xmp}% |
| 5980 |
}{% |
| 5981 |
\hyxmp@add@simple{xmp:CreateDate}{% |
| 5982 |
\expandafter\hyxmp@as@xmp@date\expandafter{\@pdfcreationdate}}% |
| 5983 |
}% |
| 5984 |
% \end{macrocode} |
| 5985 |
% For the document's modification date, use the user-specified |
| 5986 |
% |\@pdfmoddate| if defined and non-empty. Otherwise use our |
| 5987 |
% fabricated |\hyxmp@today@xmp|. |
| 5988 |
% \begin{macrocode} |
| 5989 |
\@ifmtargexp{\@pdfmoddate}{% |
| 5990 |
\hyxmp@add@simple{xmp:ModifyDate}{\hyxmp@today@xmp}% |
| 5991 |
}{% |
| 5992 |
\hyxmp@add@simple{xmp:ModifyDate}{% |
| 5993 |
\expandafter\hyxmp@as@xmp@date\expandafter{\@pdfmoddate}}% |
| 5994 |
}% |
| 5995 |
% \end{macrocode} |
| 5996 |
% For the document's metadata date, use the user-specified |
| 5997 |
% |\@pdfmetadatetime| if defined and non-empty. Otherwise use our |
| 5998 |
% fabricated |\hyxmp@today@xmp|. |
| 5999 |
% \begin{macrocode} |
| 6000 |
\@ifmtargexp{\@pdfmetadatetime}{% |
| 6001 |
\hyxmp@add@simple{xmp:MetadataDate}{\hyxmp@today@xmp}% |
| 6002 |
}{% |
| 6003 |
\hyxmp@add@simple{xmp:MetadataDate}{\@pdfmetadatetime}% |
| 6004 |
}% |
| 6005 |
% \end{macrocode} |
| 6006 |
% Define the creation tool and the base \acro{URL}. |
| 6007 |
% \begin{macrocode} |
| 6008 |
\hyxmp@add@simple{xmp:CreatorTool}{\@pdfcreator}% |
| 6009 |
\hyxmp@add@simple{xmp:BaseURL}{\@baseurl}% |
| 6010 |
} |
| 6011 |
% \end{macrocode} |
| 6012 |
% \end{macro} |
| 6013 |
% |
| 6014 |
% \end{schemadesc} |
| 6015 |
% |
| 6016 |
% |
| 6017 |
% \subsubsection{The Photoshop schema} |
| 6018 |
% \label{sec:photoshop} |
| 6019 |
% |
| 6020 |
% \begin{schemadesc}{Photoshop} |
| 6021 |
% |
| 6022 |
% \begin{macro}{\hyxmp@photoshop@schema} |
| 6023 |
% \changes{v2.0}{2012/08/26}{Simplified using |
| 6024 |
% \texttt{\string\string\string\hyxmp@add@simple}} |
| 6025 |
% \begin{macro}{\hyxmp@photoshop@data} |
| 6026 |
% Add properties defined by the Photoshop schema to the |\hyxmp@xml| |
| 6027 |
% macro. We currently support only the |
| 6028 |
% \xmpprop{photoshop:AuthorsPosition} and |
| 6029 |
% \xmpprop{photoshop:CaptionWriter} properties. |
| 6030 |
% \begin{macrocode} |
| 6031 |
\gdef\hyxmp@photoshop@schema{% |
| 6032 |
\edef\hyxmp@photoshop@data{\@pdfauthortitle\@pdfcaptionwriter}% |
| 6033 |
\hyxmp@add@simple{photoshop:AuthorsPosition}{\@pdfauthortitle}% |
| 6034 |
\hyxmp@add@simple{photoshop:CaptionWriter}{\@pdfcaptionwriter}% |
| 6035 |
} |
| 6036 |
% \end{macrocode} |
| 6037 |
% \end{macro} |
| 6038 |
% \end{macro} |
| 6039 |
% |
| 6040 |
% \end{schemadesc} |
| 6041 |
% |
| 6042 |
% |
| 6043 |
% \subsubsection{PDF/* Identification schemata} |
| 6044 |
% \label{sec:pdfX-id} |
| 6045 |
% |
| 6046 |
% \begin{schemadesc}[PDF/A Identification]{\protect\acro{PDF/A} Identification} |
| 6047 |
% \begin{schemadesc}[PDF/X Identification]{\protect\acro{PDF/X} Identification} |
| 6048 |
% \begin{schemadesc}[PDF/UA Identification]{\protect\acro{PDF/UA} Identification} |
| 6049 |
% |
| 6050 |
% \begin{macro}{\hyxmp@pdfa@id@schema} |
| 6051 |
% Add properties defined by the \acro{PDF/A} Identification |
| 6052 |
% schema~\cite{PDFA2008:xmp-props} to the |\hyxmp@xml| macro. These |
| 6053 |
% properties identify a document as conforming to a particular |
| 6054 |
% \acro{PDF/A} standard. We default to \PDFstd{A}{1}{b}{} if any |
| 6055 |
% \acro{PDF/A} compliance is detected but let the author override the |
| 6056 |
% ``1'' with \optname{pdfapart} and the ``b'' with |
| 6057 |
% \optname{pdfaconformance}. |
| 6058 |
% \changes{v2.4}{2013/12/21}{Added this macro} |
| 6059 |
% \changes{v2.9}{2016/04/12}{Let the author specify the \protect\acro{PDF/A} |
| 6060 |
% part and conformance IDs, as requested by Leonid Sinev} |
| 6061 |
% \begin{macrocode} |
| 6062 |
\newcommand*{\hyxmp@pdfa@id@schema}{% |
| 6063 |
\ifHy@pdfa |
| 6064 |
\hyxmp@add@simple{pdfaid:part}{\@pdfapart}% |
| 6065 |
\hyxmp@add@simple{pdfaid:conformance}{\@pdfaconformance}% |
| 6066 |
\fi |
| 6067 |
} |
| 6068 |
% \end{macrocode} |
| 6069 |
% \end{macro} |
| 6070 |
% |
| 6071 |
% \begin{macro}{\hyxmp@pdfua@id@schema} |
| 6072 |
% If the document conforms to a \acro{PDF/UA} standard, the author can |
| 6073 |
% indicate the standard version with \optname{pdfuapart}. |
| 6074 |
% \changes{v5.0}{2020/02/16}{Added this macro} |
| 6075 |
% \begin{macrocode} |
| 6076 |
\newcommand*{\hyxmp@pdfua@id@schema}{% |
| 6077 |
\hyxmp@add@simple{pdfuaid:part}{\@pdfuapart}% |
| 6078 |
} |
| 6079 |
% \end{macrocode} |
| 6080 |
% \end{macro} |
| 6081 |
% |
| 6082 |
% \begin{macro}{\hyxmp@pdfx@id@schema} |
| 6083 |
% \label{page:pdfx-id-schema} |
| 6084 |
% If the document conforms to a \acro{PDF/X} standard, the author can |
| 6085 |
% indicate the standard version with \optname{pdfxstandard}. We |
| 6086 |
% separately handle \PDFstd{X}{1}{}{}, \PDFstd{X}{2}{}{} and |
| 6087 |
% \PDFstd{X}{3}{}{}, and \PDFstd{X}{4}{}{} onwards. |
| 6088 |
% \changes{v5.0}{2020/02/26}{Added this macro} |
| 6089 |
% \begin{macrocode} |
| 6090 |
\newcommand*{\hyxmp@pdfx@id@schema}{% |
| 6091 |
\@hyxmp@count=0\hyxmp@pdfx@major\relax |
| 6092 |
\ifnum\@hyxmp@count=0 |
| 6093 |
\else |
| 6094 |
\ifnum\@hyxmp@count=1 |
| 6095 |
\hyxmp@add@simple{pdfx:GTS_PDFXVersion}{PDF/X-1:2001}% |
| 6096 |
\hyxmp@add@simple{pdfx:GTS_PDFXConformance}{\@pdfxstandard}% |
| 6097 |
\else |
| 6098 |
\ifnum\@hyxmp@count<4 |
| 6099 |
\hyxmp@add@simple{pdfx:GTS_PDFXVersion}{\@pdfxstandard}% |
| 6100 |
\else |
| 6101 |
\hyxmp@add@simple{pdfxid:GTS_PDFXVersion}{\@pdfxstandard}% |
| 6102 |
\fi |
| 6103 |
\fi |
| 6104 |
\fi |
| 6105 |
} |
| 6106 |
% \end{macrocode} |
| 6107 |
% \end{macro} |
| 6108 |
% |
| 6109 |
% \end{schemadesc} |
| 6110 |
% \end{schemadesc} |
| 6111 |
% \end{schemadesc} |
| 6112 |
% |
| 6113 |
% |
| 6114 |
% \subsubsection{The IPTC Photo Metadata schema} |
| 6115 |
% \label{sec:photo-meta} |
| 6116 |
% |
| 6117 |
% \begin{schemadesc}[IPTC Photo Metadata]{\protect\acro{IPTC} Photo Metadata} |
| 6118 |
% |
| 6119 |
% \begin{macro}{\xmplinesep} |
| 6120 |
% Lines in multiline fields are separated by |\xmplinesep| in the |
| 6121 |
% generated \acro{XML}. This defaults to an \acro{LF} (|^^J|) character |
| 6122 |
% but written as an \acro{XML} character entity for consistency across |
| 6123 |
% operating systems. |
| 6124 |
% \changes{v2.2}{2012/12/07}{Added this macro} |
| 6125 |
% \begin{macrocode} |
| 6126 |
\begingroup |
| 6127 |
\catcode`\&=12 |
| 6128 |
\catcode`\#=12 |
| 6129 |
\gdef\xmplinesep{
} |
| 6130 |
\endgroup |
| 6131 |
% \end{macrocode} |
| 6132 |
% \end{macro} |
| 6133 |
% |
| 6134 |
% \begin{macro}{\hyxmp@list@to@lines} |
| 6135 |
% Given a property~(|#1|) and a macro containing a comma-separated |
| 6136 |
% list~(|#2|), replace commas with |\xmplinesep|. Do nothing if the |
| 6137 |
% list is empty. |
| 6138 |
% \changes{v2.2}{2012/12/07}{Added this macro} |
| 6139 |
% \begin{macrocode} |
| 6140 |
\newcommand*{\hyxmp@list@to@lines}[2]{% |
| 6141 |
\@ifnotmtargexp{#2}{% |
| 6142 |
\bgroup |
| 6143 |
\hyxmp@add@to@xml{% |
| 6144 |
\hyxmp@extra@indent______<#1>% |
| 6145 |
}% |
| 6146 |
% \end{macrocode} |
| 6147 |
% \begin{macro}{\@elt@first} |
| 6148 |
% The first element of the list is output as is. |
| 6149 |
% \begin{macrocode} |
| 6150 |
\def\@elt@first##1{% |
| 6151 |
\hyxmp@add@to@xml{##1}% |
| 6152 |
\let\@elt=\@elt@rest |
| 6153 |
}% |
| 6154 |
% \end{macrocode} |
| 6155 |
% \begin{macro}{\@elt@rest} |
| 6156 |
% The remaining elements of the list are output with a preceding line |
| 6157 |
% separator (|\xmplinesep|). |
| 6158 |
% \begin{macrocode} |
| 6159 |
\def\@elt@rest##1{% |
| 6160 |
\hyxmp@add@to@xml{\xmplinesep##1}% |
| 6161 |
}% |
| 6162 |
% \end{macrocode} |
| 6163 |
% \begin{macro}{\@elt} |
| 6164 |
% Re-encode the text from \term{Unicode} if necessary. Then redefine |
| 6165 |
% |\@elt| to insert a line separator between terms. |
| 6166 |
% \begin{macrocode} |
| 6167 |
\let\@elt=\@elt@first |
| 6168 |
\hyxmp@xmlify{#2}% |
| 6169 |
\hyxmp@commas@to@list\hyxmp@list{\hyxmp@xmlified}% |
| 6170 |
\hyxmp@list |
| 6171 |
\hyxmp@add@to@xml{</#1>^^J}% |
| 6172 |
\egroup |
| 6173 |
}% |
| 6174 |
} |
| 6175 |
% \end{macrocode} |
| 6176 |
% \end{macro} |
| 6177 |
% \end{macro} |
| 6178 |
% \end{macro} |
| 6179 |
% \end{macro} |
| 6180 |
% |
| 6181 |
% \begin{macro}{\hyxmp@iptc@schema} |
| 6182 |
% Add properties defined by the \acro{IPTC} Photo Metadata |
| 6183 |
% schema~\cite{IPTC2010:photo-meta} to the |\hyxmp@xml| macro. We |
| 6184 |
% currently support only the \xmpprop{Iptc4xmpCore:CreatorContactInfo} |
| 6185 |
% property, although this is a structure containing multiple fields. |
| 6186 |
% \changes{v2.2}{2012/12/07}{Added this macro} |
| 6187 |
% \changes{v2.9}{2016/04/23}{Use \textsf{Iptc4xmpCore} instead of |
| 6188 |
% \textsf{Iptc4ContInfo} as the contact-information metadata prefix. |
| 6189 |
% Leonid Sinev reports that Acrobat's \acro{PDF/A} validator seems to |
| 6190 |
% prefer \textsf{Iptc4xmpCore}} |
| 6191 |
% \changes{v4.0}{2019/03/09}{Moved the definition of |
| 6192 |
% \protect\cs{hyxmp@iptc@data} from here into |
| 6193 |
% \protect\cs{hyxmp@check@iptc@data}} |
| 6194 |
% \changes{v4.0}{2019/03/16}{Renamed this macro to |
| 6195 |
% \protect\cs{hyxmp@iptc@schema} from |
| 6196 |
% \protect\cs{hyxmp@photometa@schema}} |
| 6197 |
% \changes{v4.0}{2019/03/16}{Rewrote this macro entirely to correct |
| 6198 |
% the use of fields within a structure} |
| 6199 |
% \begin{macrocode} |
| 6200 |
\gdef\hyxmp@iptc@schema{% |
| 6201 |
% \end{macrocode} |
| 6202 |
% Because we currently support only |
| 6203 |
% \xmpprop{Iptc4xmpCore:CreatorContactInfo} it suffices to check if we |
| 6204 |
% have any relevant data. If so, we instantiate a |
| 6205 |
% \xmpprop{Iptc4xmpCore:ContactInfo} structure with all available |
| 6206 |
% fields. |
| 6207 |
% \begin{macrocode} |
| 6208 |
\ifx\hyxmp@iptc@data\@empty |
| 6209 |
\else |
| 6210 |
\hyxmp@add@to@xml{% |
| 6211 |
______<Iptc4xmpCore:CreatorContactInfo rdf:parseType="Resource">^^J% |
| 6212 |
}% |
| 6213 |
% \end{macrocode} |
| 6214 |
% We locally redefine |\hyxmp@extra@indent| to increase the indentation |
| 6215 |
% of the assignments to \xmpprop{Iptc4xmpCore:CreatorContactInfo}'s |
| 6216 |
% fields. |
| 6217 |
% \begin{macrocode} |
| 6218 |
\bgroup |
| 6219 |
\edef\hyxmp@extra@indent{\hyxmp@extra@indent\space\space}% |
| 6220 |
\hyxmp@list@to@lines{Iptc4xmpCore:CiAdrExtadr}{\@pdfcontactaddress}% |
| 6221 |
\hyxmp@add@simple{Iptc4xmpCore:CiAdrCity}{\@pdfcontactcity}% |
| 6222 |
\hyxmp@add@simple{Iptc4xmpCore:CiAdrRegion}{\@pdfcontactregion}% |
| 6223 |
\hyxmp@add@simple{Iptc4xmpCore:CiAdrPcode}{\@pdfcontactpostcode}% |
| 6224 |
\hyxmp@add@simple{Iptc4xmpCore:CiAdrCtry}{\@pdfcontactcountry}% |
| 6225 |
% \end{macrocode} |
| 6226 |
% \begin{macro}{\xmplinesep} |
| 6227 |
% The \acro{IPTC} standard states that sets of telephone numbers, email |
| 6228 |
% addresses, and \acro{URL}s for the contact person or institution, |
| 6229 |
% ``[m]ay have to be separated by a comma in the user |
| 6230 |
% interface''~\cite{IPTC2010:photo-meta}. This is rather ambiguous: |
| 6231 |
% Does the comma appear \emph{only} in the user interface or also in the |
| 6232 |
% generated \acro{XML}\@? Here we assume the latter interpretation and |
| 6233 |
% temporarily redefine |\xmplinesep| as a comma and use |
| 6234 |
% |\hyxmp@list@to@lines| to insert the data. Unlike |
| 6235 |
% |\hyxmp@add@simple|, this approach trims all spaces surrounding commas. |
| 6236 |
% \begin{macrocode} |
| 6237 |
\def\xmplinesep{,}% |
| 6238 |
\hyxmp@list@to@lines{Iptc4xmpCore:CiTelWork}{\@pdfcontactphone}% |
| 6239 |
\hyxmp@list@to@lines{Iptc4xmpCore:CiEmailWork}{\@pdfcontactemail}% |
| 6240 |
\hyxmp@list@to@lines{Iptc4xmpCore:CiUrlWork}{\@pdfcontacturl}% |
| 6241 |
\egroup |
| 6242 |
\hyxmp@add@to@xml{% |
| 6243 |
______</Iptc4xmpCore:CreatorContactInfo>^^J% |
| 6244 |
}% |
| 6245 |
\fi |
| 6246 |
} |
| 6247 |
% \end{macrocode} |
| 6248 |
% \end{macro} |
| 6249 |
% \end{macro} |
| 6250 |
% |
| 6251 |
% \end{schemadesc} |
| 6252 |
% |
| 6253 |
% |
| 6254 |
% \subsubsection{The PRISM Basic Metadata schema} |
| 6255 |
% \label{sec:prism-meta} |
| 6256 |
% |
| 6257 |
% \begin{schemadesc}[PRISM Basic Metadata]{\protect\acro{PRISM} Basic Metadata} |
| 6258 |
% |
| 6259 |
% \begin{macro}{\hyxmp@prism@schema} |
| 6260 |
% \changes{v4.0}{2019/03/10}{Added this macro} |
| 6261 |
% Add properties defined by the \acro{PRISM} Basic Metadata |
| 6262 |
% schema~\cite{PRISM2012:basic-meta}. |
| 6263 |
% \begin{macrocode} |
| 6264 |
\newcommand*{\hyxmp@prism@schema}{% |
| 6265 |
\ifx\hyxmp@prism@data\@empty |
| 6266 |
\else |
| 6267 |
\hyxmp@add@simple{prism:complianceProfile}{three}% |
| 6268 |
\fi |
| 6269 |
\hyxmp@add@simple@lang{prism:subtitle}{\@pdfsubtitle}% |
| 6270 |
\hyxmp@add@simple@lang{prism:publicationName}{\@pdfpublication}% |
| 6271 |
\hyxmp@add@simple{prism:aggregationType}{\@pdfpubtype}% |
| 6272 |
\hyxmp@add@simple@lang{prism:bookEdition}{\@pdfbookedition}% |
| 6273 |
\hyxmp@add@simple{prism:volume}{\@pdfvolumenum}% |
| 6274 |
\hyxmp@add@simple{prism:number}{\@pdfissuenum}% |
| 6275 |
\hyxmp@add@simple{prism:pageRange}{\@pdfpagerange}% |
| 6276 |
\hyxmp@add@simple{prism:isbn}{\@pdfisbn}% |
| 6277 |
\hyxmp@add@simple{prism:issn}{\@pdfissn}% |
| 6278 |
\hyxmp@add@simple{prism:eIssn}{\@pdfeissn}% |
| 6279 |
\hyxmp@add@simple{prism:doi}{\@pdfdoi}% |
| 6280 |
\hyxmp@add@simple{prism:url}{\@pdfurl}% |
| 6281 |
\hyxmp@add@simple{prism:byteCount}{\@pdfbytes}% |
| 6282 |
\hyxmp@add@simple{prism:pageCount}{\@pdfnumpages}% |
| 6283 |
} |
| 6284 |
% \end{macrocode} |
| 6285 |
% \end{macro} |
| 6286 |
% |
| 6287 |
% \end{schemadesc} |
| 6288 |
% |
| 6289 |
% |
| 6290 |
% \subsubsection{The Journal Article Versions (JAV) schema} |
| 6291 |
% \label{sec:niso-jav-meta} |
| 6292 |
% |
| 6293 |
% \begin{schemadesc}{Journal Article Versions} |
| 6294 |
% |
| 6295 |
% \begin{macro}{\hyxmp@jav@schema} |
| 6296 |
% \changes{v5.5}{2020/07/23}{Added this macro} |
| 6297 |
% Add properties defined by the \acro{NISO}/\acro{ALPSP} Journal Article |
| 6298 |
% Versions schema~\cite{NISO2008:jav}. |
| 6299 |
% \begin{macrocode} |
| 6300 |
\newcommand*{\hyxmp@jav@schema}{% |
| 6301 |
\hyxmp@add@simple{jav:journal_article_version}{\@pdfpubstatus}% |
| 6302 |
} |
| 6303 |
% \end{macrocode} |
| 6304 |
% \end{macro} |
| 6305 |
% |
| 6306 |
% \end{schemadesc} |
| 6307 |
% |
| 6308 |
% \subsubsection{The XMP Paged-Text schema} |
| 6309 |
% \label{sec:xmp-paged-text} |
| 6310 |
% |
| 6311 |
% \begin{schemadesc}[XMP Paged-Text]{\protect\acro{XMP} Paged-Text} |
| 6312 |
% |
| 6313 |
% \begin{macro}{\hyxmp@xmptpg@schema} |
| 6314 |
% The \acro{XMP} Paged-Text schema~\cite{Adobe2012:XMP} includes |
| 6315 |
% properties related to the construction of the \acro{PDF} file itself. |
| 6316 |
% We acquire most of this information through \LuaTeX\ mechanisms and |
| 6317 |
% therefore include much less information when run from other \TeX\ engines. |
| 6318 |
% \changes{v5.5}{2020/07/25}{Added this macro} |
| 6319 |
% \begin{macrocode} |
| 6320 |
\newcommand*{\hyxmp@xmptpg@schema}{% |
| 6321 |
\ifLuaTeX |
| 6322 |
\luadirect{write_xmp_font_list(\the\hyxmp@cct)}% |
| 6323 |
\fi |
| 6324 |
\hyxmp@add@simple{xmpTPg:NPages}{\@pdfnumpages}% |
| 6325 |
} |
| 6326 |
% \end{macrocode} |
| 6327 |
% \end{macro} |
| 6328 |
% |
| 6329 |
% \begin{macro}{\hyxmp@cct} |
| 6330 |
% We store the current category-code table to ensure that |
| 6331 |
% |write_xmp_font_list|'s output uses our redefined category codes. |
| 6332 |
% \begin{macrocode} |
| 6333 |
\ifLuaTeX |
| 6334 |
\newcatcodetable\hyxmp@cct |
| 6335 |
\savecatcodetable\hyxmp@cct |
| 6336 |
\fi |
| 6337 |
% \end{macrocode} |
| 6338 |
% \end{macro} |
| 6339 |
% |
| 6340 |
% \begin{macro}{\hyxmp@prot@us} |
| 6341 |
% Define an underscore character that's protected from being converted |
| 6342 |
% into a space when passed to \cs{hyxmp@add@to@xml}. \cs{hyxmp@prot@us} |
| 6343 |
% is used within |write_xmp_font_list| (below) in particular to typeset |
| 6344 |
% filenames that may contain underscores. |
| 6345 |
% \begin{macrocode} |
| 6346 |
\bgroup |
| 6347 |
\catcode`\_=11 |
| 6348 |
\gdef\hyxmp@prot@us{_}% |
| 6349 |
\egroup |
| 6350 |
% \end{macrocode} |
| 6351 |
% \end{macro} |
| 6352 |
% |
| 6353 |
% Here we define a Lua\index{Lua} function, |write_xmp_font_list|, that |
| 6354 |
% writes font information to the \acro{XMP} packet. |
| 6355 |
% \changes{v5.6}{2020/10/02}{Make \protect\texttt{write\_xmp\_font\_list} |
| 6356 |
% robust to fonts loaded using |
| 6357 |
% \protect\href{https://en.wikipedia.org/wiki/HarfBuzz}{HarfBuzz}. |
| 6358 |
% Thanks to John Lienhard for the bug report} |
| 6359 |
% \changes{v5.6}{2020/10/02}{Don't inadvertently replace underscores in |
| 6360 |
% filenames when writing font-related metadata} |
| 6361 |
% \begin{macrocode} |
| 6362 |
\ifLuaTeX |
| 6363 |
\begin{luacode*} |
| 6364 |
function write_xmp_font_list (cct) |
| 6365 |
local function show_field(name, ...) |
| 6366 |
for i = 1, select("#", ...) do |
| 6367 |
local val = select(i, ...) |
| 6368 |
if val then |
| 6369 |
local xml = string.gsub(val, "&", "&") |
| 6370 |
xml = string.gsub(xml, "<", "<") |
| 6371 |
xml = string.gsub(xml, ">", ">") |
| 6372 |
xml = string.gsub(xml, "_", "\\hyxmp@prot@us ") |
| 6373 |
tex.print(cct, "____________<stFnt:" .. name .. ">" .. |
| 6374 |
xml .. "</stFnt:" .. name .. ">^^J%") |
| 6375 |
return |
| 6376 |
end |
| 6377 |
end |
| 6378 |
end |
| 6379 |
tex.print(cct, "\\hyxmp@add@to@xml{%") |
| 6380 |
tex.print(cct, "______<xmpTPg:Fonts>^^J%") |
| 6381 |
tex.print(cct, "________<rdf:Bag>^^J%") |
| 6382 |
for i, f in font.each() do |
| 6383 |
tex.print(cct, "__________<rdf:li rdf:parseType=\"Resource\">^^J%") |
| 6384 |
if f.filename then |
| 6385 |
local fname = string.gsub(f.filename, "^harfloaded:(.*)", "%1") |
| 6386 |
local info = fontloader.info(fname) |
| 6387 |
if info then |
| 6388 |
show_field("fontFace", info.fullname) |
| 6389 |
show_field("fontFamily", info.familyname) |
| 6390 |
show_field("fontName", info.fontname) |
| 6391 |
show_field("versionString", info.version) |
| 6392 |
end |
| 6393 |
local baseName = string.gsub(f.filename, ".*[/\\](.*)", "%1") |
| 6394 |
show_field("fontFileName", baseName) |
| 6395 |
else |
| 6396 |
show_field("fontName", f.psname, f.fullname, f.name) |
| 6397 |
end |
| 6398 |
if f.format and f.format ~= "unknown" then |
| 6399 |
show_field("fontType", f.format) |
| 6400 |
end |
| 6401 |
tex.print(cct, "__________</rdf:li>^^J%") |
| 6402 |
end |
| 6403 |
tex.print(cct, "________</rdf:Bag>^^J%") |
| 6404 |
tex.print(cct, "______</xmpTPg:Fonts>^^J%") |
| 6405 |
tex.print(cct, "}") |
| 6406 |
end |
| 6407 |
\end{luacode*} |
| 6408 |
\fi |
| 6409 |
% \end{macrocode} |
| 6410 |
% |
| 6411 |
% \end{schemadesc} |
| 6412 |
% |
| 6413 |
% |
| 6414 |
% \subsubsection{XMP extension schemata} |
| 6415 |
% \label{sec:extension-schemata} |
| 6416 |
% |
| 6417 |
% Not all of the schemata supported by \pkgname{hyperxmp} are predefined |
| 6418 |
% by \acro{XMP}. \acro{PDF/A} conversion would normally fail for |
| 6419 |
% documents that employ ``custom'' schemata. However, this problem can |
| 6420 |
% be circumvented by declaring non-standard schemata in the \acro{XMP} |
| 6421 |
% packet itself, following a technique described in a PDF Association |
| 6422 |
% technical note~\cite{PDFA2008:ext-schemas}. In this section, we |
| 6423 |
% declare only those schemata we actually use. |
| 6424 |
% |
| 6425 |
% \begin{macro}{\hyxmp@check@iptc@data} |
| 6426 |
% \begin{macro}{\hyxmp@iptc@data} |
| 6427 |
% Define |\hyxmp@iptc@data| as the concatenation of all \acro{IPTC} |
| 6428 |
% photo metadata supplied by the document. |
| 6429 |
% \begin{macrocode} |
| 6430 |
\newcommand*{\hyxmp@check@iptc@data}{% |
| 6431 |
\edef\hyxmp@iptc@data{% |
| 6432 |
\@pdfcontactaddress |
| 6433 |
\@pdfcontactcity |
| 6434 |
\@pdfcontactregion |
| 6435 |
\@pdfcontactpostcode |
| 6436 |
\@pdfcontactcountry |
| 6437 |
\@pdfcontactphone |
| 6438 |
\@pdfcontactemail |
| 6439 |
\@pdfcontacturl |
| 6440 |
}% |
| 6441 |
}% |
| 6442 |
% \end{macrocode} |
| 6443 |
% \end{macro} |
| 6444 |
% \end{macro} |
| 6445 |
% |
| 6446 |
% \begin{macro}{\hyxmp@check@prism@data} |
| 6447 |
% \begin{macro}{\hyxmp@prism@data} |
| 6448 |
% Define |\hyxmp@prism@data| as the concatenation of all \acro{PRISM} |
| 6449 |
% metadata supplied by the document. |
| 6450 |
% \begin{macrocode} |
| 6451 |
\newcommand*{\hyxmp@check@prism@data}{% |
| 6452 |
\edef\hyxmp@prism@data{% |
| 6453 |
\@pdfbookedition |
| 6454 |
\@pdfbytes |
| 6455 |
\@pdfdoi |
| 6456 |
\@pdfeissn |
| 6457 |
\@pdfisbn |
| 6458 |
\@pdfissn |
| 6459 |
\@pdfissuenum |
| 6460 |
\@pdfnumpages |
| 6461 |
\@pdfpagerange |
| 6462 |
\@pdfpublication |
| 6463 |
\@pdfpubtype |
| 6464 |
\@pdfsubtitle |
| 6465 |
\@pdfurl |
| 6466 |
\@pdfvolumenum |
| 6467 |
}% |
| 6468 |
}% |
| 6469 |
% \end{macrocode} |
| 6470 |
% \end{macro} |
| 6471 |
% \end{macro} |
| 6472 |
% |
| 6473 |
% \begin{macro}{\hyxmp@check@jav@data} |
| 6474 |
% \begin{macro}{\hyxmp@jav@data} |
| 6475 |
% Define |\hyxmp@jav@data| as the concatenation of all \acro{JAV} |
| 6476 |
% metadata supplied by the document. |
| 6477 |
% \begin{macrocode} |
| 6478 |
\newcommand*{\hyxmp@check@jav@data}{% |
| 6479 |
\edef\hyxmp@jav@data{% |
| 6480 |
\@pdfpubstatus |
| 6481 |
}% |
| 6482 |
} |
| 6483 |
% \end{macrocode} |
| 6484 |
% \end{macro} |
| 6485 |
% \end{macro} |
| 6486 |
% |
| 6487 |
% \begin{macro}{\hyxmp@begin@extension@decls} |
| 6488 |
% Begin a block of \acro{XML} tags that indicates we're declaring one or |
| 6489 |
% more extension schemata. |
| 6490 |
% \begin{macrocode} |
| 6491 |
\newcommand*{\hyxmp@begin@extension@decls}{% |
| 6492 |
\hyxmp@add@to@xml{% |
| 6493 |
______<pdfaExtension:schemas>^^J% |
| 6494 |
________<rdf:Bag>^^J% |
| 6495 |
}% |
| 6496 |
} |
| 6497 |
% \end{macrocode} |
| 6498 |
% \end{macro} |
| 6499 |
% |
| 6500 |
% \begin{macro}{\hyxmp@end@extension@decls} |
| 6501 |
% End the block of \acro{XML} tags begun by |\hyxmp@begin@extension@decls|. |
| 6502 |
% \begin{macrocode} |
| 6503 |
\newcommand*{\hyxmp@end@extension@decls}{% |
| 6504 |
\hyxmp@add@to@xml{% |
| 6505 |
________</rdf:Bag>^^J% |
| 6506 |
______</pdfaExtension:schemas>^^J% |
| 6507 |
}% |
| 6508 |
} |
| 6509 |
% \end{macrocode} |
| 6510 |
% \end{macro} |
| 6511 |
% |
| 6512 |
% \begin{macro}{\hyxmp@begin@ext@decl} |
| 6513 |
% Begin the declaration of a single extension schema. |
| 6514 |
% |\hyxmp@begin@ext@decl| accepts the schema's name, prefix, and |
| 6515 |
% namespace URI. |
| 6516 |
% \changes{v4.0}{2019/03/15}{Added this macro} |
| 6517 |
% \begin{macrocode} |
| 6518 |
\newcommand*{\hyxmp@begin@ext@decl}[3]{% |
| 6519 |
\hyxmp@add@to@xml{% |
| 6520 |
__________<rdf:li rdf:parseType="Resource">^^J% |
| 6521 |
____________<pdfaSchema:schema>#1</pdfaSchema:schema>^^J% |
| 6522 |
____________<pdfaSchema:prefix>#2</pdfaSchema:prefix>^^J% |
| 6523 |
____________<pdfaSchema:namespaceURI>#3</pdfaSchema:namespaceURI>^^J% |
| 6524 |
____________<pdfaSchema:property>^^J% |
| 6525 |
______________<rdf:Seq>^^J% |
| 6526 |
}% |
| 6527 |
}% |
| 6528 |
% \end{macrocode} |
| 6529 |
% \end{macro} |
| 6530 |
% |
| 6531 |
% \begin{macro}{\hyxmp@end@ext@decl} |
| 6532 |
% End the declaration of a single extension schema. |
| 6533 |
% \changes{v4.0}{2019/03/15}{Added this macro} |
| 6534 |
% \begin{macrocode} |
| 6535 |
\newcommand*{\hyxmp@end@ext@decl}{% |
| 6536 |
\hyxmp@add@to@xml{% |
| 6537 |
______________</rdf:Seq>^^J% |
| 6538 |
____________</pdfaSchema:property>^^J% |
| 6539 |
__________</rdf:li>^^J% |
| 6540 |
}% |
| 6541 |
}% |
| 6542 |
% \end{macrocode} |
| 6543 |
% \end{macro} |
| 6544 |
% |
| 6545 |
% \begin{macro}{\hyxmp@declare@property} |
| 6546 |
% Declare a single extension-schema property. |\hyxmp@declare@property| |
| 6547 |
% takes as input an optional type (defaults to \xmpterm{Text}) and a |
| 6548 |
% mandatory name, category, and description. |
| 6549 |
% \changes{v4.0}{2019/03/15}{Added this macro} |
| 6550 |
% \changes{v5.0}{2020/02/21}{Insert the property name (\string\texttt{\#2}) |
| 6551 |
% verbatim} |
| 6552 |
% \begin{macrocode} |
| 6553 |
\newcommand{\hyxmp@declare@property}[4][Text]{% |
| 6554 |
\hyxmp@add@to@xml{% |
| 6555 |
________________<rdf:li rdf:parseType="Resource">^^J% |
| 6556 |
__________________<pdfaProperty:name>}% |
| 6557 |
\xdef\hyxmp@xml{\hyxmp@xml#2}% |
| 6558 |
\hyxmp@add@to@xml{</pdfaProperty:name>^^J% |
| 6559 |
__________________<pdfaProperty:valueType>#1</pdfaProperty:valueType>^^J% |
| 6560 |
__________________<pdfaProperty:category>#3</pdfaProperty:category>^^J% |
| 6561 |
__________________<pdfaProperty:description>#4</pdfaProperty:description>^^J% |
| 6562 |
________________</rdf:li>^^J% |
| 6563 |
}% |
| 6564 |
}% |
| 6565 |
% \end{macrocode} |
| 6566 |
% \end{macro} |
| 6567 |
% |
| 6568 |
% \begin{macro}{\hyxmp@declare@field} |
| 6569 |
% Declare a single field in a custom datatype required by an extension |
| 6570 |
% schema. |\hyxmp@declare@field| takes as input an optional type |
| 6571 |
% (defaults to \xmpterm{Text}) and a mandatory name and description. |
| 6572 |
% \changes{v4.0}{2019/03/16}{Replaced |
| 6573 |
% \protect\cs{hyxmp@declare@resource} with this macro} |
| 6574 |
% \begin{macrocode} |
| 6575 |
\newcommand{\hyxmp@declare@field}[3][Text]{% |
| 6576 |
\hyxmp@add@to@xml{% |
| 6577 |
______________________<rdf:li rdf:parseType="Resource">^^J% |
| 6578 |
________________________<pdfaField:name>#2</pdfaField:name>^^J% |
| 6579 |
________________________<pdfaField:valueType>#1</pdfaField:valueType>^^J% |
| 6580 |
________________________<pdfaField:description>#3</pdfaField:description>^^J% |
| 6581 |
______________________</rdf:li>^^J% |
| 6582 |
}% |
| 6583 |
} |
| 6584 |
% \end{macrocode} |
| 6585 |
% \end{macro} |
| 6586 |
% |
| 6587 |
% \begin{macro}{\hyxmp@pdf@extensions} |
| 6588 |
% Declare the Adobe \acro{PDF} schema. |
| 6589 |
% \changes{v5.0}{2020/02/27}{Added this macro} |
| 6590 |
% \begin{macrocode} |
| 6591 |
\newcommand*{\hyxmp@pdf@extensions}{% |
| 6592 |
\hyxmp@begin@ext@decl |
| 6593 |
{Adobe PDF Schema}% |
| 6594 |
{pdf}% |
| 6595 |
{http://ns.adobe.com/pdf/1.3/}% |
| 6596 |
\hyxmp@declare@property |
| 6597 |
{Trapped}% |
| 6598 |
{internal}% |
| 6599 |
{Indication if the document has been modified to include trapping information}% |
| 6600 |
\hyxmp@end@ext@decl |
| 6601 |
}% |
| 6602 |
% \end{macrocode} |
| 6603 |
% \end{macro} |
| 6604 |
% |
| 6605 |
% \begin{macro}{\hyxmp@mm@extensions} |
| 6606 |
% Declare the \acro{XMP} Media Management schema. |
| 6607 |
% \changes{v4.0}{2019/03/15}{Added this macro} |
| 6608 |
% \changes{v5.5}{2020/07/23}{Corrected the type of |
| 6609 |
% \protect\xmpprop{xmpMM:RenditionClass}. Thanks to Thorsten Wi{\ss}mann |
| 6610 |
% for the bug report and patch} |
| 6611 |
% \begin{macrocode} |
| 6612 |
\newcommand*{\hyxmp@mm@extensions}{% |
| 6613 |
\hyxmp@begin@ext@decl |
| 6614 |
{XMP Media Management Schema}% |
| 6615 |
{xmpMM}% |
| 6616 |
{http://ns.adobe.com/xap/1.0/mm/}% |
| 6617 |
\hyxmp@declare@property |
| 6618 |
[URI] |
| 6619 |
{DocumentID}% |
| 6620 |
{internal}% |
| 6621 |
{UUID based identifier for all versions and renditions of a document}% |
| 6622 |
\hyxmp@declare@property |
| 6623 |
[URI] |
| 6624 |
{InstanceID}% |
| 6625 |
{internal}% |
| 6626 |
{UUID based identifier for specific incarnation of a document}% |
| 6627 |
\hyxmp@declare@property |
| 6628 |
{VersionID}% |
| 6629 |
{internal}% |
| 6630 |
{Document version identifier}% |
| 6631 |
\hyxmp@declare@property |
| 6632 |
[RenditionClass]% |
| 6633 |
{RenditionClass}% |
| 6634 |
{internal}% |
| 6635 |
{The manner in which a document is rendered}% |
| 6636 |
\hyxmp@end@ext@decl |
| 6637 |
}% |
| 6638 |
% \end{macrocode} |
| 6639 |
% \end{macro} |
| 6640 |
% |
| 6641 |
% \begin{macro}{\hyxmp@pdfa@id@extensions} |
| 6642 |
% Declare the \acro{PDF/A} Identification schema~\cite{PDFA2008:xmp-props}. |
| 6643 |
% \changes{v4.0}{2019/03/15}{Added this macro} |
| 6644 |
% \begin{macrocode} |
| 6645 |
\newcommand*{\hyxmp@pdfa@id@extensions}{% |
| 6646 |
\hyxmp@begin@ext@decl |
| 6647 |
{PDF/A Identification Schema}% |
| 6648 |
{pdfaid}% |
| 6649 |
{http://www.aiim.org/pdfa/ns/id/}% |
| 6650 |
\hyxmp@declare@property |
| 6651 |
[Integer]% |
| 6652 |
{part}% |
| 6653 |
{internal}% |
| 6654 |
{Part of PDF/A standard}% |
| 6655 |
\hyxmp@declare@property |
| 6656 |
{conformance}% |
| 6657 |
{internal}% |
| 6658 |
{Conformance level of PDF/A standard}% |
| 6659 |
\hyxmp@end@ext@decl |
| 6660 |
}% |
| 6661 |
% \end{macrocode} |
| 6662 |
% \end{macro} |
| 6663 |
% |
| 6664 |
% \begin{macro}{\hyxmp@pdfua@id@extensions} |
| 6665 |
% Declare the \acro{PDF/UA} Universal Accessibility schema. |
| 6666 |
% \changes{v5.0}{2020/02/15}{Added this macro} |
| 6667 |
% \begin{macrocode} |
| 6668 |
\newcommand*{\hyxmp@pdfua@id@extensions}{% |
| 6669 |
\hyxmp@begin@ext@decl |
| 6670 |
{PDF/UA Universal Accessibility Schema}% |
| 6671 |
{pdfuaid}% |
| 6672 |
{http://www.aiim.org/pdfua/ns/id/}% |
| 6673 |
\hyxmp@declare@property |
| 6674 |
[Integer]% |
| 6675 |
{part}% |
| 6676 |
{internal}% |
| 6677 |
{Part of ISO 14289 standard}% |
| 6678 |
\hyxmp@end@ext@decl |
| 6679 |
}% |
| 6680 |
% \end{macrocode} |
| 6681 |
% \end{macro} |
| 6682 |
% |
| 6683 |
% \begin{macro}{\hyxmp@pdfx@id@extensions} |
| 6684 |
% Declare the schema used pre-\PDFstd{X}{4}{}{}. Because Adobe Acrobat DC |
| 6685 |
% (at least) defines this even for \PDFstd{X}{4}{}{} and later, we follow |
| 6686 |
% suit. |
| 6687 |
% \changes{v5.0}{2020/02/26}{Added this macro} |
| 6688 |
% \begin{macrocode} |
| 6689 |
\newcommand*{\hyxmp@pdfx@id@extensions}{% |
| 6690 |
\ifx\hyxmp@pdfx@major\empty |
| 6691 |
\else |
| 6692 |
\hyxmp@begin@ext@decl |
| 6693 |
{Adobe Document Info PDF/X eXtension Schema}% |
| 6694 |
{pdfx}% |
| 6695 |
{http://ns.adobe.com/pdfx/1.3/}% |
| 6696 |
\hyxmp@declare@property |
| 6697 |
{GTS_PDFXVersion}% |
| 6698 |
{internal}% |
| 6699 |
{ID of PDF/X standard}% |
| 6700 |
\hyxmp@declare@property |
| 6701 |
{GTS_PDFXConformance}% |
| 6702 |
{internal}% |
| 6703 |
{Conformance level of PDF/X standard}% |
| 6704 |
\hyxmp@end@ext@decl |
| 6705 |
\fi |
| 6706 |
% \end{macrocode} |
| 6707 |
% Declare the schema used in \PDFstd{X}{4}{}{} and later versions. |
| 6708 |
% \begin{macrocode} |
| 6709 |
\@hyxmp@count=0\hyxmp@pdfx@major\relax |
| 6710 |
\ifnum\@hyxmp@count>3 |
| 6711 |
\hyxmp@begin@ext@decl |
| 6712 |
{PDF/X ID Schema}% |
| 6713 |
{pdfxid}% |
| 6714 |
{http://www.npes.org/pdfx/ns/id/}% |
| 6715 |
\hyxmp@declare@property |
| 6716 |
{GTS_PDFXVersion}% |
| 6717 |
{internal}% |
| 6718 |
{ID of PDF/X standard}% |
| 6719 |
\hyxmp@end@ext@decl |
| 6720 |
\fi |
| 6721 |
}% |
| 6722 |
% \end{macrocode} |
| 6723 |
% \end{macro} |
| 6724 |
% |
| 6725 |
% \begin{macro}{\hyxmp@iptc@extensions} |
| 6726 |
% \changes{v2.2}{2012/12/13}{Added this macro to support |
| 6727 |
% \acro{PDF/A} generation} |
| 6728 |
% \changes{v2.3}{2013/01/08}{Gave the |
| 6729 |
% \xmpprop{Iptc4xmpCore:CreatorContactInfo} fields a unique |
| 6730 |
% \xmpprop{pdfaType:prefix} to better support conversion of the |
| 6731 |
% document to \acro{PDF/A}} |
| 6732 |
% \changes{v4.0}{2019/03/09}{Moved the header code from here into |
| 6733 |
% \protect\cs{hyxmp@begin@extension@decls} and the trailer code |
| 6734 |
% from here into \protect\cs{hyxmp@end@extension@decls}} |
| 6735 |
% \changes{v4.0}{2019/03/16}{Rewrote to more closely honor the |
| 6736 |
% \acro{XMP} specification} |
| 6737 |
% Because \acro{IPTC} metadata are not recognized by the \acro{PDF/A} |
| 6738 |
% standard, \acro{PDF/A} conversion would normally fail for documents |
| 6739 |
% that utilize \acro{IPTC} metadata. Declaring the \acro{IPTC} |
| 6740 |
% metadata we support enables the document to be converted to |
| 6741 |
% \acro{PDF/A} format. |
| 6742 |
% \begin{macrocode} |
| 6743 |
\newcommand*{\hyxmp@iptc@extensions}{% |
| 6744 |
\hyxmp@begin@ext@decl |
| 6745 |
{IPTC Core Schema}% |
| 6746 |
{Iptc4xmpCore}% |
| 6747 |
{http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/}% |
| 6748 |
\hyxmp@declare@property |
| 6749 |
[ContactInfo] |
| 6750 |
{CreatorContactInfo} |
| 6751 |
{external} |
| 6752 |
{Document creator's contact information} |
| 6753 |
% \end{macrocode} |
| 6754 |
% We can't call |\hyxmp@end@ext@decl| because we need first need to |
| 6755 |
% define the \xmpprop{Iptc4xmpCore:ContactInfo} structure. |
| 6756 |
% \begin{macrocode} |
| 6757 |
\hyxmp@add@to@xml{% |
| 6758 |
______________</rdf:Seq>^^J% |
| 6759 |
____________</pdfaSchema:property>^^J% |
| 6760 |
____________<pdfaSchema:valueType>^^J% |
| 6761 |
______________<rdf:Seq>^^J% |
| 6762 |
________________<rdf:li rdf:parseType="Resource">^^J% |
| 6763 |
__________________<pdfaType:type>ContactInfo</pdfaType:type>^^J% |
| 6764 |
__________________<pdfaType:namespaceURI>http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/</pdfaType:namespaceURI>^^J% |
| 6765 |
__________________<pdfaType:prefix>Iptc4xmpCore</pdfaType:prefix>^^J% |
| 6766 |
__________________<pdfaType:description>% |
| 6767 |
Basic set of information to get in contact with a person% |
| 6768 |
</pdfaType:description>^^J% |
| 6769 |
__________________<pdfaType:field>^^J% |
| 6770 |
____________________<rdf:Seq>^^J% |
| 6771 |
}% |
| 6772 |
\hyxmp@declare@field |
| 6773 |
{CiAdrCity}% |
| 6774 |
{Contact information city}% |
| 6775 |
\hyxmp@declare@field |
| 6776 |
{CiAdrCtry}% |
| 6777 |
{Contact information country}% |
| 6778 |
\hyxmp@declare@field |
| 6779 |
{CiAdrExtadr}% |
| 6780 |
{Contact information address}% |
| 6781 |
\hyxmp@declare@field |
| 6782 |
{CiAdrPcode}% |
| 6783 |
{Contact information local postal code}% |
| 6784 |
\hyxmp@declare@field |
| 6785 |
{CiAdrRegion}% |
| 6786 |
{Contact information regional information such as state or province}% |
| 6787 |
\hyxmp@declare@field |
| 6788 |
{CiEmailWork}% |
| 6789 |
{Contact information email address(es)}% |
| 6790 |
\hyxmp@declare@field |
| 6791 |
{CiTelWork}% |
| 6792 |
{Contact information telephone number(s)}% |
| 6793 |
\hyxmp@declare@field |
| 6794 |
{CiUrlWork}% |
| 6795 |
{Contact information Web URL(s)}% |
| 6796 |
\hyxmp@add@to@xml{% |
| 6797 |
____________________</rdf:Seq>^^J% |
| 6798 |
__________________</pdfaType:field>^^J% |
| 6799 |
________________</rdf:li>^^J% |
| 6800 |
______________</rdf:Seq>^^J% |
| 6801 |
____________</pdfaSchema:valueType>^^J% |
| 6802 |
__________</rdf:li>^^J% |
| 6803 |
}% |
| 6804 |
} |
| 6805 |
% \end{macrocode} |
| 6806 |
% \end{macro} |
| 6807 |
% |
| 6808 |
% \begin{macro}{\hyxmp@prism@extensions} |
| 6809 |
% \changes{v4.0}{2019/03/15}{Added this macro} |
| 6810 |
% Because \acro{PRISM} metadata are not recognized by the \acro{PDF/A} |
| 6811 |
% standard, \acro{PDF/A} conversion would normally fail for documents |
| 6812 |
% that utilize \acro{PRISM} metadata. Declaring the \acro{PRISM} |
| 6813 |
% metadata we support enables the document to be converted to |
| 6814 |
% \acro{PDF/A} format. |
| 6815 |
% \begin{macrocode} |
| 6816 |
\newcommand*{\hyxmp@prism@extensions}{% |
| 6817 |
\hyxmp@begin@ext@decl |
| 6818 |
{PRISM Basic Metadata}% |
| 6819 |
{prism}% |
| 6820 |
{http://prismstandard.org/namespaces/basic/3.0/}% |
| 6821 |
\hyxmp@declare@property |
| 6822 |
{complianceProfile}% |
| 6823 |
{internal}% |
| 6824 |
{PRISM specification compliance profile to which this document adheres}% |
| 6825 |
\hyxmp@declare@property |
| 6826 |
{publicationName}% |
| 6827 |
{external}% |
| 6828 |
{Publication name}% |
| 6829 |
\hyxmp@declare@property |
| 6830 |
{aggregationType}% |
| 6831 |
{external}% |
| 6832 |
{Publication type}% |
| 6833 |
\hyxmp@declare@property |
| 6834 |
{bookEdition}% |
| 6835 |
{external}% |
| 6836 |
{Edition of the book in which the document was published}% |
| 6837 |
\hyxmp@declare@property |
| 6838 |
{volume}% |
| 6839 |
{external}% |
| 6840 |
{Publication volume number}% |
| 6841 |
\hyxmp@declare@property |
| 6842 |
{number}% |
| 6843 |
{external}% |
| 6844 |
{Publication issue number within a volume}% |
| 6845 |
\hyxmp@declare@property |
| 6846 |
{pageRange}% |
| 6847 |
{external}% |
| 6848 |
{Page range for the document within the print version of its publication}% |
| 6849 |
\hyxmp@declare@property |
| 6850 |
{issn}% |
| 6851 |
{external}% |
| 6852 |
{ISSN for the printed publication in which the document was published}% |
| 6853 |
\hyxmp@declare@property |
| 6854 |
{eIssn}% |
| 6855 |
{external}% |
| 6856 |
{ISSN for the electronic publication in which the document was published}% |
| 6857 |
\hyxmp@declare@property |
| 6858 |
{isbn}% |
| 6859 |
{external}% |
| 6860 |
{ISBN for the publication in which the document was published}% |
| 6861 |
\hyxmp@declare@property |
| 6862 |
{doi}% |
| 6863 |
{external}% |
| 6864 |
{Digital Object Identifier for the document}% |
| 6865 |
\hyxmp@declare@property |
| 6866 |
[URL] |
| 6867 |
{url}% |
| 6868 |
{external}% |
| 6869 |
{URL at which the document can be found}% |
| 6870 |
\hyxmp@declare@property |
| 6871 |
[Integer] |
| 6872 |
{byteCount}% |
| 6873 |
{internal}% |
| 6874 |
{Approximate file size in octets}% |
| 6875 |
\hyxmp@declare@property |
| 6876 |
[Integer] |
| 6877 |
{pageCount}% |
| 6878 |
{internal}% |
| 6879 |
{Number of pages in the print version of the document}% |
| 6880 |
\hyxmp@declare@property |
| 6881 |
{subtitle}% |
| 6882 |
{external}% |
| 6883 |
{Document's subtitle}% |
| 6884 |
\hyxmp@end@ext@decl |
| 6885 |
}% |
| 6886 |
% \end{macrocode} |
| 6887 |
% \end{macro} |
| 6888 |
% |
| 6889 |
% \begin{macro}{\hyxmp@jav@extensions} |
| 6890 |
% \changes{v5.5}{2020/07/23}{Added this macro} |
| 6891 |
% Because \acro{JAV} metadata are not recognized by the \acro{PDF/A} |
| 6892 |
% standard, \acro{PDF/A} conversion would normally fail for documents |
| 6893 |
% that utilize \acro{JAV} metadata. Declaring the \acro{JAV} metadata |
| 6894 |
% we support enables the document to be converted to \acro{PDF/A} |
| 6895 |
% format. |
| 6896 |
% \begin{macrocode} |
| 6897 |
\newcommand*{\hyxmp@jav@extensions}{% |
| 6898 |
\hyxmp@begin@ext@decl |
| 6899 |
{NISO/ALPSP Journal Article Versions}% |
| 6900 |
{jav}% |
| 6901 |
{http://www.niso.org/schemas/jav/1.0/}% |
| 6902 |
\hyxmp@declare@property |
| 6903 |
[Closed Choice of Text]% |
| 6904 |
{journal_article_version}% |
| 6905 |
{external}% |
| 6906 |
{Article status, one of "AO", "SMUR", "AM", "P", "VoR", "CVoR", or "EVoR"}% |
| 6907 |
\hyxmp@end@ext@decl |
| 6908 |
}% |
| 6909 |
% \end{macrocode} |
| 6910 |
% \end{macro} |
| 6911 |
% |
| 6912 |
% \begin{macro}{\hyxmp@declare@extensions} |
| 6913 |
% Declare all \acro{XMP} extension schemata. We'll always have at least |
| 6914 |
% one, the \acro{XMP} Media Management extensions, because we |
| 6915 |
% automatically generate \xmpprop{xmpMM:DocumentID} and |
| 6916 |
% \xmpprop{xmpMM:InstanceID} |
| 6917 |
% values. |
| 6918 |
% \begin{macrocode} |
| 6919 |
\newcommand*{\hyxmp@declare@extensions}{% |
| 6920 |
\hyxmp@begin@extension@decls |
| 6921 |
% \end{macrocode} |
| 6922 |
% Declare the Adobe \acro{PDF} schema (always present). |
| 6923 |
% \begin{macrocode} |
| 6924 |
\hyxmp@pdf@extensions |
| 6925 |
% \end{macrocode} |
| 6926 |
% Declare the \acro{XMP} Media Management extensions (always present). |
| 6927 |
% \begin{macrocode} |
| 6928 |
\hyxmp@mm@extensions |
| 6929 |
% \end{macrocode} |
| 6930 |
% Declare the \acro{PDF/A} Identification extensions, but only when |
| 6931 |
% generating a \acro{PDF/A} document. |
| 6932 |
% \begin{macrocode} |
| 6933 |
\ifHy@pdfa |
| 6934 |
\hyxmp@pdfa@id@extensions |
| 6935 |
\fi |
| 6936 |
% \end{macrocode} |
| 6937 |
% Conditionally declare the \acro{PDF/UA} Universal Accessibility |
| 6938 |
% extensions. |
| 6939 |
% \begin{macrocode} |
| 6940 |
\ifx\@pdfuapart\@empty |
| 6941 |
\else |
| 6942 |
\hyxmp@pdfua@id@extensions |
| 6943 |
\fi |
| 6944 |
% \end{macrocode} |
| 6945 |
% \begin{macro}{\next} |
| 6946 |
% Conditionally declare the \acro{PDF/X} extensions. |
| 6947 |
% \begin{macrocode} |
| 6948 |
\ifx\@pdfxversion\@empty |
| 6949 |
\else |
| 6950 |
\hyxmp@pdfx@id@extensions |
| 6951 |
\fi |
| 6952 |
% \end{macrocode} |
| 6953 |
% \end{macro} |
| 6954 |
% Conditionally declare \acro{IPTC} photo metadata extensions. |
| 6955 |
% \begin{macrocode} |
| 6956 |
\ifx\hyxmp@iptc@data\@empty |
| 6957 |
\else |
| 6958 |
\hyxmp@iptc@extensions |
| 6959 |
\fi |
| 6960 |
% \end{macrocode} |
| 6961 |
% Conditionally declare \acro{PRISM} basic metadata extensions. |
| 6962 |
% \begin{macrocode} |
| 6963 |
\ifx\hyxmp@prism@data\@empty |
| 6964 |
\else |
| 6965 |
\hyxmp@prism@extensions |
| 6966 |
\fi |
| 6967 |
% \end{macrocode} |
| 6968 |
% Conditionally declare \acro{JAV} metadata. |
| 6969 |
% \begin{macrocode} |
| 6970 |
\ifx\hyxmp@jav@data\@empty |
| 6971 |
\else |
| 6972 |
\hyxmp@jav@extensions |
| 6973 |
\fi |
| 6974 |
% \end{macrocode} |
| 6975 |
% \begin{macrocode} |
| 6976 |
\hyxmp@end@extension@decls |
| 6977 |
} |
| 6978 |
% \end{macrocode} |
| 6979 |
% \end{macro} |
| 6980 |
% |
| 6981 |
% \subsubsection{Combining schemata into an XMP packet} |
| 6982 |
% \label{sec:combining-schemata} |
| 6983 |
% |
| 6984 |
% \begin{macro}{\hyxmp@bom} |
| 6985 |
% Define a macro for the \term{Unicode} byte-order marker (\acro{BOM}). |
| 6986 |
% \changes{v2.0}{2012/08/02}{Added by Heiko Oberdiek} |
| 6987 |
% \begin{macrocode} |
| 6988 |
\begingroup |
| 6989 |
\ifhyxmp@unicodetex |
| 6990 |
\lccode`\!="FEFF % |
| 6991 |
\lowercase{% |
| 6992 |
\gdef\hyxmp@bom{!} |
| 6993 |
}% |
| 6994 |
\else |
| 6995 |
\catcode`\^^ef=12 |
| 6996 |
\catcode`\^^bb=12 |
| 6997 |
\catcode`\^^bf=12 |
| 6998 |
\gdef\hyxmp@bom{^^ef^^bb^^bf}% |
| 6999 |
\fi |
| 7000 |
\endgroup |
| 7001 |
% \end{macrocode} |
| 7002 |
% \end{macro} |
| 7003 |
% |
| 7004 |
% \begin{macro}{\hyxmp@construct@packet} |
| 7005 |
% \changes{v1.1}{2006/05/21}{Explicitly set the category codes of |
| 7006 |
% characters \string\meta{EF}, \string\meta{BB}, and |
| 7007 |
% \string\meta{BF} to ``letter''. Thanks to Daniel Sch\"omer for |
| 7008 |
% the bug report} |
| 7009 |
% \changes{v2.0}{2012/08/02}{Modified by Heiko Oberdiek to use an |
| 7010 |
% appropriate \acro{BOM} representation via |
| 7011 |
% \texttt{\string\string\string\hyxmp@bom}} |
| 7012 |
% \begin{macro}{\hyxmp@xml} |
| 7013 |
% Successively add \acro{XML} data to |\hyxmp@xml| until we have |
| 7014 |
% something we can insert into the document's \acro{PDF} catalog. |
| 7015 |
% \begin{macrocode} |
| 7016 |
\def\hyxmp@construct@packet{% |
| 7017 |
\gdef\hyxmp@xml{}% |
| 7018 |
\hyxmp@add@to@xml{<?xpacket begin="\hyxmp@bom" % |
| 7019 |
id="W5M0MpCehiHzreSzNTczkc9d"?>^^J% |
| 7020 |
<x:xmpmeta xmlns:x="adobe:ns:meta/">^^J% |
| 7021 |
__<rdf:RDF % |
| 7022 |
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns\hyxmp@hash">^^J% |
| 7023 |
____<rdf:Description rdf:about=""^^J% |
| 7024 |
% \end{macrocode} |
| 7025 |
% Specify every namespace we can potentially use, even the ones we end |
| 7026 |
% up not actually using. |
| 7027 |
% \begin{macrocode} |
| 7028 |
_____________________xmlns:pdf="http://ns.adobe.com/pdf/1.3/"^^J% |
| 7029 |
_____________________xmlns:xmpRights="http://ns.adobe.com/xap/1.0/rights/"^^J% |
| 7030 |
_____________________xmlns:dc="http://purl.org/dc/elements/1.1/"^^J% |
| 7031 |
_____________________xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"^^J% |
| 7032 |
_____________________xmlns:xmp="http://ns.adobe.com/xap/1.0/"^^J% |
| 7033 |
_____________________xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"^^J% |
| 7034 |
_____________________xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent\hyxmp@hash"^^J% |
| 7035 |
_____________________xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/"^^J% |
| 7036 |
_____________________xmlns:pdfuaid="http://www.aiim.org/pdfua/ns/id/"^^J% |
| 7037 |
_____________________xmlns:pdfx="http://ns.adobe.com/pdfx/1.3/"^^J% |
| 7038 |
}% |
| 7039 |
% \end{macrocode} |
| 7040 |
% We make one exception to the rule of including every namespace we can |
| 7041 |
% potentially use: We don't define the \texttt{pdfxid} namespace unless |
| 7042 |
% the \acro{PDF/X} version (specified by the \optname{pdfxstandard}) |
| 7043 |
% option is~4 or greater. Otherwise, Adobe Acrobat---at least Adobe |
| 7044 |
% Acrobat DC 2020---alters the way it displays color. (I believe it |
| 7045 |
% renders color in a printer gamut instead of a screen gamut.) |
| 7046 |
% \changes{v5.10}{2020/01/05}{Include the \string\texttt{pdfxid} namespace |
| 7047 |
% only if the \protect\acro{PDF/X} version is~4 or greater. Thanks to |
| 7048 |
% John Lienhard for the bug report} |
| 7049 |
% \begin{macrocode} |
| 7050 |
\ifnum0\hyxmp@pdfx@major>3 |
| 7051 |
\hyxmp@add@to@xml{% |
| 7052 |
_____________________xmlns:pdfxid="http://www.npes.org/pdfx/ns/id/"^^J% |
| 7053 |
}% |
| 7054 |
\fi |
| 7055 |
% \end{macrocode} |
| 7056 |
% Revert to ``include every namespace'' mode. |
| 7057 |
% \begin{macrocode} |
| 7058 |
\hyxmp@add@to@xml{% |
| 7059 |
_____________________xmlns:prism="http://prismstandard.org/namespaces/basic/3.0/"^^J% |
| 7060 |
_____________________xmlns:jav="http://www.niso.org/schemas/jav/1.0/"^^J% |
| 7061 |
_____________________xmlns:xmpTPg="http://ns.adobe.com/xap/1.0/t/pg/"^^J% |
| 7062 |
_____________________xmlns:stFnt="http://ns.adobe.com/xap/1.0/sType/Font\hyxmp@hash"^^J% |
| 7063 |
_____________________xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/"^^J% |
| 7064 |
_____________________xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/"^^J% |
| 7065 |
_____________________xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema\hyxmp@hash"^^J% |
| 7066 |
_____________________xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property\hyxmp@hash"^^J% |
| 7067 |
_____________________xmlns:pdfaType="http://www.aiim.org/pdfa/ns/type\hyxmp@hash"^^J% |
| 7068 |
_____________________xmlns:pdfaField="http://www.aiim.org/pdfa/ns/field\hyxmp@hash">^^J% |
| 7069 |
}% |
| 7070 |
% \end{macrocode} |
| 7071 |
% Declare non-standard schemata. |
| 7072 |
% \begin{macrocode} |
| 7073 |
\hyxmp@check@iptc@data |
| 7074 |
\hyxmp@check@prism@data |
| 7075 |
\hyxmp@check@jav@data |
| 7076 |
\hyxmp@declare@extensions |
| 7077 |
% \end{macrocode} |
| 7078 |
% Insert all the metadata we know how to insert. |
| 7079 |
% \begin{macrocode} |
| 7080 |
\hyxmp@pdf@schema |
| 7081 |
\hyxmp@xmpRights@schema |
| 7082 |
\hyxmp@dc@schema |
| 7083 |
\hyxmp@photoshop@schema |
| 7084 |
\hyxmp@xmp@basic@schema |
| 7085 |
\hyxmp@pdfa@id@schema |
| 7086 |
\hyxmp@pdfua@id@schema |
| 7087 |
\hyxmp@pdfx@id@schema |
| 7088 |
\hyxmp@mm@schema |
| 7089 |
\hyxmp@iptc@schema |
| 7090 |
\hyxmp@prism@schema |
| 7091 |
\hyxmp@jav@schema |
| 7092 |
\hyxmp@xmptpg@schema |
| 7093 |
\hyxmp@add@to@xml{% |
| 7094 |
____</rdf:Description>^^J% |
| 7095 |
__</rdf:RDF>^^J% |
| 7096 |
</x:xmpmeta>^^J% |
| 7097 |
\hyxmp@padding |
| 7098 |
<?xpacket end="w"?>^^J% |
| 7099 |
}% |
| 7100 |
} |
| 7101 |
% \end{macrocode} |
| 7102 |
% \end{macro} |
| 7103 |
% \end{macro} |
| 7104 |
% |
| 7105 |
% |
| 7106 |
% \subsection{Embedding the XMP packet} |
| 7107 |
% |
| 7108 |
% The \acro{PDF} specification says that ``a metadata stream may be |
| 7109 |
% attached to a document through the \pdfterm{Metadata} entry in the |
| 7110 |
% document catalogue''~\cite{Adobe2008:PDF} so that's what we do here. |
| 7111 |
% |
| 7112 |
% \begin{macro}{\hyxmp@embed@packet} |
| 7113 |
% \begin{macro}{\hyxmp@driver} |
| 7114 |
% Determine which \pkgname{hyperref} driver is in use and invoke the |
| 7115 |
% appropriate embedding function. |
| 7116 |
% \begin{macrocode} |
| 7117 |
\newcommand*{\hyxmp@embed@packet}{% |
| 7118 |
\hyxmp@construct@packet |
| 7119 |
\def\hyxmp@driver{hpdftex}% |
| 7120 |
\ifx\hyxmp@driver\Hy@driver |
| 7121 |
\hyxmp@embed@packet@pdftex |
| 7122 |
\else |
| 7123 |
\def\hyxmp@driver{hluatex}% |
| 7124 |
\ifx\hyxmp@driver\Hy@driver |
| 7125 |
\hyxmp@embed@packet@luatex |
| 7126 |
\else |
| 7127 |
\def\hyxmp@driver{hdvipdfm}% |
| 7128 |
\ifx\hyxmp@driver\Hy@driver |
| 7129 |
\hyxmp@embed@packet@dvipdfm |
| 7130 |
\else |
| 7131 |
\def\hyxmp@driver{hxetex}% |
| 7132 |
\ifx\hyxmp@driver\Hy@driver |
| 7133 |
\hyxmp@embed@packet@xetex |
| 7134 |
\else |
| 7135 |
\@ifundefined{pdfmark}{% |
| 7136 |
\PackageWarningNoLine{hyperxmp}{% |
| 7137 |
Unrecognized hyperref driver `\Hy@driver'.\MessageBreak |
| 7138 |
\[email protected]'s XMP metadata will *not* be\MessageBreak |
| 7139 |
embedded in the resulting file}% |
| 7140 |
}{% |
| 7141 |
\hyxmp@embed@packet@pdfmark |
| 7142 |
}% |
| 7143 |
\fi |
| 7144 |
\fi |
| 7145 |
\fi |
| 7146 |
\fi |
| 7147 |
} |
| 7148 |
% \end{macrocode} |
| 7149 |
% \end{macro} |
| 7150 |
% \end{macro} |
| 7151 |
% |
| 7152 |
% \subsubsection{Embedding using \pdfTeX} |
| 7153 |
% |
| 7154 |
% Up to version~0.85, \LuaTeX\ supported the \pdfTeX\ primitives, and |
| 7155 |
% \pkgname{hyperref} didn't distinguish the two backends. However, from |
| 7156 |
% \pkgname{hyperxmp}'s perspective there is one key difference: the |
| 7157 |
% effect of |\pdfcompresslevel| is local to a group in \pdfTeX\ but is |
| 7158 |
% global in \LuaTeX\@. |
| 7159 |
% |
| 7160 |
% The \acro{PDF} object representing the \acro{XMP} packet is supposed |
| 7161 |
% to include an uncompressed stream so it can be read by |
| 7162 |
% non-\acro{PDF}-aware tools. However, we don't want to unnecessarily |
| 7163 |
% uncompress \emph{every} \acro{PDF} stream. The solution, provided by |
| 7164 |
% Hans Hagen on the |luatex| mailing list (thread: |
| 7165 |
% \href{http://tug.org/pipermail/luatex/2016-July/006077.html}{``Leaving |
| 7166 |
% a single \acro{PDF} object uncompressed''}, 6\,\textsc{Jul}\,2016), |
| 7167 |
% is to provide the |uncompressed| flag to |\pdfobj|. Our definition of |
| 7168 |
% |\hyxmp@embed@packet@pdftex| uses the \pkgname{ifluatex} package to |
| 7169 |
% distinguish the \pdfTeX\ case from the pre-0.85 \LuaTeX\ case. |
| 7170 |
% |
| 7171 |
% \begin{macrocode} |
| 7172 |
\RequirePackage{ifluatex} |
| 7173 |
% \end{macrocode} |
| 7174 |
% |
| 7175 |
% \begin{macro}{\hyxmp@embed@packet@pdftex} |
| 7176 |
% Embed the \acro{XMP} packet using \pdfTeX\ primitives, which are |
| 7177 |
% supported by both \pdfTeX\ and pre-0.85 \LuaTeX. The only difference |
| 7178 |
% is that in the former case we locally specify |\pdfcompresslevel=0| to |
| 7179 |
% leave the \acro{PDF} object uncompressed while in the latter case we |
| 7180 |
% pass the |uncompressed| flag to |\pdfobj| to achieve the same effect. |
| 7181 |
% \changes{v3.1}{2016/07/06}{Leave the \protect\acro{XMP} packet---and |
| 7182 |
% only the \protect\acro{XMP} packet---uncompressed in both |
| 7183 |
% \protect\pdfTeX\ and pre-0.85 \protect\LuaTeX} |
| 7184 |
% \begin{macrocode} |
| 7185 |
\newcommand*{\hyxmp@embed@packet@pdftex}{% |
| 7186 |
\bgroup |
| 7187 |
\ifluatex |
| 7188 |
\else |
| 7189 |
\pdfcompresslevel=0 |
| 7190 |
\fi |
| 7191 |
\immediate\pdfobj \ifluatex uncompressed\fi stream attr {% |
| 7192 |
/Type /Metadata |
| 7193 |
/Subtype /XML |
| 7194 |
}{\hyxmp@xml}% |
| 7195 |
\pdfcatalog {/Metadata \the\pdflastobj\space 0 R}% |
| 7196 |
\egroup |
| 7197 |
} |
| 7198 |
% \end{macrocode} |
| 7199 |
% \end{macro} |
| 7200 |
% |
| 7201 |
% \subsubsection{Embedding using \LuaTeX~0.85+} |
| 7202 |
% |
| 7203 |
% \begin{macro}{\hyxmp@embed@packet@luatex} |
| 7204 |
% Embed the \acro{XMP} packet using \LuaTeX~0.85+ primitives. |
| 7205 |
% \changes{v3.0}{2016/07/02}{Added this macro} |
| 7206 |
% \changes{v3.1}{2016/07/06}{Updated to use |
| 7207 |
% \protect\texttt{\string\string\string\pdfextension\ obj uncompressed} |
| 7208 |
% as suggested by Hans Hagen} |
| 7209 |
% \begin{macrocode} |
| 7210 |
\newcommand*{\hyxmp@embed@packet@luatex}{% |
| 7211 |
\immediate\pdfextension obj uncompressed stream attr {% |
| 7212 |
/Type /Metadata |
| 7213 |
/Subtype /XML |
| 7214 |
}{\hyxmp@xml}% |
| 7215 |
\pdfextension catalog {/Metadata \the\numexpr\pdffeedback lastobj\relax\space 0 R}% |
| 7216 |
} |
| 7217 |
% \end{macrocode} |
| 7218 |
% \end{macro} |
| 7219 |
% |
| 7220 |
% \subsubsection{Embedding using any \texttt{pdfmark}-based backend} |
| 7221 |
% |
| 7222 |
% \begin{macro}{\hyxmp@embed@packet@pdfmark} |
| 7223 |
% Embed the \acro{XMP} packet using \pkgname{hyperref}'s |\pdfmark| |
| 7224 |
% command. I believe |\pdfmark| is used by the \optname{dvipdf}, |
| 7225 |
% \optname{dvipsone}, \optname{dvips}, \optname{dviwindo}, |
| 7226 |
% \optname{nativepdf}, \optname{pdfmark}, \optname{ps2pdf}, |
| 7227 |
% \optname{textures}, and \optname{vtexpdfmark} options to |
| 7228 |
% \pkgname{hyperref}, but I've tested only a few of those. |
| 7229 |
% \begin{macrocode} |
| 7230 |
\newcommand*{\hyxmp@embed@packet@pdfmark}{% |
| 7231 |
\pdfmark{% |
| 7232 |
pdfmark=/NamespacePush |
| 7233 |
}% |
| 7234 |
\pdfmark{% |
| 7235 |
pdfmark=/OBJ, |
| 7236 |
Raw={/_objdef \string{hyxmp@Metadata\string} /type /stream}% |
| 7237 |
}% |
| 7238 |
\pdfmark{% |
| 7239 |
pdfmark=/PUT, |
| 7240 |
Raw={\string{hyxmp@Metadata\string} |
| 7241 |
2 dict begin |
| 7242 |
/Type /Metadata def |
| 7243 |
/Subtype /XML def |
| 7244 |
currentdict |
| 7245 |
end |
| 7246 |
}% |
| 7247 |
}% |
| 7248 |
\pdfmark{% |
| 7249 |
pdfmark=/PUT, |
| 7250 |
Raw={\string{hyxmp@Metadata\string} (\hyxmp@xml)}% |
| 7251 |
}% |
| 7252 |
\pdfmark{% |
| 7253 |
pdfmark=/Metadata, |
| 7254 |
Raw={\string{Catalog\string} \string{hyxmp@Metadata\string}}% |
| 7255 |
}% |
| 7256 |
\pdfmark{% |
| 7257 |
pdfmark=/NamespacePop |
| 7258 |
}% |
| 7259 |
} |
| 7260 |
% \end{macrocode} |
| 7261 |
% \end{macro} |
| 7262 |
% |
| 7263 |
% \subsubsection{Embedding using \texttt{dvipdfm}} |
| 7264 |
% |
| 7265 |
% \begin{macro}{\hyxmp@embed@packet@dvipdfm} |
| 7266 |
% Embed the \acro{XMP} packet using \cmdname{dvipdfm}-specific |
| 7267 |
% |\special| commands. Note that \cmdname{dvipdfm} rather irritatingly |
| 7268 |
% requires us to count the number of characters in the |\hyxmp@xml| |
| 7269 |
% stream ourselves. |
| 7270 |
% \begin{macrocode} |
| 7271 |
\newcommand*{\hyxmp@embed@packet@dvipdfm}{% |
| 7272 |
\hyxmp@string@len{\hyxmp@xml}% |
| 7273 |
\special{pdf: object @hyxmp@Metadata |
| 7274 |
<< |
| 7275 |
/Type /Metadata |
| 7276 |
/Subtype /XML |
| 7277 |
/Length \the\@hyxmp@count |
| 7278 |
>> |
| 7279 |
stream^^J\hyxmp@xml endstream% |
| 7280 |
}% |
| 7281 |
\special{pdf: docview |
| 7282 |
<< |
| 7283 |
/Metadata @hyxmp@Metadata |
| 7284 |
>> |
| 7285 |
}% |
| 7286 |
} |
| 7287 |
% \end{macrocode} |
| 7288 |
% \end{macro} |
| 7289 |
% |
| 7290 |
% \begin{macro}{\hyxmp@string@len} |
| 7291 |
% Set |\@hyxmp@count| to the number of characters in a given string~(|#1|). |
| 7292 |
% The approach is first to tally the number of space characters then to |
| 7293 |
% tally the number of non-space characters. While this is rather |
| 7294 |
% sloppy I haven't found a better way to achieve the same effect, |
| 7295 |
% especially given that all of the characters in |#1| have already been |
| 7296 |
% assigned their category codes. |
| 7297 |
% \begin{macrocode} |
| 7298 |
\newcommand*{\hyxmp@string@len}[1]{% |
| 7299 |
\@hyxmp@count=0 |
| 7300 |
\expandafter\hyxmp@count@spaces#1 {} % |
| 7301 |
\expandafter\hyxmp@count@non@spaces#1{}% |
| 7302 |
} |
| 7303 |
% \end{macrocode} |
| 7304 |
% \end{macro} |
| 7305 |
% |
| 7306 |
% \begin{macro}{\hyxmp@count@spaces} |
| 7307 |
% Count the number of spaces in a given string. We rely on the built-in |
| 7308 |
% pattern matching of \tex's |\def| primitive to pry one word at a time |
| 7309 |
% off the head of the input string. |
| 7310 |
% \begin{macrocode} |
| 7311 |
\def\hyxmp@count@spaces#1 {% |
| 7312 |
\def\hyxmp@one@token{#1}% |
| 7313 |
\ifx\hyxmp@one@token\@empty |
| 7314 |
\advance\@hyxmp@count by -1 |
| 7315 |
\else |
| 7316 |
\advance\@hyxmp@count by 1 |
| 7317 |
\expandafter\hyxmp@count@spaces |
| 7318 |
\fi |
| 7319 |
} |
| 7320 |
% \end{macrocode} |
| 7321 |
% \end{macro} |
| 7322 |
% |
| 7323 |
% \begin{macro}{\hyxmp@count@non@spaces} |
| 7324 |
% Count the number of non-spaces in a given string. Ideally, we'd count |
| 7325 |
% both spaces and non-spaces but \tex\ won't bind |#1| to a space |
| 7326 |
% character (category code~10). Hence, in each iteration, |#1| is bound |
| 7327 |
% to the next non-space character only. |
| 7328 |
% \begin{macrocode} |
| 7329 |
\newcommand*{\hyxmp@count@non@spaces}[1]{% |
| 7330 |
\def\hyxmp@one@token{#1}% |
| 7331 |
\ifx\hyxmp@one@token\@empty |
| 7332 |
\else |
| 7333 |
\advance\@hyxmp@count by 1 |
| 7334 |
\expandafter\hyxmp@count@non@spaces |
| 7335 |
\fi |
| 7336 |
} |
| 7337 |
% \end{macrocode} |
| 7338 |
% \end{macro} |
| 7339 |
% |
| 7340 |
% \subsubsection{Embedding using \XeTeX} |
| 7341 |
% |
| 7342 |
% \begin{macro}{\hyxmp@embed@packet@xetex} |
| 7343 |
% Embed the \acro{XMP} packet using \cmdname{xdvipdfmx}-specific |
| 7344 |
% |\special| commands. I don't know how to tell \cmdname{xdvipdfmx} |
| 7345 |
% always to leave the \pdfterm{Metadata} stream uncompressed, so the |
| 7346 |
% \acro{XMP} metadata is likely to be missed by non-\acro{PDF}-aware |
| 7347 |
% \acro{XMP} viewers. |
| 7348 |
% \begin{macrocode} |
| 7349 |
\newcommand*{\hyxmp@embed@packet@xetex}{% |
| 7350 |
\special{pdf:stream @hyxmp@Metadata (\hyxmp@xml) |
| 7351 |
<< |
| 7352 |
/Type /Metadata |
| 7353 |
/Subtype /XML |
| 7354 |
>> |
| 7355 |
}% |
| 7356 |
\special{pdf:put @catalog |
| 7357 |
<< |
| 7358 |
/Metadata @hyxmp@Metadata |
| 7359 |
>> |
| 7360 |
}% |
| 7361 |
} |
| 7362 |
% \end{macrocode} |
| 7363 |
% \end{macro} |
| 7364 |
% |
| 7365 |
% |
| 7366 |
% \subsection{Final clean-up} |
| 7367 |
% \label{sec:clean-up} |
| 7368 |
% |
| 7369 |
% As explained in Section~\ref{sec:initial-prep}, all invocations of |
| 7370 |
% \cs{AtEndPreamble} have been stored in \cs{hyxmp@aep@toks} rather than |
| 7371 |
% executed. Now that \pkgname{hyperxmp} has been initialized |
| 7372 |
% completely, it is finally safe to execute the accumulated |
| 7373 |
% \cs{AtEndPreamble} stanzas. |
| 7374 |
% \begin{macrocode} |
| 7375 |
\the\hyxmp@aep@toks |
| 7376 |
% \end{macrocode} |
| 7377 |
% |
| 7378 |
% Having saved the category code of |
| 7379 |
% ``\,{\fontencoding{T1}\selectfont\textquotedbl}\,'' at the start of |
| 7380 |
% the package code (Section~\ref{sec:initial-prep}), we now restore that |
| 7381 |
% character's original category code. |
| 7382 |
% |
| 7383 |
% \begin{macrocode} |
| 7384 |
\catcode`\"=\hyxmp@dq@code |
| 7385 |
% \end{macrocode} |
| 7386 |
% |
| 7387 |
% \iffalse |
| 7388 |
%</package> |
| 7389 |
% \fi |
| 7390 |
% |
| 7391 |
% \iffalse |
| 7392 |
%<*doc-helper> |
| 7393 |
% \fi |
| 7394 |
% |
| 7395 |
% ^^A There's not much point including the documentation helper code |
| 7396 |
% ^^A in the documentation itself, but feel free to remove the |
| 7397 |
% ^^A following |\iffalse| and matching |\fi| if you'd like to include |
| 7398 |
% ^^A it. |
| 7399 |
% \iffalse |
| 7400 |
% |
| 7401 |
% \section{Documentation helper code} |
| 7402 |
% |
| 7403 |
% The following code is used to make |hyperxmp.pdf| compliant with the |
| 7404 |
% \PDFstd{A}{1}{b}{} standard, at least when built from \pdfLaTeX\ or |
| 7405 |
% \LuaLaTeX, but not currently \XeLaTeX\@. We include this code in a |
| 7406 |
% separate file because (a)~it is less distracting squirreled away here |
| 7407 |
% than placed at the top of the |.dtx| file, and (b)~putting it in a |
| 7408 |
% separate file makes it easy to disable. One simply needs to comment |
| 7409 |
% out the |\input{hyperxmp-stds}| line to produce an ordinary \acro{PDF} |
| 7410 |
% file, which offers the benefit of live hyperlinks in almost all |
| 7411 |
% \acro{PDF} readers. |
| 7412 |
% |
| 7413 |
% |
| 7414 |
% \subsection{Ensuring proper support} |
| 7415 |
% |
| 7416 |
% \begin{macro}{\next} |
| 7417 |
% We can't proceed without a color profile. For this document we use a |
| 7418 |
% \acro{CMYK} profile, specifically uncoated FOGRA29L, as a small and |
| 7419 |
% thus safe color space. As long as |FOGRA29L_uncoated.icc| lies in the |
| 7420 |
% \tex\ search path (which normally includes the current directory), |
| 7421 |
% we'll be able to find it. |
| 7422 |
% \begin{macrocode} |
| 7423 |
\let\next=\endinput |
| 7424 |
\IfFileExists{FOGRA29L_uncoated.icc} |
| 7425 |
{\let\next=\relax} |
| 7426 |
{} |
| 7427 |
\next |
| 7428 |
% \end{macrocode} |
| 7429 |
% \end{macro} |
| 7430 |
% |
| 7431 |
% \begin{macro}{\next} |
| 7432 |
% We can't proceed unless we're running either \pdfLaTeX\ or |
| 7433 |
% \LuaLaTeX\@. \XeLaTeX\ doesn't appear to support all of the |
| 7434 |
% mechanisms required below to support \PDFstd{A}{1}{b}{} compliance. |
| 7435 |
% If you know how to adapt the following code to \XeLaTeX, please |
| 7436 |
% contact the \pkgname{hyperxmp} maintainer. |
| 7437 |
% \begin{macrocode} |
| 7438 |
\let\next=\endinput |
| 7439 |
\ifPDFTeX |
| 7440 |
\let\next=\relax |
| 7441 |
\else |
| 7442 |
\ifLuaTeX |
| 7443 |
\usepackage{luatex85} |
| 7444 |
\let\next=\relax |
| 7445 |
\fi |
| 7446 |
\fi |
| 7447 |
\next |
| 7448 |
% \end{macrocode} |
| 7449 |
% \end{macro} |
| 7450 |
% |
| 7451 |
% If we're here, we should be able to make |hyperxmp.pdf| |
| 7452 |
% \PDFstd{A}{1}{b}{}-compliant. |
| 7453 |
% \begin{macrocode} |
| 7454 |
\def\wantpdfstandards{} |
| 7455 |
\typeout{Generating PDF/A-1b compliant hyperxmp documentation.} |
| 7456 |
% \end{macrocode} |
| 7457 |
% |
| 7458 |
% |
| 7459 |
% \subsection{Complying with the PDF/A-1b standard} |
| 7460 |
% |
| 7461 |
% We can't specify \PDFstd{A}{1}{b}{} compliance until after both |
| 7462 |
% \pkgname{hyperref} and \pkgname{hyperxmp} are loaded so we do so at |
| 7463 |
% the beginning of the document. |
| 7464 |
% \begin{macrocode} |
| 7465 |
\AtBeginDocument{% |
| 7466 |
\hypersetup{% |
| 7467 |
pdfapart=1, |
| 7468 |
pdfaconformance=b |
| 7469 |
}% |
| 7470 |
} |
| 7471 |
% \end{macrocode} |
| 7472 |
% |
| 7473 |
% \PDFstd{A}{1}{b}{} forbids object compression. This is normally the |
| 7474 |
% default for \pdfLaTeX, but the \TeX\ Live distribution changes the |
| 7475 |
% default to compression level~2. Here we explicitly change it back |
| 7476 |
% to~0. |
| 7477 |
% \begin{macrocode} |
| 7478 |
\pdfobjcompresslevel=0 |
| 7479 |
% \end{macrocode} |
| 7480 |
% |
| 7481 |
% We specify an uncoated FOGRA29 output intent for both |
| 7482 |
% \PDFstd{A}{1}{b}{} and \acro{PDF/X} (all versions). |
| 7483 |
% \begin{macrocode} |
| 7484 |
\immediate\pdfobj stream attr {/N 4} file {FOGRA29L_uncoated.icc} |
| 7485 |
\edef\iccobj{\the\pdflastobj} |
| 7486 |
\pdfcatalog{% |
| 7487 |
/OutputIntents [ |
| 7488 |
<< |
| 7489 |
/Type /OutputIntent |
| 7490 |
/S /GTS_PDFA1 |
| 7491 |
/DestOutputProfile \iccobj\space 0 R |
| 7492 |
/OutputConditionIdentifier (Uncoated FOGRA29) |
| 7493 |
/Info (FOGRA29L) |
| 7494 |
>> |
| 7495 |
<< |
| 7496 |
/Type /OutputIntent |
| 7497 |
/S /GTS_PDFX |
| 7498 |
/DestOutputProfile \iccobj\space 0 R |
| 7499 |
/OutputConditionIdentifier (Uncoated FOGRA29) |
| 7500 |
/Info (FOGRA29L) |
| 7501 |
>> |
| 7502 |
] |
| 7503 |
} |
| 7504 |
% \end{macrocode} |
| 7505 |
% |
| 7506 |
% \begin{macro}{\HyColor@HyperrefBorderColor} |
| 7507 |
% We just specified a \acro{CMYK} color profile, but \pkgname{hyperref} |
| 7508 |
% normally produces \acro{RGB} link borders. The following code |
| 7509 |
% instructs \pkgname{hyperref} to accept \acro{CMYK} colors. |
| 7510 |
% \begin{macrocode} |
| 7511 |
\makeatletter |
| 7512 |
\AtBeginDocument{% |
| 7513 |
\let\HyColor@HyperrefBorderColor\HyColor@XZeroOneThreeFour |
| 7514 |
} |
| 7515 |
\makeatother |
| 7516 |
% \end{macrocode} |
| 7517 |
% \end{macro} |
| 7518 |
% |
| 7519 |
% \pkgname{hyperref}'s default colors are specified as \acro{RGB}\@. We |
| 7520 |
% need to reassign them so they take on \acro{CMYK} values. (Note that |
| 7521 |
% the main document already loaded the \pkgname{xcolor} package with the |
| 7522 |
% \optname{cmyk} option.) Annoyingly, very few \acro{PDF} readers |
| 7523 |
% correctly color hyperlinks defined with \acro{CMYK} link borders. At |
| 7524 |
% the time of this writing (March 2020), Adobe Acrobat DC displays the |
| 7525 |
% \emph{reverse} of the specified color, presumably because it always |
| 7526 |
% interprets the first three color channels as red, green, and blue. |
| 7527 |
% Other browsers display no border or a black border. This is not a |
| 7528 |
% huge problem in practice because (a)~it's more important to be able to |
| 7529 |
% distinguish hyperlinks from regular text than to render with correct |
| 7530 |
% border colors and (b)~\acro{PDF} readers may suppress hyperlink |
| 7531 |
% borders anyway for \PDFstd{A}{1}{b}{} documents. |
| 7532 |
% \begin{macrocode} |
| 7533 |
\AtBeginDocument{% |
| 7534 |
\hypersetup{% |
| 7535 |
citebordercolor=green, |
| 7536 |
linkbordercolor=red, |
| 7537 |
urlbordercolor=cyan |
| 7538 |
}% |
| 7539 |
} |
| 7540 |
% \end{macrocode} |
| 7541 |
% |
| 7542 |
% \begin{macro}{\@tempdima} |
| 7543 |
% \begin{macro}{\boxwd} |
| 7544 |
% \begin{macro}{\boxht} |
| 7545 |
% \begin{macro}{\next} |
| 7546 |
% Explicitly specify the \pdfterm{BleedBox} and \pdfterm{TrimBox} to use |
| 7547 |
% for every page of the documentation. |
| 7548 |
% \begin{macrocode} |
| 7549 |
\makeatletter |
| 7550 |
\@tempdima=0.996264\paperwidth |
| 7551 |
\edef\boxwd{\strip@pt\@tempdima} |
| 7552 |
\@tempdima=0.996264\paperheight |
| 7553 |
\edef\boxht{\strip@pt\@tempdima} |
| 7554 |
\makeatother |
| 7555 |
\edef\next{% |
| 7556 |
\protect\pdfpageattr{ |
| 7557 |
/BleedBox [0.0 0.0 \boxwd\space \boxht] |
| 7558 |
/TrimBox [0.0 0.0 \boxwd\space \boxht] |
| 7559 |
/StructParents 0 |
| 7560 |
/Tabs /S |
| 7561 |
}% |
| 7562 |
} |
| 7563 |
\next |
| 7564 |
% \end{macrocode} |
| 7565 |
% \end{macro} |
| 7566 |
% \end{macro} |
| 7567 |
% \end{macro} |
| 7568 |
% \end{macro} |
| 7569 |
% |
| 7570 |
% \fi |
| 7571 |
% |
| 7572 |
% \iffalse |
| 7573 |
%</doc-helper> |
| 7574 |
% \fi |
| 7575 |
% |
| 7576 |
% \Finale |
| 7577 |
\endinput |