diff options
author | Karl Berry <karl@freefriends.org> | 2013-10-14 22:28:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-10-14 22:28:46 +0000 |
commit | 9f85f95eb8ea005052f16a229098bf48ada96635 (patch) | |
tree | 6d46747aa9edf834f9caa6924a8003a50e4bddc9 /Master/texmf-dist/source/latex | |
parent | 2f0a462b7fbebdd8c80a7212f215fceefbf691c4 (diff) |
embedall (14oct13)
git-svn-id: svn://tug.org/texlive/trunk@31903 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/embedall/embedall.dtx | 189 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/embedall/embedall.ins | 55 |
2 files changed, 244 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/embedall/embedall.dtx b/Master/texmf-dist/source/latex/embedall/embedall.dtx new file mode 100644 index 00000000000..763963da21d --- /dev/null +++ b/Master/texmf-dist/source/latex/embedall/embedall.dtx @@ -0,0 +1,189 @@ +% \iffalse meta-comment +% +% Copyright (C) 20013 by Alberto Sartori +% ------------------------------------------------------- +% +% 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: +% +% 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. +% +% \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> +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{embedall}[2013/10/10] +\usepackage[T1]{fontenc} +\usepackage[osf,sc]{mathpazo} +\usepackage{hyperref} +\renewcommand\sfdefault{lmsf} +\renewcommand\ttdefault{lmtt} +\usepackage{microtype} +\linespread{1.1} +\usepackage{enumitem} +\setdescription{font=\itshape,leftmargin=2cm,style=sameline} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{embedall.dtx} + %\PrintChanges + %\PrintIndex +\end{document} +%</driver> +% \fi +% +% \CheckSum{74} +% +% \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 +% Lower-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 +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% \changes{v1.0}{2013/10/10}{Initial version} +% +% \GetFileInfo{embedall.dtx} +% +% \DoNotIndex{\newcommand,\def,\let,\DeclareRobustCommand} +% +% \title{The \textbf{embedall} package\thanks{This document +% corresponds to \textsf{embedall}~\fileversion, dated \filedate.}} +% \author{Alberto Sartori \\ \texttt{\href{mailto:alberto.sartori.as@gmail.com}{alberto.sartori.as@gmail.com}}} +% +% \maketitle +% +% \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. +% +% \section{Options} +% +% 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: +% \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 +% \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|). +% +% \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. +% +% \StopEventually{} +% +% \section{Implementation} +% +% Initial operations: declaration of packages, commands and options. +% \begin{macrocode} + +\RequirePackage{embedfile} +\RequirePackage{graphicx} +\RequirePackage{listings} +\RequirePackage{letltxmacro} + +\newcommand\embedall@all{1} +\newcommand\embedall@graphicx{0} +\newcommand\embedall@list{0} +\newcommand\embedall@source{0} + +\DeclareOption{graphicx}{\def\embedall@graphicx{1}\def\embedall@all{0}} +\DeclareOption{listings}{\def\embedall@list{1}\def\embedall@all{0}} +\DeclareOption{source}{\def\embedall@source{1}\def\embedall@all{0}} + +\ProcessOptions + +% \end{macrocode} +% \begin{macro}{\embedall@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@latex@includegraphics|. +% \begin{macrocode} +\LetLtxMacro\embedall@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. +% +% Then the |\embedall@includegraphics| is defined +% \begin{macrocode} +\newcommand\embedall@includegraphics[2][]{% + \embedfile[desc=image]{#2} + \embedall@latex@includegraphics[#1]{#2}% +} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\embedall@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@latex@listinputlisting|. +% \begin{macrocode} +\LetLtxMacro\embedall@latex@lstinputlisting\lstinputlisting +% \end{macrocode} +% Then the |\embedall@listinputlisting| is defined +% \begin{macrocode} +\newcommand\embedall@lstinputlisting[2][]{% + \embedfile[desc=listing file]{#2} + \embedall@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. +% \begin{macrocode} +\DeclareRobustCommand\embedinput[2][input file]{% + \input{#2}% + \embedfile[desc={#1}]{#2}% +} + +% \end{macrocode} +% \end{macro} +% +% \noindent Finally options are processed +% \begin{macrocode} +\ifnum\embedall@all=1% + \def\embedall@graphicx{1} + \def\embedall@list{1} + \def\embedall@source{1} +\fi +\ifnum\embedall@graphicx=1% + \LetLtxMacro\includegraphics\embedall@includegraphics +\fi +\ifnum\embedall@list=1% + \LetLtxMacro\lstinputlisting\embedall@lstinputlisting +\fi + +% \end{macrocode} +% and the complete tex source file is also included if the |source| option is present. +% \begin{macrocode} +\IfFileExists{./\jobname.tex}{% + \ifnum\embedall@source=1% + \embedfile[desc=main source file]{\jobname.tex}\fi}{} +% \end{macrocode} +% \Finale + +\endinput diff --git a/Master/texmf-dist/source/latex/embedall/embedall.ins b/Master/texmf-dist/source/latex/embedall/embedall.ins new file mode 100644 index 00000000000..6ee3a3b3f41 --- /dev/null +++ b/Master/texmf-dist/source/latex/embedall/embedall.ins @@ -0,0 +1,55 @@ +%% +%% Copyright (C) 2013 by Alberto Sartori +%% +%% 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: +%% +%% 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. +%% + +\input docstrip.tex +\keepsilent + +\usedir{tex/latex/skeleton} + +\preamble + +This is a generated file. + +Copyright (C) 2013 by Alberto Sartori + +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: + + 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. + +\endpreamble + +\generate{\file{embedall.sty}{\from{embedall.dtx}{package}}} + +\obeyspaces +\Msg{*************************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the following *} +\Msg{* file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* embedall.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file embedall.dtx *} +\Msg{* through LaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{*************************************************************} + +\endbatchfile |