summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/clipboard/clipboard.sty
blob: dc3dfe64be6022690f70e7c36670001ed9081bdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
%%
%% This is file `clipboard.sty',
%% 
%% 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.
%% 
\NeedsTeXFormat{LaTeX2e}[1996/06/01]
\ProvidesPackage{clipboard}[2016/05/18 v0.3 Copy and paste into and across documents]

\newwrite  \clipboard@fileout
\newcommand\clipboard@write   [2] {\immediate\write\clipboard@fileout{\noexpand\clipboard{#1}{\unexpanded{#2}}}}
\newcommand\clipboard@copy    [2] {\global\@namedef{clipboard@#1}{#2}}
\newcommand\clipboard@paste   [1] {\@nameuse{clipboard@#1}}

\newcommand\newclipboard      [1] {\immediate\openout\clipboard@fileout=#1.cpy}
\newcommand\openclipboard     [1] {\input{#1.cpy}}

\newcommand\clipboard         [2] {\clipboard@copy{#1}{#2}}

\newcommand\Copy              [2] {\clipboard{#1}{#2}\clipboard@write{#1}{#2}#2}
\newcommand\Paste             [1] {\clipboard@paste{#1}}

\endinput
%%
%% End of file `clipboard.sty'.