From 702dcf050b18dfde338853a56a85375afce44ecf Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 18 Nov 2008 00:38:13 +0000 Subject: verbatimcopy update (17nov08) git-svn-id: svn://tug.org/texlive/trunk@11335 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/verbatimcopy/README.TEXLIVE | 6 - .../doc/latex/verbatimcopy/verbatimcopy.pdf | Bin 0 -> 168477 bytes .../doc/latex/verbatimcopy/verbatimcopy.tex | 274 +++++++++++++++++++++ 3 files changed, 274 insertions(+), 6 deletions(-) delete mode 100644 Master/texmf-dist/doc/latex/verbatimcopy/README.TEXLIVE create mode 100644 Master/texmf-dist/doc/latex/verbatimcopy/verbatimcopy.pdf create mode 100644 Master/texmf-dist/doc/latex/verbatimcopy/verbatimcopy.tex (limited to 'Master/texmf-dist/doc/latex/verbatimcopy') 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 Binary files /dev/null and b/Master/texmf-dist/doc/latex/verbatimcopy/verbatimcopy.pdf 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: -- cgit v1.2.3