summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/oberdiek/embedfile.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/embedfile.dtx')
-rw-r--r--Master/texmf-dist/source/latex/oberdiek/embedfile.dtx193
1 files changed, 119 insertions, 74 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/embedfile.dtx b/Master/texmf-dist/source/latex/oberdiek/embedfile.dtx
index beb7675f472..a6bc8487e13 100644
--- a/Master/texmf-dist/source/latex/oberdiek/embedfile.dtx
+++ b/Master/texmf-dist/source/latex/oberdiek/embedfile.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2006, 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
+% Copyright (C) 2006-2009 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
@@ -75,7 +75,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: embedfile 2007/11/25 v2.3 embed files into PDF (HO)}
+\Msg{* Package: embedfile 2009/09/25 v2.4 embed files into PDF (HO)}
\Msg{************************************************************************}
\keepsilent
@@ -86,7 +86,7 @@
This is a generated file.
-Copyright (C) 2006, 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
+Copyright (C) 2006-2009 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
@@ -152,7 +152,7 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{embedfile.drv}%
- [2007/11/25 v2.3 embed files into PDF (HO)]%
+ [2009/09/25 v2.4 embed files into PDF (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}[2008/08/11]
\begin{document}
@@ -161,7 +161,7 @@ and the derived files
%</driver>
% \fi
%
-% \CheckSum{1396}
+% \CheckSum{1418}
%
% \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
@@ -182,7 +182,7 @@ and the derived files
% \GetFileInfo{embedfile.drv}
%
% \title{The \xpackage{embedfile} package}
-% \date{2007/11/25 v2.3}
+% \date{2009/09/25 v2.4}
% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}}
%
% \maketitle
@@ -261,10 +261,24 @@ and the derived files
% \item[\xoption{filespec}]
% This allows to override the file name
% that appears in the PDF file. If you are using other than
-% simple file names (8bit, path separators, \dots), look into
+% simple file names (8-bit, path separators, \dots), look into
% the PDF specification (\cite{pdfspec}).
-% There are rules how these file names
-% must be written/encoded.
+% There are rules how these file names must be written/encoded.
+% Avoid 8-bit characters
+% and other special characters, the behaviour is currently undefined.
+% Use option \xoption{ucfilespec} for more funny file names.
+% The string method, see below, is |escape| since version 2.4.
+%
+% This name is also used as entry in a name tree
+% (see PDF specification: |/EmbeddedFiles|). Therefore the
+% value for \xoption{filespec} must be unique among all
+% embedded files. Also key \xoption{initialfiles} refers
+% to this name, if the file name and the value of \xoption{filespec}
+% are different.
+% \item[\xoption{ucfilespec}]
+% Since PDF 1.7 the file name may be provided in Unicode.
+% The conversion of the option value into a PDF string
+% is controlled by option \xoption{stringmethod}.
% \item[\xoption{filesystem}]
% This sets the entry \verb|/FS| in
% the file specification dictionary, see PDF specification
@@ -277,8 +291,9 @@ and the derived files
% \item[\xoption{desc}]
% The description for the file.
% \item[\xoption{stringmethod}]
-% The package must convert the values of the keys \xoption{filespec}
-% and \xoption{desc} into a PDF string. If \xpackage{hyperref}
+% The package must convert the values of the keys \xoption{ucfilespec}
+% and \xoption{desc} into a PDF string (before version 2.4: \xoption{filespec}
+% and \xoption{desc}). If \xpackage{hyperref}
% is found, then its \cs{pdfstringdef} will be used, otherwise
% \pdfTeX's \cs{pdfescapestring} is used. Value \verb|psd|
% forces the use of \cs{pdfstringdef}, value \verb|escape|
@@ -356,7 +371,10 @@ and the derived files
% \item[\xoption{initialfile}]
% Selects the file that is initially presented. Especially
% useful for an embedded PDF file that is then shown instead
-% of the cover document.
+% of the cover document. There must be an \cs{embedfile} command
+% somewhere whose value for key \xoption{filespec} is used here.
+% The \cs{embedfile} command can drop option \xoption{filespec}
+% if the file name is not different.
% \end{description}
%
% \begin{declcs}{embedfilefield} \M{key} \M{options}
@@ -518,7 +536,7 @@ This example document contains three embedded files.
\usepackage[bookmarks=false]{hyperref}
% provides \pdfstringdef that is then used by `title' and
% other keys.
-\usepackage{embedfile}[2007/11/25]
+\usepackage{embedfile}[2009/09/25]
\embedfilesetup{
view=details,
initialfile=embedfile.pdf
@@ -586,8 +604,8 @@ You need Acrobat Reader 8 or higher.
%<*dtxattach>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{dtx-attach}
- [2007/11/25 v2.3 Embed \string\jobname.dtx (HO)]%
-\RequirePackage{embedfile}[2007/11/25]
+ [2009/09/25 v2.4 Embed \string\jobname.dtx (HO)]%
+\RequirePackage{embedfile}[2009/09/25]
\embedfile[%
stringmethod=escape,%
mimetype=plain/text,%
@@ -671,7 +689,7 @@ You need Acrobat Reader 8 or higher.
\fi
\expandafter\x\csname ver@embedfile.sty\endcsname
\ProvidesPackage{embedfile}%
- [2007/11/25 v2.3 embed files into PDF (HO)]
+ [2009/09/25 v2.4 embed files into PDF (HO)]
% \end{macrocode}
%
% \subsection{Catcodes}
@@ -758,6 +776,7 @@ You need Acrobat Reader 8 or higher.
% \end{macrocode}
% \begin{macrocode}
\EmFi@RequirePackage{pdftexcmds}[2007/11/11]
+\EmFi@RequirePackage{ltxcmds}[2009/08/05]
% \end{macrocode}
% Check version.
% \begin{macrocode}
@@ -869,11 +888,6 @@ You need Acrobat Reader 8 or higher.
\newif\ifEmFi@collection
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\ifEmFi@initialfile}
-% \begin{macrocode}
-\newif\ifEmFi@initialfile
-% \end{macrocode}
-% \end{macro}
% \begin{macro}{\ifEmFi@sort}
% \begin{macrocode}
\newif\ifEmFi@sort
@@ -1041,6 +1055,10 @@ You need Acrobat Reader 8 or higher.
% \begin{macrocode}
\EmFi@DefineKey{filespec}{\EmFi@file}
% \end{macrocode}
+% File specification string in Unicode.
+% \begin{macrocode}
+\EmFi@DefineKey{ucfilespec}{}
+% \end{macrocode}
% File system (optional).
% \begin{macrocode}
\EmFi@DefineKey{filesystem}{}
@@ -1086,27 +1104,13 @@ You need Acrobat Reader 8 or higher.
% \begin{macrocode}
\def\embedfileifobjectexists#1#2{%
\expandafter\ifx\csname EmFi@#2@#1\endcsname\relax
- \expandafter\@secondoftwo
+ \expandafter\ltx@secondoftwo
\else
- \expandafter\@firstoftwo
+ \expandafter\ltx@firstoftwo
\fi
}
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\@firstoftwo}
-% \begin{macrocode}
-\expandafter\ifx\csname @firstoftwo\endcsname\relax
- \long\def\@firstoftwo#1#2{#1}%
-\fi
-% \end{macrocode}
-% \end{macro}
-% \begin{macro}{\@secondoftwo}
-% \begin{macrocode}
-\expandafter\ifx\csname @secondoftwo\endcsname\relax
- \long\def\@secondoftwo#1#2{#2}%
-\fi
-% \end{macrocode}
-% \end{macro}
% \begin{macro}{\embedfilegetobject}
% \begin{macrocode}
\def\embedfilegetobject#1#2{%
@@ -1126,7 +1130,7 @@ You need Acrobat Reader 8 or higher.
\def\EmFi@next{%
\global\EmFi@collectiontrue
}%
- \ifx\EmFi@temp\empty
+ \ifx\EmFi@temp\ltx@empty
\let\EmFi@view\EmFi@S@details
\else\ifx\EmFi@temp\EmFi@S@details
\let\EmFi@view\EmFi@S@details
@@ -1293,13 +1297,13 @@ You need Acrobat Reader 8 or higher.
`\EmFi@S@descending
}\@ehc
\fi\fi
- \ifx\EmFi@temp\empty
+ \ifx\EmFi@temp\ltx@empty
\else
\xdef\EmFi@sortkeys{%
\EmFi@sortkeys
/\pdf@escapename{#1}%
}%
- \ifx\EmFi@sortorders\empty
+ \ifx\EmFi@sortorders\ltx@empty
\global\let\EmFi@sortorders\EmFi@temp
\gdef\EmFi@sortcase{1}%
\else
@@ -1425,9 +1429,6 @@ You need Acrobat Reader 8 or higher.
\else
\begingroup
\def\EmFi@file{#2}%
- \ifx\EmFi@file\EmFi@initialfile
- \global\EmFi@initialfiletrue
- \fi
\setkeys{EmFi}{#1}%
\expandafter\expandafter\expandafter
\ifx\expandafter\expandafter\expandafter
@@ -1438,9 +1439,16 @@ You need Acrobat Reader 8 or higher.
The unknown file is not embedded.%
}%
\else
- \EmFi@convert\EmFi@filespec\EmFi@@filespec
- \ifx\EmFi@desc\empty
- \let\EmFi@@desc\empty
+ \edef\EmFi@@filespec{%
+ \pdf@escapestring{\EmFi@filespec}%
+ }%
+ \ifx\EmFi@ucfilespec\ltx@empty
+ \let\EmFi@@ucfilespec\ltx@empty
+ \else
+ \EmFi@convert\EmFi@ucfilespec\EmFi@@ucfilespec
+ \fi
+ \ifx\EmFi@desc\ltx@empty
+ \let\EmFi@@desc\ltx@empty
\else
\EmFi@convert\EmFi@desc\EmFi@@desc
\fi
@@ -1455,7 +1463,7 @@ You need Acrobat Reader 8 or higher.
\fi
\immediate\pdfobj stream attr{%
/Type/EmbeddedFile%
- \ifx\EmFi@mimetype\empty
+ \ifx\EmFi@mimetype\ltx@empty
\else
/Subtype/\pdf@escapename{\EmFi@mimetype}%
\fi
@@ -1469,12 +1477,16 @@ You need Acrobat Reader 8 or higher.
\immediate\pdfobj{%
<<%
/Type/Filespec%
- \ifx\EmFi@filesystem\empty
+ \ifx\EmFi@filesystem\ltx@empty
\else
/FS/\pdf@escapename{\EmFi@filesystem}%
\fi
/F(\EmFi@@filespec)%
- \ifx\EmFi@@desc\empty
+ \ifx\EmFi@@ucfilespec\ltx@empty
+ \else
+ /UF(\EmFi@@ucfilespec)%
+ \fi
+ \ifx\EmFi@@desc\ltx@empty
\else
/Desc(\EmFi@@desc)%
\fi
@@ -1529,7 +1541,7 @@ You need Acrobat Reader 8 or higher.
% \end{macrocode}
% \end{macro}
% \begin{macrocode}
-\global\let\EmFi@list\empty
+\global\let\EmFi@list\ltx@empty
% \end{macrocode}
% \begin{macro}{\EmFi@add}
% Sorting is done by the insertion sort algorithm.
@@ -1540,16 +1552,15 @@ You need Acrobat Reader 8 or higher.
% \begin{macrocode}
\def\EmFi@add#1#2{%
\begingroup
- \edef\key{\pdf@escapehex{#1}}%
- \ifx\EmFi@list\empty
- \xdef\EmFi@list{\noexpand\do{\key}{#2}}%
+ \ifx\EmFi@list\ltx@empty
+ \xdef\EmFi@list{\noexpand\do{#1}{#2}}%
\else
\def\do##1##2{%
- \ifnum\pdf@strcmp{##1}{\key}>0 %
+ \ifnum\pdf@strcmp{##1}{#1}>0 %
\edef\x{%
\toks@{%
\the\toks@%
- \noexpand\do{\key}{#2}%
+ \noexpand\do{#1}{#2}%
\noexpand\do{##1}{##2}%
}%
}%
@@ -1565,7 +1576,7 @@ You need Acrobat Reader 8 or higher.
\fi
}%
\def\stop{%
- \xdef\EmFi@list{\the\toks@\noexpand\do{\key}{#2}}%
+ \xdef\EmFi@list{\the\toks@\noexpand\do{#1}{#2}}%
}%
\toks@{}%
\EmFi@list\stop
@@ -1584,7 +1595,7 @@ You need Acrobat Reader 8 or higher.
The list of embedded files is already written.%
}%
\else
- \ifx\EmFi@list\empty
+ \ifx\EmFi@list\ltx@empty
\else
% \end{macrocode}
% Write |/EmbeddedFiles| entry.
@@ -1592,7 +1603,7 @@ You need Acrobat Reader 8 or higher.
\global\EmFi@finishedtrue
\begingroup
\def\do##1##2{%
- <##1>##2%
+ (##1)##2%
}%
\immediate\pdfobj{%
<<%
@@ -1606,21 +1617,40 @@ You need Acrobat Reader 8 or higher.
% \end{macrocode}
% Write collection objects.
% \begin{macrocode}
- \ifEmFi@initialfile
+ \ifx\EmFi@initialfile\ltx@empty
+ \else
\EmFi@collectiontrue
\fi
\ifEmFi@collection
- \ifEmFi@initialfile
+ \ifx\EmFi@initialfile\ltx@empty
+ \let\EmFi@@initialfile\ltx@empty
\else
- \ifx\EmFi@initialfile\empty
- \EmFi@convert\EmFi@initialfile\EmFi@initialfile
- \else
- \@PackageWarningNoLine{embedfile}{%
- Missing initial file `\EmFi@initialfile'\MessageBreak
- among the embedded files%
- }%
- \EmFi@initialfilefalse
- \fi
+ \edef\EmFi@@initialfile{%
+ \pdf@escapestring{\EmFi@initialfile}%
+ }%
+ \fi
+% \end{macrocode}
+% Look for initial file among the embedded files.
+% \begin{macrocode}
+ \begingroup
+ \let\f=N%
+ \def\do##1##2{%
+ \def\x{##1}%
+ \ifx\x\EmFi@@initialfile
+ \let\f=Y%
+ \let\do\ltx@gobbletwo
+ \fi
+ }%
+ \EmFi@list
+ \expandafter\endgroup
+ \ifx\f Y%
+ \else
+ \@PackageWarningNoLine{embedfile}{%
+ Missing initial file `\EmFi@initialfile'\MessageBreak
+ among the embedded files%
+ }%
+ \let\EmFi@initialfile\ltx@empty
+ \let\EmFi@@initialfile\ltx@empty
\fi
\ifcase\EmFi@sortcase
\def\EmFi@temp{}%
@@ -1642,19 +1672,20 @@ You need Acrobat Reader 8 or higher.
}%
\immediate\pdfobj{%
<<%
- \ifx\EmFi@schema\empty
+ \ifx\EmFi@schema\ltx@empty
\else
/Schema<<\EmFi@schema>>%
\fi
- \ifEmFi@initialfile
- /D(\EmFi@initialfile)%
+ \ifx\EmFi@@initialfile\ltx@empty
+ \else
+ /D(\EmFi@@initialfile)%
\fi
\ifx\EmFi@view\EmFi@S@tile
/View/T%
\else\ifx\EmFi@view\EmFi@S@hidden
/View/H%
\fi\fi
- \ifx\EmFi@temp\empty
+ \ifx\EmFi@temp\ltx@empty
\EmFi@temp
\else
/Sort<<\EmFi@temp>>%
@@ -1806,7 +1837,7 @@ Test (plain-\TeX): {\tt embedfile.dtx} should be embedded.%
\NeedsTeXFormat{LaTeX2e}
\let\SavedJobname\jobname
\def\jobname{embedfile}
-\RequirePackage{dtx-attach}[2007/11/25]
+\RequirePackage{dtx-attach}[2009/09/25]
\let\jobname\SavedJobname
\documentclass{minimal}
\begin{document}
@@ -2063,6 +2094,20 @@ Test (plain-\TeX): {\tt embedfile.dtx} should be embedded.%
% \item
% Fix in use of \cs{pdf@filesize}, bug introduced in previous version.
% \end{Version}
+% \begin{Version}{2009/09/25 v2.4}
+% \item
+% Bug fix: If \xpackage{hyperref} is used with option \xoption{unicode},
+% the Unicode encoded file name causes trouble. Therefore \cs{pdfstringdef}
+% is now never used for option \xoption{filespec}, always method
+% \texttt{escape} is applied (Peter Cibulka).
+% \item
+% Bug fix for \xoption{initialfile}.
+% \item
+% Bug fix for file names in \texttt{/EmbeddedFiles}.
+% \item
+% New option \xoption{ucfilespec} for file name support in Unicode
+% (since PDF 1.7).
+% \end{Version}
% \end{History}
%
% \PrintIndex