1STY2DTX(1)            User Contributed Perl Documentation           STY2DTX(1)
2
3
4

NAME

6       sty2dtx -- Converts a LaTeX .sty file to a documented .dtx file
7

VERSION

9       Version: v2.3
10
12       Copyright (c) 2010-2012 Martin Scharrer <martin@scharrer-online.de>
13
14       This program is free software: you can redistribute it and/or modify it
15       under the terms of the GNU General Public License as published by the
16       Free Software Foundation, either version 3 of the License, or (at your
17       option) any later version.
18
19       This program is distributed in the hope that it will be useful, but
20       WITHOUT ANY WARRANTY; without even the implied warranty of
21       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22       General Public License for more details.
23
24       You should have received a copy of the GNU General Public License along
25       with this program.  If not, see <http://www.gnu.org/licenses/>.
26

DESCRIPTION

28       Converts a .sty file (LaTeX package) to .dtx format (documented LaTeX
29       source), by surrounding macro definitions with 'macro' and 'macrocode'
30       environments.  The macro name is automatically inserted as an argument
31       to the 'macro' environemnt.  Code lines outside macro definitions are
32       wrapped only in 'macrocode' environments. Empty lines are removed.  The
33       script is not thought to be fool proof and 100% accurate but rather as
34       a good start to convert undocumented style files to .dtx files.
35
36   Basic Usage
37            perl sty2dtx.pl infile [infile ...] outfile
38
39       or
40
41            perl sty2dtx.pl < file.sty > file.dtx
42
43   Supported Definitions
44       The following macro definitions are detected when they are at the start
45       of a line (can be prefixed by \global, \long, \protected and/or
46       \outer):
47
48           \def   \edef   \gdef   \xdef
49           \newcommand{\name}     \newcommand*{\name}
50           \newcommand\name       \newcommand*\name
51           \renewcommand{\name}   \renewcommand*{\name}
52           \renewcommand\name     \renewcommand*\name
53           \providecommand{\name} \providecommand*{\name}
54           \providecommand\name   \providecommand*\name
55           \@namedef{\name}       \@namedef\name
56
57       The following environment definitions are detected when they are at the
58       start of a line:
59
60           \newenvironment{name}  \renewenvironemnt{name}  \provideenvironment{name}
61
62       The macro and environment definition must either end at the same line
63       or with a '"}"' on its own on a line.
64

USAGE

66         sty2dtx [<options>] [--<VAR>=<VALUE> ...] [--] [<infile(s)>] [<outfile>]
67
68   Files
69       · can be '"-"' for STDIN or STDOUT, which is the default if no files
70         are given
71
72       · multiple input files are merged to one output file
73
74   Variables
75       Variables can be defined using
76
77         --<VAR>=<VALUE>
78
79       or
80
81         --<VAR> <VALUE>
82
83       and will be used for substitutions in the template file.
84
85       Common variables:
86
87             author, email, maintainer, year (for copyright),
88             version, date, description (of package/class),
89             type (either 'package' default or 'class'),
90             filebase (automatically set from output or input file name),
91
92   Options
93       -h           Print this help text
94       -H           Print extended help
95       -V           Print version and copyright
96       -v           Be verbose
97       -o output    Use given file as output
98       -O           Overwrite already existing output file(s)
99       -B           Use basename of single input file for output file
100       -I           Also create .ins (install) file
101       -c           Only use code section (like v1.0)
102       -r           Remove existing 'macro', 'macrocode', etc. environments.
103       -R           Do not remove existing 'macro', 'macrocode', etc.
104       environments.
105       -i ins-file  Create .ins file with given name
106       -t template  Use this file as template instead of the default one
107       -T template  Use this file as template for the .ins file
108       -e file      Export default .dtx template to file and exit
109       -E file      Export default .ins template to file and exit
110       -D           Use current date as file date
111       -F file      Read more options and variables from file.
112       -N           Do not read default config file; must be the first option
113
114   Config files
115       A default config file either named 'sty2dtx.cfg' or '.sty2dtx.cfg' is
116       searched in the current directory, the users home directory and the
117       directory of this script, in this order. The first one found is loaded.
118       If none is found the 'texmf' tree is searched for a 'sty2dtx.cfg'
119       config file.  As with -F files the config file should contain one
120       option or variable per line.  Lines starting with '"%"' or '"#"' are
121       ignored.
122

Examples

124       Produce 'file.dtx' from 'file.sty':
125
126           sty2dtx.pl < file.sty > file.dtx
127
128       or
129
130           sty2dtx.pl file.sty file.dtx
131
132       or
133
134           sty2dtx.pl -B file.sty
135
136       Produce 'file.dtx' and 'file.ins' from 'file.sty':
137
138           sty2dtx.pl -I file.sty file.dtx
139
140       or
141
142           sty2dtx.pl file.sty -i file.sty file.dtx
143
144       or
145
146           sty2dtx.pl -IB file.sty
147
148       Set custom variable values:
149
150           sty2dtx.pl --author Me --email me@there.com mypkg.sty mypkg.dtx
151
152       Produce DTX file for a class:
153
154           sty2dtx.pl --type class mycls.sty mycls.dtx
155

AUTHOR

157       Martin Scharrer
158
159       E-mail: martin@scharrer-online.de
160
161       WWW: http://www.scharrer-online.de <http://www.scharrer-online.de>
162
163
164
165perl v5.14.2                      2012-11-07                        STY2DTX(1)
Impressum