diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/hyperxmp')
-rw-r--r-- | Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx | 245 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/hyperxmp/hyperxmp.ins | 16 |
2 files changed, 209 insertions, 52 deletions
diff --git a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx index 264e78496f7..fb028cb5a79 100644 --- a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx +++ b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx @@ -1,17 +1,17 @@ % \iffalse meta-comment % -% Copyright (C) 2006 by Scott Pakin <scott+hyxmp@pakin.org> +% Copyright (C) 2011 by Scott Pakin <scott+hyxmp@pakin.org> % ------------------------------------------------------- % % This file may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3b +% conditions of the LaTeX Project Public License, either version 1.3c % 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. +% and version 1.3c or later is part of all distributions of LaTeX +% version 2008/05/04 or later. % % \fi % @@ -22,11 +22,12 @@ %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{hyperxmp} %<*package> - [2006/05/21 v1.1 Store hyperref metadata in XMP format] + [2011/04/17 v1.2 Store hyperref metadata in XMP format] %</package> % %<*driver> \documentclass{ltxdoc} +\usepackage{graphicx} \usepackage{tocbibind} \usepackage{hyperxmp} \usepackage[bookmarksopen]{hyperref} @@ -41,7 +42,7 @@ %</driver> % \fi % -% \CheckSum{756} +% \CheckSum{834} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -89,11 +90,18 @@ % \DeclareRobustCommand{\pkgname}[1]{\textsf{#1}\SortIndex{#1}{\textsf{#1}}} % \DeclareRobustCommand{\xmpterm}[1]{\textsf{#1}\SortIndex{#1}{\textsf{#1}}} % \DeclareRobustCommand{\pdfterm}[1]{\textsf{#1}\SortIndex{#1}{\textsf{#1}}} +% \DeclareRobustCommand{\cmdname}[1]{\texttt{#1}\SortIndex{#1}{\texttt{#1}}} % \DeclareRobustCommand{\acrostyle}[1]{\textsc{\MakeLowercase{#1}}} % \DeclareRobustCommand{\acro}[1]{^^A % \acrostyle{#1}^^A % \SortIndex{#1}{\acrostyle{#1}}^^A % } +% \DeclareRobustCommand{\XeTeXlogo}{^^A +% X\lower0.5ex\hbox{\kern-.15em\reflectbox{E}}\kern-0.1667em\TeX +% } +% \DeclareRobustCommand{\XeTeX}{^^A +% \texorpdfstring{\XeTeXlogo\SortIndex{XeTeX}{\XeTeXlogo}}{XeTeX}^^A +% } % % ^^A Specify this document's metadata. % \title{The \pkgname{hyperxmp} package\thanks{This document @@ -104,7 +112,7 @@ % pdftitle={The hyperxmp package}, % pdfsubject={LaTeX2e support for XMP metadata}, % pdfkeywords={LaTeX, embedded metadata, XMP, PDF, copyright, license, comments}, -% pdfcopyright={Copyright (C) 2006, Scott Pakin}, +% pdfcopyright={Copyright (C) 2011, Scott Pakin}, % pdflicenseurl={http://www.latex-project.org/lppl/} % } % @@ -295,10 +303,11 @@ % % Besides the approaches listed above, other approaches may work as well % but have not been tested. Note that in many \TeX\ distributions -% |ps2pdf| is a convenience script that calls Ghostscript with the -% appropriate options for converting PostScript to \acro{PDF} and -% |dvipdf| is a convenience script that calls |dvips| and |ps2pdf|; both -% |ps2pdf| and |dvipdf| should be compatible with \pkgname{hyperxmp}. +% \cmdname{ps2pdf} is a convenience script that calls Ghostscript with +% the appropriate options for converting PostScript to \acro{PDF} and +% \cmdname{dvipdf} is a convenience script that calls \cmdname{dvips} +% and \cmdname{ps2pdf}; both \cmdname{ps2pdf} and \cmdname{dvipdf} +% should be compatible with \pkgname{hyperxmp}. % % \bigskip % @@ -431,11 +440,32 @@ % % \section{Implementation} % -% This section presents the commented \LaTeXe\ source code for +% This section presents the commented \LaTeX\ source code for % \pkgname{hyperxmp}. Read this section only if you want to learn how % \pkgname{hyperxmp} is implemented. % % +% \subsection{Initial preparation} +% \label{sec:initial-prep} +% +% \changes{v1.2}{2011/04/17}{Made the package compatible with \pkgname{ngerman}. +% Thanks to Tobias Mueller for the bug report.} +% +% \begin{macro}{\hyxmp@dq@code} +% The \pkgname{ngerman} package redefines +% ``\,{\fontencoding{T1}\selectfont\textquotedbl}\,'' as an active +% character, which causes problems for \pkgname{hyperxmp} when it tries +% to use that character. We therefore save the double-quote character's +% current category code in |\hyxmp@dq@code|, mark the character as +% category code~12 (``other''), and restore the original category code +% at the end of the package code (Section~\ref{sec:clean-up}). +% \begin{macrocode} +\edef\hyxmp@dq@code{\the\catcode`\"} +\catcode`\"=12 +% \end{macrocode} +% \end{macro} +% +% % \subsection{Integration with \textsf{hyperref}} % % An important design decision underlying \pkgname{hyperxmp} is that the @@ -452,7 +482,7 @@ % \begin{macro}{\@pdfcopyright} % Prepare to store the document's copyright statement. For consistency % with \pkgname{hyperref}'s document-metadata naming conventions (which -% are in turn based on \LaTeXe's document-metadata naming conventions), +% are in turn based on \LaTeX's document-metadata naming conventions), % we do not prefix the macro name with our package-specific |\hyxmp@| % prefix. % \begin{macrocode} @@ -465,7 +495,7 @@ % Prepare to store the \acro{URL} containing the document's license % agreement. For consistency with \pkgname{hyperref}'s % document-metadata naming conventions (which are in turn based on -% \LaTeXe's document-metadata naming conventions), we do not prefix the +% \LaTeX's document-metadata naming conventions), we do not prefix the % macro name with our package-specific |\hyxmp@| prefix. % \begin{macrocode} \def\@pdflicenseurl{} @@ -473,6 +503,30 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\@pdfauthortitle} +% Prepare to store the author's position/title (e.g.,~Staff Writer). For +% consistency with \pkgname{hyperref}'s document-metadata naming +% conventions (which are in turn based on \LaTeX's document-metadata +% naming conventions), we do not prefix the macro name with our +% package-specific |\hyxmp@| prefix. +% \begin{macrocode} +\def\@pdfauthortitle{} +\define@key{Hyp}{pdfauthortitle}{\pdfstringdef\@pdfauthortitle{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@pdfcaptionwriter} +% Prepare to store the name of the person who inserted the +% \pkgname{hyperxmp} metadata. For consistency with +% \pkgname{hyperref}'s document-metadata naming conventions (which are +% in turn based on \LaTeX's document-metadata naming conventions), we do +% not prefix the macro name with our package-specific |\hyxmp@| prefix. +% \begin{macrocode} +\def\@pdfcaptionwriter{} +\define@key{Hyp}{pdfcaptionwriter}{\pdfstringdef\@pdfcaptionwriter{#1}} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\hyxmp@find@metadata} % Issue a warning message if the author failed to include any metadata % at all. @@ -482,14 +536,18 @@ \ifx\@pdfcopyright\@empty \ifx\@pdfkeywords\@empty \ifx\@pdflicenseurl\@empty - \ifx\@pdfsubject\@empty - \ifx\@pdftitle\@empty - \PackageWarningNoLine{hyperxmp}{% + \ifx\@pdfauthortitle\@empty + \ifx\@pdfcaptionwriter\@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 @@ -537,7 +595,7 @@ disabled}% % package options to \pkgname{hyperref} or via the \pkgname{hyperref} % |\hypersetup| command. The functions in this section convert % author-supplied lists (e.g.,~|pdfkeywords={foo, bar, baz}|) into -% \LaTeXe\ lists (e.g.,~|\@elt {foo}| |\@elt {bar}| |\@elt {baz}|) that +% \LaTeX\ lists (e.g.,~|\@elt {foo}| |\@elt {bar}| |\@elt {baz}|) that % can be more easily manipulated (Section~\ref{sec:list-manip}); define % macros for the \acro{XML} entites |<|, |>|, and |&| % (Section~\ref{sec:xml-entities}); trim spaces off the ends of strings @@ -549,7 +607,7 @@ disabled}% % \label{sec:list-manip} % % We define a macro for converting a list of comma-separated elements -% (e.g.,~the list of \acro{PDF} keywords) to a list of \LaTeXe\ +% (e.g.,~the list of \acro{PDF} keywords) to a list of \LaTeX\ % |\@elt|-separated elements. % % \begin{macro}{\hyxmp@commas@to@list} @@ -680,7 +738,7 @@ disabled}% % \begin{macrocode} \begingroup % \end{macrocode} -% Put |\toks 0 {| into the |afterassignment| queue. +% Put ``|\toks 0 {|'' into the |afterassignment| queue. % \begin{macrocode} \aftergroup\toks\aftergroup0\aftergroup{% % \end{macrocode} @@ -735,9 +793,10 @@ disabled}% % and all occurrences of~``|&|'' replaced with~|&|. % % If |\pdfmark| is defined then there's a chance the user will run -% |dvips| on the resulting \acro{DVI} file and |dvips| may convert some -% of the spaces to newlines, which is problematic for the proper display -% of an \acro{XMP} packet. We therefore conditionally invoke +% \cmdname{dvips} on the resulting \acro{DVI} file and \cmdname{dvips} +% may convert some of the spaces to newlines, which is problematic for +% the proper display of an \acro{XMP} packet. We therefore +% conditionally invoke % |\hyxmp@obscure@spaces| to replace all spaces with | |. % \begin{macrocode} \newcommand*{\hyxmp@xmlify}[1]{% @@ -876,16 +935,16 @@ disabled}% % \end{macro} % % \begin{macro}{\hyxmp@obscure@spaces} -% The |dvips| backend rather obnoxiously word-wraps text. Doing so can -% cause \acro{XMP} metadata to be displayed incorrectly. For example, -% Adobe Acrobat displays the document's |dc:rights| (copyright notice) -% within a single-line field. By introducing an extra line break in the -% middle of the copyright notice, |dvips| implicitly causes it to be -% truncated when displayed. +% The \cmdname{dvips} backend rather obnoxiously word-wraps text. Doing +% so can cause \acro{XMP} metadata to be displayed incorrectly. For +% example, Adobe Acrobat displays the document's |dc:rights| (copyright +% notice) within a single-line field. By introducing an extra line +% break in the middle of the copyright notice, \cmdname{dvips} +% implicitly causes it to be truncated when displayed. % -% To thwart |dvips|'s word-wrapping, we define |\hyxmp@obscure@spaces| -% to replace each space in a given piece of text with an \acro{XML} | | -% (space) entity. +% To thwart \cmdname{dvips}'s word-wrapping, we define +% |\hyxmp@obscure@spaces| to replace each space in a given piece of text +% with an \acro{XML} | | (space) entity. % \begin{macrocode} \newcommand*{\hyxmp@obscure@spaces}[1]{% \gdef\hyxmp@xmlified{}% @@ -1385,6 +1444,57 @@ ______</rdf:Description>^^J% % \end{macrocode} % \end{macro} % +% \subsubsection{The Photoshop schema} +% \label{sec:photoshop} +% +% \begin{macro}{\hyxmp@photoshop@schema} +% \begin{macro}{\hyxmp@photoshop@data} +% Add properties defined by the Photoshop schema to the |\hyxmp@xml| +% macro. We support only the \xmpterm{AuthorsPosition} and +% \xmpterm{CaptionWriter} properties, as that's all that Adobe Acrobat +% currently displays. +% \changes{v1.2}{2010/06/07}{Added support for the Photoshop schema} +% \begin{macrocode} +\gdef\hyxmp@photoshop@schema{% + \def\hyxmp@photoshop@data{\@pdfauthortitle\@pdfcaptionwriter}% + \ifx\@hyxmp@photoshop@data\@empty + \else + \hyxmp@add@to@xml{% +______<rdf:Description rdf:about=""^^J% +____________xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">^^J% + }% + \fi +% \end{macrocode} +% \begin{macrocode} + \ifx\@pdfauthortitle\@empty + \else + \hyxmp@xmlify{\@pdfauthortitle}% + \hyxmp@add@to@xml{% +_________<photoshop:AuthorsPosition>\hyxmp@xmlified</photoshop:AuthorsPosition>^^J% + }% + \fi +% \end{macrocode} +% \begin{macrocode} + \ifx\@pdfcaptionwriter\@empty + \else + \hyxmp@xmlify{\@pdfcaptionwriter}% + \hyxmp@add@to@xml{% +_________<photoshop:CaptionWriter>\hyxmp@xmlified</photoshop:CaptionWriter>^^J% + }% + \fi +% \end{macrocode} +% \begin{macrocode} + \ifx\@hyxmp@photoshop@data\@empty + \else + \hyxmp@add@to@xml{% +______</rdf:Description>^^J% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \subsubsection{Constructing the XMP packet} % % \begin{macro}{\hyxmp@construct@packet} @@ -1421,6 +1531,7 @@ ___<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns\hyxmp@hash">^^ \hyxmp@pdf@schema \hyxmp@xapRights@schema \hyxmp@dc@schema + \hyxmp@photoshop@schema \hyxmp@mm@schema \hyxmp@add@to@xml{% ___</rdf:RDF>^^J% @@ -1458,14 +1569,19 @@ ___</rdf:RDF>^^J% \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 - }% + \def\hyxmp@driver{hxetex}% + \ifx\hyxmp@driver\Hy@driver + \hyxmp@embed@packet@xetex + \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 \fi } @@ -1547,9 +1663,10 @@ ___</rdf:RDF>^^J% % \subsubsection{Embedding using \texttt{dvipdfm}} % % \begin{macro}{\hyxmp@embed@packet@dvipdfm} -% Embed the \acro{XMP} packet using a |dvipdfm|-specific |\special| command. -% Note that |dvipdfm| rather irritatingly requires us to count the -% number of characters in the |\hyxmp@xml| stream ourselves. +% Embed the \acro{XMP} packet using \cmdname{dvipdfm}-specific +% |\special| commands. Note that \cmdname{dvipdfm} rather irritatingly +% requires us to count the number of characters in the |\hyxmp@xml| +% stream ourselves. % \begin{macrocode} \newcommand*{\hyxmp@embed@packet@dvipdfm}{% \hyxmp@string@len{\hyxmp@xml}% @@ -1620,5 +1737,45 @@ ___</rdf:RDF>^^J% % \end{macrocode} % \end{macro} % +% \subsubsection{Embedding using \XeTeX} +% +% \begin{macro}{\hyxmp@embed@packet@xetex} +% Embed the \acro{XMP} packet using \cmdname{xdvipdfmx}-specific +% |\special| commands. I don't know how to tell \cmdname{xdvipdfmx} +% always to leave the \pdfterm{Metadata} stream uncompressed, so the +% \acro{XMP} metadata is likely to be missed by non-\acro{PDF}-aware +% \acro{XMP} viewers. +% \changes{v1.2}{2010/06/04}{Added support for the \XeTeX\ backend +% (\texttt{xdvipdfmx})} +% \begin{macrocode} +\newcommand*{\hyxmp@embed@packet@xetex}{% + \special{pdf:stream @hyxmp@Metadata (\hyxmp@xml) + << + /Type /Metadata + /Subtype /XML + >> + }% + \special{pdf:put @catalog + << + /Metadata @hyxmp@Metadata + >> + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Final clean-up} +% \label{sec:clean-up} +% +% Having saved the category code of +% ``\,{\fontencoding{T1}\selectfont\textquotedbl}\,'' at the start of +% the package code (Section~\ref{sec:initial-prep}), we now restore that +% character's original category code. +% +% \begin{macrocode} +\catcode`\"=\hyxmp@dq@code +% \end{macrocode} +% % \Finale \endinput diff --git a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.ins b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.ins index 82008a84a5f..4a3f70a3ffc 100644 --- a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.ins +++ b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.ins @@ -1,15 +1,15 @@ %% -%% Copyright (C) 2006 by Scott Pakin <scott+dtx@pakin.org> +%% Copyright (C) 2011 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 +%% the LaTeX Project Public License, either version 1.3c 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. +%% and version 1.3c or later is part of all distributions of LaTeX version +%% 2008/05/04 or later. %% \input docstrip.tex @@ -21,17 +21,17 @@ This is a generated file. -Copyright (C) 2006 by Scott Pakin <scott+dtx@pakin.org> +Copyright (C) 2011 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 +the LaTeX Project Public License, either version 1.3c 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. +and version 1.3c or later is part of all distributions of LaTeX +version 2008/05/04 or later. \endpreamble |