diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/hyperxmp')
-rw-r--r-- | Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty | 549 |
1 files changed, 549 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty b/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty new file mode 100644 index 00000000000..6824688b0e5 --- /dev/null +++ b/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty @@ -0,0 +1,549 @@ +%% +%% This is file `hyperxmp.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% hyperxmp.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% Copyright (C) 2006 by Scott Pakin <scott+dtx@pakin.org> +%% +%% This file may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.3b of this license +%% or (at your option) any later version. The latest version of this +%% license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3b or later is part of all distributions of LaTeX +%% version 2006/01/07 or later. +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{hyperxmp} + [2006/05/21 v1.1 Store hyperref metadata in XMP format] +\RequirePackage{keyval} +\def\@pdfcopyright{} +\define@key{Hyp}{pdfcopyright}{\pdfstringdef\@pdfcopyright{#1}} +\def\@pdflicenseurl{} +\define@key{Hyp}{pdflicenseurl}{\pdfstringdef\@pdflicenseurl{#1}} +\newcommand*{\hyxmp@find@metadata}{% + \ifx\@pdfauthor\@empty + \ifx\@pdfcopyright\@empty + \ifx\@pdfkeywords\@empty + \ifx\@pdflicenseurl\@empty + \ifx\@pdfsubject\@empty + \ifx\@pdftitle\@empty + \PackageWarningNoLine{hyperxmp}{% +\jobname.tex did not specify any metadata to\MessageBreak +include in the XMP packet.\space\space Please see the hyperxmp\MessageBreak +documentation for instructions on how to provide\MessageBreak +metadata values to hyperxmp% + }% + \fi + \fi + \fi + \fi + \fi + \fi +} +\AtBeginDocument{% + \@ifpackageloaded{hyperref}% + {% + \AtEndDocument{% + \hyxmp@find@metadata + \hyxmp@embed@packet + }% + }% + {\PackageWarningNoLine{hyperxmp}{% +\jobname.tex failed to include a\MessageBreak +\string\usepackage\string{hyperref\string} +in the preamble.\MessageBreak +Consequently, all hyperxmp functionality will be\MessageBreak +disabled}% + }% +} +\newcommand*{\hyxmp@commas@to@list}[2]{% + \gdef#1{}% + \expandafter\hyxmp@commas@to@list@i\expandafter#1#2,,% +} +\def\hyxmp@commas@to@list@i#1#2,{% + \gdef\hyxmp@sublist{#2}% + \ifx\hyxmp@sublist\@empty + \let\next=\relax + \else + \hyxmp@trimspaces\hyxmp@sublist + \@cons{#1}{{\hyxmp@sublist}}% + \def\next{\hyxmp@commas@to@list@i{#1}}% + \fi + \next +} +\bgroup +\catcode`\&=11 +\gdef\hyxmp@xml@amp{&} +\global\let\hyxmp@other@amp=& +\gdef\hyxmp@amp{&} +\catcode`\<=11 +\gdef\hyxmp@xml@lt{<} +\global\let\hyxmp@other@lt=< +\catcode`\>=11 +\gdef\hyxmp@xml@gt{>} +\global\let\hyxmp@other@gt=> +\def\next#1{#1} +\next{\global\let\hyxmp@other@space= } % +\catcode`\|=0 +\catcode`\\=11 +|global|let|hyxmp@other@bs=\ +|egroup +\catcode`\Q=3 +\newcommand{\hyxmp@trimspaces}[1]{% + \begingroup + \aftergroup\toks\aftergroup0\aftergroup{% + \expandafter\hyxmp@trimb\expandafter\noexpand#1Q Q}% + \edef#1{\the\toks0}% +} +\def\hyxmp@trimb#1 Q{\hyxmp@trimc#1Q} +\def\hyxmp@trimc#1Q#2{\afterassignment\endgroup \vfuzz\the\vfuzz#1} +\catcode`\Q=11 +\newcommand*{\hyxmp@xmlify}[1]{% + \gdef\hyxmp@xmlified{}% + \expandafter\hyxmp@xmlify@i#1\@empty + \@ifundefined{pdfmark}{}{% + \expandafter\hyxmp@obscure@spaces\expandafter{\hyxmp@xmlified}% + }% +} +\def\hyxmp@xmlify@i{\futurelet\hyxmp@one@token\hyxmp@xmlify@ii} +\def\hyxmp@xmlify@ii{% + \if\hyxmp@one@token\hyxmp@other@lt + \def\next##1{% + \xdef\hyxmp@xmlified{\hyxmp@xmlified\hyxmp@xml@lt}% + \hyxmp@xmlify@i + }% + \else + \if\hyxmp@one@token\hyxmp@other@gt + \def\next##1{% + \xdef\hyxmp@xmlified{\hyxmp@xmlified\hyxmp@xml@gt}% + \hyxmp@xmlify@i + }% + \else + \if\hyxmp@one@token\hyxmp@other@amp + \def\next##1{% + \xdef\hyxmp@xmlified{\hyxmp@xmlified\hyxmp@xml@amp}% + \hyxmp@xmlify@i + }% + \else + \ifx\hyxmp@one@token\hyxmp@other@space + \def\next##1{% + \g@addto@macro\hyxmp@xmlified{ }% + \hyxmp@xmlify@i##1% + }% + \else + \if\hyxmp@one@token\hyxmp@other@bs + \def\next##1{\futurelet\hyxmp@one@token\hyxmp@xmlify@iii} + \else + \ifx\hyxmp@one@token\@empty + \def\next##1{}% + \else + \def\next##1{% + \g@addto@macro\hyxmp@xmlified{##1}% + \hyxmp@xmlify@i + }% + \fi + \fi + \fi + \fi + \fi + \fi + \next +} +\def\hyxmp@xmlify@iii{% + \def\next##1##2##3{% + \@tempcnta='##1##2##3 + \xdef\hyxmp@xmlified{\hyxmp@xmlified + \hyxmp@amp\hyxmp@hash\the\@tempcnta;% + }% + \hyxmp@xmlify@i + }% + \if\hyxmp@one@token( + \let\next=\hyxmp@xmlify@i + \else + \if\hyxmp@one@token) + \let\next=\hyxmp@xmlify@i + \fi + \fi + \next +} +\newcommand*{\hyxmp@obscure@spaces}[1]{% + \gdef\hyxmp@xmlified{}% + \expandafter\hyxmp@obscure@spaces@i#1 {} % +} +\def\hyxmp@obscure@spaces@i #1 #2 {% + \def\hyxmp@one@token{#2}% + \ifx\hyxmp@one@token\@empty + \xdef\hyxmp@xmlified{\hyxmp@xmlified#1}% + \let\next=\relax + \else + \xdef\hyxmp@xmlified{\hyxmp@xmlified#1\hyxmp@amp\hyxmp@hash32;}% + \def\next{\expandafter\hyxmp@obscure@spaces@i\expandafter#2 }% + \fi + \next +} +\def\hyxmp@modulo@a#1{% + \@tempcntb=\@tempcnta + \divide\@tempcntb by #1 + \multiply\@tempcntb by #1 + \advance\@tempcnta by -\@tempcntb +} +\def\hyxmp@big@prime{536870923} +\def\hyxmp@big@prime@ii{536870027} +\def\hyxmp@seed@rng#1{% + \@tempcnta=\hyxmp@big@prime + \futurelet\hyxmp@one@token\hyxmp@seed@rng@i#1\@empty +} +\def\hyxmp@seed@rng@i{% + \ifx\hyxmp@one@token\@empty + \let\next=\relax + \else + \def\next##1{% + \multiply\@tempcnta by 3 + \advance\@tempcnta by `##1 + \hyxmp@modulo@a{\hyxmp@big@prime}% + \futurelet\hyxmp@one@token\hyxmp@seed@rng@i + }% + \fi + \next +} +\def\hyxmp@set@rand@num{% + \@tempcnta=\hyxmp@rand@num + \multiply\@tempcnta by 3 + \advance\@tempcnta by \hyxmp@big@prime@ii + \hyxmp@modulo@a{\hyxmp@big@prime}% + \xdef\hyxmp@rand@num{\the\@tempcnta}% +} +\def\hyxmp@append@hex#1{% + \hyxmp@set@rand@num + \@tempcnta=\hyxmp@rand@num + \hyxmp@modulo@a{16}% + \ifnum\@tempcnta<10 + \xdef#1{#1\the\@tempcnta}% + \else + \advance\@tempcnta by -10 + \ifcase\@tempcnta + \xdef#1{#1a}% + \or\xdef#1{#1b}% + \or\xdef#1{#1c}% + \or\xdef#1{#1d}% + \or\xdef#1{#1e}% + \or\xdef#1{#1f}% + \fi + \fi +} +\def\hyxmp@append@hex@iv#1{% + \hyxmp@append@hex#1% + \hyxmp@append@hex#1% + \hyxmp@append@hex#1% + \hyxmp@append@hex#1% +} +\def\hyxmp@create@uuid#1{% + \def#1{uuid:}% + \hyxmp@append@hex@iv#1% + \hyxmp@append@hex@iv#1% + \g@addto@macro#1{-}% + \hyxmp@append@hex@iv#1% + \g@addto@macro#1{-}% + \hyxmp@append@hex@iv#1% + \g@addto@macro#1{-}% + \hyxmp@append@hex@iv#1% + \hyxmp@append@hex@iv#1% + \hyxmp@append@hex@iv#1% +} +\newcommand*{\hyxmp@def@DocumentID}{% + \edef\hyxmp@seed@string{\jobname:\@pdftitle:\@pdfauthor}% + \expandafter\hyxmp@seed@rng\expandafter{\hyxmp@seed@string}% + \edef\hyxmp@rand@num{\the\@tempcnta}% + \hyxmp@create@uuid\hyxmp@DocumentID +} +\newcommand*{\hyxmp@def@InstanceID}{% + \edef\hyxmp@seed@string{% + \jobname:\@pdftitle:\@pdfauthor:% + \the\year/\the\month/\the\day:% + \the\time + }% + \expandafter\hyxmp@seed@rng\expandafter{\hyxmp@seed@string}% + \edef\hyxmp@rand@num{\the\@tempcnta}% + \hyxmp@create@uuid\hyxmp@InstanceID +} +\newcommand*{\hyxmp@add@to@xml}[1]{% + \bgroup + \@tempcnta=0 + \loop + \lccode\@tempcnta=\@tempcnta + \advance\@tempcnta by 1 + \ifnum\@tempcnta<256 + \repeat + \lccode`\_=`\ \relax + \lowercase{\xdef\hyxmp@xml{\hyxmp@xml#1}}% + \egroup +} +\bgroup +\catcode`\#=11 +\gdef\hyxmp@hash{#} +\egroup +\bgroup + \xdef\hyxmp@xml{}% + \hyxmp@add@to@xml{% +__________________________________________________^^J% + } + \xdef\hyxmp@padding{\hyxmp@xml}% +\egroup +\xdef\hyxmp@padding{\hyxmp@padding\hyxmp@padding} +\xdef\hyxmp@padding{\hyxmp@padding\hyxmp@padding} +\xdef\hyxmp@padding{\hyxmp@padding\hyxmp@padding} +\xdef\hyxmp@padding{\hyxmp@padding\hyxmp@padding} +\xdef\hyxmp@padding{\hyxmp@padding\hyxmp@padding} +\xdef\hyxmp@today{\the\year}% +\ifnum\month<10 + \xdef\hyxmp@today{\hyxmp@today-0\the\month}% +\else + \xdef\hyxmp@today{\hyxmp@today-\the\month}% +\fi +\ifnum\day<10 + \xdef\hyxmp@today{\hyxmp@today-0\the\day}% +\else + \xdef\hyxmp@today{\hyxmp@today-\the\day}% +\fi +\newcommand*{\hyxmp@pdf@schema}{% + \let\hyxmp@have@any=!% + \ifx\@pdfkeywords\@empty + \ifx\@pdfproducer\@empty + \let\hyxmp@have@any=\@empty + \fi + \fi + \ifx\hyxmp@have@any\@empty + \else + \hyxmp@add@to@xml{% +______<rdf:Description rdf:about=""^^J% +___________xmlns:pdf="http://ns.adobe.com/pdf/1.3/">^^J% + }% + \ifx\@pdfkeywords\@empty + \else + \hyxmp@xmlify{\@pdfkeywords}% + \hyxmp@add@to@xml{% +___________<pdf:Keywords>\hyxmp@xmlified</pdf:Keywords>^^J% + }% + \fi + \ifx\@pdfproducer\@empty + \else + \hyxmp@xmlify{\@pdfproducer}% + \hyxmp@add@to@xml{% +___________<pdf:Producer>\hyxmp@xmlified</pdf:Producer>^^J% + }% + \fi + \hyxmp@add@to@xml{% +______</rdf:Description>^^J% + }% + \fi +} +\newcommand*{\hyxmp@rdf@dc}[2]{% + \ifx#2\@empty + \else + \hyxmp@xmlify{#2}% + \hyxmp@add@to@xml{% +_________<dc:#1>^^J% +____________<rdf:Alt>^^J% +_______________<rdf:li xml:lang="x-default">\hyxmp@xmlified</rdf:li>^^J% +____________</rdf:Alt>^^J% +_________</dc:#1>^^J% + }% + \fi% +}% +\newcommand*{\hyxmp@list@to@xml}[3]{% + \ifx#3\@empty + \else + \hyxmp@add@to@xml{% +_________<dc:#1>^^J% +____________<rdf:#2>^^J% + }% + \bgroup + \hyxmp@commas@to@list\hyxmp@list{#3}% + \def\@elt##1{% + \hyxmp@xmlify{##1}% + \hyxmp@add@to@xml{% +_______________<rdf:li>\hyxmp@xmlified</rdf:li>^^J% + }% + }% + \hyxmp@list + \egroup + \hyxmp@add@to@xml{% +____________</rdf:#2>^^J% +_________</dc:#1>^^J% + }% + \fi +} +\newcommand*{\hyxmp@dc@schema}{% + \hyxmp@add@to@xml{% +______<rdf:Description rdf:about=""^^J% +____________xmlns:dc="http://purl.org/dc/elements/1.1/">^^J% +_________<dc:format>application/pdf</dc:format>^^J% + }% + \hyxmp@rdf@dc{title}{\@pdftitle}% + \hyxmp@rdf@dc{description}{\@pdfsubject}% + \hyxmp@rdf@dc{rights}{\@pdfcopyright}% + \hyxmp@list@to@xml{creator}{Seq}{\@pdfauthor}% + \hyxmp@list@to@xml{subject}{Bag}{\@pdfkeywords}% + \hyxmp@list@to@xml{date}{Seq}{\hyxmp@today}% + \hyxmp@add@to@xml{% +______</rdf:Description>^^J% + }% +} +\newcommand*{\hyxmp@xapRights@schema}{% + \ifx\@pdflicenseurl\@empty + \else + \hyxmp@xmlify{\@pdflicenseurl}% + \hyxmp@add@to@xml{% +______<rdf:Description rdf:about=""^^J% +___________xmlns:xapRights="http://ns.adobe.com/xap/1.0/rights/">^^J% +_________<xapRights:Marked>True</xapRights:Marked>^^J% +_________<xapRights:WebStatement>\hyxmp@xmlified</xapRights:WebStatement>^^J% +______</rdf:Description>^^J% + }% + \fi +} +\gdef\hyxmp@mm@schema{% + \hyxmp@def@DocumentID + \hyxmp@def@InstanceID + \hyxmp@add@to@xml{% +______<rdf:Description rdf:about=""^^J% +____________xmlns:xapMM="http://ns.adobe.com/xap/1.0/mm/">^^J% +_________<xapMM:DocumentID>\hyxmp@DocumentID</xapMM:DocumentID>^^J% +_________<xapMM:InstanceID>\hyxmp@InstanceID</xapMM:InstanceID>^^J% +______</rdf:Description>^^J% + }% +} +\bgroup +\catcode`\^^ef=12 +\catcode`\^^bb=12 +\catcode`\^^bf=12 +\gdef\hyxmp@construct@packet{% + \gdef\hyxmp@xml{}% + \hyxmp@add@to@xml{% +<?xpacket begin="^^ef^^bb^^bf" id="W5M0MpCehiHzreSzNTczkc9d"?>^^J% +<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="3.1-702">^^J% +___<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns\hyxmp@hash">^^J% + }% + \hyxmp@pdf@schema + \hyxmp@xapRights@schema + \hyxmp@dc@schema + \hyxmp@mm@schema + \hyxmp@add@to@xml{% +___</rdf:RDF>^^J% +</x:xmpmeta>^^J% +\hyxmp@padding +<?xpacket end="w"?>^^J% + }% +} +\egroup +\newcommand*{\hyxmp@embed@packet}{% + \hyxmp@construct@packet + \def\hyxmp@driver{hpdftex}% + \ifx\hyxmp@driver\Hy@driver + \hyxmp@embed@packet@pdftex + \else + \def\hyxmp@driver{hdvipdfm}% + \ifx\hyxmp@driver\Hy@driver + \hyxmp@embed@packet@dvipdfm + \else + \@ifundefined{pdfmark}{% + \PackageWarningNoLine{hyperxmp}{% + Unrecognized hyperref driver `\Hy@driver'.\MessageBreak + \jobname.tex's XMP metadata will *not* be\MessageBreak + embedded in the resulting file}% + }{% + \hyxmp@embed@packet@pdfmark + }% + \fi + \fi +} +\newcommand*{\hyxmp@embed@packet@pdftex}{% + \bgroup + \pdfcompresslevel=0 + \immediate\pdfobj stream attr {% + /Type /Metadata + /Subtype /XML + }{\hyxmp@xml}% + \pdfcatalog {/Metadata \the\pdflastobj\space 0 R}% + \egroup +} +\newcommand*{\hyxmp@embed@packet@pdfmark}{% + \pdfmark{% + pdfmark=/OBJ, + Raw={/_objdef \string{hyxmp@Metadata\string} /type /stream}% + }% + \pdfmark{% + pdfmark=/PUT, + Raw={\string{hyxmp@Metadata\string}% + << + /Type /Metadata + /Subtype /XML + >> + }% + }% + \pdfmark{% + pdfmark=/PUT, + Raw={\string{hyxmp@Metadata\string} (\hyxmp@xml)}% + }% + \pdfmark{% + pdfmark=/CLOSE, + Raw={\string{hyxmp@Metadata\string}}% + }% + \pdfmark{% + pdfmark=/PUT, + Raw={\string{Catalog\string}% + << + /Metadata \string{hyxmp@Metadata\string}% + >> + }% + }% +} +\newcommand*{\hyxmp@embed@packet@dvipdfm}{% + \hyxmp@string@len{\hyxmp@xml}% + \special{pdf: object @hyxmp@Metadata + << + /Type /Metadata + /Subtype /XML + /Length \the\@tempcnta + >> + stream^^J\hyxmp@xml endstream% + }% + \special{pdf: docview + << + /Metadata @hyxmp@Metadata + >> + }% +} +\newcommand*{\hyxmp@string@len}[1]{% + \@tempcnta=0 + \expandafter\hyxmp@count@spaces#1 {} % + \expandafter\hyxmp@count@non@spaces#1{}% +} +\def\hyxmp@count@spaces#1 {% + \def\hyxmp@one@token{#1}% + \ifx\hyxmp@one@token\@empty + \advance\@tempcnta by -1 + \else + \advance\@tempcnta by 1 + \expandafter\hyxmp@count@spaces + \fi +} +\newcommand*{\hyxmp@count@non@spaces}[1]{% + \def\hyxmp@one@token{#1}% + \ifx\hyxmp@one@token\@empty + \else + \advance\@tempcnta by 1 + \expandafter\hyxmp@count@non@spaces + \fi +} +\endinput +%% +%% End of file `hyperxmp.sty'. |