summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/attachfile/attachfile.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/attachfile/attachfile.dtx')
-rw-r--r--Master/texmf-dist/source/latex/attachfile/attachfile.dtx53
1 files changed, 33 insertions, 20 deletions
diff --git a/Master/texmf-dist/source/latex/attachfile/attachfile.dtx b/Master/texmf-dist/source/latex/attachfile/attachfile.dtx
index 1a0b5edb1da..96734f2fee0 100644
--- a/Master/texmf-dist/source/latex/attachfile/attachfile.dtx
+++ b/Master/texmf-dist/source/latex/attachfile/attachfile.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2011 by Scott Pakin <scott+af@pakin.org>
+% Copyright (C) 2015 by Scott Pakin <scott+af@pakin.org>
% -------------------------------------------------------
%
% This file may be distributed and/or modified under the conditions of
@@ -22,7 +22,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{attachfile}
%<*package>
- [2011/03/27 v1.5b PDF 1.3+ file attachment]
+ [2015/04/04 v1.6 PDF 1.3+ file attachment]
%</package>
%
%<*driver>
@@ -30,6 +30,7 @@
\usepackage{color}
\usepackage{xspace}
\usepackage[hyperindex=false,bookmarksopen=true]{attachfile}
+\usepackage{hyperxmp}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
@@ -84,7 +85,7 @@
%<*package>
% \fi
%
-% \CheckSum{493}
+% \CheckSum{502}
%
% \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
@@ -131,7 +132,16 @@
% pdftitle={The attachfile package},
% pdfauthor={Scott Pakin <scott+af@pakin.org>},
% pdfsubject={LaTeX file attachment package},
-% pdfkeywords={attachments; annotations; PDF; LaTeX; package; automatic; files}
+% pdfkeywords={file attachments, annotations, embedded, PDF, LaTeX},
+% pdfcopyright={Copyright (C) \the\year, Scott Pakin},
+% pdflicenseurl={http://www.latex-project.org/lppl.txt},
+% pdfcaptionwriter={Scott Pakin},
+% pdfcontactregion={New Mexico},
+% pdfcontactcountry={USA},
+% pdfcontactemail={scott+af@pakin.org},
+% pdfcontacturl={http://www.pakin.org/\xmptilde scott/},
+% baseurl={http://mirror.ctan.org/macros/latex/contrib/attachfile/attachfile.pdf},
+% pdflang={en-US}
% }
%
% ^^A Help prevent weird line breaks in URLs
@@ -1138,28 +1148,31 @@
% \end{macro}
%
% \begin{macro}{\atfi@embedfile}
-% \begin{macro}{\atfi@embedfileobj}
-% Embed a file as a \acronym{PDF} \pdfname{EmbeddedFile} object and store its
-% object number in |\atfi@embedfileobj|.
+% If the given file has not yet been embedded, embed it as a
+% \acronym{PDF} \pdfname{EmbeddedFile} object, and store its object
+% number in |\atfi@embedfile@|\meta{filename}.
% \changes{v1.3}{2007/01/15}{Included a \protect\pdfname{Params}
% dictionary describing the file's date, modification date, and size}
+% \changes{v1.6}{2015/04/04}{Don't re-embed files that have already been
+% embedded (feature proposed by Gareth Walker)}
% \begin{macrocode}
\DeclareRobustCommand{\atfi@embedfile}[1]{%
- \immediate\pdfobj stream attr {
- /Type /EmbeddedFile
- \atfi@mimetype\space
- \atfi@dlsize\space
- /Params <<
- \atfi@credate\space
- \atfi@moddate\space
- \atfi@size\space
- >>
- } file {#1}%
- \edef\atfi@embedfileobj{\the\pdflastobj}%
+ \expandafter\ifx\csname atfi@embed@file@#1\endcsname\relax
+ \immediate\pdfobj stream attr {
+ /Type /EmbeddedFile
+ \atfi@mimetype\space
+ \atfi@dlsize\space
+ /Params <<
+ \atfi@credate\space
+ \atfi@moddate\space
+ \atfi@size\space
+ >>
+ } file {#1}%
+ \expandafter\xdef\csname atfi@embed@file@#1\endcsname{\the\pdflastobj}%
+ \fi
}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
% \begin{macro}{\atfi@appearancewidth}
% \begin{macro}{\atfi@appearanceheight}
@@ -1291,7 +1304,7 @@
/Type /Filespec
/F (\atfi@file)
/EF <<
- /F \atfi@embedfileobj\space 0 R
+ /F \csname atfi@embed@file@#1\endcsname\space 0 R
>>
>>
}%