From fe377a8d868c079aee98aa6f2aae23b1ed55ce11 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Thu, 18 May 2017 21:44:40 +0000
Subject: pdfx (18may17)

git-svn-id: svn://tug.org/texlive/trunk@44412 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/source/latex/pdfx/pdfx.dtx | 147 ++++++++++++++++-----------
 1 file changed, 90 insertions(+), 57 deletions(-)

(limited to 'Master/texmf-dist/source/latex/pdfx/pdfx.dtx')

diff --git a/Master/texmf-dist/source/latex/pdfx/pdfx.dtx b/Master/texmf-dist/source/latex/pdfx/pdfx.dtx
index 741f895fe0f..1a636a76814 100644
--- a/Master/texmf-dist/source/latex/pdfx/pdfx.dtx
+++ b/Master/texmf-dist/source/latex/pdfx/pdfx.dtx
@@ -19,7 +19,7 @@
 %
 % \fi
 %
-% \CheckSum{3857}
+% \CheckSum{3939}
 % \iffalse
 %
 %<*driver>
@@ -28,7 +28,7 @@
 \providecommand{\thisyear}{2017}
 \begin{filecontents*}{./\jobname.xmpdata}
 \Title{Generation of PDF/X- and PDF/A-compliant PDFs with pdfTeX \textemdash\ pdfx.sty}
-\Author{\CVR\sep \Thanh\sep Ross~Moore\sep Peter Selinger}
+\Author{\CVR\sep \Thanh\sep Ross Moore\sep Peter Selinger}
 \Subject{This package supports generation of PDF/X-, PDF/A- and PDF/E-compliant documents, in most of their variants, using pdfLaTeX, LuaLaTeX and XeLaTeX.}
 \Keywords{PDF/X-, PDF/A- and PDF/E-compliance\sep Multilingual Metadata\sep installation\sep \TeX Live \thisyear}
 \PublicationType{manual}
@@ -36,10 +36,10 @@
 \Copyrighted{False}
 \CopyrightURL{http://tug.org/texlive/}
 \CoverDisplayDate{May \thisyear}
-\CoverDate{\thisyear-05-03}
+\CoverDate{\thisyear-05-17}
 \CreatorTool{pdfTeX + pdfx.sty with option \pdfxopt, from TeX Live \thisyear}
 \pdfxEnableCommands{%
- \def\CVR{C.V. Radhakrishnan}\def\Thanh{H^^c3^^a0n Th\eee Thanh}%
+ \def\CVR{C.V. Radhakrishnan}\def\Thanh{H\`an Th\eee Thanh}%
  \def\eee{^^c3^^aa^^cc^^81 }}
 \end{filecontents*}
 \documentclass[a4paper]{ltxdoc}
@@ -48,7 +48,7 @@
 \usepackage{graphicx}
 \usepackage[T1]{fontenc}
 \hypersetup{citecolor=blue}
-\EnableCrossrefs         
+\EnableCrossrefs
 \CodelineIndex
 \RecordChanges 
 \begin{document}
@@ -131,13 +131,16 @@
 %   Added support for XeLaTeX, improvements with LuaTeX. Updated documentation.} 
 % \changes{v1.5.82}{2017/05/12}{%
 %   Adjusted to changes in the LaTeX core, affecting macros for composite
-%   commands; incl. \textsuperscript and others.}%
+%   commands; incl. \texttt{\textbackslash textsuperscript} and others.}%
+% \changes{v1.5.83}{2017/05/16}{Improved support for XeLaTeX and LuaLaTeX.}%
+% \changes{v1.5.84}{2017/05/18}{Fully expand options for hyperref. Better support for 
+%   extended IPA letters and modifiers. Adjusted release versions and dates.}%
 % \title{Generation of PDF/X- and PDF/A-compliant PDFs
 %  with pdf\TeX{} --- \texttt{pdfx.sty}}
-% \date{2017/05/12}
-% \version{1.5.82}
+% \date{2017/05/18}
+% \version{1.5.84}
 % \keywords{PDF, PDF/A, PDF/X, pdf\TeX, \LaTeX, Multilingual Metadata}
-% \author{C.\,V.\,Radhakrishnan, \Thanh, Ross~Moore {\upshape\small
+% \author{C.\,V.\,Radhakrishnan, \Thanh, Ross Moore {\upshape\small
 % and} Peter Selinger}
 % \contact{\texttt{[cvr,thanh]@river-valley.org},\\%
 % \texttt{ross.moore@mq.edu.au}, \texttt{selinger@mathstat.dal.ca}\hss}
@@ -157,7 +160,7 @@
 % As of \TeX\,Live 2016 it now also works with Lua\LaTeX\ and Xe\LaTeX,
 % when using appropriate command-line options\footnote{%
 % The required invokation is:\quad
-%  |xelatex --shell-escape -output-driver="xdvipdfmx -z 0" <filename>.tex |}, but
+%  |xelatex --shell-escape <filename>.tex |}, but
 % with some limitations --- see Sections~\ref{sssec-xetex} and \ref{sssec-luatex}.
 % By `supports', we mean that the package provides correct and sufficient  
 % means to declare that a document conforms with a stated PDF variant
@@ -370,6 +373,8 @@
 % \item |noBOM|: do not generate the optional byte-order marker. (default)
 % \item |noerr|: avoids stopping when making PDF/X with an RGB profile,
 %  and at other unusual situations.
+% \item |pdf12|: use PDF 1.2, overriding the version specified by the
+% applicable standard.\\This may produce a non-standard-conforming PDF file.
 % \item |pdf13|: use PDF 1.3, overriding the version specified by the
 % applicable standard.\\This may produce a non-standard-conforming PDF file.
 % \item |pdf14|: use PDF 1.4, overriding the version specified by the
@@ -407,11 +412,12 @@
 %    and |Ux1D00|--|Ux1DFF|
 % \item |mathxmp|: mathematical letters, symbols, operators 
 %    arrows, alphanumeric forms. 
-% \item |allxmp|: all of the above, as well as those listed next.
+% \item |allxmp|: all of the above, as well as those listed next;
+%    used primarily for testing compatibility with other packages.
 % \end{itemize}
 % The characters supported by these options include those supported
 % by |hyperref.sty| via the |PDFdoc| encodings (|PD1| and |PU|)
-% for inclusion in PDF files. Extra supported is provided for math
+% for inclusion in PDF files. Extra support is provided for math
 % alphabets. For Armenian, the macros defined by Arm\TeX\ are supported.
 %
 % \medskip
@@ -882,7 +888,7 @@
 % \subsection{Limitations and dependencies}
 % 
 % The |pdfx.sty| package works with \pdftex\ and also Lua\TeX\ and Xe\TeX\ 
-% with some limitations.  
+% with some minor limitations.  
 % It further depends on the following other packages.
 % \begin{enumerate}
 %  \item |xmpincl|  for insertion of metadata into PDF.
@@ -946,7 +952,7 @@
 % validate to a particular PDF standard, one need to use a command
 % to run the \TeX\ engine, as follows.
 % \begin{decl}[]
-%   |xelatex -shell-escape -output-driver="xdvipdfmx -z 0" <filename>.tex |
+%   |xelatex -shell-escape <filename>.tex |
 % \end{decl}
 % The |-shell-escape| option allows a command-line task to be run,
 % which writes the creation-date \& time of the running job into 
@@ -957,14 +963,6 @@
 % this need for |-shell-escape| must be viewed as imposing a limitation on the 
 % work-flows in which this can be safely used.
 %
-% More severe is the need for the |-z 0| output-driver option, which disables 
-% all compression in the final PDF output.
-% This is needed since all the PDF standards require the XMP metadata
-% packet to be present as uncompressed plain text, in UTF-8 format.
-% The only way to achieve this with Xe\LaTeX\ is for no compression being
-% used at all by the |xdvipdfmx| driver program. The result can be file sizes
-% more than $10\times$ what is produced by \TeX\ engines using compression.
-%
 % Xe\TeX\ is designed for processing UTF-8 input only. When presented
 % with a \LaTeX\ source using a legacy encoding, such as |latin2| or |koi8-r|, 
 % the input is accepted and a PDF produced. Yet there will be garbage 
@@ -1541,7 +1539,7 @@
 % |\textaristerikeraia\textalpha\textsampi\textqoppa\textzeta\textdexiakeraia|
 % \end{decl}
 % The corresponding trick does not work with |\Greeknumeral|, but the uppercasing
-% can be done by manually from the string obtained using |\greeknumeral|,
+% can be done manually from the string obtained using |\greeknumeral|,
 % \begin{decl}[]
 % |\textaristerikeraia\textAlpha\textSampi\textQoppa\textZeta\textdexiakeraia|
 % \end{decl}
@@ -1884,7 +1882,8 @@
 % Several other `rebinding' commands are defined, mostly with package-loading options.
 %\begin{itemize}
 % \item |\LIIXUmapTeXnames| always defined
-% \item |\LIIXUscriptcommands| handles |\textsuperscript|, |\textsubscript|
+% \item |\LIIXUscriptcommands| handles |\textsuperscript|, |\textsubscript|, |\t|
+% \item |\LIIXUtipacommands| handles IPA letters and symbols
 % \item |\LIIXUmaparabicletters| with |arbxmp|
 % \item |\LIIXUmapgreekletters| with |grkxmp| and |LGRxmp|
 % \item |\LIIXUmaplatinchars| and |\LIIXUcancelfontswitches| with |LATxmp|
@@ -2241,7 +2240,7 @@
 }{}%
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{pdfx}
-  [2016/05/03 v1.5.8 PDF/X and PDF/A support (CVR/HTH/RRM/PS)]
+  [2017/05/18 v1.5.84 PDF/X and PDF/A support (CVR/HTH/RRM/PS)]
 
 \newif\ifpdfx@noBOM \pdfx@noBOMfalse   % use a BOM in the XMP packet
 \newif\ifpdfx@x \pdfx@xfalse   % PDF/X mode
@@ -2374,6 +2373,7 @@
   \global\pdfminorversion=6 }
 
 %% options to alter PDF minor version, in case needed in special circumstances
+\DeclareOption{pdf12}{\global\pdfminorversion=2 }
 \DeclareOption{pdf13}{\global\pdfminorversion=3 }
 \DeclareOption{pdf14}{\global\pdfminorversion=4 }
 \DeclareOption{pdf15}{\global\pdfminorversion=5 }
@@ -2437,10 +2437,14 @@
  \global\vnmxmptrue
  \global\latEXTxmptrue
  \global\latLATxmptrue
+ \global\vnmxmptrue
  \global\ipaxmptrue
  \global\mathxmptrue
+ \global\let\pdfx@useactivespacestrue\pdfx@useactivespacesfalse
 }
 
+\newif\ifpdfx@useactivespaces
+
 \ExecuteOptions{noBOM,a-1b}
 \ProcessOptions
 
@@ -2460,7 +2464,6 @@
  \ifarmSCIxmp\pdfx@nopdfinfotrue
 \fi\fi\fi\fi\fi
 
-\newif\ifpdfx@useactivespaces
 \iflatLATxmp\pdfx@useactivespacestrue\fi
 \ifgrkLGRxmp\pdfx@useactivespacestrue\fi
 \ifcyrKOIxmp\pdfx@useactivespacestrue\fi
@@ -2592,14 +2595,14 @@
  \fi
 \fi
 
-\ifluatex\else
+\ifluatex\else\ifxetex\else
  \@ifpackageloaded{inputenc}{%
  }{%
   \RequirePackage{inputenc}
  % allow this to be loaded again cleanly
  \expandafter\let\csname ver@inputenc.sty\endcsname\relax
  }
-\fi
+\fi\fi
 
 %% pseudo-declare the L8U encoding
 \expandafter\let\csname L8U-cmd\expandafter\endcsname\csname OT1-cmd\endcsname
@@ -2756,6 +2759,7 @@
  \liixu@enablenumberline
  \def\empty{}% used in LICR patterns
  \LIIXUscriptcommands
+ \LIIXUtipacommands
  \LIIXUmapTeXnames
 %%  from Hyperref's  psdextra.def
  \csname psdmapshortnames\endcsname
@@ -2874,12 +2878,12 @@
    \PackageWarning{pdfx}{%
     CreationDate is not properly supported;^^J
     PDF validation may fail. To avoid this problem use:^^J
-     xelatex -shell-escape -output-driver="xdvipdfmx -z 0" <filename>^^J}
+     xelatex -shell-escape <filename>^^J}
   \else
    \PackageError{pdfx}{%
     CreationDate is not properly supported;^^J
     PDF validation may fail.}{To avoid this problem use:^^J
-     xelatex -shell-escape -output-driver="xdvipdfmx -z 0" <filename> }
+     xelatex -shell-escape <filename> }
   \fi
  \fi
 \fi
@@ -2942,74 +2946,74 @@
 %% the "pdftex" option seems to work fine with LuaTeX
 
 %% Hyperref options for PDF/X
-\def\pdfx@pdfX@opts@pdftex{%
+\edef\pdfx@pdfX@opts@pdftex{%
   draft,pdftex,pdfpagemode=UseNone,bookmarks=false,%
     pdfversion=1.\thepdfminorversion,pdfstartview=}
-\def\pdfx@pdfX@opts@xetex{%
+\edef\pdfx@pdfX@opts@xetex{%
   draft,xetex,pdfpagemode=UseNone,bookmarks=false,%
   pdfversion=1.\thepdfminorversion,pdfstartview=}
-\def\pdfx@pdfX@opts@luatex{%
-  draft,pdftex,pdfpagemode=UseNone,bookmarks=false,%
+\edef\pdfx@pdfX@opts@luatex{%
+  draft,luatex,pdfpagemode=UseNone,bookmarks=false,%
   pdfversion=1.\thepdfminorversion,pdfstartview=}
 
 %% Hyperref options for PDF/A and PDF/E
-\def\pdfx@pdfAE@opts@pdftex{pdftex,pdfa,pdfversion=1.\thepdfminorversion}%
-\def\pdfx@pdfAE@opts@xetex{xetex,pdfa,pdfversion=1.\thepdfminorversion}%
-\def\pdfx@pdfAE@opts@luatex{pdftex,pdfa,pdfversion=1.\thepdfminorversion}%
+\edef\pdfx@pdfAE@opts@pdftex{pdftex,pdfa,pdfversion=1.\thepdfminorversion}%
+\edef\pdfx@pdfAE@opts@xetex{xetex,pdfa,pdfversion=1.\thepdfminorversion}%
+\edef\pdfx@pdfAE@opts@luatex{luatex,pdfa,pdfversion=1.\thepdfminorversion}%
     
 \ifpdfx@x
  \@ifpackageloaded{hyperref}{%
   \ifxetex
-   \hypersetup{\pdfx@pdfX@opts@xetex}
+   \expandafter\hypersetup\expandafter{\pdfx@pdfX@opts@xetex}
   \else\ifluatex
-   \hypersetup{\pdfx@pdfX@opts@luatex}
+   \expandafter\hypersetup\expandafter{\pdfx@pdfX@opts@luatex}
   \else
-   \hypersetup{\pdfx@pdfX@opts@pdftex}
+   \expandafter\hypersetup\expandafter{\pdfx@pdfX@opts@pdftex}
   \fi\fi
  }{%
   \ifxetex
-   \RequirePackage[\pdfx@pdfX@opts@xetex]{hyperref}
+   \expandafter\RequirePackage\expandafter[\pdfx@pdfX@opts@xetex]{hyperref}
   \else\ifluatex
-   \RequirePackage[\pdfx@pdfX@opts@luatex]{hyperref}
+   \expandafter\RequirePackage\expandafter[\pdfx@pdfX@opts@luatex]{hyperref}
   \else
-   \RequirePackage[\pdfx@pdfX@opts@pdftex]{hyperref}
+   \expandafter\RequirePackage\expandafter[\pdfx@pdfX@opts@pdftex]{hyperref}
   \fi\fi
  }%
 \else
  \ifpdfx@e
   \@ifpackageloaded{hyperref}{%
    \ifxetex
-    \hypersetup{\pdfx@pdfAE@opts@xetex}
+    \expandafter\hypersetup\expandafter{\pdfx@pdfAE@opts@xetex}
    \else\ifluatex
-    \hypersetup{\pdfx@pdfAE@opts@luatex}
+    \expandafter\hypersetup\expandafter{\pdfx@pdfAE@opts@luatex}
    \else
-    \hypersetup{\pdfx@pdfAE@opts@pdftex}
+    \expandafter\hypersetup\expandafter{\pdfx@pdfAE@opts@pdftex}
    \fi\fi
   }{%
    \ifxetex
-    \RequirePackage[\pdfx@pdfAE@opts@xetex]{hyperref}
+    \expandafter\RequirePackage\expandafter[\pdfx@pdfAE@opts@xetex]{hyperref}
    \else\ifluatex
-    \RequirePackage[\pdfx@pdfAE@opts@luatex]{hyperref}
+    \expandafter\RequirePackage\expandafter[\pdfx@pdfAE@opts@luatex]{hyperref}
    \else
-    \RequirePackage[\pdfx@pdfAE@opts@pdftex]{hyperref}
+    \expandafter\RequirePackage\expandafter[\pdfx@pdfAE@opts@pdftex]{hyperref}
    \fi\fi
   }%
  \else % generating PDF/A or ...
   \@ifpackageloaded{hyperref}{%
    \ifxetex
-    \hypersetup{\pdfx@pdfAE@opts@xetex}%
+    \expandafter\hypersetup\expandafter{\pdfx@pdfAE@opts@xetex}%
    \else\ifluatex
-    \hypersetup{\pdfx@pdfAE@opts@luatex}%
+    \expandafter\hypersetup\expandafter{\pdfx@pdfAE@opts@luatex}%
    \else
-    \hypersetup{\pdfx@pdfAE@opts@pdftex}%
+    \expandafter\hypersetup\expandafter{\pdfx@pdfAE@opts@pdftex}%
    \fi\fi
   }{%
    \ifxetex
-    \RequirePackage[\pdfx@pdfAE@opts@xetex]{hyperref}
+    \expandafter\RequirePackage\expandafter[\pdfx@pdfAE@opts@xetex]{hyperref}
    \else\ifluatex
-    \RequirePackage[\pdfx@pdfAE@opts@luatex]{hyperref}
+    \expandafter\RequirePackage\expandafter[\pdfx@pdfAE@opts@luatex]{hyperref}
    \else
-    \RequirePackage[\pdfx@pdfAE@opts@pdftex]{hyperref}
+    \expandafter\RequirePackage\expandafter[\pdfx@pdfAE@opts@pdftex]{hyperref}
    \fi\fi
  }%
 \fi\fi
@@ -3018,6 +3022,11 @@
  \hypersetup{psdextra}
 \fi
 
+%% hyperref doesn't set the minor version for XeTeX
+\ifxetex
+ \special{pdf:minorversion \thepdfminorversion}
+\fi
+
 \ifx\xmp@CreatorTool\@empty
  \edef\xmp@CreatorTool{\@pdfcreator}
 \fi
@@ -3588,9 +3597,9 @@
   \global\let#1\empty
  \else
   \begingroup
-   \ifluatex\else
+   \ifluatex\else\ifxetex\else
     \inputencoding{utf8}%
-   \fi
+   \fi\fi
    \hypersetup{pdfencoding=auto}%
    \pdfstringdef#1{#2}%
   \endgroup
@@ -3932,6 +3941,30 @@
  \let\includexmp\pdfx@xmpincl@xetex
 \fi
 
+%% macro provided by Leonardo E. Segovia on 2007-05-15
+%% <leonardo.segovia@cs.uns.edu.ar>
+\def\pdfx@xmpincl@luatex#1{%
+ \IfFileExists{#1.xmp}{%
+   \mcs@xmpincl@patchFile{#1}%
+   \begingroup
+   \pdfcompresslevel=0
+   \immediate\pdfobj uncompressed stream attr {/Type /Metadata /Subtype /XML}
+   file{#1.xmpi}%
+   \pdfcatalog{/Metadata \the\pdflastobj\space 0 R}%
+   \endgroup
+ }{%
+  \newcommand{\mcs@xmpincl@filename}{#1.xmp}%
+   \PackageError{xmpincl}%
+   {The file \mcs@xmpincl@filename\space was not found}%
+   {The file \mcs@xmpincl@filename\space The metadata file
+     wasn't found.\MessageBreak Oops.}%
+ }
+}
+\ifluatex
+ \let\includexmp\pdfx@xmpincl@luatex
+\fi
+
+
 %%----------------------------------------------------------------------
 \begingroup
  \ifpdfx@x
-- 
cgit v1.2.3

