dtxgen generate template for LaTeX self-extracting .dtx file
doc generated from the script with gendoc
bash script, version=1.09

Synopsis

dtxgen [options] basename.[sty,cls]

Options

-h,--help
print short help and exit
-H,--Help
print full documentation via less and exit
-V
print version and exit
-s,--short=X
set short, one-liner, package description to X
-v,--version=X
set initial version to X.
Default: 1.00
-d,--date=X
set initial version’s date to X.
Default: current date
-m,--mail=X
set your email address to X.
Default: $EMAIL
-n,--name=X
set your name to X.
Default: $NAME
-c,--class=X
(class packs only) set class to be preloaded to X.
Default: article
-f,--format=X
set latex format to be used for compilation to X.
Default: pdflatex
-b,--body=X
existing style or class X to be used instead of demo
-i,--history
replace standard Change History section with simpler one.

Description

dtxgen creates a template for a self-extracting .dtx file, based on the model described by Joseph Wright. It is useful for those who plan to create a new Documented LaTeX Source (.dtx) file.

Usage example:

  dtxgen -n 'your name' -m 'your@email.ad' myclass.cls

The script takes some variables such as:

from environment variables, or from command line options and generates, among more, a template for the .dtx file with some minimal examples. Of course, the user will have to replace those examples with the real work, but the dates, basename, author's name and email address are already in place and, depending on whether you use used a .cls or a .sty extension in the argument, it is formatted to be either a class or a package source file.

If you have an environment with your name and email address defined in NAME and EMAIL, you could simply type:

  dtxgen myclass.cls

and you would end up with five files: myclass.dtx, myclass.cls, myclass.pdf, README.md, and Makefile.

Options

dtxgen recognizes the following options:

-h,--help
Prints help information and exits.
-H,--Help
print full documentation via less and exit
-V
Prints the script's version and exits.
-s,--short=X
A short, one-liner, description for the class or package. By default, the string /A new LaTeX class/ or /A new LaTeX package/ will be used.
-n,--name=X
Your name (first name, followed by surname). Alternatively, you can set a default value in the environment variable |NAME|; if you do so and still use this option, the option's value wills have priority.
-m,--mail=X
Your email address. Alternatively, you can set a default value ins the environment variable |EMAIL|; if you do so and still use this option, the option's value will have priority.
-c,--class=X
For class templates only: inserts a |\LoadClass{...}|, so that the new class will start with the properties of the |...| class. The default is |article|.
-v,--version=X
Set the initial version; by default 1.00 wil be used.
-d,--date=X
Set the initial version's date. By default, the current date will be used.  The date should be entered in the |yyyymmdd| format, although it will be stored the LaTeX way: |yyyy/mm/dd|.

-f,--format=X

Latex format to be used for compilation. The default is pdflatex, but you may need another format, like xelatex of lualatex.
-i,--history
Create a section History instead of the standard Change History section. The standard Change History allows very detailed reports, but most people contine themselves to global remarks about changes between versions, appearing at one place in the document. The --␣history option provides a straightforward history section, formatted in a longtable environment.

Makefile

The Makefile can be used to compile new versions of your work; it contains the following targets:

all
(the default) generate the style or class file,
the pdf-documentation, and a README.md file.
distclean
remove all files that can be regenerated,
clean
same, except the style or class file, the
pdf-documentation, and a README.md file.
inst
install in the user's TeX tree,
install
install in the local TeX tree (uses sudo)
zip
produce a zip file ready for upload to CTAN

Author

Wybo Dekker

Copyright

Released under the GNU General Public License

Functions used:


excheck

synopsis:
excheck executable1 [executable2...]
description:
check if all needed execs are there and getopt is GNU
apt-file find -x /pdfcrop$

handle_options

synopsis:
handle_options "$@"
description:
handle the options.
globals used:
Myname Version
globals  set:
args short date mail name loadclass format
returns:
the number of remaining arguments