Debian Codegraph @

texmf-dist/source/latex/embedfile/embedfile.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: embedfile.dtx
4 % Version: 2025-10-27 v2.13
5 % Info: Embed files into PDF
6 %
7 % Copyright (C)
8 % 2006-2011 Heiko Oberdiek
9 % 2016-2025 Oberdiek Package Support Group
10 % https://github.com/ho-tex/embedfile/issues
11 %
12 % This work may be distributed and/or modified under the
13 % conditions of the LaTeX Project Public License, either
14 % version 1.3c of this license or (at your option) any later
15 % version. This version of this license is in
16 % https://www.latex-project.org/lppl/lppl-1-3c.txt
17 % and the latest version of this license is in
18 % https://www.latex-project.org/lppl.txt
19 % and version 1.3 or later is part of all distributions of
20 % LaTeX version 2005/12/01 or later.
21 %
22 % This work has the LPPL maintenance status "maintained".
23 %
24 % The Current Maintainers of this work are
25 % Heiko Oberdiek and the Oberdiek Package Support Group
26 % https://github.com/ho-tex/embedfile/issues
27 %
28 % The Base Interpreter refers to any `TeX-Format',
29 % because some files are installed in TDS:tex/generic//.
30 %
31 % This work consists of the main source file embedfile.dtx
32 % and the derived files
33 % embedfile.sty, embedfile.pdf, embedfile.ins, embedfile.drv,
34 % dtx-attach.sty, embedfile-example-plain.tex,
35 % embedfile-example-collection.tex, embedfile-test1.tex,
36 % embedfile-test2.tex, embedfile-test3.tex,
37 % embedfile-test4.tex.
38 %
39 % Distribution:
40 % CTAN:macros/latex/contrib/embedfile/embedfile.dtx
41 % CTAN:macros/latex/contrib/embedfile/embedfile.pdf
42 %
43 % Unpacking:
44 % (a) If embedfile.ins is present:
45 % tex embedfile.ins
46 % (b) Without embedfile.ins:
47 % tex embedfile.dtx
48 % (c) If you insist on using LaTeX
49 % latex \let\install=y\input{embedfile.dtx}
50 % (quote the arguments according to the demands of your shell)
51 %
52 % Documentation:
53 % (a) If embedfile.drv is present:
54 % latex embedfile.drv
55 % (b) Without embedfile.drv:
56 % latex embedfile.dtx; ...
57 % The class ltxdoc loads the configuration file ltxdoc.cfg
58 % if available. Here you can specify further options, e.g.
59 % use A4 as paper format:
60 % \PassOptionsToClass{a4paper}{article}
61 %
62 % Program calls to get the documentation (example):
63 % pdflatex embedfile.dtx
64 % makeindex -s gind.ist embedfile.idx
65 % pdflatex embedfile.dtx
66 % makeindex -s gind.ist embedfile.idx
67 % pdflatex embedfile.dtx
68 %
69 % Installation:
70 % TDS:tex/generic/embedfile/embedfile.sty
71 % TDS:tex/generic/embedfile/dtx-attach.sty
72 % TDS:doc/latex/embedfile/embedfile.pdf
73 % TDS:doc/latex/embedfile/embedfile-example-plain.tex
74 % TDS:doc/latex/embedfile/embedfile-example-collection.tex
75 % TDS:source/latex/embedfile/embedfile.dtx
76 %
77 %<*ignore>
78 \begingroup
79 \catcode123=1 %
80 \catcode125=2 %
81 \def\x{LaTeX2e}%
82 \expandafter\endgroup
83 \ifcase 0\ifx\install y1\fi\expandafter
84 \ifx\csname processbatchFile\endcsname\relax\else1\fi
85 \ifx\fmtname\x\else 1\fi\relax
86 \else\csname fi\endcsname
87 %</ignore>
88 %<*install>
89 \input docstrip.tex
90 \Msg{************************************************************************}
91 \Msg{* Installation}
92 \Msg{* Package: embedfile 2025-10-27 v2.13 Embed files into PDF (HO)}
93 \Msg{************************************************************************}
94
95 \keepsilent
96 \askforoverwritefalse
97
98 \let\MetaPrefix\relax
99 \preamble
100
101 This is a generated file.
102
103 Project: embedfile
104 Version: 2025-10-27 v2.13
105
106 Copyright (C)
107 2006-2011 Heiko Oberdiek
108 2016-2025 Oberdiek Package Support Group
109
110 This work may be distributed and/or modified under the
111 conditions of the LaTeX Project Public License, either
112 version 1.3c of this license or (at your option) any later
113 version. This version of this license is in
114 https://www.latex-project.org/lppl/lppl-1-3c.txt
115 and the latest version of this license is in
116 https://www.latex-project.org/lppl.txt
117 and version 1.3 or later is part of all distributions of
118 LaTeX version 2005/12/01 or later.
119
120 This work has the LPPL maintenance status "maintained".
121
122 The Current Maintainers of this work are
123 Heiko Oberdiek and the Oberdiek Package Support Group
124 https://github.com/ho-tex/embedfile/issues
125
126
127 The Base Interpreter refers to any `TeX-Format',
128 because some files are installed in TDS:tex/generic//.
129
130 This work consists of the main source file embedfile.dtx
131 and the derived files
132 embedfile.sty, embedfile.pdf, embedfile.ins, embedfile.drv,
133 dtx-attach.sty, embedfile-example-plain.tex,
134 embedfile-example-collection.tex, embedfile-test1.tex,
135 embedfile-test2.tex, embedfile-test3.tex,
136 embedfile-test4.tex.
137
138 \endpreamble
139 \let\MetaPrefix\DoubleperCent
140
141 \generate{%
142 \file{embedfile.ins}{\from{embedfile.dtx}{install}}%
143 \file{embedfile.drv}{\from{embedfile.dtx}{driver}}%
144 \usedir{tex/generic/embedfile}%
145 \file{embedfile.sty}{\from{embedfile.dtx}{package}}%
146 \usedir{tex/latex/embedfile}%
147 \file{dtx-attach.sty}{\from{embedfile.dtx}{dtxattach}}%
148 \usedir{doc/latex/embedfile}%
149 \file{embedfile-example-plain.tex}{\from{embedfile.dtx}{exampleplain}}%
150 \file{embedfile-example-collection.tex}{\from{embedfile.dtx}{examplecollection}}%
151 % \usedir{doc/latex/embedfile/test}%
152 % \file{embedfile-test1.tex}{\from{embedfile.dtx}{test1}}%
153 % \file{embedfile-test2.tex}{\from{embedfile.dtx}{test2}}%
154 % \file{embedfile-test3.tex}{\from{embedfile.dtx}{test3}}%
155 % \file{embedfile-test4.tex}{\from{embedfile.dtx}{test4}}%
156 }
157
158 \catcode32=13\relax% active space
159 \let =\space%
160 \Msg{************************************************************************}
161 \Msg{*}
162 \Msg{* To finish the installation you have to move the following}
163 \Msg{* files into a directory searched by TeX:}
164 \Msg{*}
165 \Msg{* embedfile.sty, dtx-attach.sty}
166 \Msg{*}
167 \Msg{* To produce the documentation run the file `embedfile.drv'}
168 \Msg{* through LaTeX.}
169 \Msg{*}
170 \Msg{* Happy TeXing!}
171 \Msg{*}
172 \Msg{************************************************************************}
173
174 \endbatchfile
175 %</install>
176 %<*ignore>
177 \fi
178 %</ignore>
179 %<*driver>
180 \NeedsTeXFormat{LaTeX2e}
181 \ProvidesFile{embedfile.drv}%
182 [2025-10-27 v2.13 Embed files into PDF (HO)]%
183 \documentclass{ltxdoc}
184 \usepackage{holtxdoc}[2011/11/22]
185 \begin{document}
186 \DocInput{embedfile.dtx}%
187 \end{document}
188 %</driver>
189 % \fi
190 %
191 %
192 %
193 % \GetFileInfo{embedfile.drv}
194 %
195 % \title{The \xpackage{embedfile} package}
196 % \date{2025-10-27 v2.13}
197 % \author{Heiko Oberdiek\thanks
198 % {Please report any issues at \url{https://github.com/ho-tex/embedfile/issues}}}
199 %
200 % \maketitle
201 %
202 % \begin{abstract}
203 % This package embeds files to a PDF document.
204 % Currently the only supported drivers are \pdfTeX\ $>=$ 1.30 and lua\TeX\ in PDF mode.
205 % \end{abstract}
206 %
207 % \tableofcontents
208 %
209 % \section{Documentation}
210 %
211 % \subsection{Introduction}
212 %
213 % The PDF format (\cite{pdfspec}) allows the inclusion of files
214 % inside the PDF document. The included files can be bound to an
215 % annotation on a page. Or they can be recorded in a sorted
216 % list of embedded files. The packages \xpackage{attachfile}
217 % or \xpackage{attachfile2} follow the first approach, this
218 % package uses the latter method.
219 %
220 % Since version 2.13 the package is compatible with the LaTeX PDF management
221 % (loaded with \verb+\RequirePackage{pdfmanagement}+ or \verb+\DocumentMetadata+),
222 % but it doesn't make full use of its tools yet, the dictionary of the embedded files
223 % can \emph{not} be changed as described in the l3pdffile documentation.
224 %
225 % \subsubsection{Future development}
226 %
227 % My dream is a large package that merges the features of
228 % all these packages mentioned before:
229 % \begin{itemize}
230 % \item Files can be attached to a page.
231 % \item Files can be attached to the document.
232 % \item An easy user interface for simple, common tasks and
233 % beginners.
234 % \item An interface for the advanced users that want to setup
235 % every detail.
236 % \item Support of many drivers (pdftex, dvips, dvipdfm, \dots).
237 % \item \dots
238 % \end{itemize}
239 % However, I have not managed to take the time for this project.
240 % Instead:
241 % \begin{itemize}
242 % \item First I experimented with package \xpackage{attachfile},
243 % adding driver support, fixing bugs, \dots. The result is
244 % currently named as \xpackage{attachfile2}. It uses an external
245 % script to get file properties (size, date, checksum, \dots).
246 % \item In order to avoid an external program for getting basic
247 % file properties I provided a patch ``EscapeAndOther'' for
248 % pdfTeX that was accepted for version 1.30.
249 % \item This package closes a gap left by the packages for attaching
250 % files and allows the embedding of files to the document.
251 % Also it makes use of the new primitives of \pdfTeX.
252 % \end{itemize}
253 %
254 % \subsection{User interface}
255 %
256 % This package \xpackage{embedfile} can be used with both
257 % \LaTeX\ and \plainTeX. See \autoref{sec:plain} that
258 % explains the use with \plainTeX\ by an example.
259 % In \LaTeX\ the package is loaded as usually. There are no options.
260 % \begin{quote}
261 % \verb|\usepackage{embedfile}|
262 % \end{quote}
263 %
264 % \begin{declcs}{embedfile}
265 % |[|\meta{options}|]| \M{file}
266 % \end{declcs}
267 % The macro \cs{embedfile} includes file \meta{file} and
268 % attaches it to the PDF document. At the end of the document
269 % the sorted list of embedded files are written. Thus you can
270 % safely use \cs{embedfile} before \verb|\end{document}|.
271 % Embedding files using \cs{AtEndDocument} will only work,
272 % if \cs{AtEndDocument} is called before loading the package
273 % \xpackage{embedfile}.
274 %
275 % The \meta{options} are give as key value pairs. The following
276 % keys are supported:
277 % \begin{description}
278 % \item[\xoption{filespec}]
279 % This allows to override the file name
280 % that appears in the PDF file. If you are using other than
281 % simple file names (8-bit, path separators, \dots), look into
282 % the PDF specification (\cite{pdfspec}).
283 % There are rules how these file names must be written/encoded.
284 % Avoid 8-bit characters
285 % and other special characters, the behaviour is currently undefined.
286 % Use option \xoption{ucfilespec} for more funny file names.
287 % The string method, see below, is |escape| since version 2.4.
288 %
289 % This name is also used as entry in a name tree
290 % (see PDF specification: |/EmbeddedFiles|). Therefore the
291 % value for \xoption{filespec} must be unique among all
292 % embedded files. Also key \xoption{initialfiles} refers
293 % to this name, if the file name and the value of \xoption{filespec}
294 % are different.
295 % \item[\xoption{ucfilespec}]
296 % Since PDF 1.7 the file name may be provided in Unicode.
297 % It must be provided for PDF/A-3.
298 % By default the \xoption{filespec} is used.
299 % The conversion of the option value into a PDF string
300 % is controlled by option \xoption{stringmethod}.
301 % Non-ascii chars can look funny if hyperref is not loaded!
302 % If \xoption{ucfilespec} is not set, \xoption{filespec} or the file name
303 % are used for the \texttt{/UF} key too.
304 % \item[\xoption{filesystem}]
305 % This sets the entry \verb|/FS| in
306 % the file specification dictionary, see PDF specification
307 % (\cite{pdfspec}).
308 % Example: \verb|filesystem=URL|.
309 % \item[\xoption{mimetype}]
310 % This sets the mime type (\cite{mime}) of the file,
311 % see \autoref{sec:plain} for examples and \cite{types}
312 % for a list of officially registered types.
313 % \item[\xoption{desc}]
314 % The description for the file.
315 % \item[\xoption{afrelationship}]
316 % This adds the /AFRelationship key to the filespec dictionary. The value is
317 % a pdf name with or without the leading slash.
318 % Typical values are \verb|Source|, \verb|Data|, \verb|Alternative|,
319 % \verb|Schema| or \verb|Unspecified|. Mandatory for PDF/A-3.
320 % \item[\xoption{stringmethod}]
321 % The package must convert the values of the keys \xoption{ucfilespec}
322 % and \xoption{desc} into a PDF string (before version 2.4: \xoption{filespec}
323 % and \xoption{desc}). If \xpackage{hyperref}
324 % is found, then its \cs{pdfstringdef} will be used, otherwise
325 % \pdfTeX's \cs{pdfescapestring} is used. Value \verb|psd|
326 % forces the use of \cs{pdfstringdef}, value \verb|escape|
327 % the use of \cs{pdfescapestring}.
328 % \item[\xoption{\meta{key}.value}] Sets the value of a collection
329 % item property, see section \ref{sec:collection}.
330 % \item[\xoption{\meta{key}.prefix}]
331 % Sets the prefix of a collection item property,
332 % see section \ref{sec:collection}.
333 % \item[\xoption{id}]
334 % The value must be an unique name. Macros
335 % \cs{embedfileifobjectexists} and \cs{embedfilegetobject}
336 % are using this name later.
337 % \end{description}
338 %
339 % \begin{declcs}{embedfilefinish}
340 % \end{declcs}
341 % The list of all embedded files must be added as data structure
342 % in the PDF file. In case of \LaTeX\ this is automatically done.
343 % The package uses \cs{AtEndDocument}. Then the list of all
344 % files should be known. However, \plainTeX\ does not know
345 % about \cs{AtEndDocument}. Thus the user must call
346 % \cs{embedfilefinish} at the end of the document
347 % after the last file is embedded.
348 %
349 % \begin{declcs}{embedfilesetup} \M{options}
350 % \end{declcs}
351 % Options for \cs{embedfile} and collection support
352 % can be set in \cs{embedfilesetup}.
353 %
354 % \subsection{Collection support (PDF 1.7)}
355 % \label{sec:collection}
356 %
357 % Since PDF 1.7 the embedded files can form a \emph{collection}
358 % (sometimes referred as \emph{package}), the main document
359 % is called \emph{cover sheet}. See PDF specification
360 % 8.2.4 ``Collections'' and 3.10.5 ``Collection items'' \cite{pdfspec}.
361 %
362 % Usually Acrobat Reader 7 or 8 shows the
363 % embedded files in a table at the bottom with the following columns:
364 % \begin{quote}
365 % \begin{tabular}{@{}l|l|l|l@{}}
366 % Name & Description & Modified & Size\\
367 % \hline
368 % \dots & \dots & \dots & \dots\\
369 % \end{tabular}
370 % \end{quote}
371 % Acrobat Reader 10 shows the embedded files in the left panel
372 % and adds a new column for the compressed size.
373 %
374 % If the files form a collection, then they are displayed
375 % in a table left or top (depending on option \xoption{view},
376 % see \cs{embedfilesetup}).
377 %
378 %
379 % Collection support is enabled automatically, if
380 % it is used.
381 %
382 % \begin{declcs}{embedfilesetup} \M{options}
383 % \end{declcs}
384 % The following options are supported in addition
385 % to options for \cs{embedfile}:
386 % \begin{description}
387 % \item[\xoption{view}]
388 % If the PDF file contains a collection, then Acrobat Reader 8
389 % shows a line at the top below the menu bar and the toolbar.
390 % It shows the current selected file, icons for changing the
391 % view mode, an options menu.
392 % The initial mode how the collection is presented is
393 % set by this option \xoption{view}.
394 % The following modes/values are supported, the default is |details|:
395 % \begin{description}
396 % \item[\texttt{details}] The full collection table is displayed
397 % at the top below the collection bar.
398 % \item[\texttt{tile}] The files of the collection are shown
399 % in tile mode on the left.
400 % \item[\texttt{hidden}] The collection table is not shown.
401 % \end{description}
402 % \item[\xoption{initialfile}]
403 % Selects the file that is initially presented. Especially
404 % useful for an embedded PDF file that is then shown instead
405 % of the cover document. There must be an \cs{embedfile} command
406 % somewhere whose value for key \xoption{filespec} is used here.
407 % The \cs{embedfile} command can drop option \xoption{filespec}
408 % if the file name is not different.
409 % \end{description}
410 %
411 % \begin{declcs}{embedfilefield} \M{key} \M{options}
412 % \end{declcs}
413 % Macro \cs{embedfilefield} defines a column/field in the collection table.
414 % The name of the field is \meta{key}.
415 % \begin{description}
416 % \item[\xoption{type}]
417 % sets the type of the field. The supported values are:
418 % \begin{description}
419 % \item[\texttt{text}] A text field. Its value is set in
420 % \cs{embedfile} by option \xoption{\meta{key}.value}.
421 % \item[\texttt{date}] A date field. Its value is set in
422 % \cs{embedfile} by option \xoption{\meta{key}.value}.
423 % A special format is required, see ``3.8.3 Dates'' \cite{pdfspec}.
424 % \item[\texttt{number}] A field with an integer or float number.
425 % Its value is set in \cs{embedfile} by option
426 % \xoption{\meta{key}.value}.
427 % \item[\texttt{file}] The file name of the embedded file.
428 % \item[\texttt{desc}] The description text of the embedded file. It is
429 % set in \cs{embedfile} by option \xoption{desc}.
430 % \item[\texttt{moddate}] The modification date of the embedded file.
431 % \item[\texttt{size}] The size of the embedded file.
432 % \end{description}
433 % All types allow the use of a prefix that is disregarded by
434 % sorting. The prefix for this field is set in \cs{embedfile} by
435 % option \xoption{\meta{key}.prefix}.
436 % \item[\xoption{title}] sets the column title.
437 % \item[\xoption{visible}] controls whether the column is presented:
438 % \begin{description}
439 % \item[\texttt{true}] shows the column.
440 % \item[\texttt{false}] hides the column.
441 % \end{description}
442 % Default: \texttt{true}
443 % \item[\xoption{edit}]
444 % Allows the editing of field values. Does not seem to have an
445 % effect for Acrobat Reader.
446 % \begin{description}
447 % \item[\texttt{true}] enables the feature, if available (depends
448 % on the PDF viewer).
449 % \item[\texttt{false}] disables the feature.
450 % \end{description}
451 % Default: \texttt{false}
452 % \end{description}
453 % The order of \cs{embedfilefield} statements defines the order
454 % of the columns.
455 %
456 % \begin{declcs}{embedfilesort} \M{key-sort-list}
457 % \end{declcs}
458 % The sort order of the embedded files are controlled by
459 % macro \cs{embedfilesort}. \meta{key-sort-list} defines
460 % the sort order. The key is a field name defined by \cs{embedfilefield}.
461 % Its value is either \texttt{ascending} or \texttt{descending}.
462 % The default is \texttt{ascending}.
463 %
464 % \subsection{Export of object references}
465 %
466 % Caution: This feature is still experimental. It may be even removed
467 % in future versions. Therefore feedback would be nice, if someone
468 % has a useful application for this feature.
469 %
470 % Object numbers are saved, if \xoption{id} is given in \cs{embedfile}.
471 % The following objects are supported:
472 % \begin{itemize}
473 % \item \texttt{EmbeddedFile}
474 % \item \texttt{Filespec}
475 % \end{itemize}
476 %
477 % \begin{declcs}{embedfileifobjectexists} \M{id} \M{type}
478 % \M{then} \M{else}
479 % \end{declcs}
480 % Macro \cs{embedfileifobjectexists} tests whether object of \meta{type}
481 % is available for the embedded file identified by \meta{id}.
482 %
483 % \begin{declcs}{embedfilegetobject} \M{id} \M{type}
484 % \end{declcs}
485 % Macro \cs{embedfilegetobject} expands to the full object reference
486 % object of \meta{type} for the embedded file identified by \meta{id}.
487 %
488 % \subsubsection{Example}
489 %
490 %\begin{quote}
491 %\begin{verbatim}
492 %\embedfile[id={foo}]{foo.pdf}
493 %\embedfileifobjectexists{foo}{Filespec}{%
494 % \typeout{%
495 % FileSpec object for `foo': %
496 % \embedfilegetobject{foo}{Filespec}%
497 % }%
498 %}{%
499 % \typeout{No Filespec object for `foo'}%
500 %}
501 %\end{verbatim}
502 %\end{quote}
503 %
504 % \subsection{Examples}
505 % \label{sec:examples}
506 %
507 % \subsubsection{\plainTeX}
508 % \label{sec:plain}
509 %
510 % The package can be used with \plainTeX. It can be used
511 % with or without help from \xfile{miniltx.tex}.
512 %
513 % If additionally package \xpackage{keyval} (\xpackage{graphicx})
514 % is needed, load it first. Then package \xpackage{embedfile} avoids
515 % a duplicate loading of package \xpackage{keyval}.
516 %
517 % Because \plainTeX\ does not provide a hook at end of the document,
518 % you have to call \cs{embedfilefinish} manually at the end
519 % after the last embedded file.
520 % \begin{macrocode}
521 %<*exampleplain>
522 %<<END
523 % Load packages
524 \input miniltx
525 % \def\Gin@driver{pdftex.def}
526 % \input graphicx.sty
527 \input embedfile.sty
528 \resetatcatcode
529
530 % default setting
531 \embedfilesetup{
532 mimetype=text/plain
533 }
534
535 % Embed files
536 \embedfile[
537 filespec=example.tex,
538 desc={Source code (plain-TeX) of this example}
539 ]{embedfile-example-plain.tex}
540
541 \embedfile[
542 desc={Source of package `embedfile'}
543 ]{embedfile.dtx}
544
545 \embedfile[
546 mimetype=application/pdf,
547 desc={Documentation of package `embedfile'}
548 ]{embedfile.pdf}
549
550 % Some text
551 This example document contains three embedded files.
552
553 % End of document
554 \embedfilefinish % don't forget
555 \bye
556 %END
557 %</exampleplain>
558 % \end{macrocode}
559 %
560 % \subsubsection{Collection example}
561 %
562 % \begin{macrocode}
563 %<*examplecollection>
564 %<<END
565 \NeedsTeXFormat{LaTeX2e}
566 \documentclass{article}
567 \usepackage[bookmarks=false]{hyperref}
568 % provides \pdfstringdef that is then used by `title' and
569 % other keys.
570 \usepackage{embedfile}[2019/12/03]
571 \embedfilesetup{
572 view=details,
573 initialfile=embedfile.pdf
574 }
575 \embedfilefield{file}{
576 type=file,
577 title={File name}
578 }
579 \embedfilefield{description}{
580 type=desc,
581 title={Description}
582 }
583 \embedfilefield{date}{
584 type=moddate,
585 title={Date}
586 }
587 \embedfilefield{size}{
588 type=size,
589 title={Size}
590 }
591 \embedfilefield{type}{
592 type=text,
593 title={Type},
594 visible=false
595 }
596 \embedfilesort{
597 type,
598 date=descending
599 }
600 \begin{document}
601 An example for embedded files as collection.
602 You need Acrobat Reader 8 or higher.
603
604 \embedfile[
605 desc={Source file of package `embedfile'},
606 description.prefix={Package: },
607 type.value={DTX}
608 ]{embedfile.dtx}
609
610 \embedfile[
611 desc={Documentation of package `embedfile'},
612 description.prefix={Package: },
613 type.value={PDF}
614 ]{embedfile.pdf}
615
616 \embedfile[
617 desc={The source for this example},
618 description.prefix={Example: },
619 type.value={TEX}
620 ]{\jobname.tex}
621
622 \end{document}
623 %END
624 %</examplecollection>
625 % \end{macrocode}
626 %
627 % \subsection{Package \xpackage{dtx-attach}}
628 %
629 % Package \xpackage{dtx-attach} is just a small application of
630 % package \xpackage{embedfile}. I am using it for the CTAN
631 % documentation of my packages in \CTANpkg{oberdiek}.
632 % It also serves as small example for the use of the package with \LaTeX.
633 %
634 % \begin{macrocode}
635 %<*dtxattach>
636 \NeedsTeXFormat{LaTeX2e}
637 \ProvidesPackage{dtx-attach}
638 [2025-10-27 v2.13 Embed \string\jobname.dtx (HO)]%
639 \RequirePackage{embedfile}[2019/12/03]
640 \embedfile[%
641 stringmethod=escape,%
642 mimetype=plain/text,%
643 desc={LaTeX docstrip source archive for package `\jobname'}%
644 ]{\jobname.dtx}
645 %</dtxattach>
646 % \end{macrocode}
647 %
648 % \StopEventually{
649 % }
650 %
651 % \section{Implementation}
652 %
653 % \begin{macrocode}
654 %<*package>
655 % \end{macrocode}
656 %
657 % \subsection{Reload check and package identification}
658 % Reload check, especially if the package is not used with \LaTeX.
659 % \begin{macrocode}
660 \begingroup\catcode61\catcode48\catcode32=10\relax%
661 \catcode13=5 % ^^M
662 \endlinechar=13 %
663 \catcode35=6 % #
664 \catcode39=12 % '
665 \catcode44=12 % ,
666 \catcode45=12 % -
667 \catcode46=12 % .
668 \catcode58=12 % :
669 \catcode64=11 % @
670 \catcode123=1 % {
671 \catcode125=2 % }
672 \expandafter\let\expandafter\x\csname [email protected]\endcsname
673 \ifx\x\relax % plain-TeX, first loading
674 \else
675 \def\empty{}%
676 \ifx\x\empty % LaTeX, first loading,
677 % variable is initialized, but \ProvidesPackage not yet seen
678 \else
679 \expandafter\ifx\csname PackageInfo\endcsname\relax
680 \def\x#1#2{%
681 \immediate\write-1{Package #1 Info: #2.}%
682 }%
683 \else
684 \def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
685 \fi
686 \x{embedfile}{The package is already loaded}%
687 \aftergroup\endinput
688 \fi
689 \fi
690 \endgroup%
691 % \end{macrocode}
692 % Package identification:
693 % \begin{macrocode}
694 \begingroup\catcode61\catcode48\catcode32=10\relax%
695 \catcode13=5 % ^^M
696 \endlinechar=13 %
697 \catcode35=6 % #
698 \catcode39=12 % '
699 \catcode40=12 % (
700 \catcode41=12 % )
701 \catcode44=12 % ,
702 \catcode45=12 % -
703 \catcode46=12 % .
704 \catcode47=12 % /
705 \catcode58=12 % :
706 \catcode64=11 % @
707 \catcode91=12 % [
708 \catcode93=12 % ]
709 \catcode123=1 % {
710 \catcode125=2 % }
711 \expandafter\ifx\csname ProvidesPackage\endcsname\relax
712 \def\x#1#2#3[#4]{\endgroup
713 \immediate\write-1{Package: #3 #4}%
714 \xdef#1{#4}%
715 }%
716 \else
717 \def\x#1#2[#3]{\endgroup
718 #2[{#3}]%
719 \ifx#1\@undefined
720 \xdef#1{#3}%
721 \fi
722 \ifx#1\relax
723 \xdef#1{#3}%
724 \fi
725 }%
726 \fi
727 \expandafter\x\csname [email protected]\endcsname
728 \ProvidesPackage{embedfile}%
729 [2025-10-27 v2.13 Embed files into PDF (HO)]%
730 % \end{macrocode}
731 %
732 % \subsection{Catcodes}
733 %
734 % \begin{macrocode}
735 \begingroup\catcode61\catcode48\catcode32=10\relax%
736 \catcode13=5 % ^^M
737 \endlinechar=13 %
738 \catcode123=1 % {
739 \catcode125=2 % }
740 \catcode64=11 % @
741 \def\x{\endgroup
742 \expandafter\edef\csname EmFi@AtEnd\endcsname{%
743 \endlinechar=\the\endlinechar\relax
744 \catcode13=\the\catcode13\relax
745 \catcode32=\the\catcode32\relax
746 \catcode35=\the\catcode35\relax
747 \catcode61=\the\catcode61\relax
748 \catcode64=\the\catcode64\relax
749 \catcode123=\the\catcode123\relax
750 \catcode125=\the\catcode125\relax
751 }%
752 }%
753 \x\catcode61\catcode48\catcode32=10\relax%
754 \catcode13=5 % ^^M
755 \endlinechar=13 %
756 \catcode35=6 % #
757 \catcode64=11 % @
758 \catcode123=1 % {
759 \catcode125=2 % }
760 \def\TMP@EnsureCode#1#2{%
761 \edef\EmFi@AtEnd{%
762 \EmFi@AtEnd
763 \catcode#1=\the\catcode#1\relax
764 }%
765 \catcode#1=#2\relax
766 }
767 \TMP@EnsureCode{39}{12}% '
768 \TMP@EnsureCode{40}{12}% (
769 \TMP@EnsureCode{41}{12}% )
770 \TMP@EnsureCode{44}{12}% ,
771 \TMP@EnsureCode{46}{12}% .
772 \TMP@EnsureCode{47}{12}% /
773 \TMP@EnsureCode{58}{12}% :
774 \TMP@EnsureCode{60}{12}% <
775 \TMP@EnsureCode{62}{12}% >
776 \TMP@EnsureCode{91}{12}% [
777 \TMP@EnsureCode{93}{12}% ]
778 \TMP@EnsureCode{96}{12}% `
779 \edef\EmFi@AtEnd{\EmFi@AtEnd\noexpand\endinput}
780 % \end{macrocode}
781 %
782 % \subsection{Tools}
783 %
784 % \begin{macro}{\EmFi@RequirePackage}
785 % \begin{macrocode}
786 \begingroup\expandafter\expandafter\expandafter\endgroup
787 \expandafter\ifx\csname RequirePackage\endcsname\relax
788 \def\EmFi@RequirePackage#1[#2]{%
789 \input #1.sty\relax
790 }%
791 \else
792 \let\EmFi@RequirePackage\RequirePackage
793 \fi
794 % \end{macrocode}
795 % \end{macro}
796 %
797 % \begin{macro}{\EmFi@Error}
798 % \begin{macrocode}
799 \EmFi@RequirePackage{infwarerr}[2007/09/09]%
800 \ifcsname EmFi@Error\endcsname
801 \else
802 \def\EmFi@Error{%
803 \@PackageError{embedfile}%
804 }
805 \fi
806 % \end{macrocode}
807 % \end{macro}
808 %
809 % Luatex compat
810 % \begin{macrocode}
811 \ifx\pdfextension\@undefined\else
812 \protected\def\pdflastobj {\numexpr\pdffeedback lastobj\relax}
813 \protected\def\pdfnames {\pdfextension names }
814 \protected\def\pdfobj {\pdfextension obj }
815 \protected\def\pdfcatalog {\pdfextension catalog }
816 \let\pdfoutput \outputmode
817 \fi
818 % \end{macrocode}
819 %
820 % \subsection{Check for recent \pdfTeX\ in PDF mode}
821 %
822 % Load package \xpackage{iftex} and check mode.
823 % \begin{macrocode}
824 \EmFi@RequirePackage{iftex}[2019/11/07]
825 \ifpdf
826 \else
827 \EmFi@Error{%
828 Missing pdfTeX or luaTeX in PDF mode%
829 }{%
830 Currently other drivers are not supported. %
831 Package loading is aborted.%
832 }%
833 \expandafter\EmFi@AtEnd
834 \fi%
835 % \end{macrocode}
836 % \begin{macrocode}
837 \EmFi@RequirePackage{pdftexcmds}[2007/11/11]
838 \EmFi@RequirePackage{ltxcmds}[2010/03/01]
839 \EmFi@RequirePackage{kvsetkeys}[2010/03/01]
840 \EmFi@RequirePackage{kvdefinekeys}[2010/03/01]
841 % \end{macrocode}
842 % Check version.
843 % \begin{macrocode}
844 \begingroup\expandafter\expandafter\expandafter\endgroup
845 \expandafter\ifx\csname pdf@filesize\endcsname\relax
846 \EmFi@Error{%
847 Unsupported pdfTeX version%
848 }{%
849 At least version 1.30 is necessary. Package loading is aborted.%
850 }%
851 \expandafter\EmFi@AtEnd
852 \fi%
853 % \end{macrocode}
854 %
855 % \subsection{Strings}
856 %
857 % Minimal version of package \xpackage{pdfescape} is 2007/08/27 v1.5
858 % because of \cs{EdefSanitize}.
859 % \begin{macrocode}
860 \EmFi@RequirePackage{pdfescape}[2007/11/11]
861 % \end{macrocode}
862 %
863 % \begin{macrocode}
864 \def\EmFi@temp#1{%
865 \expandafter\EdefSanitize\csname EmFi@S@#1\endcsname{#1}%
866 }
867 % \end{macrocode}
868 % \begin{macro}{\EmFi@details}
869 % \begin{macrocode}
870 \EmFi@temp{details}%
871 % \end{macrocode}
872 % \end{macro}
873 % \begin{macro}{\EmFi@tile}
874 % \begin{macrocode}
875 \EmFi@temp{tile}%
876 % \end{macrocode}
877 % \end{macro}
878 % \begin{macro}{\EmFi@hidden}
879 % \begin{macrocode}
880 \EmFi@temp{hidden}%
881 % \end{macrocode}
882 % \end{macro}
883 % \begin{macro}{\EmFi@S@text}
884 % \begin{macrocode}
885 \EmFi@temp{text}
886 % \end{macrocode}
887 % \end{macro}
888 % \begin{macro}{\EmFi@S@date}
889 % \begin{macrocode}
890 \EmFi@temp{date}
891 % \end{macrocode}
892 % \end{macro}
893 % \begin{macro}{\EmFi@S@number}
894 % \begin{macrocode}
895 \EmFi@temp{number}
896 % \end{macrocode}
897 % \end{macro}
898 % \begin{macro}{\EmFi@S@file}
899 % \begin{macrocode}
900 \EmFi@temp{file}
901 % \end{macrocode}
902 % \end{macro}
903 % \begin{macro}{\EmFi@S@desc}
904 % \begin{macrocode}
905 \EmFi@temp{desc}
906 % \end{macrocode}
907 % \end{macro}
908 % \begin{macro}{\EmFi@S@afrelationship}
909 % \begin{macrocode}
910 \EmFi@temp{afrelationship}
911 % \end{macrocode}
912 % \end{macro}
913 % \begin{macro}{\EmFi@S@moddate}
914 % \begin{macrocode}
915 \EmFi@temp{moddate}
916 % \end{macrocode}
917 % \end{macro}
918 % \begin{macro}{\EmFi@S@creationdate}
919 % \begin{macrocode}
920 \EmFi@temp{creationdate}
921 % \end{macrocode}
922 % \end{macro}
923 % \begin{macro}{\EmFi@S@size}
924 % \begin{macrocode}
925 \EmFi@temp{size}
926 % \end{macrocode}
927 % \end{macro}
928 % \begin{macro}{\EmFi@S@ascending}
929 % \begin{macrocode}
930 \EmFi@temp{ascending}
931 % \end{macrocode}
932 % \end{macro}
933 % \begin{macro}{\EmFi@S@descending}
934 % \begin{macrocode}
935 \EmFi@temp{descending}
936 % \end{macrocode}
937 % \end{macro}
938 % \begin{macro}{\EmFi@S@true}
939 % \begin{macrocode}
940 \EmFi@temp{true}
941 % \end{macrocode}
942 % \end{macro}
943 % \begin{macro}{\EmFi@S@false}
944 % \begin{macrocode}
945 \EmFi@temp{false}
946 % \end{macrocode}
947 % \end{macro}
948 %
949 % \subsection{Switches}
950 %
951 % \begin{macro}{\ifEmFi@collection}
952 % \begin{macrocode}
953 \ltx@newif\ifEmFi@collection
954 % \end{macrocode}
955 % \end{macro}
956 % \begin{macro}{\ifEmFi@sort}
957 % \begin{macrocode}
958 \ltx@newif\ifEmFi@sort
959 % \end{macrocode}
960 % \end{macro}
961 % \begin{macro}{\ifEmFi@visible}
962 % \begin{macrocode}
963 \ltx@newif\ifEmFi@visible
964 % \end{macrocode}
965 % \end{macro}
966 % \begin{macro}{\ifEmFi@edit}
967 % \begin{macrocode}
968 \ltx@newif\ifEmFi@edit
969 % \end{macrocode}
970 % \end{macro}
971 % \begin{macro}{\ifEmFi@item}
972 % \begin{macrocode}
973 \ltx@newif\ifEmFi@item
974 % \end{macrocode}
975 % \end{macro}
976 % \begin{macro}{\ifEmFi@finished}
977 % \begin{macrocode}
978 \ltx@newif\ifEmFi@finished
979 % \end{macrocode}
980 % \end{macro}
981 % \begin{macro}{\ifEmFi@id}
982 % \begin{macrocode}
983 \ltx@newif\ifEmFi@id
984 % \end{macrocode}
985 % \end{macro}
986 %
987 % \subsection{Key value definitions}
988 %
989 % \begin{macro}{\EmFi@GlobalKey}
990 % \begin{macrocode}
991 \def\EmFi@GlobalKey#1#2{%
992 \global\expandafter\let\csname KV@#1@#2\expandafter\endcsname
993 \csname KV@#1@#2\endcsname
994 }
995 % \end{macrocode}
996 % \end{macro}
997 % \begin{macro}{\EmFi@GlobalDefaultKey}
998 % \begin{macrocode}
999 \def\EmFi@GlobalDefaultKey#1#2{%
1000 \EmFi@GlobalKey{#1}{#2}%
1001 \global\expandafter\let
1002 \csname KV@#1@#2@default\expandafter\endcsname
1003 \csname KV@#1@#2@default\endcsname
1004 }
1005 % \end{macrocode}
1006 % \end{macro}
1007 %
1008 % \begin{macro}{\EmFi@DefineKey}
1009 % \begin{macrocode}
1010 \def\EmFi@DefineKey#1#2{%
1011 \kv@define@key{EmFi}{#1}{%
1012 \expandafter\def\csname EmFi@#1\endcsname{##1}%
1013 }%
1014 \expandafter\def\csname EmFi@#1\endcsname{#2}%
1015 }
1016 % \end{macrocode}
1017 % \end{macro}
1018 % Subtype of the embedded file (optional).
1019 % \begin{macrocode}
1020 \EmFi@DefineKey{mimetype}{}
1021 % \end{macrocode}
1022 % File specification string.
1023 % \begin{macrocode}
1024 \EmFi@DefineKey{filespec}{\EmFi@file}
1025 % \end{macrocode}
1026 % File specification string in Unicode.
1027 % \begin{macrocode}
1028 \EmFi@DefineKey{ucfilespec}{}
1029 % \end{macrocode}
1030 % File system (optional).
1031 % \begin{macrocode}
1032 \EmFi@DefineKey{filesystem}{}
1033 % \end{macrocode}
1034 % Description (optional).
1035 % \begin{macrocode}
1036 \EmFi@DefineKey{desc}{}
1037 % \end{macrocode}
1038 % AFRelationship (mandatory for PDF/A-3 compliance).
1039 % \begin{macrocode}
1040 \EmFi@DefineKey{afrelationship}{}
1041 % \end{macrocode}
1042 % Method for converting text to PDF strings.
1043 % \begin{macrocode}
1044 \EmFi@DefineKey{stringmethod}{%
1045 \ifx\pdfstringdef\@undefined
1046 escape%
1047 \else
1048 \ifx\pdfstringdef\relax
1049 escape%
1050 \else
1051 psd%
1052 \fi
1053 \fi
1054 }
1055 % \end{macrocode}
1056 %
1057 % Option \xoption{id} as key for object numbers.
1058 % \begin{macrocode}
1059 \kv@define@key{EmFi}{id}{%
1060 \def\EmFi@id{#1}%
1061 \EmFi@idtrue
1062 }
1063 % \end{macrocode}
1064 % \begin{macro}{\EmFi@defobj}
1065 % \begin{macrocode}
1066 \def\EmFi@defobj#1{%
1067 \ifEmFi@id
1068 \expandafter\xdef\csname EmFi@#1@\EmFi@id\endcsname{%
1069 \emFi@pdfobjectreflast%
1070 }%
1071 \fi
1072 }
1073 % \end{macrocode}
1074 % \end{macro}
1075 % \begin{macro}{\embedfileifobjectexists}
1076 % \begin{macrocode}
1077 \def\embedfileifobjectexists#1#2{%
1078 \expandafter\ifx\csname EmFi@#2@#1\endcsname\relax
1079 \expandafter\ltx@secondoftwo
1080 \else
1081 \expandafter\ltx@firstoftwo
1082 \fi
1083 }
1084 % \end{macrocode}
1085 % \end{macro}
1086 % \begin{macro}{\embedfilegetobject}
1087 % \begin{macrocode}
1088 \def\embedfilegetobject#1#2{%
1089 \embedfileifobjectexists{#1}{#2}{%
1090 \csname EmFi@#2@#1\endcsname
1091 }{%
1092 0 0 R%
1093 }%
1094 }
1095 % \end{macrocode}
1096 % \end{macro}
1097 %
1098 % Initial view of the collection.
1099 % \begin{macrocode}
1100 \kv@define@key{EmFi}{view}[]{%
1101 \EdefSanitize\EmFi@temp{#1}%
1102 \def\EmFi@next{%
1103 \global\EmFi@collectiontrue
1104 }%
1105 \ifx\EmFi@temp\ltx@empty
1106 \let\EmFi@view\EmFi@S@details
1107 \else\ifx\EmFi@temp\EmFi@S@details
1108 \let\EmFi@view\EmFi@S@details
1109 \else\ifx\EmFi@temp\EmFi@S@tile
1110 \let\EmFi@view\EmFi@S@tile
1111 \else\ifx\EmFi@temp\EmFi@S@hidden
1112 \let\EmFi@view\EmFi@S@hidden
1113 \else
1114 \let\EmFi@next\relax
1115 \EmFi@Error{%
1116 Unknown value `\EmFi@temp' for key `view'.\MessageBreak
1117 Supported values: `details', `tile', `hidden'.%
1118 }\@ehc
1119 \fi\fi\fi\fi
1120 \EmFi@next
1121 }
1122 % \end{macrocode}
1123 % \begin{macrocode}
1124 \EmFi@DefineKey{initialfile}{}
1125 % \end{macrocode}
1126 %
1127 % \begin{macro}{\embedfilesetup}
1128 % \begin{macrocode}
1129 \def\embedfilesetup{%
1130 \ifEmFi@finished
1131 \def\EmFi@next##1{}%
1132 \EmFi@Error{%
1133 \string\embedfilefield\ltx@space after \string\embedfilefinish
1134 }{%
1135 The list of embedded files is already written.%
1136 }%
1137 \else
1138 \def\EmFi@next{%
1139 \kvsetkeys{EmFi}%
1140 }%
1141 \fi
1142 \EmFi@next
1143 }
1144 % \end{macrocode}
1145 % \end{macro}
1146 %
1147 % \begin{macro}{\EmFi@schema}
1148 % \begin{macrocode}
1149 \def\EmFi@schema{}
1150 % \end{macrocode}
1151 % \end{macro}
1152 % \begin{macro}{\EmFi@order}
1153 % \begin{macrocode}
1154 \gdef\EmFi@order{0}
1155 % \end{macrocode}
1156 % \end{macro}
1157 % \begin{macro}{\EmFi@@order}
1158 % \begin{macrocode}
1159 \let\EmFi@@order\relax
1160 % \end{macrocode}
1161 % \end{macro}
1162 % \begin{macro}{\EmFi@fieldlist}
1163 % \begin{macrocode}
1164 \def\EmFi@fieldlist{}
1165 % \end{macrocode}
1166 % \end{macro}
1167 % \begin{macro}{\EmFi@sortcase}
1168 % \begin{macrocode}
1169 \def\EmFi@sortcase{0}%
1170 % \end{macrocode}
1171 % \end{macro}
1172 % \begin{macro}{\embedfilefield}
1173 % \begin{macrocode}
1174 \def\embedfilefield#1#2{%
1175 \ifEmFi@finished
1176 \EmFi@Error{%
1177 \string\embedfilefield\ltx@space after \string\embedfilefinish
1178 }{%
1179 The list of embedded files is already written.%
1180 }%
1181 \else
1182 \global\EmFi@collectiontrue
1183 \EdefSanitize\EmFi@key{#1}%
1184 \expandafter\ifx\csname KV@EmFi@\[email protected]\endcsname\relax
1185 \begingroup
1186 \count@=\EmFi@order
1187 \advance\count@ 1 %
1188 \xdef\EmFi@order{\the\count@}%
1189 \let\EmFi@title\EmFi@key
1190 \let\EmFi@type\EmFi@S@text
1191 \EmFi@visibletrue
1192 \EmFi@editfalse
1193 \kvsetkeys{EmFiFi}{#2}%
1194 \EmFi@convert\EmFi@title\EmFi@title
1195 \xdef\EmFi@schema{%
1196 \EmFi@schema
1197 /\pdf@escapename{\EmFi@key}<<%
1198 /Subtype/%
1199 \ifx\EmFi@type\EmFi@S@date D%
1200 \else\ifx\EmFi@type\EmFi@S@number N%
1201 \else\ifx\EmFi@type\EmFi@S@file F%
1202 \else\ifx\EmFi@type\EmFi@S@desc Desc%
1203 \else\ifx\EmFi@type\EmFi@S@afrelationship AFRelationship%
1204 \else\ifx\EmFi@type\EmFi@S@moddate ModDate%
1205 \else\ifx\EmFi@type\EmFi@S@creationdate CreationDate%
1206 \else\ifx\EmFi@type\EmFi@S@size Size%
1207 \else S%
1208 \fi\fi\fi\fi\fi\fi\fi\fi
1209 /N(\EmFi@title)%
1210 \EmFi@@order{\EmFi@order}%
1211 \ifEmFi@visible
1212 \else
1213 /V false%
1214 \fi
1215 \ifEmFi@edit
1216 /E true%
1217 \fi
1218 >>%
1219 }%
1220 \let\do\relax
1221 \xdef\EmFi@fieldlist{%
1222 \EmFi@fieldlist
1223 \do{\EmFi@key}%
1224 }%
1225 \ifx\EmFi@type\EmFi@S@text
1226 \kv@define@key{EmFi}{\[email protected]}{%
1227 \EmFi@itemtrue
1228 \def\EmFi@temp{##1}%
1229 \EmFi@convert\EmFi@temp\EmFi@temp
1230 \expandafter\def\csname EmFi@V@#1%
1231 \expandafter\endcsname\expandafter{%
1232 \expandafter(\EmFi@temp)%
1233 }%
1234 }%
1235 \EmFi@GlobalKey{EmFi}{\[email protected]}%
1236 \else\ifx\EmFi@type\EmFi@S@date
1237 \kv@define@key{EmFi}{\[email protected]}{%
1238 \EmFi@itemtrue
1239 \def\EmFi@temp{##1}%
1240 \EmFi@convert\EmFi@temp\EmFi@temp
1241 \expandafter\def\csname EmFi@V@#1%
1242 \expandafter\endcsname\expandafter{%
1243 \expandafter(\EmFi@temp)%
1244 }%
1245 }%
1246 \EmFi@GlobalKey{EmFi}{\[email protected]}%
1247 \else\ifx\EmFi@type\EmFi@S@number
1248 \kv@define@key{EmFi}{\[email protected]}{%
1249 \EmFi@itemtrue
1250 \expandafter\EdefSanitize\csname EmFi@V@#1\endcsname{ ##1}%
1251 }%
1252 \EmFi@GlobalKey{EmFi}{\[email protected]}%
1253 \fi\fi\fi
1254 \kv@define@key{EmFi}{\[email protected]}{%
1255 \EmFi@itemtrue
1256 \expandafter\def\csname EmFi@P@#1\endcsname{##1}%
1257 }%
1258 \EmFi@GlobalKey{EmFi}{\[email protected]}%
1259 \kv@define@key{EmFiSo}{\EmFi@key}[ascending]{%
1260 \EdefSanitize\EmFi@temp{##1}%
1261 \ifx\EmFi@temp\EmFi@S@ascending
1262 \def\EmFi@temp{true}%
1263 \else\ifx\EmFi@temp\EmFi@S@descending
1264 \def\EmFi@temp{false}%
1265 \else
1266 \def\EmFi@temp{}%
1267 \EmFi@Error{%
1268 Unknown sort order `\EmFi@temp'.\MessageBreak
1269 Supported values: `\EmFi@S@ascending', %
1270 `\EmFi@S@descending
1271 }\@ehc
1272 \fi\fi
1273 \ifx\EmFi@temp\ltx@empty
1274 \else
1275 \xdef\EmFi@sortkeys{%
1276 \EmFi@sortkeys
1277 /\pdf@escapename{#1}%
1278 }%
1279 \ifx\EmFi@sortorders\ltx@empty
1280 \global\let\EmFi@sortorders\EmFi@temp
1281 \gdef\EmFi@sortcase{1}%
1282 \else
1283 \xdef\EmFi@sortorders{%
1284 \EmFi@sortorders
1285 \ltx@space
1286 \EmFi@temp
1287 }%
1288 \xdef\EmFi@sortcase{2}%
1289 \fi
1290 \fi
1291 }%
1292 \EmFi@GlobalDefaultKey{EmFiSo}\EmFi@key
1293 \endgroup
1294 \else
1295 \EmFi@Error{%
1296 Field `\EmFi@key' is already defined%
1297 }\@ehc
1298 \fi
1299 \fi
1300 }
1301 % \end{macrocode}
1302 % \end{macro}
1303 % \begin{macrocode}
1304 \kv@define@key{EmFiFi}{type}{%
1305 \EdefSanitize\EmFi@temp{#1}%
1306 \ifx\EmFi@temp\EmFi@S@text
1307 \let\EmFi@type\EmFi@temp
1308 \else\ifx\EmFi@temp\EmFi@S@date
1309 \let\EmFi@type\EmFi@temp
1310 \else\ifx\EmFi@temp\EmFi@S@number
1311 \let\EmFi@type\EmFi@temp
1312 \else\ifx\EmFi@temp\EmFi@S@file
1313 \let\EmFi@type\EmFi@temp
1314 \else\ifx\EmFi@temp\EmFi@S@desc
1315 \let\EmFi@type\EmFi@temp
1316 \else\ifx\EmFi@temp\EmFi@S@afrelationship
1317 \let\EmFi@type\EmFi@temp
1318 \else\ifx\EmFi@temp\EmFi@S@moddate
1319 \let\EmFi@type\EmFi@temp
1320 \else\ifx\EmFi@temp\EmFi@S@creationdate
1321 \let\EmFi@type\EmFi@temp
1322 \else\ifx\EmFi@temp\EmFi@S@size
1323 \let\EmFi@type\EmFi@temp
1324 \else
1325 \EmFi@Error{%
1326 Unknown type `\EmFi@temp'.\MessageBreak
1327 Supported types: `text', `date', `number', `file',\MessageBreak
1328 `desc', `afrelationship', `moddate', `creationdate', `size'%
1329 }%
1330 \fi\fi\fi\fi\fi\fi\fi\fi\fi
1331 }
1332 % \end{macrocode}
1333 % \begin{macrocode}
1334 \kv@define@key{EmFiFi}{title}{%
1335 \def\EmFi@title{#1}%
1336 }
1337 % \end{macrocode}
1338 % \begin{macro}{\EmFi@setboolean}
1339 % \begin{macrocode}
1340 \def\EmFi@setboolean#1#2{%
1341 \EdefSanitize\EmFi@temp{#2}%
1342 \ifx\EmFi@temp\EmFi@S@true
1343 \csname EmFi@#1true\endcsname
1344 \else
1345 \ifx\EmFi@temp\EmFi@S@false
1346 \csname EmFi@#1false\endcsname
1347 \else
1348 \EmFi@Error{%
1349 Unknown value `\EmFi@temp' for key `#1'.\MessageBreak
1350 Supported values: `true', `false'%
1351 }\@ehc
1352 \fi
1353 \fi
1354 }
1355 % \end{macrocode}
1356 % \end{macro}
1357 % \begin{macrocode}
1358 \kv@define@key{EmFiFi}{visible}[true]{%
1359 \EmFi@setboolean{visible}{#1}%
1360 }
1361 % \end{macrocode}
1362 % \begin{macrocode}
1363 \kv@define@key{EmFiFi}{edit}[true]{%
1364 \EmFi@setboolean{edit}{#1}%
1365 }
1366 % \end{macrocode}
1367 %
1368 % \begin{macro}{\EmFi@sortkeys}
1369 % \begin{macrocode}
1370 \def\EmFi@sortkeys{}
1371 % \end{macrocode}
1372 % \end{macro}
1373 % \begin{macro}{\EmFi@sortorders}
1374 % \begin{macrocode}
1375 \def\EmFi@sortorders{}
1376 % \end{macrocode}
1377 % \end{macro}
1378 % \begin{macro}{\embedfilesort}
1379 % \begin{macrocode}
1380 \def\embedfilesort{%
1381 \kvsetkeys{EmFiSo}%
1382 }
1383 % \end{macrocode}
1384 % \end{macro}
1385 %
1386 % \subsection{Embed the file}
1387 %
1388 % \begin{macro}{\embedfile}
1389 % \begin{macrocode}
1390 \def\embedfile{%
1391 \ltx@ifnextchar[\EmFi@embedfile{\EmFi@embedfile[]}%
1392 }
1393 % \end{macrocode}
1394 % \end{macro}
1395 % \begin{macro}{\EmFi@embedfile}
1396 % \begin{macrocode}
1397 \def\EmFi@removeslash#1{\if/#1\else#1\fi}%
1398 \def\EmFi@embedfile[#1]#2{%
1399 \ifEmFi@finished
1400 \EmFi@Error{%
1401 \string\embedfile\ltx@space after \string\embedfilefinish
1402 }{%
1403 The list of embedded files is already written.%
1404 }%
1405 \else
1406 \begingroup
1407 \def\EmFi@file{#2}%
1408 \kvsetkeys{EmFi}{#1}%
1409 \expandafter\expandafter\expandafter
1410 \ifx\expandafter\expandafter\expandafter
1411 \\\pdf@filesize{\EmFi@file}\\%
1412 \EmFi@Error{%
1413 File `\EmFi@file' not found%
1414 }{%
1415 The unknown file is not embedded.%
1416 }%
1417 \else
1418 \edef\EmFi@@filespec{%
1419 \pdf@escapestring{\EmFi@filespec}%
1420 }%
1421 \ifx\EmFi@ucfilespec\ltx@empty
1422 \EmFi@convert\EmFi@filespec\EmFi@@ucfilespec
1423 \else
1424 \EmFi@convert\EmFi@ucfilespec\EmFi@@ucfilespec
1425 \fi
1426 \ifx\EmFi@desc\ltx@empty
1427 \let\EmFi@@desc\ltx@empty
1428 \else
1429 \EmFi@convert\EmFi@desc\EmFi@@desc
1430 \fi
1431 \ifx\EmFi@afrelationship\ltx@empty
1432 \let\EmFi@@afrelationship\ltx@empty
1433 \else
1434 \expandafter\edef\expandafter\EmFi@@afrelationship\expandafter
1435 {\expandafter\EmFi@removeslash\EmFi@afrelationship}
1436 \fi
1437 \ifEmFi@item
1438 \let\do\EmFi@do
1439 \emFi@pdfwritedict{\EmFi@fieldlist}%
1440 \edef\EmFi@ci{\emFi@pdfobjectreflast}%
1441 \fi
1442 \emFi@pdfwritefstream
1443 {%
1444 /Type/EmbeddedFile%
1445 \ifx\EmFi@mimetype\ltx@empty
1446 \else
1447 /Subtype/\pdf@escapename{\EmFi@mimetype}%
1448 \fi
1449 /Params<<%
1450 /ModDate(\pdf@filemoddate{\EmFi@file})%
1451 /Size \pdf@filesize{\EmFi@file}%
1452 /CheckSum<\pdf@filemdfivesum{\EmFi@file}>%
1453 >>%
1454 }{\EmFi@file}\relax
1455 \EmFi@defobj{EmbeddedFile}%
1456 \emFi@pdfwritedict{%
1457 /Type/Filespec%
1458 \ifx\EmFi@filesystem\ltx@empty
1459 \else
1460 /FS/\pdf@escapename{\EmFi@filesystem}%
1461 \fi
1462 /F(\EmFi@@filespec)%
1463 /UF(\EmFi@@ucfilespec)%
1464 \ifx\EmFi@@desc\ltx@empty
1465 \else
1466 /Desc(\EmFi@@desc)%
1467 \fi
1468 \ifx\EmFi@@afrelationship\ltx@empty
1469 \else
1470 /AFRelationship/\pdf@escapename{\EmFi@@afrelationship}%
1471 \fi
1472 /EF<<%
1473 /F \emFi@pdfobjectreflast%
1474 >>%
1475 \ifEmFi@item
1476 /CI \EmFi@ci%
1477 \fi
1478 }%
1479 \EmFi@defobj{Filespec}%
1480 \EmFi@add{%
1481 \EmFi@@filespec
1482 }{\emFi@pdfobjectreflast}%
1483 \fi
1484 \endgroup
1485 \fi
1486 }
1487 % \end{macrocode}
1488 % \end{macro}
1489 % \begin{macro}{\EmFi@do}
1490 % \begin{macrocode}
1491 \def\EmFi@do#1{%
1492 \expandafter\ifx\csname EmFi@P@#1\endcsname\relax
1493 \expandafter\ifx\csname EmFi@V@#1\endcsname\relax
1494 \else
1495 /\pdf@escapename{#1}\csname EmFi@V@#1\endcsname
1496 \fi
1497 \else
1498 /\pdf@escapename{#1}<<%
1499 \expandafter\ifx\csname EmFi@V@#1\endcsname\relax
1500 \else
1501 /D\csname EmFi@V@#1\endcsname
1502 \fi
1503 /P(\csname EmFi@P@#1\endcsname)%
1504 >>%
1505 \fi
1506 }
1507 % \end{macrocode}
1508 % \end{macro}
1509 % \begin{macro}{\EmFi@convert}
1510 % \begin{macrocode}
1511 \def\EmFi@convert#1#2{%
1512 \ifnum\pdf@strcmp{\EmFi@stringmethod}{psd}=0 %
1513 \pdfstringdef\EmFi@temp{#1}%
1514 \let#2\EmFi@temp
1515 \else
1516 \edef#2{\pdf@escapestring{#1}}%
1517 \fi
1518 }
1519 % \end{macrocode}
1520 % \end{macro}
1521 % \begin{macrocode}
1522 \global\let\EmFi@list\ltx@empty
1523 % \end{macrocode}
1524 % \begin{macro}{\EmFi@add}
1525 % Sorting is done by the insertion sort algorithm.
1526 % Probably the sorting could be done more reliable.
1527 % However, the PDF specification is not too clear to me
1528 % regarding precise sorting rules (how to deal with
1529 % different encodings, escaped characters, \dots).
1530 % \begin{macrocode}
1531 \def\EmFi@add#1#2{%
1532 \begingroup
1533 \ifx\EmFi@list\ltx@empty
1534 \xdef\EmFi@list{\noexpand\do{#1}{#2}}%
1535 \else
1536 \def\do##1##2{%
1537 \ifnum\pdf@strcmp{##1}{#1}>0 %
1538 \edef\x{%
1539 \toks@{%
1540 \the\toks@%
1541 \noexpand\do{#1}{#2}%
1542 \noexpand\do{##1}{##2}%
1543 }%
1544 }%
1545 \x
1546 \def\do####1####2{%
1547 \toks@\expandafter{\the\toks@\do{####1}{####2}}%
1548 }%
1549 \def\stop{%
1550 \xdef\EmFi@list{\the\toks@}%
1551 }%
1552 \else
1553 \toks@\expandafter{\the\toks@\do{##1}{##2}}%
1554 \fi
1555 }%
1556 \def\stop{%
1557 \xdef\EmFi@list{\the\toks@\noexpand\do{#1}{#2}}%
1558 }%
1559 \toks@{}%
1560 \EmFi@list\stop
1561 \fi
1562 \endgroup
1563 }
1564 % \end{macrocode}
1565 % \end{macro}
1566 % \begin{macro}{\embedfilefinish}
1567 % \begin{macrocode}
1568 \ifcsname ProvidesPackage\endcsname
1569 \ExplSyntaxOn
1570 \sys_ensure_backend:
1571 \IfPDFManagementActiveTF
1572 {
1573 \cs_new_eq:NN\emFi@pdfmanagementadd\pdfmanagement_add:nne
1574 }
1575 {}
1576 \cs_new_eq:NN\emFi@pdfobjectreflast\pdf_object_ref_last:
1577 \cs_new:Npn\emFi@pdfwritedict#1{\pdf_object_unnamed_write:ne{dict}{#1}}
1578 \cs_new:Npn\emFi@pdfwritearray#1{\pdf_object_unnamed_write:ne{array}{#1}}
1579 \cs_new:Npn\emFi@pdfwritefstream#1#2{\pdf_object_unnamed_write:ne{fstream}{{#1}{#2}}}
1580 \ExplSyntaxOff
1581 \else
1582 \def\IfPDFManagementActiveTF#1#2{#2}
1583 \def\emFi@pdfobjectreflast{\the\pdflastobj\ltx@space 0 R}
1584 \def\emFi@pdfwritedict#1{\immediate\pdfobj{<<#1>>}}
1585 \def\emFi@pdfwritearray#1{\immediate\pdfobj{[#1]}}
1586 \def\emFi@pdfwritefstream#1#2{\immediate\pdfobj stream attr{#1}file{#2}}
1587 \fi
1588 \def\embedfilefinish{%
1589 \ifEmFi@finished
1590 \EmFi@Error{%
1591 Too many invocations of \string\embedfilefinish
1592 }{%
1593 The list of embedded files is already written.%
1594 }%
1595 \else
1596 \ifx\EmFi@list\ltx@empty
1597 \else
1598 % \end{macrocode}
1599 % Write |/EmbeddedFiles| entry.
1600 % \begin{macrocode}
1601 \global\EmFi@finishedtrue
1602 \begingroup
1603 \IfPDFManagementActiveTF
1604 {%
1605 \def\do##1##2{%
1606 \emFi@pdfmanagementadd{Catalog/Names}
1607 {EmbeddedFiles}{##2}}%
1608 \EmFi@list
1609 }
1610 {%
1611 \def\do##1##2{%
1612 (##1)##2%
1613 }%
1614 \emFi@pdfwritedict{/Names[\EmFi@list]}
1615 \pdfnames{%
1616 /EmbeddedFiles \emFi@pdfobjectreflast%
1617 }}%
1618 \endgroup
1619 \begingroup
1620 \IfPDFManagementActiveTF
1621 {%
1622 \def\do##1##2{%
1623 \emFi@pdfmanagementadd{Catalog}{AF}{##2}}%
1624 \EmFi@list
1625 }
1626 {%
1627 \def\do##1##2{%
1628 \ltx@space##2%
1629 }%
1630 \emFi@pdfwritearray{\EmFi@list}%
1631 \pdfcatalog{%
1632 /AF \emFi@pdfobjectreflast%
1633 }%
1634 }
1635 \endgroup
1636 % \end{macrocode}
1637 % Write collection objects.
1638 % \begin{macrocode}
1639 \ifx\EmFi@initialfile\ltx@empty
1640 \else
1641 \EmFi@collectiontrue
1642 \fi
1643 \ifEmFi@collection
1644 \ifx\EmFi@initialfile\ltx@empty
1645 \let\EmFi@@initialfile\ltx@empty
1646 \else
1647 \edef\EmFi@@initialfile{%
1648 \pdf@escapestring{\EmFi@initialfile}%
1649 }%
1650 \fi
1651 % \end{macrocode}
1652 % Look for initial file among the embedded files.
1653 % \begin{macrocode}
1654 \begingroup
1655 \let\f=N%
1656 \def\do##1##2{%
1657 \def\x{##1}%
1658 \ifx\x\EmFi@@initialfile
1659 \let\f=Y%
1660 \let\do\ltx@gobbletwo
1661 \fi
1662 }%
1663 \EmFi@list
1664 \expandafter\endgroup
1665 \ifx\f Y%
1666 \else
1667 \@PackageWarningNoLine{embedfile}{%
1668 Missing initial file `\EmFi@initialfile'\MessageBreak
1669 among the embedded files%
1670 }%
1671 \let\EmFi@initialfile\ltx@empty
1672 \let\EmFi@@initialfile\ltx@empty
1673 \fi
1674 \ifcase\EmFi@sortcase
1675 \def\EmFi@temp{}%
1676 \or
1677 \def\EmFi@temp{%
1678 /S\EmFi@sortkeys
1679 /A \EmFi@sortorders
1680 }%
1681 \else
1682 \def\EmFi@temp{%
1683 /S[\EmFi@sortkeys]%
1684 /A[\EmFi@sortorders]%
1685 }%
1686 \fi
1687 \def\EmFi@@order##1{%
1688 \ifnum\EmFi@order>1 %
1689 /O ##1%
1690 \fi
1691 }%
1692 \emFi@pdfwritedict{%
1693 \ifx\EmFi@schema\ltx@empty
1694 \else
1695 /Schema<<\EmFi@schema>>%
1696 \fi
1697 \ifx\EmFi@@initialfile\ltx@empty
1698 \else
1699 /D(\EmFi@@initialfile)%
1700 \fi
1701 \ifx\EmFi@view\EmFi@S@tile
1702 /View/T%
1703 \else\ifx\EmFi@view\EmFi@S@hidden
1704 /View/H%
1705 \fi\fi
1706 \ifx\EmFi@temp\ltx@empty
1707 \EmFi@temp
1708 \else
1709 /Sort<<\EmFi@temp>>%
1710 \fi
1711 }
1712 \IfPDFManagementActiveTF
1713 {%
1714 \emFi@pdfmanagementadd{Catalog}{Collection}{\emFi@pdfobjectreflast}%
1715 }%
1716 {%
1717 \pdfcatalog{%
1718 /Collection \emFi@pdfobjectreflast%
1719 }%
1720 }%
1721 \fi
1722 \fi
1723 \fi
1724 }
1725 % \end{macrocode}
1726 % \end{macro}
1727 % \begin{macrocode}
1728 \begingroup\expandafter\expandafter\expandafter\endgroup
1729 \expandafter\ifx\csname AtEndDocument\endcsname\relax
1730 \else
1731 \AtEndDocument{\embedfilefinish}%
1732 \fi
1733 % \end{macrocode}
1734 %
1735 % \begin{macrocode}
1736 \EmFi@AtEnd%
1737 %</package>
1738 % \end{macrocode}
1739 % \section{Installation}
1740 %
1741 % \subsection{Download}
1742 %
1743 % \paragraph{Package.} This package is available on
1744 % CTAN\footnote{\CTANpkg{embedfile}}:
1745 % \begin{description}
1746 % \item[\CTAN{macros/latex/contrib/embedfile/embedfile.dtx}] The source file.
1747 % \item[\CTAN{macros/latex/contrib/embedfile/embedfile.pdf}] Documentation.
1748 % \end{description}
1749 %
1750 %
1751 % \paragraph{Bundle.} All the packages of the bundle `embedfile'
1752 % are also available in a TDS compliant ZIP archive. There
1753 % the packages are already unpacked and the documentation files
1754 % are generated. The files and directories obey the TDS standard.
1755 % \begin{description}
1756 % \item[\CTANinstall{install/macros/latex/contrib/embedfile.tds.zip}]
1757 % \end{description}
1758 % \emph{TDS} refers to the standard ``A Directory Structure
1759 % for \TeX\ Files'' (\CTANpkg{tds}). Directories
1760 % with \xfile{texmf} in their name are usually organized this way.
1761 %
1762 % \subsection{Bundle installation}
1763 %
1764 % \paragraph{Unpacking.} Unpack the \xfile{embedfile.tds.zip} in the
1765 % TDS tree (also known as \xfile{texmf} tree) of your choice.
1766 % Example (linux):
1767 % \begin{quote}
1768 % |unzip embedfile.tds.zip -d ~/texmf|
1769 % \end{quote}
1770 %
1771 % \subsection{Package installation}
1772 %
1773 % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
1774 % \docstrip\ archive. The files are extracted by running the
1775 % \xfile{.dtx} through \plainTeX:
1776 % \begin{quote}
1777 % \verb|tex embedfile.dtx|
1778 % \end{quote}
1779 %
1780 % \paragraph{TDS.} Now the different files must be moved into
1781 % the different directories in your installation TDS tree
1782 % (also known as \xfile{texmf} tree):
1783 % \begin{quote}
1784 % \def\t{^^A
1785 % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
1786 % embedfile.sty & tex/generic/embedfile/embedfile.sty\\
1787 % dtx-attach.sty & tex/generic/embedfile/dtx-attach.sty\\
1788 % embedfile.pdf & doc/latex/embedfile/embedfile.pdf\\
1789 % embedfile-example-plain.tex & doc/latex/embedfile/embedfile-example-plain.tex\\
1790 % embedfile-example-collection.tex & doc/latex/embedfile/embedfile-example-collection.tex\\
1791 % embedfile.dtx & source/latex/embedfile/embedfile.dtx\\
1792 % \end{tabular}^^A
1793 % }^^A
1794 % \sbox0{\t}^^A
1795 % \ifdim\wd0>\linewidth
1796 % \begingroup
1797 % \advance\linewidth by\leftmargin
1798 % \advance\linewidth by\rightmargin
1799 % \edef\x{\endgroup
1800 % \def\noexpand\lw{\the\linewidth}^^A
1801 % }\x
1802 % \def\lwbox{^^A
1803 % \leavevmode
1804 % \hbox to \linewidth{^^A
1805 % \kern-\leftmargin\relax
1806 % \hss
1807 % \usebox0
1808 % \hss
1809 % \kern-\rightmargin\relax
1810 % }^^A
1811 % }^^A
1812 % \ifdim\wd0>\lw
1813 % \sbox0{\small\t}^^A
1814 % \ifdim\wd0>\linewidth
1815 % \ifdim\wd0>\lw
1816 % \sbox0{\footnotesize\t}^^A
1817 % \ifdim\wd0>\linewidth
1818 % \ifdim\wd0>\lw
1819 % \sbox0{\scriptsize\t}^^A
1820 % \ifdim\wd0>\linewidth
1821 % \ifdim\wd0>\lw
1822 % \sbox0{\tiny\t}^^A
1823 % \ifdim\wd0>\linewidth
1824 % \lwbox
1825 % \else
1826 % \usebox0
1827 % \fi
1828 % \else
1829 % \lwbox
1830 % \fi
1831 % \else
1832 % \usebox0
1833 % \fi
1834 % \else
1835 % \lwbox
1836 % \fi
1837 % \else
1838 % \usebox0
1839 % \fi
1840 % \else
1841 % \lwbox
1842 % \fi
1843 % \else
1844 % \usebox0
1845 % \fi
1846 % \else
1847 % \lwbox
1848 % \fi
1849 % \else
1850 % \usebox0
1851 % \fi
1852 % \end{quote}
1853 % If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
1854 % TDS installing feature, then some files can already be in the right
1855 % place, see the documentation of \docstrip.
1856 %
1857 % \subsection{Refresh file name databases}
1858 %
1859 % If your \TeX~distribution
1860 % (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh
1861 % these. For example, \TeX\,Live\ users run \verb|texhash| or
1862 % \verb|mktexlsr|.
1863 %
1864 % \subsection{Some details for the interested}
1865 %
1866 % \paragraph{Unpacking with \LaTeX.}
1867 % The \xfile{.dtx} chooses its action depending on the format:
1868 % \begin{description}
1869 % \item[\plainTeX:] Run \docstrip\ and extract the files.
1870 % \item[\LaTeX:] Generate the documentation.
1871 % \end{description}
1872 % If you insist on using \LaTeX\ for \docstrip\ (really,
1873 % \docstrip\ does not need \LaTeX), then inform the autodetect routine
1874 % about your intention:
1875 % \begin{quote}
1876 % \verb|latex \let\install=y\input{embedfile.dtx}|
1877 % \end{quote}
1878 % Do not forget to quote the argument according to the demands
1879 % of your shell.
1880 %
1881 % \paragraph{Generating the documentation.}
1882 % You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
1883 % the documentation. The process can be configured by the
1884 % configuration file \xfile{ltxdoc.cfg}. For instance, put this
1885 % line into this file, if you want to have A4 as paper format:
1886 % \begin{quote}
1887 % \verb|\PassOptionsToClass{a4paper}{article}|
1888 % \end{quote}
1889 % An example follows how to generate the
1890 % documentation with pdf\LaTeX:
1891 % \begin{quote}
1892 %\begin{verbatim}
1893 %pdflatex embedfile.dtx
1894 %makeindex -s gind.ist embedfile.idx
1895 %pdflatex embedfile.dtx
1896 %makeindex -s gind.ist embedfile.idx
1897 %pdflatex embedfile.dtx
1898 %\end{verbatim}
1899 % \end{quote}
1900 %
1901 % \begin{thebibliography}{9}
1902 % \bibitem{attachfile}
1903 % Scott Pakin: \textit{The \xpackage{attachfile} package};
1904 % 2005/02/20 v1.2;
1905 % \CTANpkg{attachfile}.
1906 %
1907 % \bibitem{attachfile2}
1908 % Heiko Oberdiek: \textit{The \xpackage{attachfile2} package};
1909 % 2006/08/16 v2.2;
1910 % \CTANpkg{attachfile2}.
1911 %
1912 % \bibitem{pdfspec}
1913 % Adobe Systems Incorporated:
1914 % \href{http://www.adobe.com/devnet/acrobat/pdfs/pdf_reference.pdf}%
1915 % {\textit{PDF Reference, Sixth Edition, Version 1.7}},%
1916 % Oktober 2006;
1917 % \url{http://www.adobe.com/devnet/pdf/pdf_reference.html}.
1918 %
1919 % \bibitem{mime}
1920 % Network Working Group: RFC 2046, \textit{Multipurpose Internet Mail Extensions (MIME) Part Two:
1921 % Media Types}, November 1996; \url{http://www.rfc-editor.org/}.
1922 %
1923 % \bibitem{types}
1924 % IANA (Internet Assigned Numbers Authority):
1925 % \textit{MIME Media Types}, May 2006;
1926 % \url{http://www.iana.org/assignments/media-types/}.
1927 %
1928 % \end{thebibliography}
1929 %
1930 % \begin{History}
1931 % \begin{Version}{2006/08/16 v1.0}
1932 % \item
1933 % First public version.
1934 % \end{Version}
1935 % \begin{Version}{2007/04/11 v1.1}
1936 % \item
1937 % Line ends sanitized.
1938 % \end{Version}
1939 % \begin{Version}{2007/09/09 v1.2}
1940 % \item
1941 % Fixes for plain-TeX, wrapper for package \xpackage{keyval} added.
1942 % \item
1943 % Catcode section rewritten.
1944 % \end{Version}
1945 % \begin{Version}{2007/10/28 v2.0}
1946 % \item
1947 % Collection support added (PDF 1.7).
1948 % \end{Version}
1949 % \begin{Version}{2007/10/29 v2.1}
1950 % \item
1951 % Export of object references by adding new option \xoption{id} and
1952 % new macros \cs{embedfileifobjectexists} and \cs{embedfilegetobject}.
1953 % \end{Version}
1954 % \begin{Version}{2007/11/11 v2.2}
1955 % \item
1956 % Use of package \xpackage{pdftexcmds} for \LuaTeX\ support.
1957 % \end{Version}
1958 % \begin{Version}{2007/11/25 v2.3}
1959 % \item
1960 % Fix in use of \cs{pdf@filesize}, bug introduced in previous version.
1961 % \end{Version}
1962 % \begin{Version}{2009/09/25 v2.4}
1963 % \item
1964 % Bug fix: If \xpackage{hyperref} is used with option \xoption{unicode},
1965 % the Unicode encoded file name causes trouble. Therefore \cs{pdfstringdef}
1966 % is now never used for option \xoption{filespec}, always method
1967 % \texttt{escape} is applied (Peter Cibulka).
1968 % \item
1969 % Bug fix for \xoption{initialfile}.
1970 % \item
1971 % Bug fix for file names in \texttt{/EmbeddedFiles}.
1972 % \item
1973 % New option \xoption{ucfilespec} for file name support in Unicode
1974 % (since PDF 1.7).
1975 % \end{Version}
1976 % \begin{Version}{2010/03/01 v2.5}
1977 % \item
1978 % Compatibility for \iniTeX.
1979 % \item
1980 % Package \xpackage{keyval} replaced by packages \xpackage{kvsetkeys}
1981 % and \xpackage{kvdefinekeys} because of compatibility for \iniTeX.
1982 % \item
1983 % TDS location moved from TDS:tex/latex/oberdiek/embedfile.sty to
1984 % TDS:tex/generic/oberdiek/embedfile.sty.
1985 % \end{Version}
1986 % \begin{Version}{2011/04/13 v2.6}
1987 % \item
1988 % Docu fixes (thanks Hans-Martin M\"unch).
1989 % \end{Version}
1990 % \begin{Version}{2016/05/15 v2.7}
1991 % \item
1992 % LuaTeX compatibility
1993 % \end{Version}
1994 % \begin{Version}{2018/11/01 v2.8}
1995 % \item
1996 % Remove luatex85 package dependency.
1997 % \end{Version}
1998 % \begin{Version}{2019/12/03 v2.9}
1999 % \item
2000 % add \verb|/AF| and \verb|/AFrelationship| keys (Andreas Karrenbauer)
2001 % \item
2002 % add \verb|\pdfcatalog| emulation for Lua\TeX.
2003 % \item
2004 % update to use \xpackage{iftex}
2005 % \end{Version}
2006 % \begin{Version}{2020-04-14 v2.10}
2007 % \item Fix issue \#4, the value of afrelationship should not be
2008 % converted but name escaped.
2009 % \end{Version}
2010 % \begin{Version}{2020-04-24 v2.11}
2011 % \item Updated
2012 % \end{Version}%
2013 % \begin{Version}{2023-01-12 v2.12}
2014 % \item Allow the error message to be changed for better tex4ht compatibility (PR\#7)
2015 % \item Adapted the error message to luatex
2016 % \item The /UF key in the filespec dictionary is now set by default (PR\#6)
2017 % \end{Version}
2018 % \begin{Version}{2025-10-27 v2.13}
2019 % \item Add support for PDF management
2020 % \end{Version}
2021 % \end{History}
2022 %
2023 % \PrintIndex
2024 %
2025 % \Finale
2026 \endinput