summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-11-18 00:38:13 +0000
committerKarl Berry <karl@freefriends.org>2008-11-18 00:38:13 +0000
commit702dcf050b18dfde338853a56a85375afce44ecf (patch)
treeda7bca7d4b70369c3c33130ecf114366528637a5 /Master/texmf-dist
parentd6a9cc9e6f60abfffdf4d15ac698a1da38799712 (diff)
verbatimcopy update (17nov08)
git-svn-id: svn://tug.org/texlive/trunk@11335 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/verbatimcopy/README.TEXLIVE6
-rw-r--r--Master/texmf-dist/doc/latex/verbatimcopy/verbatimcopy.pdfbin0 -> 168477 bytes
-rw-r--r--Master/texmf-dist/doc/latex/verbatimcopy/verbatimcopy.tex274
-rw-r--r--Master/texmf-dist/tex/latex/verbatimcopy/verbatimcopy.sty269
4 files changed, 485 insertions, 64 deletions
diff --git a/Master/texmf-dist/doc/latex/verbatimcopy/README.TEXLIVE b/Master/texmf-dist/doc/latex/verbatimcopy/README.TEXLIVE
deleted file mode 100644
index 51932839916..00000000000
--- a/Master/texmf-dist/doc/latex/verbatimcopy/README.TEXLIVE
+++ /dev/null
@@ -1,6 +0,0 @@
-The following files have been removed in the TeX Live installation of
-the current package, typically due to duplication, lack of space, or
-missing source code. You can find these files on CTAN. If questions or
-concerns, email tex-live.org.
-
- verbatimcopy.pdf
diff --git a/Master/texmf-dist/doc/latex/verbatimcopy/verbatimcopy.pdf b/Master/texmf-dist/doc/latex/verbatimcopy/verbatimcopy.pdf
new file mode 100644
index 00000000000..93867277028
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/verbatimcopy/verbatimcopy.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/verbatimcopy/verbatimcopy.tex b/Master/texmf-dist/doc/latex/verbatimcopy/verbatimcopy.tex
new file mode 100644
index 00000000000..612318ce4ee
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/verbatimcopy/verbatimcopy.tex
@@ -0,0 +1,274 @@
+\RequirePackage{etex}
+\documentclass[11pt,a4paper,oldfontcommands,danish,english,article,oneside]{memoir}
+\usepackage[T1]{fontenc}
+\usepackage[widespace]{fourier}
+\DeclareRobustCommand{\SetFourierSpace}{%
+\fontdimen2\font=1.13\fontdimen2\font}
+
+\setlxvchars[\normalfont]
+
+\settypeblocksize{*}{1.3\lxvchars}{1.618}
+
+\usepackage{babel}
+
+% for print
+\setlrmargins{*}{*}{1.6}
+\setulmargins{*}{*}{1.3}
+
+% for online
+\setlrmargins{*}{*}{0.7}
+\setulmargins{*}{*}{1}
+\setlength\marginparwidth{2.4cm}
+
+\checkandfixthelayout
+
+%\usepackage{felinepreamble}
+%\usepackage{felinemarkup}
+
+
+\usepackage[loadsampleconfig]{dlfltxbmarkup}
+\usepackage{dlfltxbmisc,color}
+\let\MarkWMargin=\felineWriteInMargin
+\definecolor{nicered}{rgb}{.647,.129,.149}
+
+\makeatletter
+\renewcommand\feline@MWM@inner[1]{%
+ \parbox[t]{\marginparwidth}{%
+ \leavevmode\checkoddpage%
+ \ifoddpage\RaggedLeft\else\RaggedLeft\fi%
+ {\slshape\footnotesize\hspace{0pt}\color{nicered}#1\par}}}
+
+\makeatother
+\setsecheadstyle{\Large\bfseries\raggedright\color{nicered}}
+\setsubsecheadstyle{\large\bfseries\raggedright\color{nicered}}
+
+
+\reversemarginpar
+%\twocolumnfootnotes
+
+\setsecnumdepth{part}
+
+\pagestyle{plain}
+
+\begin{document}
+
+\title{The \textsf{verbatimcopy} package\thanks{Version 0.06}}
+\author{Lars Madsen\thanks{Email: daleif@imf.au.dk (packing and user docs)}
+\and Ulrich Diez\thanks{Email: eu\_angelion@web.de (macro coding)}
+}
+\maketitle
+
+\section{Intro}
+
+The \textsf{\jobname} package is a package that enables \LaTeX\ to
+make verbatim copies of files. Additionally one can specify which
+(sub)directory to save the copy in.
+
+\textcolor{nicered}{\itshape\bfseries Please note that this version is
+not backwards compatible! As \markup[nomk]{VerbatimCopy} now can
+handle a \cs{verb}-like syntax, it can no longer be used inside other
+macros. Though we do provide a compatability mode that reverts back to
+the old functionality. See the \emph{Compatability} section for more
+information.
+}
+\section{Usage}
+
+
+The package provides two macros. Firstly the
+\begin{syntax}
+\markup{setOutputDir}\marg{dir}
+\end{syntax}
+macro is used for specifying which default directory to copy files to.
+\markup[nomk]{setOutputDir} will automatically add a trailing
+>>\texttt{/}<< if missing.
+On systems that are not able to use >>\texttt{/}<< as a directory
+delimiter, please redefine \markup[nomk]{VC@slash}
+accordingly.\footnote{As we do not have access to systems where this
+ is needed this features has not been throughly tested.}
+The default output directory is the current directory. Please note
+that we cannot create directories, the directory specified has to
+exist beforehand.
+
+
+The main macro of the package is
+\begin{syntax}
+ \markup{VerbatimCopy}\marg{input file}\marg{output file}
+\end{syntax}
+which will take a verbatim copy of \Arg{input file} and save it as
+\Arg{output file}. \textit{Note:} If \Arg{output file} does not have
+an extension, then \LaTeX\ gives it >>\texttt{.tex}<<.
+
+Be very careful when using this package, it will overwrite the target
+file without warning.
+
+\section{Advanced usage}
+\label{sec:advanced-usage}
+
+
+
+Actually both \markup[nomk]{setOutputDir} and
+\markup[nomk]{VerbatimCopy} supports a more \markup[nomk]{verb}-like
+syntax. That is you can use a syntax similar to
+\begin{syntax}
+ \markup[nomk]{setOutputDir}\Arg{char}\Arg{some name not containing \textsf{char}}\Arg{char}
+\end{syntax}
+example
+\begin{syntax}
+ \verb+\setOutputDir|# #{@} b&~ $$/|+
+\end{syntax}
+for the already existing dir >>\verb+# #{@} b&~ $$+<<, meaning
+that we can use directories with special names. Any linebreak in
+the directory name or in the input or output names for
+\markup[nomk]{VerbatimCopy} are silently ignored, but the spaces
+do count. Many editors automatically strip spaces at
+line-endings, thus avoiding linebreaks after spaces might be a
+good idea.
+
+With \markup[nomk]{VerbatimCopy} you will need two sets of \Arg{char}
+characters (to replace the braces in the syntax above) and these sets
+need not be the same. Example:
+\begin{syntax}
+ \verb|\VerbatimCopy#test.tex#+test%#2}.tex+|
+\end{syntax}
+meaning that the file >>\texttt{test\%\#2\}.tex}<< will be a
+verbatim copy of the original file >>\texttt{test.tex}<<.
+
+\subsection{A note about spaces in filenames}
+\label{sec:note-about-spaces}
+
+Heiko Oberdiek mentions in his \markup[sty,nomk]{grffile} package:
+\begin{quote}\itshape
+ In general it is not possible to use space inside file names,
+ because \TeX\ considers the space character as termination in its
+ syntax for commands that expect a file name.
+\end{quote}
+But in most modern \LaTeX\ distributions one can use double
+quotes around the filename containing spaces. If you use
+\begin{syntax}
+ \verb+\usepackage[enquotefilenames]{verbatimcopy}+
+\end{syntax}
+file-paths will get wrapped into double-quotes automatically
+and you can avoid doing this ``by hand'' for the sake of avoiding
+issues which might come from string-concatenation of
+\markup[nomk]{setOutputDir}'s \Arg{dir} and
+\markup[nomk]{VerbatimCopy}'s \Arg{output file}.
+
+On systems that allow/require a different file-name-delimiter,
+redefine \markup[nomk]{VC@quote} accordingly.
+
+\subsection{Compatability}
+\label{sec:compatability}
+
+As mentioned ealier the macros \markup[nomk]{VerbatimCopy} and
+\markup[nomk]{setOutputDir} have been changed to allow a
+\cs{verb}-like functionality. This also means that
+\cs{VerbatimCopy} and \cs{setOutputDir} can no longer be used
+inside other macros. Some people might be able to live without
+the \cs{verb}-like features and would like to be able to use
+\cs{VerbatimCopy} and \cs{setOutputDir} inside other macros.
+These users have two possibilities:
+\begin{syntax}
+ \verb+\usepackage[compatibility]{verbatimcopy}+
+\end{syntax}
+or
+\begin{syntax}
+ \cs{OldVerbatimCopy}
+\end{syntax}
+\begin{syntax}
+ \cs{OldsetOutputDir}
+\end{syntax}
+(which is always available). Just note that using the `old'
+macros you cannot have special characters in the filenames, but
+spaces are still allowed using the syntax shown ealier (using
+double quotes).
+
+\section{A hint for programmers}
+\label{sec:hint-programmers}
+
+As mentioned earlier \markup[nomk]{VerbatimCopy} can no longer be used,
+as is, inside other macros. For that you will need a trick. Here is
+what Ulrich Diez provided such that this version of
+\markup[sty,nomk]{verbatimcopy} works with my LaTeX-book:
+\begingroup
+\footnotesize
+\begin{verbatim}
+\makeatletter
+% helper macro
+\newcommand\VCverbdef[1]{%
+ \VCverbaction{\expandafter\newcommand
+ \expandafter*\expandafter
+ #1\@firstofone}{}%
+}%
+%
+% use this incase you use odd input or output filenames
+\VCverbdef\felineFC@input|input with odd letter.tex|
+\VCverbdef\felineFC@output+output+
+% I use 'feline' for localisation in some internal macros
+\newcommand\feline@run@verbatimcopy{%
+ \@bsphack
+ \begingroup
+ \edef\@tempa{%
+ \endgroup
+ \noexpand\scantokens{%
+ \begingroup
+ \noexpand\csname VerbatimCopy\endcsname
+ "\felineFC@input""\felineFC@output"%
+ %\scantokens will produce a trailing space without this:
+ \endlinechar=-1
+ }%
+ \endgroup
+ \@esphack
+ }\@tempa
+}
+\end{verbatim}
+\endgroup
+
+\section{Acknowledgement}
+
+The main idea behind this package was originally posted on
+\texttt{comp.text.tex} by Ulrich Diez
+(\url{http://groups.google.com/group/comp.text.tex/msg/153e3dc7a8d0e548?hl=en}).
+The idea is to use a simple, local, redefinition of
+\markup[nomk]{verbatiminput}, which, instead of writing the contents
+in the document, just writes it to another file.
+
+Later Ulrich Diez provided new code that extends the original to
+macros. This is the code that are currently in the \texttt{\jobname}
+package, completely replacing the old code.
+
+The \textsf{\jobname} package automatically loads the
+\markup[nomk,sty]{verbatim} package.
+
+
+\section{Why?}
+\label{sec:why}
+
+One might ask why the need for a functionality like this?
+
+Here is where I use it: In my Danish 400+ pages \LaTeX\ book
+(\url{http://www.imf.au.dk/system/latex/bog}), I have lots of
+examples. For many of these examples I'd like to offer the source for
+download (as was done for the \LaTeX\ Companion, 2nd edition). Several
+examples are created using autogenerated fully compilable files that
+are converted into EPS/PDF and included as graphics. All of my
+examples are of course numbered, but the actual files that make up the
+external files are all individually named. To make it easier for users
+to find the right code, the downloadable source files are named to fit
+the example numbers in the book. So instead of writing a script to
+rename files, we simply let \LaTeX\ do the verbatim copying from one
+directory into another.
+
+(TODO: fingure out a way to see if I actually need to copy a file or
+write it to disk, the XY-Pic package can do something similar.)
+
+
+\end{document}
+
+
+
+
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: t
+%%% End:
diff --git a/Master/texmf-dist/tex/latex/verbatimcopy/verbatimcopy.sty b/Master/texmf-dist/tex/latex/verbatimcopy/verbatimcopy.sty
index d495d865bc7..fb2e74157a7 100644
--- a/Master/texmf-dist/tex/latex/verbatimcopy/verbatimcopy.sty
+++ b/Master/texmf-dist/tex/latex/verbatimcopy/verbatimcopy.sty
@@ -1,78 +1,231 @@
-\ProvidesPackage{verbatimcopy}[2007/05/10 v0.03 by Lars Madsen]
+\ProvidesPackage{verbatimcopy}[2008/11/17 v0.06 by Lars Madsen and Ulrich Diez]
-
-% This package be distributed and/or modified under the
+%% 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).
%%
-
+%% The Current Maintainer of this work is Lars Madsen <daleif@imf.au.dk>
+%%
+%% Package code: Ulrich Diez <eu_angelion@web.de>
+%% Packing and user documentation: Lars Madsen <daleif@imf.au.dk>
+%%
+%%
+%% The implementation is as is, any questions about the implementaion
+%% of this package should preferably be send to Ulrich Diez via the
+%% email above.
+%%
+%% For usage information see the user manual
+%
\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
+%
+% Directory-separator usually is slash.
+%
+\newcommand\VC@slash{/}%
+\@onelevel@sanitize\VC@slash
+%
+% Enquote file-names with quotes.
+%
+\newcommand\VC@quote{"}%
+\@onelevel@sanitize\VC@quote
+%
+\newcommand*\VC@@quote{}%
+%
+\newcommand*\VC@outputdir{}%
+%
+\begingroup
+\long\def\@@setOutputDir#1{%
+ \endgroup
+ %
+ %\@@setOutputDir automatically adds a trailing /
+ %
+ \@ifdefinable\@@setOutputDir{%
+ \long\def\@@setOutputDir##1#1\@nil##2\@nil#1{%
+ \ifx\@nil##2\@nil
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+ }%
+ }%
+ \newcommand\setOutputDir[1]{%
+ \@bsphack
+ \@@setOutputDir##1\@nil#1\@nil\@nil#1%
+ {\def\VC@outputdir{##1#1}}%
+ {\def\VC@outputdir{##1}}%
+ \@esphack
}%
}%
-\newcommand\setOutputDir[1]{%
- \@setOutputDir#1\@nil/\@nil\@nil/%
- {\def\VC@outputdir{#1/}}%
- {\def\VC@outputdir{#1}}%
-}%
-
+\expandafter\@@setOutputDir\expandafter{\VC@slash}%
+%
% memoir defines this one, verbatim does not
+%
\@ifundefined{verbatim@out}{\newwrite\verbatim@out}{}
-
-
-% the following is basically based on an idea
+%
+% 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&)
-
+% (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
+ \@bsphack
+ \expandafter\def\expandafter\VC@target\expandafter{\VC@outputdir#2}%
+ \IfFileExists{\VC@@quote#1\VC@@quote}%
+ {%
+ \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@@quote\VC@target\VC@@quote\relax
+ \verbatiminput{\VC@@quote#1\VC@@quote}%
+ \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
}%
-
+%
+% Copy the original user-level-macros.
+%
+\@ifdefinable\OldVerbatimCopy{%
+ \let\OldVerbatimCopy\VerbatimCopy
+}%
+\@ifdefinable\OldsetOutputDir{%
+ \let\OldsetOutputDir\setOutputDir
+}%
+%
+% Implement stuff for reading arguments "verbatim":
+%
+% Syntax of \VCverbaction:
+%
+% \VCverbaction{<Mandatory 1>}{<Mandatory 2>}<verbatim-Arg>
+%
+% yields:
+%
+% <Mandatory 1>{<Mandatory2>{<verbatim-Arg>}}
+%
+% The Mandatory-Arguments are mandatory. If they consist of several
+% tokens, they must be nested into catcode-1/2-character-pair / braces.
+% If reading is necessary, they will be read under normal catcode-
+% conditions.
+% The verbatim-Arg is also mandatory. It will be read under
+% verbatim-catcode-conditions. If its first character is a brace,
+% it will be "assumed" that the argument is nested into braces.
+% Otherwise it will be assumed, that the argument is delimited
+% by the first character - like the argument of \verb.
+%
+% Empty-lines will not be ignored.
+%
+% By nesting calls to \VCverbaction within \VCverbaction's first
+% argument, you can collect "verbatim-arguments" within its second
+% argument.
+%
+% E.g.,
+%
+% \VCverbaction{\VCverbaction{\VCverbaction{\action}}}% <- Mandatory 1
+% {}% <- Mandatory 2 is empty!
+% <verbatim-Arg1><verbatim-Arg2><verbatim-Arg3>
+%
+% yields:
+%
+% \VCverbaction{\VCverbaction{\action}}% <- Mandatory 1
+% {<verbatim-Arg1>}% <- Mandatory 2
+% <verbatim-Arg2><verbatim-Arg3>
+%
+% yields:
+%
+% \VCverbaction{\action}% <- Mandatory 1
+% {{<verbatim-Arg1>}{<verbatim-Arg2>}}% <- Mandatory 2
+% <verbatim-Arg3>
+%
+% yields:
+%
+% \action{{<verbatim-Arg1>}{<verbatim-Arg2>}{<verbatim-Arg3>}}
+%
+\newcommand\VCverbaction[2]{%
+ \@bsphack
+ \begingroup
+ \let\do\@makeother\dospecials
+ \catcode`\{=1 %
+ \catcode`\ =10 %
+ \@ifnextchar\bgroup
+ {\catcode`\}=2 \@@VCverbaction{#1}{#2}}%
+ {\do\{\@VCverbaction{#1}{#2}}%
+}%
+\newcommand\@VCverbaction[3]{%
+ \do\ %
+ \catcode`\^^M=14 %
+ \long\def\@tempb##1#3{%
+ \def\@tempb{##1}%
+ \@onelevel@sanitize\@tempb
+ \expandafter\@@@VCverbaction\expandafter{\@tempb}{#1}{#2}%
+ }%
+ \@tempb
+}%
+\newcommand\@@VCverbaction[2]{%
+ \do\ %
+ \catcode`\^^M=14 %
+ \long\def\@tempb##1{%
+ \def\@tempb{##1}%
+ \@onelevel@sanitize\@tempb
+ \expandafter\@@@VCverbaction\expandafter{\@tempb}{#1}{#2}%
+ }%
+ \@tempb
+}%
+\newcommand\@@@VCverbaction[3]{%
+ \endgroup
+ \@esphack
+ #2{#3{#1}}%
+}%
+%
+%
+\DeclareOption{compatibility}{\endinput}
+\DeclareOption{enquotefilenames}{\let\VC@@quote=\VC@quote}
+\ProcessOptions\relax
+%
+% If compatibility-option is provided, then package-loading is done
+% and loading finishes via \endinput.
+%
+% Otherwise have the copies called when a nesting-chain of \VCverbaction
+% has read and collected all the arguments needed for the copies
+% "verbatimly".
+%
+\outer\def\VerbatimCopy{%
+ \@bsphack
+ \VCverbaction{%
+ \VCverbaction{%
+ \expandafter\@esphack\expandafter\OldVerbatimCopy\@firstofone
+ }%
+ }{}%
+}%
+%
+\outer\def\setOutputDir{%
+ \@bsphack
+ \VCverbaction{%
+ \expandafter\@esphack\expandafter\OldsetOutputDir\@firstofone
+ }{}%
+}%
+%
+\endinput