texlive[75946] trunk: dtxgen (1aug25)

commits+karl at tug.org commits+karl at tug.org
Fri Aug 1 23:22:22 CEST 2025


Revision: 75946
          https://tug.org/svn/texlive?view=revision&revision=75946
Author:   karl
Date:     2025-08-01 23:22:22 +0200 (Fri, 01 Aug 2025)
Log Message:
-----------
dtxgen (1aug25)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/dtxgen/dtxgen
    trunk/Master/texmf-dist/doc/support/dtxgen/dtxgen.pdf
    trunk/Master/texmf-dist/scripts/dtxgen/dtxgen
    trunk/Master/tlpkg/libexec/ctan2tds

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/man/man1/dtxgen.1
    trunk/Master/texmf-dist/doc/man/man1/dtxgen.man1.pdf
    trunk/Master/texmf-dist/doc/support/dtxgen/README.md
    trunk/Master/texmf-dist/doc/support/dtxgen/dtxgen.html

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/support/dtxgen/README

Modified: trunk/Build/source/texk/texlive/linked_scripts/dtxgen/dtxgen
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/dtxgen/dtxgen	2025-08-01 21:21:45 UTC (rev 75945)
+++ trunk/Build/source/texk/texlive/linked_scripts/dtxgen/dtxgen	2025-08-01 21:22:22 UTC (rev 75946)
@@ -1,6 +1,5 @@
 #!/bin/bash
-
-Version=1.08
+Version=1.09
 Myname="${0##*/}"
 
 :<<'DOC'
@@ -10,20 +9,31 @@
 dtxgen [options] basename.[sty,cls]	
 
 == Options
+
 -h,--help	print short help and exit
 -H,--Help	print full documentation via less and exit
--V,--version	print version and exit
--s,--short	short, one-liner, package description
--d,--date	initial version's date. Default: current date 
--m,--mail	your email address. Default: |$EMAIL|
--n,--name	your name. Default: |$NAME|
--c,--class	(class packs only) class to be preloaded. Default: article
--q,--quiet	run quietly
+-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](www.texdev.net/2009/10/06/a-model-dtx-file/). It is useful for
-those who plan to create a new Documented LaTeX Source (.dtx) file.
+dtxgen creates a template for a self-extracting .dtx file, based on the
+model described by [Joseph Wright](www.texdev.net/2009/10/06/a-model-dtx-file/).
+It is useful for those who plan to create a new Documented LaTeX Source
+(.dtx) file.
 
 Usage example:
 
@@ -47,153 +57,207 @@
   dtxgen myclass.cls
 
 and you would end up with five files: |myclass.dtx|, |myclass.cls|,
-|myclass.pdf|, |README|, and |Makefile|.
+|myclass.pdf|, |README.md|, and |Makefile|.
 
 = Options
 dtxgen recognizes the following options:
 
--s,--short=...	
+-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=...	
+-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=...	
+-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=...	
+-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|.
--d,--date=...	
+-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|.
--q,--quiet	
-	Run quietly
--V,--version	
-	Prints the script's version and exits.
--h,--help	
-	Prints help information and exits.
--H,--Help	
-	print full documentation via less and exit
 
+-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:
+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 file.
+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 file.
+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](wybo at dekkerdocumenten.nl)
+[Wybo Dekker](wybodekker at me.com)
 
 = Copyright
 Released under the [GNU General Public License](www.gnu.org/copyleft/gpl.html)
 DOC
 
-# check executables and versions of bash and getopt
-((BASH_VERSINFO>=4)) || die "Need bash version >= 4"
-for i in getopt make; do
-   command -v "$i" &> /dev/null || die "$i: command not found"
-done
-i=$(getopt -T)
-{ (($?==4)) && [[ -z $i ]]; } || die "Your getopt is not GNU"
+REd='\e[38;5;1m' Mag='\e[38;5;5m' Nor='\e[0m'
+    die() { local i; for i; do echo -e "$Myname: $REd$i$Nor"; done 1>&2; exit 1; }
+   Warn() { local i; for i; do echo -e "$Myname: $Mag$i$Nor"; done 1>&2; }
+helpsrt() { sed -n '/^= Synopsis/,/^= /p' "$0"|sed '1d;$d'; exit; }
+helpall() { sed -n "/^:<<'DOC'$/,/^DOC/p" "$0"|sed '1d;$d'|
+            less -P"$Myname-${Version/./·} (press h for help, q to quit)";exit; }
 
-# using the label in arg 2, read template from my self, filter it
-# through the script in arg 1, and write the output to the file in arg 3.
-# The default for arg 3 is arg 2
-function createfile {
-   file=$3
-   test "$file" = "" && file=$2
-   sed -n "/^:<<'$2'/,/^$2/p" "$0" |tail -n +2 |head -n -1 |sed "$1" >"$file"
+:<<'DOC' #---------------------------------------------------------------------
+= excheck
+synopsis:	 excheck executable1 [executable2...]
+description:	check if all needed execs are there and getopt is GNU
+		execs and their source are to be set in hash |needs|
+		Find the source of, say, |pdfcrop|, with:
+		 apt-file find -x /pdfcrop$
+DOC
+#-------------------------------------------------------------------------------
+excheck() {
+   local ok=true i
+   ((BASH_VERSINFO>=4)) || die "Need bash version >= 4"
+   for i in "${!needs[@]}"; do 
+      command -v "$i" > /dev/null && continue
+      Warn "Missing executable: $i (available in ${needs[$i]})"
+      ok=false
+   done
+   $ok || die
+   getopt -T 
+   (( $? == 4 )) || die "Your getopt is not GNU"
 }
 
-REd='\e[38;5;9m'
-    die() { local i; for i; do echo -e "$Myname: $REd$i"; done 1>&2; exit 1; }
-helpsrt() { sed -n '/^= Synopsis/,/^= /p' "$0"|sed '1d;$d'; exit; }
-instscr() { instscript --zip --pdf "$Myname"; exit; }
+:<<'DOC' #----------------------------------------------------------------------
+= 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
+DOC
+#-------------------------------------------------------------------------------
+handle_options() {
+   local options
+   if ! options=$(getopt \
+      -n "$Myname" \
+      -o s:n:m:b:c:d:v:hHVf:iI \
+      -l short:,name:,mail:,body:,class:,date:,version:,help,Help,version,format,history: -- "$@"
+   ); then exit 1; fi
+   history=false
+   eval set -- "$options"
+   
+   while [ $# -gt 0 ]; do
+      case $1 in
+      (-h|--help)    # print short help and exit
+                     helpsrt
+                     ;;
+      (-H|--Help)    # print full documentation via less and exit
+                     helpall
+                     ;;      
+      (-V)           # print version and exit
+                     echo $Version
+                     exit
+                     ;;
+      (-s|--short)   # set short, one-liner, package description to X
+                     short=$2
+                     shift 2
+                     ;;
+      (-v|--version) # set initial version to X.
+		     # Default: 1.00
+                     version=$2
+                     shift 2
+                     ;;
+      (-d|--date)    # set initial version’s date to X.
+		     # Default: current date 
+                     date=$2
+                     shift 2
+                     ;;
+      (-m|--mail)    # set your email address to X.
+		     # Default: |$EMAIL|
+                     mail=$2
+                     shift 2
+                     ;;
+      (-n|--name)    # set your name to X.
+		     # Default: |$NAME|
+                     name=$2
+                     shift 2
+                     ;;
+      (-c|--class)   # (class packs only) set class to be preloaded to X.
+		     # Default: article
+                     loadclass=$2
+                     shift 2
+                     ;;
+      (-f|--format)  # set latex format to be used for compilation to X.
+		     # Default: pdflatex
+                     format=$2
+                     shift 2
+                     ;;
+      (-b|--body)    # existing style or class X to be used instead of demo
+                     body="$2"
+                     [[ -z $body ]] && die "kpsewhich could not find $body"
+                     shift 2
+                     ;;
+      (-i|--history) # replace standard Change History section with simpler one.
+                     history=true
+                     shift
+                     ;;
+      (-I)           instscript "$Myname" ||
+                        die 'the -I option is for developers only'
+                     exit
+                     ;;
+      (--)           shift
+                     break
+                     ;;
+      (*)            break
+                     ;;
+      esac
+   done
+   args=( "$@" )
+}
 
-# shellcheck disable=SC2154
-helpall() { sed -n "/^:<<'DOC'$/,/^DOC/p" "$0"|sed -n '1d;$d;p'|
-            less -Ps"$Myname-${Version/./·} documentation - type h for help, q to quit."
-		exit
-	  }
+declare -A needs=(
+[make]='make'
+[getopt]='util-linux'
+[envsubst]='gettext-base'
+[pdflatex]='texlive-latex-base'
+[makeindex]='texlive-binaries'
+[zip]='zip'
+[ltxfileinfo]='texlive-extra-utils'
+[kpsewhich]='texlive-binaries'
+[texi2dvi]='https://ctan.mirrors.hoobly.com/macros/texinfo/latest/texi2dvi'
+)
+excheck "${needs[@]}"
 
-if ! options=$(getopt \
-   -n "$Myname" \
-   -o s:n:m:c:d:hHVqI \
-   -l short:,name:,mail:,class:,date:,help,Help,version,quiet -- "$@"
-); then exit 1; fi
-eval set -- "$options"
+handle_options "$@"
+set -- "${args[@]}"
 
-while [ $# -gt 0 ]; do
-   case $1 in
-   (-h|--help)    # print short help and exit
-                  helpsrt
-                  ;;
-   (-H|--Help)    # print full documentation via less and exit
-                  helpall
-                  ;;      
-   (-V|--version) # print version and exit
-                  echo $Version
-		  exit
-                  ;;
-   (-s|--short)   # short, one-liner, package description
-                  short=$2
-                  shift 2
-                  ;;
-   (-d|--date)    # initial version's date. Default: current date 
-                  date=$2
-                  shift 2
-                  ;;
-   (-m|--mail)    # your email address. Default: $EMAIL
-                  mail=$2
-                  shift 2
-                  ;;
-   (-n|--name)    # your name. Default: $NAME
-                  name=$2
-                  shift 2
-                  ;;
-   (-c|--class)   # (class packs only) class to be preloaded. Default: article
-                  loadclass=$2
-                  shift 2
-                  ;;
-   (-q|--quiet)   # run quietly
-                  quiet=--quiet
-                  shift
-                  ;;
-   (-I)           instscr
-                  ;;
-   (--)           shift
-                  break
-                  ;;
-   (*)            break
-                  ;;
-   esac
-done
+test $# == 1 || die "I need 1 argument"
 
-export year typ Typ lcl use # used in templates - shellcheck se them as unused
-
-name=${name:-${NAME:-(not set)}}
-mail=${mail:-${EMAIL:-(not set)}}
-date=${date:-$(date +%Y%m%d)}
-year=${date:0:4}
-loadclass=${loadclass:-article}
-
-# date must be 8 digits; insert the two /'s:
-if [[ ! $date =~ ^[[:digit:]]{8}$ ]]; then die "illegal date"; fi
-date=$(sed 's/\(....\)\(..\)\(..\)/\1\\\/\2\\\/\3/' <<<"$date")
-
 # argument must have .cls or .sty extension:
 base=${1%.*}
 ext=${1#*.}
@@ -200,17 +264,45 @@
 
 case "$ext" in
 (cls) typ=class; Typ=Class;
-      short=${short:-A new LaTeX class}
-      lcl='\\LoadClass[a4paper,fleqn]{'"$loadclass}"
-     ;;
+      lcl="\\LoadClass[a4paper,fleqn]{${loadclass:-article}}"
+      ;;
 (sty) typ=package; Typ=Package;
-      short=${short:-A new LaTeX package}
-      use='\\usepackage{\\jobname}'
-     ;;
+      use='\usepackage{\jobname}'
+      ;;
 (*)   die "The argument must have .cls or .sty extension
          (try the --help option)"
 esac
 
+: "${name:=${NAME:-(not set)}}"		# default name is envvar NAME
+: "${mail:=${EMAIL:-(not set)}}"	# default email is envvar MAIL
+: "${date:=$(date +%Y%m%d)}"		# default date is now
+: "${version:=1.00}"			# default version is 1.00
+: "${format:=pdflatex}"			# default formatter is pdflatex
+: "${short:=A new LaTeX $typ}"		# default short description
+
+# date must be 8 digits; insert the two -'s:
+if [[ ! $date =~ ^[[:digit:]]{8}$ ]]; then die "illegal date: $date"; fi
+date="${date:0:4}-${date:4:2}-${date:6:2}"
+Date="${date//-/\/}" # format for \Provides commands
+
+if $history; then
+   read -rd '' history <<-EOD
+	% \section{History}
+	% \begin{longtable}{@{}p{8mm}p{127mm}@{}}
+	% v1.00 & $date\\\\
+	%       & - first release.\\\\
+	% \end{longtable}
+	EOD
+else
+   history='% \PrintChanges'
+   ch1="% \\changes{v1.00}{$date}{First public release}"
+   read -rd '' ch2 <<-EOD
+	% \\changes{v1.00a}{$date}{Added a spurious change log entry to
+	%   show what a change \emph{within} an environment definition looks
+	%   like.}"
+	EOD
+fi
+
 # The short description may contain TeX commands, but then we need
 # a version without them at some places; note that this removes only
 # simple contructs:
@@ -222,88 +314,212 @@
 test -z "$mail" && die "author's email not set - use option or environment variable EMAIL"
 test -z "$name" && die "author's name not set - use option or environment variable NAME"
 
-colw=${#base}
-(( colw = colw < 7 ? 7 : colw ))
-kopl="$(eval "printf '%.0s-' {1..$colw}")"
-kopr="$(eval "printf '%.0s-' {1..$((72-colw))}")"
-declare -A rm=(
-    [$kopl]=$kopr
-    [$base]=$shrt
-   [Author]=$name
-   [E-mail]=$mail
-  [License]='Released under the LaTeX Project Public License v1.3c or later'
-      [See]='http://www.latex-project.org/lppl.txt'
-)
+export abst body desc base format etc ext year mail use typ Typ name date
+export short shrt lcl make readme version history ch1 ch2 Date
 
-for i in $kopl $base Author E-mail License See; do
-  readme+="$(printf "%*s:| %s\\\\n"  $colw "$i" "${rm[$i]}")"
-done
+if [[ -z $body ]]; then
+   # if no existing style/class file was given, use the demo one:
+   body="$(sed -n "/^:<<'BODY'/,/^BODY/{/BODY/!p}" "$0" |envsubst)"
+   desc="$(sed -n "/^:<<'DESC'/,/^DESC/{/DESC/!p}" "$0")"
+   abst="% This is a demo $Typ file"
+else
+   body=${body%.$ext}.$ext
+   body="$(kpsewhich "$body")"
+   [[ -z $body ]] && die "kpsewhich could not find $body"
+   # remove any \Provides..., \NeedsTeXFormat, \endinput and %%-comments
+   body="$(sed '
+	/^\\Provides/{N;N;s/\\Provides.*{.*}%*\s\+\[.*\]//;}
+	/^%%/d
+	/^\\NeedsTeXFormat/d
+	/^\\endinput/d
+   ' "$body")"
+   abst="% Put your abstract here"
+   desc="% Put your descriptive text here"
+fi
+readme="$(sed -n "/^:<<'README'/,/^README/{/README/!p}" "$0" |envsubst)"
 
-# make sed script replacing the variables in the templates:
-sedscript=''
-for i in base year ext mail use typ Typ name date short shrt lcl readme; do
-  test $quiet || eval "echo -e \"$i	\$$i\""|sed 's/\\\\/\\/g'
-  eval "sedscript+=\"s=%$i%=\$$i=g;\""
-done
+# Here we zip only the Makefile, but in real projects more files may be involved.
+sed -n "/^:<<'MAKEF'/,/^MAKEF/{/MAKEF/!p}" "$0" |envsubst > Makefile
+etc="$(tar czf - Makefile | uuencode -m etc.taz)"
+rm Makefile
 
-createfile "$sedscript" Makefile
-createfile "$sedscript" DTX "$base.dtx"
-make $quiet
+sed -n "/^:<<'DTX'/,/^DTX/{/DTX/!p}" "$0" |envsubst >"$base".dtx
+
+{ tex -interaction=batchmode "$base.dtx"
+  sh make.sh
+  make
+  make clean
+} >/dev/null
+cat <<-EOD
+	
+	You have 5 new files now:
+	1. $base.dtx: this is the only file you need to keep and edit.
+	   The other files can be generated from it with:
+	   tex $base.dtx && sh make.sh
+	2. The README.md file.
+	3. $base.$ext: the $Typ file.
+	4. $base.pdf: the documentation.
+	5. A Makefile:
+EOD
+make help
 exit 0
+# ---- TEMPLATES: ----
+:<<'DESC'
+% \DescribeMacro{\dummyMacro}
+% This macro does nothing.\index{doing nothing|usage} It is merely an
+% example.  If this were a real macro, you would put a paragraph here
+% describing what the macro is supposed to do, what its mandatory and
+% optional arguments are, and so forth.
+%
+% \DescribeEnv{dummyEnv}
+% This environment does nothing.  It is merely an example.
+% If this were a real environment, you would put a paragraph here
+% describing what the environment is supposed to do, what its
+% mandatory and optional arguments are, and so forth.
+DESC
 
-# ---- TEMPLATES: ----
-:<<'Makefile'
-NAME  = %base%
+:<<'BODY'
+%    \end{macrocode}
+% \begin{macro}{\dummyMacro}
+% This is a dummy macro.  If it did anything, we'd describe its
+% implementation here.
+%    \begin{macrocode}
+\newcommand{\dummyMacro}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{environment}{dummyEnv}
+% This is a dummy environment.  If it did anything, we'd describe its
+% implementation here.
+%    \begin{macrocode}
+\newenvironment{dummyEnv}{%
+}{%
+%    \end{macrocode}
+$ch2
+% Don't use |%| to introduce a code comment within a |macrocode|
+% environment.  Instead, you should typeset all of your comments with
+% LaTeX---doing so gives much prettier results.  For comments within a
+% macro/environment body, just do an |\end{macrocode}|, include some
+% commentary, and do another |\begin{macrocode}|.  It's that simple.
+%    \begin{macrocode}
+}
+%    \end{macrocode}
+% \end{environment}
+%    \begin{macrocode}
+BODY
+
+:<<'MAKEF'
 SHELL = bash
+BASE  = $base
+FMT   = $format
+UID   = $(shell id -u)
 PWD   = $(shell pwd)
-VERS  = $(shell ltxfileinfo -v $(NAME).dtx|sed -e 's/^v//')
+VERS  = $(shell ltxfileinfo -v $(BASE).dtx|sed -e 's/^v//')
 LOCAL = $(shell kpsewhich --var-value TEXMFLOCAL)
 UTREE = $(shell kpsewhich --var-value TEXMFHOME)
-all:	$(NAME).pdf
-	test -e README.txt && mv README.txt README || exit 0
-$(NAME).pdf: $(NAME).dtx
-	pdflatex -shell-escape -recorder -interaction=batchmode $(NAME).dtx >/dev/null
-	if [ -f $(NAME).glo ]; then makeindex -q -s gglo.ist -o $(NAME).gls $(NAME).glo; fi
-	if [ -f $(NAME).idx ]; then makeindex -q -s gind.ist -o $(NAME).ind $(NAME).idx; fi
-	pdflatex --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null
-	pdflatex --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null
-clean:
-	rm -f $(NAME).{aux,fls,glo,gls,hd,idx,ilg,ind,ins,log,out}
-distclean: clean
-	rm -f $(NAME).{pdf,%ext%} README
-inst: all
-	mkdir -p $(UTREE)/{tex,source,doc}/latex/$(NAME)
-	cp $(NAME).dtx $(UTREE)/source/latex/$(NAME)
-	cp $(NAME).%ext% $(UTREE)/tex/latex/$(NAME)
-	cp $(NAME).pdf $(UTREE)/doc/latex/$(NAME)
-install: all
-	sudo mkdir -p $(LOCAL)/{tex,source,doc}/latex/$(NAME)
-	sudo cp $(NAME).dtx $(LOCAL)/source/latex/$(NAME)
-	sudo cp $(NAME).%ext% $(LOCAL)/tex/latex/$(NAME)
-	sudo cp $(NAME).pdf $(LOCAL)/doc/latex/$(NAME)
-zip: all
-	ln -sf . $(NAME)
-	zip -Drq $(PWD)/$(NAME)-$(VERS).zip $(NAME)/{README,$(NAME).{pdf,dtx}}
-	rm $(NAME)
-Makefile
+all:	check
+	@$(FMT) '$(BASE).dtx'
+	@test -e $(BASE).glo && makeindex -qs gglo.ist -o $(BASE).gls $(BASE).glo
+	@makeindex -qs gind.ist $(BASE).idx
+	@$(FMT) '$(BASE).dtx'
+clean:	# clean, but keep installable files only #
+	rm -f $(BASE).{aux,fls,glo,gls,hd,idx,ilg,ind,ins,log,out,toc,synctex.gz}
+	rm -f etc.* make.sh
+Clean:	clean # clean to keep dtx file and CTAN zip only #
+	rm -f $(BASE).{pdf,$ext} README.md Makefile
+inst:	check # install in your own tree #
+	@mkdir -p $(UTREE)/{tex,source,doc}/latex/$(BASE)
+	cp $(BASE).dtx $(UTREE)/source/latex/$(BASE)
+	cp $(BASE).$ext $(UTREE)/tex/latex/$(BASE)
+	cp $(BASE).pdf README.md $(UTREE)/doc/latex/$(BASE)
+install: check # install in local tree (needs sudo rights) #
+	@sudo mkdir -p $(LOCAL)/{tex,source,doc}/latex/$(BASE)
+	sudo cp $(BASE).dtx $(LOCAL)/source/latex/$(BASE)
+	sudo cp $(BASE).$ext $(LOCAL)/tex/latex/$(BASE)
+	sudo cp $(BASE).pdf README.md $(LOCAL)/doc/latex/$(BASE)
+zip:	check # create zip for CTAN #
+	@ln -sf . $(BASE)
+	@zip -Drq $(PWD)/$(BASE)-$(VERS).zip $(BASE)/{README.md,$(BASE).{pdf,dtx,$ext}}
+	@rm $(BASE)
+	@echo $(BASE)-$(VERS).zip created
+check:
+	@test "$(UID)" != "0" -a  -n "$(VERS)" -a -n "$(LOCAL)" || exit 1
+help:	# show this help #
+	@echo
+	@echo make targets:
+	@sed -n '/^[a-zA-Z.]*:/N;s/:[^#]*# \([^#]*\) #.*/:\t\1/p' Makefile |expand -12
+	@echo
+	@echo "Version:    $(VERS)"
+	@echo "User tree:  $(UTREE)"
+	@echo "Local tree: $(LOCAL)"
+	@echo "Use the Makefile for the above targets only"
+	@echo "Note:       Never use sudo!"
+MAKEF
 
+:<<'README'
+# $base
+     key | description
+     ---:|:---
+   $base | $shrt
+ version | $version
+    date | $date 
+  author | $name
+   email | $mail
+ license | Released under the LaTeX Project Public License v1.3c or later
+
+## Short description:
+Some text about the $typ: probably the same as the abstract.
+
+## Installation:
+This is a self-extracting file. Install as follows:
+1. Run "tex $base.dtx"
+2. Run "sh make.sh"
+3. Run "make install" to install in the local tree (needs sudo rights), or
+   Run "make inst" to install in your own tree.
+4. Run "make clean" to remove most intermediate files, or
+   Run "make Clean" to keep the dtx file and CTAN zip only.
+5. Run "make zip" to create a zip file for CTAN
+6. Try "make help"
+README
+
 :<<'DTX'
 % \iffalse meta-comment
-% vim: textwidth=75
+%
+% Copyright (C) 2021 by Wybo Dekker <wybodekker at me.com>
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License (LPPL), either
+% version 1.3c of this license or (at your option) any later
+% version.  The latest version of this license is in the file:
+%
+% http://www.latex-project.org/lppl.txt
+%
+% This work consists of the self-extracting file $base.dtx,
+% generated by dtxgen (https://github.com/wybodekker/dtxgen)
+% Installation: see the readme section below.
+%
 %<*internal>
 \iffalse
 %</internal>
 %<*readme>
-|
-%readme%
-
-Short description:
-Some text about the %typ%: probably the same as the abstract.
+$readme
 %</readme>
+%<*make>
+uudecode etc.uue
+tar xf etc.taz
+make
+make help
+%</make>
+%<*etc>
+$etc
+%</etc>
 %<*internal>
 \fi
 \def\nameofplainTeX{plain}
-\ifx\fmtname\nameofplainTeX\else
+\ifx\fmtname\nameofplainTeX
+  \def\Extract#1#2#3{\generate{\file{#1.#2}{\from{\jobname.dtx}{#3}}}}
+\else
+  \def\Extract#1#2#3{}
   \expandafter\begingroup
 \fi
 %</internal>
@@ -311,46 +527,15 @@
 \input docstrip.tex
 \keepsilent
 \askforoverwritefalse
-\preamble
-%readme%
-\endpreamble
-\postamble
-
-Copyright (C) %year% by %name% <%mail%>
-
-This work may be distributed and/or modified under the
-conditions of the LaTeX Project Public License (LPPL), either
-version 1.3c of this license or (at your option) any later
-version.  The latest version of this license is in the file:
-
-http://www.latex-project.org/lppl.txt
-
-This work is "maintained" (as per LPPL maintenance status) by
-%name%.
-
-This work consists of the file %base%.dtx and a Makefile.
-Running "make" generates the derived files README, %base%.pdf and %base%.%ext%.
-Running "make inst" installs the files in the user's TeX tree.
-Running "make install" installs the files in the local TeX tree.
-
-\endpostamble
-
-\usedir{tex/latex/%base%}
-\generate{
-  \file{\jobname.%ext%}{\from{\jobname.dtx}{%typ%}}
-}
+\Extract{\jobname}{$ext}{$typ}
 %</install>
 %<install>\endbatchfile
 %<*internal>
-\usedir{source/latex/%base%}
-\generate{
-  \file{\jobname.ins}{\from{\jobname.dtx}{install}}
-}
 \nopreamble\nopostamble
-\usedir{doc/latex/%base%}
-\generate{
-  \file{README.txt}{\from{\jobname.dtx}{readme}}
-}
+\catcode9=12
+\Extract{README}{md}{readme}
+\Extract{etc}{uue}{etc}
+\Extract{make}{sh}{make}
 \ifx\fmtname\nameofplainTeX
   \expandafter\endbatchfile
 \else
@@ -361,18 +546,19 @@
 %
 % \iffalse
 %<*driver>
-\ProvidesFile{%base%.dtx}
+\ProvidesFile{$base.dtx}
 %</driver>
-%<%typ%>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-%<%typ%>\Provides%Typ%{%base%}
-%<*%typ%>
-    [%date% v1.00 %shrt%]
-%</%typ%>
+%<$typ>\NeedsTeXFormat{LaTeX2e}[2021/11/15]
+%<$typ>\Provides$Typ{$base}
+%<*$typ>
+    [$Date v$version $shrt]
+%</$typ>
 %<*driver>
 \documentclass{ltxdoc}
-\usepackage[a4paper,margin=25mm,left=50mm,nohead]{geometry}
+\usepackage[a4paper,margin=20mm,left=50mm,nohead]{geometry}
 \usepackage[numbered]{hypdoc}
-%use%
+\usepackage{longtable}
+$use
 \EnableCrossrefs
 \CodelineIndex
 \RecordChanges
@@ -385,78 +571,32 @@
 % \GetFileInfo{\jobname.dtx}
 % \DoNotIndex{\newcommand,\newenvironment}
 %
-%\title{\textsf{%base%} --- %short%\thanks{This file
-%   describes version \fileversion, last revised \filedate.}
-%}
-%\author{%name%\thanks{E-mail: %mail%}}
-%\date{Released \filedate}
-%
-%\maketitle
-%
-%\changes{v1.00}{%date%}{First public release}
-%
-% \begin{abstract}
-% ==== Put abstract text here. ====
+% \title{\textsf{$base} --- $short}
+% \date{\large\fileversion\quad\filedate}
+% \author{$name\thanks{Email: $mail}}
+% \maketitle
+$ch1
+% \begin{abstract}\noindent
+$abst
 % \end{abstract}
+% \tableofcontents
 %
 % \section{Usage}
-%
-% ==== Put descriptive text here. ====
-%
-% \DescribeMacro{\dummyMacro}
-% This macro does nothing.\index{doing nothing|usage} It is merely an
-% example.  If this were a real macro, you would put a paragraph here
-% describing what the macro is supposed to do, what its mandatory and
-% optional arguments are, and so forth.
-%
-% \DescribeEnv{dummyEnv}
-% This environment does nothing.  It is merely an example.
-% If this were a real environment, you would put a paragraph here
-% describing what the environment is supposed to do, what its
-% mandatory and optional arguments are, and so forth.
-%
-%\StopEventually{^^A
-%  \PrintChanges
-%  \PrintIndex
-%}
-%
+$desc
+% \StopEventually{^^A
+$history
+% \PrintIndex
+% }
 % \section{Implementation}
 %
 %    \begin{macrocode}
-%<*%typ%>
-%lcl%
-%    \end{macrocode}
-% \begin{macro}{\dummyMacro}
-% This is a dummy macro.  If it did anything, we'd describe its
-% implementation here.
-%    \begin{macrocode}
-\newcommand{\dummyMacro}{}
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{environment}{dummyEnv}
-% This is a dummy environment.  If it did anything, we'd describe its
-% implementation here.
-%    \begin{macrocode}
-\newenvironment{dummyEnv}{%
-}{%
-%    \end{macrocode}
-% \changes{v1.00a}{%date%}{Added a spurious change log entry to
-%   show what a change \emph{within} an environment definition looks
-%   like.}
-% Don't use |%| to introduce a code comment within a |macrocode|
-% environment.  Instead, you should typeset all of your comments with
-% LaTeX---doing so gives much prettier results.  For comments within a
-% macro/environment body, just do an |\end{macrocode}|, include some
-% commentary, and do another |\begin{macrocode}|.  It's that simple.
-%    \begin{macrocode}
-}
-%    \end{macrocode}
-% \end{environment}
-%
-%    \begin{macrocode}
+%<*$typ>
+$lcl
+% ===== Start of your own code =====
+$body
+% ===== End of your own code =====
 \endinput
-%</%typ%>
+%</$typ>
 %    \end{macrocode}
 %\Finale
 DTX

Added: trunk/Master/texmf-dist/doc/man/man1/dtxgen.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/dtxgen.1	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/man/man1/dtxgen.1	2025-08-01 21:22:22 UTC (rev 75946)
@@ -0,0 +1,176 @@
+.TH dtxgen 1 "July 31, 2025" "dtxgen version 1.09" "DekDoc scripts"
+.SH NAME
+
+dtxgen - generate template for LaTeX self-extracting .dtx file
+
+.SH Synopsis
+
+.B dtxgen [options] basename.[sty,cls]
+
+.SS Options
+
+.B -h,--help
+.RS
+print short help and exit
+.RE
+.B -H,--Help
+.RS
+print full documentation via less and exit
+.RE
+.B -V
+.RS
+print version and exit
+.RE
+.B -s,--short=X
+.RS
+set short, one-liner, package description to X
+.RE
+.B -v,--version=X
+.RS
+set initial version to X.
+.RE
+.RS
+Default: 1.00
+.RE
+.B -d,--date=X
+.RS
+set initial version’s date to X.
+.RE
+.RS
+Default: current date 
+.RE
+.B -m,--mail=X
+.RS
+set your email address to X.
+.RE
+.RS
+Default: $EMAIL
+.RE
+.B -n,--name=X
+.RS
+set your name to X.
+.RE
+.RS
+Default: $NAME
+.RE
+.B -c,--class=X
+.RS
+(class packs only) set class to be preloaded to X.
+.RE
+.RS
+Default: article
+.RE
+.B -f,--format=X
+.RS
+set latex format to be used for compilation to X.
+.RE
+.RS
+Default: pdflatex
+.RE
+.B -b,--body=X
+.RS
+existing style or class X to be used instead of demo
+.RE
+.B -i,--history
+.RS
+replace standard Change History section with simpler one.
+.RE
+
+.SH Description
+dtxgen creates a template for a self-extracting .dtx file, based on the model described by Joseph Wright (www.texdev.net\fI2009\fR10\fI06\fRa-model-dtx-file/). It is useful for those who plan to create a new Documented LaTeX Source (.dtx) file. 
+
+Usage example: 
+
+  dtxgen -n 'your name' -m 'your at email.ad' myclass.cls
+
+The script takes some variables such as: 
+.IP ‣ 2
+name and email address of the author, 
+.IP ‣ 2
+a short description of the class or package generated from the .dtx file,
+
+.IP ‣ 2
+a date
+
+.PP
+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. 
+
+.SH Options
+dtxgen recognizes the following options: 
+
+.B -h,--help
+.RS
+Prints help information and exits.
+.RE
+.B -H,--Help
+.RS
+print full documentation via less and exit
+.RE
+.B -V
+.RS
+Prints the script's version and exits.
+.RE
+-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.
+
+.B -i,--history
+.RS
+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.
+.RE
+
+.SH Makefile
+The Makefile can be used to compile new versions of your work; it contains the following targets: 
+
+.B all
+.RS
+(the default) generate the style or class file,
+.RE
+.RS
+the pdf-documentation, and a README.md file.
+.RE
+.B distclean
+.RS
+remove all files that can be regenerated,
+.RE
+.B clean
+.RS
+same, except the style or class file, the
+.RE
+.RS
+pdf-documentation, and a README.md file.
+.RE
+.B inst
+.RS
+install in the user's TeX tree,
+.RE
+.B install
+.RS
+install in the local TeX tree (uses sudo)
+.RE
+.B zip
+.RS
+produce a zip file ready for upload to CTAN
+.RE
+
+.SH Author
+Wybo Dekker (wybodekker at me.com) 
+
+.SH Copyright
+Released under the GNU General Public License (www.gnu.org\fIcopyleft\fRgpl.html) 
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/man/man1/dtxgen.1
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/man/man1/dtxgen.man1.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/man/man1/dtxgen.man1.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/dtxgen.man1.pdf	2025-08-01 21:21:45 UTC (rev 75945)
+++ trunk/Master/texmf-dist/doc/man/man1/dtxgen.man1.pdf	2025-08-01 21:22:22 UTC (rev 75946)

Property changes on: trunk/Master/texmf-dist/doc/man/man1/dtxgen.man1.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/support/dtxgen/README
===================================================================
--- trunk/Master/texmf-dist/doc/support/dtxgen/README	2025-08-01 21:21:45 UTC (rev 75945)
+++ trunk/Master/texmf-dist/doc/support/dtxgen/README	2025-08-01 21:22:22 UTC (rev 75946)
@@ -1,11 +0,0 @@
- script: dtxgen - generate template for LaTeX self-extracting .dtx file
-   type: bash
- author: Wybo Dekker
-  email: wybo at dekkerdocumenten.nl
-version: 1.08
-license: GNU General Public License
---------------------------------------------------------------------------------
-dtxgen creates a template for a self-extracting .dtx file, based on the model described by
-[Joseph Wright](www.texdev.net/2009/10/06/a-model-dtx-file/). It is useful for
-those who plan to create a new Documented LaTeX Source (.dtx) file.
-

Added: trunk/Master/texmf-dist/doc/support/dtxgen/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/support/dtxgen/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/support/dtxgen/README.md	2025-08-01 21:22:22 UTC (rev 75946)
@@ -0,0 +1,14 @@
+# dtxgen
+|     key | description
+|     ---:|:---
+|  script | dtxgen - generate template for LaTeX self-extracting .dtx file
+|    type | bash
+|  author | Wybo Dekker
+|   email | wybodekker at me.com
+| version | 1.09
+| license | GNU General Public License
+
+dtxgen creates a template for a self-extracting .dtx file, based on the
+model described by [Joseph Wright](www.texdev.net/2009/10/06/a-model-dtx-file/).
+It is useful for those who plan to create a new Documented LaTeX Source
+(.dtx) file.


Property changes on: trunk/Master/texmf-dist/doc/support/dtxgen/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/support/dtxgen/dtxgen.html
===================================================================
--- trunk/Master/texmf-dist/doc/support/dtxgen/dtxgen.html	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/support/dtxgen/dtxgen.html	2025-08-01 21:22:22 UTC (rev 75946)
@@ -0,0 +1,153 @@
+<!DOCTYPE html>
+<html Lang="en">
+<head>
+  <meta name="generator" content="gendoc" />
+  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+  <title>dtxgen documentation</title>
+  <style media="screen">
+    tr { vertical-align:baseline; }
+    p { margin-top:10px; }
+    * { padding: 0; margin: 0; }
+    body {
+      font-family:Fontin,serif;
+      font-size:small;
+     color:#444;
+      margin-left: 30px;
+      max-width: 40em;
+    }
+    .top {
+      margin-top:10px;
+      margin-bottom:5px;
+    }
+    .bot {
+      margin-top:10px;
+      margin-bottom:0px;
+    }
+    h1 {
+      font-size: 120%;
+      color:#a00;
+      text-shadow: rgba(135,145,135,0.65) 3px 3px 4px;
+      margin-top: 30px;
+      padding-bottom: 0.4em;
+    }
+    h4 {
+      margin-top:15px;
+      margin-bottom:0px;
+    }
+    :link,
+    :visited {
+      color: #aa0000;
+      text-decoration: none;
+    }
+    :link:hover,
+    :visited:hover {
+      border-bottom: 1px dotted #6C8C22;
+    }
+    ul { list-style-type: circle; }
+    li { margin-left: 1.5em; }
+    pre,code {
+      font-family:monospace;
+      font-size: medium;
+      color: #023aaa;
+    }
+    td { padding-right: 1em; }
+    .red { color:#f00; }
+    .green { color:#0f0; }
+    .blue { color:#00f; }
+    .big {
+      font-size:xx-large;
+      font-weight:900;
+      color:#a00; 
+      text-shadow: rgba(135,145,135,0.65) 3px 3px 4px;
+      padding-right: .4em;
+    }
+    .kop {
+      font-size:large;
+      font-weight:900;
+      color:#a00;
+      text-shadow: rgba(135,145,135,0.65) 3px 3px 4px;
+    }
+    .left {
+       font-size:xx-small;
+       font-family:sans-serif;
+       margin-top:0px;
+       float: left;
+       width: 53%;
+    }
+    .right {
+       font-size:xx-small;
+       font-family:sans-serif;
+       text-align:right;
+       margin-top:0px;
+       float: right;
+       width: 45%;
+    }
+    img { vertical-align:top; }
+    h1.sub { color:#770; margin-top:2px; }
+    </style>
+    </head>
+    <body class="file">
+    <div>
+<hr class="top"/>
+<span class="big">dtxgen</span>
+<span class="kop">generate template for LaTeX self-extracting .dtx file</span>
+<hr class="bot"/>
+<div class="left">doc generated from the script with <a href="http://www.dekkerdocumenten.nl/unix/doc/gendoc.html">gendoc</a></div>
+<div class="right">bash script, version=1.09</div><div><br/>
+<p>
+<h1>Synopsis</h1>
+<table><colgroup><col style="width:10%"/><col style="width:90%"/></colgroup><tr><td></td><td></td></tr><tr><td colspan="2"><pre>dtxgen [options] basename.[sty,cls]</pre></td></tr></table><p>
+<h4>Options</h4>
+<p>
+<table><tr><td><pre>-h,--help</pre></td><td>print short help and exit</td></tr><tr><td><pre>-H,--Help</pre></td><td>print full documentation via less and exit</td></tr><tr><td><pre>-V</pre></td><td>print version and exit</td></tr><tr><td><pre>-s,--short=X</pre></td><td>set short, one-liner, package description to X</td></tr><tr><td><pre>-v,--version=X</pre></td><td>set initial version to X.</td></tr><tr><td></td><td>Default: 1.00</td></tr><tr><td><pre>-d,--date=X</pre></td><td>set initial version’s date to X.</td></tr><tr><td></td><td>Default: current date </td></tr><tr><td><pre>-m,--mail=X</pre></td><td>set your email address to X.</td></tr><tr><td></td><td>Default: <code>$EMAIL</code></td></tr><tr><td><pre>-n,--name=X</pre></td><td>set your name to X.</td></tr><tr><td></td><td>Default: <code>$NAME</code></td></tr><tr><td><pre>-c,--class=X</pre></td><td>(class packs only) set class to be preloaded to X.</td></tr><tr><td></td><td>Default: article</td></tr><tr><td><pre>-f,--format=X</pre></td><td>set latex format to be used for compilation to X.</td></tr><tr><td></td><td>Default: pdflatex</td></tr><tr><td><pre>-b,--body=X</pre></td><td>existing style or class X to be used instead of demo</td></tr><tr><td><pre>-i,--history</pre></td><td>replace standard Change History section with simpler one.</td></tr></table><p>
+<h1>Description</h1>
+<b><a href="../dtxgen">dtxgen</a></b> creates a template for a self-extracting .dtx file, based on the model described by <a href="http://www.texdev.net/2009/10/06/a-model-dtx-file/">Joseph Wright</a>. It is useful for those who plan to create a new Documented LaTeX Source (.dtx) file. <p>
+Usage example: <p>
+<pre>  dtxgen -n 'your name' -m 'your at email.ad' myclass.cls
+</pre>
+<p>
+The script takes some variables such as: <ul><li>
+name and email address of the author, </li><li>
+a short description of the class or package generated from the .dtx file,
+</li><li>
+a date
+</li></ul>
+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. <p>
+If you have an environment with your name and email address defined in NAME and EMAIL, you could simply type: <p>
+<pre>  dtxgen myclass.cls
+</pre>
+<p>
+and you would end up with five files: <code>myclass.dtx</code>, <code>myclass.cls</code>, <code>myclass.pdf</code>, <code>README.md</code>, and <code>Makefile</code>. <p>
+<h1>Options</h1>
+<b><a href="../dtxgen">dtxgen</a></b> recognizes the following options: <p>
+<table><colgroup><col style="width:10%"/><col style="width:90%"/></colgroup><tr><td></td><td></td></tr><tr><td colspan="2"><pre>-h,--help</pre></td></tr><tr><td></td><td>Prints help information and exits.</td></tr><tr><td colspan="2"><pre>-H,--Help</pre></td></tr><tr><td></td><td>print full documentation via less and exit</td></tr><tr><td colspan="2"><pre>-V</pre></td></tr><tr><td></td><td>Prints the script's version and exits.</td></tr></table>-s,--short=X <pre>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.
+</pre>
+-n,--name=X <pre>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.
+</pre>
+-m,--mail=X <pre>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.
+</pre>
+-c,--class=X <pre>For class templates only: inserts a |\LoadClass{...}|, so that the new class will start with the properties of the |...| class. The default is |article|.
+</pre>
+-v,--version=X <pre>Set the initial version; by default 1.00 wil be used.
+</pre>
+-d,--date=X <pre>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|.
+</pre>
+<p>
+-f,--format=X <pre>Latex format to be used for compilation. The default is pdflatex, but you may need another format, like xelatex of lualatex.
+</pre>
+<table><colgroup><col style="width:10%"/><col style="width:90%"/></colgroup><tr><td></td><td></td></tr><tr><td colspan="2"><pre>-i,--history</pre></td></tr><tr><td></td><td>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 <code>--&#x2423;history</code> option provides a straightforward history section, formatted in a <code>longtable</code> environment.</td></tr></table><p>
+<h1>Makefile</h1>
+The <code>Makefile</code> can be used to compile new versions of your work; it contains the following targets: <p>
+<table><tr><td><pre>all</pre></td><td>(the default) generate the style or class file,</td></tr><tr><td></td><td>the pdf-documentation, and a README.md file.</td></tr><tr><td><pre>distclean</pre></td><td>remove all files that can be regenerated,</td></tr><tr><td><pre>clean</pre></td><td>same, except the style or class file, the</td></tr><tr><td></td><td>pdf-documentation, and a README.md file.</td></tr><tr><td><pre>inst</pre></td><td>install in the user's TeX tree,</td></tr><tr><td><pre>install</pre></td><td>install in the local TeX tree (uses sudo)</td></tr><tr><td><pre>zip</pre></td><td>produce a zip file ready for upload to CTAN</td></tr></table><p>
+<h1>Author</h1>
+<a href="mailto:wybodekker at me.com">Wybo Dekker</a> <p>
+<h1>Copyright</h1>
+Released under the <a href="http://www.gnu.org/copyleft/gpl.html">GNU General Public License</a> <h1>Functions used:</h1><hr/><h1 class="sub">excheck</h1>
+<table><tr><td><pre>synopsis:</pre></td><td><pre>excheck executable1 [executable2...]</pre>
+</td></tr><tr><td><pre>description:</pre></td><td>check if all needed execs are there and getopt is GNU</td></tr><tr><td></td><td><pre>apt-file find -x /pdfcrop$</pre>
+</td></tr></table><hr/><h1 class="sub">handle_options</h1>
+<table><tr><td><pre>synopsis:</pre></td><td><pre>handle_options "$@"</pre>
+</td></tr><tr><td><pre>description:</pre></td><td>handle the options.</td></tr><tr><td><pre>globals used:</pre></td><td><pre>Myname Version</pre>
+</td></tr><tr><td><pre>globals  set:</pre></td><td><pre>args short date mail name loadclass format</pre>
+</td></tr><tr><td><pre>returns:</pre></td><td>the number of remaining arguments</td></tr></table><p>
+</div></div></body></html>


Property changes on: trunk/Master/texmf-dist/doc/support/dtxgen/dtxgen.html
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/support/dtxgen/dtxgen.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/scripts/dtxgen/dtxgen
===================================================================
--- trunk/Master/texmf-dist/scripts/dtxgen/dtxgen	2025-08-01 21:21:45 UTC (rev 75945)
+++ trunk/Master/texmf-dist/scripts/dtxgen/dtxgen	2025-08-01 21:22:22 UTC (rev 75946)
@@ -1,6 +1,5 @@
 #!/bin/bash
-
-Version=1.08
+Version=1.09
 Myname="${0##*/}"
 
 :<<'DOC'
@@ -10,20 +9,31 @@
 dtxgen [options] basename.[sty,cls]	
 
 == Options
+
 -h,--help	print short help and exit
 -H,--Help	print full documentation via less and exit
--V,--version	print version and exit
--s,--short	short, one-liner, package description
--d,--date	initial version's date. Default: current date 
--m,--mail	your email address. Default: |$EMAIL|
--n,--name	your name. Default: |$NAME|
--c,--class	(class packs only) class to be preloaded. Default: article
--q,--quiet	run quietly
+-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](www.texdev.net/2009/10/06/a-model-dtx-file/). It is useful for
-those who plan to create a new Documented LaTeX Source (.dtx) file.
+dtxgen creates a template for a self-extracting .dtx file, based on the
+model described by [Joseph Wright](www.texdev.net/2009/10/06/a-model-dtx-file/).
+It is useful for those who plan to create a new Documented LaTeX Source
+(.dtx) file.
 
 Usage example:
 
@@ -47,153 +57,207 @@
   dtxgen myclass.cls
 
 and you would end up with five files: |myclass.dtx|, |myclass.cls|,
-|myclass.pdf|, |README|, and |Makefile|.
+|myclass.pdf|, |README.md|, and |Makefile|.
 
 = Options
 dtxgen recognizes the following options:
 
--s,--short=...	
+-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=...	
+-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=...	
+-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=...	
+-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|.
--d,--date=...	
+-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|.
--q,--quiet	
-	Run quietly
--V,--version	
-	Prints the script's version and exits.
--h,--help	
-	Prints help information and exits.
--H,--Help	
-	print full documentation via less and exit
 
+-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:
+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 file.
+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 file.
+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](wybo at dekkerdocumenten.nl)
+[Wybo Dekker](wybodekker at me.com)
 
 = Copyright
 Released under the [GNU General Public License](www.gnu.org/copyleft/gpl.html)
 DOC
 
-# check executables and versions of bash and getopt
-((BASH_VERSINFO>=4)) || die "Need bash version >= 4"
-for i in getopt make; do
-   command -v "$i" &> /dev/null || die "$i: command not found"
-done
-i=$(getopt -T)
-{ (($?==4)) && [[ -z $i ]]; } || die "Your getopt is not GNU"
+REd='\e[38;5;1m' Mag='\e[38;5;5m' Nor='\e[0m'
+    die() { local i; for i; do echo -e "$Myname: $REd$i$Nor"; done 1>&2; exit 1; }
+   Warn() { local i; for i; do echo -e "$Myname: $Mag$i$Nor"; done 1>&2; }
+helpsrt() { sed -n '/^= Synopsis/,/^= /p' "$0"|sed '1d;$d'; exit; }
+helpall() { sed -n "/^:<<'DOC'$/,/^DOC/p" "$0"|sed '1d;$d'|
+            less -P"$Myname-${Version/./·} (press h for help, q to quit)";exit; }
 
-# using the label in arg 2, read template from my self, filter it
-# through the script in arg 1, and write the output to the file in arg 3.
-# The default for arg 3 is arg 2
-function createfile {
-   file=$3
-   test "$file" = "" && file=$2
-   sed -n "/^:<<'$2'/,/^$2/p" "$0" |tail -n +2 |head -n -1 |sed "$1" >"$file"
+:<<'DOC' #---------------------------------------------------------------------
+= excheck
+synopsis:	 excheck executable1 [executable2...]
+description:	check if all needed execs are there and getopt is GNU
+		execs and their source are to be set in hash |needs|
+		Find the source of, say, |pdfcrop|, with:
+		 apt-file find -x /pdfcrop$
+DOC
+#-------------------------------------------------------------------------------
+excheck() {
+   local ok=true i
+   ((BASH_VERSINFO>=4)) || die "Need bash version >= 4"
+   for i in "${!needs[@]}"; do 
+      command -v "$i" > /dev/null && continue
+      Warn "Missing executable: $i (available in ${needs[$i]})"
+      ok=false
+   done
+   $ok || die
+   getopt -T 
+   (( $? == 4 )) || die "Your getopt is not GNU"
 }
 
-REd='\e[38;5;9m'
-    die() { local i; for i; do echo -e "$Myname: $REd$i"; done 1>&2; exit 1; }
-helpsrt() { sed -n '/^= Synopsis/,/^= /p' "$0"|sed '1d;$d'; exit; }
-instscr() { instscript --zip --pdf "$Myname"; exit; }
+:<<'DOC' #----------------------------------------------------------------------
+= 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
+DOC
+#-------------------------------------------------------------------------------
+handle_options() {
+   local options
+   if ! options=$(getopt \
+      -n "$Myname" \
+      -o s:n:m:b:c:d:v:hHVf:iI \
+      -l short:,name:,mail:,body:,class:,date:,version:,help,Help,version,format,history: -- "$@"
+   ); then exit 1; fi
+   history=false
+   eval set -- "$options"
+   
+   while [ $# -gt 0 ]; do
+      case $1 in
+      (-h|--help)    # print short help and exit
+                     helpsrt
+                     ;;
+      (-H|--Help)    # print full documentation via less and exit
+                     helpall
+                     ;;      
+      (-V)           # print version and exit
+                     echo $Version
+                     exit
+                     ;;
+      (-s|--short)   # set short, one-liner, package description to X
+                     short=$2
+                     shift 2
+                     ;;
+      (-v|--version) # set initial version to X.
+		     # Default: 1.00
+                     version=$2
+                     shift 2
+                     ;;
+      (-d|--date)    # set initial version’s date to X.
+		     # Default: current date 
+                     date=$2
+                     shift 2
+                     ;;
+      (-m|--mail)    # set your email address to X.
+		     # Default: |$EMAIL|
+                     mail=$2
+                     shift 2
+                     ;;
+      (-n|--name)    # set your name to X.
+		     # Default: |$NAME|
+                     name=$2
+                     shift 2
+                     ;;
+      (-c|--class)   # (class packs only) set class to be preloaded to X.
+		     # Default: article
+                     loadclass=$2
+                     shift 2
+                     ;;
+      (-f|--format)  # set latex format to be used for compilation to X.
+		     # Default: pdflatex
+                     format=$2
+                     shift 2
+                     ;;
+      (-b|--body)    # existing style or class X to be used instead of demo
+                     body="$2"
+                     [[ -z $body ]] && die "kpsewhich could not find $body"
+                     shift 2
+                     ;;
+      (-i|--history) # replace standard Change History section with simpler one.
+                     history=true
+                     shift
+                     ;;
+      (-I)           instscript "$Myname" ||
+                        die 'the -I option is for developers only'
+                     exit
+                     ;;
+      (--)           shift
+                     break
+                     ;;
+      (*)            break
+                     ;;
+      esac
+   done
+   args=( "$@" )
+}
 
-# shellcheck disable=SC2154
-helpall() { sed -n "/^:<<'DOC'$/,/^DOC/p" "$0"|sed -n '1d;$d;p'|
-            less -Ps"$Myname-${Version/./·} documentation - type h for help, q to quit."
-		exit
-	  }
+declare -A needs=(
+[make]='make'
+[getopt]='util-linux'
+[envsubst]='gettext-base'
+[pdflatex]='texlive-latex-base'
+[makeindex]='texlive-binaries'
+[zip]='zip'
+[ltxfileinfo]='texlive-extra-utils'
+[kpsewhich]='texlive-binaries'
+[texi2dvi]='https://ctan.mirrors.hoobly.com/macros/texinfo/latest/texi2dvi'
+)
+excheck "${needs[@]}"
 
-if ! options=$(getopt \
-   -n "$Myname" \
-   -o s:n:m:c:d:hHVqI \
-   -l short:,name:,mail:,class:,date:,help,Help,version,quiet -- "$@"
-); then exit 1; fi
-eval set -- "$options"
+handle_options "$@"
+set -- "${args[@]}"
 
-while [ $# -gt 0 ]; do
-   case $1 in
-   (-h|--help)    # print short help and exit
-                  helpsrt
-                  ;;
-   (-H|--Help)    # print full documentation via less and exit
-                  helpall
-                  ;;      
-   (-V|--version) # print version and exit
-                  echo $Version
-		  exit
-                  ;;
-   (-s|--short)   # short, one-liner, package description
-                  short=$2
-                  shift 2
-                  ;;
-   (-d|--date)    # initial version's date. Default: current date 
-                  date=$2
-                  shift 2
-                  ;;
-   (-m|--mail)    # your email address. Default: $EMAIL
-                  mail=$2
-                  shift 2
-                  ;;
-   (-n|--name)    # your name. Default: $NAME
-                  name=$2
-                  shift 2
-                  ;;
-   (-c|--class)   # (class packs only) class to be preloaded. Default: article
-                  loadclass=$2
-                  shift 2
-                  ;;
-   (-q|--quiet)   # run quietly
-                  quiet=--quiet
-                  shift
-                  ;;
-   (-I)           instscr
-                  ;;
-   (--)           shift
-                  break
-                  ;;
-   (*)            break
-                  ;;
-   esac
-done
+test $# == 1 || die "I need 1 argument"
 
-export year typ Typ lcl use # used in templates - shellcheck se them as unused
-
-name=${name:-${NAME:-(not set)}}
-mail=${mail:-${EMAIL:-(not set)}}
-date=${date:-$(date +%Y%m%d)}
-year=${date:0:4}
-loadclass=${loadclass:-article}
-
-# date must be 8 digits; insert the two /'s:
-if [[ ! $date =~ ^[[:digit:]]{8}$ ]]; then die "illegal date"; fi
-date=$(sed 's/\(....\)\(..\)\(..\)/\1\\\/\2\\\/\3/' <<<"$date")
-
 # argument must have .cls or .sty extension:
 base=${1%.*}
 ext=${1#*.}
@@ -200,17 +264,45 @@
 
 case "$ext" in
 (cls) typ=class; Typ=Class;
-      short=${short:-A new LaTeX class}
-      lcl='\\LoadClass[a4paper,fleqn]{'"$loadclass}"
-     ;;
+      lcl="\\LoadClass[a4paper,fleqn]{${loadclass:-article}}"
+      ;;
 (sty) typ=package; Typ=Package;
-      short=${short:-A new LaTeX package}
-      use='\\usepackage{\\jobname}'
-     ;;
+      use='\usepackage{\jobname}'
+      ;;
 (*)   die "The argument must have .cls or .sty extension
          (try the --help option)"
 esac
 
+: "${name:=${NAME:-(not set)}}"		# default name is envvar NAME
+: "${mail:=${EMAIL:-(not set)}}"	# default email is envvar MAIL
+: "${date:=$(date +%Y%m%d)}"		# default date is now
+: "${version:=1.00}"			# default version is 1.00
+: "${format:=pdflatex}"			# default formatter is pdflatex
+: "${short:=A new LaTeX $typ}"		# default short description
+
+# date must be 8 digits; insert the two -'s:
+if [[ ! $date =~ ^[[:digit:]]{8}$ ]]; then die "illegal date: $date"; fi
+date="${date:0:4}-${date:4:2}-${date:6:2}"
+Date="${date//-/\/}" # format for \Provides commands
+
+if $history; then
+   read -rd '' history <<-EOD
+	% \section{History}
+	% \begin{longtable}{@{}p{8mm}p{127mm}@{}}
+	% v1.00 & $date\\\\
+	%       & - first release.\\\\
+	% \end{longtable}
+	EOD
+else
+   history='% \PrintChanges'
+   ch1="% \\changes{v1.00}{$date}{First public release}"
+   read -rd '' ch2 <<-EOD
+	% \\changes{v1.00a}{$date}{Added a spurious change log entry to
+	%   show what a change \emph{within} an environment definition looks
+	%   like.}"
+	EOD
+fi
+
 # The short description may contain TeX commands, but then we need
 # a version without them at some places; note that this removes only
 # simple contructs:
@@ -222,88 +314,212 @@
 test -z "$mail" && die "author's email not set - use option or environment variable EMAIL"
 test -z "$name" && die "author's name not set - use option or environment variable NAME"
 
-colw=${#base}
-(( colw = colw < 7 ? 7 : colw ))
-kopl="$(eval "printf '%.0s-' {1..$colw}")"
-kopr="$(eval "printf '%.0s-' {1..$((72-colw))}")"
-declare -A rm=(
-    [$kopl]=$kopr
-    [$base]=$shrt
-   [Author]=$name
-   [E-mail]=$mail
-  [License]='Released under the LaTeX Project Public License v1.3c or later'
-      [See]='http://www.latex-project.org/lppl.txt'
-)
+export abst body desc base format etc ext year mail use typ Typ name date
+export short shrt lcl make readme version history ch1 ch2 Date
 
-for i in $kopl $base Author E-mail License See; do
-  readme+="$(printf "%*s:| %s\\\\n"  $colw "$i" "${rm[$i]}")"
-done
+if [[ -z $body ]]; then
+   # if no existing style/class file was given, use the demo one:
+   body="$(sed -n "/^:<<'BODY'/,/^BODY/{/BODY/!p}" "$0" |envsubst)"
+   desc="$(sed -n "/^:<<'DESC'/,/^DESC/{/DESC/!p}" "$0")"
+   abst="% This is a demo $Typ file"
+else
+   body=${body%.$ext}.$ext
+   body="$(kpsewhich "$body")"
+   [[ -z $body ]] && die "kpsewhich could not find $body"
+   # remove any \Provides..., \NeedsTeXFormat, \endinput and %%-comments
+   body="$(sed '
+	/^\\Provides/{N;N;s/\\Provides.*{.*}%*\s\+\[.*\]//;}
+	/^%%/d
+	/^\\NeedsTeXFormat/d
+	/^\\endinput/d
+   ' "$body")"
+   abst="% Put your abstract here"
+   desc="% Put your descriptive text here"
+fi
+readme="$(sed -n "/^:<<'README'/,/^README/{/README/!p}" "$0" |envsubst)"
 
-# make sed script replacing the variables in the templates:
-sedscript=''
-for i in base year ext mail use typ Typ name date short shrt lcl readme; do
-  test $quiet || eval "echo -e \"$i	\$$i\""|sed 's/\\\\/\\/g'
-  eval "sedscript+=\"s=%$i%=\$$i=g;\""
-done
+# Here we zip only the Makefile, but in real projects more files may be involved.
+sed -n "/^:<<'MAKEF'/,/^MAKEF/{/MAKEF/!p}" "$0" |envsubst > Makefile
+etc="$(tar czf - Makefile | uuencode -m etc.taz)"
+rm Makefile
 
-createfile "$sedscript" Makefile
-createfile "$sedscript" DTX "$base.dtx"
-make $quiet
+sed -n "/^:<<'DTX'/,/^DTX/{/DTX/!p}" "$0" |envsubst >"$base".dtx
+
+{ tex -interaction=batchmode "$base.dtx"
+  sh make.sh
+  make
+  make clean
+} >/dev/null
+cat <<-EOD
+	
+	You have 5 new files now:
+	1. $base.dtx: this is the only file you need to keep and edit.
+	   The other files can be generated from it with:
+	   tex $base.dtx && sh make.sh
+	2. The README.md file.
+	3. $base.$ext: the $Typ file.
+	4. $base.pdf: the documentation.
+	5. A Makefile:
+EOD
+make help
 exit 0
+# ---- TEMPLATES: ----
+:<<'DESC'
+% \DescribeMacro{\dummyMacro}
+% This macro does nothing.\index{doing nothing|usage} It is merely an
+% example.  If this were a real macro, you would put a paragraph here
+% describing what the macro is supposed to do, what its mandatory and
+% optional arguments are, and so forth.
+%
+% \DescribeEnv{dummyEnv}
+% This environment does nothing.  It is merely an example.
+% If this were a real environment, you would put a paragraph here
+% describing what the environment is supposed to do, what its
+% mandatory and optional arguments are, and so forth.
+DESC
 
-# ---- TEMPLATES: ----
-:<<'Makefile'
-NAME  = %base%
+:<<'BODY'
+%    \end{macrocode}
+% \begin{macro}{\dummyMacro}
+% This is a dummy macro.  If it did anything, we'd describe its
+% implementation here.
+%    \begin{macrocode}
+\newcommand{\dummyMacro}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{environment}{dummyEnv}
+% This is a dummy environment.  If it did anything, we'd describe its
+% implementation here.
+%    \begin{macrocode}
+\newenvironment{dummyEnv}{%
+}{%
+%    \end{macrocode}
+$ch2
+% Don't use |%| to introduce a code comment within a |macrocode|
+% environment.  Instead, you should typeset all of your comments with
+% LaTeX---doing so gives much prettier results.  For comments within a
+% macro/environment body, just do an |\end{macrocode}|, include some
+% commentary, and do another |\begin{macrocode}|.  It's that simple.
+%    \begin{macrocode}
+}
+%    \end{macrocode}
+% \end{environment}
+%    \begin{macrocode}
+BODY
+
+:<<'MAKEF'
 SHELL = bash
+BASE  = $base
+FMT   = $format
+UID   = $(shell id -u)
 PWD   = $(shell pwd)
-VERS  = $(shell ltxfileinfo -v $(NAME).dtx|sed -e 's/^v//')
+VERS  = $(shell ltxfileinfo -v $(BASE).dtx|sed -e 's/^v//')
 LOCAL = $(shell kpsewhich --var-value TEXMFLOCAL)
 UTREE = $(shell kpsewhich --var-value TEXMFHOME)
-all:	$(NAME).pdf
-	test -e README.txt && mv README.txt README || exit 0
-$(NAME).pdf: $(NAME).dtx
-	pdflatex -shell-escape -recorder -interaction=batchmode $(NAME).dtx >/dev/null
-	if [ -f $(NAME).glo ]; then makeindex -q -s gglo.ist -o $(NAME).gls $(NAME).glo; fi
-	if [ -f $(NAME).idx ]; then makeindex -q -s gind.ist -o $(NAME).ind $(NAME).idx; fi
-	pdflatex --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null
-	pdflatex --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null
-clean:
-	rm -f $(NAME).{aux,fls,glo,gls,hd,idx,ilg,ind,ins,log,out}
-distclean: clean
-	rm -f $(NAME).{pdf,%ext%} README
-inst: all
-	mkdir -p $(UTREE)/{tex,source,doc}/latex/$(NAME)
-	cp $(NAME).dtx $(UTREE)/source/latex/$(NAME)
-	cp $(NAME).%ext% $(UTREE)/tex/latex/$(NAME)
-	cp $(NAME).pdf $(UTREE)/doc/latex/$(NAME)
-install: all
-	sudo mkdir -p $(LOCAL)/{tex,source,doc}/latex/$(NAME)
-	sudo cp $(NAME).dtx $(LOCAL)/source/latex/$(NAME)
-	sudo cp $(NAME).%ext% $(LOCAL)/tex/latex/$(NAME)
-	sudo cp $(NAME).pdf $(LOCAL)/doc/latex/$(NAME)
-zip: all
-	ln -sf . $(NAME)
-	zip -Drq $(PWD)/$(NAME)-$(VERS).zip $(NAME)/{README,$(NAME).{pdf,dtx}}
-	rm $(NAME)
-Makefile
+all:	check
+	@$(FMT) '$(BASE).dtx'
+	@test -e $(BASE).glo && makeindex -qs gglo.ist -o $(BASE).gls $(BASE).glo
+	@makeindex -qs gind.ist $(BASE).idx
+	@$(FMT) '$(BASE).dtx'
+clean:	# clean, but keep installable files only #
+	rm -f $(BASE).{aux,fls,glo,gls,hd,idx,ilg,ind,ins,log,out,toc,synctex.gz}
+	rm -f etc.* make.sh
+Clean:	clean # clean to keep dtx file and CTAN zip only #
+	rm -f $(BASE).{pdf,$ext} README.md Makefile
+inst:	check # install in your own tree #
+	@mkdir -p $(UTREE)/{tex,source,doc}/latex/$(BASE)
+	cp $(BASE).dtx $(UTREE)/source/latex/$(BASE)
+	cp $(BASE).$ext $(UTREE)/tex/latex/$(BASE)
+	cp $(BASE).pdf README.md $(UTREE)/doc/latex/$(BASE)
+install: check # install in local tree (needs sudo rights) #
+	@sudo mkdir -p $(LOCAL)/{tex,source,doc}/latex/$(BASE)
+	sudo cp $(BASE).dtx $(LOCAL)/source/latex/$(BASE)
+	sudo cp $(BASE).$ext $(LOCAL)/tex/latex/$(BASE)
+	sudo cp $(BASE).pdf README.md $(LOCAL)/doc/latex/$(BASE)
+zip:	check # create zip for CTAN #
+	@ln -sf . $(BASE)
+	@zip -Drq $(PWD)/$(BASE)-$(VERS).zip $(BASE)/{README.md,$(BASE).{pdf,dtx,$ext}}
+	@rm $(BASE)
+	@echo $(BASE)-$(VERS).zip created
+check:
+	@test "$(UID)" != "0" -a  -n "$(VERS)" -a -n "$(LOCAL)" || exit 1
+help:	# show this help #
+	@echo
+	@echo make targets:
+	@sed -n '/^[a-zA-Z.]*:/N;s/:[^#]*# \([^#]*\) #.*/:\t\1/p' Makefile |expand -12
+	@echo
+	@echo "Version:    $(VERS)"
+	@echo "User tree:  $(UTREE)"
+	@echo "Local tree: $(LOCAL)"
+	@echo "Use the Makefile for the above targets only"
+	@echo "Note:       Never use sudo!"
+MAKEF
 
+:<<'README'
+# $base
+     key | description
+     ---:|:---
+   $base | $shrt
+ version | $version
+    date | $date 
+  author | $name
+   email | $mail
+ license | Released under the LaTeX Project Public License v1.3c or later
+
+## Short description:
+Some text about the $typ: probably the same as the abstract.
+
+## Installation:
+This is a self-extracting file. Install as follows:
+1. Run "tex $base.dtx"
+2. Run "sh make.sh"
+3. Run "make install" to install in the local tree (needs sudo rights), or
+   Run "make inst" to install in your own tree.
+4. Run "make clean" to remove most intermediate files, or
+   Run "make Clean" to keep the dtx file and CTAN zip only.
+5. Run "make zip" to create a zip file for CTAN
+6. Try "make help"
+README
+
 :<<'DTX'
 % \iffalse meta-comment
-% vim: textwidth=75
+%
+% Copyright (C) 2021 by Wybo Dekker <wybodekker at me.com>
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License (LPPL), either
+% version 1.3c of this license or (at your option) any later
+% version.  The latest version of this license is in the file:
+%
+% http://www.latex-project.org/lppl.txt
+%
+% This work consists of the self-extracting file $base.dtx,
+% generated by dtxgen (https://github.com/wybodekker/dtxgen)
+% Installation: see the readme section below.
+%
 %<*internal>
 \iffalse
 %</internal>
 %<*readme>
-|
-%readme%
-
-Short description:
-Some text about the %typ%: probably the same as the abstract.
+$readme
 %</readme>
+%<*make>
+uudecode etc.uue
+tar xf etc.taz
+make
+make help
+%</make>
+%<*etc>
+$etc
+%</etc>
 %<*internal>
 \fi
 \def\nameofplainTeX{plain}
-\ifx\fmtname\nameofplainTeX\else
+\ifx\fmtname\nameofplainTeX
+  \def\Extract#1#2#3{\generate{\file{#1.#2}{\from{\jobname.dtx}{#3}}}}
+\else
+  \def\Extract#1#2#3{}
   \expandafter\begingroup
 \fi
 %</internal>
@@ -311,46 +527,15 @@
 \input docstrip.tex
 \keepsilent
 \askforoverwritefalse
-\preamble
-%readme%
-\endpreamble
-\postamble
-
-Copyright (C) %year% by %name% <%mail%>
-
-This work may be distributed and/or modified under the
-conditions of the LaTeX Project Public License (LPPL), either
-version 1.3c of this license or (at your option) any later
-version.  The latest version of this license is in the file:
-
-http://www.latex-project.org/lppl.txt
-
-This work is "maintained" (as per LPPL maintenance status) by
-%name%.
-
-This work consists of the file %base%.dtx and a Makefile.
-Running "make" generates the derived files README, %base%.pdf and %base%.%ext%.
-Running "make inst" installs the files in the user's TeX tree.
-Running "make install" installs the files in the local TeX tree.
-
-\endpostamble
-
-\usedir{tex/latex/%base%}
-\generate{
-  \file{\jobname.%ext%}{\from{\jobname.dtx}{%typ%}}
-}
+\Extract{\jobname}{$ext}{$typ}
 %</install>
 %<install>\endbatchfile
 %<*internal>
-\usedir{source/latex/%base%}
-\generate{
-  \file{\jobname.ins}{\from{\jobname.dtx}{install}}
-}
 \nopreamble\nopostamble
-\usedir{doc/latex/%base%}
-\generate{
-  \file{README.txt}{\from{\jobname.dtx}{readme}}
-}
+\catcode9=12
+\Extract{README}{md}{readme}
+\Extract{etc}{uue}{etc}
+\Extract{make}{sh}{make}
 \ifx\fmtname\nameofplainTeX
   \expandafter\endbatchfile
 \else
@@ -361,18 +546,19 @@
 %
 % \iffalse
 %<*driver>
-\ProvidesFile{%base%.dtx}
+\ProvidesFile{$base.dtx}
 %</driver>
-%<%typ%>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-%<%typ%>\Provides%Typ%{%base%}
-%<*%typ%>
-    [%date% v1.00 %shrt%]
-%</%typ%>
+%<$typ>\NeedsTeXFormat{LaTeX2e}[2021/11/15]
+%<$typ>\Provides$Typ{$base}
+%<*$typ>
+    [$Date v$version $shrt]
+%</$typ>
 %<*driver>
 \documentclass{ltxdoc}
-\usepackage[a4paper,margin=25mm,left=50mm,nohead]{geometry}
+\usepackage[a4paper,margin=20mm,left=50mm,nohead]{geometry}
 \usepackage[numbered]{hypdoc}
-%use%
+\usepackage{longtable}
+$use
 \EnableCrossrefs
 \CodelineIndex
 \RecordChanges
@@ -385,78 +571,32 @@
 % \GetFileInfo{\jobname.dtx}
 % \DoNotIndex{\newcommand,\newenvironment}
 %
-%\title{\textsf{%base%} --- %short%\thanks{This file
-%   describes version \fileversion, last revised \filedate.}
-%}
-%\author{%name%\thanks{E-mail: %mail%}}
-%\date{Released \filedate}
-%
-%\maketitle
-%
-%\changes{v1.00}{%date%}{First public release}
-%
-% \begin{abstract}
-% ==== Put abstract text here. ====
+% \title{\textsf{$base} --- $short}
+% \date{\large\fileversion\quad\filedate}
+% \author{$name\thanks{Email: $mail}}
+% \maketitle
+$ch1
+% \begin{abstract}\noindent
+$abst
 % \end{abstract}
+% \tableofcontents
 %
 % \section{Usage}
-%
-% ==== Put descriptive text here. ====
-%
-% \DescribeMacro{\dummyMacro}
-% This macro does nothing.\index{doing nothing|usage} It is merely an
-% example.  If this were a real macro, you would put a paragraph here
-% describing what the macro is supposed to do, what its mandatory and
-% optional arguments are, and so forth.
-%
-% \DescribeEnv{dummyEnv}
-% This environment does nothing.  It is merely an example.
-% If this were a real environment, you would put a paragraph here
-% describing what the environment is supposed to do, what its
-% mandatory and optional arguments are, and so forth.
-%
-%\StopEventually{^^A
-%  \PrintChanges
-%  \PrintIndex
-%}
-%
+$desc
+% \StopEventually{^^A
+$history
+% \PrintIndex
+% }
 % \section{Implementation}
 %
 %    \begin{macrocode}
-%<*%typ%>
-%lcl%
-%    \end{macrocode}
-% \begin{macro}{\dummyMacro}
-% This is a dummy macro.  If it did anything, we'd describe its
-% implementation here.
-%    \begin{macrocode}
-\newcommand{\dummyMacro}{}
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{environment}{dummyEnv}
-% This is a dummy environment.  If it did anything, we'd describe its
-% implementation here.
-%    \begin{macrocode}
-\newenvironment{dummyEnv}{%
-}{%
-%    \end{macrocode}
-% \changes{v1.00a}{%date%}{Added a spurious change log entry to
-%   show what a change \emph{within} an environment definition looks
-%   like.}
-% Don't use |%| to introduce a code comment within a |macrocode|
-% environment.  Instead, you should typeset all of your comments with
-% LaTeX---doing so gives much prettier results.  For comments within a
-% macro/environment body, just do an |\end{macrocode}|, include some
-% commentary, and do another |\begin{macrocode}|.  It's that simple.
-%    \begin{macrocode}
-}
-%    \end{macrocode}
-% \end{environment}
-%
-%    \begin{macrocode}
+%<*$typ>
+$lcl
+% ===== Start of your own code =====
+$body
+% ===== End of your own code =====
 \endinput
-%</%typ%>
+%</$typ>
 %    \end{macrocode}
 %\Finale
 DTX

Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds	2025-08-01 21:21:45 UTC (rev 75945)
+++ trunk/Master/tlpkg/libexec/ctan2tds	2025-08-01 21:22:22 UTC (rev 75946)
@@ -4087,6 +4087,7 @@
  'ctanify'              => '\.1$',
  'dosepsbin'            => 'dosepsbin.man',
  'dviasm'		=> '\.1$',
+ 'dtxgen'		=> '\.1$',
  'easydtx'		=> '\.1$',
  'eolang'		=> '\.1$',
  'epstopdf'             => 'r?epstopdf.1|epstopdf.man1.pdf', # don't keep pdf



More information about the tex-live-commits mailing list.