texlive[51177] Master/texmf-dist: embedall (21may19)

commits+karl at tug.org commits+karl at tug.org
Tue May 21 23:03:31 CEST 2019


Revision: 51177
          http://tug.org/svn/texlive?view=revision&revision=51177
Author:   karl
Date:     2019-05-21 23:03:31 +0200 (Tue, 21 May 2019)
Log Message:
-----------
embedall (21may19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/embedall/embedall.pdf
    trunk/Master/texmf-dist/source/latex/embedall/embedall.dtx
    trunk/Master/texmf-dist/source/latex/embedall/embedall.ins
    trunk/Master/texmf-dist/tex/latex/embedall/embedall.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/embedall/README

Added: trunk/Master/texmf-dist/doc/latex/embedall/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/embedall/README	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/embedall/README	2019-05-21 21:03:31 UTC (rev 51177)
@@ -0,0 +1,2 @@
+This package provides an easy way of storing the main TeX file as an attachment in the output PDF.
+The same functionality is provided for several types of content imports like external TeX files, images and listings.


Property changes on: trunk/Master/texmf-dist/doc/latex/embedall/README
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/latex/embedall/embedall.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/embedall/embedall.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/embedall/embedall.dtx	2019-05-21 21:03:18 UTC (rev 51176)
+++ trunk/Master/texmf-dist/source/latex/embedall/embedall.dtx	2019-05-21 21:03:31 UTC (rev 51177)
@@ -1,36 +1,33 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 20013 by Alberto Sartori
+% Copyright (C) 2013 by Alberto Sartori
+% Copyright (C) 2019 by David Lichti
 % -------------------------------------------------------
 % 
 % This file may be distributed and/or modified under the
-% conditions of the LaTeX Project Public License, either version 1.2
-% of this license or (at your option) any later version.
-% The latest version of this license is in:
+% conditions of the LaTeX Project Public License, either
+% version 1.3 of this license or (at your option) any later
+% version. The latest version of this license is in:
 %
 %    http://www.latex-project.org/lppl.txt
 %
-% and version 1.2 or later is part of all distributions of LaTeX 
-% version 1999/12/01 or later.
+% and version 1.3 or later is part of all distributions of
+% LaTeX version 2005/12/01 or later.
 %
 % \fi
 %
 % \iffalse
-%<*driver>
-\ProvidesFile{embedall.dtx}
-%</driver>
-%<package>\NeedsTeXFormat{LaTeX2e}[1994/06/01]
-%<package>\ProvidesPackage{embedall}
-%<*package>
-    [2013/10/10 v1.0 embed files in pdf]
-%</package>
 %
+%<package>\NeedsTeXFormat{LaTeX2e}
+%<package>\ProvidesClass{embedall}[2019/05/18 v2.0 Automatically embed source files in PDF]
+%
 %<*driver>
 \documentclass{ltxdoc}
-\usepackage{embedall}[2013/10/10]
+\usepackage[notall]{embedall}[2019/05/18]
+\usepackage[utf8]{inputenc}
 \usepackage[T1]{fontenc}
 \usepackage[osf,sc]{mathpazo}
-\usepackage{hyperref}
+\usepackage{parskip}
 \renewcommand\sfdefault{lmsf}
 \renewcommand\ttdefault{lmtt}
 \usepackage{microtype}
@@ -37,18 +34,18 @@
 \linespread{1.1}
 \usepackage{enumitem}
 \setdescription{font=\itshape,leftmargin=2cm,style=sameline}
+\usepackage{hyperref}
 \EnableCrossrefs         
 \CodelineIndex
 \RecordChanges
 \begin{document}
   \DocInput{embedall.dtx}
-  %\PrintChanges
-  %\PrintIndex
 \end{document}
 %</driver>
+% 
 % \fi
 %
-% \CheckSum{74}
+% \CheckSum{154}
 %
 % \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
@@ -67,123 +64,343 @@
 %   Right brace   \}     Tilde         \~}
 %
 % \changes{v1.0}{2013/10/10}{Initial version}
+% \changes{v2.0}{2019/05/18}{Overhaul using filehook package}
 %
-% \GetFileInfo{embedall.dtx}
+% \GetFileInfo{embedall.sty}
 %
 % \DoNotIndex{\newcommand,\def,\let,\DeclareRobustCommand}
+% \DoNotIndex{\newif,\DeclareOption,\ProcessOptions,\relax,\RequirePackage,\fi,\else,\ifcsname,\endcsname,\PackageWarning,\^\^}
+% \DoNotIndex{\AtBeginDocument,\IfFileExists,\input,\jobname,\LetLtxMacro,\listxadd,\message,\newlinechar,\xifinlist}
+% \DoNotIndex{\embedfile,\currfilename,\AtBeginOfInputs,\AtBeginOfIncludes}
+% \DoNotIndex{\Gin at setfile}
+% \DoNotIndex{\csvloop,\csv at input@filename}
 %
 % \title{The \textbf{embedall} package\thanks{This document
 %   corresponds to \textsf{embedall}~\fileversion, dated \filedate.}}
-% \author{Alberto Sartori \\ \texttt{\href{mailto:alberto.sartori.as at gmail.com}{alberto.sartori.as at gmail.com}}}
+% \author{
+%    Alberto Sartori -- \texttt{\href{mailto:alberto.sartori.as at gmail.com}{alberto.sartori.as at gmail.com}}\\
+%    David Lichti -- \texttt{\href{mailto:dlichtistw at gmx.de}{dlichtistw at gmx.de}}
+% }
 %
 % \maketitle
 %
+% \embedsource[desc=main source file]
+%
 % \section{Introduction}
 %
-% This package is designed to help you storing your projects without losing anything. It uses the |embedfile| package in order to attach to the generated |pdf| file all files used in creating your project. In particular it can embed images, external |tex| files, external codes and most important the source file itself.
+% This package is designed to help you storing your projects without losing anything.
+% It uses the |filehook| package and some custom patches to hook into several supported import mechanisms.
+% These imported files are then attached to the PDF file using the |embedfile| package.
+% In particular it can embed images, external TeX files, external code listings, CSV files, and, most importantly, the main TeX file itself.
 %
-% \section{Options}
+% \section{Usage}
 %
-% If you use this package without specifying any option, |embedall| attaches by default all files it can. If you don't want to do so you have to use one (or more than one) of the following options. Every option attaches the files it refers to:
+% To use the package, simply add |\usepackage{embedsources}| to your document's preamble.
+% Without any option, the default behaviour is to attach all supported source file types to the finished document.
+% See section~\ref{sec:PackageOptions} for options to change this behaviour.
+% No furhter macros are needed, and no change has to be made to the rest of the source.
+%
+% As of now, this package can hook into |\input| and |\include| using the |filehook| package.
+% Furthermore, two hooks for |graphicx| and |csvsimple| are provided.
+%
+% \subsection{Package Options}\label{sec:PackageOptions}
+%
+% If the package is loaded without any option, then all hooks are installed.
+% In case this is not wanted, each hook can be enabled individually.
 % \begin{description}
-% \item[graphicx] images included with the |\includegraphics| command of the |graphicx| package
-% \item[listings] external codes included with |\listinputlisting| command of the |listings| package
-% \item[source] the main source |tex| file
+%    \item[|main|] Attach the main source file.
+%        This uses the |\AtBeginDocument| hook.
+%    \item[|input|] Attach files loaded with |\input|.
+%        This is done using |\AtBeginOfInputs| from the |filehook| package.
+%        It also applies to every macro relying on |\input| to load external content.
+%    \item[|include|] Attach files loaded with |\include|.
+%        This is done using the |\AtBeginOfIncludes| hook.
+%    \item[|graphicx|] Attach image files used with |\includegraphics|.
+%        This patches some macro in the |graphicx| package, so make sure that it is loaded prior to |embedsources|.
+%    \item[|csvsimple|] Attach data files used with the |csvsimple| package.
+%        Make sure that it is already loaded.
 % \end{description}
-% Note that the |embedall| package imports the |graphicx| and |listings| packages without any options so if you want to specify some options you have to do it before |\usepackage{embedall}| either with |\usepackage|\oarg{options}|{graphicx}| or with |\PassOptionsToPackage|\marg{options}|{graphicx}|  (the same for |listings|).
+% Specifying any of these options will disable all hooks that are not enabled explicitly.
 %
-% \section{Commands}
-% \DescribeMacro{\embedinput} \noindent This is the only new command defined by this package. It is the substitute of the |\input| one and it adds the feature of attaching the file to the |pdf| after inserting it in the |tex| source. It was not possible to directly redefine the |\input| command because it is often used by other packages to import their own source code so its redefinition would have the disadvantage of attaching also these files to the final document.
+% There are some other options for very special cases.
+% \begin{description}
+%    \item[|all|] Enable all file type hooks.
+%        This is the default and the option is mostly redundant.
+%        However, it may be used to reenable all hooks, after an explicit type option has disabled them.
+%    \item[|notall|] Do not enable all file type hooks.
+%        As for the the |all| option, this is mostly useless, since it disables all effects this package was intended for.
+%        However, some side effects may remain.
+%        Consider not loading the package at all.
+%    \item[|compat|] Enable compatibility mode to maintain some functionality from version 1.0.
+%        Use this if your document needs the old style |\embedinput| macro.
+%\end{description}
+%
+% \subsection{User Commands}
+%
+% \DescribeMacro{\embedfile \oarg{options} \marg{filename}}
+% Although not defined by this package, it is made available by loading |embedfile|.
+% You may use it to manually embed sources or any file, that is not covered by the hooks described above.
+% See the |embedfile| documentation for more details.
+%
+% \DescribeMacro{\embedsource \oarg{options}}
+% This macro can be used to embed the current TeX file in case the automatic hook has been disabled.
+% Use it inside the file to be loaded.
+% The \meta{options} are passed to the |\embedfile| macro.
 % 
+% \DescribeMacro{\embedinput \oarg{options} \marg{filename}}
+% This command is a substitute for |\input{<filename>}| in compatibility mode.
+% It adds the feature of attaching the file to the PDF after inserting it in the TeX source.
+% The \meta{options} are ultimately passed to the |\embedfile| macro.
+% As of version 2.0 with the automatic input file hook enabled, this is not needed anymore.
+% Consider using |\embedsource| for manual embedding without the automatic hook.
+%
+% \section{Compatibility}
+%
+% This package heavily relies on |filehook|'s\footnote{filehook package: \url{https://ctan.org/pkg/filehook}} file hooks and |embedfile|'s\footnote{embedfile package: \url{https://ctan.org/pkg/embedfile}} file embedding.
+% See the compatibility notes in their respective documentations.
+%
+% Furthermore, hooking into the |graphicx| and |csvsimple| macros is done by patching some of their macros.
+% If they have not been loaded when |embedall| is loaded, this will fail.
+% If they are loaded or reloaded after |embedall|, these patches may be overwritten.
+% To ensure good functionality, load this package after all packages providing import commands.
+%
 % \StopEventually{}
 %
 % \section{Implementation}
 %
-% Initial operations: declaration of packages, commands and options.
+% \subsection{Options}
+%
+% First, we need some booleans to store package options.
+% The switch |embedall at all| acts on all types of hooks.
 %    \begin{macrocode}
-
+\newif\ifembedall at all
+\embedall at alltrue
+%    \end{macrocode}
+% The following |embedall@<hook>| can be used to enable specific embedding hooks.
+%    \begin{macrocode}
+\newif\ifembedall at main
+\embedall at mainfalse
+\newif\ifembedall at input
+\embedall at inputfalse
+\newif\ifembedall at include
+\embedall at includefalse
+\newif\ifembedall at graphicx
+\embedall at graphicxfalse
+\newif\ifembedall at csvsimple
+\embedall at csvsimplefalse
+%    \end{macrocode}
+% Compatibility mode is disabled by default.
+%    \begin{macrocode}
+\newif\ifembedall at compat
+\embedall at compatfalse
+%    \end{macrocode}
+%
+% Now, declare the actual package options.
+%    \begin{macrocode}
+\DeclareOption{all}{\embedall at alltrue}
+\DeclareOption{notall}{\embedall at allfalse}
+%    \end{macrocode}
+% The following options correspond to the more specific embedding hooks mentioned above.
+% Using any of these options will turn of general embedding off all source file types.
+%    \begin{macrocode}
+\DeclareOption{main}{\embedall at maintrue\embedall at allfalse}
+\DeclareOption{input}{\embedall at inputtrue\embedall at allfalse}
+\DeclareOption{include}{\embedall at includetrue\embedall at allfalse}
+\DeclareOption{graphicx}{\embedall at graphicxtrue\embedall at allfalse}
+\DeclareOption{csvsimple}{\embedall at csvsimpletrue\embedall at allfalse}
+%    \end{macrocode}
+% Request compatibility mode.
+%    \begin{macrocode}
+\DeclareOption{compat}{\embedall at compattrue}
+%    \end{macrocode}
+%
+% Now, process these options.
+%    \begin{macrocode}
+\ProcessOptions\relax
+%    \end{macrocode}
+%
+% Turn on all |embedall@<hook>| if |embedall at all| is |true|.
+%    \begin{macrocode}
+\ifembedall at all
+    \embedall at maintrue
+    \embedall at inputtrue
+    \embedall at includetrue
+    \embedall at graphicxtrue
+    \embedall at csvsimpletrue
+\fi
+%    \end{macrocode}
+%
+% \subsection{Dependencies}
+%
+% Load packages for file embedding and file hooks.
+%    \begin{macrocode}
 \RequirePackage{embedfile}
-\RequirePackage{graphicx}
-\RequirePackage{listings}
-\RequirePackage{letltxmacro}
-
-\newcommand\embedall at all{1}
-\newcommand\embedall at graphicx{0}
-\newcommand\embedall at list{0}
-\newcommand\embedall at source{0}
-
-\DeclareOption{graphicx}{\def\embedall at graphicx{1}\def\embedall at all{0}}
-\DeclareOption{listings}{\def\embedall at list{1}\def\embedall at all{0}}
-\DeclareOption{source}{\def\embedall at source{1}\def\embedall at all{0}}
-
-\ProcessOptions
-
+\RequirePackage{filehook}
+\RequirePackage{currfile}
+\RequirePackage{etoolbox}
+\ifembedall at compat
+    \RequirePackage{letltxmacro}
+\fi
 %    \end{macrocode}
+%
+% \subsection{Macros}
+%
+% \begin{macro}{\embedsource}
+% We define a shorthand to embed the current source file.
+%    \begin{macrocode}
+\newcommand\embedsource[1][]{\embedall at embed[#1]{\currfilename}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\embedall at filelist}
+% Keep a list of files that have already been attached.
+%    \begin{macrocode}
+\def\embedall at filelist{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\embedall at embed}
+% This is done to avoid embedding the same file multiple times.
+%    \begin{macrocode}
+\newcommand{\embedall at embed}[2][]{%
+    \xifinlist{#2}{\embedall at filelist}{}{%
+        \newlinechar=`\^^J%
+        \message{^^J^^Jembedall: Attaching file '#2'.^^J^^J}%
+        \embedfile[#1]{#2}%
+        \listxadd{\embedall at filelist}{#2}%
+    }%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsection{Compatibility Commands}
+%
+% The following macros are only defined in compatibility mode to maintain backward compatibility.
+%    \begin{macrocode}
+\ifembedall at compat
+%    \end{macrocode}
+%
 % \begin{macro}{\embedall at includegraphics}
-% This macro is the modified version of |\includegraphics| command from the |graphicx| package with included the |\embedfile| command. First the original |\includegraphics| command is stored inside the not-user-accessible |\embedall at latex@includegraphics|.
+% This macro is the modified version of |\includegraphics| command from the |graphicx| package with included the |\embedfile| command.
+% First the original |\includegraphics| command is stored inside the not-user-accessible |\embedall at latex@includegraphics|.
 %    \begin{macrocode}
-\LetLtxMacro\embedall at latex@includegraphics\includegraphics
+    \LetLtxMacro\embedall at latex@includegraphics\includegraphics
 %    \end{macrocode}
-% |\LetLtxMacro| is used (instead of simply |\let|) because some packages modify the |\includegraphics| command. For this reason you can not use the * variant of this command but you have to declare the |clip| option instead.
+% |\LetLtxMacro| is used (instead of simply |\let|) because some packages modify the |\includegraphics| command.
+% For this reason you can not use the * variant of this command but you have to declare the |clip| option instead.
 %
 % Then the |\embedall at includegraphics| is defined
 %    \begin{macrocode}
-\newcommand\embedall at includegraphics[2][]{%
-    \embedfile[desc=image]{#2}
-    \embedall at latex@includegraphics[#1]{#2}%
-}
-
+    \newcommand\embedall at includegraphics[2][]{%
+        \embedall at embed[desc=image]{#2}
+        \embedall at latex@includegraphics[#1]{#2}%
+    }
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}{\embedall at listinputlisting}
-% This macro is the modified version of |\listinputlisting| command from the |listings| package with included the |\embedfile| command. First the original |\listinputlisting| command is stored inside the not-user-accessible |\embedall at latex@listinputlisting|.
+% This macro is the modified version of |\listinputlisting| command from the |listings| package with included the |\embedfile| command.
+% First the original |\listinputlisting| command is stored inside the not-user-accessible |\embedall at latex@listinputlisting|.
 %    \begin{macrocode}
-\LetLtxMacro\embedall at latex@lstinputlisting\lstinputlisting
+    \LetLtxMacro\embedall at latex@lstinputlisting\lstinputlisting
 %    \end{macrocode}
 % Then the |\embedall at listinputlisting| is defined
 %    \begin{macrocode}
-\newcommand\embedall at lstinputlisting[2][]{%
-    \embedfile[desc=listing file]{#2}
-    \embedall at latex@lstinputlisting[#1]{#2}%
-}
-
+    \newcommand\embedall at lstinputlisting[2][]{%
+        \embedfile[desc=listing file]{#2}
+        \embedall at latex@lstinputlisting[#1]{#2}%
+    }
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}{\embedinput}
-% This command substitute the |\input| one, the added optional option gives the input file
-% description in the generated pdf.
+% This command can be used as a substitute for |\input| to manually embed the source if the automatic file hook is not enabled.
+% Otherwise, it will just call |\input| without further side effects.
+% The additional optional parameter sets the input file description in the generated PDF.
 %    \begin{macrocode}
-\DeclareRobustCommand\embedinput[2][input file]{%
-    \input{#2}%
-    \embedfile[desc={#1}]{#2}%
-}
-
+    \ifembedall at input
+        \DeclareRobustCommand\embedinput[2][]{%
+            \input{#2}%
+        }
+    \else
+        \DeclareRobustCommand\embedinput[2][input file]{%
+            \input{#2}%
+            \embedall at embed[desc={#1}]{#2}%
+        }
+    \fi
+\fi
 %    \end{macrocode}
 % \end{macro}
 %
-% \noindent Finally options are processed
+% \subsection{Installing Hooks}
+%
+% The actual work happens here.
+% First, the main source file is attached.
 %    \begin{macrocode}
-\ifnum\embedall at all=1%
-    \def\embedall at graphicx{1}
-    \def\embedall at list{1}
-    \def\embedall at source{1}
+\ifembedall at main
+    \ifembedall at compat
+        \IfFileExists{./\jobname.tex}{%
+            \embedall at embed[desc=main source file]{\jobname.tex}
+        }{}
+    \else
+        \AtBeginDocument{\embedsource[desc=main source file]}
+    \fi
 \fi
-\ifnum\embedall at graphicx=1%
-    \LetLtxMacro\includegraphics\embedall at includegraphics
+%    \end{macrocode}
+% These macros are provided by the |embedfile| and |currfile| packages.
+%
+% Then, the hooks for |\input| and |\include| are installed, given the respective switch was enabled.
+%    \begin{macrocode}
+\ifembedall at input
+    \AtBeginOfInputs{\embedsource[desc=input file]}
 \fi
-\ifnum\embedall at list=1%
-    \LetLtxMacro\lstinputlisting\embedall at lstinputlisting
+\ifembedall at include
+    \AtBeginOfIncludes{\embedsource[desc=include file]}
 \fi
-
 %    \end{macrocode}
-% and the complete tex source file is also included if the |source| option is present.
+% The macros |\AtBeginOfInputs| and |\AtBeginOfIncludes| are provided by the |filehook| package.
+%
+% For the |graphicx| hook, we need to patch the |\Gin at setfile| macro to call |\embedfile| after finishing its own work.
+% At this point, the full file name including the file name extension will be available as the third argument passed to the macro.
 %    \begin{macrocode}
-\IfFileExists{./\jobname.tex}{%
-    \ifnum\embedall at source=1%
-        \embedfile[desc=main source file]{\jobname.tex}\fi}{}
+\ifembedall at graphicx
+    \ifcsname Gin at setfile\endcsname
+        \let\embedall at Gin@setfile\Gin at setfile
+        \def\Gin at setfile#1#2#3{%
+            \embedall at Gin@setfile{#1}{#2}{#3}%
+            \embedall at embed[image file]{#3}%
+        }
 %    \end{macrocode}
+% Issue a warning if |\Gin at setfile| does not exists.
+% This could happen in the unlikely case that the internal workings of |graphicx| have changed, or, more likely, because the package was not loaded.
+%    \begin{macrocode}
+    \else
+        \ifembedall at all\else
+            \PackageWarning{embedall}{Patching of graphicx requested, but package not loaded. Consider removing the 'graphicx' option.}
+        \fi
+    \fi
+\fi
+%    \end{macrocode}
+%
+% The |csvsimple| hook is very similar to the |graphicx| hook.
+% It patches into the |\csvloop| macro which is used by all other user macros to do the actual work.
+%    \begin{macrocode}
+\ifembedall at csvsimple
+    \ifcsname csvloop\endcsname
+        \let\embedall at csvloop\csvloop
+        \def\csvloop#1{%
+            \embedall at csvloop{#1}%
+            \embedall at embed[CSV file]{\csv at input@filename}%
+        }
+    \else
+        \ifembedall at all\else
+            \PackageWarning{embedall}{Patching of csvsimple requested explicitly, but package not loaded. Consider removing the 'csvsimple' option.}
+        \fi
+    \fi
+\fi
+%    \end{macrocode}
+% The |\csv at input@filename| macro is used in the |csvsimple| macro to store the input file name.
+%
 % \Finale
-
+%
 \endinput

Modified: trunk/Master/texmf-dist/source/latex/embedall/embedall.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/embedall/embedall.ins	2019-05-21 21:03:18 UTC (rev 51176)
+++ trunk/Master/texmf-dist/source/latex/embedall/embedall.ins	2019-05-21 21:03:31 UTC (rev 51177)
@@ -1,21 +1,23 @@
 %%
 %% Copyright (C) 2013 by Alberto Sartori
+%% Copyright (C) 2019 by David Lichti
 %%
-%% This file may be distributed and/or modified under the conditions of
-%% the LaTeX Project Public License, either version 1.2 of this license
-%% or (at your option) any later version.  The latest version of this
-%% license is in:
-%% 
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3 of this license or (at your option) any later
+%% version. The latest version of this license is in:
+%%
 %%    http://www.latex-project.org/lppl.txt
-%% 
-%% and version 1.2 or later is part of all distributions of LaTeX version
-%% 1999/12/01 or later.
 %%
+%% and version 1.3 or later is part of all distributions of
+%% LaTeX version 2005/12/01 or later.
+%%
 
-\input docstrip.tex
+\input{docstrip.tex}
+
 \keepsilent
 
-\usedir{tex/latex/skeleton}
+\usedir{tex/latex/embedall}
 
 \preamble
 
@@ -22,16 +24,17 @@
 This is a generated file.
 
 Copyright (C) 2013 by Alberto Sartori
+Copyright (C) 2019 by David Lichti
 
-This file may be distributed and/or modified under the conditions of
-the LaTeX Project Public License, either version 1.2 of this license
-or (at your option) any later version.  The latest version of this
-license is in:
+This file may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either
+version 1.3 of this license or (at your option) any later
+version. The latest version of this license is in:
 
-   http://www.latex-project.org/lppl.txt
+http://www.latex-project.org/lppl.txt
 
-and version 1.2 or later is part of all distributions of LaTeX version
-1999/12/01 or later.
+and version 1.3 or later is part of all distributions of
+LaTeX version 2005/12/01 or later.
 
 \endpreamble
 

Modified: trunk/Master/texmf-dist/tex/latex/embedall/embedall.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/embedall/embedall.sty	2019-05-21 21:03:18 UTC (rev 51176)
+++ trunk/Master/texmf-dist/tex/latex/embedall/embedall.sty	2019-05-21 21:03:31 UTC (rev 51177)
@@ -9,70 +9,130 @@
 %% This is a generated file.
 %% 
 %% Copyright (C) 2013 by Alberto Sartori
+%% Copyright (C) 2019 by David Lichti
 %% 
-%% This file may be distributed and/or modified under the conditions of
-%% the LaTeX Project Public License, either version 1.2 of this license
-%% or (at your option) any later version.  The latest version of this
-%% license is in:
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3 of this license or (at your option) any later
+%% version. The latest version of this license is in:
 %% 
-%%    http://www.latex-project.org/lppl.txt
+%% http://www.latex-project.org/lppl.txt
 %% 
-%% and version 1.2 or later is part of all distributions of LaTeX version
-%% 1999/12/01 or later.
+%% and version 1.3 or later is part of all distributions of
+%% LaTeX version 2005/12/01 or later.
 %% 
-\NeedsTeXFormat{LaTeX2e}[1994/06/01]
-\ProvidesPackage{embedall}
-    [2013/10/10 v1.0 embed files in pdf]
-
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesClass{embedall}[2019/05/18 v2.0 Automatically embed source files in PDF]
+\newif\ifembedall at all
+\embedall at alltrue
+\newif\ifembedall at main
+\embedall at mainfalse
+\newif\ifembedall at input
+\embedall at inputfalse
+\newif\ifembedall at include
+\embedall at includefalse
+\newif\ifembedall at graphicx
+\embedall at graphicxfalse
+\newif\ifembedall at csvsimple
+\embedall at csvsimplefalse
+\newif\ifembedall at compat
+\embedall at compatfalse
+\DeclareOption{all}{\embedall at alltrue}
+\DeclareOption{notall}{\embedall at allfalse}
+\DeclareOption{main}{\embedall at maintrue\embedall at allfalse}
+\DeclareOption{input}{\embedall at inputtrue\embedall at allfalse}
+\DeclareOption{include}{\embedall at includetrue\embedall at allfalse}
+\DeclareOption{graphicx}{\embedall at graphicxtrue\embedall at allfalse}
+\DeclareOption{csvsimple}{\embedall at csvsimpletrue\embedall at allfalse}
+\DeclareOption{compat}{\embedall at compattrue}
+\ProcessOptions\relax
+\ifembedall at all
+    \embedall at maintrue
+    \embedall at inputtrue
+    \embedall at includetrue
+    \embedall at graphicxtrue
+    \embedall at csvsimpletrue
+\fi
 \RequirePackage{embedfile}
-\RequirePackage{graphicx}
-\RequirePackage{listings}
-\RequirePackage{letltxmacro}
-
-\newcommand\embedall at all{1}
-\newcommand\embedall at graphicx{0}
-\newcommand\embedall at list{0}
-\newcommand\embedall at source{0}
-
-\DeclareOption{graphicx}{\def\embedall at graphicx{1}\def\embedall at all{0}}
-\DeclareOption{listings}{\def\embedall at list{1}\def\embedall at all{0}}
-\DeclareOption{source}{\def\embedall at source{1}\def\embedall at all{0}}
-
-\ProcessOptions
-
-\LetLtxMacro\embedall at latex@includegraphics\includegraphics
-\newcommand\embedall at includegraphics[2][]{%
-    \embedfile[desc=image]{#2}
-    \embedall at latex@includegraphics[#1]{#2}%
+\RequirePackage{filehook}
+\RequirePackage{currfile}
+\RequirePackage{etoolbox}
+\ifembedall at compat
+    \RequirePackage{letltxmacro}
+\fi
+\newcommand\embedsource[1][]{\embedall at embed[#1]{\currfilename}}
+\def\embedall at filelist{}
+\newcommand{\embedall at embed}[2][]{%
+    \xifinlist{#2}{\embedall at filelist}{}{%
+        \newlinechar=`\^^J%
+        \message{^^J^^Jembedall: Attaching file '#2'.^^J^^J}%
+        \embedfile[#1]{#2}%
+        \listxadd{\embedall at filelist}{#2}%
+    }%
 }
-
-\LetLtxMacro\embedall at latex@lstinputlisting\lstinputlisting
-\newcommand\embedall at lstinputlisting[2][]{%
-    \embedfile[desc=listing file]{#2}
-    \embedall at latex@lstinputlisting[#1]{#2}%
-}
-
-\DeclareRobustCommand\embedinput[2][input file]{%
-    \input{#2}%
-    \embedfile[desc={#1}]{#2}%
-}
-
-\ifnum\embedall at all=1%
-    \def\embedall at graphicx{1}
-    \def\embedall at list{1}
-    \def\embedall at source{1}
+\ifembedall at compat
+    \LetLtxMacro\embedall at latex@includegraphics\includegraphics
+    \newcommand\embedall at includegraphics[2][]{%
+        \embedall at embed[desc=image]{#2}
+        \embedall at latex@includegraphics[#1]{#2}%
+    }
+    \LetLtxMacro\embedall at latex@lstinputlisting\lstinputlisting
+    \newcommand\embedall at lstinputlisting[2][]{%
+        \embedfile[desc=listing file]{#2}
+        \embedall at latex@lstinputlisting[#1]{#2}%
+    }
+    \ifembedall at input
+        \DeclareRobustCommand\embedinput[2][]{%
+            \input{#2}%
+        }
+    \else
+        \DeclareRobustCommand\embedinput[2][input file]{%
+            \input{#2}%
+            \embedall at embed[desc={#1}]{#2}%
+        }
+    \fi
 \fi
-\ifnum\embedall at graphicx=1%
-    \LetLtxMacro\includegraphics\embedall at includegraphics
+\ifembedall at main
+    \ifembedall at compat
+        \IfFileExists{./\jobname.tex}{%
+            \embedall at embed[desc=main source file]{\jobname.tex}
+        }{}
+    \else
+        \AtBeginDocument{\embedsource[desc=main source file]}
+    \fi
 \fi
-\ifnum\embedall at list=1%
-    \LetLtxMacro\lstinputlisting\embedall at lstinputlisting
+\ifembedall at input
+    \AtBeginOfInputs{\embedsource[desc=input file]}
 \fi
-
-\IfFileExists{./\jobname.tex}{%
-    \ifnum\embedall at source=1%
-        \embedfile[desc=main source file]{\jobname.tex}\fi}{}
-
+\ifembedall at include
+    \AtBeginOfIncludes{\embedsource[desc=include file]}
+\fi
+\ifembedall at graphicx
+    \ifcsname Gin at setfile\endcsname
+        \let\embedall at Gin@setfile\Gin at setfile
+        \def\Gin at setfile#1#2#3{%
+            \embedall at Gin@setfile{#1}{#2}{#3}%
+            \embedall at embed[image file]{#3}%
+        }
+    \else
+        \ifembedall at all\else
+            \PackageWarning{embedall}{Patching of graphicx requested, but package not loaded. Consider removing the 'graphicx' option.}
+        \fi
+    \fi
+\fi
+\ifembedall at csvsimple
+    \ifcsname csvloop\endcsname
+        \let\embedall at csvloop\csvloop
+        \def\csvloop#1{%
+            \embedall at csvloop{#1}%
+            \embedall at embed[CSV file]{\csv at input@filename}%
+        }
+    \else
+        \ifembedall at all\else
+            \PackageWarning{embedall}{Patching of csvsimple requested explicitly, but package not loaded. Consider removing the 'csvsimple' option.}
+        \fi
+    \fi
+\fi
 \endinput
 %%
 %% End of file `embedall.sty'.



More information about the tex-live-commits mailing list