diff options
author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2008-09-17 09:18:47 +0000 |
---|---|---|
committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2008-09-17 09:18:47 +0000 |
commit | f076934493e56a49abfe314d4dfc9c3da38cbe2a (patch) | |
tree | 834687d6b44fd10b1f1eed1245754161c75d7bfb /Master/texmf-dist/tex/latex | |
parent | 4e28989a02439f3d5fa61d54e05a2e6daf0dc3bf (diff) |
-mnew latex package verbatimcopy (without doc, lacking source :-( )
git-svn-id: svn://tug.org/texlive/trunk@10621 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/verbatimcopy/verbatimcopy.sty | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/verbatimcopy/verbatimcopy.sty b/Master/texmf-dist/tex/latex/verbatimcopy/verbatimcopy.sty new file mode 100644 index 00000000000..d495d865bc7 --- /dev/null +++ b/Master/texmf-dist/tex/latex/verbatimcopy/verbatimcopy.sty @@ -0,0 +1,78 @@ +\ProvidesPackage{verbatimcopy}[2007/05/10 v0.03 by Lars Madsen] + + +% This package 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.3 or later is part of all distributions of LaTeX +%% version 2003/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% +%% The Current Maintainer of this work is Lars Madsen (daleif@imf.au.dk). +%% + +\RequirePackage{verbatim} + + +% addition by Ulrich Diez, automatically adds a trailing / +\@ifdefinable\@setOutputDir{% + \def\@setOutputDir#1/\@nil#2\@nil/{% + \ifx\@nil#2\@nil + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + }% +}% +\newcommand\setOutputDir[1]{% + \@setOutputDir#1\@nil/\@nil\@nil/% + {\def\VC@outputdir{#1/}}% + {\def\VC@outputdir{#1}}% +}% + +% memoir defines this one, verbatim does not +\@ifundefined{verbatim@out}{\newwrite\verbatim@out}{} + + +% the following is basically based on an idea +% by Ulrich Diez on comp.text.tex +% (http://groups.google.com/group/comp.text.tex/msg/153e3dc7a8d0e548?hl=en&) + +% be very carefull, this will overwrite without asking + +% the idea is simply to mess with \verbatiminput such that it write +% instead of read +\newcommand*\VerbatimCopy[2]{% {from file}{to file} + \edef\VC@target{\VC@outputdir#2}% + \@bsphack + \IfFileExists{#1}% + {% + \bgroup + \def\@verbatim{% + \obeylines + \let\do\@makeother + \dospecials + }% + \let\endtrivlist\relax + \def\verbatim@processline{% + \immediate\write\verbatim@out{\the\verbatim@line}% + }% + \immediate\openout\verbatim@out\VC@target\relax + \verbatiminput{#1}% + \immediate\closeout\verbatim@out% + \egroup% + }% + {% + \PackageError{verbatimcopy}% + {Source-file cannot be found}% + {% + For copying source-file to target-file it would be nice to + have the source-file available.% + }% + }% + \@esphack +}% + |