summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-01-12 23:54:14 +0000
committerKarl Berry <karl@freefriends.org>2013-01-12 23:54:14 +0000
commit40582d40114fa4f0b3d0432e8a85900312bff43a (patch)
tree1ee65664e3a165590a4cb84b8de7d3ea429b1f46 /Master/texmf-dist/source
parent64c3ae9601b2e7ce16250f9d1d4da4af5ff7ab67 (diff)
copypaste (12jan13)
git-svn-id: svn://tug.org/texlive/trunk@28815 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/copypaste/copypaste.dtx172
-rw-r--r--Master/texmf-dist/source/latex/copypaste/copypaste.ins47
2 files changed, 219 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/copypaste/copypaste.dtx b/Master/texmf-dist/source/latex/copypaste/copypaste.dtx
new file mode 100644
index 00000000000..6e2d546c52f
--- /dev/null
+++ b/Master/texmf-dist/source/latex/copypaste/copypaste.dtx
@@ -0,0 +1,172 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2013 Eduardo C. Lourenço de Lima
+%
+% This work 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.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% \fi
+% \iffalse
+%
+%<package>\NeedsTeXFormat{LaTeX2e}[1996/06/01]
+%<package>\ProvidesPackage{copypaste}[2013/01/11 v0.1 Copy and paste]
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{copypaste}
+\newenvironment{Description}
+ {\par\medskip\noindent\ignorespaces}{}
+\newenvironment{synopsis}
+ {\begin{list}{}
+ {\setlength\parsep{0pt}
+ \setlength\itemsep{0pt}}}
+ {\end{list}}
+\newenvironment{Example}[1]
+ {\if#1\else\paragraph{Example.}#1\fi}
+ {}
+\newenvironment{page}
+ {\begin{center}\begin{minipage}[t]{0.5\linewidth}}
+ {\end{minipage}\end{center}}
+\newcommand\TODO{\texttt{Todo:}}
+\begin{document}
+ \DocInput{copypaste.dtx}
+\end{document}
+%</driver>
+% \fi
+% \changes{0.1}{2013/01/11}{Initial version}
+% \GetFileInfo{copypaste.sty}
+% \CheckSum{199}
+% \DoNotIndex{\,,\@addtoreset,\begin,\closeout,\csname,\end,\endcsname}
+% \DoNotIndex{\expandafter}
+% \DoNotIndex{\@ifundefined,\immediate,\input,\jobname,\label}
+% \DoNotIndex{\@makebox,\makebox,\mbox,\MessageBreak,\@namedef,\@nameuse}
+% \DoNotIndex{\newcommand,\newcounter,\newenvironment,\newwrite,\noindent}
+% \DoNotIndex{\normalfont,\openout,\PackageError, \par,\parskip,\ref}
+% \DoNotIndex{\relax,\renewcommand,\setlength,\string}
+% \DoNotIndex{\write}
+% \title{The \textsf{copypaste} package\thanks{This document
+% corresponds to \textsf{copypaste}~\fileversion,
+% dated~\filedate.}}
+% \author{Eduardo C. Louren\c{c}o de Lima \\ \texttt{elourenco@phi.pro.br}}
+% \maketitle
+%
+% \section*{Introduction}
+%
+% This package provides a basic framework for copying and pasting content
+% into a single document, or across different documents.
+%
+% \section{Basic Usage}
+% \begin{synopsis}
+% \item |\savecopypaste| \marg{basename}
+% \item |\yank| \marg{key} \marg{content}
+% \item |\paste| \marg{key}
+% \item |\opencopypaste| \marg{basename}
+% \end{synopsis}
+%
+%
+% \begin{Description}
+% \DescribeMacro{\savecopypaste}
+% The first step is to create a copy-and-paste apparatus.
+% \begin{synopsis}
+% \item |\savecopypaste| \marg{basename}
+% \end{synopsis}
+% \end{Description}
+%
+% \begin{Description}
+% \DescribeMacro{\yank}
+% The command |\yank| typesets \meta{content} and identifies it as \meta{key}.\footnote
+% {\texttt{copy} is already defined in {\TeX}.}
+% \begin{synopsis}
+% \item |\yank| \marg{key} \marg{content}
+% \end{synopsis}
+% \end{Description}
+%
+% \begin{Description}
+% \DescribeMacro{\paste}
+% And |\paste| just typesets the content identified by \meta{key}.
+% \begin{synopsis}
+% \item |\paste| \marg{key}
+% \end{synopsis}
+% \end{Description}
+%
+% \begin{Description}
+% \DescribeMacro{\opencopypaste}
+% Finally, |\opencopypaste| makes available content from |doc1.tex| to |doc2.tex|. In that way, you can paste into |doc2.tex| content from |doc1.tex|. Make sure to use the same \meta{basename} in both documents.
+% \begin{synopsis}
+% \item |\opencopypaste| \marg{basename}
+% \end{synopsis}
+% \end{Description}
+%
+% \section{Example}
+%
+% This is how to copy |bar| from |doc1.tex| and paste it into |doc2.tex|:\bigskip
+%
+% \noindent |doc1.tex|:
+% \iffalse
+%<*example>
+% \fi
+\begin{verbatim}
+\documentclass{article}
+\usepackage{copypaste}
+\savecopypaste{myfoo}
+\begin{document}
+\yank{foo}{bar}
+\end{document}
+\end{verbatim}
+% \iffalse
+%</example>
+% \fi
+%
+% \noindent |doc2.tex|:
+% \iffalse
+%<*example>
+% \fi
+\begin{verbatim}
+\documentclass{article}
+\usepackage{copypaste}
+\opencopypaste{myfoo}
+\begin{document}
+\paste{foo}
+\end{document}
+\end{verbatim}
+% \iffalse
+%</example>
+% \fi
+%
+% \noindent Now, running:
+%
+% |$ latex doc1|
+%
+% |$ latex doc2|
+%
+% \noindent outputs 2 documents with the same content, namely, |bar|.
+%
+% \StopEventually
+%
+% \section{Implementation}
+% \begin{macrocode}
+\newwrite\@copypaste
+
+\newcommand\savecopypaste[1]{%
+ \immediate\openout\@copypaste=#1.cpy}
+
+\newcommand\opencopypaste[1]{%
+ \input{#1.cpy}}
+
+\newcommand\yank[2]{%
+ \defcopy{#1}{#2}%
+ \immediate\write\@copypaste{\noexpand\defcopy{#1}{\unexpanded{#2}}}%
+ #2}
+
+\newcommand\defcopy[2]{%
+ \@namedef{@copypaste@#1}{#2}}
+
+\newcommand\paste[1]{%
+ \@nameuse{@copypaste@#1}}
+% \end{macrocode}
diff --git a/Master/texmf-dist/source/latex/copypaste/copypaste.ins b/Master/texmf-dist/source/latex/copypaste/copypaste.ins
new file mode 100644
index 00000000000..16bc0b92c94
--- /dev/null
+++ b/Master/texmf-dist/source/latex/copypaste/copypaste.ins
@@ -0,0 +1,47 @@
+%% copypaste.ins
+%%
+%% Copyright (C) 2013 Eduardo C. Lourenço de Lima
+%%
+%% This work 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.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+\input docstrip.tex
+\keepsilent
+\preamble
+
+Copyright (C) 2013 Eduardo C. Lourenço de Lima
+
+This work 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.3 or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+
+\endpreamble
+\generate{\file{copypaste.sty}{\from{copypaste.dtx}{package}}}
+\obeyspaces
+\Msg{****************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the *}
+\Msg{* following file into a directory searched by TeX: *}
+\Msg{* *}
+\Msg{* copypaste.sty *}
+\Msg{* *}
+\Msg{* To produce the documentation run the file *}
+\Msg{* copypaste.dtx through LaTeX. *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{* *}
+\Msg{****************************************************}
+\endbatchfile