Debian Codegraph @

texmf-dist/doc/latex/concepts/dry.sty

raw
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \iffalse %%%%
2 % %
3 % Copyright (c) 2012 - Michiel Helvensteijn (www.mhelvens.net) %
4 % %
5 % http://latex-with.googlecode.com %
6 % %
7 % This work may be distributed and/or modified under the conditions %
8 % of the LaTeX Project Public License, either version 1.3 of this %
9 % license or (at your option) any later version. The latest version %
10 % of this license is in http://www.latex-project.org/lppl.txt %
11 % and version 1.3 or later is part of all distributions of LaTeX %
12 % version 2005/12/01 or later. %
13 % %
14 % This work has the LPPL maintenance status `author-maintained'. %
15 % %
16 % The Current Maintainer of this work is Michiel Helvensteijn. %
17 % %
18 % This work consists of the file dry.sty. %
19 % %
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fi %%%%
21
22 % I will 'officially' release this package at some point in the future. For
23 % now I'm just using it to document a couple of packages. Still, it's
24 % released under LPPL, so use it as you will.
25 %
26 % -- Michiel Helvensteijn
27
28 \NeedsTeXFormat{LaTeX2e}
29 \ProvidesPackage{dry}
30 [2012/12/19 convenience macros for reusing LaTeX code]
31
32 \RequirePackage{filecontents}
33 \RequirePackage{xparse}
34 \RequirePackage{etoolbox}
35 \RequirePackage{with}
36
37 \newcommand\minput[1]{%
38 \input{#1}\unskip%
39 }
40
41 \NewDocumentCommand{\NewDRYer}{m +m}{%
42 \with{un} [#1] [#2] {%
43 \newenvironment{#1}{%
44 \begingroup%
45 \@tempswafalse\filec@ntents{##1.tmp}%
46 }{%
47 \endfilecontents%
48 \endgroup%
49 }%
50 \AfterEndEnvironment{#1}{%
51 \with{xn} [##1.tmp] [\minput{##1.tmp}] {%
52 ##2%
53 }%
54 }%
55 }%
56 }