\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
\"
\" Standard preamble:
\" ========================================================================
de Sp \" Vertical space (when we can't use .PP)
if t .sp .5v
if n .sp
.
de Vb \" Begin verbatim text
ft CW
nf
ne \\$1
.
de Ve \" End verbatim text
ft R
fi
.
\" Set up some character translations and predefined strings.  \*(-- will
\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
\" double quote, and \*(R" will give a right double quote.  \*(C+ will
\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
\" nothing in troff, for use with C<>.
tr \(*W-
ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
ie n \{\
   ds -- \(*W-
   ds PI pi
   if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   ds L" ""
   ds R" ""
   ds C` ""
   ds C' ""
'br\}
el\{\
   ds -- \|\(em\|
   ds PI \(*p
   ds L" ``
   ds R" ''
   ds C`
   ds C'
'br\}
\"
\" Escape single quotes in literal strings from groff's Unicode transform.
ie \n(.g .ds Aq \(aq
el       .ds Aq '
\"
\" If the F register is >0, we'll generate index entries on stderr for
\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
\" entries marked with X<> in POD.  Of course, you'll have to process the
\" output yourself in some meaningful fashion.
\"
\" Avoid warning from groff about undefined register 'F'.
de IX
.
nr rF 0
if \n(.g .if rF .nr rF 1
if (\n(rF:(\n(.g==0)) \{\
   if \nF \{\
       de IX
       tm Index:\\$1\t\\n%\t"\\$2"
.
       if !\nF==2 \{\
           nr % 0
           nr F 2
       \}
   \}
\}
rr rF
\"
\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   \" fudge factors for nroff and troff
if n \{\
   ds #H 0
   ds #V .8m
   ds #F .3m
   ds #[ \f1
   ds #] \fP
\}
if t \{\
   ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   ds #V .6m
   ds #F 0
   ds #[ \&
   ds #] \&
\}
   \" simple accents for nroff and troff
if n \{\
   ds ' \&
   ds ` \&
   ds ^ \&
   ds , \&
   ds ~ ~
   ds /
\}
if t \{\
   ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
   ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
   ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
   ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
   ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
\}
   \" troff and (daisy-wheel) nroff accents
ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
ds 8 \h'\*(#H'\(*b\h'-\*(#H'
ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
ds ae a\h'-(\w'a'u*4/10)'e
ds Ae A\h'-(\w'A'u*4/10)'E
   \" corrections for vroff
if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
   \" for low resolution devices (crt and lpr)
if \n(.H>23 .if \n(.V>19 \
\{\
   ds : e
   ds 8 ss
   ds o a
   ds d- d\h'-1'\(ga
   ds D- D\h'-1'\(hy
   ds th \o'bp'
   ds Th \o'LP'
   ds ae ae
   ds Ae AE
\}
rm #[ #] #H #V #F C
\" ========================================================================
\"
IX Title "STY2DTX 1"
TH STY2DTX 1 "2022-10-18" "perl v5.30.0" "User Contributed Perl Documentation"
\" For nroff, turn off justification.  Always turn off hyphenation; it makes
\" way too many mistakes in technical documents.
if n .ad l
nh
SH "NAME"
sty2dtx \-\- Converts a LaTeX .sty file to a documented .dtx file
SH "VERSION"
IX Header "VERSION"
Version: v2.4 \- 2022/10/18
SH "LINKS"
IX Header "LINKS"
\&\s-1CTAN:\s0 https://ctan.org/pkg/sty2dtx
PP
Repository: https://github.com/MartinScharrer/sty2dtx
PP
Issues: https://github.com/MartinScharrer/sty2dtx/issues
SH "COPYRIGHT"
IX Header "COPYRIGHT"
Copyright (c) 2010\-2022 Martin Scharrer <[email protected]>
PP
This program is free software: you can redistribute it and/or modify
it under the terms of the \s-1GNU\s0 General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PP
This program is distributed in the hope that it will be useful,
but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of
\&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0  See the
\&\s-1GNU\s0 General Public License for more details.
PP
You should have received a copy of the \s-1GNU\s0 General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
SH "DESCRIPTION"
IX Header "DESCRIPTION"
Converts a .sty file (LaTeX package) to .dtx format (documented LaTeX source),
by surrounding macro definitions with 'macro' and 'macrocode' environments.
The macro name is automatically inserted as an argument to the 'macro'
environemnt.
Code lines outside macro definitions are wrapped only in 'macrocode'
environments. Empty lines are removed.
The script is not thought to be fool proof and 100% accurate but rather
as a good start to convert undocumented style files to .dtx files.
SS "Basic Usage"
IX Subsection "Basic Usage"
Vb 1
\&     perl sty2dtx.pl infile [infile ...] outfile
Ve
PP
or
PP
Vb 1
\&     perl sty2dtx.pl < file.sty > file.dtx
Ve
SS "Supported Definitions"
IX Subsection "Supported Definitions"
The following macro definitions are detected when they are at the start of a
line (can be prefixed by \eglobal, \elong, \eprotected and/or \eouter):
PP
Vb 8
\&    \edef   \eedef   \egdef   \exdef
\&    \enewcommand{\ename}     \enewcommand*{\ename}
\&    \enewcommand\ename       \enewcommand*\ename
\&    \erenewcommand{\ename}   \erenewcommand*{\ename}
\&    \erenewcommand\ename     \erenewcommand*\ename
\&    \eprovidecommand{\ename} \eprovidecommand*{\ename}
\&    \eprovidecommand\ename   \eprovidecommand*\ename
\&    \e@namedef{\ename}       \e@namedef\ename
Ve
PP
The following environment definitions are detected when they are at the start
of a line:
PP
Vb 1
\&    \enewenvironment{name}  \erenewenvironemnt{name}  \eprovideenvironment{name}
Ve
PP
The macro and environment definition must either end at the same line or with
a '\f(CW\*(C`}\*(C'\fR' on its own on a line.
SH "USAGE"
IX Header "USAGE"
Vb 1
\&  sty2dtx [<options>] [\-\-<VAR>=<VALUE> ...] [\-\-] [<infile(s)>] [<outfile>]
Ve
SS "Files"
IX Subsection "Files"
IP "\(bu" 2
can be '\f(CW\*(C`\-\*(C'\fR' for \s-1STDIN\s0 or \s-1STDOUT,\s0 which is the default if no files are given
IP "\(bu" 2
multiple input files are merged to one output file
SS "Variables"
IX Subsection "Variables"
Variables can be defined using
PP
Vb 1
\&  \-\-<VAR>=<VALUE>
Ve
PP
or
PP
Vb 1
\&  \-\-<VAR> <VALUE>
Ve
PP
and will be used for substitutions in the template file.
PP
\fICommon variables:\fR
IX Subsection "Common variables:"
PP
Vb 4
\&      author, email, maintainer, year (for copyright),
\&      version, date, description (of package/class),
\&      type (either \*(Aqpackage\*(Aq default or \*(Aqclass\*(Aq),
\&      filebase (automatically set from output or input file name),
Ve
SS "Options"
IX Subsection "Options"
IP "\fB\-h\fR \ \ \ \ \ \ \ \ \ \ Print this help text" 8
IX Item "-h Print this help text"
PD 0
IP "\fB\-H\fR \ \ \ \ \ \ \ \ \ \ Print extended help" 8
IX Item "-H Print extended help"
IP "\fB\-V\fR \ \ \ \ \ \ \ \ \ \ Print version and copyright" 8
IX Item "-V Print version and copyright"
IP "\fB\-v\fR \ \ \ \ \ \ \ \ \ \ Be verbose" 8
IX Item "-v Be verbose"
IP "\fB\-o\fR \fIoutput\fR \ \ \ Use given file as output" 8
IX Item "-o output Use given file as output"
IP "\fB\-O\fR \ \ \ \ \ \ \ \ \ \ Overwrite already existing output file(s)" 8
IX Item "-O Overwrite already existing output file(s)"
IP "\fB\-B\fR \ \ \ \ \ \ \ \ \ \ Use basename of single input file for output file" 8
IX Item "-B Use basename of single input file for output file"
IP "\fB\-I\fR \ \ \ \ \ \ \ \ \ \ Also create .ins (install) file" 8
IX Item "-I Also create .ins (install) file"
IP "\fB\-c\fR \ \ \ \ \ \ \ \ \ \ Only use code section (like v1.0)" 8
IX Item "-c Only use code section (like v1.0)"
IP "\fB\-r\fR \ \ \ \ \ \ \ \ \ \ Remove existing 'macro', 'macrocode', etc. environments." 8
IX Item "-r Remove existing 'macro', 'macrocode', etc. environments."
IP "\fB\-R\fR \ \ \ \ \ \ \ \ \ \ Do not remove existing 'macro', 'macrocode', etc. environments." 8
IX Item "-R Do not remove existing 'macro', 'macrocode', etc. environments."
IP "\fB\-i\fR \fIins-file\fR \ Create .ins file with given name" 8
IX Item "-i ins-file Create .ins file with given name"
IP "\fB\-t\fR \fItemplate\fR \ Use this file as template instead of the default one" 8
IX Item "-t template Use this file as template instead of the default one"
IP "\fB\-T\fR \fItemplate\fR \ Use this file as template for the .ins file" 8
IX Item "-T template Use this file as template for the .ins file"
IP "\fB\-e\fR \fIfile\fR \ \ \ \ \ Export default .dtx template to file and exit" 8
IX Item "-e file Export default .dtx template to file and exit"
IP "\fB\-E\fR \fIfile\fR \ \ \ \ \ Export default .ins template to file and exit" 8
IX Item "-E file Export default .ins template to file and exit"
IP "\fB\-D\fR \ \ \ \ \ \ \ \ \ \ Use current date as file date" 8
IX Item "-D Use current date as file date"
IP "\fB\-F\fR \fIfile\fR \ \ \ \ \ Read more options and variables from file." 8
IX Item "-F file Read more options and variables from file."
IP "\fB\-N\fR \ \ \ \ \ \ \ \ \ \ Do not read default config file; must be the first option" 8
IX Item "-N Do not read default config file; must be the first option"
PD
SS "Config files"
IX Subsection "Config files"
A default config file either named 'sty2dtx.cfg' or '.sty2dtx.cfg' is searched
in the current directory, the users home directory and the directory of this
script, in this order. The first one found is loaded.  If none is found the
\&'texmf' tree is searched for a 'sty2dtx.cfg' config file.  As with \-F files the
config file should contain one option or variable per line.
Lines starting with '\f(CW\*(C`%\*(C'\fR' or '\f(CW\*(C`#\*(C'\fR' are ignored.
SH "Examples"
IX Header "Examples"
Produce 'file.dtx' from 'file.sty':
PP
Vb 1
\&    sty2dtx.pl < file.sty > file.dtx
Ve
PP
or
PP
Vb 1
\&    sty2dtx.pl file.sty file.dtx
Ve
PP
or
PP
Vb 1
\&    sty2dtx.pl \-B file.sty
Ve
PP
Produce 'file.dtx' and 'file.ins' from 'file.sty':
PP
Vb 1
\&    sty2dtx.pl \-I file.sty file.dtx
Ve
PP
or
PP
Vb 1
\&    sty2dtx.pl file.sty \-i file.sty file.dtx
Ve
PP
or
PP
Vb 1
\&    sty2dtx.pl \-IB file.sty
Ve
PP
Set custom variable values:
PP
Vb 1
\&    sty2dtx.pl \-\-author Me \-\-email [email protected] mypkg.sty mypkg.dtx
Ve
PP
Produce \s-1DTX\s0 file for a class:
PP
Vb 1
\&    sty2dtx.pl \-\-type class mycls.sty mycls.dtx
Ve
SH "AUTHOR"
IX Header "AUTHOR"
Martin Scharrer
PP
E\-mail: [email protected]
PP
\&\s-1WWW:\s0 <http://www.scharrer\-online.de>