diff options
author | Karl Berry <karl@freefriends.org> | 2016-02-18 22:44:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-02-18 22:44:14 +0000 |
commit | 718d12cc5a8a2db77ca4c0e8284022922c03d710 (patch) | |
tree | c42face0f257e81b0732ed322f121d4f563343e7 /Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx | |
parent | fc0c423157cd76dd543226c7b37e93cd2ab0c489 (diff) |
hyperxmp (18feb16)
git-svn-id: svn://tug.org/texlive/trunk@39768 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx | 108 |
1 files changed, 77 insertions, 31 deletions
diff --git a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx index e10d74b757d..96ed92592fa 100644 --- a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx +++ b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2014 by Scott Pakin <scott+hyxmp@pakin.org> +% Copyright (C) 2016 by Scott Pakin <scott+hyxmp@pakin.org> % ------------------------------------------------------- % % This file may be distributed and/or modified under the @@ -22,7 +22,7 @@ %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{hyperxmp} %<*package> - [2014/09/24 v2.6 Store hyperref metadata in XMP format] + [2016/02/17 v2.7 Store hyperref metadata in XMP format] %</package> % %<*driver> @@ -54,13 +54,13 @@ pdftitle={The hyperxmp package}, pdfsubject={LaTeX2e support for XMP metadata}, pdfkeywords={LaTeX, embedded metadata, XMP, PDF, copyright, license, comments}, - pdfcopyright={Copyright (C) 2014, Scott Pakin}, + pdfcopyright={Copyright (C) 2016, Scott Pakin}, pdflicenseurl={http://www.latex-project.org/lppl/}, pdfcaptionwriter={Scott Pakin}, pdfcontactemail={scott+hyxmp@pakin.org}, pdfcontacturl={http://www.pakin.org/\xmptilde scott/}, pdflang={en-US}, - baseurl={http://www.ctan.org/tex-archive/macros/latex/contrib/hyperxmp/hyperxmp.pdf} + baseurl={http://mirror.ctan.org/macros/latex/contrib/hyperxmp/hyperxmp.pdf} } \begin{document} @@ -81,7 +81,7 @@ %</driver> % \fi % -% \CheckSum{1475} +% \CheckSum{1508} % % \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 @@ -114,7 +114,7 @@ % Identification schema, as requested by Florian Breitwieser} % \changes{v2.5}{2014/06/19}{Enabled ``\texttt{\string\string\string\_}'' % to work within email addresses, as requested by Leonid Sinev} -% \changes{v2.6}{2014/09/24}{Added support for a new \string\optname{pdfdate} +% \changes{v2.6}{2014/09/24}{Added support for a new \protect\optname{pdfdate} % key to explicitly specify the document date (and optionally time)} % % \GetFileInfo{hyperxmp.dtx} @@ -146,7 +146,11 @@ % \makeatother % \DeclareRobustCommand{\pdfterm}[1]{\mbox{\textsf{#1}}\SortIndex{#1}{\textsf{#1}}} % \DeclareRobustCommand{\cmdname}[1]{\mbox{\texttt{#1}}\SortIndex{#1}{\texttt{#1}}} -% \DeclareRobustCommand{\optname}[1]{\mbox{\texttt{#1}}\SortIndex{#1}{\textsf{#1} (option)}} +% \DeclareRobustCommand{\optname}[1]{^^A +% \mbox{\textsf{#1}}^^A +% \SortIndex{#1}{\textsf{#1} (option)}^^A +% \index{options=\textsf{#1}}^^A +% } % \DeclareRobustCommand{\acrostyle}[1]{\textsc{\MakeLowercase{#1}}} % \DeclareRobustCommand{\acro}[1]{^^A % \mbox{\acrostyle{#1}}^^A @@ -448,7 +452,7 @@ % https://www.facebook.com/AlbertEinstein % }, % pdflang={en}, -% baseurl={http://www.ctan.org/tex-archive/macros/latex/contrib/hyperxmp/} +% baseurl={http://mirror.ctan.org/macros/latex/contrib/hyperxmp/} % } % \begin{document} % \maketitle @@ -643,6 +647,17 @@ % option or as an argument to the |\hypersetup| command, the document % can include \term{Unicode} characters in its \acro{XMP} fields. % +% \paragraph{Note~6: Automatically specified metadata} +% \optname{pdftitle} defaults to the document's title as specified by +% |\title{|\dots|}|. \optname{pdfauthor} defaults to the document's +% author(s) as specified by |\author{|\dots|}|. \optname{pdfdate} +% defaults to the current date and time. \optname{pdfmetalang} +% defaults to the same value as \optname{pdflang} if non-empty, +% ``|x-default|'' otherwise. An implication of automatic +% metadata specification is that an author can simply include +% |\usepackage{hyperxmp}| in a document's preamble and benefit from +% a modicum of \acro{XMP} metadata with no additional effort. +% % % \StopEventually{^^A % \section{Future Work} @@ -1058,28 +1073,38 @@ % \begin{macro}{\KV@Hyp@pdfauthor} % \begin{macro}{\xmpcomma} % \begin{macro}{\xmpquote} +% \begin{macro}{\hyxmp@and} +% \begin{macro}{\and} % \begin{macro}{\hyxmp@pdfauthor} % \begin{macro}{\@pdfauthor} % Redefine |\KV@Hyp@pdfauthor| to process its argument twice. The first % time, |\xmpcomma| is defined as a placeholder character -% (|\hyxmp@comma|) and |\xmpquote| as the identity function. The -% result is stored in |\hyxmp@pdfauthor| for use in structured lists -% (those surrounding each entry with |<rdf:li>|). The second time, -% |\xmpcomma| is defined as an ordinary comma, and |\xmpquote| is -% defined as a macro that puts its argument within double quotes. The -% result is stored in |\@pdfauthor| for use in unstructured lists (those -% in which the entire list appears within a single pair of tags). +% (|\hyxmp@comma|) and |\xmpquote| as the identity function. The result +% is stored in |\hyxmp@pdfauthor| for use in structured lists (those +% surrounding each entry with |<rdf:li>|). The second time, |\xmpcomma| +% is defined as an ordinary comma, and |\xmpquote| is defined as a macro +% that puts its argument within double quotes. The result is stored in +% |\@pdfauthor| for use in unstructured lists (those in which the entire +% list appears within a single pair of tags). In case +% \optname{pdfauthor} is left unspecified and we copy |\author|'s +% argument to \optname{pdfauthor}, we temporarily redefine |\and| as the +% list separator when producing a structured list and as ``|and|'' when +% producing an unstructured list. % \begin{macrocode} \define@key{Hyp}{pdfauthor}{% \let\xmpcomma=\hyxmp@comma \def\xmpquote####1{####1}% + \let\hyxmp@and=\and + \def\and{,}% \hyxmp@Hyp@pdfauthor{##1}% \global\let\hyxmp@pdfauthor=\@pdfauthor + \def\and{and\space}% \def\xmpcomma{,}% \def\xmpquote####1{"####1"}% \hyxmp@Hyp@pdfauthor{##1}% \def\xmpcomma{,}% \let\xmpquote=\relax + \let\and=\hyxmp@and }% % \end{macrocode} % \begin{macro}{\hyxmp@Hyp@pdfkeywords} @@ -1135,6 +1160,8 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\hyxmp@ProcessKeyvalOptions} % \changes{v2.0}{2012/09/05}{Added this macro} @@ -1227,10 +1254,9 @@ provide metadata values to hyperxmp}% % which causes a literal ``|\@pdflang|'' to be written as \acro{XMP} % metadata. To avoid that situation we redefine |\@pdflang| as % |\@empty| if we see it set to |\relax|. -% \changes{v2.3a}{2013/04/16}{Bug fix: Redefine -% \texttt{\string\string\string\@pdflang} as -% \texttt{\string\string\string\@empty} when \pkgname{hyperref} has set -% it to \texttt{\string\string\string\relax}} +% \changes{v2.3a}{2013/04/16}{Bug fix: Redefine \cs{@pdflang} as +% \cs{@empty} when \protect\pkgname{hyperref} has set +% it to \cs{relax}} % \begin{macrocode} \ifx\@pdflang\relax \let\@pdflang=\@empty @@ -1238,15 +1264,14 @@ provide metadata values to hyperxmp}% % \end{macrocode} % If the author explicitly specified the language to use for the % document's metadata, we use that. If not, we use the document -% language, specified to \pkgname{hyperref} with the \optname{pdflang} +% language, specified to \pkgname{hyperref} with the \protect\optname{pdflang} % option. If the author did not specify a language, we use |x-default| % as the metadata language. -% \changes{v1.3}{2011/04/25}{Introduced the \texttt{pdfmetalang} package -% option, which enables an author to specify the language in which he +% \changes{v1.3}{2011/04/25}{Introduced the \protect\optname{pdfmetalang} +% package option, which enables an author to specify the language in which he % wrote the document's metadata} -% \changes{v2.0}{2012/08/02}{New -% \texttt{\string\string\string\AtBeginDocument} code from Heiko -% Oberdiek to properly encode \texttt{\string\string\string\@pdfmetalang}} +% \changes{v2.0}{2012/08/02}{New \cs{AtBeginDocument} code from Heiko +% Oberdiek to properly encode \cs{@pdfmetalang}} % \begin{macrocode} \ifx\@pdflang\@empty \let\@pdfmetalang=\hyxmp@x@default @@ -1263,23 +1288,44 @@ provide metadata values to hyperxmp}% \edef\hyxmp@today{\@pdfdatetime}% \fi % \end{macrocode} +% If the author left \optname{pdftitle} blank but specified |\title|, +% use the title for \optname{pdftitle}. Likewise, if the author left +% \optname{pdfauthor} blank but specified |\author|, use the author for +% \optname{pdfauthor}. +% \changes{v2.7}{2016/02/01}{Automatically use \cs{title} and \cs{author} +% if \protect\optname{pdftitle} and \protect\optname{pdfauthor} are left +% unspecified. Thanks to Maciej Radziejewski for the suggestion} +% \begin{macrocode} + \ifx\@pdftitle\@empty + \ifx\@title\@empty + \else + \hypersetup{pdftitle={\@title}}% + \fi + \fi + \ifx\@pdfauthor\@empty + \ifx\@author\@empty + \else + \hypersetup{pdfauthor={\@author}}% + \fi + \fi +% \end{macrocode} % We wait until the end of the document to construct the \acro{XMP} % packet and write it to the \acro{PDF} document catalog. This gives % the author ample opportunity to provide metadata to \pkgname{hyperref} % and thereby \pkgname{hyperxmp}. % \begin{macrocode} - \hyxmp@at@end{% - \hyxmp@find@metadata - \hyxmp@embed@packet - }% + \hyxmp@at@end{% + \hyxmp@find@metadata + \hyxmp@embed@packet }% - {\PackageWarningNoLine{hyperxmp}{% + }{% + \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}% - }% + }% } % \end{macrocode} % |