| 1 |
% Copyright (C) 2013 Eduardo C. Lourenço de Lima |
| 2 |
% |
| 3 |
% This work may be distributed and/or modified under the |
| 4 |
% conditions of the LaTeX Project Public License, either |
| 5 |
% version 1.3 of this license or (at your option) any later |
| 6 |
% version. The latest version of this license is in |
| 7 |
% |
| 8 |
% http://www.latex-project.org/lppl.txt |
| 9 |
% |
| 10 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 11 |
% version 2005/12/01 or later. |
| 12 |
% |
| 13 |
\documentclass{ltxdoc} |
| 14 |
|
| 15 |
\newcommand\fileversion {0.3} |
| 16 |
\newcommand\filedate {May 18, 2016} |
| 17 |
|
| 18 |
\newenvironment{Description} |
| 19 |
{\par\medskip\noindent\ignorespaces}{} |
| 20 |
|
| 21 |
\newenvironment{synopsis} |
| 22 |
{\begin{list}{}{\setlength\parsep{0pt}\setlength\itemsep{0pt}}} |
| 23 |
{\end{list}} |
| 24 |
|
| 25 |
\title {The \textsf{clipboard} package\thanks{This document corresponds to \textsf{clipboard}~\fileversion, dated~\filedate.}} |
| 26 |
\author {Eduardo C. Louren\c{c}o de Lima\\\texttt{[email protected]}} |
| 27 |
\date {\filedate} |
| 28 |
|
| 29 |
\begin{document} |
| 30 |
\maketitle |
| 31 |
|
| 32 |
\section*{Introduction} |
| 33 |
|
| 34 |
The |clipboard| package provides a basic framework for copying and pasting content within a single document or across multiple documents. |
| 35 |
|
| 36 |
\begin{synopsis} |
| 37 |
\item |\newclipboard | \marg{basename} |
| 38 |
\item |\openclipboard| \marg{basename}\medskip |
| 39 |
\item |\Copy | \marg{key} \marg{content} |
| 40 |
\item |\Paste| \marg{key} |
| 41 |
\end{synopsis} |
| 42 |
|
| 43 |
\section{Usage} |
| 44 |
|
| 45 |
\begin{Description} |
| 46 |
\DescribeMacro{\newclipboard} |
| 47 |
The first step is to create a clipboard. |
| 48 |
\begin{synopsis} |
| 49 |
\item |\newclipboard| \marg{basename} |
| 50 |
\end{synopsis} |
| 51 |
\end{Description} |
| 52 |
|
| 53 |
\begin{Description} |
| 54 |
\DescribeMacro{\Copy} |
| 55 |
The command |\Copy| copies a \meta{content} identified as \meta{key} to the clipboard.\footnote |
| 56 |
{Lowercase \texttt{\char92 copy} is already defined in {\TeX}.} |
| 57 |
\begin{synopsis} |
| 58 |
\item |\Copy| \marg{key} \marg{content} |
| 59 |
\end{synopsis} |
| 60 |
\end{Description} |
| 61 |
|
| 62 |
\begin{Description} |
| 63 |
\DescribeMacro{\Paste} |
| 64 |
And the command |\Paste| pastes the content identified by \meta{key} somewhere else in the same or another document. |
| 65 |
See below. |
| 66 |
\begin{synopsis} |
| 67 |
\item |\Paste| \marg{key} |
| 68 |
\end{synopsis} |
| 69 |
\end{Description} |
| 70 |
|
| 71 |
\begin{Description} |
| 72 |
\DescribeMacro{\openclipboard} |
| 73 |
Finally, |\openclipboard| makes the same content available across multiple documents. |
| 74 |
For instance, you can paste content from |doc1.tex| into |doc2.tex|. |
| 75 |
Make sure to use the same \meta{basename} in both documents. |
| 76 |
\begin{synopsis} |
| 77 |
\item |\openclipboard| \marg{basename} |
| 78 |
\end{synopsis} |
| 79 |
\end{Description} |
| 80 |
|
| 81 |
\section{Example} |
| 82 |
|
| 83 |
This is how to copy and paste text from |book.tex| into |article.tex|:\bigskip |
| 84 |
|
| 85 |
\noindent |book.tex|: |
| 86 |
\begin{verbatim} |
| 87 |
\documentclass{book} |
| 88 |
\usepackage{clipboard} |
| 89 |
\newclipboard{myclipboard} |
| 90 |
\begin{document} |
| 91 |
\Copy{dolorem ipsum}{Nor again is there anyone who |
| 92 |
loves or pursues or desires to obtain pain of itself}, |
| 93 |
because it is pain, but occasionally circumstances occur |
| 94 |
in which toil and pain can procure him some great pleasure. |
| 95 |
\end{document} |
| 96 |
\end{verbatim} |
| 97 |
|
| 98 |
\noindent |article.tex|: |
| 99 |
\begin{verbatim} |
| 100 |
\documentclass{article} |
| 101 |
\usepackage{clipboard} |
| 102 |
\openclipboard{myclipboard} |
| 103 |
\begin{document} |
| 104 |
According to Cicero, |
| 105 |
\begin{quote} |
| 106 |
\Paste{dolorem ipsum} |
| 107 |
\end{quote} |
| 108 |
\end{document} |
| 109 |
\end{verbatim} |
| 110 |
|
| 111 |
\noindent\textbf{Note:} Because content from |book.tex| is being copied and pasted into |article.tex|, you must run |latex book.tex| before running |latex article.tex|. |
| 112 |
|
| 113 |
\end{document} |