texlive[67218] Master/texmf-dist: latex-dev (25may23)

commits+karl at tug.org commits+karl at tug.org
Thu May 25 22:39:13 CEST 2023


Revision: 67218
          http://tug.org/svn/texlive?view=revision&revision=67218
Author:   karl
Date:     2023-05-25 22:39:11 +0200 (Thu, 25 May 2023)
Log Message:
-----------
latex-dev (25may23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex-dev/amsmath/README.md
    trunk/Master/texmf-dist/doc/latex-dev/amsmath/amsbsy.pdf
    trunk/Master/texmf-dist/doc/latex-dev/amsmath/amscd.pdf
    trunk/Master/texmf-dist/doc/latex-dev/amsmath/amsgen.pdf
    trunk/Master/texmf-dist/doc/latex-dev/amsmath/amsldoc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/amsmath/amsldoc.tex
    trunk/Master/texmf-dist/doc/latex-dev/amsmath/amsmath.pdf
    trunk/Master/texmf-dist/doc/latex-dev/amsmath/amsopn.pdf
    trunk/Master/texmf-dist/doc/latex-dev/amsmath/amstext.pdf
    trunk/Master/texmf-dist/doc/latex-dev/amsmath/amsxtra.pdf
    trunk/Master/texmf-dist/doc/latex-dev/amsmath/changes.txt
    trunk/Master/texmf-dist/doc/latex-dev/amsmath/subeqn.pdf
    trunk/Master/texmf-dist/doc/latex-dev/amsmath/technote.pdf
    trunk/Master/texmf-dist/doc/latex-dev/amsmath/testmath.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/README.md
    trunk/Master/texmf-dist/doc/latex-dev/base/alltt.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/cfgguide.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/changes.txt
    trunk/Master/texmf-dist/doc/latex-dev/base/classes.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/clsguide.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/clsguide.tex
    trunk/Master/texmf-dist/doc/latex-dev/base/cmfonts.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/cyrguide.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/doc-code.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/doc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/docstrip.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/encguide.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/exscale.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/fix-cm.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/fntguide.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/fntguide.tex
    trunk/Master/texmf-dist/doc/latex-dev/base/graphpap.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ifthen.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/inputenc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/lamport-manual.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/latexrelease.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/latexsym.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/lb2.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/letter.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/lgc2.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/lppl.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltcmdhooks-code.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltcmdhooks-doc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltfilehook-code.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltfilehook-doc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/lthooks-code.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/lthooks-doc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltluatex.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltmarks-code.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltmarks-doc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews01.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews02.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews03.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews04.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews05.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews06.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews07.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews08.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews09.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews10.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews11.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews12.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews13.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews14.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews15.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews16.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews17.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews18.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews19.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews20.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews20.tex
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews21.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews21.tex
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews22.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews23.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews24.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews25.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews26.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews27.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews28.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews29.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews30.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews30.tex
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews31.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews31.tex
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews32.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews32.tex
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews33.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews33.tex
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews34.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews34.tex
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews35.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews35.tex
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews36.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews36.tex
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews37.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews37.tex
    trunk/Master/texmf-dist/doc/latex-dev/base/ltpara-code.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltpara-doc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltshipout-code.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltshipout-doc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltx3info.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltxdoc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/makeindx.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/manifest.txt
    trunk/Master/texmf-dist/doc/latex-dev/base/modguide.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/nfssfont.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/proc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/slides.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/slifonts.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/source2e.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/syntonly.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/tlc2.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/tulm.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/usrguide-historic.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/usrguide.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/usrguide.tex
    trunk/Master/texmf-dist/doc/latex-dev/base/utf8ienc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/webcomp.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/README.md
    trunk/Master/texmf-dist/doc/latex-dev/tools/afterpage.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/array.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/bm.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/calc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/changes.txt
    trunk/Master/texmf-dist/doc/latex-dev/tools/dcolumn.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/delarray.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/enumerate.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/fileerr.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/fontsmpl.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/ftnright.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/hhline.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/indentfirst.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/layout.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/longtable.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/multicol.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/rawfonts.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/shellesc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/showkeys.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/somedefs.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/tabularx.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/theorem.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/tools-overview.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/tools-overview.tex
    trunk/Master/texmf-dist/doc/latex-dev/tools/trace.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/varioref.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/verbatim.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/xr.pdf
    trunk/Master/texmf-dist/doc/latex-dev/tools/xspace.pdf
    trunk/Master/texmf-dist/source/latex-dev/amsmath/amsbsy.ins
    trunk/Master/texmf-dist/source/latex-dev/amsmath/amscd.dtx
    trunk/Master/texmf-dist/source/latex-dev/amsmath/amscd.ins
    trunk/Master/texmf-dist/source/latex-dev/amsmath/amsgen.dtx
    trunk/Master/texmf-dist/source/latex-dev/amsmath/amsgen.ins
    trunk/Master/texmf-dist/source/latex-dev/amsmath/amsmath.dtx
    trunk/Master/texmf-dist/source/latex-dev/amsmath/amsmath.ins
    trunk/Master/texmf-dist/source/latex-dev/amsmath/amsopn.dtx
    trunk/Master/texmf-dist/source/latex-dev/amsmath/amsopn.ins
    trunk/Master/texmf-dist/source/latex-dev/amsmath/amstext.dtx
    trunk/Master/texmf-dist/source/latex-dev/amsmath/amstext.ins
    trunk/Master/texmf-dist/source/latex-dev/amsmath/amsxtra.dtx
    trunk/Master/texmf-dist/source/latex-dev/amsmath/amsxtra.ins
    trunk/Master/texmf-dist/source/latex-dev/base/classes.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/cmfonts.fdd
    trunk/Master/texmf-dist/source/latex-dev/base/doc.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltclass.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltcmd.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltcmdhooks.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltfilehook.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltfinal.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltfssbas.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/lthooks.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltlists.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltmarks.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltmath.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltmeta.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltpara.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltplain.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltshipout.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltspace.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltvers.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltxdoc.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltxref.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/slifonts.fdd
    trunk/Master/texmf-dist/source/latex-dev/base/tulm.fdd
    trunk/Master/texmf-dist/source/latex-dev/tools/afterpage.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/afterpage.ins
    trunk/Master/texmf-dist/source/latex-dev/tools/array.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/bm.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/bm.ins
    trunk/Master/texmf-dist/source/latex-dev/tools/calc.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/dcolumn.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/delarray.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/enumerate.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/fileerr.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/fontsmpl.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/ftnright.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/hhline.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/indentfirst.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/layout.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/longtable.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/longtable.ins
    trunk/Master/texmf-dist/source/latex-dev/tools/multicol.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/multicol.ins
    trunk/Master/texmf-dist/source/latex-dev/tools/rawfonts.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/shellesc.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/showkeys.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/somedefs.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/tabularx.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/tabularx.ins
    trunk/Master/texmf-dist/source/latex-dev/tools/theorem.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/tools.ins
    trunk/Master/texmf-dist/source/latex-dev/tools/trace.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/varioref.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/varioref.ins
    trunk/Master/texmf-dist/source/latex-dev/tools/verbatim.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/xr.dtx
    trunk/Master/texmf-dist/source/latex-dev/tools/xspace.dtx
    trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsbsy.sty
    trunk/Master/texmf-dist/tex/latex-dev/amsmath/amscd.sty
    trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsgen.sty
    trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsmath.sty
    trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsopn.sty
    trunk/Master/texmf-dist/tex/latex-dev/amsmath/amstext.sty
    trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsxtra.sty
    trunk/Master/texmf-dist/tex/latex-dev/base/article.cls
    trunk/Master/texmf-dist/tex/latex-dev/base/atbegshi-ltx.sty
    trunk/Master/texmf-dist/tex/latex-dev/base/atveryend-ltx.sty
    trunk/Master/texmf-dist/tex/latex-dev/base/bk10.clo
    trunk/Master/texmf-dist/tex/latex-dev/base/bk11.clo
    trunk/Master/texmf-dist/tex/latex-dev/base/bk12.clo
    trunk/Master/texmf-dist/tex/latex-dev/base/book.cls
    trunk/Master/texmf-dist/tex/latex-dev/base/latex.ltx
    trunk/Master/texmf-dist/tex/latex-dev/base/latexrelease.sty
    trunk/Master/texmf-dist/tex/latex-dev/base/ltnews.cls
    trunk/Master/texmf-dist/tex/latex-dev/base/ltxdoc.cls
    trunk/Master/texmf-dist/tex/latex-dev/base/ltxguide.cls
    trunk/Master/texmf-dist/tex/latex-dev/base/minimal.cls
    trunk/Master/texmf-dist/tex/latex-dev/base/omlcmm.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/omlcmr.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/omscmr.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/omscmsy.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/omxcmex.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmdh.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmfib.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmfr.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmr.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmss.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmtt.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmvtt.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/report.cls
    trunk/Master/texmf-dist/tex/latex-dev/base/size10.clo
    trunk/Master/texmf-dist/tex/latex-dev/base/size11.clo
    trunk/Master/texmf-dist/tex/latex-dev/base/size12.clo
    trunk/Master/texmf-dist/tex/latex-dev/base/structuredlog.sty
    trunk/Master/texmf-dist/tex/latex-dev/base/t1cmdh.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/t1cmfib.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/t1cmfr.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/t1cmr.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/t1cmss.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/t1cmtt.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/t1cmvtt.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/ts1cmr.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/ts1cmss.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/ts1cmtt.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/ts1cmvtt.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/ucmr.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/ucmss.fd
    trunk/Master/texmf-dist/tex/latex-dev/base/ucmtt.fd
    trunk/Master/texmf-dist/tex/latex-dev/tools/.tex
    trunk/Master/texmf-dist/tex/latex-dev/tools/afterpage.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/array.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/bm.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/calc.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/dcolumn.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/delarray.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/e.tex
    trunk/Master/texmf-dist/tex/latex-dev/tools/enumerate.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/fontsmpl.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/fontsmpl.tex
    trunk/Master/texmf-dist/tex/latex-dev/tools/ftnright.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/h.tex
    trunk/Master/texmf-dist/tex/latex-dev/tools/hhline.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/indentfirst.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/layout.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/longtable.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/multicol.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/q.tex
    trunk/Master/texmf-dist/tex/latex-dev/tools/r.tex
    trunk/Master/texmf-dist/tex/latex-dev/tools/rawfonts.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/s.tex
    trunk/Master/texmf-dist/tex/latex-dev/tools/shellesc.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/showkeys.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/somedefs.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/tabularx.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/thb.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/thc.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/thcb.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/theorem.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/thm.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/thmb.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/thp.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/trace.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/varioref.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/verbatim.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/verbtest.tex
    trunk/Master/texmf-dist/tex/latex-dev/tools/x.tex
    trunk/Master/texmf-dist/tex/latex-dev/tools/xr.sty
    trunk/Master/texmf-dist/tex/latex-dev/tools/xspace.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex-dev/base/clsguide-historic.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/clsguide-historic.tex
    trunk/Master/texmf-dist/doc/latex-dev/base/tlc3.err
    trunk/Master/texmf-dist/doc/latex-dev/base/tlc3.pdf

Modified: trunk/Master/texmf-dist/doc/latex-dev/amsmath/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/amsmath/README.md	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/amsmath/README.md	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,7 +1,7 @@
 The amsmath bundle for LaTeX
 ============================
 
-Release 2023-05-01 pre-release 0
+Release 2023-06-01 pre-release 3
 
 Overview
 --------
@@ -77,5 +77,5 @@
 -----
 
 <p>Copyright (C) 2001-2004, 2007, 2008, 2010, 2011, 2013 American Mathematical Society. <br />
-<p>Copyright (C) 2016-2022 The LaTeX Project and American Mathematical Society. <br />
+<p>Copyright (C) 2016-2023 The LaTeX Project and American Mathematical Society. <br />
 

Modified: trunk/Master/texmf-dist/doc/latex-dev/amsmath/amsbsy.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/amsmath/amscd.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/amsmath/amsgen.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/amsmath/amsldoc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/amsmath/amsldoc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/amsmath/amsldoc.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/amsmath/amsldoc.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 %
 % Copyright (C) 1995, 2000, 2013 American Mathematical Society.
-% Copyright (C) 2016-2022 LaTeX Project and American Mathematical Society.
+% Copyright (C) 2016-2023 LaTeX Project and American Mathematical Society.
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/doc/latex-dev/amsmath/amsmath.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/amsmath/amsopn.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/amsmath/amstext.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/amsmath/amsxtra.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/amsmath/changes.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/amsmath/changes.txt	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/amsmath/changes.txt	2023-05-25 20:39:11 UTC (rev 67218)
@@ -2,6 +2,11 @@
 All changes above are only part of the development branch for the next release.
 ================================================================================
 
+
+2023-05-13  David Carlisle  <David.Carlisle at latex-project.org>
+
+	* amsmath.dtx: Adjust the definition of \@@eqno  (gh/1059)
+
 #########################
 # 2022-06-01 Release
 #########################

Modified: trunk/Master/texmf-dist/doc/latex-dev/amsmath/subeqn.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/amsmath/technote.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/amsmath/testmath.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/README.md	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/README.md	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,7 +1,7 @@
 The LaTeX kernel
 ================
 
-Release 2023-06-01 pre-release 2
+Release 2023-06-01 pre-release 3
 
 Overview
 --------

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/alltt.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/cfgguide.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/changes.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/changes.txt	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/changes.txt	2023-05-25 20:39:11 UTC (rev 67218)
@@ -6,6 +6,132 @@
 are not part of the distribution.
 ================================================================================
 
+2023-05-22  Joseph Wright  <Joseph.Wright at latex-project.org>
+
+	* usrguide.tex
+	Ensure url package is always loaded
+
+2023-05-21  Phelype Oleinik  <phelype.oleinik at latex-project.org>
+
+	* lthooks.dtx, ltcmdhooks.dtx:
+	Add support for accessing arguments in 'cmd' hooks.
+
+2023-05-19  Joseph Wright  <Joseph.Wright at latex-project.org>
+
+	* usrguide.tex (section Creating document commands and environments)
+	  Add details of result of trailing optional arguments on
+	  \inputlineno
+	
+2023-05-12  Ulrike Fischer <Ulrike.Fischer at latex-project.org>
+
+	* ltxref.dtx
+	extend \label to store five values and add a hook with argument
+
+2023-05-17  Joseph Wright  <Joseph.Wright at latex-project.org>
+
+	* usrguide.tex (section Creating document commands and environments)
+	  Add details of brace stripping by \SplitList
+	  Add guidance on creating commands to use at start of
+	  tabular cells
+
+2023-05-15  Joseph Wright  <Joseph.Wright at latex-project.org>
+
+	* ltfiles.dtx:
+	Use expl3-based file-existence test
+
+2023-05-13  David Carlisle  <David.Carlisle at latex-project.org>
+
+	* ltmath.dtx: Add \ignorespaces to \eqno (gh/1059)
+
+2023-04-19  Joseph Wright  <joseph.wright at latex-project.org>
+
+	* ltfinal.dtx (subsection{Lccodes and uccodes}):
+	Add \DeclareLowercaseMapping, \DeclareTitlecaseMapping and
+	\DeclareUppercaseMapping (gh/1033)
+
+2023-04-19  Phelype Oleinik  <phelype.oleinik at latex-project.org>
+
+	* lthooks.dtx (subsection{Specifying code for next invocation}):
+	Initialise hook structure when adding 'next' code (gh/1052)
+
+2023-04-17  Joseph Wright  <Joseph.Wright at latex-project.org>
+
+	* ltfinal.dtx (subsubsection{Lccodes and uccodes}):
+	Add \BCPdata (gh/1035)
+	Adapt \MakeLowercase, \MakeTitlecase and \MakeLowercase
+	to use \BCPdata for locale info
+
+2023-04-16  Phelype Oleinik  <phelype.oleinik at latex-project.org>
+
+	* lthooks.dtx (subsubsection{Setting hooks up}):
+	Use \@@_replacing_args_false: in \@@_include_legacy_code_chunk:n.
+
+2023-04-15  David Carlisle  <David.Carlisle at latex-project.org>
+
+	* ltplain.dtx: adjust \extrafloats so it does not error if thousands
+	of float boxes are allocated. github/1041
+
+2023-04-14  Phelype Oleinik  <phelype.oleinik at latex-project.org>
+
+	* ltclass.dtx (\@onefilewithoptions):
+	When in latexrelease.sty, define \load at onefilewithoptions (gh/992).
+
+2023-04-13  David Carlisle  <David.Carlisle at latex-project.org>
+
+	* cmfonts.fdd: add missing substitution for U/cmtt/bx/sl gh/1037
+
+2023-04-12  Phelype Oleinik  <phelype.oleinik at latex-project.org>
+
+	* ltcmd.dtx (subsection{Grabbing arguments}):
+	Set \tex_endlinechar:D earlier to correct parsing of newlines in
+	special catcode settings (e.g., \ExplSyntaxOn) (gh/876).
+  
+2023-04-02  David Carlisle  <David.Carlisle at latex-project.org>
+
+	* ltfilehook.dtx: allow par as a filename. (gh/942)
+
+2023-04-06  Phelype Oleinik  <phelype.oleinik at latex-project.org>
+
+	* lthooks.dtx, ltcmdhooks.dtx:
+	Add support for providing and using arguments in hooks:
+	  - Modify hook data structures to allow access to arguments;
+	  - Add commands to declare hooks with arguments;
+	  - Add commands to add code that references hook arguments;
+	  - Add commands to use hooks with arguments.
+
+2023-04-01  David Carlisle  <David.Carlisle at latex-project.org>
+
+	* ltfssbas.dtx: locally reset frozen mathversions when the math
+	version changes. (gh/1028)
+
+2023-03-28  Joseph Wright  <Joseph.Wright at latex-project.org>
+
+	* ltclass.dtx:
+	Add \IfFileAtLeastTF (gh/1015)
+
+2023-03-28  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* ltxdoc.dtx (section{Options}):
+	Define \cs if doc is rolled back to v2 (gh/981)
+
+2023-03-28  David Carlisle  <David.Carlisle at latex-project.org>
+
+	* ltfinal.dtx: Restore groups to \MakeUppercase and
+          \MakeLowercase, and add a group to \MakeTitlecase. (gh/1021)
+
+2023-03-22  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* ltspace.dtx:
+	Add \predisplaypenalty setting of 10000 to \samepage in case
+	that was changed (gh/1022)
+
+2023-03-11  Yukai Chou  <muzimuzhi at gmail.com>
+
+    * ltcmd.dtx (subsubsection{Showing the definition of a command}),
+                (subsubsection{Copying a command and its internal structure}):
+    Correctly recognize (non-expandable) document commands with empty or only
+    m-type arguments (gh/1009)
+
 2023-01-30  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
 	* ltpara.dtx (subsection{Providing hooks for paragraphs}):
@@ -12,13 +138,24 @@
 	Backout \parskip at top of minipage if it shouldn't be there
 	but is due to whatsits (gh/989)
 
+2023-02-05 Yukai Chou <muzimuzhi at gmail.com>
+
+	* fntguide.tex:
+	Adjusted pagination due to recently added doc paragraphs (gh/994)
+
 2023-01-16 Yukai Chou <muzimuzhi at gmail.com>
 
 	* ltnews.cls:
-	Added full release date yyyy-mm-dd to _all_ ltnews issues.
+	Added full release date yyyy-mm-dd to _all_ ltnews issues (gh/982)
 	Added \publicationday{<day>} to specify day in a month in ltnews<n>.tex.
 	<day> defaults to 01.
 
+2023-01-12  Joseph Joseph  <Joseph.Joseph at latex-project.org>
+
+	* clsguide.tex, clsguide-historic,tex
+	Pre-2023 source moved to new name, re-worked material which remains
+	relevant in updated file
+
 ================================================================================
 All changes above are only part of the development branch for the next release.
 ================================================================================

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/classes.pdf
===================================================================
(Binary files differ)

Added: trunk/Master/texmf-dist/doc/latex-dev/base/clsguide-historic.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex-dev/base/clsguide-historic.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/clsguide-historic.pdf	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/clsguide-historic.pdf	2023-05-25 20:39:11 UTC (rev 67218)

Property changes on: trunk/Master/texmf-dist/doc/latex-dev/base/clsguide-historic.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex-dev/base/clsguide-historic.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/clsguide-historic.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/clsguide-historic.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -0,0 +1,1881 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 1993-2023
+% The LaTeX Project and any individual authors listed elsewhere
+% in this file.
+%
+% This file is part of the LaTeX base system.
+% -------------------------------------------
+%
+% It may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3c
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+%    http://www.latex-project.org/lppl.txt
+% and version 1.3c or later is part of all distributions of LaTeX
+% version 2008 or later.
+%
+% This file has the LPPL maintenance status "maintained".
+%
+% The list of all files belonging to the LaTeX base distribution is
+% given in the file `manifest.txt'. See also `legal.txt' for additional
+% information.
+%
+% The list of derived (unpacked) files belonging to the distribution
+% and covered by LPPL is defined by the unpacking scripts (with
+% extension .ins) which are part of the distribution.
+%
+% \fi
+% Filename: clsguide-historic.tex
+
+\NeedsTeXFormat{LaTeX2e}[1995/12/01]
+
+\documentclass{ltxguide}[1995/11/28]
+
+\title{\LaTeXe~for class and package writers --- historic version}
+
+\author{Copyright \copyright~1995--2006 The \LaTeX\ Project\\
+   All rights reserved.%
+   \footnote{This file may be distributed and/or modified under the
+     conditions of the \LaTeX{} Project Public License, either version 1.3c
+     of this license or (at your option) any later version. See the source
+    \texttt{clsguide.tex} for full details.}%
+}
+
+\date{11 January 2023}
+
+\begin{document}
+
+\maketitle
+
+\tableofcontents
+
+\section{Introduction}
+
+This document is an introduction to writing classes and packages for
+\LaTeX{}, with special attention given to upgrading existing
+\LaTeX~2.09 packages to \LaTeXe{}.  The latter subject is also
+covered in an article by Johannes Braams published in TUGboat~15.3.
+
+It is somewhat of an historical document now, since \LaTeXe{} came into
+existence in 1994.
+
+\subsection{Writing classes and packages for \LaTeXe}
+
+\LaTeX{} is a document preparation system that enables the document
+writer to concentrate on the contents of their text, without bothering
+too much about the formatting of it.  For example, chapters are
+indicated by |\chapter{<title>}| rather than by selecting 18pt bold.
+
+The file that contains the information about how to turn logical
+structure (like `|\chapter|') into formatting (like `18pt bold ragged
+right') is a \emph{document class}.  In addition, some features (such
+as colour or included graphics) are independent of the document class
+and these are contained in \emph{packages}.
+
+One of the largest differences between \LaTeX~2.09 and \LaTeXe{} is in
+the commands used to write packages and classes.  In \LaTeX~2.09,
+there was very little support for writing |.sty| files, and so writers
+had to resort to using low-level commands.
+
+\LaTeXe{} provides high-level commands for structuring packages.
+It is also much easier to build classes and packages on top of each
+other, for example writing a local technical report class |cetechr|
+(for the Chemical Engineering department) based on |article|.
+
+\subsection{Overview}
+
+This document contains an overview of how to write classes and
+packages for \LaTeX{}.  It does \emph{not} introduce all of the
+commands necessary to write packages: these can be found in either
+\emph{\LaTeXbook} or \emph{\LaTeXcomp}.  But it does describe the new
+commands for structuring classes and packages.
+
+\begin{description}
+
+\item[Section~\ref{Sec:general}] contains some general advice about
+  writing classes and packages.  It describes the difference between
+  classes and packages, the command naming conventions, the use of
+  |doc| and |docstrip|, how \TeX's primitive file and box commands
+  interact with \LaTeX{}. It also contains some hints about general
+  \LaTeX{} style.
+
+\item[Section~\ref{Sec:structure}] describes the structure of classes
+  and packages.  This includes building classes and packages on top of
+  other classes and packages, declaring options and declaring
+  commands.  It also contains example classes.
+
+\item[Section~\ref{Sec:commands}] lists the new class and package
+   commands.
+
+ \item[Section~\ref{Sec:upgrade}] gives detailed advice on how to
+   upgrade existing \LaTeX~2.09 classes and packages to \LaTeXe{}.
+
+\end{description}
+
+\subsection{Further information}
+
+For a general introduction to \LaTeX{}, including the new features of
+\LaTeXe{}, you should read \emph{\LaTeXbook}
+by Leslie Lamport~\cite{A-W:LLa94}.
+
+A more detailed description of the new features of \LaTeX, including an
+overview of more than 200 packages and nearly 1000 ready to run examples, is
+to be found in \emph{\LaTeXcomp\ second edition} by Frank Mittelbach and
+Michel Goossens~\cite{A-W:MG2004}.
+
+The \LaTeX{} system is based on \TeX{}, which is
+described in \emph{The \TeX book} by Donald E.~Knuth~\cite{A-W:DEK91}.
+
+There are a number of documentation files which accompany every copy
+of \LaTeX{}.  A copy of \emph{\LaTeX{} News} will come out with each
+six-monthly release of \LaTeX{}, and is found in the files
+|ltnews*.tex|.  The author's guide \emph{\usrguide} describes the new
+\LaTeX{} document features; it is in |usrguide.tex|.  The guide
+\emph{\fntguide} describes the \LaTeX{} font selection scheme for
+class- and package-writers; it is in |fntguide.tex|. Configuring
+\LaTeX{} is covered by the guide \emph{\cfgguide} in
+\texttt{cfgguide.tex} whilst the philosophy behind our policy on
+modifying \LaTeX{} is described in \emph{\modguide} in
+\texttt{modguide.tex}.
+
+The documented source code (from the files used to produce the kernel
+format via |latex.ltx|) is now available as
+\emph{The \LaTeXe\ Sources}.
+This very large document also includes an index of
+\LaTeX{} commands.  It can be typeset from the \LaTeX{} file
+|source2e.tex| in the |base| directory, using the source files and
+the class file |ltxdoc.cls| from this directory.
+
+For more information about \TeX{} and \LaTeX{}, please contact your
+local \TeX{} Users Group, or the international \TeX{} Users Group.
+Addresses and other details can be found at:
+\begin{quote}\small\label{addrs}
+    \texttt{http://www.tug.org/lugs.html}
+\end{quote}
+
+
+\subsection{Policy on standard classes}
+
+Many of the problem reports we receive concerning the standard classes
+are not concerned with bugs but are suggesting, more or less politely,
+that the design decisions embodied in them are `not optimal' and
+asking us to modify them.
+
+There are several reasons why we should not make such changes to these
+files.
+\begin{itemize}
+\item
+  However misguided, the current behaviour is clearly what was
+  intended when these classes were designed.
+\item
+  It is not good practice to change such aspects of `standard classes'
+  because many people will be relying on them.
+\end{itemize}
+
+We have therefore decided not to even consider making such
+modifications, nor to spend time justifying that decision.  This does
+not mean that we do not agree that there are many deficiencies in the
+design of these classes, but we have many tasks with higher priority
+than continually explaining why the standard classes for \LaTeX{}
+cannot be changed.
+
+We would, of course, welcome the production of better classes, or of
+packages that can be used to enhance these classes.  So your first
+thought when you consider such a deficiency will, we hope, be ``what
+can I do to improve this?''
+
+Similar considerations apply to those parts of the kernel that are
+implementing design decisions, many of which should be left to the
+class file but are not in the current system.  We realise that in such
+cases it is much more difficult for you to rectify the problem
+yourself but it is also the case that making such changes in the
+kernel would probably be a major project for us; therefore such
+enhancements will have to wait for \LaTeX3.
+
+\section{Writing classes and packages}
+\label{Sec:writing}
+
+This section covers some general points concerned with writing
+\LaTeX{} classes and packages.
+
+
+\subsection{Old versions}
+
+If you are upgrading an existing \LaTeX~2.09 style file then we
+recommend freezing the 2.09 version and no longer maintaining it.
+Experience with the various dialects of \LaTeX{} which existed in the
+early 1990's suggests that maintaining packages for different versions
+of \LaTeX{} is almost impossible.  It will, of course, be necessary
+for some organisations to maintain both versions in parallel for some
+time but this is not essential for those packages and classes
+supported by individuals: they should support only the new standard
+\LaTeXe{}, not obsolete versions of \LaTeX{}.
+
+
+\subsection{Using `docstrip' and `doc'}
+
+If you are going to write a large class or package for \LaTeX{} then
+you should consider using the |doc| software which comes with
+\LaTeX{}.
+\LaTeX{} classes and packages written using this can be
+processed in two ways: they can be run through \LaTeX{}, to produce
+documentation; and they can be processed with |docstrip|, to produce
+the |.cls| or |.sty| file.
+
+The |doc| software can automatically generate indexes of definitions,
+indexes of command use, and change-log lists.  It is very useful for
+maintaining and documenting large \TeX{} sources.
+
+The documented sources of the \LaTeX{} kernel itself, and of the
+standard classes, etc, are |doc| documents; they are in the |.dtx|
+files in the distribution.  You can, in fact, typeset the source code
+of the kernel as one long document, complete with index, by running
+\LaTeX{} on |source2e.tex|.  Typesetting these documents uses the
+class file |ltxdoc.cls|.
+
+For more information on |doc| and |docstrip|, consult the files
+|docstrip.dtx|, |doc.dtx|, and \emph{\LaTeXcomp}.  For examples of its
+use, look at the |.dtx| files.
+
+\subsection{Is it a class or a package?}
+\label{Sec:classorpkg}
+
+The first thing to do when you want to put some new \LaTeX{} commands
+in a file is to decide whether it should be a \emph{document class} or a
+\emph{package}.  The rule of thumb is:
+\begin{quote}
+  If the commands could be used with any document class, then make
+  them a package; and if not, then make them a class.
+\end{quote}
+
+There are two major types of class: those like |article|, |report| or
+|letter|, which are free-standing; and those which are extensions or
+variations of other classes---for example, the |proc| document class,
+which is built on the |article| document class.
+
+Thus, a company might have a local |ownlet| class for printing letters
+with their own headed note-paper.  Such a class would build on top of
+the existing |letter| class but it cannot be used with any other
+document class, so we have |ownlet.cls| rather than |ownlet.sty|.
+
+The |graphics| package, in contrast, provides commands for including
+images into a \LaTeX{} document.  Since these commands can be used
+with any document class, we have |graphics.sty| rather than
+|graphics.cls|.
+
+
+\subsection{Command names}
+
+\LaTeX{} has three types of command.
+
+There are the author commands, such as |\section|, |\emph| and
+|\times|:  most of these have short names, all in lower case.
+
+There are also the class and package writer commands:
+most of these have long mixed-case names such as the following.
+\begin{verbatim}
+   \InputIfFileExists  \RequirePackage  \PassOptionsToClass
+\end{verbatim}
+
+Finally, there are the internal commands used in the \LaTeX{}
+implementation, such as |\@tempcnta|, |\@ifnextchar| and |\@eha|:
+most of these commands contain |@| in their name, which means they
+cannot be used in documents, only in class and package files.
+
+Unfortunately, for historical reasons the distinction between these
+commands is often blurred.  For example, |\hbox| is an internal
+command which should only be used in the \LaTeX{} kernel, whereas
+|\m at ne| is the constant $-1$ and could have been |\MinusOne|.
+
+However, this rule of thumb is still useful: if a command has |@| in
+its name then it is not part of the supported \LaTeX{} language---and
+its behaviour may change in future releases!  If a command is
+mixed-case, or is described in \emph{\LaTeXbook}, then you can rely on
+future releases of \LaTeXe{} supporting the command.
+
+\subsection{Box commands and colour}
+\label{Sec:colour}
+
+Even if you do not intend to use colour in your own documents, by
+taking note of the points in this section you can ensure that your
+class or package is compatible with the |color| package. This may
+benefit people using your class or package who have access to colour
+printers.
+
+The simplest way to ensure `colour safety' is to always use \LaTeX{}
+box commands rather than \TeX{} primitives, that is use |\sbox| rather
+than |\setbox|, |\mbox| rather than |\hbox| and |\parbox| or
+the |minipage| environment rather than |\vbox|.
+The \LaTeX{} box commands have new options which mean that they are now
+as powerful as the \TeX{} primitives.
+
+As an example of what can go wrong, consider that in
+|{\ttfamily <text>}|
+the font is restored just \emph{before} the |}|, whereas in the
+similar looking construction
+|{\color{green} <text>}|
+the colour is restored just \emph{after} the final |}|. Normally this
+distinction does not matter at all; but consider a primitive \TeX{}
+box assignment such as:
+\begin{verbatim}
+   \setbox0=\hbox{\color{green} <text>}
+\end{verbatim}
+Now the colour-restore occurs after the |}| and so is \emph{not}
+stored in the box. Exactly what bad effects this can have depends on
+how colour is implemented: it can range from getting the wrong
+colours in the rest of the document, to causing errors in the
+dvi-driver used to print the document.
+
+Also of interest is the command |\normalcolor|.   This is
+normally just |\relax| (i.e., does nothing)
+but you can use it rather like |\normalfont| to
+set regions of the page such as captions or section headings to the
+`main document colour'.
+
+
+\subsection{Defining text and math characters}
+\label{Sec:chars}
+
+Because \LaTeXe{} supports different encodings, definitions of commands
+for producing symbols, accents, composite glyphs, etc.\ must be
+defined using the commands provided for this purpose and described in
+\emph{\fntguide}.  This part of the system is still under development
+so such tasks should be undertaken with great caution.
+
+Also, |\DeclareRobustCommand| should be used for encoding-independent
+commands of this type.
+
+Note that it is no longer possible to refer to the math font set-up
+outside math mode: for example, neither |\textfont 1| nor
+|\scriptfont 2| are guaranteed to be defined in other modes.
+
+
+\subsection{General style}
+\label{Sec:general}
+
+The new system provides many commands designed to help you produce
+well-structured class and package files that are both robust and
+portable.  This section outlines some ways to make intelligent use of
+these.
+
+\subsubsection{Loading other files}
+\label{Sec:loading}
+
+\NEWdescription{1995/12/01}
+\LaTeX{} provides these commands:
+\begin{verbatim}
+   \LoadClass        \LoadClassWithOptions
+   \RequirePackage   \RequirePackageWithOptions
+\end{verbatim}
+for using classes or packages inside other classes or packages.  We
+recommend strongly that you use them, rather than the primitive
+|\input| command, for a number of reasons.
+
+Files loaded with |\input <filename>| will not be listed in the
+|\listfiles| list.
+
+If a package is always loaded with |\RequirePackage...| or |\usepackage|
+then, even if its loading is requested several times, it will be
+loaded only once.  By contrast, if it is loaded with |\input| then it
+can be loaded more than once; such an extra loading may waste time and
+memory and it may produce strange results.
+
+If a package provides option-processing then, again, strange results
+are possible if the package is |\input| rather than loaded by means of
+|\usepackage| or |\RequirePackage...|.
+
+If the package |foo.sty| loads the package |baz.sty| by use of
+|\input baz.sty| then the user will get a warning:
+\begin{verbatim}
+   LaTeX Warning: You have requested package `foo',
+                  but the package provides `baz'.
+\end{verbatim}
+Thus, for several reasons, using |\input| to load packages is not a
+good idea.
+
+Unfortunately, if you are upgrading the file |myclass.sty| to a class
+file then you have to make sure that any old files which contain
+|\input myclass.sty| still work.
+
+This was also true for the standard classes (|article|, |book| and
+|report|), since a lot of existing \LaTeX~2.09 document styles contain
+|\input article.sty|.  The approach which we use to solve this is
+to provide minimal files |article.sty|, |book.sty| and |report.sty|,
+which simply load the appropriate class files.
+
+For example, |article.sty| contains just the following lines:
+\begin{verbatim}
+   \NeedsTeXFormat{LaTeX2e}
+   \@obsoletefile{article.cls}{article.sty}
+   \LoadClass{article}
+\end{verbatim}
+You may wish to do the same or, if you think that it is safe to do so,
+you may decide to just remove |myclass.sty|.
+
+\subsubsection{Make it robust}
+
+We consider it good practice, when writing packages and classes, to use
+\LaTeX{} commands as much as possible.
+
+Thus, instead of using |\def...| we recommend using one of
+|\newcommand|, |\renewcommand| or |\providecommand|; |\CheckCommand| is
+also useful. Doing this makes
+it less likely that you will inadvertently redefine a command, giving
+unexpected results.
+
+When you define an environment, use |\newenvironment| or
+|\renewenvironment| instead |\def\foo{...}| and |\def\endfoo{...}|.
+
+If you need to set or change the value of a \m{dimen} or \m{skip}
+register, use |\setlength|.
+
+To manipulate boxes, use \LaTeX{} commands such as |\sbox|,
+|\mbox| and |\parbox| rather than |\setbox|, |\hbox| and |\vbox|.
+
+Use |\PackageError|, |\PackageWarning| or |\PackageInfo| (or the
+equivalent class commands) rather than |\@latexerr|, |\@warning| or
+|\wlog|.
+
+It is still possible to declare options by defining |\ds@<option>| and
+calling |\@options|; but we recommend the |\DeclareOption| and
+|\ProcessOptions| commands instead.  These are more powerful and use
+less memory.  So rather than using:
+\begin{verbatim}
+   \def\ds at draft{\overfullrule 5pt}
+   \@options
+\end{verbatim}
+you should use:
+\begin{verbatim}
+   \DeclareOption{draft}{\setlength{\overfullrule}{5pt}}
+   \ProcessOptions\relax
+\end{verbatim}
+
+The advantage of this kind of practice is that your code is more
+readable and, more important, that it is less likely to break when
+used with future versions of \LaTeX{}.
+
+\subsubsection{Make it portable}
+
+It is also sensible to make your files are as portable as possible. To
+ensure this; they should contain only visible 7-bit text; and the
+filenames should contain at most eight characters (plus the three
+letter extension).  Also, of course, it \textbf{must not} have the
+same name as a file in the standard \LaTeX{} distribution, however
+similar its contents may be to one of these files.
+
+It is also useful if local classes or packages have a common prefix,
+for example the University of Nowhere classes might begin with |unw|.
+This helps to avoid every University having its own thesis class, all
+called |thesis.cls|.
+
+If you rely on some features of the \LaTeX{} kernel, or on a package,
+please specify the release-date you need.  For example, the package
+error commands were introduced in the June 1994 release so, if you use
+them then you should put:
+\begin{verbatim}
+   \NeedsTeXFormat{LaTeX2e}[1994/06/01]
+\end{verbatim}
+
+\subsubsection{Useful hooks}
+
+Some packages and document styles had to redefine the command
+|\document| or |\enddocument| to achieve their goal.  This is no
+longer necessary. You can now use the `hooks' |\AtBeginDocument| and
+|\AtEndDocument| (see Section~\ref{Sec:delays}).  Again, using these
+hooks makes it less likely that your code breaks with future versions
+of \LaTeX{}. It also makes it more likely that your package can work
+together with someone else's.
+
+\NEWdescription{1996/12/01}
+However, note that code in the |\AtBeginDocument| hook is part of the
+preamble.  Thus there are restrictions on what can be put there; in
+particular, no typesetting can be done.
+
+\section{The structure of a class or package}
+\label{Sec:structure}
+
+\LaTeXe{} classes and packages have more structure than \LaTeX~2.09
+style files did.  The outline of a class or package file is:
+\begin{description}
+\item[Identification] The file says that it is a \LaTeXe{} package or
+   class, and gives a short description of itself.
+\item[Preliminary declarations]
+   Here the file declares some commands and can also load
+   other files.  Usually these commands will be just those needed for
+   the code used in the declared options.
+\item[Options] The file declares and processes its options.
+\item[More declarations] This is where the file does most of its work:
+   declaring new variables, commands and fonts; and loading other files.
+\end{description}
+
+\subsection{Identification}
+
+The first thing a class or package file does is identify itself.
+Package files do this as follows:
+\begin{verbatim}
+   \NeedsTeXFormat{LaTeX2e}
+   \ProvidesPackage{<package>}[<date> <other information>]
+\end{verbatim}
+For example:
+\begin{verbatim}
+   \NeedsTeXFormat{LaTeX2e}
+   \ProvidesPackage{latexsym}[1994/06/01 Standard LaTeX package]
+\end{verbatim}
+Class files do this as follows:
+\begin{verbatim}
+   \NeedsTeXFormat{LaTeX2e}
+   \ProvidesClass{<class-name>}[<date> <other information>]
+\end{verbatim}
+For example:
+\begin{verbatim}
+   \NeedsTeXFormat{LaTeX2e}
+   \ProvidesClass{article}[1994/06/01 Standard LaTeX class]
+\end{verbatim}
+\NEWdescription{1998/06/19}
+The \m{date} should be given in the form `\textsc{yyyy/mm/dd}' and
+must be present if the optional argument is used (this is also true
+for the |\NeedsTeXFormat| command).
+Any derivation from this syntax will result in low-level \TeX{}
+errors---the commands expect a valid syntax to speed up the daily
+usage of the package or class and make no provision for the case that
+the developer made a mistake!
+
+This date is checked whenever a user specifies a date in their
+|\documentclass| or |\usepackage| command.  For example, if you wrote:
+\begin{verbatim}
+   \documentclass{article}[1995/12/23]
+\end{verbatim}
+then users at a different location
+would get a warning that their copy of |article| was out of
+date.
+
+The description of a class is displayed when the class is used.  The
+description of a package is put into the log file.  These descriptions
+are also displayed by the |\listfiles| command.  The phrase
+\texttt{Standard LaTeX} \textbf{must not} be used in the identification
+banner of any file other than those in the standard \LaTeX{}
+distribution.
+
+
+\subsection{Using classes and packages}
+
+The first major difference between \LaTeX~2.09 style files and
+\LaTeXe{} packages and classes is that \LaTeXe{} supports
+\emph{modularity}, in the sense of building files from small
+building-blocks rather than using large single files.
+
+A \LaTeX{} package or class can load a package as follows:
+\begin{verbatim}
+   \RequirePackage[<options>]{<package>}[<date>]
+\end{verbatim}
+For example:
+\begin{verbatim}
+   \RequirePackage{ifthen}[1994/06/01]
+\end{verbatim}
+This command has the same syntax as the author command |\usepackage|.
+It allows packages or classes to use features provided by other
+packages.  For example, by loading the |ifthen| package, a package
+writer can use the `if\dots then\dots else\dots' commands provided
+by that package.
+
+A \LaTeX{} class can load one other class as follows:
+\begin{verbatim}
+   \LoadClass[<options>]{<class-name>}[<date>]
+\end{verbatim}
+For example:
+\begin{verbatim}
+   \LoadClass[twocolumn]{article}
+\end{verbatim}
+This command has the same syntax as the author command |\documentclass|.
+It allows classes to be based on the syntax and appearance of another
+class.  For example, by loading the |article| class, a class writer
+only has to change the bits of |article| they don't like, rather than
+writing a new class from scratch.
+
+\NEWfeature{1995/12/01}
+The following commands can be used in the common case that you want to
+simply load a class or package file with exactly those options that
+are being used by the current class.
+\begin{verbatim}
+   \LoadClassWithOptions{<class-name>}[<date>]
+   \RequirePackageWithOptions{<package>}[<date>]
+\end{verbatim}
+For example:
+\begin{verbatim}
+   \LoadClassWithOptions{article}
+   \RequirePackageWithOptions{graphics}[1995/12/01]
+\end{verbatim}
+
+\subsection{Declaring options}
+
+\NEWdescription{1998/12/01}
+The other major difference between \LaTeX~2.09 styles and \LaTeXe{}
+packages and classes is in option handling.  Packages and classes can
+now declare options and these can be specified by authors; for
+example, the |twocolumn| option is declared by the |article| class.
+Note that the name of an option should contain only those characters
+allowed in a `\LaTeX{} name'; in particular it must not contain any
+control sequences.
+
+An option is declared as follows:
+\begin{verbatim}
+   \DeclareOption{<option>}{<code>}
+\end{verbatim}
+For example, the |dvips| option (slightly simplified)
+to the |graphics| package is implemented as:
+\begin{verbatim}
+   \DeclareOption{dvips}{\input{dvips.def}}
+\end{verbatim}
+This means that when an author writes |\usepackage[dvips]{graphics}|,
+the file |dvips.def| is loaded.  As another example, the |a4paper|
+option is declared in the |article| class to set the |\paperheight|
+and |\paperwidth| lengths:
+\begin{verbatim}
+   \DeclareOption{a4paper}{%
+      \setlength{\paperheight}{297mm}%
+      \setlength{\paperwidth}{210mm}%
+   }
+\end{verbatim}
+Sometimes a user will request an option which the class
+or package has not explicitly declared.  By default this will produce
+a warning (for classes) or error (for packages); this behaviour
+can be altered as follows:
+\begin{verbatim}
+   \DeclareOption*{<code>}
+\end{verbatim}
+For example, to make the package |fred| produce a warning rather than
+an error for unknown options, you could specify:
+\begin{verbatim}
+   \DeclareOption*{%
+      \PackageWarning{fred}{Unknown option `\CurrentOption'}%
+   }
+\end{verbatim}
+Then, if an author writes |\usepackage[foo]{fred}|, they will get a
+warning \texttt{Package fred Warning: Unknown option `foo'.}  As
+another example, the |fontenc| package tries to load a file
+|<ENC>enc.def| whenever the \m{ENC} option is used.  This
+can be done by writing:
+\begin{verbatim}
+   \DeclareOption*{%
+      \input{\CurrentOption enc.def}%
+   }
+\end{verbatim}
+\NEWdescription{1998/12/01}
+It is possible to pass options on to another package or class, using
+the command |\PassOptionsToPackage| or |\PassOptionsToClass| (note
+that this is a specialised operation that works only for option
+names).  For example, to pass every unknown option on to the |article|
+class, you can use:
+\begin{verbatim}
+   \DeclareOption*{%
+      \PassOptionsToClass{\CurrentOption}{article}%
+   }
+\end{verbatim}
+If you do this then you should make sure you load the class at some
+later point, otherwise the options will never be processed!
+
+So far, we have explained only how to declare options, not how to
+execute them.  To process the options with which the file was called,
+you should use:
+\begin{verbatim}
+   \ProcessOptions\relax
+\end{verbatim}
+This executes the \m{code} for each option that was both specified and
+declared (see Section~\ref{Sec:commands.options} for details of how
+this is done).
+
+For example, if the |jane| package file contains:
+\begin{verbatim}
+   \DeclareOption{foo}{\typeout{Saw foo.}}
+   \DeclareOption{baz}{\typeout{Saw baz.}}
+   \DeclareOption*{\typeout{What's \CurrentOption?}}
+   \ProcessOptions\relax
+\end{verbatim}
+and an author writes |\usepackage[foo,bar]{jane}|, then they will see
+the messages \texttt{Saw foo.} and \texttt{What's bar?}
+
+\subsection{A minimal class file}
+
+Most of the work of a class or package is in defining new commands, or
+changing the appearance of documents.  This is done in the body of the
+package, using commands such as |\newcommand| or |\setlength|.
+
+\LaTeXe{} provides several new commands to help class and package
+writers; these are described in detail in Section~\ref{Sec:commands}.
+
+There are four things that every class file \emph{must} contain: these
+are a definition of |\normalsize|, values for |\textwidth| and
+|\textheight| and a specification for page-numbering.  So a minimal
+document class file\footnote {This class is now in the standard
+distribution, as \texttt{minimal.cls}.} looks like this:
+\begin{verbatim}
+   \NeedsTeXFormat{LaTeX2e}
+   \ProvidesClass{minimal}[1995/10/30 Standard LaTeX minimal class]
+   \renewcommand{\normalsize}{\fontsize{10pt}{12pt}\selectfont}
+   \setlength{\textwidth}{6.5in}
+   \setlength{\textheight}{8in}
+   \pagenumbering{arabic}       % needed even though this class will
+                                % not show page numbers
+\end{verbatim}
+However, this class file will not support footnotes, marginals,
+floats, etc., nor will it provide any of the 2-letter font commands
+such as |\rm|; thus most classes will contain more than this minimum!
+
+\subsection{Example: a local letter class}
+
+A company may have its own letter class, for setting letters in the
+company style.  This section shows a simple implementation of such a
+class, although a real class would need more structure.
+
+The class begins by announcing itself as |neplet.cls|.
+\begin{verbatim}
+   \NeedsTeXFormat{LaTeX2e}
+   \ProvidesClass{neplet}[1995/04/01 NonExistent Press letter class]
+\end{verbatim}
+Then this next bit passes any options on to the |letter| class, which
+is loaded with the |a4paper| option.
+\begin{verbatim}
+   \DeclareOption*{\PassOptionsToClass{\CurrentOption}{letter}}
+   \ProcessOptions\relax
+   \LoadClass[a4paper]{letter}
+\end{verbatim}
+In order to use the company letter head, it redefines the
+|firstpage| page style: this is the page style that is used on
+the first page of letters.
+\begin{verbatim}
+   \renewcommand{\ps at firstpage}{%
+      \renewcommand{\@oddhead}{<letterhead goes here>}%
+      \renewcommand{\@oddfoot}{<letterfoot goes here>}%
+   }
+\end{verbatim}
+And that's it!
+
+\subsection{Example: a newsletter class}
+
+A simple newsletter can be typeset with \LaTeX{}, using a variant of the
+|article| class.
+The class begins by announcing itself as |smplnews.cls|.
+\begin{verbatim}
+   \NeedsTeXFormat{LaTeX2e}
+   \ProvidesClass{smplnews}[1995/04/01 The Simple News newsletter class]
+
+   \newcommand{\headlinecolor}{\normalcolor}
+\end{verbatim}
+It passes most specified options on to the |article| class: apart from
+the |onecolumn| option, which is switched off, and the |green| option,
+which sets the headline in green.
+\begin{verbatim}
+   \DeclareOption{onecolumn}{\OptionNotUsed}
+   \DeclareOption{green}{\renewcommand{\headlinecolor}{\color{green}}}
+
+   \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
+
+   \ProcessOptions\relax
+\end{verbatim}
+It then loads the class |article| with the option |twocolumn|.
+\begin{verbatim}
+   \LoadClass[twocolumn]{article}
+\end{verbatim}
+Since the newsletter is to be printed in colour, it now loads the
+|color| package.  The class does not specify a device driver option
+since this should be specified by the user of the |smplnews| class.
+\begin{verbatim}
+   \RequirePackage{color}
+\end{verbatim}
+The class then redefines |\maketitle| to produce the title in 72pt
+Helvetica bold oblique, in the appropriate colour.
+\begin{verbatim}
+   \renewcommand{\maketitle}{%
+      \twocolumn[%
+         \fontsize{72}{80}\fontfamily{phv}\fontseries{b}%
+         \fontshape{sl}\selectfont\headlinecolor
+         \@title
+      ]%
+   }
+\end{verbatim}
+It redefines |\section| and switches off section numbering.
+\begin{verbatim}
+   \renewcommand{\section}{%
+      \@startsection
+         {section}{1}{0pt}{-1.5ex plus -1ex minus -.2ex}%
+         {1ex plus .2ex}{\large\sffamily\slshape\headlinecolor}%
+   }
+
+   \setcounter{secnumdepth}{0}
+\end{verbatim}
+It also sets the three essential things.
+\begin{verbatim}
+   \renewcommand{\normalsize}{\fontsize{9}{10}\selectfont}
+   \setlength{\textwidth}{17.5cm}
+   \setlength{\textheight}{25cm}
+\end{verbatim}
+In practice, a class would need more than this: it would provide
+commands for issue numbers, authors of articles, page styles and so
+on; but this skeleton gives a start.  The |ltnews| class file is not
+much more complex than this one.
+
+\section{Commands for class and package writers}
+\label{Sec:commands}
+
+This section describes briefly each of the new commands for class and
+package writers.  To find out about other aspects of the new system,
+you should also read \emph{\LaTeXbook}, \emph{\LaTeXcomp} and
+\emph{\usrguide}.
+
+\subsection{Identification}
+
+The first group of commands discussed here are those used
+to identify your class or package file.
+
+\begin{decl}
+|\NeedsTeXFormat| \arg{format-name} \oarg{release-date}
+\end{decl}
+This command tells \TeX{} that this file should be processed using a
+format with name \m{format-name}.  You can use the optional argument
+\m{release-date} to further specify the earliest release date of the
+format that is needed.  When the release date of the format is older
+than the one specified a warning will be generated. The standard
+\m{format-name} is \texttt{LaTeX2e}.  The date, if present, must be in
+the form \textsc{yyyy/mm/dd}.
+
+Example:
+\begin{verbatim}
+   \NeedsTeXFormat{LaTeX2e}[1994/06/01]
+\end{verbatim}
+
+\begin{decl}
+|\ProvidesClass| \arg{class-name} \oarg{release-info} \\
+|\ProvidesPackage| \arg{package-name} \oarg{release-info}
+\end{decl}
+This declares that the current file contains the definitions for the
+document class \m{class-name} or package \m{package-name}.
+
+The optional \m{release-info}, if used, must contain:
+\begin{itemize}
+  \item the release date of
+  this version of the file, in the form \textsc{yyyy/mm/dd};
+\item optionally followed by a space and a short description, possibly
+  including a version number.
+\end{itemize}
+The above syntax must be followed exactly so that this information
+can be used by |\LoadClass| or |\documentclass| (for classes) or
+|\RequirePackage| or |\usepackage| (for packages) to test that the
+release is not too old.
+
+The whole of this \m{release-info} information is displayed by
+|\listfiles| and should therefore not be too long.
+
+Example:
+\begin{verbatim}
+   \ProvidesClass{article}[1994/06/01 v1.0 Standard LaTeX class]
+   \ProvidesPackage{ifthen}[1994/06/01 v1.0 Standard LaTeX package]
+\end{verbatim}
+
+\begin{decl}
+  |\ProvidesFile| \arg{file-name} \oarg{release-info}
+\end{decl}
+This is similar to the two previous commands except that here the full
+filename, including the extension, must be given. It is used for
+declaring any files other than main class and package files.
+
+Example:
+\begin{verbatim}
+   \ProvidesFile{T1enc.def}[1994/06/01 v1.0 Standard LaTeX file]
+\end{verbatim}
+
+Note that the phrase \texttt{Standard LaTeX} \textbf{must not} be used
+in the identification banner of any file other than those in the
+standard \LaTeX{} distribution.
+
+\subsection{Loading files}
+\label{Sec:loadf}
+
+\NEWfeature{1995/12/01}
+This group of commands can be used to create your own document class or
+package by building on existing classes or packages.
+\begin{decl}
+  |\RequirePackage| \oarg{options-list} \arg{package-name}
+     \oarg{release-info}\\
+  |\RequirePackageWithOptions| \arg{package-name}
+     \oarg{release-info}
+\end{decl}
+Packages and classes should use these commands to load other packages.
+
+The use of |\RequirePackage| is the same as the author command
+|\usepackage|.
+
+Examples:
+\begin{verbatim}
+   \RequirePackage{ifthen}[1994/06/01]
+   \RequirePackageWithOptions{graphics}[1995/12/01]
+\end{verbatim}
+
+\begin{decl}
+  |\LoadClass| \oarg{options-list} \arg{class-name}
+     \oarg{release-info}\\
+  |\LoadClassWithOptions| \arg{class-name}
+     \oarg{release-info}
+\end{decl}
+\NEWfeature{1995/12/01}
+These commands are for use \emph{only} in class files, they cannot be
+used in packages files;
+they can be used at most once within a class file.
+
+The use of |\LoadClass| is the same as
+the use of |\documentclass| to load a class file.
+
+Examples:
+\begin{verbatim}
+   \LoadClass{article}[1994/06/01]
+   \LoadClassWithOptions{article}[1995/12/01]
+\end{verbatim}
+
+\NEWfeature{1995/12/01}
+The two |WithOptions| versions simply load the class (or package) file
+with exactly those options that are being used by the current file
+(class or package).  See below, in \ref{Sec:opmove}, for further
+discussion of their use.
+
+
+\subsection{Option declaration}
+\label{Sec:commands.options.dec}
+
+\NEWdescription{1998/12/01}
+The following commands deal with the declaration and handling of
+options to document classes and packages.  Every option name must be a
+`\LaTeX{} name'.
+
+There are some commands designed especially for use within the
+\m{code} argument of these commands (see below).
+
+\begin{decl}
+  |\DeclareOption| \arg{option-name} \arg{code}
+\end{decl}
+This makes \m{option-name} a `declared option' of the class or package
+in which it is put.
+
+The \m{code} argument contains the code to be executed if that option
+is specified for the class or package; it can contain any valid
+\LaTeXe{} construct.
+
+Example:
+\begin{verbatim}
+   \DeclareOption{twoside}{\@twosidetrue}
+\end{verbatim}
+
+\begin{decl}
+  |\DeclareOption*| \arg{code}
+\end{decl}
+This declares the \m{code} to be executed for every option which is
+specified for, but otherwise not explicitly declared by, the class or
+package; this code is called the `default option code' and it can
+contain any valid \LaTeXe{} construct.
+
+If a class file contains no |\DeclareOption*| then, by default, all
+specified but undeclared options for that class will be silently
+passed to all packages (as will the specified and declared options for
+that class).
+
+If a package file contains no |\DeclareOption*| then, by default, each
+specified but undeclared option for that package will produce an error.
+
+
+\subsection{Commands within option code}
+\label{Sec:within.code}
+
+These two commands can be used only within the \m{code} argument of
+either |\DeclareOption| or |\DeclareOption*|.  Other commands commonly
+used within these arguments can be found in the next few subsections.
+
+\begin{decl}
+  |\CurrentOption|
+\end{decl}
+This expands to the name of the current option.
+
+\begin{decl}
+  |\OptionNotUsed|
+\end{decl}
+This causes the current option to
+be added to the list of `unused options'.
+
+\NEWfeature{1995/06/01}
+  You can now include hash marks (\texttt{\#}) within these \m{code}
+  arguments without special treatment (formerly, it had been
+  necessary to double them).
+
+\subsection{Moving options around}
+\label{Sec:opmove}
+
+These two commands are also very useful within the \m{code} argument
+of |\DeclareOption| or |\DeclareOption*|:
+\begin{decl}
+  |\PassOptionsToPackage| \arg{options-list} \arg{package-name}\\
+  |\PassOptionsToClass| \arg{options-list} \arg{class-name}
+\end{decl}
+The command |\PassOptionsToPackage| passes the option names in
+\m{options-list} to package \m{package-name}.
+This means that it adds the \m{option-list} to the
+list of options used by any future |\RequirePackage| or |\usepackage|
+command for package \m{package-name}.
+
+Example:
+\begin{verbatim}
+   \PassOptionsToPackage{foo,bar}{fred}
+   \RequirePackage[baz]{fred}
+\end{verbatim}
+is the same as:
+\begin{verbatim}
+   \RequirePackage[foo,bar,baz]{fred}
+\end{verbatim}
+
+Similarly, |\PassOptionsToClass| may be used in a class file to pass
+options to another class to be loaded with |\LoadClass|.
+
+\NEWdescription{1995/12/01}
+The effects and use of these two commands should be contrasted with
+those of the following two (documented above, in \ref{Sec:loadf}):
+\begin{verbatim}
+   \LoadClassWithOptions
+   \RequirePackageWithOptions
+\end{verbatim}
+The command |\RequirePackageWithOptions| is similar to
+|\RequirePackage|, but it always loads the required package with
+exactly the same option list as that being used by the current class
+or package, rather than with any option explicitly supplied or passed
+on by |\PassOptionsToPackage|.
+
+The main purpose of |\LoadClassWithOptions| is to allow one class to
+simply build on another, for example:
+\begin{verbatim}
+  \LoadClassWithOptions{article}
+\end{verbatim}
+This should be compared with the slightly different construction
+\begin{verbatim}
+  \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
+  \ProcessOptions\relax
+  \LoadClass{article}
+\end{verbatim}
+As used above, the effects are more or less the same, but the first is
+a lot less to type; also the |\LoadClassWithOptions| method runs
+slightly quicker.
+
+If, however, the class declares options of its own then
+the two constructions are different.  Compare, for example:
+\begin{verbatim}
+  \DeclareOption{landscape}{\@landscapetrue}
+  \ProcessOptions\relax
+  \LoadClassWithOptions{article}
+\end{verbatim}
+with:
+\begin{verbatim}
+  \DeclareOption{landscape}{\@landscapetrue}
+  \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
+  \ProcessOptions\relax
+  \LoadClass{article}
+\end{verbatim}
+In the first example, the \textsf{article} class will be loaded with
+option |landscape| precisely when the current class is called with
+this option. By contrast, in the second example it will never be
+called with option \texttt{landscape} as in that case \textsf{article}
+is passed options only by the default option handler, but this handler
+is not used for |landscape| because that option is explicitly
+declared.
+
+\subsection{Delaying code}
+\label{Sec:delays}
+
+These first two commands are also intended primarily for use within
+the \m{code} argument of |\DeclareOption| or |\DeclareOption*|.
+
+\begin{decl}
+  |\AtEndOfClass| \arg{code}\\
+  |\AtEndOfPackage| \arg{code}
+\end{decl}
+These commands declare \m{code} that is saved away internally and then
+executed after processing the whole of the current class or package
+file.
+
+Repeated use of these commands is permitted: the code in the
+arguments is stored (and later executed) in the order of their
+declarations.
+
+\begin{decl}
+  |\AtBeginDocument| \arg{code}\\
+  |\AtEndDocument| \arg{code}
+\end{decl}
+These commands declare \m{code} to be saved internally and executed
+while \LaTeX{} is executing |\begin{document}| or |\end{document}|.
+
+The \m{code} specified in the argument to |\AtBeginDocument| is
+executed near the end of the |\begin{document}| code, \emph{after} the
+font selection tables have been set up.  It is therefore a useful
+place to put code which needs to be executed after everything has been
+prepared for typesetting and when the normal font for the document is
+the current font.
+
+\NEWdescription{1995/12/01}
+The |\AtBeginDocument| hook should not be used for code that does any
+typesetting since the typeset result would be unpredictable.
+
+The \m{code} specified in the argument to |\AtEndDocument| is
+executed at the beginning of the |\end{document}| code,
+\emph{before} the final page is finished and before any leftover
+floating environments are processed. If some of the \m{code} is to be
+executed after these two processes, you should include a |\clearpage|
+at the appropriate point in \m{code}.
+
+Repeated use of these commands is permitted: the code in the
+arguments is stored (and later executed) in the order of their
+declarations.
+
+\begin{decl}[1994/12/01]
+  |\AtBeginDvi| \arg{specials}
+\end{decl}
+These commands save in a box register things which are written to the
+|.dvi| file at the beginning of the `shipout' of the first page of the
+document.
+
+This should not be used for anything that will add any typeset
+material to the |.dvi| file.
+
+Repeated use of this command is permitted.
+
+
+\subsection{Option processing}
+\label{Sec:commands.options}
+
+\begin{decl}
+  |\ProcessOptions|
+\end{decl}
+This command executes the \m{code} for each selected option.
+
+We shall first describe how |\ProcessOptions| works in a package file,
+and then how this differs in a class file.
+
+To understand in detail what |\ProcessOptions| does in a package file,
+you have to know the difference between \emph{local} and \emph{global}
+options.
+\begin{itemize}
+\item \textbf{Local options} are those which have been explicitly
+  specified for this particular package in the \m{options} argument of
+  any of these:
+\begin{quote}
+    |\PassOptionsToPackage{<options>}| \ |\usepackage[<options>]|\\
+    |\RequirePackage[<options>]|
+\end{quote}
+\item \textbf{Global options} are any other options that are specified
+  by the author in the \m{options} argument of
+    |\documentclass[<options>]|.
+\end{itemize}
+For example, suppose that a document begins:
+\begin{verbatim}
+   \documentclass[german,twocolumn]{article}
+   \usepackage{gerhardt}
+\end{verbatim}
+whilst package |gerhardt| calls package |fred| with:
+\begin{verbatim}
+   \PassOptionsToPackage{german,dvips,a4paper}{fred}
+   \RequirePackage[errorshow]{fred}
+\end{verbatim}
+then:
+\begin{itemize}
+\item |fred|'s local options are |german|, |dvips|, |a4paper|
+  and |errorshow|;
+\item |fred|'s only global option is |twocolumn|.
+\end{itemize}
+
+When |\ProcessOptions| is called, the following happen.
+\begin{itemize}
+\item \emph{First}, for each option so far declared in |fred.sty|
+  by |\DeclareOption|, it looks to see if that option is either a
+  global or a local option for |fred|: if it is then the corresponding
+  code is executed.
+
+  This is done in the order in which these options
+  were declared in |fred.sty|.
+\item \emph{Then}, for each remaining \emph{local} option, the command
+  |\ds@<option>| is executed if it has been defined somewhere (other
+  than by a |\DeclareOption|); otherwise, the `default option code' is
+  executed.  If no default option code has been declared then an error
+  message is produced.
+
+  This is done in the order in which these
+  options were specified.
+\end{itemize}
+Throughout this process, the system ensures that the code declared for
+an option is executed at most once.
+
+Returning to the example, if |fred.sty| contains:
+\begin{verbatim}
+   \DeclareOption{dvips}{\typeout{DVIPS}}
+   \DeclareOption{german}{\typeout{GERMAN}}
+   \DeclareOption{french}{\typeout{FRENCH}}
+   \DeclareOption*{\PackageWarning{fred}{Unknown `\CurrentOption'}}
+   \ProcessOptions\relax
+\end{verbatim}
+then the result of processing this document will be:
+\begin{verbatim}
+   DVIPS
+   GERMAN
+   Package fred Warning: Unknown `a4paper'.
+   Package fred Warning: Unknown `errorshow'.
+\end{verbatim}
+Note the following:
+
+\begin{itemize}
+\item the code for the |dvips| option is executed before that for the
+  |german| option, because that is the order in which they are declared
+  in |fred.sty|;
+\item the code for the |german| option is executed only once, when the
+  declared options are being processed;
+\item the |a4paper| and |errorshow| options produce the warning from
+  the code declared by |\DeclareOption*| (in the order in which they
+  were specified), whilst the |twocolumn| option does not: this is
+  because |twocolumn| is a global option.
+\end{itemize}
+
+In a class file, |\ProcessOptions| works in the same way, except
+that: \emph{all} options are local; and the default value for
+|\DeclareOption*| is |\OptionNotUsed| rather than an error.
+
+\NEWdescription{1995/12/01}
+Note that, because |\ProcessOptions| has a |*|-form, it is wise to
+follow the non-star form with |\relax|, as in the previous examples,
+since this prevents unnecessary look ahead and possibly misleading
+error messages being issued.
+
+\begin{decl}
+  |\ProcessOptions*| \\
+  |\@options|
+\end{decl}
+This is like |\ProcessOptions| but it executes the options in the
+order specified in the calling commands, rather than in the order of
+declaration in the class or package. For a package this means that the
+global options are processed first.
+
+The |\@options| command from \LaTeX~2.09 has been made equivalent to
+this in order to ease the task of updating old document styles to
+\LaTeXe{} class files.
+
+\begin{decl}
+  |\ExecuteOptions| \arg{options-list}
+\end{decl}
+
+For each option in the \m{options-list}, in order,
+this command simply executes the command
+|\ds@<option>| (if this command is not defined, then that option is
+silently ignored).
+
+It can be used to provide a `default option list' just before
+|\ProcessOptions|.  For example, suppose that in a class file you want
+to set up the default design to be: two-sided printing; 11pt fonts;
+in two columns. Then it could specify:
+\begin{verbatim}
+   \ExecuteOptions{11pt,twoside,twocolumn}
+\end{verbatim}
+
+
+\subsection{Safe file commands}
+
+These commands deal with file input; they ensure that the non-existence
+of a requested file can be handled in a user-friendly way.
+
+\begin{decl}
+|\IfFileExists| \arg{file-name} \arg{true} \arg{false}
+\end{decl}
+If the file exists then the code specified in \m{true} is
+executed.
+
+If the file does not exist then the code specified in \m{false} is
+executed.
+
+This command does \emph{not} input the file.
+
+\begin{decl}
+  |\InputIfFileExists| \arg{file-name} \arg{true} \arg{false}
+\end{decl}
+This inputs the file \m{file-name} if it exists and, immediately
+before the input, the code specified in \m{true} is executed.
+
+If the file does not exist then the code specified in \m{false} is
+executed.
+
+It is implemented using |\IfFileExists|.
+
+
+\subsection{Reporting errors, etc}
+
+These commands should be used by third party classes and packages to
+report errors, or to provide information to authors.
+
+\begin{decl}
+  |\ClassError| \arg{class-name} \arg{error-text} \arg{help-text}\\
+  |\PackageError| \arg{package-name} \arg{error-text} \arg{help-text}
+\end{decl}
+These produce an error message.  The \m{error-text} is displayed and the
+|?| error prompt is shown.  If the user types |h|, they will be shown
+the \m{help-text}.
+
+Within the \m{error-text} and \m{help-text}: |\protect| can be used to
+stop a command from expanding; |\MessageBreak| causes a line-break;
+and |\space| prints a space.
+
+Note that the \m{error-text} will have a full stop added to it, so do
+not put one into the argument.
+
+For example:
+\begin{verbatim}
+   \newcommand{\foo}{FOO}
+   \PackageError{ethel}{%
+      Your hovercraft is full of eels,\MessageBreak
+      and \protect\foo\space is \foo
+   }{%
+      Oh dear! Something's gone wrong.\MessageBreak
+      \space \space Try typing \space <<return>>
+      \space to proceed, ignoring \protect\foo.
+   }
+\end{verbatim}
+produces this display:
+\begin{verbatim}
+   ! Package ethel Error: Your hovercraft is full of eels,
+   (ethel)                and \foo is FOO.
+
+   See the ethel package documentation for explanation.
+\end{verbatim}
+If the user types |h|, this will be shown:
+\begin{verbatim}
+   Oh dear! Something's gone wrong.
+     Try typing  <<return>>  to proceed, ignoring \foo.
+\end{verbatim}
+
+\begin{decl}
+  |\ClassWarning| \arg{class-name} \arg{warning-text}\\
+  |\PackageWarning| \arg{package-name} \arg{warning-text}\\
+  |\ClassWarningNoLine| \arg{class-name} \arg{warning-text}\\
+  |\PackageWarningNoLine| \arg{package-name} \arg{warning-text}\\
+  |\ClassInfo| \arg{class-name} \arg{info-text}\\
+  |\PackageInfo| \arg{package-name} \arg{info-text}
+\end{decl}
+The four |Warning| commands are similar to the error commands, except
+that they produce only a warning on the screen, with no error prompt.
+
+The first two, |Warning| versions, also show the line number where the
+warning occurred, whilst the second two, |WarningNoLine| versions, do
+not.
+
+The two |Info| commands are similar except that they log the
+information only in the transcript file, including the line number.
+There are no |NoLine| versions of these two.
+
+Within the \m{warning-text} and \m{info-text}: |\protect| can be used to
+stop a command from expanding; |\MessageBreak| causes a line-break;
+and |\space| prints a space.
+Also, these should not end with a full stop as one is
+automatically added.
+
+
+\subsection{Defining commands}
+\label{Sec:commands.define}
+
+\LaTeXe{} provides some extra methods of (re)defining commands that are
+intended for use in class and package files.
+
+\NEWfeature{1994/12/01}
+The \texttt{*}-forms of these commands should be used to define
+commands that are not, in \TeX{} terms, long.  This can be useful for
+error-trapping with commands whose arguments are not intended to
+contain whole paragraphs of text.
+
+\begin{decl}
+  |\DeclareRobustCommand| \arg{cmd} \oarg{num} \oarg{default}
+     \arg{definition}\\
+  |\DeclareRobustCommand*| \arg{cmd} \oarg{num} \oarg{default}
+     \arg{definition}
+\end{decl}
+This command takes the same arguments as |\newcommand| but it declares
+a robust command, even if some code within the \m{definition} is
+fragile.  You can use this command to define new robust commands, or
+to redefine existing commands and make them robust.  A log is put into
+the transcript file if a command is redefined.
+
+For example, if |\seq| is defined as follows:
+\begin{verbatim}
+   \DeclareRobustCommand{\seq}[2][n]{%
+     \ifmmode
+       #1_{1}\ldots#1_{#2}%
+     \else
+       \PackageWarning{fred}{You can't use \protect\seq\space in text}%
+     \fi
+   }
+\end{verbatim}
+Then the command |\seq| can be used in moving arguments, even though
+|\ifmmode| cannot, for example:
+\begin{verbatim}
+   \section{Stuff about sequences $\seq{x}$}
+\end{verbatim}
+
+Note also that there is no need to put a |\relax| before the
+|\ifmmode| at the beginning of the definition; this is because the
+protection given by this |\relax| against expansion at the wrong time
+will be provided internally.
+
+\begin{decl}
+  |\CheckCommand| \arg{cmd} \oarg{num} \oarg{default}
+     \arg{definition}\\
+  |\CheckCommand*| \arg{cmd} \oarg{num} \oarg{default}
+     \arg{definition}
+\end{decl}
+This takes the same arguments as |\newcommand| but, rather than define
+\m{cmd}, it just checks that the current definition of \m{cmd} is
+exactly as given by \m{definition}.  An error is raised if these
+definitions differ.
+
+This command is useful for checking the state of the system before
+your package starts altering the definitions of commands.  It allows
+you to check, in particular, that no other package has redefined the
+same command.
+
+\subsection{Moving arguments}
+
+\NEWdescription{1994/12/01}
+The setting of protect whilst processing (i.e.~moving) moving arguments
+has been reimplemented, as has the method of writing information from
+the |.aux| file to other files such as the |.toc| file.  Details can
+be found in the file |ltdefns.dtx|.
+
+We hope that these changes will not affect many packages.
+
+\section{Miscellaneous commands, etc}
+\label{Sec:commands.misc}
+
+\subsection{Layout parameters}
+
+\begin{decl}
+|\paperheight|\\
+|\paperwidth|
+\end{decl}
+These two parameters are usually set by the class to be the size of
+the paper being used. This should be actual paper size, unlike
+|\textwidth| and |\textheight| which are the size of the main text
+body within the margins.
+
+
+\subsection{Case changing}
+\label{sec:case}
+
+\begin{decl}
+  |\MakeUppercase| \arg{text} \\
+  |\MakeLowercase| \arg{text}
+\end{decl}
+
+\NEWfeature{1995/06/01}
+\TeX{} provides two primitives |\uppercase| and |\lowercase| for
+changing the case of text.  These are sometimes used in document
+classes, for example to set information in running heads in all
+capitals.
+
+Unfortunately, these \TeX{} primitives do not change the case of
+characters accessed by commands like |\ae| or |\aa|.  To overcome this
+problem, \LaTeX{} provides two new commands |\MakeUppercase| and
+|\MakeLowercase| to do this.
+
+For example:
+\begin{quotation}
+\begin{tabular}{rl}
+   |\uppercase{aBcD\ae\AA\ss\OE}| & \uppercase{aBcD\ae\AA\ss\OE}\\
+   |\lowercase{aBcD\ae\AA\ss\OE}| & \lowercase{aBcD\ae\AA\ss\OE}\\
+   |\MakeUppercase{aBcD\ae\AA\ss\OE}| &
+                                      \MakeUppercase{aBcD\ae\AA\ss\OE}\\
+   |\MakeLowercase{aBcD\ae\AA\ss\OE}| & \MakeLowercase{aBcD\ae\AA\ss\OE}
+\end{tabular}
+\end{quotation}
+
+The commands |\MakeUppercase| and |\MakeLowercase| themselves are
+robust, but they have moving arguments.
+
+The commands use the \TeX{} primitives |\uppercase| and |\lowercase|,
+and so have a number of unexpected `features'.  In particular, they
+change the case of everything (except characters in the names of
+control-sequences) in their text argument: this includes mathematics,
+environment names, and label names.
+
+For example:
+\begin{verbatim}
+   \MakeUppercase{$x+y$ in \ref{foo}}
+\end{verbatim}
+produces $X+Y$ and the warning:
+\begin{verbatim}
+   LaTeX Warning: Reference `FOO' on page ... undefined on ...
+\end{verbatim}
+In the long run, we would like to use all-caps fonts rather than any
+command like |\MakeUppercase| but this is not possible at the moment
+because such fonts do not exist.
+
+\NEWdescription{1995/12/01}
+In order that upper/lower-casing will work reasonably well, and in
+order to provide any correct hyphenation, \LaTeXe{} \emph{must} use,
+throughout a document, the same fixed table for changing case.
+The table used is designed for the font encoding |T1|; this works well
+with the standard \TeX{} fonts for all Latin alphabets but will cause
+problems when using other alphabets.
+
+\subsection{The `openany' option in the `book' class}
+
+\NEWdescription{1996/06/01}
+The |openany| option allows chapter and similar openings to
+occur on left hand pages. Previously this option affected only
+|\chapter| and |\backmatter|.  It now also affects
+|\part|, |\frontmatter| and |\mainmatter|.
+
+\subsection{Better user-defined math display environments}
+
+\begin{decl}
+  |\ignorespacesafterend|
+\end{decl}
+
+\NEWfeature{1996/12/01}
+\NEWdescription{2003/12/01}
+Suppose that you want to define an environment for displaying text
+that is numbered as an equation.  A straightforward way to do this is
+as follows:
+\begin{verbatim}
+  \newenvironment{texteqn}
+    {\begin{equation}
+       \begin{minipage}{0.9\linewidth}}
+      {\end{minipage}
+     \end{equation}}
+\end{verbatim}
+However, if you have tried this then you will probably have noticed
+that it does not work perfectly when used in the middle of a paragraph
+because an inter-word space appears at the beginning of the first
+line after the environment.
+
+There is now an extra command (with a very long name) available that
+you can use to avoid this problem; it should be inserted as shown here:
+\begin{verbatim}
+  \newenvironment{texteqn}
+    {\begin{equation}
+       \begin{minipage}{0.9\linewidth}}
+      {\end{minipage}
+     \end{equation}
+     \ignorespacesafterend}
+\end{verbatim}
+
+This command may also have other uses.
+
+\subsection{Normalising spacing}
+
+\begin{decl}
+  |\normalsfcodes|
+\end{decl}
+
+\NEWfeature{1997/06/01}
+This command should be used to restore the normal settings of the
+parameters that affect spacing between words, sentences, etc.
+
+An important use of this feature is to correct a problem, reported by
+Donald Arseneau, that punctuation in page headers has always (in all
+known \TeX{} formats) been potentially wrong whenever a page break
+happens while a local setting of the space codes is in effect.  These
+space codes are changed by, for example, the command
+\verb|\frenchspacing|) and the \textsf{verbatim} environment.
+
+It is normally given the correct definition automatically in
+|\begin{document}| and so need not be explicitly set; however, if it
+is explicitly made nonempty in a class file then automatic
+default setting will be over-ridden.
+
+
+\section{Upgrading \LaTeX~2.09 classes and packages}
+\label{Sec:upgrade}
+
+This section describes the changes you may need to make when you
+upgrade an existing \LaTeX{} style to a package or class but we shall
+start in optimistic mode.
+
+Many existing style files will run with \LaTeXe{} without any
+modification to the file itself.  When everything is running OK,
+please put a note in the newly created package or class file to record
+that it runs with the new standard \LaTeX{}; then distribute it to
+your users.
+
+\subsection{Try it first!}
+\label{Sec:try-it}
+
+The first thing you should do is to test your style in `compatibility
+mode'.  The only change you need to make in order to do this is,
+possibly, to change the extension of the file to |.cls|: you should
+make this change only if your file was used as a main document style.
+Now, without any other modifications, run \LaTeXe{} on a document that
+uses your file.  This assumes that you have a suitable collection of
+files that tests all the functionality provided by your style file.
+(If you haven't, now is the time to make one!)
+
+You now need to change the test document files so that they are
+\LaTeXe{} documents: see \emph{\usrguide} for details of how to do
+this and then try them again.  You have now tried the test documents
+in both \LaTeXe{} native mode and \LaTeX~2.09 compatibility mode.
+
+\subsection{Troubleshooting}
+\label{Sec:trouble}
+
+If your file does not work with \LaTeXe{}, there are two likely
+reasons.
+\begin{itemize}
+\item \LaTeX{} now has a robust, well-defined designer's interface for
+  selecting fonts, which is very different from the \LaTeX~2.09
+  internals.
+\item Your style file may have used some \LaTeX~2.09 internal commands
+  which have changed, or which have been removed.
+\end{itemize}
+
+When you are debugging your file, you will probably need more
+information than is normally displayed by \LaTeXe.  This is achieved
+by resetting the counter |errorcontextlines| from its default value of
+$-1$ to a much higher value, e.g.~999.
+
+\subsection{Accommodating compatibility mode}
+
+Sometimes an existing collection of \LaTeX~2.09 documents makes it
+inconvenient or impossible to abandon the old commands entirely.
+If this is the case, then it is possible to accommodate both conventions
+by making special provision for documents processed in compatibility
+mode.
+
+\begin{decl}
+|\if at compatibility|
+\end{decl}
+This switch is set when a document begins with |\documentstyle| rather
+than |\documentclass|.  Appropriate code can be supplied for either
+condition, as follows:
+\begin{verbatim}
+   \if at compatibility
+     <code emulating LaTeX 2.09 behavior>
+   \else
+     <code suitable for LaTeX2e>
+   \fi
+\end{verbatim}
+
+
+\subsection{Font commands}
+
+Some font and size commands are now defined by the document class
+rather than by the \LaTeX{} kernel.  If you are upgrading a
+\LaTeX~2.09 document style to a class that does not load one of the
+standard classes, then you will probably need to add definitions for
+these commands.
+
+\begin{decl}
+   |\rm| |\sf| |\tt| |\bf| |\it| |\sl| |\sc|
+\end{decl}
+None of these short-form font selection commands are defined in the
+\LaTeXe{} kernel.  They are defined by all the standard class files.
+
+If you want to define them in your class file, there are several
+reasonable ways to do this.
+
+One possible definition is:
+\begin{verbatim}
+   \newcommand{\rm}{\rmfamily}
+   ...
+   \newcommand{\sc}{\scshape}
+\end{verbatim}
+This would make the font commands orthogonal; for example
+|{\bf\it text}| would produce bold italic, thus: \textbf{\textit{text}}.
+It will also make them produce an error if used in math mode.
+
+Another possible definition is:
+\begin{verbatim}
+   \DeclareOldFontCommand{\rm}{\rmfamily}{\mathrm}
+   ...
+   \DeclareOldFontCommand{\sc}{\scshape}{\mathsc}
+\end{verbatim}
+This will make |\rm| act like |\rmfamily| in text mode (see above) and
+it will make |\rm| select the |\mathrm| math alphabet in math mode.
+
+Thus |${\rm math} = X + 1$| will produce `${\rm math} = X + 1$'.
+
+If you do not want font selection to be orthogonal then you can
+follow the standard classes and define:
+\begin{verbatim}
+   \DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
+   ...
+   \DeclareOldFontCommand{\sc}{\normalfont\scshape}{\mathsc}
+\end{verbatim}
+This means, for example, that |{\bf\it text}| will produce medium
+weight (rather than bold) italic, thus: \textit{text}.
+
+\begin{decl}
+   |\normalsize| \\
+   |\@normalsize|
+\end{decl}
+The command |\@normalsize| is retained for compatibility with
+\LaTeX~2.09 packages which may have used its value; but redefining it
+in a class file will have no effect since it is always reset to have
+the same meaning as |\normalsize|.
+
+This means that classes \emph{must} now redefine |\normalsize| rather
+than redefining |\@normalsize|; for example (a rather incomplete one):
+\begin{verbatim}
+   \renewcommand{\normalsize}{\fontsize{10}{12}\selectfont}
+\end{verbatim}
+Note that |\normalsize| is defined by the \LaTeX{} kernel to be an
+error message.
+
+\begin{decl}
+   |\tiny| |\footnotesize| |\small| |\large|\\
+   |\Large| |\LARGE| |\huge| |\Huge|
+\end{decl}
+None of these other `standard' size-changing commands are defined in
+the kernel: each needs to be defined in a class file if you need it.
+They are all defined by the standard classes.
+
+This means you should use |\renewcommand| for |\normalsize| and
+|\newcommand| for the other size-changing commands.
+
+
+\subsection{Obsolete commands}
+
+Some packages will not work with \LaTeXe{}, normally because they relied
+on an internal \LaTeX{} command which was never supported and has now
+changed, or been removed.
+
+In many cases there will now be a robust, high-level means of
+achieving what previously required low-level commands.  Please consult
+Section~\ref{Sec:commands} to see if you can now use the \LaTeXe{}
+class and package writers commands.
+
+Also, of course, if your package or class redefined any of the kernel
+commands (i.e.~those defined in the files |latex.tex|, |slitex.tex|,
+|lfonts.tex|, |sfonts.tex|) then you will need to check it very
+carefully against the new kernel in case the implementation has
+changed or the command no longer exists in the \LaTeX2e{} kernel.
+
+Too many of the internal commands of \LaTeX~2.09 have been
+re-implemented or removed to be able to list them all here. You must
+check any that you have used or changed.
+
+We shall, however, list some of the more important commands which are
+no longer supported.
+
+\begin{decl}
+   |\tenrm| |\elvrm| |\twlrm| \dots\\
+   |\tenbf| |\elvbf| |\twlbf| \dots\\
+   |\tensf| |\elvsf| |\twlsf| \dots\\
+   \qquad$\vdots$
+\end{decl}
+The (approximately) seventy internal commands of this form are no longer
+defined.  If your class or package uses them then \emph{please}
+replace them with new font commands described in \emph{\fntguide}.
+
+For example, the command |\twlsf| should be replaced by:
+\begin{verbatim}
+   \fontsize{12}{14}\normalfont\sffamily\selectfont
+\end{verbatim}
+
+Another possibility is to use the |rawfonts| package, described in
+\emph{\usrguide}.
+
+Also, remember that many of the fonts preloaded by \LaTeX~2.09
+are no longer preloaded.
+
+\begin{decl}
+   |\vpt| |\vipt| |\viipt| \dots
+\end{decl}
+These were the internal size-selecting commands in \LaTeX~2.09.
+(They can still be used in \LaTeX~2.09 compatibility mode.)
+Please use the command |\fontsize| instead: see \emph{\fntguide} for
+details.
+
+For example, |\vpt| should be replaced by:
+\begin{verbatim}
+   \fontsize{5}{6}\normalfont\selectfont
+\end{verbatim}
+
+\begin{decl}
+  |\prm|, |\pbf|, |\ppounds|, |\pLaTeX| \dots
+\end{decl}
+\LaTeX~2.09 used several commands beginning with |\p| in order to
+provide `protected' commands.  For example, |\LaTeX| was defined to be
+|\protect\pLaTeX|, and |\pLaTeX| was defined to produce the \LaTeX{}
+logo.  This made |\LaTeX| robust, even though |\pLaTeX| was not.
+
+These commands have now been reimplemented using
+|\DeclareRobustCommand|
+(described in Section~\ref{Sec:commands.define}).
+If your package redefined one of the |\p|-commands then you must
+remove the redefinition and use |\DeclareRobustCommand| to redefine the
+non-|\p| command.
+
+\begin{decl}
+|\footheight|\\
+|\@maxsep|\\
+|\@dblmaxsep|
+\end{decl}
+These parameters are not used by \LaTeXe{} so they have been removed,
+except in \LaTeX~2.09 compatibility mode.  Classes should no longer
+set them.
+
+\begin{thebibliography}{1}
+
+\bibitem{A-W:DEK91}
+Donald~E. Knuth.
+\newblock {\em The \TeX book}.
+\newblock Addison-Wesley, Reading, Massachusetts, 1986.
+\newblock Revised to cover \TeX3, 1991.
+
+\bibitem{A-W:LLa94}
+Leslie Lamport.
+\newblock {\em {\LaTeX:} A Document Preparation System}.
+\newblock Addison-Wesley, Reading, Massachusetts, second edition, 1994.
+
+\bibitem{A-W:MG2004}
+Frank Mittelbach and Michel Goossens.
+\newblock {\em The {\LaTeX} Companion second edition}.
+\newblock With Johannes Braams, David Carlisle, and Chris Rowley.
+\newblock Addison-Wesley, Reading, Massachusetts, 2004.
+
+\end{thebibliography}
+
+\newpage
+\thispagestyle{empty}
+
+\section*{\LaTeXe{} Summary sheet: updating old styles}
+
+Section references below are to \emph{\clsguide}.
+
+\begin{enumerate}
+
+\item Should it become a class or a package?
+  See Section~\ref{Sec:classorpkg} for how to answer this question.
+
+\item If it uses another style file, then you will need to obtain an
+  updated version of this other file.  Look at Section~\ref{Sec:loading}
+  for information on how to load other class and package files.
+
+\item Try it: see Section~\ref{Sec:try-it}.
+
+\item It worked?  Excellent, but there are probably still some things
+  you should change in order to make your file into a well-structured
+  \LaTeXe{} file that is both robust and portable. So you should now
+  read Section~\ref{Sec:writing}, especially~\ref{Sec:general}.  You
+  will also find some useful examples in Section~\ref{Sec:structure}.
+
+  If your file sets up new fonts, font-changing commands or symbols,
+  you should also read \emph{\fntguide}.
+
+\item It did not work?  There are three possibilities here:
+  \begin{itemize}
+  \item  error messages are produced whilst reading your file;
+  \item  error messages are produced whilst processing test documents;
+  \item  there are no errors but the output is not as it should be.
+  \end{itemize}
+  Don't forget to check carefully for this last possibility.
+
+  If you have got to this stage then you will need to read
+  Section~\ref{Sec:upgrade} to find the solutions that will make your
+  file work.
+\end{enumerate}
+
+\end{document}


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

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/clsguide.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/clsguide.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/clsguide.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2023
+% Copyright (C) 2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %
@@ -28,22 +28,33 @@
 % \fi
 % Filename: clsguide.tex
 
-\NeedsTeXFormat{LaTeX2e}[1995/12/01]
+\documentclass{ltxguide}
 
-\documentclass{ltxguide}[1995/11/28]
+\usepackage[T1]{fontenc}  % needed for \textbackslash in tt
+\usepackage{csquotes}
 
-\title{\LaTeXe~for class and package writers}
-
-\author{Copyright \copyright~1995--2006 The \LaTeX\ Project\\
+\title{\LaTeX\ for package and class authors --- current version}
+\author{\copyright~Copyright 2023, \LaTeX\ Project Team.\\
    All rights reserved.%
-   \footnote{This file may be distributed and/or modified under the
+   \footnote{This file may distributed and/or modified under the
      conditions of the \LaTeX{} Project Public License, either version 1.3c
      of this license or (at your option) any later version. See the source
     \texttt{clsguide.tex} for full details.}%
 }
 
-\date{15 February 2006}
+\date{2023-01-12}
 
+\NewDocumentCommand\cs{m}{\texttt{\textbackslash\detokenize{#1}}}
+\NewDocumentCommand\marg{m}{\arg{#1}}
+\NewDocumentCommand\meta{m}{\ensuremath{\langle}\textit{#1}\ensuremath{\rangle}}
+\NewDocumentCommand\pkg{m}{\textsf{#1}}
+\NewDocumentCommand\text{m}{\ifmmode\mbox{#1}\else#1\fi}
+% Fix a 'feature'
+\makeatletter
+\renewcommand \verbatim at font {\normalfont \ttfamily}
+\makeatother
+\providecommand\url[1]{\texttt{#1}}
+
 \begin{document}
 
 \maketitle
@@ -52,106 +63,75 @@
 
 \section{Introduction}
 
-This document is an introduction to writing classes and packages for
-\LaTeX{}, with special attention given to upgrading existing
-\LaTeX~2.09 packages to \LaTeXe{}.  The latter subject is also
-covered in an article by Johannes Braams published in TUGboat~15.3.
+\LaTeXe{} was released in 1994 and added a number of then-new concepts to
+\LaTeX{}. For package and class authors, these are described in
+\texttt{clsguide-historic}, which has largely remained unchanged. Since then,
+the \LaTeX{} team have worked on a number of ideas, firstly a programming
+language for \LaTeX{} (L3 programming layer) and then a range of tools for
+authors which build on that language. Here, we describe the current, stable set
+of tools provided by the \LaTeX{} kernel for package and class developers. We
+assume familiarity with general \LaTeX{} usage as a document author, and that
+the material here is read in conjunction with \texttt{usrguide}, which provides
+information for general \LaTeX{} users on up-to-date approaches to creating
+commands, etc.
 
-\subsection{Writing classes and packages for \LaTeXe}
+\section{Writing classes and packages}
+\label{Sec:writing}
 
-\LaTeX{} is a document preparation system that enables the document
-writer to concentrate on the contents of their text, without bothering
-too much about the formatting of it.  For example, chapters are
-indicated by |\chapter{<title>}| rather than by selecting 18pt bold.
+This section covers some general points concerned with writing
+\LaTeX{} classes and packages.
 
-The file that contains the information about how to turn logical
-structure (like `|\chapter|') into formatting (like `18pt bold ragged
-right') is a \emph{document class}.  In addition, some features (such
-as colour or included graphics) are independent of the document class
-and these are contained in \emph{packages}.
+\subsection{Is it a class or a package?}
+\label{Sec:classorpkg}
 
-One of the largest differences between \LaTeX~2.09 and \LaTeXe{} is in
-the commands used to write packages and classes.  In \LaTeX~2.09,
-there was very little support for writing |.sty| files, and so writers
-had to resort to using low-level commands.
+The first thing to do when you want to put some new \LaTeX{} commands
+in a file is to decide whether it should be a \emph{document class} or a
+\emph{package}.  The rule of thumb is:
+\begin{quote}
+  If the commands could be used with any document class, then make
+  them a package; and if not, then make them a class.
+\end{quote}
 
-\LaTeXe{} provides high-level commands for structuring packages.
-It is also much easier to build classes and packages on top of each
-other, for example writing a local technical report class |cetechr|
-(for the Chemical Engineering department) based on |article|.
+There are two major types of class: those like |article|, |report| or
+|letter|, which are free-standing; and those which are extensions or
+variations of other classes---for example, the |proc| document class,
+which is built on the |article| document class.
 
-\subsection{Overview}
+Thus, a company might have a local |ownlet| class for printing letters
+with their own headed note-paper.  Such a class would build on top of
+the existing |letter| class but it cannot be used with any other
+document class, so we have |ownlet.cls| rather than |ownlet.sty|.
 
-This document contains an overview of how to write classes and
-packages for \LaTeX{}.  It does \emph{not} introduce all of the
-commands necessary to write packages: these can be found in either
-\emph{\LaTeXbook} or \emph{\LaTeXcomp}.  But it does describe the new
-commands for structuring classes and packages.
+The |graphics| package, in contrast, provides commands for including
+images into a \LaTeX{} document.  Since these commands can be used
+with any document class, we have |graphics.sty| rather than
+|graphics.cls|.
 
-\begin{description}
+\subsection{Using `docstrip' and `doc'}
 
-\item[Section~\ref{Sec:general}] contains some general advice about
-  writing classes and packages.  It describes the difference between
-  classes and packages, the command naming conventions, the use of
-  |doc| and |docstrip|, how \TeX's primitive file and box commands
-  interact with \LaTeX{}. It also contains some hints about general
-  \LaTeX{} style.
+If you are going to write a large class or package for \LaTeX{} then
+you should consider using the |doc| software which comes with
+\LaTeX{}.
+\LaTeX{} classes and packages written using this can be
+processed in two ways: they can be run through \LaTeX{}, to produce
+documentation; and they can be processed with |docstrip|, to produce
+the |.cls| or |.sty| file.
 
-\item[Section~\ref{Sec:structure}] describes the structure of classes
-  and packages.  This includes building classes and packages on top of
-  other classes and packages, declaring options and declaring
-  commands.  It also contains example classes.
+The |doc| software can automatically generate indexes of definitions,
+indexes of command use, and change-log lists.  It is very useful for
+maintaining and documenting large \TeX{} sources.
 
-\item[Section~\ref{Sec:commands}] lists the new class and package
-   commands.
+The documented sources of the \LaTeX{} kernel itself, and of the
+standard classes, etc., are |doc| documents; they are in the |.dtx|
+files in the distribution.  You can, in fact, typeset the source code
+of the kernel as one long document, complete with index, by running
+\LaTeX{} on |source2e.tex|.  Typesetting these documents uses the
+class file |ltxdoc.cls|.
 
- \item[Section~\ref{Sec:upgrade}] gives detailed advice on how to
-   upgrade existing \LaTeX~2.09 classes and packages to \LaTeXe{}.
+For more information on |doc| and |docstrip|, consult the files
+|docstrip.dtx|, |doc.dtx|, and \emph{\LaTeXcomp}.  For examples of its
+use, look at the |.dtx| files.
 
-\end{description}
-
-\subsection{Further information}
-
-For a general introduction to \LaTeX{}, including the new features of
-\LaTeXe{}, you should read \emph{\LaTeXbook}
-by Leslie Lamport~\cite{A-W:LLa94}.
-
-A more detailed description of the new features of \LaTeX, including an
-overview of more than 200 packages and nearly 1000 ready to run examples, is
-to be found in \emph{\LaTeXcomp\ second edition} by Frank Mittelbach and
-Michel Goossens~\cite{A-W:MG2004}.
-
-The \LaTeX{} system is based on \TeX{}, which is
-described in \emph{The \TeX book} by Donald E.~Knuth~\cite{A-W:DEK91}.
-
-There are a number of documentation files which accompany every copy
-of \LaTeX{}.  A copy of \emph{\LaTeX{} News} will come out with each
-six-monthly release of \LaTeX{}, and is found in the files
-|ltnews*.tex|.  The author's guide \emph{\usrguide} describes the new
-\LaTeX{} document features; it is in |usrguide.tex|.  The guide
-\emph{\fntguide} describes the \LaTeX{} font selection scheme for
-class- and package-writers; it is in |fntguide.tex|. Configuring
-\LaTeX{} is covered by the guide \emph{\cfgguide} in
-\texttt{cfgguide.tex} whilst the philosophy behind our policy on
-modifying \LaTeX{} is described in \emph{\modguide} in
-\texttt{modguide.tex}.
-
-The documented source code (from the files used to produce the kernel
-format via |latex.ltx|) is now available as
-\emph{The \LaTeXe\ Sources}.
-This very large document also includes an index of
-\LaTeX{} commands.  It can be typeset from the \LaTeX{} file
-|source2e.tex| in the |base| directory, using the source files and
-the class file |ltxdoc.cls| from this directory.
-
-For more information about \TeX{} and \LaTeX{}, please contact your
-local \TeX{} Users Group, or the international \TeX{} Users Group.
-Addresses and other details can be found at:
-\begin{quote}\small\label{addrs}
-    \texttt{http://www.tug.org/lugs.html}
-\end{quote}
-
-
 \subsection{Policy on standard classes}
 
 Many of the problem reports we receive concerning the standard classes
@@ -182,89 +162,10 @@
 thought when you consider such a deficiency will, we hope, be ``what
 can I do to improve this?''
 
-Similar considerations apply to those parts of the kernel that are
-implementing design decisions, many of which should be left to the
-class file but are not in the current system.  We realise that in such
-cases it is much more difficult for you to rectify the problem
-yourself but it is also the case that making such changes in the
-kernel would probably be a major project for us; therefore such
-enhancements will have to wait for \LaTeX3.
-
-\section{Writing classes and packages}
-\label{Sec:writing}
-
-This section covers some general points concerned with writing
-\LaTeX{} classes and packages.
-
-
-\subsection{Old versions}
-
-If you are upgrading an existing \LaTeX~2.09 style file then we
-recommend freezing the 2.09 version and no longer maintaining it.
-Experience with the various dialects of \LaTeX{} which existed in the
-early 1990's suggests that maintaining packages for different versions
-of \LaTeX{} is almost impossible.  It will, of course, be necessary
-for some organisations to maintain both versions in parallel for some
-time but this is not essential for those packages and classes
-supported by individuals: they should support only the new standard
-\LaTeXe{}, not obsolete versions of \LaTeX{}.
-
-
-\subsection{Using `docstrip' and `doc'}
-
-If you are going to write a large class or package for \LaTeX{} then
-you should consider using the |doc| software which comes with
-\LaTeX{}.
-\LaTeX{} classes and packages written using this can be
-processed in two ways: they can be run through \LaTeX{}, to produce
-documentation; and they can be processed with |docstrip|, to produce
-the |.cls| or |.sty| file.
-
-The |doc| software can automatically generate indexes of definitions,
-indexes of command use, and change-log lists.  It is very useful for
-maintaining and documenting large \TeX{} sources.
-
-The documented sources of the \LaTeX{} kernel itself, and of the
-standard classes, etc, are |doc| documents; they are in the |.dtx|
-files in the distribution.  You can, in fact, typeset the source code
-of the kernel as one long document, complete with index, by running
-\LaTeX{} on |source2e.tex|.  Typesetting these documents uses the
-class file |ltxdoc.cls|.
-
-For more information on |doc| and |docstrip|, consult the files
-|docstrip.dtx|, |doc.dtx|, and \emph{\LaTeXcomp}.  For examples of its
-use, look at the |.dtx| files.
-
-\subsection{Is it a class or a package?}
-\label{Sec:classorpkg}
-
-The first thing to do when you want to put some new \LaTeX{} commands
-in a file is to decide whether it should be a \emph{document class} or a
-\emph{package}.  The rule of thumb is:
-\begin{quote}
-  If the commands could be used with any document class, then make
-  them a package; and if not, then make them a class.
-\end{quote}
-
-There are two major types of class: those like |article|, |report| or
-|letter|, which are free-standing; and those which are extensions or
-variations of other classes---for example, the |proc| document class,
-which is built on the |article| document class.
-
-Thus, a company might have a local |ownlet| class for printing letters
-with their own headed note-paper.  Such a class would build on top of
-the existing |letter| class but it cannot be used with any other
-document class, so we have |ownlet.cls| rather than |ownlet.sty|.
-
-The |graphics| package, in contrast, provides commands for including
-images into a \LaTeX{} document.  Since these commands can be used
-with any document class, we have |graphics.sty| rather than
-|graphics.cls|.
-
-
 \subsection{Command names}
 
-\LaTeX{} has three types of command.
+Prior to the introduction of the L3~programming layer described in the next
+section, \LaTeX{} had three types of command.
 
 There are the author commands, such as |\section|, |\emph| and
 |\times|:  most of these have short names, all in lower case.
@@ -289,118 +190,98 @@
 its name then it is not part of the supported \LaTeX{} language---and
 its behaviour may change in future releases!  If a command is
 mixed-case, or is described in \emph{\LaTeXbook}, then you can rely on
-future releases of \LaTeXe{} supporting the command.
+future releases of \LaTeX{} supporting the command.
 
-\subsection{Box commands and colour}
-\label{Sec:colour}
+\subsection{Programming support}
 
-Even if you do not intend to use colour in your own documents, by
-taking note of the points in this section you can ensure that your
-class or package is compatible with the |color| package. This may
-benefit people using your class or package who have access to colour
-printers.
+As noted in the introduction, the \LaTeX{} kernel today loads dedicated support
+from programming, here referred to as the L3 programming layer but also often
+called \pkg{expl3}. Details of the general approach taken by the L3
+programming layer are given in the document \texttt{expl3}, while a reference
+for all current code interfaces is available as \texttt{interface3}. This layer
+contains two types of command: a documented set of commands making up the API
+and a large number of private internal commands. The latter all start with two
+underscores and should not be used outside of the code module which defines
+them. This more structured approach means that using the L3 programming layer
+does not suffer from the somewhat fluid situation mentioned above with
+`\texttt{@} commands'.
 
-The simplest way to ensure `colour safety' is to always use \LaTeX{}
-box commands rather than \TeX{} primitives, that is use |\sbox| rather
-than |\setbox|, |\mbox| rather than |\hbox| and |\parbox| or
-the |minipage| environment rather than |\vbox|.
-The \LaTeX{} box commands have new options which mean that they are now
-as powerful as the \TeX{} primitives.
+We do not cover the detail of using the L3 programming layer here. A good
+introduction to the approach is provided at
+\url{https://www.alanshawn.com/latex3-tutorial/}.
 
-As an example of what can go wrong, consider that in
-|{\ttfamily <text>}|
-the font is restored just \emph{before} the |}|, whereas in the
-similar looking construction
-|{\color{green} <text>}|
-the colour is restored just \emph{after} the final |}|. Normally this
-distinction does not matter at all; but consider a primitive \TeX{}
-box assignment such as:
+\subsection{Box commands and color}
+\label{Sec:color}
+
+Even if you do not intend to use color in your own documents, by taking note of
+the points in this section you can ensure that your class or package is
+compatible with the |color| package. This may benefit people using your class
+or package and wish to use color.
+
+The simplest way to ensure `color safety' is to always use \LaTeX{} box
+commands rather than \TeX{} primitives, that is use |\sbox| rather than
+|\setbox|, |\mbox| rather than |\hbox| and |\parbox| or the |minipage|
+environment rather than |\vbox|. The \LaTeX{} box commands have new options
+which mean that they are now as powerful as the \TeX{} primitives.
+
+As an example of what can go wrong, consider that in |{\ttfamily <text>}| the
+font is restored just \emph{before} the |}|, whereas in the similar looking
+construction |{\color{green} <text>}| the color is restored just \emph{after}
+the final |}|. Normally this distinction does not matter at all; but consider a
+primitive \TeX{} box assignment such as:
 \begin{verbatim}
    \setbox0=\hbox{\color{green} <text>}
 \end{verbatim}
-Now the colour-restore occurs after the |}| and so is \emph{not}
-stored in the box. Exactly what bad effects this can have depends on
-how colour is implemented: it can range from getting the wrong
-colours in the rest of the document, to causing errors in the
-dvi-driver used to print the document.
+Now the color-restore occurs after the |}| and so is \emph{not} stored in the
+box. Exactly what bad effects this can have depends on how color is
+implemented: it can range from getting the wrong colors in the rest of the
+document, to causing errors in the dvi-driver used to print the document.
 
-Also of interest is the command |\normalcolor|.   This is
-normally just |\relax| (i.e., does nothing)
-but you can use it rather like |\normalfont| to
-set regions of the page such as captions or section headings to the
-`main document colour'.
+Also of interest is the command |\normalcolor|. This is normally just |\relax|
+(i.e., does nothing) but you can use it rather like |\normalfont| to set
+regions of the page such as captions or section headings to the `main document
+color'.
 
-
-\subsection{Defining text and math characters}
-\label{Sec:chars}
-
-Because \LaTeXe{} supports different encodings, definitions of commands
-for producing symbols, accents, composite glyphs, etc.\ must be
-defined using the commands provided for this purpose and described in
-\emph{\fntguide}.  This part of the system is still under development
-so such tasks should be undertaken with great caution.
-
-Also, |\DeclareRobustCommand| should be used for encoding-independent
-commands of this type.
-
-Note that it is no longer possible to refer to the math font set-up
-outside math mode: for example, neither |\textfont 1| nor
-|\scriptfont 2| are guaranteed to be defined in other modes.
-
-
 \subsection{General style}
 \label{Sec:general}
 
-The new system provides many commands designed to help you produce
-well-structured class and package files that are both robust and
-portable.  This section outlines some ways to make intelligent use of
-these.
+\LaTeX{} provides many commands designed to help you produce well-structured
+class and package files that are both robust and portable. This section
+outlines some ways to make intelligent use of these.
 
 \subsubsection{Loading other files}
 \label{Sec:loading}
 
-\NEWdescription{1995/12/01}
 \LaTeX{} provides these commands:
 \begin{verbatim}
    \LoadClass        \LoadClassWithOptions
    \RequirePackage   \RequirePackageWithOptions
 \end{verbatim}
-for using classes or packages inside other classes or packages.  We
-recommend strongly that you use them, rather than the primitive
-|\input| command, for a number of reasons.
+for using classes or packages inside other classes or packages. We recommend
+strongly that you use them, rather than the primitive |\input| command, for a
+number of reasons.
 
-Files loaded with |\input <filename>| will not be listed in the
-|\listfiles| list.
+Files loaded with |\input <filename>| will not be listed in the |\listfiles|
+list.
 
-If a package is always loaded with |\RequirePackage...| or |\usepackage|
-then, even if its loading is requested several times, it will be
-loaded only once.  By contrast, if it is loaded with |\input| then it
-can be loaded more than once; such an extra loading may waste time and
-memory and it may produce strange results.
+If a package is always loaded with |\RequirePackage...| or |\usepackage| then,
+even if its loading is requested several times, it will be loaded only once. By
+contrast, if it is loaded with |\input| then it can be loaded more than once;
+such an extra loading may waste time and memory and it may produce strange
+results.
 
-If a package provides option-processing then, again, strange results
-are possible if the package is |\input| rather than loaded by means of
+If a package provides option-processing then, again, strange results are
+possible if the package is |\input| rather than loaded by means of
 |\usepackage| or |\RequirePackage...|.
 
-If the package |foo.sty| loads the package |baz.sty| by use of
-|\input baz.sty| then the user will get a warning:
+If the package |foo.sty| loads the package |baz.sty| by use of |\input baz.sty|
+then the user will get a warning:
 \begin{verbatim}
    LaTeX Warning: You have requested package `foo',
                   but the package provides `baz'.
 \end{verbatim}
-Thus, for several reasons, using |\input| to load packages is not a
-good idea.
+Thus, for several reasons, using |\input| to load packages is not a good idea.
 
-Unfortunately, if you are upgrading the file |myclass.sty| to a class
-file then you have to make sure that any old files which contain
-|\input myclass.sty| still work.
-
-This was also true for the standard classes (|article|, |book| and
-|report|), since a lot of existing \LaTeX~2.09 document styles contain
-|\input article.sty|.  The approach which we use to solve this is
-to provide minimal files |article.sty|, |book.sty| and |report.sty|,
-which simply load the appropriate class files.
-
 For example, |article.sty| contains just the following lines:
 \begin{verbatim}
    \NeedsTeXFormat{LaTeX2e}
@@ -407,8 +288,8 @@
    \@obsoletefile{article.cls}{article.sty}
    \LoadClass{article}
 \end{verbatim}
-You may wish to do the same or, if you think that it is safe to do so,
-you may decide to just remove |myclass.sty|.
+You may wish to do the same or, if you think that it is safe to do so, you may
+decide to just remove |myclass.sty|.
 
 \subsubsection{Make it robust}
 
@@ -415,85 +296,64 @@
 We consider it good practice, when writing packages and classes, to use
 \LaTeX{} commands as much as possible.
 
-Thus, instead of using |\def...| we recommend using one of
-|\newcommand|, |\renewcommand| or |\providecommand|; |\CheckCommand| is
-also useful. Doing this makes
-it less likely that you will inadvertently redefine a command, giving
-unexpected results.
+Thus, instead of using |\def...| we recommend using one of |\newcommand|,
+|\renewcommand| or |\providecommand| for programming and for defining document
+interfaces |\NewDocumentCommand|, etc. (see \texttt{usrguide} for details of
+these commands).
 
-When you define an environment, use |\newenvironment| or
-|\renewenvironment| instead |\def\foo{...}| and |\def\endfoo{...}|.
+When you define an environment, use |\NewDocumentEnvironment|, etc., (or
+|\newenvironment|, etc., for simple cases) instead of using |\def\foo{...}| and
+|\def\endfoo{...}|.
 
-If you need to set or change the value of a \m{dimen} or \m{skip}
-register, use |\setlength|.
+If you need to set or change the value of a \m{dimen} or \m{skip} register, use
+|\setlength|.
 
-To manipulate boxes, use \LaTeX{} commands such as |\sbox|,
-|\mbox| and |\parbox| rather than |\setbox|, |\hbox| and |\vbox|.
+To manipulate boxes, use \LaTeX{} commands such as |\sbox|, |\mbox| and
+|\parbox| rather than |\setbox|, |\hbox| and |\vbox|.
 
-Use |\PackageError|, |\PackageWarning| or |\PackageInfo| (or the
-equivalent class commands) rather than |\@latexerr|, |\@warning| or
-|\wlog|.
+Use |\PackageError|, |\PackageWarning| or |\PackageInfo| (or the equivalent
+class commands) rather than |\@latexerr|, |\@warning| or |\wlog|.
 
-It is still possible to declare options by defining |\ds@<option>| and
-calling |\@options|; but we recommend the |\DeclareOption| and
-|\ProcessOptions| commands instead.  These are more powerful and use
-less memory.  So rather than using:
-\begin{verbatim}
-   \def\ds at draft{\overfullrule 5pt}
-   \@options
-\end{verbatim}
-you should use:
-\begin{verbatim}
-   \DeclareOption{draft}{\setlength{\overfullrule}{5pt}}
-   \ProcessOptions\relax
-\end{verbatim}
+The advantage of this kind of practice is that your code is more readable and
+accessible to other experienced \LaTeX{} programmers.
 
-The advantage of this kind of practice is that your code is more
-readable and, more important, that it is less likely to break when
-used with future versions of \LaTeX{}.
-
 \subsubsection{Make it portable}
 
-It is also sensible to make your files are as portable as possible. To
-ensure this; they should contain only visible 7-bit text; and the
-filenames should contain at most eight characters (plus the three
-letter extension).  Also, of course, it \textbf{must not} have the
-same name as a file in the standard \LaTeX{} distribution, however
-similar its contents may be to one of these files.
+It is also sensible to make your files are as portable as possible. To ensure
+this, files must not have the same name as a file in the standard \LaTeX{}
+distribution, however similar its contents may be to one of these files. It is
+also still lower risk to stick to file names which use only the ASCII range:
+whilst \LaTeX{} works natively with UTF-8, the same cannot be said with
+certainty for all tools. For the same reason, avoid spaces in file names.
 
-It is also useful if local classes or packages have a common prefix,
-for example the University of Nowhere classes might begin with |unw|.
-This helps to avoid every University having its own thesis class, all
-called |thesis.cls|.
+It is also useful if local classes or packages have a common prefix, for
+example the University of Nowhere classes might begin with |unw|. This helps to
+avoid every University having its own thesis class, all called |thesis.cls|.
 
 If you rely on some features of the \LaTeX{} kernel, or on a package,
 please specify the release-date you need.  For example, the package
-error commands were introduced in the June 1994 release so, if you use
+error commands were introduced in the June 2022 release so, if you use
 them then you should put:
 \begin{verbatim}
-   \NeedsTeXFormat{LaTeX2e}[1994/06/01]
+   \NeedsTeXFormat{LaTeX2e}[2022-06-01]
 \end{verbatim}
 
 \subsubsection{Useful hooks}
 
-Some packages and document styles had to redefine the command
-|\document| or |\enddocument| to achieve their goal.  This is no
-longer necessary. You can now use the `hooks' |\AtBeginDocument| and
-|\AtEndDocument| (see Section~\ref{Sec:delays}).  Again, using these
-hooks makes it less likely that your code breaks with future versions
-of \LaTeX{}. It also makes it more likely that your package can work
-together with someone else's.
+It is sometimes necessary for a package to arrange for code to be
+executed at the start or end of the preamble, at the end of the document
+or at the start of every use of an environment. This can be carried
+out by using hooks. As a document author, you will likely be familiar with
+|\AtBeginDocument|, a wrapper around the more powerful command |\AddToHook|.
+The \LaTeX{} kernel provides a large number of dedicated hooks (applying in
+a pre-defined location) and generic hooks (applying to arbitrary commands):
+the interface for using these is described in \texttt{lthooks} . There are
+also hooks to apply to files, described in \texttt{ltfilehooks}.
 
-\NEWdescription{1996/12/01}
-However, note that code in the |\AtBeginDocument| hook is part of the
-preamble.  Thus there are restrictions on what can be put there; in
-particular, no typesetting can be done.
-
 \section{The structure of a class or package}
 \label{Sec:structure}
 
-\LaTeXe{} classes and packages have more structure than \LaTeX~2.09
-style files did.  The outline of a class or package file is:
+The outline of a class or package file is:
 \begin{description}
 \item[Identification] The file says that it is a \LaTeXe{} package or
    class, and gives a short description of itself.
@@ -517,7 +377,7 @@
 For example:
 \begin{verbatim}
    \NeedsTeXFormat{LaTeX2e}
-   \ProvidesPackage{latexsym}[1994/06/01 Standard LaTeX package]
+   \ProvidesPackage{latexsym}[1998-08-17 Standard LaTeX package]
 \end{verbatim}
 Class files do this as follows:
 \begin{verbatim}
@@ -527,41 +387,31 @@
 For example:
 \begin{verbatim}
    \NeedsTeXFormat{LaTeX2e}
-   \ProvidesClass{article}[1994/06/01 Standard LaTeX class]
+   \ProvidesClass{article}[2022-06-01 Standard LaTeX class]
 \end{verbatim}
-\NEWdescription{1998/06/19}
-The \m{date} should be given in the form `\textsc{yyyy/mm/dd}' and
-must be present if the optional argument is used (this is also true
-for the |\NeedsTeXFormat| command).
-Any derivation from this syntax will result in low-level \TeX{}
-errors---the commands expect a valid syntax to speed up the daily
-usage of the package or class and make no provision for the case that
-the developer made a mistake!
+The \m{date} should be given in the form `\textsc{yyyy-mm-dd}' and must be
+present if the optional argument is used (this is also true for the
+|\NeedsTeXFormat| command). Any derivation from this syntax will result in
+low-level \TeX{} errors---the commands expect a valid syntax to speed up the
+daily usage of the package or class and make no provision for the case that the
+developer made a mistake!
 
-This date is checked whenever a user specifies a date in their
-|\documentclass| or |\usepackage| command.  For example, if you wrote:
+This date is checked whenever a user specifies a date in their |\documentclass|
+or |\usepackage| command. For example, if you wrote:
 \begin{verbatim}
-   \documentclass{article}[1995/12/23]
+   \documentclass{article}[2022-06-01]
 \end{verbatim}
-then users at a different location
-would get a warning that their copy of |article| was out of
-date.
+then users at a different location would get a warning that their copy of
+|article| was out of date.
 
-The description of a class is displayed when the class is used.  The
-description of a package is put into the log file.  These descriptions
-are also displayed by the |\listfiles| command.  The phrase
-\texttt{Standard LaTeX} \textbf{must not} be used in the identification
-banner of any file other than those in the standard \LaTeX{}
-distribution.
+The description of a class is displayed when the class is used. The description
+of a package is put into the log file. These descriptions are also displayed by
+the |\listfiles| command. The phrase \texttt{Standard LaTeX} \textbf{must not}
+be used in the identification banner of any file other than those in the
+standard \LaTeX{} distribution.
 
-
 \subsection{Using classes and packages}
 
-The first major difference between \LaTeX~2.09 style files and
-\LaTeXe{} packages and classes is that \LaTeXe{} supports
-\emph{modularity}, in the sense of building files from small
-building-blocks rather than using large single files.
-
 A \LaTeX{} package or class can load a package as follows:
 \begin{verbatim}
    \RequirePackage[<options>]{<package>}[<date>]
@@ -568,13 +418,12 @@
 \end{verbatim}
 For example:
 \begin{verbatim}
-   \RequirePackage{ifthen}[1994/06/01]
+   \RequirePackage{ifthen}[2022-06-01]
 \end{verbatim}
-This command has the same syntax as the author command |\usepackage|.
-It allows packages or classes to use features provided by other
-packages.  For example, by loading the |ifthen| package, a package
-writer can use the `if\dots then\dots else\dots' commands provided
-by that package.
+This command has the same syntax as the author command |\usepackage|. It allows
+packages or classes to use features provided by other packages. For example, by
+loading the |ifthen| package, a package writer can use the `if\dots then\dots
+else\dots' commands provided by that package.
 
 A \LaTeX{} class can load one other class as follows:
 \begin{verbatim}
@@ -584,13 +433,12 @@
 \begin{verbatim}
    \LoadClass[twocolumn]{article}
 \end{verbatim}
-This command has the same syntax as the author command |\documentclass|.
-It allows classes to be based on the syntax and appearance of another
-class.  For example, by loading the |article| class, a class writer
-only has to change the bits of |article| they don't like, rather than
-writing a new class from scratch.
+This command has the same syntax as the author command |\documentclass|. It
+allows classes to be based on the syntax and appearance of another class. For
+example, by loading the |article| class, a class writer only has to change the
+bits of |article| they don't like, rather than writing a new class from
+scratch.
 
-\NEWfeature{1995/12/01}
 The following commands can be used in the common case that you want to
 simply load a class or package file with exactly those options that
 are being used by the current class.
@@ -606,15 +454,21 @@
 
 \subsection{Declaring options}
 
-\NEWdescription{1998/12/01}
-The other major difference between \LaTeX~2.09 styles and \LaTeXe{}
-packages and classes is in option handling.  Packages and classes can
-now declare options and these can be specified by authors; for
-example, the |twocolumn| option is declared by the |article| class.
-Note that the name of an option should contain only those characters
-allowed in a `\LaTeX{} name'; in particular it must not contain any
-control sequences.
+Packages and classes can declare options and these can be specified by authors;
+for example, the |twocolumn| option is declared by the |article| class. Note
+that the name of an option should contain only those characters allowed in a
+`\LaTeX{} name'; in particular it must not contain any control sequences.
 
+\LaTeX{} supports two methods for creating options: a key--value system and a
+`simple text' approach. The key--value system is recommended for new classes
+and packages, and is more flexible in handling of option classes than the
+simple text approach. Both option methods use the same basic structure within
+the \LaTeX{} source: declaration of options first then processing options in a
+second step. Both also allow options to be passed on to other packages or an
+underlying class. As the `classical' simple text approach is conceptually more
+straight-forward to illustrate, it is used here to show the general structure:
+see Section~\ref{Sec:opt:keyval} for full details of the key--value approach.
+
 An option is declared as follows:
 \begin{verbatim}
    \DeclareOption{<option>}{<code>}
@@ -624,10 +478,9 @@
 \begin{verbatim}
    \DeclareOption{dvips}{\input{dvips.def}}
 \end{verbatim}
-This means that when an author writes |\usepackage[dvips]{graphics}|,
-the file |dvips.def| is loaded.  As another example, the |a4paper|
-option is declared in the |article| class to set the |\paperheight|
-and |\paperwidth| lengths:
+This means that when an author writes |\usepackage[dvips]{graphics}|, the file
+|dvips.def| is loaded. As another example, the |a4paper| option is declared in
+the |article| class to set the |\paperheight| and |\paperwidth| lengths:
 \begin{verbatim}
    \DeclareOption{a4paper}{%
       \setlength{\paperheight}{297mm}%
@@ -634,53 +487,49 @@
       \setlength{\paperwidth}{210mm}%
    }
 \end{verbatim}
-Sometimes a user will request an option which the class
-or package has not explicitly declared.  By default this will produce
-a warning (for classes) or error (for packages); this behaviour
-can be altered as follows:
+Sometimes a user will request an option which the class or package has not
+explicitly declared. By default this will produce a warning (for classes) or
+error (for packages); this behaviour can be altered as follows:
 \begin{verbatim}
    \DeclareOption*{<code>}
 \end{verbatim}
-For example, to make the package |fred| produce a warning rather than
-an error for unknown options, you could specify:
+For example, to make the package |fred| produce a warning rather than an error
+for unknown options, you could specify:
 \begin{verbatim}
    \DeclareOption*{%
       \PackageWarning{fred}{Unknown option `\CurrentOption'}%
    }
 \end{verbatim}
-Then, if an author writes |\usepackage[foo]{fred}|, they will get a
-warning \texttt{Package fred Warning: Unknown option `foo'.}  As
-another example, the |fontenc| package tries to load a file
-|<ENC>enc.def| whenever the \m{ENC} option is used.  This
-can be done by writing:
+Then, if an author writes |\usepackage[foo]{fred}|, they will get a warning
+\texttt{Package fred Warning: Unknown option `foo'.} As another example, the
+|fontenc| package tries to load a file |<ENC>enc.def| whenever the \m{ENC}
+option is used. This can be done by writing:
 \begin{verbatim}
    \DeclareOption*{%
       \input{\CurrentOption enc.def}%
    }
 \end{verbatim}
-\NEWdescription{1998/12/01}
-It is possible to pass options on to another package or class, using
-the command |\PassOptionsToPackage| or |\PassOptionsToClass| (note
-that this is a specialised operation that works only for option
-names).  For example, to pass every unknown option on to the |article|
-class, you can use:
+
+It is possible to pass options on to another package or class, using the
+command |\PassOptionsToPackage| or |\PassOptionsToClass| (note that this is a
+specialised operation that works only for option names): see
+Section~\ref{Sec:opmove}. For example, to pass every unknown option on to the
+|article| class, you can use:
 \begin{verbatim}
    \DeclareOption*{%
       \PassOptionsToClass{\CurrentOption}{article}%
    }
 \end{verbatim}
-If you do this then you should make sure you load the class at some
-later point, otherwise the options will never be processed!
+If you do this then you should make sure you load the class at some later
+point, otherwise the options will never be processed!
 
-So far, we have explained only how to declare options, not how to
-execute them.  To process the options with which the file was called,
-you should use:
+So far, we have explained only how to declare options, not how to execute them.
+To process the options with which the file was called, you should use:
 \begin{verbatim}
    \ProcessOptions\relax
 \end{verbatim}
-This executes the \m{code} for each option that was both specified and
-declared (see Section~\ref{Sec:commands.options} for details of how
-this is done).
+This executes the \m{code} for each option that was both specified and declared
+(see Section~\ref{Sec:commands.options} for details of how this is done).
 
 For example, if the |jane| package file contains:
 \begin{verbatim}
@@ -689,8 +538,8 @@
    \DeclareOption*{\typeout{What's \CurrentOption?}}
    \ProcessOptions\relax
 \end{verbatim}
-and an author writes |\usepackage[foo,bar]{jane}|, then they will see
-the messages \texttt{Saw foo.} and \texttt{What's bar?}
+and an author writes |\usepackage[foo,bar]{jane}|, then they will see the
+messages \texttt{Saw foo.} and \texttt{What's bar?}
 
 \subsection{A minimal class file}
 
@@ -698,9 +547,6 @@
 changing the appearance of documents.  This is done in the body of the
 package, using commands such as |\newcommand| or |\setlength|.
 
-\LaTeXe{} provides several new commands to help class and package
-writers; these are described in detail in Section~\ref{Sec:commands}.
-
 There are four things that every class file \emph{must} contain: these
 are a definition of |\normalsize|, values for |\textwidth| and
 |\textheight| and a specification for page-numbering.  So a minimal
@@ -708,7 +554,7 @@
 distribution, as \texttt{minimal.cls}.} looks like this:
 \begin{verbatim}
    \NeedsTeXFormat{LaTeX2e}
-   \ProvidesClass{minimal}[1995/10/30 Standard LaTeX minimal class]
+   \ProvidesClass{minimal}[2022-06-01 Standard LaTeX minimal class]
    \renewcommand{\normalsize}{\fontsize{10pt}{12pt}\selectfont}
    \setlength{\textwidth}{6.5in}
    \setlength{\textheight}{8in}
@@ -728,18 +574,17 @@
 The class begins by announcing itself as |neplet.cls|.
 \begin{verbatim}
    \NeedsTeXFormat{LaTeX2e}
-   \ProvidesClass{neplet}[1995/04/01 NonExistent Press letter class]
+   \ProvidesClass{neplet}[2022-06-01 NonExistent Press letter class]
 \end{verbatim}
-Then this next bit passes any options on to the |letter| class, which
-is loaded with the |a4paper| option.
+Then this next bit passes any options on to the |letter| class, which is loaded
+with the |a4paper| option.
 \begin{verbatim}
    \DeclareOption*{\PassOptionsToClass{\CurrentOption}{letter}}
    \ProcessOptions\relax
    \LoadClass[a4paper]{letter}
 \end{verbatim}
-In order to use the company letter head, it redefines the
-|firstpage| page style: this is the page style that is used on
-the first page of letters.
+In order to use the company letter head, it redefines the |firstpage| page
+style: this is the page style that is used on the first page of letters.
 \begin{verbatim}
    \renewcommand{\ps at firstpage}{%
       \renewcommand{\@oddhead}{<letterhead goes here>}%
@@ -751,17 +596,16 @@
 \subsection{Example: a newsletter class}
 
 A simple newsletter can be typeset with \LaTeX{}, using a variant of the
-|article| class.
-The class begins by announcing itself as |smplnews.cls|.
+|article| class. The class begins by announcing itself as |smplnews.cls|.
 \begin{verbatim}
    \NeedsTeXFormat{LaTeX2e}
-   \ProvidesClass{smplnews}[1995/04/01 The Simple News newsletter class]
+   \ProvidesClass{smplnews}[2022-06-01 The Simple News newsletter class]
 
    \newcommand{\headlinecolor}{\normalcolor}
 \end{verbatim}
-It passes most specified options on to the |article| class: apart from
-the |onecolumn| option, which is switched off, and the |green| option,
-which sets the headline in green.
+It passes most specified options on to the |article| class: apart from the
+|onecolumn| option, which is switched off, and the |green| option, which sets
+the headline in green.
 \begin{verbatim}
    \DeclareOption{onecolumn}{\OptionNotUsed}
    \DeclareOption{green}{\renewcommand{\headlinecolor}{\color{green}}}
@@ -774,14 +618,14 @@
 \begin{verbatim}
    \LoadClass[twocolumn]{article}
 \end{verbatim}
-Since the newsletter is to be printed in colour, it now loads the
-|color| package.  The class does not specify a device driver option
-since this should be specified by the user of the |smplnews| class.
+Since the newsletter is to be printed in colour, it now loads the |color|
+package. The class does not specify a device driver option since this should be
+specified by the user of the |smplnews| class.
 \begin{verbatim}
    \RequirePackage{color}
 \end{verbatim}
-The class then redefines |\maketitle| to produce the title in 72pt
-Helvetica bold oblique, in the appropriate colour.
+The class then redefines |\maketitle| to produce the title in 72\,pt Helvetica
+bold oblique, in the appropriate colour.
 \begin{verbatim}
    \renewcommand{\maketitle}{%
       \twocolumn[%
@@ -807,66 +651,68 @@
    \setlength{\textwidth}{17.5cm}
    \setlength{\textheight}{25cm}
 \end{verbatim}
-In practice, a class would need more than this: it would provide
-commands for issue numbers, authors of articles, page styles and so
-on; but this skeleton gives a start.  The |ltnews| class file is not
-much more complex than this one.
+In practice, a class would need more than this: it would provide commands for
+issue numbers, authors of articles, page styles and so on; but this skeleton
+gives a start. The |ltnews| class file is not much more complex than this one.
 
 \section{Commands for class and package writers}
 \label{Sec:commands}
 
-This section describes briefly each of the new commands for class and
-package writers.  To find out about other aspects of the new system,
+This section describes briefly each of the commands for class and package
+writers. To find out about other aspects of the system,
 you should also read \emph{\LaTeXbook}, \emph{\LaTeXcomp} and
 \emph{\usrguide}.
 
 \subsection{Identification}
 
-The first group of commands discussed here are those used
-to identify your class or package file.
+The first group of commands discussed here are those used to identify your
+class or package file.
 
 \begin{decl}
 |\NeedsTeXFormat| \arg{format-name} \oarg{release-date}
 \end{decl}
-This command tells \TeX{} that this file should be processed using a
-format with name \m{format-name}.  You can use the optional argument
-\m{release-date} to further specify the earliest release date of the
-format that is needed.  When the release date of the format is older
-than the one specified a warning will be generated. The standard
-\m{format-name} is \texttt{LaTeX2e}.  The date, if present, must be in
-the form \textsc{yyyy/mm/dd}.
+This command tells \TeX{} that this file should be processed using a format
+with name \m{format-name}. You can use the optional argument \m{release-date}
+to further specify the earliest release date of the format that is needed. When
+the release date of the format is older than the one specified a warning will
+be generated. The standard \m{format-name} is \texttt{LaTeX2e}. The date, if
+present, must be in the form \textsc{yyyy-mm-dd}.
 
 Example:
 \begin{verbatim}
-   \NeedsTeXFormat{LaTeX2e}[1994/06/01]
+   \NeedsTeXFormat{LaTeX2e}[2022-06-01]
 \end{verbatim}
+People often don't know what date to put here. For the kernel, you can find out
+the right one by consulting |changes.txt| and select the release date of a new
+feature you are interested in. This is slightly different for packages as they
+are released throughout the year: you will need to consult their change
+history.
 
 \begin{decl}
 |\ProvidesClass| \arg{class-name} \oarg{release-info} \\
 |\ProvidesPackage| \arg{package-name} \oarg{release-info}
 \end{decl}
-This declares that the current file contains the definitions for the
-document class \m{class-name} or package \m{package-name}.
+This declares that the current file contains the definitions for the document
+class \m{class-name} or package \m{package-name}.
 
 The optional \m{release-info}, if used, must contain:
 \begin{itemize}
-  \item the release date of
-  this version of the file, in the form \textsc{yyyy/mm/dd};
+  \item the release date of this version of the file, in the form
+    \textsc{yyyy-mm-dd};
 \item optionally followed by a space and a short description, possibly
   including a version number.
 \end{itemize}
-The above syntax must be followed exactly so that this information
-can be used by |\LoadClass| or |\documentclass| (for classes) or
-|\RequirePackage| or |\usepackage| (for packages) to test that the
-release is not too old.
+The above syntax must be followed exactly so that this information can be used
+by |\LoadClass| or |\documentclass| (for classes) or |\RequirePackage| or
+|\usepackage| (for packages) to test that the release is not too old.
 
-The whole of this \m{release-info} information is displayed by
-|\listfiles| and should therefore not be too long.
+The whole of this \m{release-info} information is displayed by |\listfiles| and
+should therefore not be too long.
 
 Example:
 \begin{verbatim}
-   \ProvidesClass{article}[1994/06/01 v1.0 Standard LaTeX class]
-   \ProvidesPackage{ifthen}[1994/06/01 v1.0 Standard LaTeX package]
+   \ProvidesClass{article}[2022-06-01 v1.0 Standard LaTeX class]
+   \ProvidesPackage{ifthen}[2022-06-01 v1.0 Standard LaTeX package]
 \end{verbatim}
 
 \begin{decl}
@@ -873,24 +719,23 @@
   |\ProvidesFile| \arg{file-name} \oarg{release-info}
 \end{decl}
 This is similar to the two previous commands except that here the full
-filename, including the extension, must be given. It is used for
-declaring any files other than main class and package files.
+filename, including the extension, must be given. It is used for declaring any
+files other than main class and package files.
 
 Example:
 \begin{verbatim}
-   \ProvidesFile{T1enc.def}[1994/06/01 v1.0 Standard LaTeX file]
+   \ProvidesFile{T1enc.def}[2022-06-01 v1.0 Standard LaTeX file]
 \end{verbatim}
 
-Note that the phrase \texttt{Standard LaTeX} \textbf{must not} be used
-in the identification banner of any file other than those in the
-standard \LaTeX{} distribution.
+Note that the phrase \texttt{Standard LaTeX} \textbf{must not} be used in the
+identification banner of any file other than those in the standard \LaTeX{}
+distribution.
 
 \subsection{Loading files}
 \label{Sec:loadf}
 
-\NEWfeature{1995/12/01}
-This group of commands can be used to create your own document class or
-package by building on existing classes or packages.
+This group of commands can be used to create your own document class or package
+by building on existing classes or packages.
 \begin{decl}
   |\RequirePackage| \oarg{options-list} \arg{package-name}
      \oarg{release-info}\\
@@ -899,13 +744,11 @@
 \end{decl}
 Packages and classes should use these commands to load other packages.
 
-The use of |\RequirePackage| is the same as the author command
-|\usepackage|.
-
+The use of |\RequirePackage| is the same as the author command |\usepackage|.
 Examples:
 \begin{verbatim}
-   \RequirePackage{ifthen}[1994/06/01]
-   \RequirePackageWithOptions{graphics}[1995/12/01]
+   \RequirePackage{ifthen}[2022-06-01]
+   \RequirePackageWithOptions{graphics}[2022-06-01]
 \end{verbatim}
 
 \begin{decl}
@@ -914,107 +757,153 @@
   |\LoadClassWithOptions| \arg{class-name}
      \oarg{release-info}
 \end{decl}
-\NEWfeature{1995/12/01}
-These commands are for use \emph{only} in class files, they cannot be
-used in packages files;
-they can be used at most once within a class file.
+These commands are for use \emph{only} in class files, they cannot be used in
+packages files; they can be used at most once within a class file.
 
-The use of |\LoadClass| is the same as
-the use of |\documentclass| to load a class file.
+The use of |\LoadClass| is the same as the use of |\documentclass| to load a
+class file.
 
 Examples:
 \begin{verbatim}
-   \LoadClass{article}[1994/06/01]
-   \LoadClassWithOptions{article}[1995/12/01]
+   \LoadClass{article}[2022-06-01]
+   \LoadClassWithOptions{article}[2022-06-01]
 \end{verbatim}
 
-\NEWfeature{1995/12/01}
-The two |WithOptions| versions simply load the class (or package) file
-with exactly those options that are being used by the current file
-(class or package).  See below, in \ref{Sec:opmove}, for further
-discussion of their use.
+The two |WithOptions| versions simply load the class (or package) file with
+exactly those options that are being used by the current file (class or
+package). See below, in \ref{Sec:opmove}, for further discussion of their use.
 
+\subsection{Delaying code}
+\label{Sec:delays}
 
-\subsection{Option declaration}
-\label{Sec:commands.options.dec}
+As noted earlier, a sophisticated hook system is available and described in
+\texttt{lthooks}. Here, we document a small set of convenient short names for
+common hooks.
 
-\NEWdescription{1998/12/01}
-The following commands deal with the declaration and handling of
-options to document classes and packages.  Every option name must be a
-`\LaTeX{} name'.
+These first two commands are also intended primarily for use within the
+\m{code} argument of |\DeclareOption| or |\DeclareOption*|.
 
-There are some commands designed especially for use within the
-\m{code} argument of these commands (see below).
+\begin{decl}
+  |\AtEndOfClass| \arg{code}\\
+  |\AtEndOfPackage| \arg{code}
+\end{decl}
+These commands declare \m{code} that is saved away internally and then executed
+after processing the whole of the current class or package file.
 
+Repeated use of these commands is permitted: the code in the arguments is
+stored (and later executed) in the order of their declarations.
+
 \begin{decl}
-  |\DeclareOption| \arg{option-name} \arg{code}
+  |\AtBeginDocument| \arg{code}\\
+  |\AtEndDocument| \arg{code}
 \end{decl}
-This makes \m{option-name} a `declared option' of the class or package
-in which it is put.
+These commands declare \m{code} to be saved internally and executed while
+\LaTeX{} is executing |\begin{document}| or |\end{document}|.
 
-The \m{code} argument contains the code to be executed if that option
-is specified for the class or package; it can contain any valid
-\LaTeXe{} construct.
+The \m{code} specified in the argument to |\AtBeginDocument| is executed near
+the end of the |\begin{document}| code, \emph{after} the font selection tables
+have been set up. It is therefore a useful place to put code which needs to be
+executed after everything has been prepared for typesetting and when the normal
+font for the document is the current font.
 
-Example:
-\begin{verbatim}
-   \DeclareOption{twoside}{\@twosidetrue}
-\end{verbatim}
+The |\AtBeginDocument| hook should not be used for code that does any
+typesetting since the typeset result would be unpredictable.
 
+The \m{code} specified in the argument to |\AtEndDocument| is executed at the
+beginning of the |\end{document}| code, \emph{before} the final page is
+finished and before any leftover floating environments are processed. If some
+of the \m{code} is to be executed after these two processes, you should include
+a |\clearpage| at the appropriate point in \m{code}.
+
+Repeated use of these commands is permitted: the code in the arguments is
+stored (and later executed) in the order of their declarations.
+
+\subsection{Creating and using keyval options}
+\label{Sec:opt:keyval}
+
+As with any key--value input, using key--value pairs as package or class
+options has two parts: creating the key options and setting (using) them.
+Options created in this way \emph{may} be used after package loading as general
+key--value settings: this will depend on the nature of the underlying code.
+
 \begin{decl}
-  |\DeclareOption*| \arg{code}
+  |\DeclareKeys| \oarg{family} \arg{declarations}
 \end{decl}
-This declares the \m{code} to be executed for every option which is
-specified for, but otherwise not explicitly declared by, the class or
-package; this code is called the `default option code' and it can
-contain any valid \LaTeXe{} construct.
+This command creates a series of options from a comma-separated
+\m{declarations} list. Each entry in this list is a key--value pair, with the
+\m{key} having one or more \m{properties}. A small number of `basic'
+\m{properties} are described below. The full range of properties, provided by
+\texttt{l3keys}, can also be used for more powerful processing. See
+\texttt{interface3} for the full details.
 
-If a class file contains no |\DeclareOption*| then, by default, all
-specified but undeclared options for that class will be silently
-passed to all packages (as will the specified and declared options for
-that class).
+The basic properties provided here are
+\begin{itemize}
+  \item \texttt{.code} --- execute arbitrary code
+  \item \texttt{.if} --- sets a \TeX{} |\if...| switch
+  \item \texttt{.ifnot} --- sets an inverted \TeX{} |\if...| switch
+  \item \texttt{.store} --- stores a value in a macro
+  \item \texttt{.usage} -- defines whether the option can be given only
+    when loading (\texttt{load}), in the preamble (\texttt{preamble}) or
+    has no limitation on scope (\texttt{general})
+\end{itemize}
+The part of the \meta{key} before the \m{property} is the \m{name}, with the
+\m{value} working with the \m{property} to define the behaviour of the option.
 
-If a package file contains no |\DeclareOption*| then, by default, each
-specified but undeclared option for that package will produce an error.
+For example, with
+\begin{verbatim}
+\DeclareKeys[mypkg]
+ {
+   draft.if          = @mypkg at draft      ,
+   draft.usage       = preamble          ,
+   name.store        = \@mypkg at name      ,
+   name.usage        = load              ,
+   second-name.store = \@mypkg at other@name
+ }
+\end{verbatim}
+three options would be created. The option \texttt{draft} can be given anywhere
+in the preamble, and will set a switch called |\if at mypkg@draft|. The option
+\texttt{name} can only be given during package loading, and will save whatever
+value it is given in |\@mypkg at name|. Finally, the option \texttt{second-name}
+can be given anywhere, and will save its value in |\@mypkg at other@name|.
 
+Keys created \emph{before} the use of |\ProcessKeyOptions| act as package
+options.
 
-\subsection{Commands within option code}
-\label{Sec:within.code}
+\begin{decl}
+  |\DeclareUnknownKeyHandler| \oarg{family} \arg{code}
+\end{decl}
+The command |\DeclareUnknownKeyHandler| may be used to define the behavior when
+an undefined key is encountered. The \m{code} will receive the unknown key name
+as |#1| and the value as |#2|. These can then be processed as appropriate,
+e.g.~by forwarding to another package.
 
-These two commands can be used only within the \m{code} argument of
-either |\DeclareOption| or |\DeclareOption*|.  Other commands commonly
-used within these arguments can be found in the next few subsections.
-
 \begin{decl}
-  |\CurrentOption|
+  |\ProcessKeyOptions| \oarg{family}
 \end{decl}
-This expands to the name of the current option.
+The |\ProcessKeyOptions| function is used to check the current option list
+against the keys defined for \m{family}. Global (class) options and local
+(package) options are checked when this function is called in a package.
 
 \begin{decl}
-  |\OptionNotUsed|
+  |\SetKeys| \oarg{family} \arg{keyvals}
 \end{decl}
-This causes the current option to
-be added to the list of `unused options'.
+Sets (applies) the explicit list of \m{keyvals} for the \m{family}: if the
+latter is not given, the value of |\@currname| is used. This command may be used
+within a package to set options before or after using |\ProcessKeyOptions|.
 
-\NEWfeature{1995/06/01}
-  You can now include hash marks (\texttt{\#}) within these \m{code}
-  arguments without special treatment (formerly, it had been
-  necessary to double them).
-
-\subsection{Moving options around}
+\subsection{Passing options around}
 \label{Sec:opmove}
 
-These two commands are also very useful within the \m{code} argument
-of |\DeclareOption| or |\DeclareOption*|:
+These two commands are also very useful within the \m{code} argument of
+options.
 \begin{decl}
   |\PassOptionsToPackage| \arg{options-list} \arg{package-name}\\
   |\PassOptionsToClass| \arg{options-list} \arg{class-name}
 \end{decl}
-The command |\PassOptionsToPackage| passes the option names in
-\m{options-list} to package \m{package-name}.
-This means that it adds the \m{option-list} to the
-list of options used by any future |\RequirePackage| or |\usepackage|
-command for package \m{package-name}.
+The command |\PassOptionsToPackage| passes the option names in \m{options-list}
+to package \m{package-name}. This means that it adds the \m{option-list} to the
+list of options used by any future |\RequirePackage| or |\usepackage| command
+for package \m{package-name}.
 
 Example:
 \begin{verbatim}
@@ -1026,24 +915,22 @@
    \RequirePackage[foo,bar,baz]{fred}
 \end{verbatim}
 
-Similarly, |\PassOptionsToClass| may be used in a class file to pass
-options to another class to be loaded with |\LoadClass|.
+Similarly, |\PassOptionsToClass| may be used in a class file to pass options to
+another class to be loaded with |\LoadClass|.
 
-\NEWdescription{1995/12/01}
-The effects and use of these two commands should be contrasted with
-those of the following two (documented above, in \ref{Sec:loadf}):
+The effects and use of these two commands should be contrasted with those of
+the following two (documented above, in \ref{Sec:loadf}):
 \begin{verbatim}
    \LoadClassWithOptions
    \RequirePackageWithOptions
 \end{verbatim}
-The command |\RequirePackageWithOptions| is similar to
-|\RequirePackage|, but it always loads the required package with
-exactly the same option list as that being used by the current class
-or package, rather than with any option explicitly supplied or passed
-on by |\PassOptionsToPackage|.
+The command |\RequirePackageWithOptions| is similar to |\RequirePackage|, but
+it always loads the required package with exactly the same option list as that
+being used by the current class or package, rather than with any option
+explicitly supplied or passed on by |\PassOptionsToPackage|.
 
-The main purpose of |\LoadClassWithOptions| is to allow one class to
-simply build on another, for example:
+The main purpose of |\LoadClassWithOptions| is to allow one class to simply
+build on another, for example:
 \begin{verbatim}
   \LoadClassWithOptions{article}
 \end{verbatim}
@@ -1053,12 +940,11 @@
   \ProcessOptions\relax
   \LoadClass{article}
 \end{verbatim}
-As used above, the effects are more or less the same, but the first is
-a lot less to type; also the |\LoadClassWithOptions| method runs
-slightly quicker.
+As used above, the effects are more or less the same, but the first is a lot
+less to type; also the |\LoadClassWithOptions| method runs slightly quicker.
 
-If, however, the class declares options of its own then
-the two constructions are different.  Compare, for example:
+If, however, the class declares options of its own then the two constructions
+are different. Compare, for example:
 \begin{verbatim}
   \DeclareOption{landscape}{\@landscapetrue}
   \ProcessOptions\relax
@@ -1071,221 +957,24 @@
   \ProcessOptions\relax
   \LoadClass{article}
 \end{verbatim}
-In the first example, the \textsf{article} class will be loaded with
-option |landscape| precisely when the current class is called with
-this option. By contrast, in the second example it will never be
-called with option \texttt{landscape} as in that case \textsf{article}
-is passed options only by the default option handler, but this handler
-is not used for |landscape| because that option is explicitly
-declared.
+In the first example, the \textsf{article} class will be loaded with option
+|landscape| precisely when the current class is called with this option. By
+contrast, in the second example it will never be called with option |landscape|
+as in that case \textsf{article} is passed options only by the default option
+handler, but this handler is not used for |landscape| because that option is
+explicitly declared.
 
-\subsection{Delaying code}
-\label{Sec:delays}
-
-These first two commands are also intended primarily for use within
-the \m{code} argument of |\DeclareOption| or |\DeclareOption*|.
-
-\begin{decl}
-  |\AtEndOfClass| \arg{code}\\
-  |\AtEndOfPackage| \arg{code}
-\end{decl}
-These commands declare \m{code} that is saved away internally and then
-executed after processing the whole of the current class or package
-file.
-
-Repeated use of these commands is permitted: the code in the
-arguments is stored (and later executed) in the order of their
-declarations.
-
-\begin{decl}
-  |\AtBeginDocument| \arg{code}\\
-  |\AtEndDocument| \arg{code}
-\end{decl}
-These commands declare \m{code} to be saved internally and executed
-while \LaTeX{} is executing |\begin{document}| or |\end{document}|.
-
-The \m{code} specified in the argument to |\AtBeginDocument| is
-executed near the end of the |\begin{document}| code, \emph{after} the
-font selection tables have been set up.  It is therefore a useful
-place to put code which needs to be executed after everything has been
-prepared for typesetting and when the normal font for the document is
-the current font.
-
-\NEWdescription{1995/12/01}
-The |\AtBeginDocument| hook should not be used for code that does any
-typesetting since the typeset result would be unpredictable.
-
-The \m{code} specified in the argument to |\AtEndDocument| is
-executed at the beginning of the |\end{document}| code,
-\emph{before} the final page is finished and before any leftover
-floating environments are processed. If some of the \m{code} is to be
-executed after these two processes, you should include a |\clearpage|
-at the appropriate point in \m{code}.
-
-Repeated use of these commands is permitted: the code in the
-arguments is stored (and later executed) in the order of their
-declarations.
-
-\begin{decl}[1994/12/01]
-  |\AtBeginDvi| \arg{specials}
-\end{decl}
-These commands save in a box register things which are written to the
-|.dvi| file at the beginning of the `shipout' of the first page of the
-document.
-
-This should not be used for anything that will add any typeset
-material to the |.dvi| file.
-
-Repeated use of this command is permitted.
-
-
-\subsection{Option processing}
-\label{Sec:commands.options}
-
-\begin{decl}
-  |\ProcessOptions|
-\end{decl}
-This command executes the \m{code} for each selected option.
-
-We shall first describe how |\ProcessOptions| works in a package file,
-and then how this differs in a class file.
-
-To understand in detail what |\ProcessOptions| does in a package file,
-you have to know the difference between \emph{local} and \emph{global}
-options.
-\begin{itemize}
-\item \textbf{Local options} are those which have been explicitly
-  specified for this particular package in the \m{options} argument of
-  any of these:
-\begin{quote}
-    |\PassOptionsToPackage{<options>}| \ |\usepackage[<options>]|\\
-    |\RequirePackage[<options>]|
-\end{quote}
-\item \textbf{Global options} are any other options that are specified
-  by the author in the \m{options} argument of
-    |\documentclass[<options>]|.
-\end{itemize}
-For example, suppose that a document begins:
-\begin{verbatim}
-   \documentclass[german,twocolumn]{article}
-   \usepackage{gerhardt}
-\end{verbatim}
-whilst package |gerhardt| calls package |fred| with:
-\begin{verbatim}
-   \PassOptionsToPackage{german,dvips,a4paper}{fred}
-   \RequirePackage[errorshow]{fred}
-\end{verbatim}
-then:
-\begin{itemize}
-\item |fred|'s local options are |german|, |dvips|, |a4paper|
-  and |errorshow|;
-\item |fred|'s only global option is |twocolumn|.
-\end{itemize}
-
-When |\ProcessOptions| is called, the following happen.
-\begin{itemize}
-\item \emph{First}, for each option so far declared in |fred.sty|
-  by |\DeclareOption|, it looks to see if that option is either a
-  global or a local option for |fred|: if it is then the corresponding
-  code is executed.
-
-  This is done in the order in which these options
-  were declared in |fred.sty|.
-\item \emph{Then}, for each remaining \emph{local} option, the command
-  |\ds@<option>| is executed if it has been defined somewhere (other
-  than by a |\DeclareOption|); otherwise, the `default option code' is
-  executed.  If no default option code has been declared then an error
-  message is produced.
-
-  This is done in the order in which these
-  options were specified.
-\end{itemize}
-Throughout this process, the system ensures that the code declared for
-an option is executed at most once.
-
-Returning to the example, if |fred.sty| contains:
-\begin{verbatim}
-   \DeclareOption{dvips}{\typeout{DVIPS}}
-   \DeclareOption{german}{\typeout{GERMAN}}
-   \DeclareOption{french}{\typeout{FRENCH}}
-   \DeclareOption*{\PackageWarning{fred}{Unknown `\CurrentOption'}}
-   \ProcessOptions\relax
-\end{verbatim}
-then the result of processing this document will be:
-\begin{verbatim}
-   DVIPS
-   GERMAN
-   Package fred Warning: Unknown `a4paper'.
-   Package fred Warning: Unknown `errorshow'.
-\end{verbatim}
-Note the following:
-
-\begin{itemize}
-\item the code for the |dvips| option is executed before that for the
-  |german| option, because that is the order in which they are declared
-  in |fred.sty|;
-\item the code for the |german| option is executed only once, when the
-  declared options are being processed;
-\item the |a4paper| and |errorshow| options produce the warning from
-  the code declared by |\DeclareOption*| (in the order in which they
-  were specified), whilst the |twocolumn| option does not: this is
-  because |twocolumn| is a global option.
-\end{itemize}
-
-In a class file, |\ProcessOptions| works in the same way, except
-that: \emph{all} options are local; and the default value for
-|\DeclareOption*| is |\OptionNotUsed| rather than an error.
-
-\NEWdescription{1995/12/01}
-Note that, because |\ProcessOptions| has a |*|-form, it is wise to
-follow the non-star form with |\relax|, as in the previous examples,
-since this prevents unnecessary look ahead and possibly misleading
-error messages being issued.
-
-\begin{decl}
-  |\ProcessOptions*| \\
-  |\@options|
-\end{decl}
-This is like |\ProcessOptions| but it executes the options in the
-order specified in the calling commands, rather than in the order of
-declaration in the class or package. For a package this means that the
-global options are processed first.
-
-The |\@options| command from \LaTeX~2.09 has been made equivalent to
-this in order to ease the task of updating old document styles to
-\LaTeXe{} class files.
-
-\begin{decl}
-  |\ExecuteOptions| \arg{options-list}
-\end{decl}
-
-For each option in the \m{options-list}, in order,
-this command simply executes the command
-|\ds@<option>| (if this command is not defined, then that option is
-silently ignored).
-
-It can be used to provide a `default option list' just before
-|\ProcessOptions|.  For example, suppose that in a class file you want
-to set up the default design to be: two-sided printing; 11pt fonts;
-in two columns. Then it could specify:
-\begin{verbatim}
-   \ExecuteOptions{11pt,twoside,twocolumn}
-\end{verbatim}
-
-
 \subsection{Safe file commands}
 
-These commands deal with file input; they ensure that the non-existence
-of a requested file can be handled in a user-friendly way.
+These commands deal with file input; they ensure that the non-existence of a
+requested file can be handled in a user-friendly way.
 
 \begin{decl}
 |\IfFileExists| \arg{file-name} \arg{true} \arg{false}
 \end{decl}
-If the file exists then the code specified in \m{true} is
-executed.
+If the file exists then the code specified in \m{true} is executed.
 
-If the file does not exist then the code specified in \m{false} is
-executed.
+If the file does not exist then the code specified in \m{false} is executed.
 
 This command does \emph{not} input the file.
 
@@ -1292,34 +981,32 @@
 \begin{decl}
   |\InputIfFileExists| \arg{file-name} \arg{true} \arg{false}
 \end{decl}
-This inputs the file \m{file-name} if it exists and, immediately
-before the input, the code specified in \m{true} is executed.
+This inputs the file \m{file-name} if it exists and, immediately before the
+input, the code specified in \m{true} is executed.
 
-If the file does not exist then the code specified in \m{false} is
-executed.
+If the file does not exist then the code specified in \m{false} is executed.
 
 It is implemented using |\IfFileExists|.
 
-
 \subsection{Reporting errors, etc}
 
-These commands should be used by third party classes and packages to
-report errors, or to provide information to authors.
+These commands should be used by third party classes and packages to report
+errors, or to provide information to authors.
 
 \begin{decl}
   |\ClassError| \arg{class-name} \arg{error-text} \arg{help-text}\\
   |\PackageError| \arg{package-name} \arg{error-text} \arg{help-text}
 \end{decl}
-These produce an error message.  The \m{error-text} is displayed and the
-|?| error prompt is shown.  If the user types |h|, they will be shown
-the \m{help-text}.
+These produce an error message. The \m{error-text} is displayed and the |?|
+error prompt is shown. If the user types |h|, they will be shown the
+\m{help-text}.
 
-Within the \m{error-text} and \m{help-text}: |\protect| can be used to
-stop a command from expanding; |\MessageBreak| causes a line-break;
-and |\space| prints a space.
+Within the \m{error-text} and \m{help-text}: |\protect| can be used to stop a
+command from expanding; |\MessageBreak| causes a line-break; and |\space|
+prints a space.
 
-Note that the \m{error-text} will have a full stop added to it, so do
-not put one into the argument.
+Note that the \m{error-text} will have a full stop added to it, so do not put
+one into the argument.
 
 For example:
 \begin{verbatim}
@@ -1354,96 +1041,22 @@
   |\ClassInfo| \arg{class-name} \arg{info-text}\\
   |\PackageInfo| \arg{package-name} \arg{info-text}
 \end{decl}
-The four |Warning| commands are similar to the error commands, except
-that they produce only a warning on the screen, with no error prompt.
+The four |Warning| commands are similar to the error commands, except that they
+produce only a warning on the screen, with no error prompt.
 
-The first two, |Warning| versions, also show the line number where the
-warning occurred, whilst the second two, |WarningNoLine| versions, do
-not.
+The first two, |Warning| versions, also show the line number where the warning
+occurred, whilst the second two, |WarningNoLine| versions, do not.
 
-The two |Info| commands are similar except that they log the
-information only in the transcript file, including the line number.
-There are no |NoLine| versions of these two.
+The two |Info| commands are similar except that they log the information only
+in the transcript file, including the line number. There are no |NoLine|
+versions of these two.
 
-Within the \m{warning-text} and \m{info-text}: |\protect| can be used to
-stop a command from expanding; |\MessageBreak| causes a line-break;
-and |\space| prints a space.
-Also, these should not end with a full stop as one is
+Within the \m{warning-text} and \m{info-text}: |\protect| can be used to stop a
+command from expanding; |\MessageBreak| causes a line-break; and |\space|
+prints a space. Also, these should not end with a full stop as one is
 automatically added.
 
-
-\subsection{Defining commands}
-\label{Sec:commands.define}
-
-\LaTeXe{} provides some extra methods of (re)defining commands that are
-intended for use in class and package files.
-
-\NEWfeature{1994/12/01}
-The \texttt{*}-forms of these commands should be used to define
-commands that are not, in \TeX{} terms, long.  This can be useful for
-error-trapping with commands whose arguments are not intended to
-contain whole paragraphs of text.
-
-\begin{decl}
-  |\DeclareRobustCommand| \arg{cmd} \oarg{num} \oarg{default}
-     \arg{definition}\\
-  |\DeclareRobustCommand*| \arg{cmd} \oarg{num} \oarg{default}
-     \arg{definition}
-\end{decl}
-This command takes the same arguments as |\newcommand| but it declares
-a robust command, even if some code within the \m{definition} is
-fragile.  You can use this command to define new robust commands, or
-to redefine existing commands and make them robust.  A log is put into
-the transcript file if a command is redefined.
-
-For example, if |\seq| is defined as follows:
-\begin{verbatim}
-   \DeclareRobustCommand{\seq}[2][n]{%
-     \ifmmode
-       #1_{1}\ldots#1_{#2}%
-     \else
-       \PackageWarning{fred}{You can't use \protect\seq\space in text}%
-     \fi
-   }
-\end{verbatim}
-Then the command |\seq| can be used in moving arguments, even though
-|\ifmmode| cannot, for example:
-\begin{verbatim}
-   \section{Stuff about sequences $\seq{x}$}
-\end{verbatim}
-
-Note also that there is no need to put a |\relax| before the
-|\ifmmode| at the beginning of the definition; this is because the
-protection given by this |\relax| against expansion at the wrong time
-will be provided internally.
-
-\begin{decl}
-  |\CheckCommand| \arg{cmd} \oarg{num} \oarg{default}
-     \arg{definition}\\
-  |\CheckCommand*| \arg{cmd} \oarg{num} \oarg{default}
-     \arg{definition}
-\end{decl}
-This takes the same arguments as |\newcommand| but, rather than define
-\m{cmd}, it just checks that the current definition of \m{cmd} is
-exactly as given by \m{definition}.  An error is raised if these
-definitions differ.
-
-This command is useful for checking the state of the system before
-your package starts altering the definitions of commands.  It allows
-you to check, in particular, that no other package has redefined the
-same command.
-
-\subsection{Moving arguments}
-
-\NEWdescription{1994/12/01}
-The setting of protect whilst processing (i.e.~moving) moving arguments
-has been reimplemented, as has the method of writing information from
-the |.aux| file to other files such as the |.toc| file.  Details can
-be found in the file |ltdefns.dtx|.
-
-We hope that these changes will not affect many packages.
-
-\section{Miscellaneous commands, etc}
+\section{Miscellaneous commands, etc.}
 \label{Sec:commands.misc}
 
 \subsection{Layout parameters}
@@ -1452,79 +1065,26 @@
 |\paperheight|\\
 |\paperwidth|
 \end{decl}
-These two parameters are usually set by the class to be the size of
-the paper being used. This should be actual paper size, unlike
-|\textwidth| and |\textheight| which are the size of the main text
-body within the margins.
+These two parameters are usually set by the class to be the size of the paper
+being used. This should be actual paper size, unlike |\textwidth| and
+|\textheight| which are the size of the main text body within the margins.
 
-
 \subsection{Case changing}
 \label{sec:case}
 
 \begin{decl}
   |\MakeUppercase| \arg{text} \\
-  |\MakeLowercase| \arg{text}
+  |\MakeLowercase| \arg{text} \\
+  |\MakeTitlecase| \arg{text}
 \end{decl}
 
-\NEWfeature{1995/06/01}
-\TeX{} provides two primitives |\uppercase| and |\lowercase| for
-changing the case of text.  These are sometimes used in document
-classes, for example to set information in running heads in all
-capitals.
+As described in \texttt{usrguide}, case changing for text should be carried out
+using the commands |\MakeUppercase|, |\MakeLowercase| and
+|\MakeTitlecase|. If you need to change the case of programmatic material, the
+team strongly suggest using the L3 programming layer commands in the
+\texttt{str} module. If you do not wish to do this, you should use the \TeX{}
+|\uppercase| and |\lowercase| primitives \emph{in this situation only}.
 
-Unfortunately, these \TeX{} primitives do not change the case of
-characters accessed by commands like |\ae| or |\aa|.  To overcome this
-problem, \LaTeX{} provides two new commands |\MakeUppercase| and
-|\MakeLowercase| to do this.
-
-For example:
-\begin{quotation}
-\begin{tabular}{rl}
-   |\uppercase{aBcD\ae\AA\ss\OE}| & \uppercase{aBcD\ae\AA\ss\OE}\\
-   |\lowercase{aBcD\ae\AA\ss\OE}| & \lowercase{aBcD\ae\AA\ss\OE}\\
-   |\MakeUppercase{aBcD\ae\AA\ss\OE}| &
-                                      \MakeUppercase{aBcD\ae\AA\ss\OE}\\
-   |\MakeLowercase{aBcD\ae\AA\ss\OE}| & \MakeLowercase{aBcD\ae\AA\ss\OE}
-\end{tabular}
-\end{quotation}
-
-The commands |\MakeUppercase| and |\MakeLowercase| themselves are
-robust, but they have moving arguments.
-
-The commands use the \TeX{} primitives |\uppercase| and |\lowercase|,
-and so have a number of unexpected `features'.  In particular, they
-change the case of everything (except characters in the names of
-control-sequences) in their text argument: this includes mathematics,
-environment names, and label names.
-
-For example:
-\begin{verbatim}
-   \MakeUppercase{$x+y$ in \ref{foo}}
-\end{verbatim}
-produces $X+Y$ and the warning:
-\begin{verbatim}
-   LaTeX Warning: Reference `FOO' on page ... undefined on ...
-\end{verbatim}
-In the long run, we would like to use all-caps fonts rather than any
-command like |\MakeUppercase| but this is not possible at the moment
-because such fonts do not exist.
-
-\NEWdescription{1995/12/01}
-In order that upper/lower-casing will work reasonably well, and in
-order to provide any correct hyphenation, \LaTeXe{} \emph{must} use,
-throughout a document, the same fixed table for changing case.
-The table used is designed for the font encoding |T1|; this works well
-with the standard \TeX{} fonts for all Latin alphabets but will cause
-problems when using other alphabets.
-
-\subsection{The `openany' option in the `book' class}
-
-\NEWdescription{1996/06/01}
-The |openany| option allows chapter and similar openings to
-occur on left hand pages. Previously this option affected only
-|\chapter| and |\backmatter|.  It now also affects
-|\part|, |\frontmatter| and |\mainmatter|.
-
 \subsection{Better user-defined math display environments}
 
 \begin{decl}
@@ -1531,11 +1091,8 @@
   |\ignorespacesafterend|
 \end{decl}
 
-\NEWfeature{1996/12/01}
-\NEWdescription{2003/12/01}
-Suppose that you want to define an environment for displaying text
-that is numbered as an equation.  A straightforward way to do this is
-as follows:
+Suppose that you want to define an environment for displaying text that is
+numbered as an equation. A straightforward way to do this is as follows:
 \begin{verbatim}
   \newenvironment{texteqn}
     {\begin{equation}
@@ -1543,13 +1100,13 @@
       {\end{minipage}
      \end{equation}}
 \end{verbatim}
-However, if you have tried this then you will probably have noticed
-that it does not work perfectly when used in the middle of a paragraph
-because an inter-word space appears at the beginning of the first
-line after the environment.
+However, if you have tried this then you will probably have noticed that it
+does not work perfectly when used in the middle of a paragraph because an
+inter-word space appears at the beginning of the first line after the
+environment.
 
-There is now an extra command (with a very long name) available that
-you can use to avoid this problem; it should be inserted as shown here:
+You can avoid this problem using |\ignorespacesafterend|; it should be
+inserted as shown here:
 \begin{verbatim}
   \newenvironment{texteqn}
     {\begin{equation}
@@ -1567,312 +1124,298 @@
   |\normalsfcodes|
 \end{decl}
 
-\NEWfeature{1997/06/01}
 This command should be used to restore the normal settings of the
 parameters that affect spacing between words, sentences, etc.
 
-An important use of this feature is to correct a problem, reported by
-Donald Arseneau, that punctuation in page headers has always (in all
-known \TeX{} formats) been potentially wrong whenever a page break
-happens while a local setting of the space codes is in effect.  These
-space codes are changed by, for example, the command
-\verb|\frenchspacing|) and the \textsf{verbatim} environment.
+An important use of this feature is to correct a problem, reported by Donald
+Arseneau, that punctuation in page headers has always (in all known \TeX{}
+formats) been potentially wrong whenever a page break happens while a local
+setting of the space codes is in effect. These space codes are changed by, for
+example, the command \verb|\frenchspacing|) and the \textsf{verbatim}
+environment.
 
-It is normally given the correct definition automatically in
-|\begin{document}| and so need not be explicitly set; however, if it
-is explicitly made nonempty in a class file then automatic
-default setting will be over-ridden.
+It is normally given the correct definition automatically in |\begin{document}|
+and so need not be explicitly set; however, if it is explicitly made non-empty
+in a class file then automatic default setting will be over-ridden.
 
+\subsection{Querying localisation}
 
-\section{Upgrading \LaTeX~2.09 classes and packages}
-\label{Sec:upgrade}
+Localisation information is needed to customise a range of outputs. The
+\LaTeX{} kernel does not itself manage localisation, which is well-served by
+the bundles \pkg{babel} and \pkg{polyglossia}. To allow the kernel and other
+packages to access the current localisation information provided by \pkg{babel}
+or \pkg{polyglossia}, the command \cs{BCPdata} is defined by the kernel. The
+initial kernel definition expands to tag parts for \texttt{en-US}, as the
+kernel does not track localisation but does start out with a broadly US~English
+setup. However, if \pkg{babel} or \pkg{polyglossia} are loaded, it is redefined
+expand to the BCP-47 information from the appropriate package. The supported
+arguments are the BCP-47 tag breakdowns:
+\begin{itemize}
+  \item \texttt{tag} The full BCP-47 tag (e.g.~\texttt{en-US})
+  \item \texttt{language} (e.g.,~\texttt{de})
+  \item \texttt{region} (e.g.,~\texttt{AT})
+  \item \texttt{script} (e.g.,~\texttt{Latn})
+  \item \texttt{variant} (e.g.,~\texttt{1901})
+  \item \texttt{extension.t} (transformation, e.g.,~\texttt{en-t-ja})
+  \item \texttt{extension.u} (additional locale
+    information, e.g.,~\texttt{ar-u-nu-latn})
+  \item \texttt{extension.x} (private use area, e.g.,~\texttt{la-x-classic})
+\end{itemize}
+The information for the \emph{main} language for a document is be provided
+if these are prefixed by \texttt{main.}, e.g.~\texttt{main.language} will
+expand to the main language even if another language is currently active.
 
-This section describes the changes you may need to make when you
-upgrade an existing \LaTeX{} style to a package or class but we shall
-start in optimistic mode.
-
-Many existing style files will run with \LaTeXe{} without any
-modification to the file itself.  When everything is running OK,
-please put a note in the newly created package or class file to record
-that it runs with the new standard \LaTeX{}; then distribute it to
-your users.
-
-\subsection{Try it first!}
-\label{Sec:try-it}
-
-The first thing you should do is to test your style in `compatibility
-mode'.  The only change you need to make in order to do this is,
-possibly, to change the extension of the file to |.cls|: you should
-make this change only if your file was used as a main document style.
-Now, without any other modifications, run \LaTeXe{} on a document that
-uses your file.  This assumes that you have a suitable collection of
-files that tests all the functionality provided by your style file.
-(If you haven't, now is the time to make one!)
-
-You now need to change the test document files so that they are
-\LaTeXe{} documents: see \emph{\usrguide} for details of how to do
-this and then try them again.  You have now tried the test documents
-in both \LaTeXe{} native mode and \LaTeX~2.09 compatibility mode.
-
-\subsection{Troubleshooting}
-\label{Sec:trouble}
-
-If your file does not work with \LaTeXe{}, there are two likely
-reasons.
+In addition to the tag breakdown, the following semantic arguments are
+supported
 \begin{itemize}
-\item \LaTeX{} now has a robust, well-defined designer's interface for
-  selecting fonts, which is very different from the \LaTeX~2.09
-  internals.
-\item Your style file may have used some \LaTeX~2.09 internal commands
-  which have changed, or which have been removed.
+  \item \texttt{casing} The tag for case changing, e.g.~\texttt{el-x-iota}
+    could be selected rather than \texttt{el} to select a capital adscript
+    iota on uppercasing an \emph{ypogegrammeni}
 \end{itemize}
 
-When you are debugging your file, you will probably need more
-information than is normally displayed by \LaTeXe.  This is achieved
-by resetting the counter |errorcontextlines| from its default value of
-$-1$ to a much higher value, e.g.~999.
-
-\subsection{Accommodating compatibility mode}
-
-Sometimes an existing collection of \LaTeX~2.09 documents makes it
-inconvenient or impossible to abandon the old commands entirely.
-If this is the case, then it is possible to accommodate both conventions
-by making special provision for documents processed in compatibility
-mode.
-
-\begin{decl}
-|\if at compatibility|
-\end{decl}
-This switch is set when a document begins with |\documentstyle| rather
-than |\documentclass|.  Appropriate code can be supplied for either
-condition, as follows:
+For example, the case changing command \cs{MakeUppercase} is (conceptually)
+defined as
 \begin{verbatim}
-   \if at compatibility
-     <code emulating LaTeX 2.09 behavior>
-   \else
-     <code suitable for LaTeX2e>
-   \fi
+\ExpandArgs{e}\MakeUppercaseAux{\BCPdata{casing}}{#1}
 \end{verbatim}
+where |#1| is the user input and the first argument to
+\cs{MakeUppercaseAux} takes two arguments, the locale and input text.
 
+\section{Commands superseded for new material}
 
-\subsection{Font commands}
+A small number of commands were introduced as part of \LaTeXe{} in the
+mid-1990s, are widely used but have been superseded by more modern methods.
+These are covered here as they are likely to be encountered routinely in
+existing classes and packages.
 
-Some font and size commands are now defined by the document class
-rather than by the \LaTeX{} kernel.  If you are upgrading a
-\LaTeX~2.09 document style to a class that does not load one of the
-standard classes, then you will probably need to add definitions for
-these commands.
+\subsection{Defining commands}
 
+The \texttt{*}-forms of these commands should be used to define
+commands that are not, in \TeX{} terms, long.  This can be useful for
+error-trapping with commands whose arguments are not intended to
+contain whole paragraphs of text.
+
 \begin{decl}
-   |\rm| |\sf| |\tt| |\bf| |\it| |\sl| |\sc|
+  |\DeclareRobustCommand| \arg{cmd} \oarg{num} \oarg{default}
+     \arg{definition}\\
+  |\DeclareRobustCommand*| \arg{cmd} \oarg{num} \oarg{default}
+     \arg{definition}
 \end{decl}
-None of these short-form font selection commands are defined in the
-\LaTeXe{} kernel.  They are defined by all the standard class files.
+This command takes the same arguments as |\newcommand| but it declares a robust
+command, even if some code within the \m{definition} is fragile. You can use
+this command to define new robust commands, or to redefine existing commands
+and make them robust. A log is put into the transcript file if a command is
+redefined.
 
-If you want to define them in your class file, there are several
-reasonable ways to do this.
-
-One possible definition is:
+For example, if |\seq| is defined as follows:
 \begin{verbatim}
-   \newcommand{\rm}{\rmfamily}
-   ...
-   \newcommand{\sc}{\scshape}
+   \DeclareRobustCommand{\seq}[2][n]{%
+     \ifmmode
+       #1_{1}\ldots#1_{#2}%
+     \else
+       \PackageWarning{fred}{You can't use \protect\seq\space in text}%
+     \fi
+   }
 \end{verbatim}
-This would make the font commands orthogonal; for example
-|{\bf\it text}| would produce bold italic, thus: \textbf{\textit{text}}.
-It will also make them produce an error if used in math mode.
-
-Another possible definition is:
+Then the command |\seq| can be used in moving arguments, even though
+|\ifmmode| cannot, for example:
 \begin{verbatim}
-   \DeclareOldFontCommand{\rm}{\rmfamily}{\mathrm}
-   ...
-   \DeclareOldFontCommand{\sc}{\scshape}{\mathsc}
+   \section{Stuff about sequences $\seq{x}$}
 \end{verbatim}
-This will make |\rm| act like |\rmfamily| in text mode (see above) and
-it will make |\rm| select the |\mathrm| math alphabet in math mode.
 
-Thus |${\rm math} = X + 1$| will produce `${\rm math} = X + 1$'.
+Note also that there is no need to put a |\relax| before the |\ifmmode| at the
+beginning of the definition; this is because the protection given by this
+|\relax| against expansion at the wrong time will be provided internally.
 
-If you do not want font selection to be orthogonal then you can
-follow the standard classes and define:
-\begin{verbatim}
-   \DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
-   ...
-   \DeclareOldFontCommand{\sc}{\normalfont\scshape}{\mathsc}
-\end{verbatim}
-This means, for example, that |{\bf\it text}| will produce medium
-weight (rather than bold) italic, thus: \textit{text}.
-
 \begin{decl}
-   |\normalsize| \\
-   |\@normalsize|
+  |\CheckCommand| \arg{cmd} \oarg{num} \oarg{default}
+     \arg{definition}\\
+  |\CheckCommand*| \arg{cmd} \oarg{num} \oarg{default}
+     \arg{definition}
 \end{decl}
-The command |\@normalsize| is retained for compatibility with
-\LaTeX~2.09 packages which may have used its value; but redefining it
-in a class file will have no effect since it is always reset to have
-the same meaning as |\normalsize|.
+This takes the same arguments as |\newcommand| but, rather than define \m{cmd},
+it just checks that the current definition of \m{cmd} is exactly as given by
+\m{definition}. An error is raised if these definitions differ.
 
-This means that classes \emph{must} now redefine |\normalsize| rather
-than redefining |\@normalsize|; for example (a rather incomplete one):
-\begin{verbatim}
-   \renewcommand{\normalsize}{\fontsize{10}{12}\selectfont}
-\end{verbatim}
-Note that |\normalsize| is defined by the \LaTeX{} kernel to be an
-error message.
+This command is useful for checking the state of the system before your package
+starts altering the definitions of commands. It allows you to check, in
+particular, that no other package has redefined the same command.
 
-\begin{decl}
-   |\tiny| |\footnotesize| |\small| |\large|\\
-   |\Large| |\LARGE| |\huge| |\Huge|
-\end{decl}
-None of these other `standard' size-changing commands are defined in
-the kernel: each needs to be defined in a class file if you need it.
-They are all defined by the standard classes.
+\subsection{Option declaration}
+\label{Sec:commands.options.dec}
 
-This means you should use |\renewcommand| for |\normalsize| and
-|\newcommand| for the other size-changing commands.
+The following commands deal with the declaration and handling of options to
+document classes and packages using a classical `simple text' approach. Every
+option name must be a `\LaTeX{} name'.
 
+There are some commands designed especially for use within the \m{code}
+argument of these commands (see below).
 
-\subsection{Obsolete commands}
+\begin{decl}
+  |\DeclareOption| \arg{option-name} \arg{code}
+\end{decl}
+This makes \m{option-name} a `declared option' of the class or package in which
+it is put.
 
-Some packages will not work with \LaTeXe{}, normally because they relied
-on an internal \LaTeX{} command which was never supported and has now
-changed, or been removed.
+The \m{code} argument contains the code to be executed if that option is
+specified for the class or package; it can contain any valid \LaTeXe{}
+construct.
 
-In many cases there will now be a robust, high-level means of
-achieving what previously required low-level commands.  Please consult
-Section~\ref{Sec:commands} to see if you can now use the \LaTeXe{}
-class and package writers commands.
+Example:
+\begin{verbatim}
+   \DeclareOption{twoside}{\@twosidetrue}
+\end{verbatim}
 
-Also, of course, if your package or class redefined any of the kernel
-commands (i.e.~those defined in the files |latex.tex|, |slitex.tex|,
-|lfonts.tex|, |sfonts.tex|) then you will need to check it very
-carefully against the new kernel in case the implementation has
-changed or the command no longer exists in the \LaTeX2e{} kernel.
-
-Too many of the internal commands of \LaTeX~2.09 have been
-re-implemented or removed to be able to list them all here. You must
-check any that you have used or changed.
-
-We shall, however, list some of the more important commands which are
-no longer supported.
-
 \begin{decl}
-   |\tenrm| |\elvrm| |\twlrm| \dots\\
-   |\tenbf| |\elvbf| |\twlbf| \dots\\
-   |\tensf| |\elvsf| |\twlsf| \dots\\
-   \qquad$\vdots$
+  |\DeclareOption*| \arg{code}
 \end{decl}
-The (approximately) seventy internal commands of this form are no longer
-defined.  If your class or package uses them then \emph{please}
-replace them with new font commands described in \emph{\fntguide}.
+This declares the \m{code} to be executed for every option which is specified
+for, but otherwise not explicitly declared by, the class or package; this code
+is called the `default option code' and it can contain any valid \LaTeXe{}
+construct.
 
-For example, the command |\twlsf| should be replaced by:
-\begin{verbatim}
-   \fontsize{12}{14}\normalfont\sffamily\selectfont
-\end{verbatim}
+If a class file contains no |\DeclareOption*| then, by default, all specified
+but undeclared options for that class will be silently passed to all packages
+(as will the specified and declared options for that class).
 
-Another possibility is to use the |rawfonts| package, described in
-\emph{\usrguide}.
+If a package file contains no |\DeclareOption*| then, by default, each
+specified but undeclared option for that package will produce an error.
 
-Also, remember that many of the fonts preloaded by \LaTeX~2.09
-are no longer preloaded.
+\subsection{Commands within option code}
+\label{Sec:within.code}
 
+These two commands can be used only within the \m{code} argument of either
+|\DeclareOption| or |\DeclareOption*|. Other commands commonly used within
+these arguments can be found in the next few subsections.
+
 \begin{decl}
-   |\vpt| |\vipt| |\viipt| \dots
+  |\CurrentOption|
 \end{decl}
-These were the internal size-selecting commands in \LaTeX~2.09.
-(They can still be used in \LaTeX~2.09 compatibility mode.)
-Please use the command |\fontsize| instead: see \emph{\fntguide} for
-details.
+This expands to the name of the current option.
 
-For example, |\vpt| should be replaced by:
-\begin{verbatim}
-   \fontsize{5}{6}\normalfont\selectfont
-\end{verbatim}
-
 \begin{decl}
-  |\prm|, |\pbf|, |\ppounds|, |\pLaTeX| \dots
+  |\OptionNotUsed|
 \end{decl}
-\LaTeX~2.09 used several commands beginning with |\p| in order to
-provide `protected' commands.  For example, |\LaTeX| was defined to be
-|\protect\pLaTeX|, and |\pLaTeX| was defined to produce the \LaTeX{}
-logo.  This made |\LaTeX| robust, even though |\pLaTeX| was not.
+This causes the current option to be added to the list of `unused options'.
 
-These commands have now been reimplemented using
-|\DeclareRobustCommand|
-(described in Section~\ref{Sec:commands.define}).
-If your package redefined one of the |\p|-commands then you must
-remove the redefinition and use |\DeclareRobustCommand| to redefine the
-non-|\p| command.
+\subsection{Option processing}
+\label{Sec:commands.options}
 
 \begin{decl}
-|\footheight|\\
-|\@maxsep|\\
-|\@dblmaxsep|
+  |\ProcessOptions|
 \end{decl}
-These parameters are not used by \LaTeXe{} so they have been removed,
-except in \LaTeX~2.09 compatibility mode.  Classes should no longer
-set them.
+This command executes the \m{code} for each selected option.
 
-\begin{thebibliography}{1}
+We shall first describe how |\ProcessOptions| works in a package file, and then
+how this differs in a class file.
 
-\bibitem{A-W:DEK91}
-Donald~E. Knuth.
-\newblock {\em The \TeX book}.
-\newblock Addison-Wesley, Reading, Massachusetts, 1986.
-\newblock Revised to cover \TeX3, 1991.
+To understand in detail what |\ProcessOptions| does in a package file, you have
+to know the difference between \emph{local} and \emph{global} options.
+\begin{itemize}
+\item \textbf{Local options} are those which have been explicitly
+  specified for this particular package in the \m{options} argument of
+  any of these:
+\begin{quote}
+    |\PassOptionsToPackage{<options>}| \ |\usepackage[<options>]|\\
+    |\RequirePackage[<options>]|
+\end{quote}
+\item \textbf{Global options} are any other options that are specified
+  by the author in the \m{options} argument of
+    |\documentclass[<options>]|.
+\end{itemize}
+For example, suppose that a document begins:
+\begin{verbatim}
+   \documentclass[german,twocolumn]{article}
+   \usepackage{gerhardt}
+\end{verbatim}
+whilst package |gerhardt| calls package |fred| with:
+\begin{verbatim}
+   \PassOptionsToPackage{german,dvips,a4paper}{fred}
+   \RequirePackage[errorshow]{fred}
+\end{verbatim}
+then:
+\begin{itemize}
+\item |fred|'s local options are |german|, |dvips|, |a4paper|
+  and |errorshow|;
+\item |fred|'s only global option is |twocolumn|.
+\end{itemize}
 
-\bibitem{A-W:LLa94}
-Leslie Lamport.
-\newblock {\em {\LaTeX:} A Document Preparation System}.
-\newblock Addison-Wesley, Reading, Massachusetts, second edition, 1994.
+When |\ProcessOptions| is called, the following happen.
+\begin{itemize}
+\item \emph{First}, for each option so far declared in |fred.sty|
+  by |\DeclareOption|, it looks to see if that option is either a
+  global or a local option for |fred|: if it is then the corresponding
+  code is executed.
 
-\bibitem{A-W:MG2004}
-Frank Mittelbach and Michel Goossens.
-\newblock {\em The {\LaTeX} Companion second edition}.
-\newblock With Johannes Braams, David Carlisle, and Chris Rowley.
-\newblock Addison-Wesley, Reading, Massachusetts, 2004.
+  This is done in the order in which these options
+  were declared in |fred.sty|.
+\item \emph{Then}, for each remaining \emph{local} option, the command
+  |\ds@<option>| is executed if it has been defined somewhere (other
+  than by a |\DeclareOption|); otherwise, the `default option code' is
+  executed.  If no default option code has been declared then an error
+  message is produced.
 
-\end{thebibliography}
+  This is done in the order in which these
+  options were specified.
+\end{itemize}
+Throughout this process, the system ensures that the code declared for
+an option is executed at most once.
 
-\newpage
-\thispagestyle{empty}
+Returning to the example, if |fred.sty| contains:
+\begin{verbatim}
+   \DeclareOption{dvips}{\typeout{DVIPS}}
+   \DeclareOption{german}{\typeout{GERMAN}}
+   \DeclareOption{french}{\typeout{FRENCH}}
+   \DeclareOption*{\PackageWarning{fred}{Unknown `\CurrentOption'}}
+   \ProcessOptions\relax
+\end{verbatim}
+then the result of processing this document will be:
+\begin{verbatim}
+   DVIPS
+   GERMAN
+   Package fred Warning: Unknown `a4paper'.
+   Package fred Warning: Unknown `errorshow'.
+\end{verbatim}
+Note the following:
 
-\section*{\LaTeXe{} Summary sheet: updating old styles}
+\begin{itemize}
+\item the code for the |dvips| option is executed before that for the
+  |german| option, because that is the order in which they are declared
+  in |fred.sty|;
+\item the code for the |german| option is executed only once, when the
+  declared options are being processed;
+\item the |a4paper| and |errorshow| options produce the warning from
+  the code declared by |\DeclareOption*| (in the order in which they
+  were specified), whilst the |twocolumn| option does not: this is
+  because |twocolumn| is a global option.
+\end{itemize}
 
-Section references below are to \emph{\clsguide}.
+In a class file, |\ProcessOptions| works in the same way, except that:
+\emph{all} options are local; and the default value for |\DeclareOption*| is
+|\OptionNotUsed| rather than an error.
 
-\begin{enumerate}
+Note that, because |\ProcessOptions| has a |*|-form, it is wise to follow the
+non-star form with |\relax|, as in the previous examples, since this prevents
+unnecessary look ahead and possibly misleading error messages being issued.
 
-\item Should it become a class or a package?
-  See Section~\ref{Sec:classorpkg} for how to answer this question.
+\begin{decl}
+  |\ProcessOptions*|
+\end{decl}
+This is like |\ProcessOptions| but it executes the options in the order
+specified in the calling commands, rather than in the order of declaration in
+the class or package. For a package this means that the global options are
+processed first.
 
-\item If it uses another style file, then you will need to obtain an
-  updated version of this other file.  Look at Section~\ref{Sec:loading}
-  for information on how to load other class and package files.
+\begin{decl}
+  |\ExecuteOptions| \arg{options-list}
+\end{decl}
 
-\item Try it: see Section~\ref{Sec:try-it}.
+It can be used to provide a `default option list' just before
+|\ProcessOptions|. For example, suppose that in a class file you want to set up
+the default design to be: two-sided printing; 11pt fonts; in two columns. Then
+it could specify:
+\begin{verbatim}
+   \ExecuteOptions{11pt,twoside,twocolumn}
+\end{verbatim}
 
-\item It worked?  Excellent, but there are probably still some things
-  you should change in order to make your file into a well-structured
-  \LaTeXe{} file that is both robust and portable. So you should now
-  read Section~\ref{Sec:writing}, especially~\ref{Sec:general}.  You
-  will also find some useful examples in Section~\ref{Sec:structure}.
-
-  If your file sets up new fonts, font-changing commands or symbols,
-  you should also read \emph{\fntguide}.
-
-\item It did not work?  There are three possibilities here:
-  \begin{itemize}
-  \item  error messages are produced whilst reading your file;
-  \item  error messages are produced whilst processing test documents;
-  \item  there are no errors but the output is not as it should be.
-  \end{itemize}
-  Don't forget to check carefully for this last possibility.
-
-  If you have got to this stage then you will need to read
-  Section~\ref{Sec:upgrade} to find the solutions that will make your
-  file work.
-\end{enumerate}
-
 \end{document}

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/cmfonts.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/cyrguide.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/doc-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/docstrip.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/encguide.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/exscale.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/fix-cm.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/fntguide.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/fntguide.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/fntguide.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/fntguide.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -42,7 +42,7 @@
 
 \title{\LaTeXe{} font selection}
 
-\author{\copyright~Copyright 1995--2022, \LaTeX\ Project
+\author{\copyright~Copyright 1995--2023, \LaTeX\ Project
   Team.\thanks{Thanks to Arash Esbati for documenting the
     newer NFSS features of 2020}\\
   All rights reserved.%
@@ -52,7 +52,7 @@
    \texttt{fntguide.tex} for full details.}%
 }
 
-\date{August 2022}
+\date{May 2023}
 
 \begin{document}
 
@@ -299,8 +299,6 @@
 should get |sb| assigned, etc.
 
 
-\newpage
-
 \NEWdescription{2020/02/02}
 The most common values for the font shape are:
 \begin{center}
@@ -325,7 +323,7 @@
   \end{minipage}
 \end{center}
 and there is also |ui| for upright italic, i.e., an italic shape but
-artifically turned upright. This is sometimes useful and available in
+artificially turned upright. This is sometimes useful and available in
 some fonts.
 
 
@@ -404,9 +402,7 @@
 Section~\ref{Sec:install}.
 
 
-\newpage
 
-
 \subsection{Selection commands}
 
 The low-level commands used to select a text font are as follows.
@@ -955,7 +951,6 @@
    \DeclareMathSymbol{\alphld}{\mathalpha}{AMSb}{"0C}
 \end{verbatim}
 
-\newpage
 
 \begin{decl}
   |\DeclareMathDelimiter| \arg{cmd} \arg{type}
@@ -1382,7 +1377,7 @@
 from this subsection.
 
 \NEWdescription{2019/07/10}
-As an exception it may also contain a |\DeclareFontsubstitution|
+As an exception it may also contain a |\DeclareFontSubstitution|
 declaration (described in \ref{sec:encoding-defaults}) to specify how
 font substitution for this encoding should be handled.  In that case it
 is important that the values used point to a font that is guaranteed to
@@ -1431,6 +1426,8 @@
 It also saves the value of \m{encoding} in the macro
 |\LastDeclaredEncoding|.
 
+\newpage
+
 Example:
 \begin{verbatim}
    \DeclareFontEncoding{OT1}{}{}
@@ -1496,6 +1493,8 @@
 It does not produce an error if the command has already
 been defined but logs the redefinition in the transcript file.
 
+\newpage
+
 \begin{decl}
   |\DeclareTextAccent| \arg{cmd} \arg{encoding} \arg{slot}
 \end{decl}
@@ -1611,6 +1610,8 @@
 
 For more examples of these definitions, see |ltoutenc.dtx|.
 
+\newpage
+
 \begin{decl}[1994/12/01]
   |\ProvideTextCommandDefault| \arg{cmd} \arg{definition}
 \end{decl}
@@ -2440,10 +2441,8 @@
 are the slots in the |TS1| encoding, |acc| indicates a `constructed'
 accent.
 
-\newpage
 
 
-
 \begin{table}[!tbp]
   \centering\footnotesize
   \begin{tabular}[t]{@{}lp{1.5em}l@{}}

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/graphpap.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ifthen.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/inputenc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/lamport-manual.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/latexrelease.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/latexsym.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/lb2.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/letter.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/lgc2.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/lppl.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltcmdhooks-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltcmdhooks-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltfilehook-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltfilehook-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/lthooks-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/lthooks-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltluatex.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltmarks-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltmarks-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews01.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews02.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews03.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews04.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews05.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews06.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews07.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews08.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews09.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews10.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews11.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews12.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews13.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews14.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews15.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews16.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews17.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews18.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews19.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews20.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews20.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/ltnews20.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/ltnews20.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 1993--2019
+% Copyright (C) 1993-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews21.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews21.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/ltnews21.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/ltnews21.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 2019
+% Copyright (C) 2019-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews22.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews23.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews24.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews25.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews26.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews27.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews28.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews29.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews30.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews30.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/ltnews30.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/ltnews30.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 2019
+% Copyright (C) 2019-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews31.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews31.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/ltnews31.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/ltnews31.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 2019-2020
+% Copyright (C) 2019-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews32.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews32.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/ltnews32.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/ltnews32.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 2019-2020
+% Copyright (C) 2019-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews33.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews33.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/ltnews33.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/ltnews33.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 2019-2021
+% Copyright (C) 2019-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews34.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews34.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/ltnews34.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/ltnews34.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 2019-2021
+% Copyright (C) 2019-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews35.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews35.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/ltnews35.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/ltnews35.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 2021-2022
+% Copyright (C) 2021-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %
@@ -322,7 +322,6 @@
 \ProcessKeyOptions
 \end{verbatim}
 will now automatically pick up the package name as the key \emph{family},
-%unless explicitly given as an optional argument.
 unless explicitly given as an optional argument:
 \begin{verbatim}
 \ProcessKeyOptions[family]
@@ -378,9 +377,7 @@
 offers a rich syntax allowing for extensive calculations, whereas the
 other three commands are essentially thin wrappers for \cs{numexpr},
 \cs{dimexpr}, and \cs{glueexpr} \Dash therefore inheriting some syntax
-%peculiars and limitations in expressiveness.
 peculiarities and limitations in expressiveness.
-%  \newcommand\calulateheight[1]{%
 \begin{verbatim}
   \newcommand\calculateheight[1]{%
     \setlength\textheight{\dimeval{\topskip
@@ -698,7 +695,7 @@
 as Unicode codepoints U+2329 and U+232A no longer break when the
 source file gets normalized under Unicode normalization rules.
 %
-\githubissue{gh/714}
+\githubissue{714}
 
 
 
@@ -907,7 +904,6 @@
 
 
 \subsection{Fix locating files with \cs{graphicspath}}
-%
 
 If a call to \cs{includegraphics} asked for a file (say, \file{image})
 without extension, and if both \file{A/image.pdf} and \file{B/image.tex}
@@ -953,22 +949,10 @@
   \emph{\LaTeX{} Tagged PDF \Dash A blueprint for a large project}.\\
   \url{https://latex-project.org/publications/indexbyyear/2020/}
 
-%\bibitem{35:source2e}
-%  \emph{\LaTeX{} documentation on the \LaTeX{} Project Website}.\\
-%  \url{https://latex-project.org/help/documentation/}
-
-%\bibitem{35:ltnews31} \LaTeX{} Project Team:
-%  \emph{\LaTeXe{} news 31}.\\
-%  \url{https://latex-project.org/news/latex2e-news/ltnews31.pdf}
-
 \bibitem{35:ltnews32} \LaTeX{} Project Team:
   \emph{\LaTeXe{} news 32}.\\
   \url{https://latex-project.org/news/latex2e-news/ltnews32.pdf}
 
-%\bibitem{35:ltnews33} \LaTeX{} Project Team:
-%  \emph{\LaTeXe{} news 33}.\\
-%  \url{https://latex-project.org/news/latex2e-news/ltnews33.pdf}
-
 \bibitem{35:ltnews34} \LaTeX{} Project Team:
   \emph{\LaTeXe{} news 34}.\\
   \url{https://latex-project.org/news/latex2e-news/ltnews34.pdf}

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews36.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews36.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/ltnews36.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/ltnews36.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 2021-2022
+% Copyright (C) 2021-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews37.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews37.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/ltnews37.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/ltnews37.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 2021-2023
+% Copyright (C) 2021-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %
@@ -124,7 +124,8 @@
 
 % \publicationday{01} % change this if it's not released on 1st of a month
 \publicationmonth{June}
-\publicationyear{2023  --- DRAFT version for upcoming release}
+%\publicationyear{2023  --- DRAFT version for upcoming release}
+\publicationyear{2023}
 
 \publicationissue{37}
 
@@ -142,15 +143,17 @@
 \medskip
 
 
-\section{Introduction}
+%\section{Introduction}
 
 
+
 \section{New functionality offered as part of the
   \enquote{\LaTeX{} Tagged PDF} project}
 
 We have now enabled new automatic tagging functionality for additional
 \LaTeX{} elements, among them most display environments, standard
-sectioning commands and content, figure and table listings. This can
+sectioning commands, content, figure and table listings, floats and graphics and
+bibliographies. This can
 be activated through
 \begin{verbatim}
 \DocumentMetadata{testphase=phase-III}
@@ -168,9 +171,9 @@
 
 Also note that there are still several environments and commands
 described in the \LaTeX{} manual that do not have tagging support yet,
-notably tabulars, floats, \texttt{tabbing} and the various math
-environment.  They will get this support as part of \texttt{phase-III}
-between now and the June release.
+notably tabulars, \texttt{tabbing}, the various math environment and a
+few others.  They will get this support as part of \texttt{phase-III},
+but some of them will be delayed until after the June release.
 
 A prototype for math tagging (including support for the \pkg{amsmath}
 environments) is already available, but it is mainly intended for
@@ -194,61 +197,85 @@
 Feedback is welcome! 
 Please use \url{https://github.com/latex3/latex2e/discussions/1010}.
 
-\section{Documentation improvements}
 
 
-\subsection{Displaying the exact release dates for \LaTeX{}}
+\section{New or improved commands}
 
-In some situations it is necessary to find out the exact release dates
-for older version of the \LaTeX{} format, for example, when you need
-to use different code in a package depending on the availablilty of a
-certain feature and you therefore want to use
-\cs{IfFormatAtLeastTF}\texttt\{\meta{date}\texttt\} or the
-rather horrible construction \verb/\@ifl at t@r\fmtversion{/\meta{date}\texttt\},
-if you
-want to cater for formats that are older than 2020.
+\subsection{Extending hooks to take arguments}
 
-Or you know that your package is definitely not going to work with a
-format before a certain \meta{date}, in which case you could use
-\verb/\NeedsTeXFormat{LaTeX2e}[/\meta{date}\texttt] to ensure that any
-  user is alerted if their format is too old.
+Hooks have always been containers for code whose outcome was entirely
+dependent on the contents of the hook alone.  If any type of contextual
+information had to be passed to the hook, it had to be done by setting
+some variable before the hook so that the code in the hook could use
+that.  But this is somewhat hard to keep track of, clumsy to implement,
+and it required the programmer to have some kind of \enquote{hook before
+the hook} to do that setup.
 
-The big problem is to know the exact \meta{date} to put into such
-commands and in the past that was not that easy to find. You could have 
-looked in the the file \file{changes.txt}, but that is hidden somewhere
-in your installation and if you try
-\verb*/texdoc -l changes.txt/ you get more than thirty results and the
-right file is by no means the first.
+To make things a bit easier, \pkg{lthooks} was enhanced to support hooks
+with arguments.  Hooks can now be declared and used with arguments, then
+the code added to these hooks can reference the hook's arguments using
+\verb|#1|, \verb|#2|, etc., so now hooks can behave more like macros
+than like \emph{token lists} (using \pkg{expl3} terminology).  Regular
+argument-less hooks continue to work exactly like they did before:  this
+extension is completely compatible with older documents and packages.
 
-Yukai Chou (\textsf{@muzimuzhi}) kindly provided a patch for this, so that we now have
-the exact dates for each \LaTeX{} format listed in an easy to remember
-place: in \file{ltnews.pdf} and that file conveniently also contains all major
-features and changes to \LaTeX{} over the years\Dash one of which is
-most likely the reason you need the \meta{date} date in the first
-place.
+\AddToHook{cmd/verbatim at font/after}[hack]{\small}
+To declare a hook with arguments, use
+\begin{verbatim}
+\NewHookWithArguments {<hook>} {<num args>}
+\end{verbatim}
+then, similarly, to use the code in the hook (supposing a hook declared
+with 2 arguments), write
+\begin{verbatim}
+\UseHookWithArguments {<hook>} {2} {<arg 1>} {<arg 2>}
+\end{verbatim}
 
-It is given in parentheses in the newsletter title, thus this
-newsletter tells you that on
-%
-\makeatletter
-\mbox{\expandafter\@gobblenonyear\@year\@nil
-  -\@julianmonthtonum\@month-\two at digits\@day}
-\makeatother
-%
-the command
-\cs{NewEnvironmentCopy}, a new \texttt{shipout} hook, etc.\ was made
-available.  And looking into \file{ltnews.pdf} you can now easily find
-out that the \LaTeX3 programming layer was added on 2020-02-02
-(because the date was so nice) and not on the first of the month.
-%
-\githubissue{982}
+Or, if you want to add some code to a hook that takes arguments, write
+\begin{verbatim}
+\AddToHookWithArguments {<hook>} [<label>] {<code>}
+\end{verbatim}
+exactly like you would for regular hooks, except that the \meta{code}
+can use the arguments by referencing \verb|#1|, \verb|#2|, etc.  In this
+case, if you want to add an actual parameter token (\verb|#|) to the
+\meta{code}, you have to double it, as usual.
+\RemoveFromHook{cmd/verbatim at font/after}[hack]
 
+Additionally, if you want to add \enquote{regular} code to a hook with
+arguments, you can still use \cs{AddToHook} --- in that case \verb|#|
+tokens are \emph{not} doubled.  This means that a package author can
+decide to add arguments to an existing hook without worrying about
+compatibility: \cs{AddToHook} will do the right thing and will not
+mistakenly reference the newly added arguments.
 
+The commands \cs{NewReversedHookWithArguments}, \cs
+{NewMirroredHookPairWithArguments}, \cs
+{AddToHookNextWithArguments}, \cs{UseOneTimeHookWithArguments}, and
+the \pkg{expl3} conterparts of the commands discussed in this section
+were also added.  The complete documentation can be found in the
+\pkg{lthooks} documentation \cite{37:lthooks-doc}.
 
-\section{New or improved commands}
+\subsubsection{Generic \texttt{cmd} hooks with arguments}
 
+Along with the possibility to pass arguments to a regular hook as
+discussed above, generic \hook{cmd} hooks now can access the arguments
+of the command they are patched into using the interface described in
+the previous section.
 
+For example, if you were to add some code to the \cs{title} command
+using hooks, you could access the actual title given in the argument.
+For example, to write the title of the document in the terminal you
+could use:
+\begin{verbatim}
+  \AddToHookWithArguments{cmd/title/before}
+    {\typeout{Document title: #1}}
+\end{verbatim}
 
+As with regular hooks, code added to a \hook{cmd} hook using
+\cs{AddToHook} will not be able to access the command's arguments.  This
+means that, as with regular hooks, this change is completely backwards
+compatible, so previous usages of \hook{cmd} hooks will work exactly as
+they did before.
+
 \subsection{Providing copy and show functions for environments}
 
 To copy a command definition we have introduced \cs{NewCommandCopy} in
@@ -279,33 +306,126 @@
 %
 \githubissue{963}
 
+\subsection{\cs{IfFileAtLeastTF}}
 
+The 2020-10-01 \LaTeX{} release introduced the CamelCase tests
+\cs{IfClassAtLeastTF} and \cs{IfPackageAtLeastTF} for checking class
+and package dates. We have now added \cs{IfFileAtLeastTF} to allow the
+same to happen for generic files which contain a \cs{ProvidesFile}
+line.
+%
+\githubissue{1015}
 
+\subsection{\cs{DeclareLowercaseMapping}, \cs{DeclareTitlecaseMapping}
+  and \cs{DeclareUppercaseMapping}}
 
-\section{Code improvements}
+The move from a case-changing approach using \cs{lccode} and \cs{uccode} data
+to one where information is stored by a kernel-managed structure left a gap in
+the ability of the user to \emph{tune} the case changing outcomes. This has now
+been addressed by the addition of three commands
+\begin{itemize}
+  \item \cs{DeclareLowercaseMapping}
+  \item \cs{DeclareTitlecaseMapping}
+  \item \cs{DeclareUppercaseMapping}
+\end{itemize}
+which can be used to customise the outcome for codepoints. This can be applied
+generally or to a specific locale (see also the next section). A small number
+of pre-defined customisations have been set up in the kernel where the outcomes
+for \pdfTeX{} should be different for those from Unicode engines. For
+example
+\begin{verbatim}
+  \DeclareUppercaseMapping{"01F0}{\v{J}}
+\end{verbatim}
+allows \v{J} to be produced in 8-bit engines: without this customisation,
+an error would occur as there is no pre-composed \v{J} in Unicode. More detail
+is given in \texttt{usrguide}.
+%
+\githubissue{1033}
 
-\subsection{\pkg{doc}: Index \texttt{\textbackslash\textvisiblespace} correctly}
+\subsection{\cs{BCPdata}}
 
-\emph{to write}
+Improvements in the Unicode handling for case changing have highlighted that
+the kernel has not to-date been locale-aware. The packages \pkg{babel} and
+\pkg{polyglossia} provide comprehensive locale support, but did not have
+an agreed unified interface to pass that information back to other code.
+Following discussion with the maintainers of those two bundles, the kernel
+now defines \cs{BCPdata} as a stub (so it is always defined), and \pkg{babel}
+and \pkg{polyglossia} will redefine it to provide the locale data. An agreed
+set of keywords mean that \cs{BCPdata} can be queried in a structured way
+by both the kernel and any other \enquote{consumer} packages.
 %
-\githubissue{943}
+\githubissue{1035}
 
+\subsection{Improve \cs{samepage}}
 
-\subsection{Default definition for \cs{do}}
+The \cs{samepage} declaration sets various parameters to
+\texttt{10000} to prevent undesired page breaks.  The
+\cs{predisplaypenalty} parameter has already by default a value of
+\texttt{10000} and to save space back in the days it was therefore not
+explicitly set. However, there are a few classes that change the
+parameter and as result the user might experience a page break in
+front of a display formula within the scope of \cs{samepage} when
+using such classes. This has now been corrected and
+\cs{predisplaypenalty} is also explicitly set to \texttt{10000}.
+%
+\githubissue{1022}
 
-The command \cs{do} with its nice public name is in reality an
-internal command inherited from plain \TeX{} for list
-processing. However, it only got a definition when
-\verb=\begin{document}= was executed, with a result that a user
-definition in the preamble was unconditionally overwritten at this
-point. To properly alert the user that this command is not freely
-available we now already provide a definition in the format so that
-\cs{newcommand} and friends produce a proper error message instead of
-providing a definition that doesn't last.
+\subsection{Groups in \cs{MakeUppercase}}
 %
-\githubissue{975}
+Prior to 2022, \cs{MakeUppercase} and \cs{MakeLowercase} used a brace
+group around their argument so providing a scope for any declarations
+within the argument. This grouping has been restored (also
+for \cs{MakeTitlecase}), although the underlying L3 text case commands do
+not use grouping.
+%
+\githubissue{1021}
 
+\subsection{Extension of the \cs{label} command}
 
+Previously, in standard \LaTeX{}, the \cs{label} command wrote a \cs{newlabel} declaration into
+the \texttt{.aux} file and stored two values in
+second argument of this \cs{newlabel} command:
+\cs{@currentlabel}, which normally contains the state of the current 
+counter and \cs{thepage} for the current page number.
+
+The packages \pkg{hyperref} and 
+\pkg{nameref} then patched the \cs{label} command to store five values instead.
+In addition to the above they saved \cs{@currentlabelname}, which normally contains the 
+current title text and can be retrieved with \cs{nameref}, and 
+\cs{@currentHref}, which is the name of the destination needed to create an 
+active link. The fifth argument was only used if external 
+references were loaded with the \pkg{xr-hyper} package. 
+
+Starting with this release, the number of values stored in \cs{newlabel} have been unified. 
+\cs{label} now writes a
+\cs{newlabel} command that always contains five values in the second argument (each in a brace group):
+\cs{@currentlabel}, \cs{thepage}, \cs{@currentlabelname}, 
+\cs{@currentHref}, and \cs{@kernel at reserved@label at data} (which is reserved for the kernel).
+
+Additionally, a hook with the name \texttt{label} has been 
+added. It takes one argument: the label string.
+Code added to the hook can refer to this argument with \verb+#1+. 
+The hook is executed directly before the \cs{label} command writes to the \texttt{.aux} file
+but \emph{after} the \cs{@bsphack} command has done its spacing magic and it is located \emph{inside} a group, thus its code only affects the write operation. 
+
+\section{Code improvements}
+
+\subsection{Performance in checking file existence}
+
+The addition of hooks, etc., to file operations had a side-effect in that
+multiple checks were made that the file existed. In larger documents using
+lots of files, these file system operations caused non-trivial performance
+impact. We now cache the existence of files, such that these repeated filesystem
+calls are avoided.
+
+\subsection{\pkg{doc}: Handle \texttt{\textbackslash\textvisiblespace} correctly in the index}
+
+Due to some problems in the code it wasn't possible to prevent
+\verb*=\ = from showing up in the index\Dash \verb=\DoNotIndex{\ }=, etc.\ had no effect. This has now been corrected.
+%
+\githubissue{943}
+
+
 \subsection{\pkg{doc}: Support the \pkg{upquote} package}
 
 The default quote and backquote characters in typewriter fonts are
@@ -341,6 +461,23 @@
 \githubissue{953}
 
 
+\subsection{Default definition for \cs{do}}
+
+The command \cs{do} with its nice public name is in reality an
+internal command inherited from plain \TeX{} for list
+processing. However, it only got a definition when
+\verb=\begin{document}= was executed, with a result that a user
+definition in the preamble was unconditionally overwritten at this
+point. To properly alert the user that this command is not freely
+available we now already provide a definition in the format so that
+\cs{newcommand} and friends produce a proper error message instead of
+providing a definition that doesn't last.
+%
+\githubissue{975}
+
+
+
+
 \subsection{New key for \env{filecontents}}
 
 The \env{filecontents} environment warns on the terminal if a file
@@ -350,7 +487,7 @@
 that redirects the overwriting warning to the transcript file. We
 think that some record of the action is still required to help with
 debugging, thus it is not completely silenced. The warning that
-nothing gets written, because the file aready exists (and the
+nothing gets written, because the file already exists (and the
 \texttt{force} key was not used), is not altered and still shows up on
 the terminal.
 %
@@ -357,7 +494,6 @@
 \githubissue{958}
 
 
-
 \subsection{A further hook for shipping out pages}
 
 Since October 2020 the shipout process offers a number of hooks to
@@ -429,11 +565,22 @@
 for example, \pkg{wrapfig} in that special situation).
 %
 This got fixed with the 2022-11 PL1 hotfix, so was already corrected in
-the previous release, but only now documented in a newletter.
+the previous release, but only now documented in the newsletter.
 %
 \githubissue{967}
 
+\subsection{Ensure that \cs{cs} is defined in \cls{ltxdoc}}
 
+The class \cls{ltxdoc} defined the command \cs{cs} to typeset a
+command name with a backslash in front. This definition was moved to
+the \pkg{doc} package itself. This meant that it was suddenly missing
+when reverting to the old \pkg{doc} package implementation via the
+class option \texttt{doc2}. This has now been corrected.
+%
+\githubissue{981}
+
+
+
 \subsection{Improve spacing at top of \env{minipages}}
 
 A list and several other document elements add some vertical space in
@@ -453,16 +600,181 @@
 \githubissue{989}
 
 
+\subsection{A fix for \cs{NewCommandCopy} and \cs{ShowCommand}}
 
-\section{Changes to packages in the \pkg{amsmath} category}
+When copying and showing definitions of (non-expandable) document commands
+(aka commands defined by \cs{NewDocumentCommand} and friends) containing empty
+or only \texttt{m}-type arguments, these commands were wrongly recognized as
+expandable ones.
+This is fixed in the present \LaTeX{} release.
+%
+\githubissue{1009}
 
-\section{Changes to packages in the \pkg{graphics} category}
+\subsection{Corrections for switching math version}
+Some internal code improvements improve support for switching math version
+when nested within an outer math expression.
+This will improve \cs{boldsymbol} and \cs{bm} and similar commands.
+%
+\githubissue{1028}
 
+\subsection{Allow par as a filename}
+\verb|\input{par}| or \verb|\includegraphics{par}| could give spurious
+errors. This has been fixed by making an internal command \cs{long}.
+%
+\githubissue{942}
+
+\subsection{Correct setting of \cs{endlinechar} in \texttt{+v} arguments}
+In the particular case of a document command with a \texttt{+v}-type
+argument used inside \cs{ExplSyntaxOn}\texttt{/Off}, newlines would be
+misinterpreted as spaces because the value of \cs{endlinechar} was
+set too late.  This has been fixed, and now newlines are correctly
+translated to ``\verb|the character ^^M|''.
+%
+\githubissue{876}
+
+\subsection{Correct handling of hooks with only `next' code}
+When \cs{AddToHookNext} was used on a not-yet-declared hook, that hook
+would be incorrectly identified as empty by \cs{ShowHook}.  Also, if
+that hook was later declared, that `next' code would not be executed.
+This has been fixed by correctly initializing the hook structure when
+\cs{AddToHookNext} is used.
+%
+\githubissue{1052}
+
+\subsection{Ignoring space after \texttt{\$\$}}
+Space is normally ignored after a closing \texttt{\$\$},
+but internal \LaTeX{} font handling code could interfere if
+\cs{eqno} was used. \cs{eqno} and \cs{leqno} have been redefined
+to add \cs{ignorespaces} after the math group.
+%
+\githubissue{1059}
+
+\section{Documentation improvements}
+
+\subsection{Updates to the guides}
+
+When \LaTeXe{} was released, the team provided documentation for both document
+authors and package/class developers in the two files \texttt{usrguide} and
+\texttt{clsguide}. Over time, the team have augmented these documents as new
+methods have been added to the kernel. However, they retained there structure
+as starting from familiarity with \LaTeX{}~2.09. This meant that for new users,
+there was material which is no longer relevant, and less clarity than desirable
+in what approaches are recommended today.
+
+The two files have now been (partially) re-written, with the versions available
+previously now frozen as \texttt{usrguide-historic} and \texttt{clsguide-historic}.
+More material has been carried forward in the class/package guide than in the
+user guide, but both are worth a re-read by experienced \LaTeX{} users.
+
+
+
+\subsection{Displaying the exact release dates for \LaTeX{}}
+
+In some situations it is necessary to find out the exact release dates
+for older version of the \LaTeX{} format, for example, when you need
+to use different code in a package depending on the availability of a
+certain feature and you therefore want to use
+\cs{IfFormatAtLeastTF}\texttt\{\meta{date}\texttt\} or the
+rather horrible construction \verb/\@ifl at t@r\fmtversion{/\meta{date}\texttt\},
+if you
+want to cater for formats that are older than 2020.
+
+Or you know that your package is definitely not going to work with a
+format before a certain \meta{date}, in which case you could use
+\verb/\NeedsTeXFormat{LaTeX2e}[/\meta{date}\texttt] to ensure that any
+  user is alerted if their format is too old.
+
+The big problem is to know the exact \meta{date} to put into such
+commands and in the past that was not that easy to find. You could have 
+looked in the the file \file{changes.txt}, but that is hidden somewhere
+in your installation and if you try
+\verb*/texdoc -l changes.txt/ you get more than thirty results and the %*
+right file is by no means the first.
+
+Yukai Chou (\textsf{@muzimuzhi}) kindly provided a patch for this, so that we now have
+the exact dates for each \LaTeX{} format listed in an easy to remember
+place: in \file{ltnews.pdf} and that file conveniently also contains all major
+features and changes to \LaTeX{} over the years\Dash one of which is
+most likely the reason you need the \meta{date} date in the first
+place.
+
+It is given in parentheses in the newsletter title, thus this
+newsletter tells you that on
+%
+\makeatletter
+\mbox{\expandafter\@gobblenonyear\@year\@nil
+  -\@julianmonthtonum\@month-\two at digits\@day}
+\makeatother
+%
+the command
+\cs{NewEnvironmentCopy}, a new \texttt{shipout} hook, etc.\ was made
+available.  And looking into \file{ltnews.pdf} you can now easily find
+out that the \LaTeX3 programming layer was added on 2020-02-02
+(because the date was so nice) and not on the first of the month.
+%
+\githubissue{982}
+
+\subsection{Fresh from the press: \enquote{The \LaTeX{} Companion, third edition} is now in print}
+
+The third edition of \emph{The \LaTeX{} Companion} is now
+available. This is the end of five years of careful work and we hope
+that it will provide our readers with all the information they need to
+successfully navigate the \LaTeX{} ecosystem and efficiently produce
+beautiful documents.
+
+Since the publication of the last edition (2004) a lot has happened in
+the \LaTeX{} world and thus a complete rewrite was necessary.  All
+chapters have been thoroughly revised and in many cases largely
+extended to describe new important functionality and features. More
+than 5,000 add-on packages have been analyzed in detail, out of which
+roughly 10\% have been chosen for inclusion in \emph{The \LaTeX{}
+Companion}. All important aspects of these packages are described to
+provide the user once again with a satisfying one-stop–shop experience
+for the decade to come.
+
+To cover what we thought worth describing today, the book nearly
+doubled in size. The print edition is therefore produced as a
+two-volume set and sold as a bundle. Both volumes come as hard-cover
+with ribbons to easily mark pages in the book.
+
+To give you an idea of what is covered in the third edition you can
+find some excerpts at
+\begin{quote}
+\url{https://www.latex-project.org/news/2023/03/17/TLC3}
+\end{quote}
+
+The edition is also available as an eBook (Parts I and II combined)
+consisting of PDF and ePub format without DRM. Finally, the publisher
+offers the combination of the printed books and the digital versions at
+a very attractive price not available anywhere else.
+
+
+%\section{Changes to packages in the \pkg{amsmath} category}
+
+%\section{Changes to packages in the \pkg{graphics} category}
+
 \section{Changes to packages in the \pkg{tools} category}
 
 
-\subsection{Fix handling of nested \env{multicols}}
+\subsection{\pkg{multicol}: Better support for CJK languages}
 
+The default minimum depth of each column in a \env{multicols}
+corresponds to the depth of a \enquote{p} in the current font. This
+helps to get some uniformity if rules are used between the columns and
+makes sense for Latin-based languages.  Until now it was hard-wired,
+but for CJK (Chinese/Japanese/Korean) languages it is better to use a zero depth, because there
+all characters have the same height and depth.  And even with
+Latin-based languages one might want to use the depth of a \cs{strut}
+or that of a parenthesis. So we now offer a way to adjust this while
+maintaining backward compatibility. Just redefine
+\cs{multicolmindepthstring} to hold whatever you want to get measured
+for its depth (the width is not relevant).
+%
+\githubissue{698}
+
+
+\subsection{\pkg{multicol}: Fix handling of nested environments}
+
 If \env{multicols} environments have been nested into each other (the
 inner one boxed) it could fail if the boxed environment appeared near a
 page break. The problem was that the output routine was called while
@@ -484,6 +796,10 @@
   \emph{The \texttt{\upshape ltshipout} documentation}.\\
   Run \texttt{texdoc} \texttt{ltshipout-doc} to view.
 
+\bibitem{37:lthooks-doc} Frank Mittelbach, Phelype Oleinik, \LaTeX{}~Project~Team:
+ \emph{\LaTeX's hook management}.\\
+ Run \texttt{texdoc} \texttt{lthooks-doc} to view.
+
 %\bibitem{37:blueprint} Frank Mittelbach and Chris Rowley:
 %  \emph{\LaTeX{} Tagged PDF \Dash A blueprint for a large project}.\\
 %  \url{https://latex-project.org/publications/indexbyyear/2020/}

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltpara-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltpara-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltshipout-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltshipout-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltx3info.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltxdoc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/makeindx.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/manifest.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/manifest.txt	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/manifest.txt	2023-05-25 20:39:11 UTC (rev 67218)
@@ -27,7 +27,8 @@
 % sample2e.tex    --  Sample LaTeX input file.
 % small2e.tex     --  Small sample LaTeX input file.
 %
-% clsguide.tex    --  How to write class files.
+% clsguide.tex   --  How to write class files.
+% clsguide-historic.tex    --  How to write class files with a focus on moving from 2.09.
 % cfgguide.tex    --  Guide to using `.cfg' files to configure LaTeX.
 % cyrguide.tex    --  Guide to using cyrillic languages in LaTeX.
 % encguide.tex    --  Guide to font encodings.
@@ -71,6 +72,8 @@
 % ltnews33.tex    --  What was new in the release dated 2021/06.
 % ltnews34.tex    --  What was new in the release dated 2021/11.
 % ltnews35.tex    --  What was new in the release dated 2022/06.
+% ltnews36.tex    --  What was new in the release dated 2022/11.
+% ltnews37.tex    --  What was new in the release dated 2023/06.
 
 %
 % ltx3info.tex    --  Information about the LaTeX3 project.
@@ -77,6 +80,7 @@
 %
 % lamport-manual.err  --  Errata for the LaTeX Manual book, second edition.
 % tlc2.err        --  Errata for the LaTeX Companion, second edition.
+% tlc3.err        --  Errata for the LaTeX Companion, third edition.
 % lb2.err         --  Errata for the LaTeX-Begleiter, 2te erw. Auflage (German).
 % lgc2.err        --  Errata for the LaTeX Graphics Companion, second edition.
 % webcomp.err     --  Errata for the LaTeX Web Companion.

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/modguide.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/nfssfont.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/proc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/slides.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/slifonts.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/source2e.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/syntonly.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/tlc2.pdf
===================================================================
(Binary files differ)

Added: trunk/Master/texmf-dist/doc/latex-dev/base/tlc3.err
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/tlc3.err	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/tlc3.err	2023-05-25 20:39:11 UTC (rev 67218)
@@ -0,0 +1,829 @@
+\newcommand\erratafiledate{2023-05-16}
+
+\def\comando#1{\texttt{\string#1}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% To produce a printed version of this errata file run this file through
+% LaTeX. It will unpack a small class file (if not already present) and
+% a configuration file with the extension .cfg. You might want to modify
+% the setting in this configuration file to print only a partial errata
+% suitable for your printed revision of this book, see details in the
+% .cfg file.
+%
+% The current version of this file can be found at:
+%
+%    https://www.latex-project.org/help/books/
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+\begin{filecontents}{ttcterrata.cls}
+%%
+%% Copyright (C) 1997-2021 Frank Mittelbach
+%% This class file is licenced under LPPL latest version;
+%% see https://www.latex-project.org/lppl
+%
+%
+% It sets up a few commands used to format the errata entries for books in the
+% Addison-Wesley Series:
+%
+%    Tools and Techniques for Computer Typesetting
+%
+% hence the name. However, anybody who likes to use it is free to apply it for
+% errata files of other books.
+%
+% Changes:
+%
+% v1.0a - changed name from errata.cls to ttcterrata.cls
+% v1.0b - added \arraybackslash
+% v1.0c - and took it out again and used \tabularnewline instead
+
+\ProvidesClass{ttcterrata}
+  [2021/08/03 v1.0c Mini class for errata files; subject to change (FMi)]
+
+\LoadClass{article}
+
+\setcounter{secnumdepth}{-1}
+\addtolength\textwidth{5cm}
+\addtolength\oddsidemargin{-3cm}
+
+\addtolength\textheight{36pt}
+
+\RequirePackage{shortvrb}
+\MakeShortVerb{\|}
+
+\RequirePackage{array,longtable}
+\RequirePackage{multicol}
+
+
+\newcommand\erratagetnumber{}
+\def\erratagetnumber#1/#2/#3\erratagetnumber{#1#2#3}
+
+
+\newcommand\gobbleerrata{%
+  \setbox\@tempboxa\vbox\bgroup
+     \let\endgobble\egroup
+     \let\hideamp\relax
+     \let\\\relax
+     \let\tabularnewline\relax
+     \let\par\@@par}
+
+\newcommand*\hideamp{&}
+
+\let\endgobble\relax
+
+
+\newcommand\erratastartdate{}
+\newcommand\myprinting{1}
+
+
+\newcommand\doweprint[2]{%
+  \ifnum \myprinting < \if!#2!1000 \else \ifx s#2 1000\else#2 \fi\fi
+   \ifnum \expandafter\erratagetnumber\erratastartdate\erratagetnumber <
+          \erratagetnumber#1\erratagetnumber \relax
+     \@tempswatrue
+   \else
+     \@tempswafalse
+   \fi
+  \else
+    \@tempswafalse
+  \fi
+}
+
+
+
+\newcommand\includedentries{entries after = \erratastartdate}
+\newcommand\printedentries{between \erratastartdate\space and}
+
+\newcommand\showallerrors{%
+ \renewcommand\includedentries{all errata entries}%
+ \renewcommand\printedentries{up to}
+ \renewcommand\doweprint[2]{\@tempswatrue}}
+
+
+\newcommand\displayrevisionfix[2]{%
+    \if!#2!\textbf{#1}\else\textit{#1}\rlap{\textsuperscript{#2}}\fi}
+
+\newcommand\norevisionnumbers{%
+  \renewcommand\displayrevisionfix[2]{\textbf{##1}}}
+
+\IfFileExists{\jobname.cfg}
+  {
+   \input{\jobname.cfg}
+   \typeout{***************************************************}
+   \typeout{*}
+   \typeout{* Configuration file for \jobname.err found }
+   \typeout{*}
+   \typeout{***************************************************}
+  \AtEndDocument{
+   \typeout{***************************************************}
+   \typeout{*}
+   \typeout{* If you wish to generate an errata listing}
+   \typeout{* containing only errors found after a certain revision}
+   \typeout{* and/or only errors found after a certain date}
+   \typeout{* modify the information stored in \jobname.cfg}
+   \typeout{*}
+   \typeout{* Current settings are:}
+   \typeout{*}
+   \typeout{* \@spaces  printing of your book = \myprinting}
+   \typeout{* \@spaces  include \includedentries}
+   \typeout{*}
+   \typeout{***************************************************}
+  }}
+  {}
+
+%% \erroronpage <page> <line info> <contributor> <date> <fixed in revision>
+
+\newcommand\erroronpage[5]{%
+   \endgobble
+   \doweprint{#4}{#5}%
+   \if at tempswa
+     \typeout{Typesetting entry #1 #2 #3 #4}%
+   \else
+     \typeout{Ignoring entry #1 #2 #3 #4}%
+     \expandafter\gobbleerrata
+   \fi
+   \hideamp \tabularnewline
+   \displayrevisionfix{#1}{#5}
+   \hideamp #2 \hideamp (\textsf{#3}) \hideamp
+}
+
+\newcommand\seriouserroronpage[5]{%
+   \endgobble
+   \doweprint{#4}{#5}%
+   \if at tempswa
+     \typeout{Typesetting entry #1 #2 #3 #4}%
+   \else
+     \typeout{Ignoring entry #1 #2 #3 #4}%
+     \expandafter\gobbleerrata
+   \fi
+   \hideamp \tabularnewline
+   \fbox{\bfseries !!}\hfill
+   \displayrevisionfix{#1}{#5}
+   \hideamp #2 \hideamp (\textsf{#3}) \hideamp
+}
+
+\newcommand\CHAPTER[1]{\endgobble
+  &\tabularnewline[4pt]%
+  \multicolumn{4}{l}{\framebox[10cm][l]{\textbf{\normalsize\strut#1}}} \tabularnewline}
+
+\newenvironment{erratalist}
+  {\begin{longtable}{r>{\raggedright}p{2cm}l>{\raggedright}p{10cm}l}}
+  {\endgobble\end{longtable}}
+
+\newcommand\erratatitle[2]
+  {\begin{center}\LARGE\bfseries
+      Errata list for #1\\[5pt](\myprinting.\ printing)\\[10pt]
+      \small Includes all entries found \printedentries\space #2\\
+      (For other periods/print runs reprocess this document
+      with different config settings)
+   \end{center}%
+   \markright{Errata for #1 (\printedentries\space #2)}%
+   \thispagestyle{plain}%
+   \vspace{20pt}}
+
+\pagestyle{myheadings}
+
+\AtBeginDocument{\small}
+
+\setlength\parindent{0pt}
+\setlength\parskip{2pt}
+
+\newcommand\contributor[2]{\makebox[1cm][l]{\sffamily#1} #2\par}
+
+% some special shortcuts overwriting existing commands:
+
+\let\u\underline
+\renewcommand\>{$\to$}
+
+%%% some code suggested by Thorsten Hansen to count the number of
+%%% contributions by individuals (will work only if we do not get
+%%% too many :-)
+
+\def\count at contributors#1/#2/#3\@nil{
+   \@ifundefined{c@#1}{\newcounter{#1}}{}\stepcounter{#1}%
+%%%   also count secondary:
+%%%   \@ifundefined{c@#2}{\newcounter{#2}}{}\stepcounter{#2}%
+}
+
+\renewcommand\erroronpage[5]{%
+   \count at contributors#3/secondary/\@nil
+   \endgobble
+   \doweprint{#4}{#5}%
+   \if at tempswa
+     \typeout{Typesetting entry #1 #2 #3 #4}%
+   \else
+     \typeout{Ignoring entry #1 #2 #3 #4}%
+     \expandafter\gobbleerrata
+   \fi
+   \hideamp \tabularnewline
+   \displayrevisionfix{#1}{#5}
+   \hideamp #2 \hideamp (\textsf{#3}) \hideamp
+}
+
+\renewcommand\seriouserroronpage[5]{%
+   \count at contributors#3/secondary/\@nil
+   \endgobble
+   \doweprint{#4}{#5}%
+   \if at tempswa
+     \typeout{Typesetting entry #1 #2 #3 #4}%
+   \else
+     \typeout{Ignoring entry #1 #2 #3 #4}%
+     \expandafter\gobbleerrata
+   \fi
+   \hideamp \tabularnewline
+   \fbox{\bfseries !!}\hfill
+   \displayrevisionfix{#1}{#5}
+   \hideamp #2 \hideamp (\textsf{#3}) \hideamp
+}
+
+\renewcommand\contributor[2]{\makebox[1cm][l]{%
+  \sffamily#1} #2\@ifundefined{c@#1}{}{ (\arabic{#1})}\par}
+
+\end{filecontents}
+
+
+\begin{filecontents}{\jobname.cfg}
+%
+%
+% Configuration file for the errata listing of
+%
+%  The LaTeX Companion, Third Edition, Parts I & II
+%
+%
+% \erratastartdate
+%
+% Specifies the date from which on errata entries should be listed.
+%
+% The format is YYYY/MM/DD.
+%
+% The default below ensures that all entries for a particular
+% printing are typeset.
+%
+
+\renewcommand\erratastartdate{2023/04/01}
+
+
+%
+% \myprinting
+%
+% Specifies which (revised) printing you own. For example, if you
+%    have the second printing set this to 2 so that errors already
+%    corrected in that printing will not appear in your errata
+%    listing.
+%
+% The default below ensures that all entries relevant to the x-th
+%    printing are typeset.
+%
+%
+
+\renewcommand\myprinting{1}
+
+%
+% \norevisionnumbers
+%
+% Specifies that all page numbers in the errata are shown in the same
+%    format (bold face) irregardless of whether or not they are fixed
+%    in some revision. The default is to print corrected errors in
+%    italic and add the revision number as a superscript.
+
+%
+% \showallerrors
+%
+% With this command you tell the program that all errata entries are
+%    supposed to be generated. This makes \myprinting and
+%    \erratastartdate basically obsolete so this isn't turned on by
+%    default.
+%
+%
+\endinput
+\end{filecontents}
+
+
+\documentclass{ttcterrata}[2005/11/10]  % we want new class
+
+\usepackage[T1]{fontenc}
+\let\u\underline          % shortcut for this file
+\newcommand\meta[1]{$\langle$\textit{#1\/}$\rangle$}
+
+\usepackage{textcomp}
+
+\usepackage{url}
+
+\begin{document}
+
+\erratatitle{The \LaTeX{} Companion, Third Edition, Parts I \& II}{\erratafiledate}
+
+
+\begin{verbatim}
+ at book(A-W:MF:2023,
+   author = {Frank Mittelbach and Ulrike Fischer},
+   title = {The {\LaTeX} Companion},
+   edition = 3,
+   note =  {With contributions by Javier Bezos, Johannes Braams, and Joseph Wright},
+   series =    {Tools and Techniques for Computer Typesetting},
+   publisher = {Addison-Wesley},
+   address   = {Boston, Massachusetts},
+   year = 2023,
+   pagenums = {976 (Part I) and 1008 (Part II)},
+   bibliography = {yes},
+   index = {yes},
+   isbn = {978-0-13-816648-9},
+)
+\end{verbatim}
+
+
+\begin{list}{}{\setlength\leftmargin{0cm}\setlength\rightmargin{3cm}}
+\item[]
+
+This file (\texttt{\jobname.err}) can be found as part of the \LaTeX{}
+distribution and its latest version is maintained on the \LaTeX{}
+project site at \texttt{https://www.latex-project.org/help/books/\jobname.err}
+where you will also find extracts of the book.
+
+The first column in the table shows the page number of the errata
+entry.  Superscript numbers in the first column refer to the printed
+revision in which this entry was corrected (\textit{s} indicates a
+correction in the sources only). The second
+column gives the precise location (negative line or paragraph numbers
+are counted from the bottom of the page). The third column shows the
+first finder of the problem.
+
+You can customize this list to only show errata related to the printing
+you own by changing the configuration in the file \texttt{\jobname.cfg}.
+
+\begin{center}
+  \Large \bfseries  To Err is Human --- Bug Contest
+\end{center}
+
+Any mistake found and reported is a gain for all readers of our book.
+For this reason Addison-Wesley and the authors offer a prize (for 5
+periods) to the eligible person who finds the largest
+number of bugs during that period (in case of a draw a random choice
+will be made between all those with the largest number of findings).
+A person can receive at most one prize, ever; errors found by any of
+the authors do not count.
+
+Each prize is a free choice of any single computing book found on the
+Addison-Wesley/Pearson web site:
+\texttt{https://www.informit.com} (that
+is, no boxed sets or multiple volume offers).
+
+
+As usual, the authors and publisher reserve the right to make various
+decisions such as whether a reported feature is an error for
+competitive purposes or whether similar features count as a single or
+multiple errors.  ---
+Good luck!
+
+\begin{center}
+\begin{tabular}{clr}
+Contest period ends & Winner \\[4pt]
+2023/?? &                         & ??? suggestions\\
+\end{tabular}
+\end{center}
+
+
+Due to its size the third edition of \textit{The \LaTeX{} Companion} is printed
+as a two-volume set. The digital version, however, is provided as a
+single PDF or ePub. This means that a small fraction of the digital
+content differs from that of the printed version: there is only a
+single font matter, a single bibliography, and a single index, whereas
+in the printed books these are separated out. However, all versions share the main
+matter (down to the page numbering) so most of the errata applies to
+all versions, but to a few only to the digital and others only to the
+printed version. Thus, we end up with three separate lists.
+
+
+\end{list}
+
+%\newpage
+
+
+%<--------------------------
+
+\newcommand\BibTeX{\textsc{Bib}\TeX}
+\newcommand\cs[1]{\texttt{\textbackslash #1}}
+\newcommand\env[1]{\texttt{#1}}
+\newcommand\pkg[1]{\textsf{#1}}
+
+\section*{Errata for the print version (not applicable to the digital version)}
+
+The printed books differ from the digital version in that the
+biligraphy is split across both volumes (with a few repeats) and that
+the font matter of each volume has its own table of contents and list
+of figures and tables. Therefore these parts have different page
+numbers and you will see similar errata entries for both print and
+digital differing only in that respect.
+
+\begin{erratalist}
+
+\CHAPTER{Front matter (Part I)} 
+
+\erroronpage{I-ix\ldots I-xvi}{}{FMi}{2023/04/04}{s}
+Dot leaders have been changed on all sections.
+
+\erroronpage{I-xvii}{chapter head}{FMi}{2023/04/04}{s}
+formulas \> \u{F}ormulas
+
+\erroronpage{I-xvii}{chapter head}{FMi}{2023/04/04}{s}
+documents \> \u{D}ocuments
+
+\erroronpage{I-xvii}{chapter head}{FMi}{2023/04/04}{s}
+beyond \> \u{B}yond
+
+\erroronpage{I-xx\ldots I-xxi}{}{FMi}{2023/04/04}{s}
+Dot leaders have been changed on all sections.
+
+\CHAPTER{Bibliography (Part I)} 
+
+\erroronpage{I-783}{[55], l.-2}{FMi}{2023/04/04}{s}
+all \> \u{them} all
+
+\erroronpage{I-785}{[73], l.-2}{kb/bb}{2023/04/04}{s}
+the go-forward way for \LaTeX-coding \> \\
+the way for \LaTeX{} coding going forward
+
+\erroronpage{I-786}{[87], l.2}{kb/bb}{2023/04/04}{s}
+p. \> pp.
+
+\erroronpage{I-786}{[88], l.2}{kb/bb}{2023/04/04}{s}
+p. \> pp.
+
+\erroronpage{I-787}{[92], l.2}{kb/bb}{2023/04/04}{s}
+Add: Vancouver, 1999
+
+\erroronpage{I-788}{[100], l.3}{kb/bb}{2023/04/04}{s}
+Publishing \> Publishing\u{,}
+
+\erroronpage{I-790}{[122], l.1}{kb/bb}{2023/04/04}{s}
+In \u{ACM editor} ``Proceedings \> In ``PODC'01: Proceedings
+
+\erroronpage{I-790}{[122], l.1}{kb/bb}{2023/04/04}{s}
+In \u{Unicode Consortium, editor} \> In
+
+
+\CHAPTER{Front matter (Part II)} 
+
+\erroronpage{II-x\ldots II-xxviii}{}{FMi}{2023/04/04}{s}
+Dot leaders have been changed on all sections.
+
+\erroronpage{II-xiv}{heading}{bb/FMi}{2023/04/04}{s}
+Multiple alignments: \env{align} \u{and \env{flalign}}
+\>\\
+Multiple alignments: \env{align}\u{, \env{flalign}, and \env{alignat}}
+
+\erroronpage{II-xv}{chapter head}{FMi}{2023/04/04}{s}
+formulas \> \u{F}ormulas
+
+\erroronpage{II-xvi}{chapter head}{FMi}{2023/04/04}{s}
+documents \> \u{D}ocuments
+
+\erroronpage{II-xxi}{chapter head}{FMi}{2023/04/04}{s}
+beyond \> \u{B}yond
+
+
+
+\CHAPTER{Bibliography (Part II)} 
+
+\erroronpage{II-799}{[43], l.-2}{FMi}{2023/04/04}{s}
+all \> \u{them} all
+
+\erroronpage{II-801}{[62], l.-2}{kb/bb}{2023/04/04}{s}
+the go-forward way for \LaTeX-coding \>\\
+the way for \LaTeX{} coding going forward
+
+\erroronpage{II-802}{[71], l.2}{kb/bb}{2023/04/04}{s}
+p. \> pp.
+
+\erroronpage{II-802}{[72], l.2}{kb/bb}{2023/04/04}{s}
+p. \> pp.
+
+\erroronpage{II-803}{[80], l.3}{kb/bb}{2023/04/04}{s}
+Publishing \> Publishing\u{,}
+
+
+
+
+\end{erratalist}
+
+
+%<--------------------------
+
+\section*{Errata for the digital version (not applicable to the print version)}
+
+All known errors to the digital version have already been incorporated in the product as distributed.
+
+%\begin{erratalist}
+%
+%\CHAPTER{General}
+%
+%\CHAPTER{Front matter}
+%
+%\end{erratalist}
+
+
+%<--------------------------
+
+
+\section*{Errata common to the print and digital versions}
+
+The main matter is identical (also in page numbers) in the print and
+the digital versions. Therefore most errata entries appear in this
+section.
+
+\begin{erratalist}
+
+
+\CHAPTER{General}
+
+\erroronpage{}{}{FMi}{2023/04/04}{s}
+Some corrections result in index changes. These are not tracked here;
+the index is always fully regenerated for new printings.
+
+\CHAPTER{Chapter 1 --- Introduction}
+
+\erroronpage{I-5}{para 4, l.4}{kb}{2023/04/04}{s}
+\u{of} the bugs \> \u{with} the bugs
+\\ Already corrected in the digital version.
+
+
+\erroronpage{I-5}{para 5, l.5}{kb}{2023/04/04}{s}
+not least \> \u{but} not least
+\\ Already corrected in the digital version.
+
+
+\CHAPTER{Chapter 2 --- The Structure of a \LaTeX{} Document}
+
+\erroronpage{I-34}{l.-1}{FMi}{2023/04/04}{s}
+Moved first line of page 35 to 34.
+\\ Already corrected in the digital version.
+
+\erroronpage{I-35}{l.1}{FMi}{2023/04/04}{s}
+Moved first line of page 35 to 34.
+\\ Already corrected in the digital version.
+
+\erroronpage{I-113}{listing}{FMi}{2023/05/14}{s}
+Situation is the same in the 2023 distributions; listing output updated.
+\\ Already corrected in the digital version.
+
+
+\CHAPTER{Chapter 3 --- Basic Formatting Tools -- Paragraph \ldots}
+
+
+\CHAPTER{Chapter 4 --- Basic Formatting Tools -- Larger \ldots}
+
+
+\CHAPTER{Chapter 5 --- The Layout of the Page}
+
+
+\CHAPTER{Chapter 6 --- Tabular  Material}
+
+
+\CHAPTER{Chapter 7 --- Mastering Floats}
+
+
+\CHAPTER{Chapter 8 --- Graphics Generation and Manipulation}
+
+
+\CHAPTER{Chapter 9 --- Font Selection and Encodings}
+ 
+\erroronpage{I-669}{exa 9-3-11}{FMi}{2023/04/04}{s}
+Changed line breaks in example.
+
+\erroronpage{I-708}{listing}{FMi}{2023/05/14}{s}
+Situation is the same in the 2023 distributions; listing output updated.
+\\ Already corrected in the digital version.
+
+
+\CHAPTER{Chapter 10 --- Text and Symbol Fonts}
+ 
+\erroronpage{II-114}{table 10.89}{FMi}{2023/04/04}{s}
+Added missing \texttt{U+00Fx} line.
+There was a bug in code generating it.
+\\ Already corrected in the digital version.
+
+\erroronpage{II-117}{table 10.92}{FMi}{2023/04/04}{s}
+Added missing \texttt{U+00Fx} line.
+There was a bug in code generating it.
+\\ Already corrected in the digital version.
+
+\erroronpage{II-121}{table 10.96}{FMi}{2023/04/04}{s}
+Added missing \texttt{U+00Fx} line.
+There was a bug in code generating it.
+\\ Already corrected in the digital version.
+
+\erroronpage{II-122}{table 10.98}{FMi}{2023/04/04}{s}
+Added missing \texttt{U+00Fx} line.
+There was a bug in code generating it.
+\\ Already corrected in the digital version.
+
+\erroronpage{II-122}{table 10.99}{FMi}{2023/04/04}{s}
+Added missing \texttt{U+00Fx} line.
+There was a bug in code generating it.
+\\ Already corrected in the digital version.
+
+\erroronpage{II-123}{table 10.100}{FMi}{2023/04/04}{s}
+Added missing \texttt{U+00Fx} line.
+There was a bug in code generating it.
+\\ Already corrected in the digital version.
+
+\erroronpage{II-124}{table 10.103}{FMi}{2023/04/04}{s}
+Added missing \texttt{U+00Fx} line.
+There was a bug in code generating it.
+\\ Already corrected in the digital version.
+
+
+
+\CHAPTER{Chapter 11 --- Higher Mathematics}
+
+\erroronpage{II-127}{para 1, l.5}{bb/FMi}{2023/04/04}{s}
+\u{The} American Mathematical Society (AMS) \u{provides} a major
+package, \pkg{amsmath}, which \u{makes} \ldots
+\>\\
+\u{In the early nineties the} American Mathematical Society (AMS)
+\u{provided} a major package, \pkg{amsmath}, which \u{made} \ldots
+\\ Already corrected in the digital version.
+
+\erroronpage{II-129}{para -3, l.1}{bb/FMi}{2023/04/04}{s}
+The principal documentation for these packages
+\>\\
+The principal documentation for these \u{two} packages
+\\ Already corrected in the digital version.
+
+
+\erroronpage{II-129}{para -1, l.3}{bb}{2023/04/04}{s}
+\u{lot} additions \> \u{many} additions
+\\ Already corrected in the digital version.
+
+
+\erroronpage{II-132}{table 11.1}{bb/FMi}{2023/04/04}{s}
+Also mention \env{alignat}, \env{alignat*}, and \env{alignedat}.
+\\ Already corrected in the digital version.
+
+\erroronpage{II-133}{para 4,l.2}{bb/FMi}{2023/04/04}{s}
+Add:
+
+Furthermore, they move the equation tag out of the way if it would
+otherwise overprint the formula.
+\\ Already corrected in the digital version.
+
+\erroronpage{II-138}{heading}{bb/FMi}{2023/04/04}{s}
+Multiple alignments: \env{align} \u{and \env{flalign}}
+\>
+Multiple alignments: \env{align}\u{, \env{flalign}, and \env{alignat}}
+\\ Already corrected in the digital version.
+
+\erroronpage{II-138}{}{FMi}{2023/04/04}{s}
+Moved para from 139 to end of this page.
+\\ Already corrected in the digital version.
+
+\erroronpage{II-139}{para 1}{FMi}{2023/04/04}{s}
+Moved para back to page 138.
+\\ Already corrected in the digital version.
+
+\erroronpage{II-139}{bottom}{FMi}{2023/04/04}{s}
+Add:
+
+Sometimes it is more convenient to explicitly specify all the
+horizontal spacing yourself within the formula. For this you can use
+an \env{alignat} environment. It differs from \env{align} in two ways: you have to
+specify the number of \texttt{rl} pairs as an argument to the environment and
+it does not add any spaces between the pairs, e.g.,
+\begin{verbatim}
+\begin{alignat}{3} x &= y &\qquad X &= Y &\qquad a &= b+c \\ ...
+\end{verbatim}
+As usual, equation numbers can be altered with \cs{tag} or suppressed with \cs{notag}.
+\\ Already corrected in the digital version.
+
+
+\erroronpage{II-140}{para 1, l.2}{bb/FMi}{2023/04/04}{s}
+Add:
+
+Do not forget to reset \cs{minalignsep} if you change it in this manner.
+\\ Already corrected in the digital version.
+
+\erroronpage{II-140}{para 2, l.4}{bb/FMi}{2023/04/04}{s}
+Add:
+
+You can think of them as subsidiary environments that can be used
+within any of the display environments discussed so far (below we use
+them inside equation).
+\\ Already corrected in the digital version.
+
+\erroronpage{II-140}{para -1}{FMi}{2023/04/04}{s}
+Paragraph moved to page 141.
+\\ Already corrected in the digital version.
+
+\erroronpage{II-141}{}{FMi}{2023/04/04}{s}
+One paragraph added moved over from page 144.
+\\ Already corrected in the digital version.
+
+\erroronpage{II-144}{para 2, l.-3}{FMi}{2023/04/04}{s}
+the issue \> the \u{spacing} issue
+\\ Already corrected in the digital version.
+
+\erroronpage{II-145}{para 2, l.1}{bb/FMi}{2023/04/04}{s}
+Add:
+
+Another problem is that an empty line introduces an unwanted break
+point in front of the display, thus \cs{predisplaypenalty} is no
+longer honored.
+\\ Already corrected in the digital version.
+
+
+\CHAPTER{Chapter 12 --- Fonts in Formulas}
+
+\erroronpage{II-225}{heading}{FMi}{2023/04/04}{s}
+Chapter title not properly capitalized.
+\\ Already corrected in the digital version.
+
+
+\CHAPTER{Chapter 13 --- Localizing Documents}
+ 
+\erroronpage{II-297}{heading}{FMi}{2023/04/04}{s}
+Chapter title not properly capitalized.
+\\ Already corrected in the digital version.
+
+
+\CHAPTER{Chapter 14 --- Index Generation}
+ 
+
+\CHAPTER{Chapter 15 --- Bibliography Generation}
+ 
+
+\CHAPTER{Chapter 16 --- Managing Citations}
+
+
+\CHAPTER{Chapter 17 --- \LaTeX{} Package Documentation Tools}
+ 
+
+\CHAPTER{Appendix A --- \LaTeX{} Overview for Preamble, \ldots}
+ 
+
+\CHAPTER{Appendix B --- Tracing and Resolving Problems}
+ 
+
+\CHAPTER{Appendix C --- Going Beyond}
+  
+\erroronpage{II-297}{heading}{FMi}{2023/04/04}{s}
+Appendix title not properly capitalized.
+\\ Already corrected in the digital version.
+
+\CHAPTER{Biographies}
+
+\CHAPTER{Production Notes}
+
+\end{erratalist}
+
+
+
+
+
+\setcounter{collectmore}{3}
+
+\begin{multicols}{3}[Thanks to all who have found errors or
+   omissions. Listed are the people who found an errata entry first.]
+\contributor{bb}{Barbara Beeton}
+\contributor{FMi}{Frank Mittelbach}
+\contributor{kb}{Karl Berry}
+\end{multicols}
+
+
+Other people have sent us corrections for errors already found.
+Thanks to all of you!
+
+If you find further errors please report them to one of the authors, e.g.,
+\begin{quote}\ttfamily
+  frank.mittelbach at latex-project.org
+\end{quote}
+preferably in a form usable directly in this file, i.e.,
+\begin{flushleft}
+|\erroronpage{|\textit{page-number}|}{|\textit{line-identification}|}{|%
+   \textit{your-initials}|}{|\textit{date}|}{}| \\
+   \hspace*{2em}\textit{description of the erratum}
+\end{flushleft}
+Here is an example:
+\begin{verbatim}
+\erroronpage{5}{para 3, l.1}{FMi}{2023/06/21}{}
+   \u{LaTeX}  \>  \u{\LaTeX}
+\end{verbatim}
+\verb=\u= underlines a text fragment and \verb=\>= produces \>.
+\end{document}
+
+
+
+
+\seriouserroronpage{general}{}{FMi}{2004/06/12}{}
+
+   To help you in assessing this errata document we have placed
+   exclamation marks in front of each entry that we consider essential
+   for correctly understanding the book contents.
+
+\erroronpage{general}{}{FMi}{2004/05/14}{}
+
+   Due to the printing process there may be small alignment problems
+   between blue and black text on some pages. These can vary from book
+   to book depending on how the paper was handled between print
+   runs---such is the analog nature of printing on a press.
+


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

Index: trunk/Master/texmf-dist/doc/latex-dev/base/tlc3.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/tlc3.pdf	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/tlc3.pdf	2023-05-25 20:39:11 UTC (rev 67218)

Property changes on: trunk/Master/texmf-dist/doc/latex-dev/base/tlc3.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/latex-dev/base/tulm.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/usrguide-historic.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/usrguide.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/usrguide.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/usrguide.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/usrguide.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -32,9 +32,10 @@
 
 \usepackage[T1]{fontenc}  % needed for \textbackslash in tt
 \usepackage{csquotes}
+\usepackage{url}
 
 \title{\LaTeX\ for authors --- current version}
-\author{\copyright~Copyright 2020-2022, \LaTeX\ Project Team.\\
+\author{\copyright~Copyright 2020-2023, \LaTeX\ Project Team.\\
    All rights reserved.%
    \footnote{This file may be distributed and/or modified under the
      conditions of the \LaTeX{} Project Public License, either version 1.3c
@@ -42,7 +43,7 @@
     \texttt{usrguide.tex} for full details.}%
 }
 
-\date{2022-07-05}
+\date{2023-05-23}
 
 \NewDocumentCommand\cs{m}{\texttt{\textbackslash\detokenize{#1}}}
 \NewDocumentCommand\marg{m}{\arg{#1}}
@@ -340,6 +341,12 @@
 \NewDocumentCommand\\{!s !o}{ ... }
 \end{verbatim}
 
+Also notable when using optional arguments in the last position is that \TeX{}
+will necessarily look ahead for the argument opening token. This means that
+the value of |\inputlineno| will be `out by one' if such a trailing optional
+argument is \emph{not} present and the command ends a line; it will be one
+greater than the line number containing the last mandatory argument.
+
 \subsection{`Embellishments'}
 \label{sec:cmd:embellishment}
 
@@ -636,7 +643,19 @@
 If only a single character \meta{token} is used for the split, any
 category code $13$ (active) character matching the \meta{token} will
 be replaced before the split takes place.
-Spaces are trimmed at each end of each item parsed.
+Spaces are trimmed at each end of each item parsed. Exactly one set
+of braces will be stripped if an entire item is surrounded by them,
+i.e.~the following inputs and outputs result (each separte item as
+a brace group).
+\begin{verbatim}
+a      ==> {a}
+{a}    ==> {a}
+{a}b   ==> {{a}b}
+a,b    ==> {a}{b}
+{a},b  ==> {a}{b}
+a,{b}  ==> {a}{b}
+a,{b}c ==> {a}{{b}c}
+\end{verbatim}
 
 \begin{decl}
   |\ProcessList| \arg{list} \arg{function}
@@ -716,7 +735,7 @@
 
 Environments that use this feature can be nested.
 
-\subsection{Fully-expandable document commands}
+\subsection{Fully-expandable document commands\label{sec:ltcmd:expandable}}
 
 Document commands created using \cs{NewDocumentCommand}, etc.\@, are normally
 created so that they do not expand unexpectedly. This is done using engine
@@ -724,7 +743,7 @@
 are \emph{very rare} occasion when it may be useful to create functions using a
 expansion-only grabber. This imposes a number of restrictions on the
 nature of the arguments accepted by a function, and the code it implements.
-This facility should only be used when \emph{absolutely necessary}.
+This facility should only be used when \emph{necessary}.
 
 \begin{decl}
   |\NewExpandableDocumentCommand|     \arg{cmd} \arg{arg spec} \arg{code} \\
@@ -755,6 +774,25 @@
     in the standard version.
 \end{itemize}
 
+\subsection{Commands at the start of tabular cells}
+
+Creating commands that are used at the start of tabular cells imposes
+some restrictions on the underlying implementation. The standard \LaTeX{}
+tabular environments (\texttt{tabular}, etc.)  use a mechanism which requires
+that any command wrapping \cs{multicolumn} or similar must be
+`expandable'. This is \emph{not} the case for commands created using
+\cs{NewDocumentCommand}, etc., which as detailed in
+Section~\ref{sec:ltcmd:expandable} use an engine feature which prevents
+such `expansion'. Therefore, to create such wrappers for use at the start
+of tabular cells, you must use \cs{NewExpandableDocumentCommand}, for example
+\begin{verbatim}
+\NewExpandableDocumentCommand\MyMultiCol{m}{\multicolumn{3}{c}{#1}}
+\begin{tabular}{lcr}
+a & b & c \\
+\MyMultiCol{stuff} \\
+\end{tabular}
+\end{verbatim}
+
 \subsection{Details about argument delimiters}
 
 In normal (non-expandable) commands, the delimited types look for the
@@ -844,23 +882,23 @@
 available for examination and use.
 
 \begin{decl}
-  |\GetDocumentCommandArgSpec| \arg{function}         \\
+  |\GetDocumentCommandArgSpec| \arg{cmd}         \\
   |\GetDocumentEnvironmentArgSpec| \arg{environment}
 \end{decl}
 These functions transfer the current argument specification for the
-requested \meta{function} or \meta{environment} into the token list
-variable \cs{ArgumentSpecification}. If the \meta{function} or
+requested \meta{cmd} or \meta{environment} into the token list
+variable \cs{ArgumentSpecification}. If the \meta{cmd} or
 \meta{environment} has no known argument specification then an error
 is issued. The assignment to \cs{ArgumentSpecification} is local to
 the current \TeX{} group.
 
 \begin{decl}
-  |\ShowDocumentCommandArgSpec| \arg{function}         \\
+  |\ShowDocumentCommandArgSpec| \arg{cmd}         \\
   |\ShowDocumentEnvironmentArgSpec| \arg{environment}
 \end{decl}
 These functions show the current argument specification for the
-requested \meta{function} or \meta{environment} at the terminal. If
-the \meta{function} or \meta{environment} has no known argument
+requested \meta{cmd} or \meta{environment} at the terminal. If
+the \meta{cmd} or \meta{environment} has no known argument
 specification then an error is issued.
 
 
@@ -1149,11 +1187,11 @@
 above. Nevertheless, in practice they are usually sufficient.  For
 example
 \begin{verbatim}
-\newcommand\calulateheight[1]{%
+\newcommand\calculateheight[1]{%
   \setlength\textheight{\dimeval{\topskip+\baselineskip*\inteval{#1-1}}}}
 \end{verbatim}
 sets the \cs{textheight} to the appropriate value if a page should
-hold a specific number of text lines. Thus after |\calulateheight{40}|
+hold a specific number of text lines. Thus after |\calculateheight{40}|
 it is set to \dimeval{\topskip+\baselineskip*\inteval{40-1}}, given
 the values \cs{topskip} (\dimeval{\topskip}) and \cs{baselineskip}
 (\dimeval{\baselineskip}) in the current document.
@@ -1216,8 +1254,35 @@
   \item Lowercasing
   \item Titlecasing (only applies for the start of the input)
 \end{itemize}
+
 The command \cs{DeclareCaseChangeEquivalent} provides a way to substitute a
 command by an alternative version when it is found inside a case changing
-situation.
+situation. There are three commands for customising the case changing of
+codepoints
+\begin{decl}
+  |\DeclareLowercaseMapping| \oarg{locale} \arg{codepoint} \arg{output} \\
+  |\DeclareTitlecaseMapping| \oarg{locale} \arg{codepoint} \arg{output} \\
+  |\DeclareUppercaseMapping| \oarg{locale} \arg{codepoint} \arg{output}
+\end{decl}
+All three take a \meta{codepoint} (as an integer expression) and will
+result in the \meta{output} being produced under the appropriate case changing
+operation. The optional \meta{locale} can be given if the mapping should only
+apply to a specific one: this is given in BCP-47 format
+(\url{https://en.wikipedia.org/wiki/IETF_language_tag}). For example,
+the kernel customises the mapping for U+01F0 (\v{j}) when uppercasing in
+8-bit engines:
+\begin{quotation}
+  |\DeclareUppercaseMapping{"01F0}{\v{J}}|
+\end{quotation}
+as there is no pre-composed \v{J} character, and this is problematic if
+the engine does not support Unicode natively. Similarly, to set a locale
+\texttt{xx} to behave in the same way as Turkish and retain the difference
+between dotted- and dotless-i, one could use for example
+\begin{quotation}
+  |\DeclareLowercaseMapping{xx}{"0049}{\i}|\\
+  |\DeclareLowercaseMapping{xx}{"0130}{i}|\\
+  |\DeclareUppercaseMapping{xx}{"0069}{\.{I}}|\\
+  |\DeclareUppercaseMapping{xx}{"0131}{I}|
+\end{quotation}
 
 \end{document}

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/utf8ienc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/webcomp.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/tools/README.md	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/tools/README.md	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,7 +1,7 @@
 The LaTeX `tools` bundle
 ========================
 
-Release 2023-05-01 pre-release 0
+Release 2023-06-01 pre-release 3
 
 Overview
 --------

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/afterpage.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/array.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/bm.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/calc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/changes.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/tools/changes.txt	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/tools/changes.txt	2023-05-25 20:39:11 UTC (rev 67218)
@@ -4,7 +4,26 @@
 completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 =======================================================================
+2023-05-11  Ulrike Fischer  <Ulrike.Fischer at latex-project.org>
 
+	* showkeys.dtx: Use label hook if format new enough.
+
+2023-04-15  David Carlisle  <David.Carlisle at latex-project.org>
+
+	* shellesc.dtx: Normalise use of "." in messages. github/1008
+
+2023-03-30  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* multicol.dtx (subsection{The output routines}]):
+	Make column min depth customizable through the command
+	\multicolmindepthstring defaulting to 'p' (gh/698)
+
+2023-02-25  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* multicol.dtx:
+	Delay returning boxed multicols so that all parameters get restored first
+	in case the boxed multicols is used into another multicols (gh/1002)
+
 ================================================================================
 All changes above are only part of the development branch for the next release.
 ================================================================================

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/dcolumn.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/delarray.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/enumerate.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/fileerr.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/fontsmpl.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/ftnright.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/hhline.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/indentfirst.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/layout.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/longtable.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/multicol.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/rawfonts.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/shellesc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/showkeys.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/somedefs.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/tabularx.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/theorem.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/tools-overview.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/tools-overview.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/tools/tools-overview.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/doc/latex-dev/tools/tools-overview.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,7 +1,7 @@
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{tools-overview.tex}[2015/03/31 v1.0 Tools overview]
 
-% Copyright (C) 2006-2022
+% Copyright (C) 2006-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/trace.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/varioref.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/verbatim.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/xr.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/tools/xspace.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex-dev/amsmath/amsbsy.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/amsmath/amsbsy.ins	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/amsmath/amsbsy.ins	2023-05-25 20:39:11 UTC (rev 67218)
@@ -26,7 +26,7 @@
 \preamble
 
 Copyright (C) 1995, 1999 American Mathematical Society.
-Copyright (C) 2016-2022 LaTeX Project and American Mathematical Society.
+Copyright (C) 2016-2023 LaTeX Project and American Mathematical Society.
 
 This work may be distributed and/or modified under the
 conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/source/latex-dev/amsmath/amscd.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/amsmath/amscd.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/amsmath/amscd.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -2,7 +2,7 @@
 % \iffalse meta-comment
 %
 % Copyright (C) 1995, 1999 American Mathematical Society.
-% Copyright (C) 2016-2022 LaTeX Project and American Mathematical Society.
+% Copyright (C) 2016-2023 LaTeX Project and American Mathematical Society.
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/source/latex-dev/amsmath/amscd.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/amsmath/amscd.ins	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/amsmath/amscd.ins	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 %%
 %% Copyright (C) 2010 American Mathematical Society.
-%% Copyright (C) 2016-2022 LaTeX Project and American Mathematical Society.
+%% Copyright (C) 2016-2023 LaTeX Project and American Mathematical Society.
 %%
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3c
@@ -25,7 +25,7 @@
 \preamble
 
 Copyright (C) 1995, 1999 American Mathematical Society.
-Copyright (C) 2016-2022  LaTeX Project and American Mathematical Society.
+Copyright (C) 2016-2023  LaTeX Project and American Mathematical Society.
 
 This work may be distributed and/or modified under the
 conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/source/latex-dev/amsmath/amsgen.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/amsmath/amsgen.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/amsmath/amsgen.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -2,7 +2,7 @@
 % \iffalse meta-comment
 %
 % Copyright (C) 1995, 1999 American Mathematical Society.
-% Copyright (C) 2016-2022 LaTeX Project and American Mathematical Society.
+% Copyright (C) 2016-2023 LaTeX Project and American Mathematical Society.
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/source/latex-dev/amsmath/amsgen.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/amsmath/amsgen.ins	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/amsmath/amsgen.ins	2023-05-25 20:39:11 UTC (rev 67218)
@@ -25,7 +25,7 @@
 \preamble
 
 Copyright (C) 1995, 1999 American Mathematical Society.
-Copyright (C) 2016-2022  LaTeX Project and American Mathematical Society.
+Copyright (C) 2016-2023  LaTeX Project and American Mathematical Society.
 
 This work may be distributed and/or modified under the
 conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/source/latex-dev/amsmath/amsmath.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/amsmath/amsmath.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/amsmath/amsmath.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -2,7 +2,7 @@
 % \iffalse meta-comment
 %
 % Copyright (C) 1995, 2000, 2013 American Mathematical Society.
-% Copyright (C) 2016-2022 LaTeX Project and American Mathematical Society.
+% Copyright (C) 2016-2023 LaTeX Project and American Mathematical Society.
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3c
@@ -86,7 +86,7 @@
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\ProvidesPackage{amsmath}[2022/04/08 v2.17n AMS math features]
+\ProvidesPackage{amsmath}[2023/05/13 v2.17o AMS math features]
 %    \end{macrocode}
 %
 % \section{Catcode defenses}
@@ -6261,9 +6261,10 @@
 %    Standard \latex/ provides three environments for one-line equations:
 %    \cn{[}\cn{]}, \env{equation}, and \env{displaymath}. We add
 %    \env{equation*} as a synonym for \env{displaymath}.
+% \changes{v2.17o}{2023/05/13}{Do not error if \cs{eqno} not primitive (gh/1059)}
 %    \begin{macrocode}
-\@saveprimitive\leqno\@@leqno
-\@saveprimitive\eqno\@@eqno
+\let\@@eqno\eqno
+\let\@@leqno\leqno
 \def\eqno{\@@eqno\let\eqno\relax\let\leqno\relax}
 \def\leqno{\@@leqno\let\leqno\relax\let\eqno\relax}
 %

Modified: trunk/Master/texmf-dist/source/latex-dev/amsmath/amsmath.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/amsmath/amsmath.ins	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/amsmath/amsmath.ins	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 %%
 %% Copyright (C) 2010 American Mathematical Society.
-%% Copyright (C) 2016-2022  LaTeX Project and American Mathematical Society.
+%% Copyright (C) 2016-2023  LaTeX Project and American Mathematical Society.
 %%
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3c
@@ -25,7 +25,7 @@
 \preamble
 
 Copyright (C) 1995, 1999, 2000, 2013 American Mathematical Society.
-Copyright (C) 2016-2022  LaTeX Project and American Mathematical Society.
+Copyright (C) 2016-2023  LaTeX Project and American Mathematical Society.
 
 This work may be distributed and/or modified under the
 conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/source/latex-dev/amsmath/amsopn.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/amsmath/amsopn.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/amsmath/amsopn.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -2,7 +2,7 @@
 % \iffalse meta-comment
 %
 % Copyright (C) 1995, 1999 American Mathematical Society.
-% Copyright (C) 2016-2022 LaTeX Project and American Mathematical Society.
+% Copyright (C) 2016-2023 LaTeX Project and American Mathematical Society.
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/source/latex-dev/amsmath/amsopn.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/amsmath/amsopn.ins	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/amsmath/amsopn.ins	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 %%
 %% Copyright (C) 2010 American Mathematical Society.
-%% Copyright (C) 2016-2022  LaTeX Project and American Mathematical Society.
+%% Copyright (C) 2016-2023  LaTeX Project and American Mathematical Society.
 %%
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3c
@@ -25,7 +25,7 @@
 \preamble
 
 Copyright (C) 1995, 1999 American Mathematical Society.
-Copyright (C) 2016-2022  LaTeX Project and American Mathematical Society.
+Copyright (C) 2016-2023  LaTeX Project and American Mathematical Society.
 
 This work may be distributed and/or modified under the
 conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/source/latex-dev/amsmath/amstext.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/amsmath/amstext.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/amsmath/amstext.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -2,7 +2,7 @@
 % \iffalse meta-comment
 %
 % Copyright (C) 1995, 1999 American Mathematical Society.
-% Copyright (C) 2016-2022 LaTeX Project and American Mathematical Society.
+% Copyright (C) 2016-2023 LaTeX Project and American Mathematical Society.
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/source/latex-dev/amsmath/amstext.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/amsmath/amstext.ins	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/amsmath/amstext.ins	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 %%
 %% Copyright (C) 2010 American Mathematical Society.
-%% Copyright (C) 2016-2022  LaTeX Project and American Mathematical Society.
+%% Copyright (C) 2016-2023  LaTeX Project and American Mathematical Society.
 %%
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3c
@@ -25,7 +25,7 @@
 \preamble
 
 Copyright (C) 1995, 1999 American Mathematical Society.
-Copyright (C) 2016-2022  LaTeX Project and American Mathematical Society.
+Copyright (C) 2016-2023  LaTeX Project and American Mathematical Society.
 
 This work may be distributed and/or modified under the
 conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/source/latex-dev/amsmath/amsxtra.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/amsmath/amsxtra.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/amsmath/amsxtra.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -2,7 +2,7 @@
 % \iffalse meta-comment
 %
 % Copyright (C) 1995, 1999 American Mathematical Society.
-% Copyright (C) 2016-2022 LaTeX Project and American Mathematical Society.
+% Copyright (C) 2016-2023 LaTeX Project and American Mathematical Society.
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/source/latex-dev/amsmath/amsxtra.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/amsmath/amsxtra.ins	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/amsmath/amsxtra.ins	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 %%
 %% Copyright (C) 2010 American Mathematical Society.
-%% Copyright (C) 2016-2022  LaTeX Project and American Mathematical Society.
+%% Copyright (C) 2016-2023  LaTeX Project and American Mathematical Society.
 %%
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3c
@@ -25,7 +25,7 @@
 \preamble
 
 Copyright (C) 1995, 1999 American Mathematical Society.
-Copyright (C) 2016-2022  LaTeX Project and American Mathematical Society.
+Copyright (C) 2016-2023  LaTeX Project and American Mathematical Society.
 
 This work may be distributed and/or modified under the
 conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/source/latex-dev/base/classes.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/classes.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/classes.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -53,7 +53,7 @@
 %<*driver>
 \ProvidesFile{classes.drv}
 %</driver>
-              [2022/07/02 v1.4n
+              [2023/05/17 v1.4n
 %<article|report|book> Standard LaTeX document class]
 %<10pt|11pt|12pt>      Standard LaTeX file (size option)]
 %    \end{macrocode}
@@ -3688,9 +3688,8 @@
 %
 %     A |\caption| command in a `figure' environment writes
 %
-%     |\contentsline{figure}{\numberline{|\meta{num}|}{|%
+%     |\contentsline{figure}{\numberline{|\meta{num}|}{|^^A
 %                    \meta{caption}|}}{|\meta{page}|}|
-%
 %     on the .\file{lof} file, where \meta{num} is the number produced
 %     by |\thefigure| and \meta{caption} is the figure caption.  It
 %     works similarly for a `table' environment.
@@ -3707,8 +3706,8 @@
 %                      \meta{title}|}{|\meta{page}|}|
 %
 %    \begin{description}
-%    \item[\meta{level}] An entry is produced only if\meta{ level}
-%        $<=$ value of the \Lcount{tocdepth} counter.  Note,
+%    \item[\meta{level}] An entry is produced only if \meta{level}
+%        $\leq$ value of the \Lcount{tocdepth} counter.  Note,
 %        |\chapter| is level 0, |\section| is level 1, etc.
 %    \item[\meta{indent}] The indentation from the outer left margin
 %        of the start   of the contents line.

Modified: trunk/Master/texmf-dist/source/latex-dev/base/cmfonts.fdd
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/cmfonts.fdd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/cmfonts.fdd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 1993-2022
+% Copyright (C) 1993-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %
@@ -67,7 +67,7 @@
 %<*driver,  >
              \ProvidesFile{cmfonts.drv}
 %</driver,  >
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 %
 %<*driver>
 \documentclass{ltxdoc}
@@ -1048,8 +1048,10 @@
 %    \end{macrocode}
 %
 % \changes{v2.5j}{2019/12/16}{Provide substitutions for cmtt/bx/sl}
+% \changes{v2.5m}{2023/04/13}{Add missing substitution for U/cmtt/bx/sl}
 %    \begin{macrocode}
 %<+OT1cmtt>\DeclareFontShape{OT1}{cmtt}{bx}{sl}
+%<+Ucmtt>\DeclareFontShape{U}{cmtt}{bx}{sl}
 %<-nowarn>  {<->sub*cmtt/m/n}{}
 %<+nowarn>  {<->ssub*cmtt/m/n}{}
 %<+OT1cmtt>\DeclareFontShape{OT1}{cmtt}{bx}{ui}

Modified: trunk/Master/texmf-dist/source/latex-dev/base/doc.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/doc.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/doc.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,7 +1,7 @@
 % \iffalse meta-comment
 %
-% Copyright 1993-2022
-% The LaTeX3 Project and any individual authors listed elsewhere
+% Copyright (C) 1993-2023
+% The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %
 % This file is part of the LaTeX base system.

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltclass.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltclass.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltclass.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltclass.dtx}
-             [2022/11/16 v1.5f LaTeX Kernel (Class & Package Interface)]
+             [2023/04/14 v1.5h LaTeX Kernel (Class & Package Interface)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltclass.dtx}
@@ -324,6 +324,7 @@
 %
 % \DescribeMacro\IfPackageAtLeastTF
 % \DescribeMacro\IfClassAtLeastTF
+% \DescribeMacro\IfFileAtLeastTF
 % \DescribeMacro\@ifpackagelater
 % \DescribeMacro\@ifclasslater
 % \changes{v1.1i}{2013/07/07}{Correctly describe how the date in
@@ -890,6 +891,7 @@
 %
 %  \begin{macro}{\IfPackageAtLeastTF}
 %  \begin{macro}{\IfClassAtLeastTF}
+%  \begin{macro}{\IfFileAtLeastTF}
 %  \begin{macro}{\IfFormatAtLeastTF}
 % |\IfFormatAtLeastTF{YYYY/MM/DD}{|\meta{true
 %    code}|}{|\meta{false code}|}|
@@ -896,6 +898,7 @@
 %    Test if the format is later or equal to the given date.
 % \changes{v1.3k}{2020/04/07}{Macro added; also in rollback (gh/168)}
 % \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}}
+% \changes{v1.5g}{2023/03/28}{Added \cs{IfFileAtLeastTF} (gh/1015)}
 %    \begin{macrocode}
 %</2ekernel>
 %<*2ekernel|latexrelease>
@@ -904,6 +907,7 @@
 \def\IfFormatAtLeastTF{\@ifl at t@r\fmtversion}
 \let\IfPackageAtLeastTF\@ifpackagelater
 \let\IfClassAtLeastTF\@ifclasslater
+\def\IfFileAtLeastTF#1{\expandafter\@ifl at t@r\csname ver@#1\endcsname}
 %    \end{macrocode}
 %    For rollback pretend it was available since the beginning of dawn.
 %    \begin{macrocode}
@@ -914,6 +918,7 @@
 %<latexrelease>\def\IfFormatAtLeastTF{\@ifl at t@r\fmtversion}
 %<latexrelease>\let\IfPackageAtLeastTF\@ifpackagelater
 %<latexrelease>\let\IfClassAtLeastTF\@ifclasslater
+%<latexrelease>\def\IfFileAtLeastTF#1{\expandafter\@ifl at t@r\csname ver@#1\endcsname}
 %<latexrelease>\EndIncludeInRelease
 %<*2ekernel>
 %    \end{macrocode}
@@ -920,6 +925,7 @@
 %  \end{macro}
 %  \end{macro}
 %  \end{macro}
+%  \end{macro}
 %
 % \begin{macro}{\@ifl at ter}
 % \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}}
@@ -2133,13 +2139,28 @@
 %         {Reset \cs{CurrentOption}}
 % \changes{v1.3d}{2019/10/18}{Initialize \cs{...-h@@k} only when loading
 %                             the package or class (gh/198)}
+% \changes{v1.5h}{2023/04/14}{Define \cs{load at onefilewithoptions} when
+%                             in \pkg{latexrelease} (gh/992)}
 %    \begin{macrocode}
 %</2ekernel>
 %<*2ekernel|latexrelease>
 %<latexrelease>\IncludeInRelease{2020/10/01}%
 %<latexrelease>      {\@onefilewithoptions}{Hooks and unused options issue}%
+%    \end{macrocode}
+%
+%   Here this macro is called \cs{@onefilewithoptions}, but further
+%   ahead in this file it is renamed to \cs{load at onefilewithoptions},
+%   and \cs{@onefilewithoptions} becomes a wrapper around this, used for
+%   bookkeeping when rolling back.  Therefore, when in
+%   \pkg{latexrelease}, we need to define \cs{load at onefilewithoptions}
+%   instead, thus the extra guarded \cs{def} line below:
+%    \begin{macrocode}
+%<*2ekernel>
 \def\@onefilewithoptions#1[#2][#3]#4{%
+%</2ekernel>
+%<latexrelease>\def\load at onefilewithoptions#1[#2][#3]#4{%
 %    \end{macrocode}
+%
 %    We have to sanitise file names, so that something like
 % \begin{verbatim}
 %   \usepackage{some/local/path/array}

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltcmd.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltcmd.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltcmd.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,7 +1,7 @@
 % \iffalse meta-comment
 %
 % Copyright (C) 1999 Frank Mittelbach, Chris Rowley, David Carlisle
-% Copyright (C) 2004-2008 Frank Mittelbach, The LaTeX3 Project
+% Copyright (C) 2004-2008 Frank Mittelbach, The LaTeX Project
 % Copyright (C) 2009-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
@@ -34,8 +34,8 @@
 %%% From File: ltcmd.dtx
 %
 %    \begin{macrocode}
-\def\ltcmdversion{v1.1b}
-\def\ltcmddate{2022-11-29}
+\def\ltcmdversion{v1.1d}
+\def\ltcmddate{2023-04-13}
 %    \end{macrocode}
 %
 %<*driver>
@@ -2123,8 +2123,8 @@
 %   and possibly another auxiliary
 %   \cs{\meta{cmd}\textvisiblespace\textvisiblespace}, if the command
 %   has both long and short arguments.  Then, its signature also has
-%   several specific bits that are unique to that command; this is in contrast to
-%   non-expandable commands, which use a common set of parsing functions.
+%   several specific bits that are unique to that command; this is in contrast
+%   to non-expandable commands, which use a common set of parsing functions.
 %
 %   We start by copying the basics, then call
 %   \cs{@@_copy_expandable_signature:NnNNNNnnn} to parse the signature
@@ -2132,7 +2132,24 @@
 %   then we call \cs{@@_copy_expandable:NnNNNNnnn} that will copy the
 %   top-level definition of the command, with the proper internal
 %   renames.
+%
 %    \begin{macrocode}
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_copy:NN}%
+%<latexrelease>  {Support~\NewCommandCopy~in~ltcmd}
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%
+% \changes{v1.1c}{2023/03/12}
+%         {Distinguish (non-expandable) document commands starting with
+%          \cs{@@_start_expandable:nNNNNn}}
+%   There's one variant: a command begins with \cs{@@_start_expandable:nNNNNn}
+%   may still be un-expandable/protected if it's defined by 
+%   \cs{NewDocumentCommand} and friends, with empty or only m-type arguments.
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_copy_expandable:nnNN}%
+%<latexrelease>  {Distinguish~non-expandable~document~commands}
 \cs_new_protected:Npn \@@_copy_expandable:nnNN #1 #2 #3 #4
   {
     \cs_set_eq:cc { #1 ~ code } { #2 ~ code }
@@ -2140,9 +2157,36 @@
     \@@_set_eq_if_exist:cc { #1 ~ \c_space_tl } { #2 ~ \c_space_tl }
     \@@_set_eq_if_exist:cc { #1 ~ defaults } { #2 ~ defaults }
     \exp_after:wN \@@_copy_expandable_signature:NnNNNNnnn #4 {#1} {#2}
-    \cs_set_nopar:Npx #3
+    \token_if_protected_macro:NTF #4
+      { \cs_set_protected_nopar:Npx }{ \cs_set_nopar:Npx }
+      #3
       { \exp_after:wN \@@_copy_expandable:NnNNNNnnn #4 {#1} {#2} }
   }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2021/11/15}{\@@_copy_expandable:nnNN}%
+%<latexrelease>  {Support~\NewCommandCopy~in~ltcmd}
+%<latexrelease>\cs_new_protected:Npn \@@_copy_expandable:nnNN #1 #2 #3 #4
+%<latexrelease>  {
+%<latexrelease>    \cs_set_eq:cc { #1 ~ code } { #2 ~ code }
+%<latexrelease>    \@@_set_eq_if_exist:cc { #1 ~ } { #2 ~ }
+%<latexrelease>    \@@_set_eq_if_exist:cc { #1 ~ \c_space_tl } { #2 ~ \c_space_tl }
+%<latexrelease>    \@@_set_eq_if_exist:cc { #1 ~ defaults } { #2 ~ defaults }
+%<latexrelease>    \exp_after:wN \@@_copy_expandable_signature:NnNNNNnnn #4 {#1} {#2}
+%<latexrelease>    \cs_set_nopar:Npx #3
+%<latexrelease>      { \exp_after:wN \@@_copy_expandable:NnNNNNnnn #4 {#1} {#2} }
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_copy_expandable:nnNN}%
+%<latexrelease>  {Support~\NewCommandCopy~in~ltcmd}
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2021/11/15}{\@@_copy:NN (part 2)}%
+%<latexrelease>  {Support~\NewCommandCopy~in~ltcmd}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 \cs_new:Npn \@@_copy_expandable:NnNNNNnnn #1 #2 #3 #4 #5 #6 #7 #8 #9
   {
     \exp_not:N #1 \exp_not:n { {#2} }
@@ -2355,7 +2399,7 @@
 % worth it.
 %    \begin{macrocode}
 %<latexrelease>\EndIncludeInRelease
-%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_copy:NN}%
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_copy:NN (part 2)}%
 %<latexrelease>  {Support~\NewCommandCopy~in~ltcmd}
 %<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
@@ -2418,13 +2462,49 @@
   }
 \cs_new_protected:Npn \@@_show_expandable:N #1
   { \exp_after:wN \@@_show_expandable:NnNNNNnN #1 #1 }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_show:N}%
+%<latexrelease>  {Support~\ShowCommand~in~ltcmd}
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%
+% \changes{v1.1c}{2023/03/12}
+%         {Distinguish (non-expandable) document commands starting with
+%          \cs{@@_start_expandable:nNNNNn}}
+%   There's one variant: a command begins with \cs{@@_start_expandable:nNNNNn}
+%   may still be un-expandable/protected if it's defined by 
+%   \cs{NewDocumentCommand} and friends, with empty or only m-type arguments.
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_show_expandable:NnNNNNnN}%
+%<latexrelease>  {Distinguish~non-expandable~document~commands}
 \cs_new_protected:Npn \@@_show_expandable:NnNNNNnN #1 #2 #3 #4 #5 #6 #7 #8
   {
-    \@@_show_command_aux:NnNNn \tl_show:x
-      { expandable~document~command } #8 #5 {#2}
+    \exp_args:NNe \@@_show_command_aux:NnNNn \tl_show:x
+      { \token_if_protected_macro:NF #8 { expandable~ } document~command }
+      #8 #5 {#2}
   }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2021/11/15}{\@@_show_expandable:NnNNNNnN}%
+%<latexrelease>  {Support~\ShowCommand~in~ltcmd}
+%<latexrelease>\cs_new_protected:Npn \@@_show_expandable:NnNNNNnN #1 #2 #3 #4 #5 #6 #7 #8
+%<latexrelease>  {
+%<latexrelease>    \@@_show_command_aux:NnNNn \tl_show:x
+%<latexrelease>      { expandable~document~command } #8 #5 {#2}
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_show_expandable:NnNNNNnN}%
+%<latexrelease>  {Support~\ShowCommand~in~ltcmd}
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 %
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2021/11/15}{\@@_show:N (part 2)}%
+%<latexrelease>  {Support~\ShowCommand~in~ltcmd}
+%    \end{macrocode}
+%
 %   Now just print everything in the required format.  The auxiliary
 %   \cs{@@_split_signature:n} stores a ready-to-print token list in
 %   \cs{l_@@_tmpa_tl}, so we ust use that here:
@@ -2675,7 +2755,7 @@
 %    \begin{macrocode}
 %<latexrelease>\EndIncludeInRelease
 %
-%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_show:N}%
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_show:N (part 2)}%
 %<latexrelease>  {Support~\ShowCommand~in~ltcmd}
 %<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
@@ -3218,6 +3298,10 @@
 % \begin{macro}{\@@_grab_v_long:w}
 % \begin{macro}{\@@_grab_v_aux:w}
 % \begin{macro}{\@@_grab_v_group_end:}
+%   Firstly, it is necessary to change \cs{tex_endlinechar:D} so that
+%   newlines in different catcode regimes (e.g., \cs{ExplSyntaxOn}) are
+%   not misinterpreted as spaces.
+% \changes{v1.1d}{2023/04/13}{Set \cs{tex_endlinechar:D} earlier (gh/876).}
 %   The opening delimiter is the first non-space token, and is never
 %   read verbatim.  This is required by consistency with the case where
 %   the preceding argument was optional and absent: then \TeX{} has
@@ -3251,6 +3335,7 @@
     \tl_set:Nn \l_@@_signature_tl {#1}
     \group_begin:
       \tex_escapechar:D = 92 \scan_stop:
+      \tex_endlinechar:D = `\^^M \scan_stop:
       \tl_clear:N \l_@@_v_arg_tl
       \peek_remove_spaces:n
         {
@@ -3268,8 +3353,8 @@
   }
 \cs_new_protected:Npn \@@_grab_v_group_end:
   {
-        \exp_args:NNNo
-      \group_end:
+      \exp_args:NNNo
+    \group_end:
     \tl_set:Nn \l_@@_v_arg_tl { \l_@@_v_arg_tl }
   }
 %    \end{macrocode}
@@ -3414,7 +3499,6 @@
   {
     \cs_set_eq:NN \do \char_set_catcode_other:N
     \dospecials
-    \tex_endlinechar:D = `\^^M \scan_stop:
     \bool_if:NTF \l_@@_long_bool
       { \char_set_catcode_other:n { \tex_endlinechar:D } }
       { \char_set_catcode_parameter:n { \tex_endlinechar:D } }

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltcmdhooks.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltcmdhooks.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltcmdhooks.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,7 +1,8 @@
 % \iffalse meta-comment
 %
-%% File: ltcmdhooks.dtx (C) Copyright 2020-2021
-%%       Frank Mittelbach, Phelype Oleinik, LaTeX Team
+%% File: ltcmdhooks.dtx
+%% Copyright (C) 2020-2023
+%% Frank Mittelbach, Phelype Oleinik, The LaTeX Project
 %
 % It may be distributed and/or modified under the conditions of the
 % LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -13,8 +14,8 @@
 %
 %%% From File: ltcmdhooks.dtx
 %
-\def\ltcmdhooksversion{v1.0f}
-\def\ltcmdhooksdate{2021/10/20}
+\def\ltcmdhooksversion{v1.0h}
+\def\ltcmdhooksdate{2023/05/21}
 %
 %
 %
@@ -51,20 +52,32 @@
 %
 %    This file implements generic hooks for (arbitrary) commands.
 %    In theory every command \tn[no-index]{\meta{name}} offers now two
-%    associated hooks to which code can be added using \tn{AddToHook}
-%    or \tn{AddToHookNext}.\footnote{In practice this is not supported
+%    associated hooks to which code can be added using
+%    \tn{AddToHook},\!\footnote{In this documentation, when something is
+%      being said about \tn{AddToHook}, the same will be valid for
+%      \tn{AddToHookWithArguments}, unless that particular paragraph is
+%      highlighting the differences between both.  The same is true for
+%      the other hook-related functions and their
+%      \texttt{\ldots WithArguments} counterparts.}
+%    \tn{AddToHookNext}, \tn{AddToHookWithArguments}, and
+%    \tn{AddToHookNextWithArguments}.\footnote{In practice this is not
+%    supported
 %    for all types of commands, see section~\ref{sec:look-ahead} for
 %    the restrictions that apply and what happens if one tries to use
-%    this with commands for which this is not supported.}  These are
+%    this with commands for which this is not supported.}  These are:
 %    \begin{description}
 %    \item[\hook{cmd/\meta{name}/before}]
 %
-%       This hook is executed at the very start of the command
-%       execution after its arguments (if any) are parsed.  The hook
-%       \meta{code} is wrapped in the command inside a call to
-%       \cs{UseHook}|{cmd/|\meta{name}|/before}|, so the arguments
-%       passed to the command are \emph{not} available in the hook
-%       \meta{code}.
+%       This hook is executed at the very start of the command, right
+%       after its arguments (if any) are parsed.  The hook \meta{code}
+%       runs in the command inside a call to \cs{UseHookWithArguments}.
+%       Any code added to this hook using \tn{AddToHookWithArguments}
+%       or \tn{AddToHookNextWithArguments} can access the command's
+%       arguments using |#1|, |#2|, etc., up to the number of arguments
+%       of the command.  If \tn{AddToHook} or \tn{AddToHookNext} are
+%       used, the arguments cannot be accessed (see the \pkg{lthooks}
+%       documentation\footnote{\texttt{texdoc lthooks-doc}} on hooks
+%       with arguments).
 %
 %    \item[\hook{cmd/\meta{name}/after}]
 %
@@ -74,9 +87,12 @@
 %    \end{description}
 %
 %    The hooks are not physically present before
-%    \verb=\begin{document}= (i.e., using a command in the preamble
-%    will never execute them) and if nobody has declared any code for
-%    them, then they are not added to the command code ever.  For
+%    \verb=\begin{document}=\footnote{More specifically, they are
+%    inserted in the commands after the \hook{begindocument} hook, so
+%    they are also not present while \LaTeX{} is reading the
+%    \texttt{.aux} file.} (i.e., using a command in the preamble
+%    will never execute the hook) and if nobody has declared any code
+%    for them, then they are not added to the command code ever.  For
 %    example, if we have the following definition
 %\begin{verbatim}
 %    \newcommand\foo[2]{Code #1 for #2!}
@@ -90,23 +106,27 @@
 %\end{verbatim}
 %    then, after |\begin{document}| the definition of \cs[no-index]{foo} will be:
 %\begin{verbatim}
-%    \renewcommand\foo[2]{\UseHook{cmd/foo/before}Code #1 for #2!}
+%    \renewcommand\foo[2]{%
+%      \UseHookWithArguments{cmd/foo/before}{2}{#1}{#2}%
+%      Code #1 for #2!}
 %\end{verbatim}
 %    and similarly \verb=\AddToHook{cmd/foo/after}{<after code>}=
 %    alters the definition to
 %\begin{verbatim}
-%    \renewcommand\foo[2]{Code #1 for #2!\UseHook{cmd/foo/after}}
+%    \renewcommand\foo[2]{%
+%      Code #1 for #2!%
+%      \UseHookWithArguments{cmd/foo/after}{2}{#1}{#2}}
 %\end{verbatim}
 %
 %    In other words, the mechanism is similar to what \pkg{etoolbox}
 %    offers with \tn{pretocmd} and \tn{apptocmd} with the important
-%    differences 
+%    differences
 %    \begin{itemize}
 %    \item
 %
 %      that code can be prepended or appended (i.e., added to the
 %      hooks) even if the command itself is not defined, because the
-%      defining package has not yet been loaded
+%      defining package has not yet been loaded;
 %
 %    \item
 %
@@ -197,6 +217,7 @@
 %
 %
 % \section{Package Author Interface}
+% \label{sec:pkg-author}
 %
 % The \hook{cmd} hooks are, by default, available for all commands
 % that can be patched to add the hooks.  For some commands, however,
@@ -206,9 +227,10 @@
 %
 % If you are a package author and you want to add the hooks to your
 % own commands in the proper position you can define the command and
-% manually add the \cs{UseHook} calls inside the command in the proper
-% positions, and manually define the hooks with \cs{NewHook} or
-% \cs{NewReversedHook}.  When the hooks are explicitly defined,
+% manually add the \cs{UseHookWithArguments} calls inside the command in
+% the proper positions, and manually define the hooks with
+% \cs{NewHookWithArguments} or \cs{NewReversedHookWithArguments}.
+% When the hooks are explicitly defined,
 % patching is not attempted so you can make sure your command works
 % properly.  For example, an (admittedly not really useful) command
 % that typesets its contents in a framed box with width optionally
@@ -230,26 +252,27 @@
 % \begin{verbatim}
 %   \newcommand\fancybox{\@ifnextchar({\@fancybox}{\@fancybox(5cm)}}
 %   \def\@fancybox(#1)#2{\fbox{%
-%                        \UseHook{cmd/fancybox/before}%
-%                        \parbox{#1}{#2}%
-%                        \UseHook{cmd/fancybox/after}}}
-%   \NewHook{cmd/fancybox/before}
-%   \NewReversedHook{cmd/fancybox/after}
+%                 \UseHookWithArguments{cmd/fancybox/before}{2}{#1}{#2}%
+%                 \parbox{#1}{#2}%
+%                 \UseHookWithArguments{cmd/fancybox/after}{2}{#1}{#2}}}
+%   \NewHookWithArguments{cmd/fancybox/before}{2}
+%   \NewReversedHookWithArguments{cmd/fancybox/after}{2}
 % \end{verbatim}
 % then the hooks will be executed where they should and no patching
 % will be attempted.  It is important that the hooks are declared with
-% \cs{NewHook} or \cs{NewReversedHook}, otherwise the command hook
+% \cs{NewHookWithArguments} or \cs{NewReversedHookWithArguments},
+% otherwise the command hook
 % code will try to patch the command.  Note also that the call to
-% |\UseHook{cmd/fancybox/before}| does not need to be in the
-% definition of \cs[no-index]{fancybox}, but anywhere it makes sense
+% |\UseHookWithArguments{cmd/fancybox/before}| does not need to be in
+% the definition of \cs[no-index]{fancybox}, but anywhere it makes sense
 % to insert it (in this case in the internal
 % \cs[no-index]{@fancybox}).
 %
 % Alternatively, if for whatever reason your command does not support
 % the generic hooks provided here, you can disable a hook with
-% \cs{DisableHook}\footnote{Please use \cs{DisableHook} if at all, only
-% on hooks that you \enquote{own}, i.e., for commands that your
-% package or class defines and not second guess
+% \cs{DisableGenericHook}\footnote{Please use \cs{DisableGenericHook} if
+% at all, only on hooks that you \enquote{own}, i.e., for commands
+% your package or class defines and not second guess
 % whether or not hooks of other packages should get disabled!}, so
 % that when someone tries to add code to it they will get an error.
 % Or if you don't want the error, you can simply declare the hook with
@@ -270,6 +293,55 @@
 % If you do that then both hooks automatically work and are patched
 % into the right places.
 %
+% \subsection{Arguments and redefining commands}
+% \label{sec:redef-warn}
+%
+% The code in \pkg{ltcmdhooks} does its best to find out how many
+% arguments a given command has, and to insert the appropriate call to
+% \cs{UseHookWithArguments}, so that the arguments seen by the hook are
+% exactly those grabbed by the command (the hook, after all, is a macro
+% call, so the arguments have to be placed in the right order, or they
+% won't match).
+%
+% When using the package writer interface, as discussed in
+% section~\ref{sec:pkg-author}, to change the position of the hooks in
+% your commands, you are also free to change how the hook code in your
+% command sees its arguments.  When a \hook{cmd} hook is declared with
+% \cs{NewHook} (or \cs{NewHookWithArguments} or other variations of
+% that), it loses its \enquote{generic} nature and works as a regular
+% hook.  This means that you may choose to declare it without
+% arguments regardless if the command takes arguments or not, or
+% declare it with arguments, even if the command takes none.
+%
+% However, this flexibility should not be abused.  When using a
+% nonstandard configuration for the hook arguments, think reasonably:
+% a user will expect that the argument \verb|#1| in the hook corresponds
+% to the argument's first argument, and so on.  Any other configuration
+% is likely to cause confusion and, if used, will have to be well
+% documented.
+%
+% This flexibility, however, allows you to \enquote{correct} the
+% arguments for the hooks.  For example, \LaTeX's \cs{refstepcounter}
+% has a single argument, the name of the counter.  The \pkg{cleveref}
+% package adds an optional argument to \cs{refstepcounter}, making the
+% name of the counter argument \verb|#2|.  If the author of
+% \pkg{cleveref} wanted, for whatever reason, to add hooks to
+% \cs{refstepcounter}, to preserve compatibility he could write
+% something along the lines of:
+% \begin{verbatim}
+%   \NewHookWithArguments{cmd/refstepcounter/before}{1}
+%   \renewcommand\refstepcounter[2][<default>]{%
+%     \UseHookWithArguments{cmd/refstepcounter/before}{1}{#2}%
+%     <code for \refstepcounter>}
+% \end{verbatim}
+% so that the mandatory argument, which is arg \verb|#2| in the
+% definition, would still be seen as \verb|#1| in the hook code.
+%
+% Another possibility would be to place the optional argument as the
+% second argument for the hook, so that people looking for it would be
+% able to use it.  In either case, it would have to be well documented
+% to cause as little confusion as possible.
+%
 % \MaybeStop{\setlength\IndexMin{200pt}  \PrintIndex  }
 %
 %
@@ -366,10 +438,13 @@
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}{\c_@@_hash_tl}
-%   A constant token list that contains two parameter tokens.
+% \begin{macro}{\c_@@_hash_tl,\c_@@_hashes_tl}
+%   Two constant token lists that contain one and two parameter tokens.
+%   \changes{v1.0g}{2023/04/06}
+%           {Rename to \cs{c_@@_hashes_tl} and add \cs{c_@@_hash_tl} (hook-args).}
 %    \begin{macrocode}
-\tl_const:Nn \c_@@_hash_tl { # # }
+\tl_const:Nn \c_@@_hash_tl { # }
+\tl_const:Nn \c_@@_hashes_tl { # # }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -702,7 +777,7 @@
 %
 % \changes{v1.0f}{2021/10/20}
 %         {Correct patching by expansion+redefinition when the macro
-%          contains a parameter tokens (gh/697).}
+%          contains a parameter token (gh/697).}
 %   Patching with expansion+redefinition is trickier than it looks like
 %   at first glance.  Suppose the simple definition:
 % \begin{verbatim}
@@ -756,6 +831,8 @@
 %   parameter token, so that this case can be handled like the previous
 %   one.
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_patch_expand_redefine:NNnn}
+%<latexrelease>                 {cmd~hooks~with~args}
 \cs_new_protected:Npn \@@_patch_expand_redefine:NNnn #1 #2 #3 #4
   {
     \@@_patch_debug:x { ++~command~can~be~patched~without~rescanning }
@@ -779,14 +856,14 @@
 %       should be identical to the \meta{parameter text} used when
 %       originally defining that macro.
 %     \item[\cs{l_@@_replace_text_tl}] will contain braced pairs of
-%       \cs{c_@@_hash_tl}\meta{num} to feed to the macro when expanded.
+%       \cs{c_@@_hashes_tl}\meta{num} to feed to the macro when expanded.
 %       This token list as well as the previous will have the first item
 %       surrounded by |[|\ldots|]| in the case of an optional argument.
 %   \end{description}
 %
-%   The use of \cs{c_@@_hash_tl} here is to differentiate actual
+%   The use of \cs{c_@@_hashes_tl} here is to differentiate actual
 %   parameters in the macro from parameter tokens in the original
-%   definition of the macro.  Later on, \cs{c_@@_hash_tl} is either
+%   definition of the macro.  Later on, \cs{c_@@_hashes_tl} is either
 %   replaced by actual parameter tokens, or expanded into them.
 %    \begin{macrocode}
     \int_compare:nNnTF { \l_@@_patch_num_args_int } > { \c_zero_int }
@@ -795,7 +872,7 @@
 %   We'll first check if the command has any parameter token in its
 %   definition (feeding it empty arguments), and set \cs{@@_exp_not:n}
 %   accordingly.  \cs{@@_exp_not:n} will be used later to either leave
-%   \cs{c_@@_hash_tl} or expand it, and also to remember the result of
+%   \cs{c_@@_hashes_tl} or expand it, and also to remember the result of
 %   \cs{@@_if_has_hash:nTF} to avoid testing twice (the test can be
 %   rather slow).
 %    \begin{macrocode}
@@ -814,20 +891,22 @@
 %    \end{macrocode}
 %   Here we'll conditionally add |[|\ldots|]| around the first
 %   parameter:
+%   \changes{v1.0g}{2023/04/06}
+%           {Rename to \cs{c_@@_hashes_tl} (hook-args).}
 %    \begin{macrocode}
         \bool_if:NTF #1
-          { \@@_tmp:w \tl_set:Nx { [ \c_@@_hash_tl 1 ] } }
-          { \@@_tmp:w \tl_set:Nx { { \c_@@_hash_tl 1 } } }
+          { \@@_tmp:w \tl_set:Nx { [ \c_@@_hashes_tl 1 ] } }
+          { \@@_tmp:w \tl_set:Nx { { \c_@@_hashes_tl 1 } } }
 %    \end{macrocode}
 %   Then, for every parameter from the second, just add it normally:
 %    \begin{macrocode}
         \int_step_inline:nnn { 2 } { \l_@@_patch_num_args_int }
-          { \@@_tmp:w \tl_put_right:Nx { { \c_@@_hash_tl ##1 } } }
+          { \@@_tmp:w \tl_put_right:Nx { { \c_@@_hashes_tl ##1 } } }
 %    \end{macrocode}
 %   Now, if the command has any parameter token in its definition
 %   (then \cs{@@_exp_not:n} is \cs{exp_not:n}), call
 %   \cs{@@_double_hashes:n} to double them, and replace every
-%   \cs{c_@@_hash_tl} by |#|:
+%   \cs{c_@@_hashes_tl} by |#|:
 %    \begin{macrocode}
         \tl_set:Nx \l_@@_replace_text_tl
           { \exp_not:N #2 \exp_not:V \l_@@_replace_text_tl }
@@ -875,22 +954,110 @@
       { \exp_not:N \@@_make_prefixes:w \cs_prefix_spec:N #2 / / }
         }
 %    \end{macrocode}
-%   Finally, call \cs{@@_redefine_with_hooks:Nnnn} with the macro being
+%   Here we redefine the hook to have the right number of arguments.
+%   Disabling the hook, undefining the \verb|parameter| token list then
+%   calling \cs{@@_make_usable:nn} are enough to redefine the hook to
+%   the extent we want.  Code stored in the hook and other metadata
+%   about it are not lost in the process.
+% \changes{v1.0h}{2023/05/21}
+%         {Changes to allow support arguments in cmd hooks (cmd-args).}
+%    \begin{macrocode}
+    \@@_disable:n { cmd / #3 / #4 }
+    \cs_undefine:c { c_@@_cmd / #3 / #4_parameter_tl }
+    \@@_make_usable:nn { cmd / #3 / #4 } { \l_@@_patch_num_args_int }
+%    \end{macrocode}
+%   Now call \cs{@@_redefine_with_hooks:Nnnn} with the macro being
 %   redefined in |#1|, then \cs{UseHook}|{cmd/<name>/before}| in |#2| or
 %   \cs{UseHook}|{cmd/<name>/after}| in |#3| (one is always empty), and
 %   in |#4| the \meta{replacement text} of the macro.
 %    \begin{macrocode}
-    \use:x
+    \use:e
       {
         \@@_redefine_with_hooks:Nnnn \exp_not:N #2
         \str_if_eq:nnTF {#4} { after }
           { \use_ii_i:nn }
           { \use:nn }
-            { { \@@_exp_not:NN \exp_not:N \UseHook { cmd / #3 / #4 } } }
+            { {
+                \@@_exp_not:NN \exp_not:N \UseHookWithArguments
+                  { cmd / #3 / #4 } { \int_use:N \l_@@_patch_num_args_int }
+                  \@@_braced_parameter:n { cmd / #3 / #4 }
+            } }
             { { } }
             { \@@_exp_not:NN \exp_not:V \l_@@_replace_text_tl }
       }
+%    \end{macrocode}
+%   Finally, update the hook code.
+%    \begin{macrocode}
+    \@@_update_hook_code:n { cmd / #3 / #4 }
   }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2021/06/01}{\@@_patch_expand_redefine:NNnn}
+%<latexrelease>                 {cmd~hooks~with~args}
+%<latexrelease>\cs_gset_protected:Npn \@@_patch_expand_redefine:NNnn #1 #2 #3 #4
+%<latexrelease>  {
+%<latexrelease>    \@@_patch_debug:x { ++~command~can~be~patched~without~rescanning }
+%<latexrelease>    \int_set:Nn \l_@@_patch_num_args_int
+%<latexrelease>      {
+%<latexrelease>        \exp_args:Nf \str_count:n { \cs_argument_spec:N #2 } / 2
+%<latexrelease>        \bool_if:NT #1 { -1 }
+%<latexrelease>      }
+%<latexrelease>    \int_compare:nNnTF { \l_@@_patch_num_args_int } > { \c_zero_int }
+%<latexrelease>      {
+%<latexrelease>        \tl_set:Nx \l_@@_tmpa_tl { \bool_if:NTF #1 { [ ] } { { } } }
+%<latexrelease>        \int_step_inline:nnn { 2 } { \l_@@_patch_num_args_int }
+%<latexrelease>          { \tl_put_right:Nn \l_@@_tmpa_tl { { } } }
+%<latexrelease>        \exp_args:NNo \exp_args:No \@@_if_has_hash:nTF
+%<latexrelease>            { \exp_after:wN #2 \l_@@_tmpa_tl }
+%<latexrelease>          { \cs_set_eq:NN \@@_exp_not:n \exp_not:n }
+%<latexrelease>          { \cs_set_eq:NN \@@_exp_not:n \use:n }
+%<latexrelease>        \cs_set_protected:Npn \@@_tmp:w ##1 ##2
+%<latexrelease>          {
+%<latexrelease>            ##1 \l_@@_param_text_tl   { \use:n ##2 }
+%<latexrelease>            ##1 \l_@@_replace_text_tl { \@@_exp_not:n {##2} }
+%<latexrelease>          }
+%<latexrelease>        \bool_if:NTF #1
+%<latexrelease>          { \@@_tmp:w \tl_set:Nx { [ \c_@@_hash_tl 1 ] } }
+%<latexrelease>          { \@@_tmp:w \tl_set:Nx { { \c_@@_hash_tl 1 } } }
+%<latexrelease>        \int_step_inline:nnn { 2 } { \l_@@_patch_num_args_int }
+%<latexrelease>          { \@@_tmp:w \tl_put_right:Nx { { \c_@@_hash_tl ##1 } } }
+%<latexrelease>        \tl_set:Nx \l_@@_replace_text_tl
+%<latexrelease>          { \exp_not:N #2 \exp_not:V \l_@@_replace_text_tl }
+%<latexrelease>        \tl_set:Nx \l_@@_replace_text_tl
+%<latexrelease>          {
+%<latexrelease>            \token_if_eq_meaning:NNTF \@@_exp_not:n \exp_not:n
+%<latexrelease>              { \exp_args:NNV \exp_args:No \@@_double_hashes:n }
+%<latexrelease>              { \exp_args:NV \exp_not:o }
+%<latexrelease>                  \l_@@_replace_text_tl
+%<latexrelease>          }
+%<latexrelease>        \cs_set_eq:NN \@@_def_cmd:w \tex_gdef:D
+%<latexrelease>        \cs_set_eq:NN \@@_exp_not:NN \prg_do_nothing:
+%<latexrelease>      }
+%<latexrelease>      {
+%<latexrelease>        \tl_clear:N \l_@@_param_text_tl
+%<latexrelease>        \tl_set_eq:NN \l_@@_replace_text_tl #2
+%<latexrelease>        \cs_set_eq:NN \@@_def_cmd:w \tex_xdef:D
+%<latexrelease>        \cs_set:Npn \@@_exp_not:NN ##1 { \exp_not:N ##1 \exp_not:N }
+%<latexrelease>      }
+%<latexrelease>    \group_begin:
+%<latexrelease>      \int_set:Nn \tex_escapechar:D { `\/ }
+%<latexrelease>      \use:x
+%<latexrelease>        {
+%<latexrelease>    \group_end:
+%<latexrelease>    \tl_set:Nx \exp_not:N \l_@@_patch_prefixes_tl
+%<latexrelease>      { \exp_not:N \@@_make_prefixes:w \cs_prefix_spec:N #2 / / }
+%<latexrelease>        }
+%<latexrelease>    \use:x
+%<latexrelease>      {
+%<latexrelease>        \@@_redefine_with_hooks:Nnnn \exp_not:N #2
+%<latexrelease>        \str_if_eq:nnTF {#4} { after }
+%<latexrelease>          { \use_ii_i:nn }
+%<latexrelease>          { \use:nn }
+%<latexrelease>            { { \@@_exp_not:NN \exp_not:N \UseHook { cmd / #3 / #4 } } }
+%<latexrelease>            { { } }
+%<latexrelease>            { \@@_exp_not:NN \exp_not:V \l_@@_replace_text_tl }
+%<latexrelease>      }
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 %
 %   Now that all the needed tools are ready, without further ado we'll
@@ -973,7 +1140,7 @@
 %   }
 %   \cs{@@_double_hashes:n} loops through the token list |#1| and
 %   duplicates any catcode~6 token, and expands tokens \cs{ifx}-equal to
-%   \cs{c_@@_hash_tl}, and leaves all other tokens \cs{notexpanded} with
+%   \cs{c_@@_hashes_tl}, and leaves all other tokens \cs{notexpanded} with
 %   \cs{exp_not:N}.  Unfortunately pairs of explicit catcode~1 and
 %   catcode~2 character tokens are normalised to |{|$_1$ and |}|$_1$
 %   because it's not feasible to expandably detect the character code
@@ -1000,8 +1167,10 @@
 %    \end{macrocode}
 %
 %   \cs{@@_double_hashes_output:N} checks for the end of the token list,
-%   then checks if the token is \cs{c_@@_hash_tl}, and if so just leaves
+%   then checks if the token is \cs{c_@@_hashes_tl}, and if so just leaves
 %   it.
+%   \changes{v1.0g}{2023/04/06}
+%           {Add case for \cs{c_@@_hashes_tl} (hook-args).}
 %    \begin{macrocode}
 \cs_new:Npn \@@_double_hashes_output:N #1
   {
@@ -1008,11 +1177,15 @@
     \if_meaning:w \q_@@_recursion_tail #1
       \@@_double_hashes_stop:w
     \fi:
-    \if_meaning:w \c_@@_hash_tl #1
+    \if:w ?
+      \if_meaning:w \c_@@_hash_tl #1 ! \fi:
+      \if_meaning:w \c_@@_hashes_tl #1 ! \fi:
+          ?
+    \else:
 %    \end{macrocode}
 %   (this \cs{use_i:nnnn} uses \cs{fi:} and consumes \cs{use:n}, the
 %   whole \cs{if_catcode:w} block, and the \cs{exp_not:N}, leaving just
-%   |#1| which is \cs{c_@@_hash_tl}.)
+%   |#1| which is \cs{c_@@_hashes_tl}.)
 %    \begin{macrocode}
       \use_i:nnnn
     \fi:
@@ -1019,7 +1192,7 @@
     \use:n
       {
 %    \end{macrocode}
-%   If |#1| is not \cs{c_@@_hash_tl}, then check if its catcode is~6,
+%   If |#1| is not \cs{c_@@_hashes_tl}, then check if its catcode is~6,
 %   and if so, leave it doubled in \cs{exp_not:n} and consume the
 %   following |\exp_not:N #1|.
 %    \begin{macrocode}
@@ -1080,10 +1253,10 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_retokenize_patch:Nnn #1 #2 #3
   {
-    \@@_patch_debug:x { ..~command~can~only~be~patched~by~rescanning }
     \str_if_eq:eeTF { \cs_argument_spec:N #1 } { }
       { \@@_patch_expand_redefine:NNnn \c_false_bool #1 {#2} {#3} }
       {
+        \@@_patch_debug:x { ..~command~can~only~be~patched~by~rescanning }
 %    \end{macrocode}
 %
 %   Otherwise, we start the actual patching by retokenization job.  The
@@ -1144,6 +1317,8 @@
 %   \cs{@@_cmd_if_scanable:NnTF} and \cs{@@_patch_retokenize:Nnnn} if
 %   the former returns \meta{true}, plus some debug messages.
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_try_patch_with_catcodes:Nnnnw}
+%<latexrelease>                 {cmd~hooks~with~args}
 \cs_new_protected:Npn \@@_try_patch_with_catcodes:Nnnnw #1 #2 #3 #4
   {
     \quark_if_recursion_tail_stop_do:nn {#4} { \use:n }
@@ -1152,7 +1327,7 @@
       {
         \@@_patch_debug:x { ++~macro~can~be~retokenized~cleanly }
         \@@_patch_debug:x { ==~retokenizing~macro~now }
-        \@@_patch_retokenize:Nnnn #1 {#2} {#3} {#4}
+        \@@_patch_retokenize:Nnnn #1 { cmd / #2 / #3 } {#3} {#4}
         \use_i_delimit_by_q_recursion_stop:nw \use_none:n
       }
       {
@@ -1160,6 +1335,26 @@
         \@@_try_patch_with_catcodes:Nnnnw #1 {#2} {#3}
       }
   }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2021/06/01}{\@@_try_patch_with_catcodes:Nnnnw}
+%<latexrelease>                 {cmd~hooks~with~args}
+%<latexrelease>\cs_gset_protected:Npn \@@_try_patch_with_catcodes:Nnnnw #1 #2 #3 #4
+%<latexrelease>  {
+%<latexrelease>    \quark_if_recursion_tail_stop_do:nn {#4} { \use:n }
+%<latexrelease>    \@@_patch_debug:x { ++~trying~to~patch~by~retokenization }
+%<latexrelease>    \@@_cmd_if_scanable:NnTF {#1} {#4}
+%<latexrelease>      {
+%<latexrelease>        \@@_patch_debug:x { ++~macro~can~be~retokenized~cleanly }
+%<latexrelease>        \@@_patch_debug:x { ==~retokenizing~macro~now }
+%<latexrelease>        \@@_patch_retokenize:Nnnn #1 {#2} {#3} {#4}
+%<latexrelease>        \use_i_delimit_by_q_recursion_stop:nw \use_none:n
+%<latexrelease>      }
+%<latexrelease>      {
+%<latexrelease>        \@@_patch_debug:x { --~macro~cannot~be~retokenized~cleanly }
+%<latexrelease>        \@@_try_patch_with_catcodes:Nnnnw #1 {#2} {#3}
+%<latexrelease>      }
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1267,15 +1462,86 @@
 % \end{macro}
 %
 %
+% \begin{macro}{\@@_guess_arg_count:NN}
+% \begin{macro}{\@@_guess_arg_count:wN}
+% \begin{macro}{\@@_guess_arg_count:nw}
+%   Looks at the parameter text of a macro, and counts the parameters
+%   by looking at the number after a \verb|#|, and checking if they are
+%   sequential.  This macro assumes that all parameters are marked with
+%   hashes, and not other characters, and that there is no
+%   \enquote{trick parameter}.
+% \changes{v1.0h}{2023/05/21}
+%         {Macro added (cmd-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_guess_arg_count:NN}
+%<latexrelease>                 {cmd~hooks~with~args}
+\cs_new_protected:Npn \@@_guess_arg_count:NN #1
+  {
+    \exp_after:wN \@@_guess_arg_count:wN
+      \token_to_meaning:N #1 \s_@@_mark
+  }
+\exp_last_unbraced:NNNNo
+\cs_new_protected:Npx \@@_guess_arg_count:wN
+    #1 { \tl_to_str:n { macro: } } #2 \s_@@_mark #3
+  {
+    \int_set:Nn #3
+      {
+        \exp_not:N \@@_guess_arg_count:nw { 0 } #2
+          \c_hash_str 0 \s_@@_mark
+      }
+  }
+\use:e
+  { \cs_new:Npn \exp_not:N \@@_guess_arg_count:nw #1 #2 \c_hash_str #3 }
+  {
+    \int_compare:nNnTF { #1 + 1 } = {#3}
+      { \@@_guess_arg_count:nw {#3} }
+      { #1 \@@_use_none_delimit_by_s_mark:w }
+  }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2021/06/01}{\@@_guess_arg_count:NN}
+%<latexrelease>                 {cmd~hooks~with~args}
+%<latexrelease>\cs_undefine:N \@@_guess_arg_count:NN
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 %
+%
 % \begin{macro}{\@@_patch_retokenize:Nnnn}
 %   Then, if \cs{@@_cmd_if_scanable:NnTF} returned true, we can go on
 %   and patch the command.
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_patch_retokenize:Nnnn}
+%<latexrelease>                 {cmd~hooks~with~args}
 \cs_new_protected:Npn \@@_patch_retokenize:Nnnn #1 #2 #3 #4
   {
+%   Here, when patching by retokenization, we can only guess the number
+%   of arguments of the macro.
+% \changes{v1.0h}{2023/05/21}
+%         {Changes to allow support arguments in cmd hooks (cmd-args).}
+%    \begin{macrocode}
+    \@@_guess_arg_count:NN #1 \l_@@_patch_num_args_int
 %    \end{macrocode}
-%   Start off by making some things \tn{relax} to avoid lots of
+%
+%   Then we redefine the hook to have the right number of arguments.
+%   Disabling the hook, undefining the \verb|parameter| token list then
+%   calling \cs{@@_make_usable:nn} are enough to redefine the hook to
+%   the extent we want.  Code stored in the hook and other metadata
+%   about it are not lost in the process.
+%    \begin{macrocode}
+    \@@_disable:n {#2}
+    \cs_undefine:c { c_@@_#2_parameter_tl }
+    \@@_make_usable:nn {#2} { \l_@@_patch_num_args_int }
+    \tl_set:Ne \l_@@_tmpa_tl
+      { \exp_args:Ne \tl_to_str:n { \@@_braced_parameter:n {#2} } }
+    \use:x
+      {
+        \str_replace_all:Nnn \exp_not:N \l_@@_tmpa_tl
+          { #### } { \c_hash_str }
+      }
+%    \end{macrocode}
+%   Then, make make some things \tn{relax} to avoid lots of
 %   \tn{noexpand} below.
 %    \begin{macrocode}
     \cs_set_eq:NN \kerneltmpDoNotUse \scan_stop:
@@ -1301,10 +1567,18 @@
             ####1 \def \kerneltmpDoNotUse ####2
               {
                 \str_if_eq:nnT {#3} { before }
-                  { \token_to_str:N \UseHook { cmd / #2 / #3 } }
+                  {
+                    \token_to_str:N \UseHookWithArguments {#2}
+                      { \int_use:N \l_@@_patch_num_args_int }
+                      \l_@@_tmpa_tl
+                  }
                 ####3
                 \str_if_eq:nnT {#3} { after }
-                  { \token_to_str:N \UseHook { cmd / #2 / #3 } }
+                  {
+                    \token_to_str:N \UseHookWithArguments {#2}
+                      { \int_use:N \l_@@_patch_num_args_int }
+                      \l_@@_tmpa_tl
+                  }
               }
           }
 %    \end{macrocode}
@@ -1328,7 +1602,39 @@
 %                {Make patching of commands a global operation (gh/674)}
 %    \begin{macrocode}
     \cs_gset_eq:NN #1 \kerneltmpDoNotUse
+%    \end{macrocode}
+%   Finally, update the hook code.
+%    \begin{macrocode}
+    \@@_update_hook_code:n {#2}
   }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2021/06/01}{\@@_patch_retokenize:Nnnn}
+%<latexrelease>                 {cmd~hooks~with~args}
+%<latexrelease>\cs_gset_protected:Npn \@@_patch_retokenize:Nnnn #1 #2 #3 #4
+%<latexrelease>  {
+%<latexrelease>    \cs_set_eq:NN \kerneltmpDoNotUse \scan_stop:
+%<latexrelease>    \cs_set_eq:NN \@@_tmp:w \scan_stop:
+%<latexrelease>    \use:x
+%<latexrelease>      {
+%<latexrelease>        \cs_set:Npn \@@_tmp:w
+%<latexrelease>            ####1 \tl_to_str:n { macro: } ####2 -> ####3 \s_@@_mark
+%<latexrelease>          {
+%<latexrelease>            ####1 \def \kerneltmpDoNotUse ####2
+%<latexrelease>              {
+%<latexrelease>                \str_if_eq:nnT {#3} { before }
+%<latexrelease>                  { \token_to_str:N \UseHook { cmd / #2 / #3 } }
+%<latexrelease>                ####3
+%<latexrelease>                \str_if_eq:nnT {#3} { after }
+%<latexrelease>                  { \token_to_str:N \UseHook { cmd / #2 / #3 } }
+%<latexrelease>              }
+%<latexrelease>          }
+%<latexrelease>        \tl_set:Nx \exp_not:N \l_@@_tmpa_tl
+%<latexrelease>          { \exp_not:N \@@_tmp:w \token_to_meaning:N #1 \s_@@_mark }
+%<latexrelease>      }
+%<latexrelease>    \tl_rescan:nV { #4 \@@_patch_required_catcodes: } \l_@@_tmpa_tl
+%<latexrelease>    \cs_gset_eq:NN #1 \kerneltmpDoNotUse
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 % \end{macro}
 %

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltfilehook.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltfilehook.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltfilehook.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,7 +1,7 @@
 % \iffalse meta-comment
 %
 % Copyright (C) 2020-2023
-%     Frank Mittelbach, Phelype Oleinik & LaTeX Team
+%     Frank Mittelbach, Phelype Oleinik and The LaTeX Project
 %
 % This file is part of the LaTeX base system.
 % -------------------------------------------
@@ -31,8 +31,8 @@
 %%% From File: ltfilehook.dtx
 %
 %    \begin{macrocode}
-\providecommand\ltfilehookversion{v1.0n}
-\providecommand\ltfilehookdate{2022/08/18}
+\providecommand\ltfilehookversion{v1.0o}
+\providecommand\ltfilehookdate{2023/04/02}
 %    \end{macrocode}
 %
 %<*driver>
@@ -1229,8 +1229,10 @@
 %   This auxiliary compares \cs{\meta{filename}} with
 %   \cs{csname\cs{endcsname}} to check if the empty |.tex| file was
 %   requested.
+%   \changes{v1.0o}{2023/04/02}
+%           {Make \cs{@set at curr@file at aux} \cs{long} gh/942}
 %    \begin{macrocode}
-\def\@set at curr@file at aux#1{%
+\long\def\@set at curr@file at aux#1{%
   \expandafter\ifx\csname\endcsname#1%
     .tex\else\string#1\fi}
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -32,7 +32,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltfiles.dtx}
-             [2023/01/05 v1.2s LaTeX Kernel (File Handling)]
+             [2023/05/17 v1.2t LaTeX Kernel (File Handling)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltfiles.dtx}
@@ -1202,6 +1202,9 @@
 % \changes{v1.0t}{1995/05/25}{(CAR) added \cs{long}}
 % \changes{v1.2d}{2019/10/26}{quote on openin}
 % \changes{v1.2k}{2021/03/12}{Allow unbalanced conditionals (gh/530)}
+% \changes{v1.2t}{2023/05/15}{Use \pkg{expl3} file existence test}
+% \begin{macro}{\IfFileExists@}
+% \changes{v1.2t}{2023/05/15}{Macro added}
 % Argument |#1| is |\@curr at file| so catcode 12 string with no quotes.
 %
 %    The original definition picked up arguments |#2| and |#3| in a
@@ -1211,23 +1214,35 @@
 %    \cs{secondoftwo}. However, that changes how |#| is interpreted
 %    and so we can't do that nowaways without invalidating a lot of
 %    code. Therefore the somewhat curious construction near the end.
+%
+%    Earlier versions used |\openin| here, but this led to two
+%    code paths, one in \pkg{expl3} and one here. To avoid that,
+%    and as the \pkg{expl3} approach works by expansion, we use
+%    that here. As we need the file name to include the path,
+%    the actual \pkg{expl3} function used is not the file existence
+%    test!
 %    \begin{macrocode}
 %</2ekernel>
 %<*2ekernel|latexrelease>
-%<latexrelease>\IncludeInRelease{2021/06/01}%
-%<latexrelease>                 {\IfFileExists@}{manage unbalanced conditionals}
+%<latexrelease>\IncludeInRelease{2023/05/01}%
+%<latexrelease>                 {\IfFileExists@}{IfFileExists}
 \long\def \IfFileExists@#1#2#3{%
-  \openin\@inputcheck"#1" %
-  \ifeof\@inputcheck
-    \ifx\input at path\@undefined
+  \edef\@filef at und{\IfFileExists@@{#1}}%
+%    \end{macrocode}
+%    The \pkg{expl3} function regards an empty argument as nothing at all,
+%    but the \LaTeXe{} convention is that this is equal to the special
+%    \texttt{.tex} file.
+%    \begin{macrocode}
+  \ifx\@filef at und\@empty
+    \if\relax\detokenize{#1}\relax
+      \let\reserved at a\@firstoftwo
+      \def\@filef at und{".tex" }%
+    \else
       \let\reserved at a\@secondoftwo
-    \else
-      \def\reserved at a{\@iffileonpath{#1}}%
     \fi
   \else
-    \closein\@inputcheck
-    \edef\@filef at und{"#1" }%
     \let\reserved at a\@firstoftwo
+    \edef\@filef at und{"\@filef at und" }%
   \fi
 %    \end{macrocode}
 %    This is just there so that any |#| inside |#2| or |#3| needs
@@ -1236,10 +1251,35 @@
   \expandafter\def\expandafter\reserved at a
     \expandafter{\reserved at a{#2}{#3}}%
 \reserved at a}
+\ExplSyntaxOn
+\cs_new_eq:NN \IfFileExists@@ \file_full_name:n
+\ExplSyntaxOff
 %</2ekernel|latexrelease>
 %<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2021/06/01}%
+%<latexrelease>                 {\IfFileExists@}{IfFileExists}
+%<latexrelease>
+%<latexrelease>\long\def \IfFileExists@#1#2#3{%
+%<latexrelease>  \openin\@inputcheck"#1" %
+%<latexrelease>  \ifeof\@inputcheck
+%<latexrelease>    \ifx\input at path\@undefined
+%<latexrelease>      \let\reserved at a\@secondoftwo
+%<latexrelease>    \else
+%<latexrelease>      \def\reserved at a{\@iffileonpath{#1}}%
+%<latexrelease>    \fi
+%<latexrelease>  \else
+%<latexrelease>    \closein\@inputcheck
+%<latexrelease>    \edef\@filef at und{"#1" }%
+%<latexrelease>    \let\reserved at a\@firstoftwo
+%<latexrelease>  \fi
+%<latexrelease>  \expandafter\def\expandafter\reserved at a
+%<latexrelease>    \expandafter{\reserved at a{#2}{#3}}%
+%<latexrelease>\reserved at a}
+%<latexrelease>\let\IfFileExists@@\@undefined
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>
 %<latexrelease>\IncludeInRelease{2019/10/01}%
-%<latexrelease>                 {\IfFileExists@}{manage unbalanced conditionals}
+%<latexrelease>                 {\IfFileExists@}{IfFileExists}
 %<latexrelease>
 %<latexrelease>\long\def \IfFileExists@#1#2#3{%
 %<latexrelease>  \openin\@inputcheck"#1" %
@@ -1257,7 +1297,7 @@
 %<latexrelease>  \reserved at a}
 %<latexrelease>\EndIncludeInRelease
 %<latexrelease>\IncludeInRelease{0000/00/00}%
-%<latexrelease>                 {\IfFileExists@}{manage unbalanced conditionals}
+%<latexrelease>                 {\IfFileExists@}{IfFileExists}
 %<latexrelease>
 %<latexrelease>\let\IfFileExists@\@undefined
 %<latexrelease>
@@ -1266,6 +1306,7 @@
 %<*2ekernel>
 %    \end{macrocode}
 %  \end{macro}
+%  \end{macro}
 %
 %
 %
@@ -1272,7 +1313,6 @@
 %
 %
 %
-%
 % \begin{macro}{\@iffileonpath}
 % If the file is not found by |\openin|, and |\input at path| is defined,
 % look in all the directories specified in |\input at path|.

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltfinal.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltfinal.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltfinal.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltfinal.dtx}
-             [2022/11/30 v2.2y LaTeX Kernel (Final Settings)]
+             [2023/04/20 v2.3b LaTeX Kernel (Final Settings)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltfinal.dtx}
@@ -1062,6 +1062,24 @@
 \fi % End of reset block for 8-bit engines
 %    \end{macrocode}
 %
+% \begin{macro}{\BCPdata}
+% \changes{v2.3a}{2023/04/16}{Command added}
+%   A stub for use by \pkg{babel}, \pkg{polyglossia}, etc.
+%    \begin{macrocode}
+\ExplSyntaxOn
+\newcommand*\BCPdata[1]{
+  \str_case:nn {#1}
+    {
+      { language } { en }
+      { region }   { US }
+      { script }   { Latn }
+      { tag }      { en-US }
+    }
+}
+\ExplSyntaxOff
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\MakeUppercase}
 % \begin{macro}{\MakeLowercase}
 % \begin{macro}{\MakeTitlecase}
@@ -1069,6 +1087,9 @@
 % \begin{macro}{\AddToNoCaseChangeList}
 % \begin{macro}{\CaseSwitch}
 % \begin{macro}{\DeclareCaseChangeEquivalent}
+% \begin{macro}{\DeclareLowercaseMapping}
+% \begin{macro}{\DeclareTitlecaseMapping}
+% \begin{macro}{\DeclareUppercaseMapping}
 % \begin{macro}{\@uclclist}
 %
 %
@@ -1088,6 +1109,7 @@
 % \changes{v2.2x}{2022/10/26}{Introduce optional argument for case-changing commands}
 % \changes{v2.2x}{2022/10/26}{Make case changing commands language-aware}
 % \changes{v2.2x}{2022/10/26}{Auto-detect \pkg{babel} locale}
+% \changes{v2.3a}{2023/04/11}{Use new generic mechanism to detect locale}
 % Wrappers around the L3 case changing functions.
 % |\protected| to make them mostly safe as replacements for |uppercase|
 % and |\lowercase|.  
@@ -1121,33 +1143,24 @@
   {
     \cs_set_nopar:Npn \reserved at a { }
     \tl_if_blank:nTF {#2}
-      { \@@text at case@aux@ }
-      { \keys_set:nn { __kernel } {#2} }
-    \use:c { text_ #1 case:Vn } \reserved at a {#3}
-  }
-\cs_new_protected:Npn \@@text at case@aux@ { }
-\tl_gput_right:Nn \@kernel at after@begindocument
-  {
-    \@ifpackageloaded { babel }
       {
-        \@ifpackagelater { babel } { 2020-01-15 }
+        \str_set:Nx \reserved at a
+          { \BCPdata { casing } }
+        \str_if_empty:NT \reserved at a
           {
-            \cs_gset_protected:Npn \@@text at case@aux@
-              {
-                \str_set:Nx \reserved at a
-                  { \localeinfo* { tag.bcp47 } }
-              }
+            \str_set:Nx \reserved at a
+              { \BCPdata { language } }
           }
-          { }
       }
-      { }
+      { \keys_set:nn { __kernel } {#2} }
+    \use:c { text_ #1 case:Vn } \reserved at a {#3}
   }
-\exp_args_generate:n { cnx }
 %    \end{macrocode}
 % The odd use of \emph{three} spaces here is needed as \pkg{ltcmd} uses the
 % name with one and two spaces to give a `friendly' error message for a runaway
 % argument: that means we can't use it here.
 %    \begin{macrocode}
+\exp_args_generate:n { cnx }
 \cs_set_protected:Npn \reserved at a #1
   {
     \cs_generate_variant:cn { text_ \str_lowercase:n {#1} case:nn } { V }
@@ -1161,6 +1174,7 @@
 \reserved at a { Title }
 %    \end{macrocode}
 % \changes{v2.2y}{2022/11/30}{Set \cs{oe}/\cs{OE} equal to act as a marker for \pkg{babel}}
+% \changes{v2.2z}{2023/03/28}{Use groups for gh/1021}
 % Currently, \pkg{babel} uses the equivalence of \cs{oe} and \cs{OE} to force casing of
 % some material, most notably in \cs{today}. To enable that to work, we have to set those
 % commands equal even though the current case changing code does not work using this
@@ -1167,30 +1181,26 @@
 % approach.
 %    \begin{macrocode}
 \cs_new_protected:cpn { MakeLowercase \c_space_tl \c_space_tl \c_space_tl } [#1] #2
-  {
-    \let \kernel at saved@OE \OE
+  {{
     \let \OE \oe
     \@@text at case@aux { lower } {#1} {#2}
-    \let \OE \kernel at saved@OE
-  }
+  }}
 \cs_new_protected:cpn { MakeUppercase \c_space_tl \c_space_tl \c_space_tl } [#1] #2
-  {
-    \let \kernel at saved@oe \oe
+  {{
     \let \oe \OE
     \@@text at case@aux { upper } {#1} {#2}
-    \let \oe \kernel at saved@oe
-  }
+  }}
 \cs_new_protected:cpn { MakeTitlecase \c_space_tl \c_space_tl \c_space_tl } [#1] #2
-  {
-    \let \kernel at saved@oe \oe
+  {{
     \let \oe \OE
     \@@text at case@aux { title } {#1} {#2}
-    \let \oe \kernel at saved@oe
-  }
+  }}
 %    \end{macrocode}
 %
 % \changes{v2.2u}{2022/06/02}{Add \cs{NoCaseChange}}
 % \changes{v2.2u}{2022/06/30}{Add \cs{AddToNoCaseChangeList}}
+% \changes{v2.3b}{2023/04/19}{Add \cs{DeclareLowercaseMapping},
+%   \cs{DeclareTitlecaseMapping} and \cs{DeclareUppercaseMapping}}
 % |\NoCaseChange| protects its argument from the case change functions.
 %
 % |\AddToNoCaseChangeList| Allows new commands to protect their arguments, eg
@@ -1204,6 +1214,27 @@
 \cs_new_eq:NN \CaseSwitch \text_case_switch:nnnn
 \cs_new_eq:NN \DeclareCaseChangeEquivalent
   \text_declare_case_equivalent:Nn
+\NewDocumentCommand \DeclareLowercaseMapping { o m m }
+  {
+    \IFNoValueTF {#1}
+      { \text_declare_lowercase_mapping:nn }
+      { \text_declare_lowercase_mapping:nnn {#1} }
+        {#2} {#3}
+  }
+\NewDocumentCommand \DeclareTitlecaseMapping { o m m }
+  {
+    \IFNoValueTF {#1}
+      { \text_declare_titlecase_mapping:nn }
+      { \text_declare_titlecase_mapping:nnn {#1} }
+        {#2} {#3}
+  }
+\NewDocumentCommand \DeclareUppercaseMapping { o m m }
+  {
+    \IFNoValueTF {#1}
+      { \text_declare_uppercase_mapping:nn }
+      { \text_declare_uppercase_mapping:nnn {#1} }
+        {#2} {#3}
+  }
 \ExplSyntaxOff
 %    \end{macrocode}
 %
@@ -1222,6 +1253,9 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \changes{v1.0h}{1994/05/13}{Added output enc stuff}
 % \changes{v1.0i}{1994/05/16}{moved output enc stuff to lfonts}

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltfssbas.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltfssbas.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltfssbas.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -35,7 +35,7 @@
 %
 %
 \ProvidesFile{ltfssbas.dtx}
-             [2022/07/04 v3.2k LaTeX Kernel (NFSS Basic Macros)]
+             [2023/04/01 v3.2l LaTeX Kernel (NFSS Basic Macros)]
 % \iffalse
 \documentclass{ltxdoc}
 \begin{document}
@@ -1050,11 +1050,22 @@
 %      {\cs{def} $\to$ \cs{edef} for \cs{math at version}.}
 % \changes{v1.2g}{1990/02/16}{\cs{@nomath} added.}
 % \changes{v2.1a}{1994/01/17}{New math font setup}
+% \changes{v3.2l}{2023/04/01}{Reset frozen mathversion gh/1028}
 %    \begin{macrocode}
 \DeclareRobustCommand\mathversion[1]
          {\@nomath\mathversion
           \expandafter\ifx\csname mv@#1\endcsname\relax
           \@latex at error{Math version `#1' is not defined}\@eha\else
+%    \end{macrocode}
+%  If there has been a frozen math version reset locally. See GH 1028.
+%    \begin{macrocode}
+          \ifcsname mv@\math at version @frozen\endcsname
+            \expandafter\let
+            \csname mv@\math at version @frozen\expandafter\endcsname
+            \csname mv@\math at version\endcsname
+          \fi
+%    \end{macrocode}
+%    \begin{macrocode}
           \edef\math at version{#1}%
 %    \end{macrocode}
 %    We need to force a math font setup both now and at the point

Modified: trunk/Master/texmf-dist/source/latex-dev/base/lthooks.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/lthooks.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/lthooks.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,7 +1,7 @@
 % \iffalse meta-comment
 %
 % Copyright (C) 2020-2023
-%       Frank Mittelbach, Phelype Oleinik & LaTeX Team
+%       Frank Mittelbach, Phelype Oleinik, The LaTeX Project
 %
 % This file is part of the LaTeX base system.
 % -------------------------------------------
@@ -31,8 +31,8 @@
 %%% From File: lthooks.dtx
 %
 %    \begin{macrocode}
-\def\lthooksversion{v1.0v}
-\def\lthooksdate{2022/06/15}
+\def\lthooksversion{v1.1d}
+\def\lthooksdate{2023/05/21}
 %    \end{macrocode}
 %
 %<*driver>
@@ -148,7 +148,6 @@
 %    the current package name. See section~\ref{sec:default-label}.
 % \end{function}
 %
-%
 % \begin{function}{\NewMirroredHookPair}
 %   \begin{syntax}
 %     \cs{NewMirroredHookPair} \Arg{hook-1} \Arg{hook-2}
@@ -156,11 +155,49 @@
 %     A shorthand for
 %    \cs{NewHook}\Arg{hook-1}\cs{NewReversedHook}\Arg{hook-2}.
 %
-%    The \meta{hooks} can be specified using the dot-syntax to denote
+%    The \meta{hook} can be specified using the dot-syntax to denote
 %    the current package name. See section~\ref{sec:default-label}.
 % \end{function}
 %
 %
+% \begin{function}{\NewHookWithArguments}
+%   \begin{syntax}
+%     \cs{NewHookWithArguments} \Arg{hook} \Arg{number}
+%   \end{syntax}
+%   Creates a new \meta{hook} whose code takes \meta{number} arguments,
+%   and otherwise works exactly like \cs{NewHook}.
+%   Section~\ref{sec:hook-args} explains hooks with arguments.
+%
+%    The \meta{hook} can be specified using the dot-syntax to denote
+%    the current package name. See section~\ref{sec:default-label}.
+% \end{function}
+%
+% \begin{function}{\NewReversedHookWithArguments}
+%   \begin{syntax}
+%     \cs{NewReversedHookWithArguments} \Arg{hook} \Arg{number}
+%   \end{syntax}
+%   Like \cs{NewReversedHook}, but creates a hook whose code takes
+%   \meta{number} arguments.
+%   Section~\ref{sec:hook-args} explains hooks with arguments.
+%
+%    The \meta{hook} can be specified using the dot-syntax to denote
+%    the current package name. See section~\ref{sec:default-label}.
+% \end{function}
+%
+% \begin{function}{\NewMirroredHookPairWithArguments}
+%   \begin{syntax}
+%     \cs{NewMirroredHookPairWithArguments} \Arg{hook-1} \Arg{hook-2} \Arg{number}
+%   \end{syntax}
+%   A shorthand for
+%   \cs{NewHookWithArguments}\Arg{hook-1}\Arg{number}\\
+%   \cs{NewReversedHookWithArguments}\Arg{hook-2}\Arg{number}.
+%   Section~\ref{sec:hook-args} explains hooks with arguments.
+%
+%    The \meta{hook} can be specified using the dot-syntax to denote
+%    the current package name. See section~\ref{sec:default-label}.
+% \end{function}
+%
+%
 % \subsubsection{Special declarations for generic hooks}
 %
 %    The declarations here should normally not be used. They are available
@@ -173,9 +210,9 @@
 %   \begin{syntax}
 %     \cs{DisableGenericHook} \Arg{hook}
 %   \end{syntax}
-%    After this declaration\footnotemark{} the \meta{hook} is no longer usable: Any
-%    attempt to add further code to it will result in an error and any
-%    use, e.g., via \cs{UseHook}, will simply do nothing.
+%    After this declaration\footnotemark{} the \meta{hook} is no longer
+%    usable: Any further attempt to add code to it will result in an
+%    error and any use, e.g., via \cs{UseHook}, will simply do nothing.
 %
 %    This is intended to be used with generic command hooks (see
 %    \texttt{ltcmdhooks-doc}) as depending on the definition of the
@@ -215,7 +252,7 @@
 %   \begin{syntax}
 %     \cs{UseHook} \Arg{hook}
 %   \end{syntax}
-%    Execute the hook code inside a command or environment.
+%    Execute the code stored in the \meta{hook}.
 %
 %    Before \verb=\begin{document}= the fast execution code for a hook
 %    is not set up, so in order to use a hook there it is explicitly
@@ -227,6 +264,22 @@
 %    A leading |.| is treated literally.
 % \end{function}
 %
+% \begin{function}{\UseHookWithArguments}
+%   \begin{syntax}
+%     \cs{UseHookWithArguments} \Arg{hook} \Arg{number} \Arg{arg_1} \ldots \Arg{arg_n}
+%   \end{syntax}
+%    Execute the code stored in the \meta{hook} and pass the arguments
+%    \Arg{arg_1} through \Arg{arg_n} to the \meta{hook}.  Otherwise, it
+%    works exactly like \cs{UseHook}.
+%    The \meta{number} should be the number of arguments declared for
+%    the hook.  If the hook is not declared, this command does nothing
+%    and it will remove \meta{number} items from the input.
+%   Section~\ref{sec:hook-args} explains hooks with arguments.
+%
+%    The \meta{hook} \emph{cannot} be specified using the dot-syntax.
+%    A leading |.| is treated literally.
+% \end{function}
+%
 % \begin{function}{\UseOneTimeHook}
 %   \begin{syntax}
 %     \cs{UseOneTimeHook} \Arg{hook}
@@ -233,8 +286,8 @@
 %   \end{syntax}
 %    Some hooks are only used (and can be only used) in one place, for
 %    example, those in \verb=\begin{document}= or
-%    \verb=\end{document}=. Once we have passed that point adding to
-%    the hook through a defined \cs[no-index]{\meta{addto-cmd}} command (e.g.,
+%    \verb=\end{document}=. From that point onwards, adding to the hook
+%    through a defined \cs[no-index]{\meta{addto-cmd}} command (e.g.,
 %    \cs{AddToHook} or \cs{AtBeginDocument}, etc.\@) would have no
 %    effect (as would the use of such a command inside the hook code
 %    itself). It is therefore customary to redefine
@@ -250,15 +303,30 @@
 %    section~\ref{sec:default-label} for details.
 %
 %    Using \cs{UseOneTimeHook} several times with the same
-%    \Arg{hook} means that it only executes the first time it is used. 
+%    \Arg{hook} means that it only executes the first time it is used.
 %    For example, if it is used in a command that can be called several times
-%    then the hook executes during only the \emph{first} invocation of that 
+%    then the hook executes during only the \emph{first} invocation of that
 %    command; this allows its use as an \enquote{initialization hook}.
 %
 %    Mixing \cs{UseHook} and \cs{UseOneTimeHook} for the same
 %    \Arg{hook} should be avoided, but if this is done then neither will execute
 %    after the first \cs{UseOneTimeHook}.
+% \end{function}
 %
+% \begin{function}{\UseOneTimeHookWithArguments}
+%   \begin{syntax}
+%     \cs{UseOneTimeHookWithArguments} \Arg{hook} \Arg{number} \Arg{arg_1} \ldots \Arg{arg_n}
+%   \end{syntax}
+%    Works exactly like \cs{UseOneTimeHook}, but passes arguments
+%    \Arg{arg_1} through \Arg{arg_n} to the \meta{hook}.
+%    The \meta{number} should be the number of arguments declared for
+%    the hook.  If the hook is not declared, this command does nothing
+%    and it will remove \meta{number} items from the input.
+%
+%    It should be noted that after a one-time hook is used, it is no
+%    longer possible to use \cs{AddToHookWithArguments} or similar with
+%    that hook.  \cs{AddToHook} continues to work as normal.
+%   Section~\ref{sec:hook-args} explains hooks with arguments.
 % \end{function}
 %
 %
@@ -294,6 +362,34 @@
 %    See section~\ref{sec:default-label}.
 % \end{function}
 %
+% \begin{function}{\AddToHookWithArguments}
+%   \begin{syntax}
+%     \cs{AddToHookWithArguments} \Arg{hook}\oarg{label}\Arg{code}
+%   \end{syntax}
+%    Works exactly like \cs{AddToHook}, except that the \meta{code} can
+%    access the arguments passed to the hook using \verb|#1|, \verb|#2|,
+%    \ldots, \verb|#n| (up to the number of arguments declared for the
+%    hook).  If the \meta{code} should contain \emph{parameter tokens}
+%    (\verb|#|) that are not supposed to be understood as the arguments
+%    of the hook, such tokens should be doubled.  For example, with
+%    \cs{AddToHook} one can write:
+%\begin{verbatim}
+%   \AddToHook{myhook}{\def\foo#1{Hello, #1!}}
+%\end{verbatim}
+%    but to achieve the same with \cs{AddToHookWithArguments}, one should
+%    write:
+%\begin{verbatim}
+%   \AddToHookWithArguments{myhook}{\def\foo##1{Hello, ##1!}}
+%\end{verbatim}
+%    because in the latter case, \verb|#1| refers to the first argument
+%    of the hook \hook{myhook}.
+%   Section~\ref{sec:hook-args} explains hooks with arguments.
+%
+%    The \meta{hook} and \meta{label} can be specified using the
+%    dot-syntax to denote the current package name.
+%    See section~\ref{sec:default-label}.
+% \end{function}
+%
 % \begin{function}{\RemoveFromHook}
 %   \begin{syntax}
 %     \cs{RemoveFromHook} \Arg{hook}\oarg{label}
@@ -403,8 +499,21 @@
 % \end{function}\footnotetext{There is
 %    no mechanism to reorder such code chunks (or delete them).}
 %
+% \begin{function}{\AddToHookNextWithArguments}
+%   \begin{syntax}
+%     \cs{AddToHookNextWithArguments} \Arg{hook}\Arg{code}
+%   \end{syntax}
+%    Works exactly like \cs{AddToHookNext}, but the \meta{code} can
+%    contain references to the arguments of the \meta{hook} as described
+%    for \cs{AddToHookWithArguments} above.
+%   Section~\ref{sec:hook-args} explains hooks with arguments.
 %
+%    The \meta{hook} can be specified using the dot-syntax to denote
+%    the current package name.  See section~\ref{sec:default-label}.
+% \end{function}
 %
+%
+%
 % \begin{function}{\ClearHookNext}
 %   \begin{syntax}
 %     \cs{ClearHookNext}\Arg{hook}
@@ -511,10 +620,10 @@
 % package's hooks, so the dot-syntax doesn't make much sense.
 %
 % In some cases, for example in large packages, one may want to separate
-% it in logical parts, but still use the main package name as
+% the code in logical parts, but still use the main package name as the
 % \meta{label}, then the \meta{default label} can be set using
-% \cs{SetDefaultHookLabel} or
-% \cs{PushDefaultHookLabel}\verb={..}=\,\ldots\cs{PopDefaultHookLabel}.
+% \cs{PushDefaultHookLabel}\verb={...}=\,\ldots\cs{PopDefaultHookLabel}
+% or \cs{SetDefaultHookLabel}\verb={...}=.
 %
 % \begin{function}{\PushDefaultHookLabel,\PopDefaultHookLabel}
 %   \begin{syntax}
@@ -906,8 +1015,11 @@
 % section even in \texttt{expl3} packages, but the choice is yours.
 %
 %
-% \begin{function}
-%   {\hook_new:n,\hook_new_reversed:n,\hook_new_pair:nn}
+% \begin{function}{
+%     \hook_new:n,
+%     \hook_new_reversed:n,
+%     \hook_new_pair:nn
+%   }
 %   \begin{syntax}
 %     \cs{hook_new:n} \Arg{hook}
 %     \cs{hook_new_reversed:n} \Arg{hook}
@@ -923,8 +1035,29 @@
 %    the current package name. See section~\ref{sec:default-label}.
 % \end{function}
 %
+% \begin{function}{
+%     \hook_new_with_args:nn,
+%     \hook_new_reversed_with_args:nn,
+%     \hook_new_pair_with_args:nnn
+%   }
+%   \begin{syntax}
+%     \cs{hook_new_with_args:nn} \Arg{hook} \Arg{number}
+%     \cs{hook_new_reversed_with_args:nn} \Arg{hook} \Arg{number}
+%     \cs{hook_new_pair_with_args:nnn} \Arg{hook-1} \Arg{hook-2} \Arg{number}
+%   \end{syntax}
+%   Creates a new \meta{hook} with normal or reverse ordering of code
+%    chunks, that takes \meta{number} arguments from the input stream
+%    when it is used. \cs{hook_new_pair_with_args:nn} creates a pair of
+%    such hooks with \Arg{hook-2} being a reversed hook.
+%    If a hook name is already taken, an error is raised and the hook
+%    is not created.
 %
+%    The \meta{hook} can be specified using the dot-syntax to denote
+%    the current package name. See section~\ref{sec:default-label}.
+% \end{function}
 %
+%
+%
 % \begin{function}{\hook_disable_generic:n}
 %   \begin{syntax}
 %     \cs{hook_disable_generic:n} \Arg{hook}
@@ -958,37 +1091,62 @@
 %
 %
 %
-% \begin{function}{\hook_use:n}
+% \begin{function}{\hook_use:n,\hook_use:nnw}
 %   \begin{syntax}
 %     \cs{hook_use:n} \Arg{hook}
+%     \cs{hook_use:nnw} \Arg{hook} \Arg{number} \Arg{arg_1} \ldots \Arg{arg_n}
 %   \end{syntax}
 %    Executes the \Arg{hook} code followed (if set up) by the code for next
 %    invocation only, then empties that next invocation code.
+%    \cs{hook_use:nnw} should be used for hooks declared with arguments,
+%    and should be followed by as many brace groups as the declared
+%    number of arguments.
+%    The \meta{number} should be the number of arguments declared for
+%    the hook.  If the hook is not declared, this command does nothing
+%    and it will remove \meta{number} items from the input.
 %
 %    The \meta{hook} \emph{cannot} be specified using the dot-syntax.
 %    A leading |.| is treated literally.
 % \end{function}
 %
-% \begin{function}{\hook_use_once:n}
+% \begin{function}{\hook_use_once:n,\hook_use_once:nnw}
 %   \begin{syntax}
 %     \cs{hook_use_once:n} \Arg{hook}
+%     \cs{hook_use_once:nnw} \Arg{hook} \Arg{number} \Arg{arg_1} \ldots \Arg{arg_n}
 %   \end{syntax}
 %     Changes the \Arg{hook} status so that from now on any addition to
 %     the hook code is executed immediately. Then execute any
 %     \Arg{hook} code already set up.
+%    \cs{hook_use_once:nnw} should be used for hooks declared with arguments,
+%    and should be followed by as many brace groups as the declared
+%    number of arguments.
+%    The \meta{number} should be the number of arguments declared for
+%    the hook.  If the hook is not declared, this command does nothing
+%    and it will remove \meta{number} items from the input.
 %
 %    The \meta{hook} \emph{cannot} be specified using the dot-syntax.
 %    A leading |.| is treated literally.
 % \end{function}
 %
-% \begin{function}{\hook_gput_code:nnn}
+% \begin{function}{
+%     \hook_gput_code:nnn,
+%     \hook_gput_code_with_args:nnn
+%   }
 %   \begin{syntax}
 %     \cs{hook_gput_code:nnn} \Arg{hook} \Arg{label} \Arg{code}
+%     \cs{hook_gput_code_with_args:nnn} \Arg{hook} \Arg{label} \Arg{code}
 %   \end{syntax}
 %    Adds a chunk of \meta{code} to the \meta{hook} labeled
 %    \meta{label}. If the label already exists the \meta{code} is
 %    appended to the already existing code.
 %
+%    If \cs{hook_gput_code_with_args:nnn} is used, the \meta{code}
+%    can access the arguments passed to \cs{hook_use:nnw}
+%    (or~\cs{hook_use_once:nnw}) with \verb|#1|, \verb|#2|, \ldots,
+%    \verb|#n| (up to the number of arguments declared for the hook).
+%    In that case, if an actual parameter token should be added to the
+%    code, it should be doubled.
+%
 %    If code is added to an external \meta{hook} (of the kernel or
 %    another package) then the convention is to use the package name
 %    as the \meta{label} not some internal module name or some other
@@ -999,8 +1157,10 @@
 %    See section~\ref{sec:default-label}.
 % \end{function}
 %
-% \begin{function}
-%   {\hook_gput_next_code:nn}
+% \begin{function}{
+%     \hook_gput_next_code:nn,
+%     \hook_gput_next_code_with_args:nn,
+%   }
 %   \begin{syntax}
 %     \cs{hook_gput_next_code:nn} \Arg{hook} \Arg{code}
 %   \end{syntax}
@@ -1007,10 +1167,16 @@
 %    Adds a chunk of \meta{code} for use only in the next invocation of the
 %    \meta{hook}. Once used it is gone.
 %
+%    If \cs{hook_gput_next_code_with_args:nn} is used, the \meta{code}
+%    can access the arguments passed to \cs{hook_use:nnw}
+%    (or~\cs{hook_use_once:nnw}) with \verb|#1|, \verb|#2|, \ldots,
+%    \verb|#n| (up to the number of arguments declared for the hook).
+%    In that case, if an actual parameter token should be added to the
+%    code, it should be doubled.
+%
 %    This is simpler than \cs{hook_gput_code:nnn}, the code is simply
 %    appended to the hook in the order of declaration at the very end,
 %    i.e., after all standard code for the hook got executed.
-%
 %    Thus if one needs to undo what the standard does one has to do
 %    that as part of \meta{code}.
 %
@@ -1019,8 +1185,7 @@
 % \end{function}
 %
 %
-% \begin{function}
-%   {\hook_gclear_next_code:n}
+% \begin{function}{\hook_gclear_next_code:n}
 %   \begin{syntax}
 %     \cs{hook_gclear_next_code:n} \Arg{hook}
 %   \end{syntax}
@@ -1240,7 +1405,7 @@
 %    \begin{itshape}\begin{color}{blue} ...
 %    \end{itshape}\end{color}
 %\end{verbatim}
-%   and an error message that \verb=\begin{color}= ended by
+%    and an error message saying that \verb=\begin{color}= was ended by
 %    \verb=\end{itshape}=.
 %    With \hook{env/quote/after} declared as a reversed hook the
 %    execution order is reversed and so all environments are closed in
@@ -1377,9 +1542,9 @@
 %    you typically do not know what kind of variable parts may come up
 %    in real documents.
 %
-%    For example, \pkg{babel} may want to provide hooks such as
-%    \hook{babel/\meta{language}/afterextras}.  Language support in
-%    \pkg{babel} is often done through external language
+%    For example, \pkg{babel} provides hooks such as
+%    \hook{babel/\meta{language}/afterextras}.  However, language
+%    support in \pkg{babel} is often done through external language
 %    packages. Thus doing the activation for all languages inside the
 %    core \pkg{babel} code is not a viable approach. Instead it needs
 %    to be done by each language package (or by the user who wants to
@@ -1396,6 +1561,125 @@
 %    conciderably.
 %
 %
+% \subsection{Hooks with arguments}
+% \label{sec:hook-args}
+%
+%    Sometimes it is necessary to pass contextual information to a hook,
+%    and, for one reason or another, it is not feasible to store such
+%    information in macros.  To serve this purpose, hooks can be
+%    declared with arguments, so that the programmer can pass along the
+%    data necessary for the code in the hook to function properly.
+%
+%    A hook with arguments works mostly like a regular hook, and most
+%    commands that work for regular hooks, also work for hooks that take
+%    arguments.  The differences are when the hook is declared
+%    (\cs{NewHookWithArguments} is used instead of \cs{NewHook}), then
+%    code can be added with both \cs{AddToHook} and
+%    \cs{AddToHookWithArguments}, and when the hook is used
+%    (\cs{UseHookWithArguments} instead of \cs{UseHook}).
+%
+%    \medskip
+%
+%    A hook with arguments must be declared as such (before it is first
+%    used, as all regular hooks) using
+%    \cs{NewHookWithArguments}\Arg{hook}\Arg{number}.  All code added to
+%    that hook can then use \verb|#1| to access the first argument,
+%    \verb|#2| to access the second, and so forth up to the number of
+%    arguments declared.  However, it is still possible to add code with
+%    references to the arguments of a hook that was not yet declared
+%    (we will discuss that later).  At their core, hooks are macros, so
+%    \TeX's limit of 9~arguments applies, and a low-level \TeX{} error
+%    is raised if you try to reference an argument number that doesn't
+%    exist.
+%
+%    \medskip
+%
+%    To use a hook with arguments, just write
+%    \cs{UseHookWithArguments}\Arg{hook}\Arg{number} followed by a
+%    braced list of the arguments.  For example, if the hook \hook{test}
+%    takes three arguments, write:
+%\begin{verbatim}
+%    \UseHookWithArguments{test}{3}{arg-1}{arg-2}{arg-3}
+%\end{verbatim}
+%    then, in the \meta{code} of the hook, all instances of \verb|#1|
+%    will be replaced by \verb|arg-1|, \verb|#2| by \verb|arg-2| and so
+%    on.  If, at the point of usage, the programmer provides more
+%    arguments than the hook is declared to take, the excess arguments
+%    are simply ignored by the hook.  Behaviour is
+%    unpredictable\footnote
+%      {The hook \emph{will} take the declared number of arguments, and
+%       what will happen depends on what was grabbed, and what the hook
+%       code does with its arguments.}
+%    if too few arguments are provided.  If the hook isn't declared,
+%    \meta{number} arguments are removed from the input stream.
+%
+%    \medskip
+%
+%    Adding code to a hook with arguments can be done with
+%    \cs{AddToHookWithArguments} as well as with the regular
+%    \cs{AddToHook}, to achieve different outcomes.  The main difference
+%    when it comes to adding code to a hook, in this case, is firstly
+%    the possibility of accessing a hook's arguments, of course, and
+%    second, how parameter tokens (\verb|#|$_6$) are treated.
+%
+%    Using \cs{AddToHook} in a hook that takes arguments will work as it
+%    does for all other hooks. This allows a package developer to add
+%    arguments to a hook that otherwise had none without having to worry
+%    about compatibility.  This means that, for example:
+%\begin{verbatim}
+%    \AddToHook{test}{\def\foo#1{Hello, #1!}}
+%\end{verbatim}
+%    will define the same macro \cs[no-index]{foo} regardless if the
+%    hook \hook{test} takes arguments or not.
+%
+%    Using \cs{AddToHookWithArguments} allows the \meta{code} added to
+%    access the arguments of the hook with \verb|#1|, \verb|#2|, and so
+%    forth, up to the number of the arguments declared in the hook.
+%    This means that if one wants to add a \verb|#|$_6$ to the
+%    \meta{code} that token must be doubled in the input.  The same
+%    definition from above, using \cs{AddToHookWithArguments}, needs to
+%    be rewritten:
+%\begin{verbatim}
+%    \AddToHookWithArguments{test}{\def\foo##1{Hello, ##1!}}
+%\end{verbatim}
+%
+%    Extending the above example to use the hook arguments, we could
+%    rewrite something like (now from declaration to usage, to get the
+%    whole picture):
+%\begin{verbatim}
+%    \NewHookWithArguments{test}{1}
+%    \AddToHookWithArguments{test}{%
+%      \typeout{Defining foo with "#1"}
+%      \def\foo##1{Hello, ##1! Some text after: #1}%
+%    }
+%    \UseHook{test}{Howdy!}
+%    \ShowCommand\foo
+%\end{verbatim}
+%    Running the code above prints in the terminal:
+%\begin{verbatim}
+%    Defining foo with "Howdy!"
+%    > \foo=macro:
+%    #1->Hello, #1! Some text after: Howdy!.
+%\end{verbatim}
+%    Note how \verb|##1| in the call to \cs{AddToHookWithArguments}
+%    became \verb|#1|, and the \verb|#1| was replaced by the argument
+%    passed to the hook.  Should the hook be used again, with a
+%    different argument, the definition would naturally change.
+%
+%    \bigskip
+%
+%    It is possible to add code referencing a hook's arguments before
+%    such hook is declared and the number of hooks is fixed.  However,
+%    if some code is added to the hook, that references more arguments
+%    than will be declared for the hook, there will be a low-level
+%    \TeX{} error about an \enquote{Illegal parameter number} at the
+%    time the hook is declared, which will be hard to track down because
+%    at that point \TeX{} can't know whence the offending code came
+%    from.  Thus it is important that package writers explicitly
+%    document how many arguments (if any) each hook can take, so users
+%    of those packages know how many arguments can be referenced, and
+%    equally important, what each argument means.
+%
 % \subsection{Private \LaTeX{} kernel hooks}
 %
 %    There are a few places where it is absolutely essential for
@@ -1461,7 +1745,7 @@
 %    package/class name if called inside such a file
 %    (see section~\ref{sec:default-label}).
 %
-%    This way one can add further code to the hook using
+%    This way one can add code to the hook using
 %    \cs{AddToHook} or \cs{AtBeginDocument} using a different label
 %    and explicitly order the code chunks as necessary, e.g., run some
 %    code before or after another package's code.  When using the
@@ -1746,10 +2030,10 @@
 %
 % \subsection{Hooks provided by \cs{end}\texttt{\{document\}}}
 %
-%    \LaTeXe{} always provided \cs{AtEndDocument} to add code to the
-%    execution of \verb=\end{document}= just in front of the code that
+%    \LaTeXe{} has always provided \cs{AtEndDocument} to add code to the
+%    \verb=\end{document}=, just in front of the code that
 %    is normally executed there. While this was a big improvement over
-%    the situation in \LaTeX\,2.09 it was not flexible enough for a
+%    the situation in \LaTeX\,2.09, it was not flexible enough for a
 %    number of use cases and so packages, such as \pkg{etoolbox},
 %    \pkg{atveryend} and others patched \cs{enddocument} to add
 %    additional points where code could be hooked into.
@@ -2095,7 +2379,27 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}[int]{\tl_gremove_once:Nx,\tl_show:x,\tl_log:x}
+% \begin{macro}{\c_@@_empty_tl}
+% \begin{macro}{\c_@@_nine_parameters_tl}
+%   An empty token list, and one containing nine parameters.
+% \changes{v1.1a}{2023/04/06}
+%         {Add auxiliary token lists (hook-args).}
+%    \begin{macrocode}
+\tl_const:Nn \c_@@_empty_tl { }
+\tl_const:Nn \c_@@_nine_parameters_tl { #1#2#3#4#5#6#7#8#9 }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}[int]{
+%     \tl_gremove_once:Nx,
+%     \tl_show:x,
+%     \tl_log:x,
+%     \tl_set:Ne,
+%     \cs_replacement_spec:c,
+%     \prop_put:Nne,
+%     \str_count:e
+%   }
 %   Some variants of \pkg{expl3} functions.
 %   \fmiinline{should probably be moved to expl3}
 %    \begin{macrocode}
@@ -2102,6 +2406,10 @@
 \cs_generate_variant:Nn \tl_gremove_once:Nn { Nx }
 \cs_generate_variant:Nn \tl_show:n { x }
 \cs_generate_variant:Nn \tl_log:n { x }
+\cs_generate_variant:Nn \tl_set:Nn { Ne }
+\cs_generate_variant:Nn \cs_replacement_spec:N { c }
+\cs_generate_variant:Nn \prop_put:Nnn { Nne }
+\cs_generate_variant:Nn \str_count:n { e }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -2112,15 +2420,20 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\@@_clean_to_scan:w}
+% \begin{macro}{
+%     \@@_use_none_delimit_by_s_mark:w,
+%     \@@_use_i_delimit_by_s_mark:nw
+%   }
 %   Removes tokens until the next \cs{s_@@_mark}.
+% \changes{v1.1a}{2023/04/06}
+%         {Use standard naming scheme (hook-args).}
 %    \begin{macrocode}
-\cs_new:Npn \@@_clean_to_scan:w #1 \s_@@_mark { }
+\cs_new:Npn \@@_use_none_delimit_by_s_mark:w #1 \s_@@_mark { }
+\cs_new:Npn \@@_use_i_delimit_by_s_mark:nw #1 #2 \s_@@_mark {#1}
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\@@_tl_set:Nn,\@@_tl_set:Nx,
-%               \@@_tl_set:cn,\@@_tl_set:cx}
+% \begin{macro}{\@@_tl_set:cn}
 %   Private copies of a few \pkg{expl3} functions.  \pkg{l3debug} will
 %   only add debugging to the public names, not to these copies, so we
 %   don't have to use \cs{debug_suspend:} and \cs{debug_resume:}
@@ -2130,44 +2443,43 @@
 %   copied because in \pkg{expl3} they use
 %   \cs[no-index]{__kernel_tl_(g)set:Nx}, which is also patched by
 %   \pkg{l3debug}.
-%   \changes{v1.0h}{2021/01/07}{Manually define some \pkg{l3tl} commands
+% \changes{v1.0h}{2021/01/07}{Manually define some \pkg{l3tl} commands
 %     to work around \pkg{expl3} changes}
+% \changes{v1.1a}{2023/04/06}
+%         {Clean-up unused variants (hook-args).}
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_tl_set:Nn #1#2
-  { \cs_set_nopar:Npx #1 { \__kernel_exp_not:w {#2} } }
-\cs_new_protected:Npn \@@_tl_set:Nx #1#2
-  { \cs_set_nopar:Npx #1 {#2} }
-\cs_generate_variant:Nn \@@_tl_set:Nn { c }
-\cs_generate_variant:Nn \@@_tl_set:Nx { c }
+\cs_new_protected:Npn \@@_tl_set:cn #1#2
+  { \cs_set_nopar:cpx {#1} { \__kernel_exp_not:w {#2} } }
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\@@_tl_gset:Nn,\@@_tl_gset:No,\@@_tl_gset:Nx,
+% \begin{macro}{\@@_tl_gset:Nn,\@@_tl_gset:Nx,
 %               \@@_tl_gset:cn,\@@_tl_gset:co,\@@_tl_gset:cx}
 %   Same as above.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_tl_gset:Nn #1#2
   { \cs_gset_nopar:Npx #1 { \__kernel_exp_not:w {#2} } }
-\cs_new_protected:Npn \@@_tl_gset:No #1#2
-  { \cs_gset_nopar:Npx #1 { \__kernel_exp_not:w \exp_after:wN {#2} } }
 \cs_new_protected:Npn \@@_tl_gset:Nx #1#2
   { \cs_gset_nopar:Npx #1 {#2} }
-\cs_generate_variant:Nn \@@_tl_gset:Nn { c }
-\cs_generate_variant:Nn \@@_tl_gset:No { c }
+\cs_generate_variant:Nn \@@_tl_gset:Nn { c, co }
 \cs_generate_variant:Nn \@@_tl_gset:Nx { c }
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\@@_tl_gput_right:Nn,\@@_tl_gput_right:No,\@@_tl_gput_right:cn}
+% \begin{macro}{
+%     \@@_tl_gput_right:Nn,
+%     \@@_tl_gput_right:Ne,
+%     \@@_tl_gput_right:cn,
+%   }
 %   Same as above.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_tl_gput_right:Nn #1#2
   { \@@_tl_gset:Nx #1 { \__kernel_exp_not:w \exp_after:wN { #1 #2 } } }
-\cs_generate_variant:Nn \@@_tl_gput_right:Nn { No, cn }
+\cs_generate_variant:Nn \@@_tl_gput_right:Nn { Ne, cn }
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\@@_tl_gput_left:Nn,\@@_tl_gput_left:No}
+% \begin{macro}{\@@_tl_gput_left:Nn}
 %   Same as above.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_tl_gput_left:Nn #1#2
@@ -2175,7 +2487,6 @@
     \@@_tl_gset:Nx #1
       { \__kernel_exp_not:w {#2} \__kernel_exp_not:w \exp_after:wN {#1} }
   }
-\cs_generate_variant:Nn \@@_tl_gput_left:Nn { No }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -2202,7 +2513,11 @@
 %
 % \DescribeMacro{\g_@@_\meta{hook}_code_prop}
 % \DescribeMacro{\@@\textvisiblespace\meta{hook}}
+% \DescribeMacro{\g_@@_\meta{hook}_reversed_tl}
+% \DescribeMacro{\g_@@_\meta{hook}_declared_tl}
+% \DescribeMacro{\g_@@_\meta{hook}_parameter_tl}
 % \DescribeMacro{\@@_next\textvisiblespace\meta{hook}}
+% \DescribeMacro{\@@_toplevel\textvisiblespace\meta{hook}}
 %    Hooks have a name (called \meta{hook} in the description below)
 %    and for each hook we have to
 %    provide a number of data structures. These are
@@ -2232,12 +2547,17 @@
 %    so that it can be identified.  The |-| character is used because
 %    $\meta{reversed}1$ is $+1$ for normal hooks and $-1$ for reversed
 %    ones.
-
+%
 %    \item[{\cs[no-index]{g_@@_\meta{hook}_declared_tl}}] This token
-%    list serves as marker for the hook being officially declared. Its
+%    list serves as a marker for the hook being officially declared. Its
 %    existence is tested to raise an error in case another declaration
 %    is attempted.
 %
+%    \item[{\cs[no-index]{c_@@_\meta{hook}_parameter_tl}}] This token
+%    list stores the parameter text for a declared hook (its existence
+%    almost completely intersects the token list above), which is used
+%    for managing hooks with arguments.
+%
 %    \item[\cs{@@_toplevel\textvisiblespace\meta{hook}}] This token list stores the code
 %    inserted in the hook from the user's document, in the |top-level|
 %    label.  This label is special, and doesn't participate in sorting.
@@ -2367,17 +2687,27 @@
 % \subsubsection{Setting hooks up}
 %
 %
-%  \begin{macro}{\hook_new:n,\@@_new:n}
+%  \begin{macro}{
+%    \hook_new:n,
+%    \hook_new_with_args:nn
+%  }
+%  \begin{macro}{@@_new:nn}
 %    The \cs{hook_new:n} declaration declares a new hook and expects
 %    the hook \meta{name} as its argument, e.g.,
 %    \hook{begindocument}.
+% \changes{v1.1a}{2023/04/06}
+%         {Add \cs{hook_new_with_args:nn} (hook-args).}
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\hook_new_with_args:nn}
+%<latexrelease>                 {Hooks~with~args}
 \cs_new_protected:Npn \hook_new:n #1
-  { \@@_normalize_hook_args:Nn \@@_new:n {#1} }
+  { \@@_normalize_hook_args:Nn \@@_new:nn {#1} { 0 } }
+\cs_new_protected:Npn \hook_new_with_args:nn #1 #2
+  { \@@_normalize_hook_args:Nn \@@_new:nn {#1} {#2} }
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_new:n #1
+\cs_new_protected:Npn \@@_new:nn #1 #2
   {
 %    \end{macrocode}
 %   We check if the hook was already \emph{explicitly} declared with
@@ -2384,28 +2714,65 @@
 %   \cs{hook_new:n}, and if it already exists we complain, otherwise set
 %   the \enquote{created} flag for the hook so that it errors next time
 %   \cs{hook_new:n} is used.
+% \changes{v1.1d}{2023/05/21}
+%         {Changes to allow support arguments in cmd hooks (cmd-args).}
 %    \begin{macrocode}
     \@@_if_declared:nTF {#1}
       { \msg_error:nnn { hooks } { exists } {#1} }
       {
         \tl_new:c { g_@@_#1_declared_tl }
-        \@@_make_usable:n {#1}
+        \cs_undefine:c { @@~#1 }
+        \cs_undefine:c { c_@@_#1_parameter_tl }
+        \@@_make_usable:nn {#1} {#2}
+%    \end{macrocode}
+%   In case there is already code in a hook, but it's undeclared, run
+%   \cs{@@_update_hook_code:n} to make it ready to be executed (see test
+%   \texttt{lthooks-034}).
+% \changes{v1.1a}{2023/04/06}
+%         {Update hook code after declaring.}
+%    \begin{macrocode}
+        \@@_update_hook_code:n {#1}
       }
   }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 % \end{macro}
 %
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\hook_new_with_args:nn}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_gset_protected:Npn \hook_new:n #1
+%<latexrelease>  { \@@_normalize_hook_args:Nn \@@_new:n {#1} }
+%<latexrelease>\cs_undefine:N \@@_new:nn
+%<latexrelease>\cs_gset_protected:Npn \@@_new:n #1
+%<latexrelease>  {
+%<latexrelease>    \@@_if_declared:nTF {#1}
+%<latexrelease>      { \msg_error:nnn { hooks } { exists } {#1} }
+%<latexrelease>      {
+%<latexrelease>        \tl_new:c { g_@@_#1_declared_tl }
+%<latexrelease>        \@@_make_usable:n {#1}
+%<latexrelease>      }
+%<latexrelease>  }
+%<latexrelease>\cs_gset_protected:Npn \hook_new_with_args:nn #1 { }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+% \end{macro}
 %
 %
-%  \begin{macro}{\@@_make_usable:n}
 %
+%  \begin{macro}{\@@_make_usable:nn}
+%
 %    This initializes all hook data structures for the hook but if
 %    used on its own doesn't mark the hook as declared (as
 %    \cs{hook_new:n} does, so a later \cs{hook_new:n} on that hook will
 %    not result in an error.  This command is internally used by
-%    \cs{hook_gput_code:n} when adding code to a generic hook.
+%    \cs{hook_gput_code:nnn} when adding code to a generic hook.
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_make_usable:n #1
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_make_usable:nn}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new_protected:Npn \@@_make_usable:nn #1 #2
   {
 %    \end{macrocode}
 %   Now we check if the hook's data structure can be safely created
@@ -2414,29 +2781,70 @@
 %   allocate the necessary data structures for the new hook,
 %   otherwise just do nothing.
 %    \begin{macrocode}
-    \tl_if_exist:cF { @@~#1 }
+    \@@_if_usable:nF {#1}
       {
         \seq_gput_right:Nn \g_@@_all_seq {#1}
 %    \end{macrocode}
+%    Here we'll define the \cs[no-index]{c_@@_\meta{hook}_parameter_tl}
+%    to hold a run of parameters up to the number of arguments of the
+%    hook (\verb|#2|).
+%    \begin{macrocode}
+        \__kernel_cs_parm_from_arg_count:nnF
+          { \tl_const:cn { c_@@_#1_parameter_tl } } {#2}
+          {
+            \msg_error:nnnn { hooks } { too-many-args } {#1} {#2}
+            \tl_const:cx { c_@@_#1_parameter_tl }
+              { \exp_not:V \c_@@_nine_parameters_tl }
+          }
+%    \end{macrocode}
+%    After that, use \cs{@@_normalise_cs_args:nn} to correct the number
+%    of parameters of the macros
+%    \cs[no-index]{@@_toplevel\textvisiblespace\meta{hook}} and
+%    \cs[no-index]{@@_next\textvisiblespace\meta{hook}}.  We need to be
+%    able to add
+%    code with arguments to a hook without prior knowledge of the number
+%    of arguments of that hook, so \pkg{lthooks} assumes~9 until the
+%    hook is properly declared and the number of arguments is known.
+%    \cs{@@_normalise_cs_args:nn} does the normalisation by using the
+%    \cs[no-index]{c_@@_\meta{hook}_parameter_tl} defined just above.
+%    \begin{macrocode}
+        \@@_normalise_cs_args:nn { _toplevel } {#1}
+        \@@_normalise_cs_args:nn { _next } {#1}
+%    \end{macrocode}
 %    This is only used by the actual code of the current hook, so
 %    declare it normally:
 %    \begin{macrocode}
-        \tl_new:c { @@~#1 }
+        \@@_code_gset:nn {#1} { }
 %    \end{macrocode}
 %    Now ensure that the base data structure for the hook exists:
 %    \begin{macrocode}
         \@@_init_structure:n {#1}
 %    \end{macrocode}
+%    The call to \cs{@@_normalise_code_pool:n} will correct any improper
+%    reference to arguments that don't exist in the hook, raising a
+%    low-level \TeX{} error and doubling the offending parameter tokens.
+%    It has to be done after \cs{@@_init_structure:n} because it
+%    operates on \cs[no-index]{g_@@_\meta{hook}_code_prop}.
+%    \begin{macrocode}
+        \@@_normalise_code_pool:n {#1}
+%    \end{macrocode}
 %    The \cs{g_@@_\meta{hook}_labels_clist} holds the sorted list of
 %    labels (once it got sorted). This is used only for debugging.
+%    These are defined conditionally, in case \cs{@@_make_usable:nn}
+%    is being used to redefine a hook.
+% \changes{v1.1d}{2023/05/21}
+%         {Changes to allow support arguments in cmd hooks (cmd-args).}
 %    \begin{macrocode}
-        \clist_new:c { g_@@_#1_labels_clist }
+        \clist_if_exist:cF { g_@@_#1_labels_clist }
+          {
+            \clist_new:c { g_@@_#1_labels_clist }
 %    \end{macrocode}
 %    Some hooks should reverse the default order of code chunks. To
 %    signal this we have a token list which is empty for normal hooks
 %    and contains a \verb=-= for reversed hooks.
 %    \begin{macrocode}
-        \tl_new:c { g_@@_#1_reversed_tl }
+            \tl_new:c { g_@@_#1_reversed_tl }
+          }
 %    \end{macrocode}
 %    The above is all in L3 convention, but we also provide an
 %    interface to legacy \LaTeXe{} hooks of the form \cs{@...hook},
@@ -2454,11 +2862,30 @@
         \@@_include_legacy_code_chunk:n {#1}
       }
   }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_make_usable:nn}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_undefine:N \@@_make_usable:nn
+%<latexrelease>\cs_gset_protected:Npn \@@_make_usable:n #1
+%<latexrelease>  {
+%<latexrelease>    \tl_if_exist:cF { @@~#1 }
+%<latexrelease>      {
+%<latexrelease>        \seq_gput_right:Nn \g_@@_all_seq {#1}
+%<latexrelease>        \tl_new:c { @@~#1 }
+%<latexrelease>        \@@_init_structure:n {#1}
+%<latexrelease>        \clist_new:c { g_@@_#1_labels_clist }
+%<latexrelease>        \tl_new:c { g_@@_#1_reversed_tl }
+%<latexrelease>        \@@_include_legacy_code_chunk:n {#1}
+%<latexrelease>      }
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
 %  \end{macro}
 %
 %
-%
 % \begin{macro}{\@@_init_structure:n}
 %    This function declares the basic data structures for a hook
 %    without explicit declaring the hook itself.  This is needed to
@@ -2472,50 +2899,125 @@
 %    \cs{@@_init_structure:n} the first time anything is added to it.
 %    Initializing a hook just with \cs{@@_init_structure:n} will not
 %    make it usable with \cs{hook_use:n}.
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_init_structure:n}
+%<latexrelease>                 {Hooks~with~args}
 \cs_new_protected:Npn \@@_init_structure:n #1
   {
     \@@_if_structure_exist:nF {#1}
       {
         \prop_new:c { g_@@_#1_code_prop }
-        \tl_new:c { @@_toplevel~#1 }
-        \tl_new:c { @@_next~#1 }
+        \@@_toplevel_gset:nn {#1} { }
+        \@@_next_gset:nn {#1} { }
       }
   }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_init_structure:n}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_gset_protected:Npn \@@_init_structure:n #1
+%<latexrelease>  {
+%<latexrelease>    \@@_if_structure_exist:nF {#1}
+%<latexrelease>      {
+%<latexrelease>        \prop_new:c { g_@@_#1_code_prop }
+%<latexrelease>        \tl_new:c { @@_toplevel~#1 }
+%<latexrelease>        \tl_new:c { @@_next~#1 }
+%<latexrelease>      }
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
 %  \end{macro}
 %
+%  \begin{macro}{
+%    \hook_new_reversed:n,
+%    \hook_new_reversed_with_args:nn
+%  }
+%  \begin{macro}{\@@_new_reversed:nn}
 %
-%
-%  \begin{macro}{\hook_new_reversed:n,\@@_new_reversed:n}
-%
 %    Declare a new hook. The default ordering of code chunks is
 %    reversed, signaled by setting the token list to a minus sign.
+% \changes{v1.1a}{2023/04/06}
+%         {Add \cs{hook_new_reversed_with_args:nn} (hook-args).}
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\hook_new_reversed_with_args:nn}
+%<latexrelease>                 {Hooks~with~args}
 \cs_new_protected:Npn \hook_new_reversed:n #1
-  { \@@_normalize_hook_args:Nn \@@_new_reversed:n {#1} }
-\cs_new_protected:Npn \@@_new_reversed:n #1
+  { \@@_normalize_hook_args:Nn \@@_new_reversed:nn {#1} { 0 } }
+\cs_new_protected:Npn \hook_new_reversed_with_args:nn #1 #2
+  { \@@_normalize_hook_args:Nn \@@_new_reversed:nn {#1} {#2} }
+\cs_new_protected:Npn \@@_new_reversed:nn #1 #2
   {
-    \@@_new:n {#1}
+    \@@_if_declared:nTF {#1}
+      { \msg_error:nnn { hooks } { exists } {#1} }
+      {
+        \@@_new:nn {#1} {#2}
+        \tl_gset:cn { g_@@_#1_reversed_tl } { - }
+      }
+  }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
-%    If the hook already exists the above will generate an error
-%    message, so the next line should be executed (but it is --- too
-%    bad).
+%
 %    \begin{macrocode}
-    \tl_gset:cn { g_@@_#1_reversed_tl } { - }
-  }
+%<latexrelease>\IncludeInRelease{2020/10/01}{\hook_new_reversed_with_args:nn}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_gset_protected:Npn \hook_new_reversed:n #1
+%<latexrelease>  { \@@_normalize_hook_args:Nn \@@_new_reversed:n {#1} }
+%<latexrelease>\cs_undefine:N \@@_new_reversed:nn
+%<latexrelease>\cs_gset_protected:Npn \@@_new_reversed:n #1
+%<latexrelease>  {
+%<latexrelease>    \@@_new:n {#1}
+%<latexrelease>    \tl_gset:cn { g_@@_#1_reversed_tl } { - }
+%<latexrelease>  }
+%<latexrelease>\cs_undefine:N \@@_new_reversed:nn
+%<latexrelease>\cs_gset_protected:Npn \hook_new_reversed_with_args:nn #1 #2 { }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 %  \end{macro}
+%  \end{macro}
 %
-%
-%
-%
-%  \begin{macro}{\hook_new_pair:nn}
+%  \begin{macro}{\hook_new_pair:nn,\hook_new_pair_with_args:nnn}
 %    A shorthand for declaring a normal and a (matching) reversed hook in one go.
+% \changes{v1.1a}{2023/04/06}
+%         {Add \cs{hook_new_pair_with_args:nnn} (hook-args).}
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\hook_new_pair_with_args:nnn}
+%<latexrelease>                 {Hooks~with~args}
 \cs_new_protected:Npn \hook_new_pair:nn #1#2
-  { \hook_new:n {#1} \hook_new_reversed:n {#2} }
+  { \@@_normalize_hook_args:Nnn \@@_new_pair:nnn {#1} {#2} { 0 } }
+\cs_new_protected:Npn \hook_new_pair_with_args:nnn #1#2#3
+  { \@@_normalize_hook_args:Nnn \@@_new_pair:nnn {#1} {#2} {#3} }
+\cs_new_protected:Npn \@@_new_pair:nnn #1 #2 #3
+  {
+    \@@_if_declared:nTF {#1}
+      { \msg_error:nnn { hooks } { exists } {#1} }
+      {
+        \@@_if_declared:nTF {#2}
+          { \msg_error:nnn { hooks } { exists } {#2} }
+          {
+            \@@_new:nn {#1} {#3}
+            \@@_new_reversed:nn {#2} {#3}
+          }
+      }
+  }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\hook_new_pair_with_args:nnn}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_gset_protected:Npn \hook_new_pair:nn #1#2
+%<latexrelease>  {
+%<latexrelease>    \hook_new:n {#1}
+%<latexrelease>    \hook_new_reversed:n {#2}
+%<latexrelease>  }
+%<latexrelease>\cs_gset_protected:Npn \hook_new_pair_with_args:nnn #1#2#3
+%<latexrelease>  { }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
 %  \end{macro}
 %
 %
@@ -2531,6 +3033,8 @@
 %       \textbf{Warning: this support will vanish in future releases!}
 %    \end{quote}
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_include_legacy_code_chunk:n}
+%<latexrelease>                 {Hooks~with~args}
 \cs_new_protected:Npn \@@_include_legacy_code_chunk:n #1
   {
 %    \end{macrocode}
@@ -2538,16 +3042,28 @@
 %    needs to be done.
 %    \begin{macrocode}
     \tl_if_exist:cT { @#1hook }
+      {
 %    \end{macrocode}
 %    Of course if the legacy hook exists but is empty, there is no need
 %    to add anything under \texttt{legacy} the legacy label.
 %    \begin{macrocode}
-      {
         \tl_if_empty:cF { @#1hook }
           {
-            \exp_args:Nnnv \@@_hook_gput_code_do:nnn {#1}
-                                  { legacy } { @#1hook }
 %    \end{macrocode}
+%    Here we set \cs{@@_replacing_args_false:} because no legacy code
+%    will reference hook arguments.
+% \changes{v1.1b}{2023/04/16}
+%         {\cs{@@_replacing_args_false:} in
+%          \cs{@@_include_legacy_code_chunk:n}.}
+%    \begin{macrocode}
+            \@@_replacing_args_false:
+            \use:e
+              {
+                \@@_hook_gput_code_do:nnn {#1} { legacy }
+                  { \exp_not:v { @#1hook } }
+              }
+            \@@_replacing_args_reset:
+%    \end{macrocode}
 %    Once added to the hook, we need to clear it otherwise it might
 %    get added again  later if the hook data gets updated.
 %    \begin{macrocode}
@@ -2555,6 +3071,22 @@
           }
       }
   }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_include_legacy_code_chunk:n}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_gset_protected:Npn \@@_include_legacy_code_chunk:n #1
+%<latexrelease>  {
+%<latexrelease>    \tl_if_exist:cT { @#1hook }
+%<latexrelease>      {
+%<latexrelease>        \tl_if_empty:cF { @#1hook }
+%<latexrelease>          {
+%<latexrelease>            \exp_args:Nnnv \@@_hook_gput_code_do:nnn
+%<latexrelease>              {#1} { legacy } { @#1hook }
+%<latexrelease>            \@@_tl_gclear:c { @#1hook }
+%<latexrelease>          }
+%<latexrelease>      }
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 % \end{macro}
 %
@@ -2579,8 +3111,8 @@
 %    if the hook is disabled.
 %
 %    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2021/06/01}%
-%<latexrelease>         {\hook_disable_generic:n}{Disable~hooks}
+%<latexrelease>\IncludeInRelease{2021/06/01}{\hook_disable_generic:n}
+%<latexrelease>                 {Disable~hooks}
 %    \end{macrocode}
 %
 %    \begin{macrocode}
@@ -2595,7 +3127,7 @@
   {
     \bool_lazy_and:nnTF
         { \tl_if_exist_p:c { g_@@_#1_declared_tl } }
-        { ! \tl_if_exist_p:c { @@~#1 } }
+        { ! \cs_if_exist_p:c { @@~#1 } }
       { \prg_return_true: }
       { \prg_return_false: }
   }
@@ -2603,8 +3135,8 @@
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2020/10/01}
-%<latexrelease>                 {\hook_disable_generic:n}{Disable~hooks}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\hook_disable_generic:n}
+%<latexrelease>                 {Disable~hooks}
 %<latexrelease>
 %<latexrelease>\cs_new_protected:Npn \hook_disable_generic:n #1 {}
 %<latexrelease>
@@ -2619,9 +3151,11 @@
 %    The \cs{hook_activate_generic:n} declaration declares a new hook if it
 %    wasn't declared already, in which case it only checks that the
 %    already existing hook is not a reversed hook.
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
 %    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2021/06/01}%
-%<latexrelease>         {\hook_activate_generic:n}{Providing~hooks}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\hook_activate_generic:n}
+%<latexrelease>                 {Providing~hooks}
 %    \end{macrocode}
 %
 %    \begin{macrocode}
@@ -2646,7 +3180,7 @@
         \@@_if_declared:nF {#1}
           {
             \tl_new:c { g_@@_#1_declared_tl }
-            \@@_make_usable:n {#1}
+            \@@_make_usable:nn {#1} { 0 }
             \tl_gset:cx { g_@@_#1_reversed_tl }
               { \@@_if_generic_reversed:nT {#1} { - } }
 %    \end{macrocode}
@@ -2660,8 +3194,6 @@
       }
   }
 %    \end{macrocode}
-% \end{macro}
-% \end{macro}
 %
 %    \begin{macrocode}
 %<latexrelease>\EndIncludeInRelease
@@ -2668,15 +3200,36 @@
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2020/10/01}
-%<latexrelease>                 {\hook_activate_generic:n}{Providing~hooks}
-%<latexrelease>
-%<latexrelease>\cs_new_protected:Npn \hook_activate_generic:n #1 {}
-%<latexrelease>
+%<latexrelease>\IncludeInRelease{2021/06/01}{\hook_activate_generic:n}
+%<latexrelease>                 {Providing~hooks}
+%<latexrelease>\cs_gset_protected:Npn \@@_activate_generic:nn #1 #2
+%<latexrelease>  {
+%<latexrelease>    \@@_if_disabled:nTF {#1}
+%<latexrelease>      { \msg_warning:nnn { hooks } { activate-disabled } {#1} }
+%<latexrelease>      {
+%<latexrelease>        \@@_if_declared:nF {#1}
+%<latexrelease>          {
+%<latexrelease>            \tl_new:c { g_@@_#1_declared_tl }
+%<latexrelease>            \@@_make_usable:n {#1}
+%<latexrelease>            \tl_gset:cx { g_@@_#1_reversed_tl }
+%<latexrelease>              { \@@_if_generic_reversed:nT {#1} { - } }
+%<latexrelease>            \@@_update_hook_code:n {#1}
+%<latexrelease>          }
+%<latexrelease>      }
+%<latexrelease>  }
 %<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 %
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\hook_activate_generic:n}
+%<latexrelease>                 {Providing~hooks}
+%<latexrelease>\cs_gset_protected:Npn \hook_activate_generic:n #1 { }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
 %
+%
 % \subsection{Parsing a label}
 %
 % \begin{macro}[EXP]{\@@_parse_label_default:n}
@@ -2965,47 +3518,92 @@
 %
 % \subsection{Adding or removing hook code}
 %
-% \begin{macro}{\hook_gput_code:nnn}
-% \begin{macro}{\@@_gput_code:nnn,\@@_hook_gput_code_do:nnn}
+% \begin{macro}{\hook_gput_code:nnn,\hook_gput_code_with_args:nnn}
+% \begin{macro}{
+%     \@@_gput_code:nnn,
+%     \@@_gput_code_store:nnn,
+%     \@@_hook_gput_code_do:nnn,
+%     \@@_prop_gput_labeled_cleanup:nnn,
+%     \@@_prop_gput_labeled_do:Nnnn
+%    }
 %
 %    With \cs{hook_gput_code:nnn}\Arg{hook}\Arg{label}\Arg{code} a
 %    chunk of \meta{code} is added to an existing \meta{hook} labeled
 %    with \meta{label}.
 % \changes{v1.0o}{2021/07/22}{Do not queue removals (gh/625)}
+% \changes{v1.1a}{2023/04/06}
+%         {Add \cs{hook_gput_code_with_args:nnn} (hook-args).}
 %    \begin{macrocode}
-\cs_new_protected:Npn \hook_gput_code:nnn #1 #2
-  { \@@_normalize_hook_args:Nnn \@@_gput_code:nnn {#1} {#2} }
+%<latexrelease>\IncludeInRelease{2023/06/01}{\hook_gput_code_with_args:nnn}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new_protected:Npn \hook_gput_code:nnn #1 #2 #3
+  {
+    \@@_replacing_args_false:
+    \@@_normalize_hook_args:Nnn \@@_gput_code:nnn {#1} {#2} {#3}
+    \@@_replacing_args_reset:
+  }
+\cs_new_protected:Npn \hook_gput_code_with_args:nnn #1 #2 #3
+  {
+    \@@_replacing_args_true:
+    \@@_normalize_hook_args:Nnn \@@_gput_code:nnn {#1} {#2} {#3}
+    \@@_replacing_args_reset:
+  }
 %    \end{macrocode}
 %
+%   If \cs{AddToHookWithArguments} was used, do some sanity checking,
+%   and if it's not possible to use arguments at this point, fall back
+%   to regular \cs{AddToHook} by using \cs{@@_replacing_args_false:}.
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_gput_code:nnn #1 #2 #3
   {
+    \@@_chk_args_allowed:nn {#1} { AddToHook }
 %    \end{macrocode}
-%   First check if the code should be executed immediately, rather than
+%   Then check if the code should be executed immediately, rather than
 %   stored:
 % \changes{v1.0r}{2021/09/06}{Use dedicated conditional (gh/606)}
 %    \begin{macrocode}
     \@@_if_execute_immediately:nTF {#1}
-      {#3}
       {
 %    \end{macrocode}
+%   \cs{AddToHookWithArguments} can't be used on one-time hooks (that
+%   were already used).
+%    \begin{macrocode}
+        \@@_if_replacing_args:TF
+          {
+            \msg_error:nnnn { hooks } { one-time-args }
+              {#1} { AddToHook }
+          }
+          { }
+        \use:n
+      }
+      { \@@_gput_code_store:nnn {#1} {#2} }
+          {#3}
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_gput_code_store:nnn #1 #2 #3
+  {
+%    \end{macrocode}
 %    Then check if the hook is usable.
 %    \begin{macrocode}
-        \@@_if_usable:nTF {#1}
+    \@@_if_usable:nTF {#1}
 %    \end{macrocode}
 %    If so we simply add (or append) the new code to the property list
 %    holding different chunks for the hook. At \verb=\begin{document}=
 %    this is then sorted into a token list for fast execution.
 %    \begin{macrocode}
-          {
-            \@@_hook_gput_code_do:nnn {#1} {#2} {#3}
+      {
+        \@@_hook_gput_code_do:nnn {#1} {#2} {#3}
 %    \end{macrocode}
 %    However, if there is an update within the document we need to alter
 %    this execution code which is done by
 %    \cs{@@_update_hook_code:n}. In the preamble this does nothing.
 %    \begin{macrocode}
-            \@@_update_hook_code:n {#1}
-          }
+        \@@_update_hook_code:n {#1}
+      }
 %    \end{macrocode}
 %
 %    If the hook is not usable, before giving up, check if it's not
@@ -3012,16 +3610,17 @@
 %    disabled and otherwise try to declare it as a generic hook, if its
 %    name matches one of the valid patterns.
 %    \begin{macrocode}
-          {
-            \@@_if_disabled:nTF {#1}
-              { \msg_error:nnn { hooks } { hook-disabled } {#1} }
-              { \@@_try_declaring_generic_hook:nnn {#1} {#2} {#3} }
-          }
+      {
+        \@@_if_disabled:nTF {#1}
+          { \msg_error:nnn { hooks } { hook-disabled } {#1} }
+          { \@@_try_declaring_generic_hook:nnn {#1} {#2} {#3} }
       }
   }
 %    \end{macrocode}
 %
 %    This macro will unconditionally add a chunk of code to the given hook.
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_hook_gput_code_do:nnn #1 #2 #3
   {
@@ -3046,31 +3645,161 @@
         \str_if_eq:eeTF { top-level } { \@@_currname_or_default: }
           {
 %    \end{macrocode}
-%    If the hook's basic structure does not exist, we need to declare it
-%    with \cs{@@_init_structure:n}.
+%   If the hook's basic structure does not exist, we need to declare it
+%   with \cs{@@_init_structure:n}.
 %    \begin{macrocode}
             \@@_init_structure:n {#1}
-            \@@_tl_gput_right:cn { @@_toplevel~#1 } {#3}
+%    \end{macrocode}
+%   Then append to the \verb|_toplevel| container for the hook.
+%    \begin{macrocode}
+            \@@_cs_gput_right:nnn { _toplevel } {#1} {#3}
           }
           { \msg_error:nnn { hooks } { misused-top-level } {#1} }
       }
       {
-        \prop_get:cnNTF { g_@@_#1_code_prop } {#2} \l_@@_return_tl
+%    \end{macrocode}
+%   When adding to the code pool, we have to double hashes if
+%   \cs{AddToHook} was used (\verb|replacing_args| is false), so that
+%   later it is turned into a single parameter token, rather than a
+%   parameter to the hook macro.
+%    \begin{macrocode}
+        \exp_args:Nx \@@_prop_gput_labeled_cleanup:nnn
           {
-            \prop_gput:cno { g_@@_#1_code_prop } {#2}
-              { \l_@@_return_tl #3 }
+            \@@_if_replacing_args:TF
+              { \exp_not:n }
+              { \@@_double_hashes:n }
+                {#3}
           }
-          { \prop_gput:cnn { g_@@_#1_code_prop } {#2} {#3} }
+          {#1} {#2}
       }
   }
 %    \end{macrocode}
+%
+%   Adds code to a hook's code pool.
+% \changes{v1.1a}{2023/04/06}
+%         {Macro added (hook-args).}
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_prop_gput_labeled_cleanup:nnn #1 #2 #3
+  {
+    \tl_set:Nn \l_@@_return_tl {#1}
+    \@@_if_replacing_args:TF
+      {
+        \@@_if_usable:nT {#2}
+          {
+            \@@_set_normalise_fn:nn {#2}
+              { Invalid~code~added~\msg_line_context: }
+            \@@_normalise_fn:nn {#3} {#1}
+            \prop_get:NnN \l_@@_work_prop {#3} \l_@@_return_tl
+          }
+      }
+      { }
+    \exp_args:NcV \@@_prop_gput_labeled_do:Nnn
+      { g_@@_#2_code_prop } \l_@@_return_tl {#3}
+  }
+\cs_new_protected:Npn \@@_prop_gput_labeled_do:Nnn #1 #2 #3
+  {
+    \prop_get:NnNTF #1 {#3} \l_@@_return_tl
+      { \prop_gput:Nno #1 {#3} { \l_@@_return_tl #2 } }
+      { \prop_gput:Nnn #1 {#3} {#2} }
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\hook_gput_code:nnn}
+%<latexrelease>                 {Providing~hooks}
+%<latexrelease>\cs_gset_protected:Npn \hook_gput_code:nnn #1 #2
+%<latexrelease>  { \@@_normalize_hook_args:Nnn \@@_gput_code:nnn {#1} {#2} }
+%<latexrelease>\cs_gset_protected:Npn \@@_gput_code:nnn #1 #2 #3
+%<latexrelease>  {
+%<latexrelease>    \@@_if_execute_immediately:nTF {#1}
+%<latexrelease>      {#3}
+%<latexrelease>      {
+%<latexrelease>        \@@_if_usable:nTF {#1}
+%<latexrelease>          {
+%<latexrelease>            \@@_hook_gput_code_do:nnn {#1} {#2} {#3}
+%<latexrelease>            \@@_update_hook_code:n {#1}
+%<latexrelease>          }
+%<latexrelease>          {
+%<latexrelease>            \@@_if_disabled:nTF {#1}
+%<latexrelease>              { \msg_error:nnn { hooks } { hook-disabled } {#1} }
+%<latexrelease>              { \@@_try_declaring_generic_hook:nnn {#1} {#2} {#3} }
+%<latexrelease>          }
+%<latexrelease>      }
+%<latexrelease>  }
+%<latexrelease>\cs_gset_protected:Npn \@@_hook_gput_code_do:nnn #1 #2 #3
+%<latexrelease>  {
+%<latexrelease>    \@@_debug:n{\iow_term:x{****~ Add~ to~
+%<latexrelease>                      \@@_if_usable:nF {#1} { undeclared~ }
+%<latexrelease>                      hook~ #1~ (#2)
+%<latexrelease>                      \on at line\space <-~ \tl_to_str:n{#3}} }
+%<latexrelease>    \str_if_eq:nnTF {#2} { top-level }
+%<latexrelease>      {
+%<latexrelease>        \str_if_eq:eeTF { top-level } { \@@_currname_or_default: }
+%<latexrelease>          {
+%<latexrelease>            \@@_init_structure:n {#1}
+%<latexrelease>            \@@_tl_gput_right:cn { @@_toplevel~#1 } {#3}
+%<latexrelease>          }
+%<latexrelease>          { \msg_error:nnn { hooks } { misused-top-level } {#1} }
+%<latexrelease>      }
+%<latexrelease>      {
+%<latexrelease>        \prop_get:cnNTF { g_@@_#1_code_prop } {#2} \l_@@_return_tl
+%<latexrelease>          {
+%<latexrelease>            \prop_gput:cno { g_@@_#1_code_prop } {#2}
+%<latexrelease>              { \l_@@_return_tl #3 }
+%<latexrelease>          }
+%<latexrelease>          { \prop_gput:cnn { g_@@_#1_code_prop } {#2} {#3} }
+%<latexrelease>      }
+%<latexrelease>  }
+%<latexrelease>\cs_gset_protected:Npn \hook_gput_code_with_args:nnn #1#2#3 { }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
 % \end{macro}
 % \end{macro}
 %
+% \begin{macro}{\@@_chk_args_allowed:nn}
+%   This macro checks if it is possible to add code with references to
+%   a hook's arguments for hook \verb|#1|.  It only does something if
+%   the function being run is \verb|replacing_args|.  This macro will
+%   error if the hook is declared and takes no arguments, then it will
+%   set \cs{@@_replacing_args_false:} so that the macro which called it
+%   will add the code normally.
+% \changes{v1.1a}{2023/04/06}
+%         {Macro added (hook-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_chk_args_allowed:nn}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new_protected:Npn \@@_chk_args_allowed:nn #1 #2
+  {
+    \@@_if_replacing_args:TF
+      {
+        \@@_if_declared:nT {#1}
+          { \tl_if_empty:cT { c_@@_#1_parameter_tl } { \use_ii:nn } }
+        \use_none:n
+          {
+            \msg_error:nnnn { hooks } { without-args } {#1} {#2}
+            \@@_replacing_args_false:
+          }
+      }
+      { }
+  }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_chk_args_allowed:nn}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_undefine:N \@@_chk_args_allowed:nn
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\@@_gput_undeclared_hook:nnn}
 %   Often it may happen that a package $A$ defines a hook \verb=foo=,
 %   but package $B$, that adds code to that hook, is loaded before $A$.
 %   In such case we need to add code to the hook before its declared.
+%   An implicitly declared hook doesn't have arguments (in principle),
+%   so use \cs{c_false_bool} here.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_gput_undeclared_hook:nnn #1 #2 #3
   {
@@ -3098,13 +3827,15 @@
 %   \cs{hook_gput_next_code:nn} if the generic hook was declared, or
 %   to \cs{@@_gput_next_do:nn} otherwise.
 % \changes{v1.0p}{2021/08/25}{Standardise generic hook names (gh/648)}
+% \changes{v1.1d}{2023/05/21}
+%         {Changes to allow support arguments in cmd hooks (cmd-args).}
 %    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2021/11/15}{\@@_try_declaring_generic_hook:nnn}
-%<latexrelease>                 {Standardise~generic~hook~names}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_try_declaring_generic_hook:nnn}
+%<latexrelease>                 {Hooks~with~args}
 \cs_new_protected:Npn \@@_try_declaring_generic_hook:nnn #1
   {
     \@@_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1}
-      \hook_gput_code:nnn
+      \@@_gput_code:nnn
       \@@_gput_undeclared_hook:nnn
         {#1}
   }
@@ -3111,11 +3842,28 @@
 \cs_new_protected:Npn \@@_try_declaring_generic_next_hook:nn #1
   {
     \@@_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1}
-      \hook_gput_next_code:nn
+      \@@_gput_next_code:nn
       \@@_gput_next_do:nn
         {#1}
   }
 %<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2021/11/15}{\@@_try_declaring_generic_hook:nnn}
+%<latexrelease>                 {Standardise~generic~hook~names}
+%<latexrelease>\cs_gset_protected:Npn \@@_try_declaring_generic_hook:nnn #1
+%<latexrelease>  {
+%<latexrelease>    \@@_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1}
+%<latexrelease>      \hook_gput_code:nnn
+%<latexrelease>      \@@_gput_undeclared_hook:nnn
+%<latexrelease>        {#1}
+%<latexrelease>  }
+%<latexrelease>\cs_gset_protected:Npn \@@_try_declaring_generic_next_hook:nn #1
+%<latexrelease>  {
+%<latexrelease>    \@@_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1}
+%<latexrelease>      \hook_gput_next_code:nn
+%<latexrelease>      \@@_gput_next_do:nn
+%<latexrelease>        {#1}
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
 %<latexrelease>\IncludeInRelease{2020/10/01}{\@@_try_declaring_generic_hook:nnn}
 %<latexrelease>                 {Standardise~generic~hook~names}
 %<latexrelease>\cs_new_protected:Npn \@@_try_declaring_generic_hook:nnn #1
@@ -3170,9 +3918,11 @@
 % \end{macro}
 %
 % \begin{macro}[TF]{\@@_try_declaring_generic_hook:wn}
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
 %    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2021/11/15}{\@@_try_declaring_generic_hook:wn}%
-%<latexrelease>                 {Standardise~generic~hook~names}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_try_declaring_generic_hook:wn}
+%<latexrelease>                 {Hooks~with~args}
 \prg_new_protected_conditional:Npnn \@@_try_declaring_generic_hook:wn
     #1 / #2 / #3 / #4 \scan_stop: #5 { TF }
   {
@@ -3188,18 +3938,25 @@
 %    For some commands this will not be possible, in which case
 %    \cs{@@_patch_cmd_or_delay:Nnn} (defined in \texttt{ltcmdhooks})
 %    will generate an appropriate error message.
+% \changes{v1.1d}{2023/05/21}
+%         {Changes to allow support arguments in cmd hooks (cmd-args).}
 %    \begin{macrocode}
             \str_if_eq:nnT {#1} { cmd }
-              { \@@_try_put_cmd_hook:n {#5} }
+              {
+                \@@_try_put_cmd_hook:n {#5}
+                \@@_make_usable:nn {#5} { 9 }
+                \use_none:nnn
+              }
 %    \end{macrocode}
 %
 %    Declare the hook always even if it can't really be used (error
 %    message generated elsewhere).
 %
-%    Here we use \cs{@@_make_usable:n}, so that a \cs{hook_new:n} is still
-%    possible later.
+%    Here we use \cs{@@_make_usable:nn}, so that a \cs{hook_new:n} is
+%    still possible later.  Generic hooks (except \hook{cmd} hooks) take
+%    no arguments, so use zero as the second argument.
 %    \begin{macrocode}
-            \@@_make_usable:n {#5}
+            \@@_make_usable:nn {#5} { 0 }
           }
         \@@_if_generic_reversed:nT {#5}
           { \tl_gset:cn { g_@@_#5_reversed_tl } { - } }
@@ -3285,6 +4042,37 @@
 % \end{macro}
 %
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2021/11/15}{\@@_try_declaring_generic_hook:wn}
+%<latexrelease>                 {Standardise~generic~hook~names}
+%<latexrelease>\prg_new_protected_conditional:Npnn \@@_try_declaring_generic_hook:wn
+%<latexrelease>    #1 / #2 / #3 / #4 \scan_stop: #5 { TF }
+%<latexrelease>  {
+%<latexrelease>    \@@_if_generic:nTF {#5}
+%<latexrelease>      {
+%<latexrelease>        \@@_if_usable:nF {#5}
+%<latexrelease>          {
+%<latexrelease>            \str_if_eq:nnT {#1} { cmd }
+%<latexrelease>              { \@@_try_put_cmd_hook:n {#5} }
+%<latexrelease>            \@@_make_usable:n {#5}
+%<latexrelease>          }
+%<latexrelease>        \@@_if_generic_reversed:nT {#5}
+%<latexrelease>          { \tl_gset:cn { g_@@_#5_reversed_tl } { - } }
+%<latexrelease>        \prg_return_true:
+%<latexrelease>      }
+%<latexrelease>      {
+%<latexrelease>        \@@_if_deprecated_generic:nTF {#5}
+%<latexrelease>          {
+%<latexrelease>            \@@_deprecated_generic_warn:n {#5}
+%<latexrelease>            \exp_after:wN \@@_declare_deprecated_generic:NNn
+%<latexrelease>            \exp:w % \exp_end:
+%<latexrelease>          }
+%<latexrelease>          { \prg_return_false: }
+%<latexrelease>      }
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 %<latexrelease>\IncludeInRelease{2021/06/01}{\@@_try_declaring_generic_hook:wn}
 %<latexrelease>                 {Support~cmd~hooks}
 %<latexrelease>\prg_new_protected_conditional:Npnn \@@_try_declaring_generic_hook:wn
@@ -3316,7 +4104,7 @@
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_try_declaring_generic_hook:wn}%
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_try_declaring_generic_hook:wn}
 %<latexrelease>                 {Support~cmd~hooks}
 %<latexrelease>\prg_new_protected_conditional:Npnn \@@_try_declaring_generic_hook:wn
 %<latexrelease>    #1 / #2 / #3 / #4 \scan_stop: #5 { TF }
@@ -3338,7 +4126,6 @@
 %<latexrelease>          { \prg_return_false: }
 %<latexrelease>      }
 %<latexrelease>  }
-%<latexrelease>
 %<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 % \end{macro}
@@ -3350,24 +4137,10 @@
 %   |file/foo.tex/before|).  If it is a file-specific hook, then it
 %   executes the \meta{true} branch, otherwise \meta{false}.
 %    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2021/11/15}{\@@_if_file_hook:w}%
+%<latexrelease>\IncludeInRelease{2021/11/15}{\@@_if_file_hook:w}
 %<latexrelease>                 {Standardise~generic~hook~names}
-\prg_new_conditional:Npnn \@@_if_file_hook:w
-    #1 / #2 \s_@@_mark #3 { TF }
-  {
-    \@@_if_generic:nTF {#3}
-      {
-        \str_if_eq:nnTF {#1} { file }
-          { \prg_return_true: }
-          { \prg_return_false: }
-      }
-      { \prg_return_false: }
-  }
 %<latexrelease>\EndIncludeInRelease
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_if_file_hook:w}%
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_if_file_hook:w}
 %<latexrelease>                 {Standardise~generic~hook~names}
 %<latexrelease>\prg_new_conditional:Npnn \@@_if_file_hook:w
 %<latexrelease>    #1 / #2 / #3 \s_@@_mark { TF }
@@ -3394,7 +4167,7 @@
 % \begin{macro}[EXP]{\@@_strip_double_slash:n,\@@_strip_double_slash:w}
 %
 %    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2021/11/15}{\@@_file_hook_normalize:n}%
+%<latexrelease>\IncludeInRelease{2021/11/15}{\@@_file_hook_normalize:n}
 %<latexrelease>                 {Standardise~generic~hook~names}
 %<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
@@ -3406,7 +4179,7 @@
 %   like \verb|\def\input at path{{./mypath/}}|, in which case a hook would
 %   have to be \verb|\AddToHook{file/./mypath//file.tex/after}|.
 %    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_file_hook_normalize:n}%
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_file_hook_normalize:n}
 %<latexrelease>                 {Standardise~generic~hook~names}
 %<latexrelease>\cs_new:Npn \@@_file_hook_normalize:n #1
 %<latexrelease>  { \@@_strip_double_slash:n {#1} }
@@ -3453,7 +4226,7 @@
 %      The generic hooks used when loading a file
 %    \end{description}
 %    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2021/11/15}{\c_@@_generics_prop}%
+%<latexrelease>\IncludeInRelease{2021/11/15}{\c_@@_generics_prop}
 %<latexrelease>                 {Standardise~generic~hook~names}
 \clist_map_inline:nn { cmd , env , file , package , class , include }
   {
@@ -3482,7 +4255,7 @@
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2020/10/01}{\c_@@_generics_prop}%
+%<latexrelease>\IncludeInRelease{2020/10/01}{\c_@@_generics_prop}
 %<latexrelease>                 {Standardise~generic~hook~names}
 %<latexrelease>\prop_const_from_keyval:Nn \c_@@_generics_prop
 %<latexrelease>     {cmd=,env=,file=,package=,class=,include=}
@@ -3496,13 +4269,13 @@
 %    The following generic hooks are supposed to use reverse ordering
 %    (the |ii| and |iii| names are kept for the deprecation cycle):
 %    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2021/11/15}{\c_@@_generics_reversed_ii_prop}%
+%<latexrelease>\IncludeInRelease{2021/11/15}{\c_@@_generics_reversed_ii_prop}
 %<latexrelease>                 {Standardise~generic~hook~names}
 %<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2020/10/01}{\c_@@_generics_reversed_ii_prop}%
+%<latexrelease>\IncludeInRelease{2020/10/01}{\c_@@_generics_reversed_ii_prop}
 %<latexrelease>                 {Standardise~generic~hook~names}
 %<latexrelease>\prop_const_from_keyval:Nn \c_@@_generics_reversed_ii_prop {after=,end=}
 %<latexrelease>\prop_const_from_keyval:Nn \c_@@_generics_reversed_iii_prop {after=}
@@ -3511,6 +4284,35 @@
 %    \end{macrocode}
 %  \end{macro}
 %
+%
+% \begin{macro}{
+%     \c_@@_parameter_cmd/./before_tl,\c_@@_parameter_cmd/./after_tl,
+%   }
+%   Token lists defining the number of arguments for a given type of
+%   generic hook.
+% \changes{v1.1d}{2023/05/21}
+%         {Token lists added (cmd-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\c_@@_parameter_cmd/./before_tl}
+%<latexrelease>                 {Hooks~with~args}
+%    \end{macrocode}
+%
+%   \hook{cmd} hooks are declared with 9 arguments because they have a
+%   variable number of arguments (depending on the command they are
+%   attached to), so we use the maximum here.
+%    \begin{macrocode}
+\tl_const:cn { c_@@_parameter_cmd/./before_tl } { #1#2#3#4#5#6#7#8#9 }
+\tl_const:cn { c_@@_parameter_cmd/./after_tl }  { #1#2#3#4#5#6#7#8#9 }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\c_@@_parameter_cmd/./before_tl}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%  \end{macro}
+%
 % \begin{macro}{\hook_gremove_code:nn}
 % \begin{macro}{\@@_gremove_code:nn}
 %
@@ -3517,7 +4319,11 @@
 %    With \cs{hook_gremove_code:nn}\Arg{hook}\Arg{label} any code
 %    for \meta{hook} stored under \meta{label} is removed.
 % \changes{v1.0o}{2021/07/22}{Do not queue removals (gh/625)}
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\hook_gremove_code:nn}
+%<latexrelease>                 {Hooks~with~args}
 \cs_new_protected:Npn \hook_gremove_code:nn #1 #2
   { \@@_normalize_hook_args:Nnn \@@_gremove_code:nn {#1} {#2} }
 \cs_new_protected:Npn \@@_gremove_code:nn #1 #2
@@ -3542,8 +4348,8 @@
         \str_if_eq:nnTF {#2} {*}
           {
             \prop_gclear:c { g_@@_#1_code_prop }
-            \@@_tl_gclear:c { @@_toplevel~#1 }
-            \@@_tl_gclear:c { @@_next~#1 }
+            \@@_toplevel_gset:nn {#1} { }
+            \@@_next_gset:nn {#1} { }
           }
           {
 %    \end{macrocode}
@@ -3551,7 +4357,7 @@
 %    there is under the same label.
 %    \begin{macrocode}
             \str_if_eq:nnTF {#2} { top-level }
-              { \@@_tl_gclear:c { @@_toplevel~#1 } }
+              { \@@_toplevel_gset:nn {#1} { } }
               {
                 \prop_gpop:cnNF { g_@@_#1_code_prop } {#2} \l_@@_return_tl
                   { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} }
@@ -3576,14 +4382,542 @@
           { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} }
       }
   }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\hook_gremove_code:nn}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_new_protected:Npn \@@_gremove_code:nn #1 #2
+%<latexrelease>  {
+%<latexrelease>    \@@_if_structure_exist:nTF {#1}
+%<latexrelease>      {
+%<latexrelease>        \str_if_eq:nnTF {#2} {*}
+%<latexrelease>          {
+%<latexrelease>            \prop_gclear:c { g_@@_#1_code_prop }
+%<latexrelease>            \@@_tl_gclear:c { @@_toplevel~#1 }
+%<latexrelease>            \@@_tl_gclear:c { @@_next~#1 }
+%<latexrelease>          }
+%<latexrelease>          {
+%<latexrelease>            \str_if_eq:nnTF {#2} { top-level }
+%<latexrelease>              { \@@_tl_gclear:c { @@_toplevel~#1 } }
+%<latexrelease>              {
+%<latexrelease>                \prop_gpop:cnNF { g_@@_#1_code_prop } {#2} \l_@@_return_tl
+%<latexrelease>                  { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} }
+%<latexrelease>              }
+%<latexrelease>          }
+%<latexrelease>        \@@_if_usable:nT {#1}
+%<latexrelease>          { \@@_update_hook_code:n {#1} }
+%<latexrelease>      }
+%<latexrelease>      {
+%<latexrelease>        \@@_if_deprecated_generic:nTF {#1}
+%<latexrelease>          {
+%<latexrelease>            \@@_deprecated_generic_warn:n {#1}
+%<latexrelease>            \@@_do_deprecated_generic:Nn \@@_gremove_code:nn {#1} {#2}
+%<latexrelease>          }
+%<latexrelease>          { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} }
+%<latexrelease>      }
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
 % \end{macro}
 % \end{macro}
 %
+% \begin{macro}{\@@_cs_gput_right:nnn}
+% \begin{macro}{\@@_code_gset_auxi:nnnn,\@@_code_gset_auxi:eeen}
+%   This macro is used to append code to the \verb|toplevel| and
+%   \verb|next| token lists, trating them correctly depending on their
+%   number of arguments, and depending if the code being added should
+%   have parameter tokens understood as parameters, or doubled to be
+%   stored as parameter tokens.
+% \changes{v1.1a}{2023/04/06}
+%         {Macro added (hook-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_cs_gput_right:nnn}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new_protected:Npn \@@_cs_gput_right:nnn #1 #2 #3
+  {
+%    \end{macrocode}
+%   The auxiliary \cs{@@_code_gset_auxi:eeen} just does the assignment
+%   at the end.  Its first argument is the parameter text of the macro,
+%   which is chosen here depending if
+%   \cs[no-index]{c_@@_\meta{hook}_parameter_tl} exists, if the hook is
+%   declared, and if it's a generic hook.
+%    \begin{macrocode}
+    \cs_if_exist:cF { @@#1~#2 }
+      { \@@_code_gset_aux:nnn {#1} {#2} { } }
+    \@@_code_gset_auxi:eeen
+      {
+        \@@_if_declared:nTF {#2}
+          { \tl_use:c { c_@@_#2_parameter_tl } }
+          {
+            \@@_if_generic:nTF {#2}
+              { \@@_generic_parameter:n {#2} }
+              { \c_@@_nine_parameters_tl }
+          }
+      }
+%    \end{macrocode}
+%   Here we take the existing code in the macro, expand it with as many
+%   arguments as it takes, then double the hashes so the code can be
+%   reused. \pho{Maybe can be improved. The case of adding to an empty
+%     cs can be optimised by quickly checking \cs{cs_replacement_spec}.}
+%    \begin{macrocode}
+      {
+        \exp_args:NNo \exp_args:No \@@_double_hashes:n
+          {
+            \cs:w @@#1~#2 \exp_last_unbraced:Ne \cs_end:
+              { \@@_braced_cs_parameter:n { @@#1~#2 } }
+          }
+      }
+%    \end{macrocode}
+%   Now the new code:  if we are replacing arguments, then hashes are
+%   left untouched, otherwise they are doubled.
+%    \begin{macrocode}
+      {
+        \@@_if_replacing_args:TF
+          { \exp_not:n }
+          { \@@_double_hashes:n }
+            {#3}
+      }
+%    \end{macrocode}
+%   And finally, the csname which we'll define with all the above.
+%    \begin{macrocode}
+      { @@#1~#2 }
+  }
+%    \end{macrocode}
+%
+%   And as promised, the auxiliary that does the definition.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_code_gset_auxi:nnnn #1 #2 #3 #4
+  { \cs_gset:cpn {#4} #1 { #2 #3 } }
+\cs_generate_variant:Nn \@@_code_gset_auxi:nnnn { eeen }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_cs_gput_right:nnn}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_undefine:N \@@_cs_gput_right:nnn
+%<latexrelease>\cs_undefine:N \@@_code_gset_auxi:nnnn
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
 % \begin{macro}{
+%     \@@_code_gset:nn,\@@_code_gset:ne,
+%     \@@_toplevel_gset:nn,
+%     \@@_next_gset:nn,
+%     \@@_code_gset_aux:nnn
+%   }
+%   These macros define
+%   \cs[no-index]{@@\meta{type}\textvisiblespace\meta{hook}} (with
+%   \meta{type} being \verb|_next|, \verb|_toplevel|, or empty) with the
+%   given code and the parameters stored in
+%   \cs[no-index]{c_@@_\meta{hook}_parameter_tl} (or none, if that
+%   doesn't exist).
+% \changes{v1.1a}{2023/04/06}
+%         {Macro added (hook-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_code_gset:nn}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new_protected:Npn \@@_code_gset:nn
+  { \@@_code_gset_aux:nnn { } }
+\cs_new_protected:Npn \@@_toplevel_gset:nn
+  { \@@_code_gset_aux:nnn { _toplevel } }
+\cs_new_protected:Npn \@@_next_gset:nn
+  { \@@_code_gset_aux:nnn { _next } }
+\cs_new_protected:Npn \@@_code_gset_aux:nnn #1 #2 #3
+  {
+    \cs_gset:cpn { @@#1~#2 \exp_last_unbraced:Ne }
+      { \@@_parameter:n {#2} }
+      {#3}
+  }
+\cs_generate_variant:Nn \@@_code_gset:nn { ne }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_code_gset:nn}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_undefine:N \@@_code_gset:nn
+%<latexrelease>\cs_undefine:N \@@_toplevel_gset:nn
+%<latexrelease>\cs_undefine:N \@@_next_gset:nn
+%<latexrelease>\cs_undefine:N \@@_code_gset_aux:nnn
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_normalise_cs_args:nn}
+%   This macro normalises the parameters of the macros
+%   \cs[no-index]{@@\meta{type}\textvisiblespace\meta{hook}} to take the
+%   right number of arguments after a hook is declared.  At this point
+%   we know \cs[no-index]{c_@@_\meta{hook}_parameter_tl} exists, so use
+%   that to count the arguments and use that as \meta{parameter text}
+%   for the newly (re)defined macro.
+% \changes{v1.1a}{2023/04/06}
+%         {Macro added (hook-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_normalise_cs_args:nn}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new_protected:Npn \@@_normalise_cs_args:nn #1 #2
+  {
+    \cs_if_exist:cT { @@#1~#2 }
+      {
+        \@@_code_gset_auxi:eeen
+          { \tl_use:c { c_@@_#2_parameter_tl } }
+          {
+            \exp_args:NNo \exp_args:No \@@_double_hashes:n
+              {
+                \cs:w @@#1~#2 \exp_last_unbraced:Ne \cs_end:
+                  { \@@_braced_cs_parameter:n { @@#1~#2 } }
+              }
+          }
+          { }
+          { @@#1~#2 }
+      }
+  }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_normalise_cs_args:nn}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_undefine:N \@@_normalise_cs_args:nn
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_normalise_code_pool:n}
+% \begin{macro}{\@@_set_normalise_fn:nn}
+%   This one's a bit of a hack.  It takes a hook, and iterates over its
+%   code pool (\cs[no-index]{g_@@_\meta{hook}_code_prop}), redefining
+%   each code label to use only valid arguments.  This is used when, for
+%   example, a code is added referencing arguments \verb|#1| and
+%   \verb|#2|, but the hook has only \verb|#1|.  In this example, every
+%   reference to \verb|#2| is changed to \verb|##2|.  This is done
+%   because otherwise \TeX{} will throw a low-level error every time
+%   some change happens to the hook (code is added, a rule is set, etc),
+%   which can get quite repetitive for no good reason.
+% \changes{v1.1a}{2023/04/06}
+%         {Macro added (hook-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_normalise_code_pool:n}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new_protected:Npn \@@_normalise_code_pool:n #1
+  {
+%    \end{macrocode}
+%   First, call \cs{@@_set_normalise_fn:nn} with the hook name to set
+%   everything up, then we'll loop over the
+%   hook's code pool applying the normalisation above.  After that's
+%   done, copy the temporary property list back to the hook's.
+%    \begin{macrocode}
+    \@@_set_normalise_fn:nn {#1} { Offending~label:~'##1' }
+    \prop_clear:N \l_@@_work_prop
+    \prop_map_function:cN { g_@@_#1_code_prop } \@@_normalise_fn:nn
+    \prop_gset_eq:cN { g_@@_#1_code_prop } \l_@@_work_prop
+  }
+%    \end{macrocode}
+%
+%   The sole purpose of this function is to define
+%   \cs{@@_normalise_fn:nn}, which will then do the correcting of the
+%   code being added to the hook.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_set_normalise_fn:nn #1 #2
+  {
+%    \end{macrocode}
+%   To start, we define two auxiliary token lists.
+%   \cs[no-index]{l_@@_tmpb_tl} contains:
+%\begin{verbatim}
+%   {\c__hook_hashes_tl 1}
+%   {\c__hook_hashes_tl 2}
+%   ...
+%   {\c__hook_hashes_tl 9}
+%\end{verbatim}
+%    \begin{macrocode}
+    \cs_set:Npn \@@_tmp:w ##1##2##3##4##5##6##7##8##9 { }
+    \tl_set:Ne \l_@@_tmpb_tl
+      { \@@_braced_cs_parameter:n { @@_tmp:w } }
+    \group_begin:
+      \@@_tl_set:cn { c_@@_hash_tl } { \exp_not:N \c_@@_hashes_tl }
+      \use:e
+        {
+    \group_end:
+    \tl_set:Nn \exp_not:N \l_@@_tmpb_tl { \l_@@_tmpb_tl }
+        }
+%    \end{macrocode}
+%   And \cs[no-index]{l_@@_tmpa_tl} contains:
+%\begin{verbatim}
+%   {\c__hook_hash_tl 1}
+%   {\c__hook_hash_tl 2}
+%   ...
+%   {\c__hook_hash_tl <n>}
+%\end{verbatim}
+%   with \meta{n} being the number of arguments declared for the hook.
+%    \begin{macrocode}
+    \exp_last_unbraced:NNf
+    \cs_set:Npn \@@_tmp:w { \@@_parameter:n {#1} } { }
+    \tl_set:Ne \l_@@_tmpa_tl { \@@_braced_cs_parameter:n { @@_tmp:w } }
+%    \end{macrocode}
+%   Now this function does the fun part.  It is meant to be used with
+%   \cs{prop_map_function:NN}, taking a label name in \verb|##1| and the
+%   code stored in that label in \verb|##2|.
+%    \begin{macrocode}
+    \cs_gset_protected:Npx \@@_normalise_fn:nn ##1 ##2
+      {
+%    \end{macrocode}
+%   Here we'll define two auxiliary macros:  the first one throws an
+%   error when it detects an invalid argument reference.  It piggybacks
+%   on \TeX's low-level \enquote{Illegal parameter number} error, but it
+%   defines a weirdly-named control sequence so that the error comes out
+%   nicely formatted.  For example, if the label \enquote{badpkg} adds
+%   some code that references argument \verb|#3| in the hook
+%   \enquote{foo}, which takes only two arguments, the error will be:
+%\begin{verbatim}
+%   ! Illegal parameter number in definition of hook 'foo'.
+%   (hooks)             Offending label: 'badpkg'.
+%   <to be read again> 
+%                      3
+%\end{verbatim}
+%   At the point of this definition, the error is raised if the code
+%   happens to reference an invalid argument.  If it was possible to
+%   detect that this definition raised no error, the next step would be
+%   unnecessary.  We'll do all this in a group so this weird definition
+%   doesn't leak out, and set \cs{tex_escapechar:D} to $-1$ so this hack
+%   shows up extra nice in the case of an error.
+%    \begin{macrocode}
+        \group_begin:
+          \int_set:Nn \tex_escapechar:D { -1 }
+          \cs_set:cpn
+              {
+                hook~'#1'. ^^J
+                (hooks) \prg_replicate:nn { 13 } { ~ }
+                #2 % more message text
+              }
+              \exp_not:v { c_@@_#1_parameter_tl }
+            {##2}
+        \group_end:
+%    \end{macrocode}
+%   This next macro, with a much less fabulous name, takes always nine
+%   arguments, and it just transfers the code \verb|##2| under the label
+%   \verb|##1| to the temporary property list.  The first \meta{n}
+%   arguments are taken from \cs[no-index]{l_@@_tmpa_tl}, and the other
+%   $9-\meta{n}$ taken from \cs[no-index]{l_@@_tmpb_tl} (which contains
+%   twice as many \verb|#| tokens as the former).  Then,
+%   \cs{@@_double_hashes:n} is used to double non-argument hashes, and
+%   expand the \cs{c_@@_hash_tl} and \cs{c_@@_hashes_tl} to the actual
+%   parameter tokens.
+%    \begin{macrocode}
+        \cs_set:Npn \exp_not:N \@@_tmp:w
+            \exp_not:V \c_@@_nine_parameters_tl
+          {
+            \prop_put:Nne \exp_not:N \l_@@_work_prop
+              {##1} { \exp_not:N \@@_double_hashes:n {##2} }
+          }
+%    \end{macrocode}
+%   This next macro, with a much less fabulous name, takes always nine
+%   arguments, and it just transfers the code \verb|##2| under the label
+%   \verb|##1| to the temporary property list.  The first \meta{n}
+%   arguments are taken from \cs[no-index]{l_@@_tmpa_tl}, and the other
+%   $9-\meta{n}$ taken from \cs[no-index]{l_@@_tmpb_tl} (which contains
+%   twice as many \verb|#| tokens as the former).  Then,
+%   \cs{@@_double_hashes:n} is used to double non-argument hashes, and
+%   expand the \cs{c_@@_hash_tl} and \cs{c_@@_hashes_tl} to the actual
+%   parameter tokens.
+%    \begin{macrocode}
+        \exp_not:N \@@_tmp:w
+          \exp_not:V \l_@@_tmpa_tl
+          \exp_args:No \exp_not:o
+            { \exp_after:wN \@@_tmp:w \l_@@_tmpb_tl }
+      }
+  }
+\cs_new_eq:NN \@@_normalise_fn:nn ?
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_normalise_code_pool:n}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_undefine:N \@@_normalise_code_pool:n
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[pTF]{\@@_cs_if_empty:c}
+%   Check if the expansion of a control sequence is empty by looking at
+%   its replacement text.
+% \changes{v1.1a}{2023/04/06}
+%         {Macro added (hook-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_cs_if_empty:c}
+%<latexrelease>                 {Hooks~with~args}
+\prg_new_conditional:Npnn \@@_cs_if_empty:c #1 { p, T, F, TF }
+  {
+    \if:w \scan_stop: \@@_replacement_spec:c {#1} \scan_stop:
+      \prg_return_true:
+    \else:
+      \prg_return_false:
+    \fi:
+  }
+\cs_new:Npn \@@_replacement_spec:c #1
+  {
+    \exp_args:Nc \token_if_macro:NT {#1}
+      { \cs_replacement_spec:c {#1} }
+  }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_cs_if_empty:c}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_undefine:N \@@_cs_if_empty:c
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@@_braced_cs_parameter:n}
+% \begin{macro}{\@@_braced_hidden_loop:w}
+% \begin{macro}{\@@_cs_parameter_count:N}
+% \begin{macro}{\@@_cs_parameter_count:w,\@@_cs_end:w}
+%   Looks at the \meta{parameter text} of a control sequence, and
+%   returns a run of \enquote{hidden} braced parameters for that macro.
+%   This works as long as the macros take a simple run of zero to nine
+%   arguments.  The parameters are \enquote{hidden} because the
+%   parameter tokens are returned inside \cs{c_@@_hash_tl} instead of
+%   explicitly, so that \cs{@@_double_hashes:n} won't touch these.
+% \changes{v1.1a}{2023/04/06}
+%         {Macro added (hook-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_braced_cs_parameter:n}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new:Npn \@@_braced_cs_parameter:n #1
+  {
+    \exp_last_unbraced:Ne \@@_braced_hidden_loop:w
+      { \exp_args:Nc \@@_cs_parameter_count:N {#1} } ? \s_@@_mark
+  }
+\cs_new:Npn \@@_braced_hidden_loop:w #1
+  {
+    \if:w ? #1
+      \@@_use_i_delimit_by_s_mark:nw
+    \fi:
+    { \exp_not:N \c_@@_hash_tl #1 }
+    \@@_braced_hidden_loop:w
+  }
+\cs_new:Npn \@@_cs_parameter_count:N #1
+  {
+    \exp_last_unbraced:Nf \@@_cs_parameter_count:w
+      { \token_if_macro:NT #1 { \cs_parameter_spec:N #1 } }
+      ? \@@_cs_end:w ? \@@_cs_end:w ? \@@_cs_end:w
+      ? \@@_cs_end:w ? \@@_cs_end:w ? \@@_cs_end:w
+      ? \@@_cs_end:w ? \@@_cs_end:w ? \@@_cs_end:w
+      \s_@@_mark
+  }
+\cs_new:Npn \@@_cs_parameter_count:w #1#2 #3#4 #5#6 #7#8
+  { #2 #4 #6 #8 \@@_cs_parameter_count:w }
+\cs_new:Npn \@@_cs_end:w #1 \s_@@_mark { }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%
+%   This function can't be undefined when rolling back because it's used
+%   at the end of this module to adequate the hook data structures to
+%   previous versions.
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_braced_cs_parameter:n}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@@_braced_parameter:n}
+% \begin{macro}{\@@_braced_real_loop:w}
+%   This one is used in simpler cases, where no special handling of
+%   hashes is required.  This is used only inside
+%   \cs{@@_initialize_hook_code:n}, so it assumes
+%   \cs[no-index]{c_@@_\meta{hook}_parameter_tl} is defined, but should
+%   work otherwise.
+% \changes{v1.1a}{2023/04/06}
+%         {Macro added (hook-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_braced_parameter:n}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new:Npn \@@_braced_parameter:n #1
+  {
+    \if_case:w
+      \int_eval:n
+        { \exp_args:Nv \str_count:n { c_@@_#1_parameter_tl } / 3 }
+      \exp_stop_f:
+    \or: {##1}
+    \or: {##1} {##2}
+    \or: {##1} {##2} {##3}
+    \or: {##1} {##2} {##3} {##4}
+    \or: {##1} {##2} {##3} {##4} {##5}
+    \or: {##1} {##2} {##3} {##4} {##5} {##6}
+    \or: {##1} {##2} {##3} {##4} {##5} {##6} {##7}
+    \or: {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8}
+    \or: {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8} {##9}
+    \else:
+      \msg_expandable_error:nnn { latex2e } { should-not-happen }
+        { Invalid~parameter~spec. }
+    \fi:
+  }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_braced_parameter:n}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_undefine:N \@@_braced_parameter:n
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@@_parameter:n}
+%   This is just a shortcut to \verb|e|- or \verb|f|-expand to the
+%   \meta{parameter text} of the hook.
+% \changes{v1.1a}{2023/04/06}
+%         {Macro added (hook-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_parameter:n}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new:Npn \@@_parameter:n #1
+  {
+    \cs:w c_@@_
+    \tl_if_exist:cTF { c_@@_#1_parameter_tl }
+      { #1_parameter } { empty }
+    _tl \cs_end:
+  }
+\cs_new:Npn \@@_generic_parameter:n #1
+  { \@@_generic_parameter:w #1 / / / \s_@@_mark }
+\cs_new:Npn \@@_generic_parameter:w #1 / #2 / #3 / #4 \s_@@_mark
+  {
+    \cs_if_exist_use:cF { c_@@_parameter_#1/./#3_tl }
+      { \c_@@_empty_tl }
+  }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_parameter:n}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_undefine:N \@@_parameter:n
+%<latexrelease>\cs_undefine:N \@@_generic_parameter:n
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%  \subsection{Setting rules for hooks code}
+%
+% \begin{macro}{
 %     \g_@@_??_code_prop,
 %     \@@~??,
 %     \g_@@_??_reversed_tl,
+%     \c_@@_??_parameter_tl,
 %   }
 %
 %    Initially these variables simply used an empty ``label'' name (not
@@ -3597,11 +4931,11 @@
 %    lot, the code should be fast, so this is not done with \texttt{c}
 %    expansion in the code later on.
 %
-%    \cs{@@\textvisiblespace??} isn't used, but it has to be defined to trick
-%    the code into thinking that \texttt{??} is actually a hook.
+%    \cs{@@\textvisiblespace??} isn't used, but it has to be defined to
+%    trick the code into thinking that \texttt{??} is actually a hook.
 %    \begin{macrocode}
-\prop_new:c {g_@@_??_code_prop}
-\prop_new:c {@@~??}
+\prop_new:c { g_@@_??_code_prop }
+\prop_new:c { @@~?? }
 %    \end{macrocode}
 %
 %    Default rules are always given in normal ordering (never in
@@ -3610,12 +4944,24 @@
 %    \texttt{after} becomes \texttt{before})
 %    because those rules are applied first and then the order is reversed.
 %    \begin{macrocode}
-\tl_new:c {g_@@_??_reversed_tl}
+\tl_new:c { g_@@_??_reversed_tl }
 %    \end{macrocode}
+%
+%    The parameter text for the \enquote{default} hook is empty.
+% \changes{v1.1a}{2023/04/06}
+%         {Token list added (hook-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\c_@@_??_parameter_tl}
+%<latexrelease>                 {Hooks~with~args}
+\tl_const:cn { c_@@_??_parameter_tl } { }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\c_@@_??_parameter_tl}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_undefine:c { c_@@_??_parameter_tl }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
 %  \end{macro}
 %
-%  \subsection{Setting rules for hooks code}
-%
 %  \begin{macro}{\hook_gset_rule:nnnn}
 %  \begin{macro}{\@@_gset_rule:nnnn}
 %    With
@@ -3645,13 +4991,13 @@
         \@@_deprecated_generic_warn:n {#1}
         \@@_do_deprecated_generic:Nn \@@_gset_rule:nnnn {#1}
           {#2} {#3} {#4}
-        \@@_clean_to_scan:w
+        \@@_use_none_delimit_by_s_mark:w
       }
     \@@_if_execute_immediately:nT {#1}
       {
         \msg_error:nnnnnn { hooks } { rule-too-late }
           {#1} {#2} {#3} {#4}
-        \@@_clean_to_scan:w
+        \@@_use_none_delimit_by_s_mark:w
       }
 %    \end{macrocode}
 %    First we ensure the basic data structure of the hook exists:
@@ -3840,9 +5186,14 @@
 %  \begin{macro}{\@@_initialize_all:}
 %    Initialize all known hooks (at \verb=\begin{document}=), i.e.,
 %    update the fast execution token lists to hold the necessary code
-%    in the right  order.
+%    in the right order.
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_initialize_all: {
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_initialize_all:}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new_protected:Npn \@@_initialize_all:
+  {
 %    \end{macrocode}
 %    First we change \cs{@@_update_hook_code:n} which so far was a
 %    no-op to now initialize one hook. This way any later updates to
@@ -3849,36 +5200,69 @@
 %    the hook will run that code and also update the execution token
 %    list.
 %    \begin{macrocode}
-  \cs_gset_eq:NN \@@_update_hook_code:n \@@_initialize_hook_code:n
+    \cs_gset_eq:NN \@@_update_hook_code:n \@@_initialize_hook_code:n
 %    \end{macrocode}
 %    Now we loop over all hooks that have been defined and update each
-%    of them.
+%    of them.  Here we have to determine if the hook has arguments so
+%    that auxiliaries know what to do with hashes.  We look at
+%    \cs[no-index]{c_@@_\meta{hook}_parameter_tl}, if it has any
+%    parameters, and set \verb|replacing_args| accordingly.
 %    \begin{macrocode}
-  \@@_debug:n { \prop_gclear:N \g_@@_used_prop }
-  \seq_map_inline:Nn \g_@@_all_seq
+    \@@_debug:n { \prop_gclear:N \g_@@_used_prop }
+    \seq_map_inline:Nn \g_@@_all_seq
       {
+        \tl_if_empty:cTF { c_@@_##1_parameter_tl }
+          { \@@_replacing_args_false: }
+          { \@@_replacing_args_true: }
         \@@_update_hook_code:n {##1}
+        \@@_replacing_args_reset:
       }
 %    \end{macrocode}
 %    If we are debugging we show results hook by hook for all hooks
 %    that have data.
 %    \begin{macrocode}
-  \@@_debug:n
-     { \iow_term:x{^^JAll~ initialized~ (non-empty)~ hooks:}
-       \prop_map_inline:Nn \g_@@_used_prop
-           { \iow_term:x{^^J~ ##1~ ->~
-               \exp_not:v {@@~##1}~ }
-           }
-     }
+    \@@_debug:n
+      {
+        \iow_term:x { ^^J All~initialized~(non-empty)~hooks: }
+        \prop_map_inline:Nn \g_@@_used_prop
+          {
+            \iow_term:x
+              { ^^J ~ ##1 ~ -> ~ \cs_replacement_spec:c { @@~##1 } ~ }
+          }
+      }
 %    \end{macrocode}
 %    After all hooks are initialized we change the ``use'' to just
 %    call the hook code and not initialize it (as it was done in the
 %    preamble.
 %    \begin{macrocode}
-  \cs_gset_eq:NN \hook_use:n \@@_use_initialized:n
-  \cs_gset_eq:NN \@@_preamble_hook:n \use_none:n
-}
+    \@@_post_initialization_defs:
+  }
 %    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_initialize_all:}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_gset_protected:Npn \@@_initialize_all:
+%<latexrelease>  {
+%<latexrelease>    \cs_gset_eq:NN \@@_update_hook_code:n \@@_initialize_hook_code:n
+%<latexrelease>    \@@_debug:n { \prop_gclear:N \g_@@_used_prop }
+%<latexrelease>    \seq_map_inline:Nn \g_@@_all_seq
+%<latexrelease>      { \@@_update_hook_code:n {##1} }
+%<latexrelease>    \@@_debug:n
+%<latexrelease>      {
+%<latexrelease>        \iow_term:x{^^JAll~ initialized~ (non-empty)~ hooks:}
+%<latexrelease>        \prop_map_inline:Nn \g_@@_used_prop
+%<latexrelease>          {
+%<latexrelease>            \iow_term:x
+%<latexrelease>              { ^^J ~ ##1 ~ -> ~ \cs_replacement_spec:c { @@~##1 } ~ }
+%<latexrelease>          }
+%<latexrelease>      }
+%<latexrelease>    \cs_gset_eq:NN \hook_use:n \@@_use_initialized:n
+%<latexrelease>    \cs_gset_eq:NN \@@_preamble_hook:n \use_none:n
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
 %  \end{macro}
 %
 %
@@ -3887,7 +5271,11 @@
 %    the preamble this is selectively done in case a hook gets used
 %    and at \verb=\begin{document}= this is done for all hooks and
 %    afterwards only if the hook code changes.
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_initialize_hook_code:n}
+%<latexrelease>                 {Hooks~with~args}
 \cs_new_protected:Npn \@@_initialize_hook_code:n #1
   {
     \@@_debug:n
@@ -3915,10 +5303,15 @@
       {
         \prop_if_empty:cTF { g_@@_#1_code_prop }
           {
-            \@@_tl_gset:co { @@~#1 }
+            \@@_code_gset:ne {#1}
               {
-                \cs:w @@_toplevel~#1 \exp_after:wN \cs_end:
-                \cs:w @@_next~#1 \cs_end:
+%    \end{macrocode}
+%   The hook may take arguments, so we add a run of braced parameters
+%   after the \verb|_next| and \verb|_toplevel| macros, so that the
+%   arguments passed to the hook are forwarded to them.
+%    \begin{macrocode}
+                \exp_not:c { @@_toplevel~#1 } \@@_braced_parameter:n {#1}
+                \exp_not:c { @@_next~#1 } \@@_braced_parameter:n {#1}
               }
           }
           {
@@ -3958,7 +5351,43 @@
           }
       }
   }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_initialize_hook_code:n}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_gset_protected:Npn \@@_initialize_hook_code:n #1
+%<latexrelease>  {
+%<latexrelease>    \@@_debug:n
+%<latexrelease>      { \iow_term:x { ^^J Update~code~for~hook~'#1' \on at line :^^J } }
+%<latexrelease>    \@@_include_legacy_code_chunk:n {#1}
+%<latexrelease>    \@@_if_usable:nT {#1}
+%<latexrelease>      {
+%<latexrelease>        \prop_if_empty:cTF { g_@@_#1_code_prop }
+%<latexrelease>          {
+%<latexrelease>            \@@_tl_gset:co { @@~#1 }
+%<latexrelease>              {
+%<latexrelease>                \cs:w @@_toplevel~#1 \exp_after:wN \cs_end:
+%<latexrelease>                \cs:w @@_next~#1 \cs_end:
+%<latexrelease>              }
+%<latexrelease>          }
+%<latexrelease>          {
+%<latexrelease>            \@@_if_reversed:nTF {#1}
+%<latexrelease>              { \cs_set_eq:NN \@@_tl_gput:Nn    \@@_tl_gput_left:Nn
+%<latexrelease>                \cs_set_eq:NN \@@_clist_gput:NV \clist_gput_left:NV  }
+%<latexrelease>              { \cs_set_eq:NN \@@_tl_gput:Nn    \@@_tl_gput_right:Nn
+%<latexrelease>                \cs_set_eq:NN \@@_clist_gput:NV \clist_gput_right:NV }
+%<latexrelease>            \prop_set_eq:Nc \l_@@_work_prop { g_@@_#1_code_prop }
+%<latexrelease>            \@@_initialize_single:ccn
+%<latexrelease>              { @@~#1 } { g_@@_#1_labels_clist } {#1}
+%<latexrelease>            \@@_debug:n
+%<latexrelease>              { \exp_args:NNx \prop_gput:Nnn \g_@@_used_prop {#1} { } }
+%<latexrelease>          }
+%<latexrelease>      }
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
 %  \end{macro}
 %
 %
@@ -4034,7 +5463,12 @@
 %    ^^A #1 <- \@@~#1
 %    ^^A #2 <- \g_@@_#1_labels_clist
 %    ^^A #3 <- #1
+%
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_initialize_single:NNn}
+%<latexrelease>                 {Hooks~with~args}
 \cs_new_protected:Npn \@@_initialize_single:NNn #1#2#3
   {
 %    \end{macrocode}
@@ -4181,16 +5615,104 @@
 %    time execution (\verb=#3=).  These should normally be empty.  The
 %    |top-level| code is added with \cs{@@_tl_gput:Nn} as that might
 %    change for a reversed hook (then |top-level| is the very first code
-%    chunk added).  The |next| code is always added last.
+%    chunk added).  The |next| code is always added last (to the right).
+%   The hook may take arguments, so we add a run of braced parameters
+%   after the \verb|_next| and \verb|_toplevel| macros, so that the
+%   arguments passed to the hook are forwarded to them.
 %    \begin{macrocode}
-    \exp_args:NNo \@@_tl_gput:Nn #1 { \cs:w @@_toplevel~#3 \cs_end: }
-    \@@_tl_gput_right:No #1 { \cs:w @@_next~#3 \cs_end: }
+    \exp_args:NNe \@@_tl_gput:Nn #1
+      { \exp_not:c { @@_toplevel~#3 } \@@_braced_parameter:n {#3} }
+    \@@_tl_gput_right:Ne #1
+      { \exp_not:c { @@_next~#3 } \@@_braced_parameter:n {#3} }
+    \use:e
+      {
+        \cs_gset:cpn { @@~#3 } \use:c { c_@@_#3_parameter_tl }
+          { \exp_not:V #1 }
+      }
   }
 %    \end{macrocode}
 %
 %    \begin{macrocode}
 \cs_generate_variant:Nn \@@_initialize_single:NNn { cc }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_initialize_single:NNn}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_new_protected:Npn \@@_initialize_single:NNn #1#2#3
+%<latexrelease>  {
+%<latexrelease>    \seq_clear:N \l_@@_labels_seq
+%<latexrelease>    \int_zero:N  \l_@@_labels_int
+%<latexrelease>    \tl_set:Nn \l_@@_cur_hook_tl {#3}
+%<latexrelease>    \prop_map_inline:Nn \l_@@_work_prop
+%<latexrelease>       {
+%<latexrelease>         \int_incr:N \l_@@_labels_int
+%<latexrelease>         \seq_put_right:Nn \l_@@_labels_seq {##1}
+%<latexrelease>         \@@_tl_set:cn { \@@_tl_csname:n {##1} } { 0 }
+%<latexrelease>         \seq_clear_new:c { \@@_seq_csname:n {##1} }
+%<latexrelease>       }
+%<latexrelease>    \prop_map_inline:Nn \l_@@_work_prop
+%<latexrelease>      {
+%<latexrelease>        \prop_map_inline:Nn \l_@@_work_prop
+%<latexrelease>          {
+%<latexrelease>            \@@_if_label_case:nnnnn {##1} {####1}
+%<latexrelease>              { \prop_map_break: }
+%<latexrelease>              { \@@_apply_label_pair:nnn {##1} {####1} }
+%<latexrelease>              { \@@_apply_label_pair:nnn {####1} {##1} }
+%<latexrelease>                  {#3}
+%<latexrelease>          }
+%<latexrelease>      }
+%<latexrelease>    \@@_debug:n { \@@_debug_label_data:N \l_@@_work_prop }
+%<latexrelease>    \tl_set:Nn \l_@@_rear_tl { 0 }
+%<latexrelease>    \tl_set:cn { \@@_tl_csname:n { 0 } } { 0 }
+%<latexrelease>    \seq_map_inline:Nn \l_@@_labels_seq
+%<latexrelease>      {
+%<latexrelease>        \int_compare:nNnT { \cs:w \@@_tl_csname:n {##1} \cs_end: } = 0
+%<latexrelease>            {
+%<latexrelease>              \tl_set:cn { \@@_tl_csname:n { \l_@@_rear_tl } }{##1}
+%<latexrelease>              \tl_set:Nn \l_@@_rear_tl {##1}
+%<latexrelease>            }
+%<latexrelease>      }
+%<latexrelease>    \tl_set_eq:Nc \l_@@_front_tl { \@@_tl_csname:n { 0 } }
+%<latexrelease>    \@@_tl_gclear:N #1
+%<latexrelease>    \clist_gclear:N #2
+%<latexrelease>    \bool_while_do:nn { ! \str_if_eq_p:Vn \l_@@_front_tl { 0 } }
+%<latexrelease>      {
+%<latexrelease>        \int_decr:N \l_@@_labels_int
+%<latexrelease>        \prop_get:NVN \l_@@_work_prop \l_@@_front_tl \l_@@_return_tl
+%<latexrelease>        \exp_args:NNV \@@_tl_gput:Nn #1 \l_@@_return_tl
+%<latexrelease>        \@@_clist_gput:NV #2 \l_@@_front_tl
+%<latexrelease>        \@@_debug:n{ \iow_term:x{Handled~ code~ for~ \l_@@_front_tl} }
+%<latexrelease>        \seq_map_inline:cn { \@@_seq_csname:n { \l_@@_front_tl } }
+%<latexrelease>          {
+%<latexrelease>            \tl_set:cx { \@@_tl_csname:n {##1} }
+%<latexrelease>                       { \int_eval:n
+%<latexrelease>                           { \cs:w \@@_tl_csname:n {##1} \cs_end: - 1 }
+%<latexrelease>                       }
+%<latexrelease>            \int_compare:nNnT
+%<latexrelease>                { \cs:w \@@_tl_csname:n {##1} \cs_end: } = 0
+%<latexrelease>                {
+%<latexrelease>                  \tl_set:cn { \@@_tl_csname:n { \l_@@_rear_tl } } {##1}
+%<latexrelease>                  \tl_set:Nn \l_@@_rear_tl            {##1}
+%<latexrelease>                }
+%<latexrelease>          }
+%<latexrelease>        \tl_set_eq:Nc \l_@@_front_tl
+%<latexrelease>                      { \@@_tl_csname:n { \l_@@_front_tl } }
+%<latexrelease>      }
+%<latexrelease>    \int_compare:nNnF \l_@@_labels_int = 0
+%<latexrelease>      {
+%<latexrelease>        \iow_term:x{====================}
+%<latexrelease>        \iow_term:x{Error:~ label~ rules~ are~ incompatible:}
+%<latexrelease>        \@@_debug_label_data:N \l_@@_work_prop
+%<latexrelease>        \iow_term:x{====================}
+%<latexrelease>      }
+%<latexrelease>    \exp_args:NNo \@@_tl_gput:Nn #1 { \cs:w @@_toplevel~#3 \cs_end: }
+%<latexrelease>    \@@_tl_gput_right:No #1 { \cs:w @@_next~#3 \cs_end: }
+%<latexrelease>  }
+%<latexrelease>\cs_generate_variant:Nn \@@_tl_gput_right:Nn { No }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
 %  \end{macro}
 %
 %
@@ -4444,7 +5966,11 @@
   { \@@_log_cmd:x { >~\@spaces #1 } }
 %    \end{macrocode}
 %
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_log:nN}
+%<latexrelease>                 {Hooks~with~args}
 \cs_new_protected:Npn \@@_log:nN #1 #2
   {
     \@@_if_deprecated_generic:nT {#1}
@@ -4455,7 +5981,20 @@
       }
     \@@_preamble_hook:n {#1}
     \@@_log_cmd:x
-      { ^^J ->~The~ \@@_if_generic:nT {#1} { generic~ } hook~'#1': }
+      {
+        ^^J ->~The~
+        \@@_if_generic:nT {#1} { generic~ }
+        hook~'#1'
+        \@@_if_disabled:nF {#1}
+          {
+            \exp_args:Nf \@@_print_args:nn {#1}
+              {
+                \int_eval:n
+                  { \str_count:e { \@@_parameter:n {#1} } / 3 }
+              }
+          }
+        :
+      }
 %    \end{macrocode}
 %
 %    \begin{macrocode}
@@ -4471,7 +6010,12 @@
           { \@@_log_line_indent:x { --- } }
           {
             \prop_map_inline:cn { g_@@_#1_code_prop }
-              { \@@_log_line_indent:x { ##1~->~\tl_to_str:n {##2} } }
+              {
+                \exp_after:wN \cs_set:Npn \exp_after:wN \@@_tmp:w
+                  \c_@@_nine_parameters_tl {##2}
+                \@@_log_line_indent:x
+                  { ##1~->~\cs_replacement_spec:N \@@_tmp:w }
+              }
           }
 %    \end{macrocode}
 %
@@ -4485,9 +6029,9 @@
           }
         \@@_log_line_indent:x
           {
-            \tl_if_empty:cTF { @@_toplevel~#1 }
+            \@@_cs_if_empty:cTF { @@_toplevel~#1 }
               { --- }
-              { -> ~ \exp_args:Nv \tl_to_str:n { @@_toplevel~#1 } }
+              { -> ~ \cs_replacement_spec:c { @@_toplevel~#1 } }
           }
 %    \end{macrocode}
 %
@@ -4495,7 +6039,7 @@
         \@@_log_line:x { Extra~code~for~next~invocation: }
         \@@_log_line_indent:x
           {
-            \tl_if_empty:cTF { @@_next~#1 }
+            \@@_cs_if_empty:cTF { @@_next~#1 }
               { --- }
 %    \end{macrocode}
 %
@@ -4503,7 +6047,10 @@
 %    the first tokens (the code to clear itself) so we call a helper
 %    command to  get rid of them.
 %    \begin{macrocode}
-              { ->~ \exp_args:Nv \@@_log_next_code:n { @@_next~#1 } }
+              {
+                -> ~ \exp_last_unbraced:Nf \@@_log_next_code:w
+                  { \cs_replacement_spec:c { @@_next~#1 } }
+              }
           }
 %    \end{macrocode}
 %
@@ -4549,7 +6096,7 @@
                 \@spaces
                 \clist_if_empty:cTF { g_@@_#1_labels_clist }
                   { --- }
-                  { \clist_use:cn {g_@@_#1_labels_clist} { ,~ } }
+                  { \clist_use:cn { g_@@_#1_labels_clist } { ,~ } }
               }
           }
           {
@@ -4563,21 +6110,145 @@
           }
       }
   }
+%<latexrelease>\EndIncludeInRelease
+%
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_log:nN}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_new_protected:Npn \@@_log:nN #1 #2
+%<latexrelease>  {
+%<latexrelease>    \@@_if_deprecated_generic:nT {#1}
+%<latexrelease>      {
+%<latexrelease>        \@@_deprecated_generic_warn:n {#1}
+%<latexrelease>        \@@_do_deprecated_generic:Nn \@@_log:nN {#1} #2
+%<latexrelease>        \exp_after:wN \use_none:nnnnnnnnn \use_none:nnnnn
+%<latexrelease>      }
+%<latexrelease>    \@@_preamble_hook:n {#1}
+%<latexrelease>    \@@_log_cmd:x
+%<latexrelease>      { ^^J ->~The~ \@@_if_generic:nT {#1} { generic~ } hook~'#1': }
+%<latexrelease>    \@@_if_usable:nF {#1}
+%<latexrelease>      { \@@_log_line:x { The~hook~is~not~declared. } }
+%<latexrelease>    \@@_if_disabled:nT {#1}
+%<latexrelease>      { \@@_log_line:x { The~hook~is~disabled. } }
+%<latexrelease>    \hook_if_empty:nTF {#1}
+%<latexrelease>      { #2 { The~hook~is~empty } }
+%<latexrelease>      {
+%<latexrelease>        \@@_log_line:x { Code~chunks: }
+%<latexrelease>        \prop_if_empty:cTF { g_@@_#1_code_prop }
+%<latexrelease>          { \@@_log_line_indent:x { --- } }
+%<latexrelease>          {
+%<latexrelease>            \prop_map_inline:cn { g_@@_#1_code_prop }
+%<latexrelease>              { \@@_log_line_indent:x { ##1~->~\tl_to_str:n {##2} } }
+%<latexrelease>          }
+%<latexrelease>        \@@_log_line:x
+%<latexrelease>          {
+%<latexrelease>            Document-level~(top-level)~code
+%<latexrelease>            \@@_if_usable:nT {#1}
+%<latexrelease>              { ~(executed~\@@_if_reversed:nTF {#1} {first} {last} ) } :
+%<latexrelease>          }
+%<latexrelease>        \@@_log_line_indent:x
+%<latexrelease>          {
+%<latexrelease>            \tl_if_empty:cTF { @@_toplevel~#1 }
+%<latexrelease>              { --- }
+%<latexrelease>              { -> ~ \exp_args:Nv \tl_to_str:n { @@_toplevel~#1 } }
+%<latexrelease>          }
+%<latexrelease>        \@@_log_line:x { Extra~code~for~next~invocation: }
+%<latexrelease>        \@@_log_line_indent:x
+%<latexrelease>          {
+%<latexrelease>            \tl_if_empty:cTF { @@_next~#1 }
+%<latexrelease>              { --- }
+%<latexrelease>              { ->~ \exp_args:Nv \@@_log_next_code:n { @@_next~#1 } }
+%<latexrelease>          }
+%<latexrelease>        \@@_log_line:x { Rules: }
+%<latexrelease>        \bool_set_true:N \l_@@_tmpa_bool
+%<latexrelease>        \@@_list_rules:nn {#1}
+%<latexrelease>          {
+%<latexrelease>            \bool_set_false:N \l_@@_tmpa_bool
+%<latexrelease>            \@@_log_line_indent:x
+%<latexrelease>              {
+%<latexrelease>                ##2~ with~
+%<latexrelease>                \str_if_eq:nnT {##3} {??} { default~ }
+%<latexrelease>                relation~ ##1
+%<latexrelease>              }
+%<latexrelease>          }
+%<latexrelease>        \bool_if:NT \l_@@_tmpa_bool
+%<latexrelease>          { \@@_log_line_indent:x { --- } }
+%<latexrelease>        \bool_lazy_and:nnTF
+%<latexrelease>            { \@@_if_usable_p:n {#1} }
+%<latexrelease>            { ! \hook_if_empty_p:n {#1} }
+%<latexrelease>          {
+%<latexrelease>            \@@_log_line:x
+%<latexrelease>              {
+%<latexrelease>                Execution~order
+%<latexrelease>                \bool_if:NTF \l_@@_tmpa_bool
+%<latexrelease>                  { \@@_if_reversed:nT {#1} { ~(after~reversal) } }
+%<latexrelease>                  { ~(after~
+%<latexrelease>                    \@@_if_reversed:nT {#1} { reversal~and~ }
+%<latexrelease>                    applying~rules)
+%<latexrelease>                  } :
+%<latexrelease>              }
+%<latexrelease>            #2 % \tl_show:n
+%<latexrelease>              {
+%<latexrelease>                \@spaces
+%<latexrelease>                \clist_if_empty:cTF { g_@@_#1_labels_clist }
+%<latexrelease>                  { --- }
+%<latexrelease>                  { \clist_use:cn { g_@@_#1_labels_clist } { ,~ } }
+%<latexrelease>              }
+%<latexrelease>          }
+%<latexrelease>          {
+%<latexrelease>            \@@_log_line:x { Execution~order: }
+%<latexrelease>            #2
+%<latexrelease>              {
+%<latexrelease>                \@spaces Not~set~because~the~hook~ \@@_if_usable:nTF {#1}
+%<latexrelease>                  { code~pool~is~empty }
+%<latexrelease>                  { is~\@@_if_disabled:nTF {#1} {disabled} {undeclared} }
+%<latexrelease>              }
+%<latexrelease>          }
+%<latexrelease>      }
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 %
 % \begin{macro}{\@@_log_next_code:n}
 %    To display the code for next invocation only (i.e., from
-%    \cs{AddToHookNext} we have to remove the first two tokens at the
-%    front which are \cs{tl_gclear:N} and the token list to clear.
+%    \cs{AddToHookNext} we have to remove the string
+%    \cs{@@_clear_next:n}\Arg{hook}, so the simplest is to use a macro
+%    delimited by a \verb|}|$_12$.
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
 %    \begin{macrocode}
-\cs_new:Npn \@@_log_next_code:n #1
-  { \exp_args:No \tl_to_str:n { \use_none:nn #1 } }
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_log_next_code:n}
+%<latexrelease>                 {Hooks~with~args}
+\exp_last_unbraced:NNNNo
+\cs_new:Npn \@@_log_next_code:w #1 \c_right_brace_str { }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_log_next_code:n}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_gset:Npn \@@_log_next_code:n #1
+%<latexrelease>  { \exp_args:No \tl_to_str:n { \use_none:nn #1 } }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\@@_print_args:n}
+%    Pretty-prints the number of arguments of a hook.
+%    \begin{macrocode}
+\cs_new:Npn \@@_print_args:nn #1 #2
+  {
+    \int_compare:nNnT {#2} > { 0 }
+      {
+        \@@_if_declared:nT {#1} { \use_none:nnn }
+        \@@_if_cmd_hook:nT {#1}
+          { \use_i:nnn { ~ (unknown ~ } }
+        \use:n { ~ (#2 ~ }
+        argument \int_compare:nNnT {#2} > { 1 } { s } )
+      }
+  }
+%    \end{macrocode}
 % \end{macro}
+%
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\@@_list_rules:nn}
 % \begin{macro}{\@@_list_one_rule:nnn,\@@_list_if_rule_exists:nnnF}
@@ -4656,15 +6327,34 @@
 %  \subsection{Specifying code for next invocation}
 %
 % \begin{macro}{\hook_gput_next_code:nn}
+% \changes{v1.1a}{2023/04/06}
+%         {Add \cs{hook_gput_next_code_with_args:nn} (hook-args).}
 %    \begin{macrocode}
-\cs_new_protected:Npn \hook_gput_next_code:nn #1
-  { \@@_normalize_hook_args:Nn \@@_gput_next_code:nn {#1} }
+%<latexrelease>\IncludeInRelease{2023/06/01}{\hook_gput_next_code:nn}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new_protected:Npn \hook_gput_next_code:nn #1 #2
+  {
+    \@@_replacing_args_false:
+    \@@_normalize_hook_args:Nn \@@_gput_next_code:nn {#1} {#2}
+    \@@_replacing_args_reset:
+  }
+\cs_new_protected:Npn \hook_gput_next_code_with_args:nn #1 #2
+  {
+    \@@_replacing_args_true:
+    \@@_normalize_hook_args:Nn \@@_gput_next_code:nn {#1} {#2}
+    \@@_replacing_args_reset:
+  }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\hook_gput_next_code:nn}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_gset_protected:Npn \hook_gput_next_code:nn #1
+%<latexrelease>  { \@@_normalize_hook_args:Nn \@@_gput_next_code:nn {#1} }
+%<latexrelease>\cs_gset_protected:Npn \hook_gput_next_code_with_args:nn #1 #2 { }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 %  \end{macro}
 %
-% \begin{macro}{\@@_gput_next_code:nn,
-%               \@@_gput_next_do:nn,
-%               \@@_gput_next_do:Nnn}
+% \begin{macro}{\@@_gput_next_code:nn}
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_gput_next_code:nn #1 #2
   {
@@ -4672,20 +6362,17 @@
       { \msg_error:nnn { hooks } { hook-disabled } {#1} }
       {
         \@@_if_structure_exist:nTF {#1}
-          { \@@_gput_next_do:nn {#1} {#2} }
-          { \@@_try_declaring_generic_next_hook:nn {#1} {#2} }
+          { \@@_gput_next_do:nn }
+          { \@@_try_declaring_generic_next_hook:nn }
+              {#1} {#2}
       }
   }
 %    \end{macrocode}
+%  \end{macro}
 %
-%    \begin{macrocode}
-\cs_new_protected:Npn \@@_gput_next_do:nn #1
-  {
-    \exp_args:Nc \@@_gput_next_do:Nnn
-      { @@_next~#1 } {#1}
-  }
-%    \end{macrocode}
-%   First check if the ``next code'' token list is empty:  if so we need
+% \begin{macro}{\@@_gput_next_do:nn}
+%   Start by sanity-checking with \cs{@@_chk_args_allowed:nn}.
+%   Then check if the ``next code'' token list is empty:  if so we need
 %   to add a \cs{tl_gclear:c} to clear it, so the code lasts for one
 %   usage only.  The token list is cleared early so that nested usages
 %   don't get lost.  \cs{tl_gclear:c} is used instead of
@@ -4694,31 +6381,68 @@
 %   that would make an infinite loop.  Also in case the main code token
 %   list is empty, the hook code has to be updated to add the next
 %   execution token list.
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
+% \changes{v1.1c}{2023/04/19}
+%         {Initialise hook structure when adding 'next' code (gh/1052).}
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_gput_next_do:Nnn #1 #2
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_gput_next_do:nn}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new_protected:Npn \@@_gput_next_do:nn #1
   {
-    \tl_if_empty:cT { @@~#2 }
-      { \@@_update_hook_code:n {#2} }
-    \tl_if_empty:NT #1
-      { \@@_tl_gset:Nn #1 { \@@_clear_next:n {#2} } }
-    \@@_tl_gput_right:Nn #1
+    \@@_init_structure:n {#1}
+    \@@_chk_args_allowed:nn {#1} { AddToHookNext }
+    \@@_cs_if_empty:cT { @@~#1 }
+      { \@@_update_hook_code:n {#1} }
+    \@@_cs_if_empty:cT { @@_next~#1 }
+      { \@@_next_gset:nn {#1} { \@@_clear_next:n {#1} } }
+    \@@_cs_gput_right:nnn { _next } {#1}
   }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_gput_next_do:nn}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_gset_protected:Npn \@@_gput_next_do:nn #1
+%<latexrelease>  {
+%<latexrelease>    \exp_args:Nc \@@_gput_next_do:Nnn
+%<latexrelease>      { @@_next~#1 } {#1}
+%<latexrelease>  }
+%<latexrelease>\cs_gset_protected:Npn \@@_gput_next_do:Nnn #1 #2
+%<latexrelease>  {
+%<latexrelease>    \tl_if_empty:cT { @@~#2 }
+%<latexrelease>      { \@@_update_hook_code:n {#2} }
+%<latexrelease>    \tl_if_empty:NT #1
+%<latexrelease>      { \@@_tl_gset:Nn #1 { \@@_clear_next:n {#2} } }
+%<latexrelease>    \@@_tl_gput_right:Nn #1
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 %  \end{macro}
 %
-%
-%
-%  \begin{macro}{\hook_gclear_next_code:n,\@@_clear_next:n}
+%  \begin{macro}{\hook_gclear_next_code:n}
 %    Discard anything set up for next invocation of the hook.
 % \changes{v1.0o}{2021/07/27}{Macro made public}
 %    \begin{macrocode}
 \cs_new_protected:Npn \hook_gclear_next_code:n #1
   { \@@_normalize_hook_args:Nn \@@_clear_next:n {#1} }
-\cs_new_protected:Npn \@@_clear_next:n #1
-  { \cs_gset_eq:cN { @@_next~#1 } \c_empty_tl }
 %    \end{macrocode}
 %  \end{macro}
 %
+% \begin{macro}{\@@_clear_next:n}
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_clear_next:n}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new_protected:Npn \@@_clear_next:n #1
+  { \@@_next_gset:nn {#1} { } }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_clear_next:n}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_gset_protected:Npn \@@_clear_next:n #1
+%<latexrelease>  { \cs_gset_eq:cN { @@_next~#1 } \c_empty_tl }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+% \end{macro}
 %
 %
 % \subsection{Using the hook}
@@ -4725,7 +6449,6 @@
 %
 % \begin{macro}{\hook_use:n}
 % \begin{macro}[EXP]{\@@_use_initialized:n}
-% \begin{macro}{\@@_use_undefined:w,\@@_use_end:}
 % \begin{macro}{\@@_preamble_hook:n}
 %   \cs{hook_use:n} as defined here is used in the preamble, where
 %   hooks aren't initialized by default.  \cs{@@_use_initialized:n} is
@@ -4750,28 +6473,54 @@
 %   \verb=\csname ...\endcsname= construct \cs{tl_if_exist:c} is
 %   careful to avoid this.
 %    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2021/11/15}{\hook_use:n}
-%<latexrelease>                 {Standardise~generic~hook~names}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\hook_use:n}
+%<latexrelease>                 {Hooks~with~args}
 \cs_new_protected:Npn \hook_use:n #1
   {
-    \tl_if_exist:cT { @@~#1 }
-      {
-        \@@_preamble_hook:n {#1}
-        \cs:w @@~#1 \cs_end:
-      }
+    \@@_preamble_hook:n {#1}
+    \@@_use_initialized:n {#1}
   }
 \cs_new:Npn \@@_use_initialized:n #1
   {
     \if_cs_exist:w @@~#1 \cs_end:
-      \cs:w @@~#1 \exp_after:wN \cs_end:
+      \cs:w @@~#1 \use_i:nn
     \fi:
+    \use_none:n
+    \cs_end:
   }
 \cs_new_protected:Npn \@@_preamble_hook:n #1
-  { \@@_initialize_hook_code:n {#1} }
+  {
+    \if_cs_exist:w @@~#1 \cs_end:
+      \@@_initialize_hook_code:n {#1}
+    \fi:
+  }
 %<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 %
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2021/11/15}{\hook_use:n}
+%<latexrelease>                 {Standardise~generic~hook~names}
+%<latexrelease>\cs_new_protected:Npn \hook_use:n #1
+%<latexrelease>  {
+%<latexrelease>    \tl_if_exist:cT { @@~#1 }
+%<latexrelease>      {
+%<latexrelease>        \@@_preamble_hook:n {#1}
+%<latexrelease>        \cs:w @@~#1 \cs_end:
+%<latexrelease>      }
+%<latexrelease>  }
+%<latexrelease>\cs_new:Npn \@@_use_initialized:n #1
+%<latexrelease>  {
+%<latexrelease>    \if_cs_exist:w @@~#1 \cs_end:
+%<latexrelease>      \cs:w @@~#1 \exp_after:wN \cs_end:
+%<latexrelease>    \fi:
+%<latexrelease>  }
+%<latexrelease>\cs_new_protected:Npn \@@_preamble_hook:n #1
+%<latexrelease>  { \@@_initialize_hook_code:n {#1} }
+%<latexrelease>\cs_new:Npn \hook_use:nnw #1 { }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 %<latexrelease>\IncludeInRelease{2020/10/01}{\hook_use:n}
 %<latexrelease>                 {Standardise~generic~hook~names}
 %<latexrelease>\cs_new_protected:Npn \hook_use:n #1
@@ -4799,13 +6548,69 @@
 %<latexrelease>\cs_new_protected:Npn \@@_preamble_hook:n #1
 %<latexrelease>  { \@@_initialize_hook_code:n {#1} }
 %<latexrelease>\cs_new_eq:NN \@@_use_end: \cs_end:
+%<latexrelease>\cs_new:Npn \hook_use:nnw #1 { }
 %<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
 % \end{macro}
+%
+%
+% \begin{macro}{\hook_use:nnw}
+% \begin{macro}[EXP]{\@@_use_initialized:nnw}
+% \changes{v1.1a}{2023/04/06}
+%         {Add \cs{hook_use:nnw} (hook-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\hook_use:nnw}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new_protected:Npn \hook_use:nnw #1
+  {
+    \@@_preamble_hook:n {#1}
+    \@@_use_initialized:nnw {#1}
+  }
+\cs_new:Npn \@@_use_initialized:nnw #1 #2
+  {
+    \cs:w
+      \if_cs_exist:w @@~#1 \cs_end:
+        @@~#1
+      \else:
+        use_none: \prg_replicate:nn {#2} { n }
+      \fi:
+    \cs_end:
+  }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\hook_use:nnw}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_gset:Npn \hook_use:nnw #1 #2
+%<latexrelease>  { \use:c { use_none: \prg_replicate:nn {#2} { n } } }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
 % \end{macro}
+% \end{macro}
 %
+%
+% \begin{macro}{\@@_post_initialization_defs:}
+% \changes{v1.1a}{2023/04/06}
+%         {Macro added (hook-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_post_initialization_defs:}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new_protected:Npn \@@_post_initialization_defs:
+  {
+    \cs_gset_eq:NN \hook_use:n \@@_use_initialized:n
+    \cs_gset_eq:NN \hook_use:nnw \@@_use_initialized:nnw
+    \cs_gset_eq:NN \@@_preamble_hook:n \use_none:n
+    \cs_gset_eq:NN \@@_post_initialization_defs: \prg_do_nothing:
+  }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_post_initialization_defs:}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_undefine:N \@@_post_initialization_defs:
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+% \end{macro}
+%
+%
 % \begin{macro}[EXP]{\@@_use:wn}
 % \begin{macro}{\@@_try_file_hook:n,\@@_if_usable_use:n}
 %   \cs{@@_use:wn} does a quick check to test if the current hook is a
@@ -4861,8 +6666,7 @@
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}{\hook_use_once:n}
-% \begin{macro}{\@@_use_once:n}
+% \begin{macro}{\hook_use_once:n,\hook_use_once:nnw}
 %   For hooks that can and should be used only once we have a special
 %   use command that further inhibits the hook from getting more code
 %   added to it.  This has the effect that any
@@ -4874,20 +6678,80 @@
 %   documented to not trim spaces.
 %
 % \changes{v1.0r}{2021/09/06}{Clean up after \cs{UseOneTimeHook} (gh/606)}
+% \changes{v1.1a}{2023/04/06}
+%         {Add \cs{hook_use_once:nnw} (hook-args).}
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\hook_use_once:nnw}
+%<latexrelease>                 {Hooks~with~args}
 \cs_new_protected:Npn \hook_use_once:n #1
   {
     \@@_if_execute_immediately:nF {#1}
-      { \@@_normalize_hook_args:Nn \@@_use_once:n { \use:n {#1} } }
+      { \@@_normalize_hook_args:Nn \@@_use_once:nn { \use:n {#1} } { 0 } }
   }
-\cs_new_protected:Npn \@@_use_once:n #1
+\cs_new_protected:Npn \hook_use_once:nnw #1 #2
   {
+    \@@_if_execute_immediately:nF {#1}
+      { \@@_normalize_hook_args:Nn \@@_use_once:nn { \use:n {#1} } {#2} }
+  }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\hook_use_once:nnw}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_gset_protected:Npn \hook_use_once:n #1
+%<latexrelease>  {
+%<latexrelease>    \@@_if_execute_immediately:nF {#1}
+%<latexrelease>      { \@@_normalize_hook_args:Nn \@@_use_once:n { \use:n {#1} } }
+%<latexrelease>  }
+%<latexrelease>\cs_gset:Npn \hook_use_once:nnw #1 #2
+%<latexrelease>  { \use:c { use_none: \prg_replicate:nn {#2} { n } } }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%
+% \begin{macro}{\@@_use_once:nn}
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_use_once:nn}
+%<latexrelease>                 {Hooks~with~args}
+\cs_new_protected:Npn \@@_use_once:nn #1 #2
+  {
     \@@_preamble_hook:n {#1}
     \@@_use_once_set:n {#1}
-    \@@_use_initialized:n {#1}
-    \@@_use_once_clear:n {#1}
+%    \end{macrocode}
+%   When a hook has arguments, the call to \cs{@@_use_initialized:n},
+%   should be the very last thing to happen, otherwise the arguments
+%   grabbed will be wrong.  So, to clean up after the hook we need to
+%   cheat a bit and sneak the cleanup code at the end of the hook,
+%   along with the next execution code.
+%    \begin{macrocode}
+    \@@_replacing_args_false:
+    \@@_cs_gput_right:nnn { _next } {#1} { \@@_use_once_clear:n {#1} }
+    \@@_replacing_args_reset:
+    \@@_if_usable:nTF {#1}
+      { \@@_use_initialized:n {#1} }
+      {
+        \int_compare:nNnT {#2} > { 0 }
+          { \use:c { use_none: \prg_replicate:nn {#2} { n } } }
+      }
   }
+%<latexrelease>\EndIncludeInRelease
+%
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_use_once:nn}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_gset_protected:Npn \@@_use_once:n #1
+%<latexrelease>  {
+%<latexrelease>    \@@_preamble_hook:n {#1}
+%<latexrelease>    \@@_use_once_set:n {#1}
+%<latexrelease>    \@@_use_initialized:n {#1}
+%<latexrelease>    \@@_use_once_clear:n {#1}
+%<latexrelease>  }
+%<latexrelease>\cs_undefine:N \@@_use_once:nn
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
+% \end{macro}
 %
 % \begin{macro}{\@@_use_once_set:n}
 % \begin{macro}{\@@_use_once_clear:n}
@@ -4900,43 +6764,60 @@
 %   \cs{hook_use_once:n} will expand to nothing.
 % \changes{v1.0r}{2021/09/06}{Clean up after \cs{UseOneTimeHook} (gh/606)}
 % \changes{v1.0u}{2022/05/13}{Check if prop exists to avoid l3debug error}
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_use_once_clear:n}
+%<latexrelease>                 {Hooks~with~args}
 \cs_new_protected:Npn \@@_use_once_set:n #1
   { \@@_tl_gset:cn { g_@@_#1_reversed_tl } { I } }
 \cs_new_protected:Npn \@@_use_once_clear:n #1
   {
-    \@@_tl_gclear:c { @@~#1 }
-    \@@_tl_gclear:c { @@_next~#1 }
-    \@@_tl_gclear:c { @@_toplevel~#1 }
+    \@@_code_gset:nn {#1} { }
+    \@@_next_gset:nn {#1} { }
+    \@@_toplevel_gset:nn {#1} { }
     \prop_gclear_new:c { g_@@_#1_code_prop }
   }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_use_once_clear:n}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_new_protected:Npn \@@_use_once_clear:n #1
+%<latexrelease>  {
+%<latexrelease>    \@@_tl_gclear:c { @@~#1 }
+%<latexrelease>    \@@_tl_gclear:c { @@_next~#1 }
+%<latexrelease>    \@@_tl_gclear:c { @@_toplevel~#1 }
+%<latexrelease>    \prop_gclear_new:c { g_@@_#1_code_prop }
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
 % \end{macro}
 % \end{macro}
-% \end{macro}
-% \end{macro}
 %
 % \begin{macro}[pTF]{\@@_if_execute_immediately:n}
-%   To check whether the code being added should be executed immediately (that
-%   is, if the hook is a one-time hook), we check if it's usable (it
-%   can't be one-time if it was not already usable), then we check that
+%   To check whether the code being added should be executed immediately
+%   (that is, if the hook is a one-time hook), we check if
 %   \cs[no-index]{g_@@_\meta{hook}_reversed_tl} is |I|.  The gymnastics
 %   around \cs{if:w} is there to allow the |reversed| token list to be
 %   empty.
 % \changes{v1.0r}{2021/09/06}{Macro added (gh/606)}
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
 %    \begin{macrocode}
 \prg_new_conditional:Npnn \@@_if_execute_immediately:n #1 { T, F, TF }
   {
-    \@@_if_usable:nTF {#1}
-      {
-        \exp_after:wN \@@_clean_to_scan:w
-        \if:w I \cs:w g_@@_#1_reversed_tl \cs_end:
-          \s_@@_mark \prg_return_true:
-        \else:
-          \s_@@_mark \prg_return_false:
+    \exp_after:wN \@@_use_none_delimit_by_s_mark:w
+    \if:w I
+        \if_cs_exist:w g_@@_#1_reversed_tl \cs_end:
+          \cs:w g_@@_#1_reversed_tl \exp_after:wN \cs_end:
         \fi:
-      }
-      { \prg_return_false: }
+        X
+      \s_@@_mark \prg_return_true:
+    \else:
+      \s_@@_mark \prg_return_false:
+    \fi:
   }
 %    \end{macrocode}
 %  \end{macro}
@@ -4963,7 +6844,7 @@
 %
 %    All other states can only be queried with internal tests as the
 %    different states are irrelevant for package code.
-
+%
 % \begin{macro}[pTF]{\hook_if_empty:n}
 %   Test if a hook is empty (that is, no code was added to that hook).
 %   A \meta{hook} being empty means that all three of its
@@ -4970,24 +6851,51 @@
 %   \cs{g_@@_\meta{hook}_code_prop}, its
 %   \cs{@@_toplevel\textvisiblespace\meta{hook}} and its
 %   \cs{@@_next\textvisiblespace\meta{hook}} are empty.
+% \changes{v1.1a}{2023/04/06}
+%         {Changes to add hook arguments (hook-args).}
+% \changes{v1.1c}{2023/04/19}
+%         {Simpler and faster version (gh/1052).}
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\hook_if_empty:n}
+%<latexrelease>                 {Hooks~with~args}
 \prg_new_conditional:Npnn \hook_if_empty:n #1 { p , T , F , TF }
   {
-    \@@_if_structure_exist:nTF {#1}
-      {
-        \bool_lazy_and:nnTF
-            { \prop_if_empty_p:c { g_@@_#1_code_prop } }
-            {
-              \bool_lazy_and_p:nn
-                { \tl_if_empty_p:c { @@_toplevel~#1 } }
-                { \tl_if_empty_p:c { @@_next~#1 } }
-            }
-          { \prg_return_true: }
-          { \prg_return_false: }
-      }
-      { \prg_return_true: }
+    \if:w
+        T
+        \prop_if_exist:cT { g_@@_#1_code_prop }
+          { \prop_if_empty:cF { g_@@_#1_code_prop } { F } }
+        \@@_cs_if_empty:cF { @@_toplevel~#1 } { F }
+        \@@_cs_if_empty:cF { @@_next~#1 } { F }
+        T
+      \prg_return_true:
+    \else:
+      \prg_return_false:
+    \fi:
   }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\hook_if_empty:n}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\prg_new_conditional:Npnn \hook_if_empty:n #1 { p , T , F , TF }
+%<latexrelease>  {
+%<latexrelease>    \@@_if_structure_exist:nTF {#1}
+%<latexrelease>      {
+%<latexrelease>        \bool_lazy_and:nnTF
+%<latexrelease>            { \prop_if_empty_p:c { g_@@_#1_code_prop } }
+%<latexrelease>            {
+%<latexrelease>              \bool_lazy_and_p:nn
+%<latexrelease>                { \tl_if_empty_p:c { @@_toplevel~#1 } }
+%<latexrelease>                { \tl_if_empty_p:c { @@_next~#1 } }
+%<latexrelease>            }
+%<latexrelease>          { \prg_return_true: }
+%<latexrelease>          { \prg_return_false: }
+%<latexrelease>      }
+%<latexrelease>      { \prg_return_true: }
+%<latexrelease>  }
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
 % \end{macro}
 %
 %
@@ -4994,8 +6902,8 @@
 % \begin{macro}[pTF]{\@@_if_usable:n}
 %   A hook is usable if the
 %   token list that stores the sorted code for that hook,
-%   \cs[no-index]{@@~\meta{hook}}, exists.  The property list
-%   \cs[no-index]{g_@@_\meta{hook}_code_prop} cannot be used here
+%   \cs[no-index]{@@\textvisiblespace\meta{hook}}, exists.  The property
+%   list \cs[no-index]{g_@@_\meta{hook}_code_prop} cannot be used here
 %   because often it is necessary to add code to a hook without knowing
 %   if such hook was already declared, or even if it will ever be
 %   (for example, in case the package that defines it isn't loaded).
@@ -5002,7 +6910,7 @@
 %    \begin{macrocode}
 \prg_new_conditional:Npnn \@@_if_usable:n #1 { p , T , F , TF }
   {
-    \tl_if_exist:cTF { @@~#1 }
+    \cs_if_exist:cTF { @@~#1 }
       { \prg_return_true: }
       { \prg_return_false: }
   }
@@ -5046,7 +6954,7 @@
 %    \begin{macrocode}
 \prg_new_conditional:Npnn \@@_if_reversed:n #1 { p , T , F , TF }
   {
-    \exp_after:wN \@@_clean_to_scan:w
+    \exp_after:wN \@@_use_none_delimit_by_s_mark:w
     \if:w - \cs:w g_@@_#1_reversed_tl \cs_end:
       \s_@@_mark \prg_return_true:
     \else:
@@ -5086,6 +6994,37 @@
 %  \end{macro}
 %  \end{macro}
 %
+% \begin{macro}[pTF]{\@@_if_cmd_hook:n}
+% \begin{macro}[pTF]{\@@_if_cmd_hook:w}
+%   An internal conditional that checks if a given hook is a valid
+%   generic \hook{cmd} hook.
+% \changes{v1.1d}{2023/05/21}
+%         {Changes to allow support arguments in cmd hooks (cmd-args).}
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\@@_if_cmd_hook:n}
+%<latexrelease>                 {Hooks~with~args}
+\prg_new_conditional:Npnn \@@_if_cmd_hook:n #1 { T }
+  { \@@_if_cmd_hook:w #1 / / / \s_@@_mark }
+\cs_new:Npn \@@_if_cmd_hook:w #1 / #2 / #3 / #4 \s_@@_mark
+  {
+    \if:w Y
+          \str_if_eq:nnF {#1} { cmd } { N }
+          \tl_if_exist:cF { c_@@_generic_#1/./#3_tl } { N }
+          Y
+      \prg_return_true:
+    \else:
+      \prg_return_false:
+    \fi:
+  }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@@_if_cmd_hook:n}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_undefine:N \@@_if_cmd_hook:nT
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%  \end{macro}
+%  \end{macro}
+%
 % \begin{macro}[pTF]{\@@_if_generic_reversed:n}
 %   An internal conditional that checks if a name belongs to a generic
 %   reversed hook.
@@ -5103,6 +7042,50 @@
 %    \end{macrocode}
 %  \end{macro}
 %
+% \begin{macro}[EXP]{\@@_if_replacing_args:TF}
+% \begin{macro}[EXP]{\@@_misused_if_replacing_args:nn}
+% \begin{macro}{\@@_replacing_args_true:}
+% \begin{macro}{\@@_replacing_args_false:}
+% \begin{macro}{\@@_replacing_args_reset:}
+% \begin{macro}{\g_@@_replacing_stack_seq}
+%   An internal conditional that checks if the code being added to the
+%   hook contains arguments.
+% \changes{v1.1a}{2023/04/06}
+%         {Macro added (hook-args).}
+%    \begin{macrocode}
+\seq_new:N \g_@@_replacing_stack_seq
+\cs_new:Npn \@@_misused_if_replacing_args:nn #1 #2
+  {
+    \msg_expandable_error:nnn { latex2e } { should-not-happen }
+      { Misused~\@@_if_replacing_args:. }
+  }
+\cs_new:Npn \@@_if_replacing_args:TF
+  { \@@_misused_if_replacing_args:nn }
+\cs_new_protected:Npn \@@_replacing_args_true:
+  {
+    \seq_gpush:No \g_@@_replacing_stack_seq
+      { \@@_if_replacing_args:TF }
+    \cs_set:Npn \@@_if_replacing_args:TF { \use_i:nn }
+  }
+\cs_new_protected:Npn \@@_replacing_args_false:
+  {
+    \seq_gpush:No \g_@@_replacing_stack_seq
+      { \@@_if_replacing_args:TF }
+    \cs_set:Npn \@@_if_replacing_args:TF { \use_ii:nn }
+  }
+\cs_new_protected:Npn \@@_replacing_args_reset:
+  {
+    \seq_gpop:NN \g_@@_replacing_stack_seq \l_@@_return_tl
+    \cs_gset_eq:NN \@@_if_replacing_args:TF \l_@@_return_tl
+  }
+%    \end{macrocode}
+%  \end{macro}
+%  \end{macro}
+%  \end{macro}
+%  \end{macro}
+%  \end{macro}
+%  \end{macro}
+%
 %  \subsection{Messages}
 %
 %    Hook errors are LaTeX kernel errors:
@@ -5137,8 +7120,57 @@
       Please~ use~ a~ different~ name~ for~ your~ hook.}
 %    \end{macrocode}
 %
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{too-many-args}
+%<latexrelease>                 {Hooks~with~args}
+%    \end{macrocode}
 %
+% \changes{v1.1a}{2023/04/06}
+%         {Messages 'too-many-args', 'without-args' and 'one-time-args' added (hook-args).}
 %    \begin{macrocode}
+\msg_new:nnnn { hooks } { too-many-args }
+  { Too~many~arguments~for~hook~'#1'. }
+  {
+    You~tried~to~declare~a~hook~with~#2~arguments,~but~a~
+    hook~can~only~have~up~to~nine.~LaTeX~will~define~this~
+    hook~with~nine~arguments.
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\msg_new:nnnn { hooks } { without-args }
+  { Hook~'#1'~has~no~arguments. }
+  {
+    You~tried~to~use~\iow_char:N\\#2WithArguments~
+    on~a~hook~that~takes~no~arguments.\\
+    Check~the~usage~of~the~hook~or~use~\iow_char:N\\#2~instead.\\
+    \\
+    LaTeX~will~use~\iow_char:N\\#2.
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\msg_new:nnnn { hooks } { one-time-args }
+  { You~can't~have~arguments~in~used~one-time~hook~'#1'. }
+  {
+    You~tried~to~use~\iow_char:N\\#2WithArguments~
+    on~a~one-time~hook~that~has~already~been~used.~
+    You~have~to~add~the~code~before~the~hook~is~used,~
+    or~add~the~code~without~arguments~using~\iow_char:N\\#2~instead.\\
+    \\
+    LaTeX~will~use~\iow_char:N\\#2.
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{too-many-args}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%
+%
+%    \begin{macrocode}
 \msg_new:nnnn { hooks } { hook-disabled }
   { Cannot~add~code~to~disabled~hook~'#1'. }
   {
@@ -5278,25 +7310,58 @@
 %  \begin{macro}{\NewHook,\NewReversedHook,\NewMirroredHookPair}
 %    Declaring new hooks \ldots
 %    \begin{macrocode}
-\NewDocumentCommand \NewHook             { m }{ \hook_new:n {#1} }
-\NewDocumentCommand \NewReversedHook     { m }{ \hook_new_reversed:n {#1} }
-\NewDocumentCommand \NewMirroredHookPair { mm }{ \hook_new_pair:nn {#1}{#2} }
+\NewDocumentCommand \NewHook             { m }
+  { \hook_new:n {#1} }
+\NewDocumentCommand \NewReversedHook     { m }
+  { \hook_new_reversed:n {#1} }
+\NewDocumentCommand \NewMirroredHookPair { mm }
+  { \hook_new_pair:nn {#1}{#2} }
 %    \end{macrocode}
 %  \end{macro}
 %
 %
 %
+%  \begin{macro}{
+%    \NewHookWithArguments,
+%    \NewReversedHookWithArguments,
+%    \NewMirroredHookPairWithArguments
+%  }
+%    Declaring new hooks with arguments\ldots
+% \changes{v1.1a}{2023/04/06}
+%         {Add \cs{NewHookWithArguments} (hook-args).}
 %    \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2021/06/01}%
-%<latexrelease>         {\hook_activate_generic:n}{Providing~hooks}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\NewHookWithArguments}
+%<latexrelease>                 {Hooks~with~args}
+\NewDocumentCommand \NewHookWithArguments             { mm }
+  { \hook_new_with_args:nn {#1} {#2} }
+\NewDocumentCommand \NewReversedHookWithArguments     { mm }
+  { \hook_new_reversed_with_args:nn {#1} {#2} }
+\NewDocumentCommand \NewMirroredHookPairWithArguments { mmm }
+  { \hook_new_pair_with_args:nnn {#1} {#2} {#3} }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2023/06/01}{\NewHookWithArguments}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_new_protected:Npn \NewHookWithArguments #1 #2 { }
+%<latexrelease>\cs_new_protected:Npn \NewReversedHookWithArguments #1 #2 { }
+%<latexrelease>\cs_new_protected:Npn \NewMirroredHookPairWithArguments #1 #2 #3 { }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
+%  \end{macro}
 %
+%
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2021/06/01}{\ActivateGenericHook}
+%<latexrelease>                 {Providing~hooks}
+%    \end{macrocode}
+%
 %  \begin{macro}{\ActivateGenericHook}
 %    Providing new hooks \ldots
 % \changes{v1.0m}{2021/04/29}{Add \cs{ProvideHook} etc.}
 % \changes{v1.0o}{2021/08/02}{Change name}
 %    \begin{macrocode}
-\NewDocumentCommand \ActivateGenericHook { m }{ \hook_activate_generic:n {#1} }
+\NewDocumentCommand \ActivateGenericHook { m }
+  { \hook_activate_generic:n {#1} }
 %    \end{macrocode}
 %  \end{macro}
 %
@@ -5304,32 +7369,57 @@
 %    Disabling a generic hook.
 % \changes{v1.0o}{2021/08/02}{Change name}
 %    \begin{macrocode}
-\NewDocumentCommand \DisableGenericHook { m }{ \hook_disable_generic:n {#1} }
+\NewDocumentCommand \DisableGenericHook { m }
+  { \hook_disable_generic:n {#1} }
 %    \end{macrocode}
 %  \end{macro}
 %
 %    \begin{macrocode}
 %<latexrelease>\EndIncludeInRelease
-%<latexrelease>\IncludeInRelease{2020/10/01}
-%<latexrelease>                 {\hook_activate_generic:n}{Providing~hooks}
-%<latexrelease>
-%<latexrelease>\def \ActivateGenericHook#1{}
-%<latexrelease>
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}{\ActivateGenericHook}
+%<latexrelease>                 {Providing~hooks}
+%<latexrelease>\def \ActivateGenericHook #1 { }
+%<latexrelease>\def \DisableGenericHook #1 { }
 %<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 %
 %
-%  \begin{macro}{\AddToHook}
+%  \begin{macro}{\AddToHook,\AddToHookWithArguments}
+% \changes{v1.1a}{2023/04/06}
+%         {Add \cs{AddToHookWithArguments} (hook-args).}
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\AddToHookWithArguments}
+%<latexrelease>                 {Hooks~with~args}
 \NewDocumentCommand \AddToHook { m o +m }
   { \hook_gput_code:nnn {#1} {#2} {#3} }
+\NewDocumentCommand \AddToHookWithArguments { m o +m }
+  { \hook_gput_code_with_args:nnn {#1} {#2} {#3} }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\AddToHookWithArguments}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_new_protected:Npn \AddToHookWithArguments #1 #2 #3 { }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 %  \end{macro}
 %
-%  \begin{macro}{\AddToHookNext}
+%  \begin{macro}{\AddToHookNext,\AddToHookNextWithArguments}
+% \changes{v1.1a}{2023/04/06}
+%         {Add \cs{AddToHookNextWithArguments} (hook-args).}
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\AddToHookNextWithArguments}
+%<latexrelease>                 {Hooks~with~args}
 \NewDocumentCommand \AddToHookNext { m +m }
   { \hook_gput_next_code:nn {#1} {#2} }
+\NewDocumentCommand \AddToHookNextWithArguments { m +m }
+  { \hook_gput_next_code_with_args:nn {#1} {#2} }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\AddToHookNextWithArguments}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_new_protected:Npn \AddToHookNextWithArguments #1 #2 { }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 %  \end{macro}
 %
@@ -5396,12 +7486,29 @@
 %
 %
 %
-%  \begin{macro}{\UseHook,\UseOneTimeHook}
+%  \begin{macro}{
+%    \UseHook,
+%    \UseOneTimeHook,
+%    \UseHookWithArguments,
+%    \UseOneTimeHookWithArguments,
+%  }
 %    Avoid the overhead of \pkg{xparse} and its protection that we
 %    don't want here (since the hook should vanish without trace if empty)!
+% \changes{v1.1a}{2023/04/06}
+%         {Add \cs{UseHookWithArguments} (hook-args).}
 %    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}{\UseHookWithArguments}
+%<latexrelease>                 {Hooks~with~args}
 \cs_new:Npn \UseHook        { \hook_use:n }
 \cs_new:Npn \UseOneTimeHook { \hook_use_once:n }
+\cs_new:Npn \UseHookWithArguments        { \hook_use:nnw }
+\cs_new:Npn \UseOneTimeHookWithArguments { \hook_use_once:nnw }
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}{\UseHookWithArguments}
+%<latexrelease>                 {Hooks~with~args}
+%<latexrelease>\cs_new:Npn \UseHookWithArguments #1 #2 { }
+%<latexrelease>\cs_new:Npn \UseOneTimeHookWithArguments #1 #2 { }
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 %  \end{macro}
 %
@@ -5462,7 +7569,7 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}[EXP]{\IfHookExistsTF}
+% \begin{macro}[EXP,int]{\IfHookExistsTF}
 %    Marked for removal and no longer documented in the doc section!
 % \phoinline{\cs{IfHookExistsTF} is used in \texttt{jlreq.cls},
 % \texttt{pxatbegshi.sty}, \texttt{pxeverysel.sty},
@@ -5484,7 +7591,7 @@
 % \changes{v1.0p}{2021/08/20}{Added deprecation warnings for
 %                             old generic hook commands (gh/638)}
 %
-% \begin{macro}{
+% \begin{macro}[int]{
 %     \hook_disable:n,
 %     \hook_provide:n,
 %     \hook_provide_reversed:n,
@@ -5529,7 +7636,7 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{
+% \begin{macro}[int]{
 %     \DisableHook,
 %     \ProvideHook,
 %     \ProvideReversedHook,
@@ -5596,8 +7703,10 @@
 %<@@=>
 %    \end{macrocode}
 %
-%  \begin{macro}{\@expl@@@initialize at all@@,
-%                \@expl@@@hook at curr@name at pop@@}
+%  \begin{macro}[int]{
+%      \@expl@@@initialize at all@@,
+%      \@expl@@@hook at curr@name at pop@@
+%  }
 %
 % \InternalDetectionOff
 %    \begin{macrocode}
@@ -5620,8 +7729,8 @@
 %                             to be for \cs{AddToHook} vice versa (gh/401)}
 %    \begin{macrocode}
 %
-%<latexrelease>\IncludeInRelease{0000/00/00}%
-%<latexrelease>                 {lthooks}{The~hook~management}%
+%<latexrelease>\IncludeInRelease{0000/00/00}{lthooks}
+%<latexrelease>                 {The~hook~management}%
 %<latexrelease>
 %<latexrelease>\def \NewHook#1{}
 %<latexrelease>\def \NewReversedHook#1{}
@@ -5656,10 +7765,56 @@
 %<latexrelease>\long\def \IfHookEmptyTF #1#2#3{#2}
 %<latexrelease>
 %<latexrelease>\EndModuleRelease
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<@@=hook>
+%    \end{macrocode}
+%
+% \changes{v1.1a}{2023/04/06}
+%         {Add dedicated rollback code to revert data structures (hook-args).}
+%    \begin{macrocode}
+%<latexrelease>\cs:w @@_rollback_tidying: \cs_end:
+%<latexrelease>\bool_lazy_and:nnT
+%<latexrelease>    { \int_compare_p:nNn { \sourceLaTeXdate } > { 20230600 } }
+%<latexrelease>    { \int_compare_p:nNn { \requestedLaTeXdate } < { 20230601 } }
+%<latexrelease>  {
+%<latexrelease>    \cs_gset_protected:Npn \@@_rollback_tidying:
+%<latexrelease>      {
+%<latexrelease>        \@latex at error { Rollback~code~executed~twice }
+%<latexrelease>          {
+%<latexrelease>            Something~went~wrong~(unless~this~was~
+%<latexrelease>            done~on~purpose~in~a~testing~environment).
+%<latexrelease>          }
+%<latexrelease>        \use_none:nnnn
+%<latexrelease>      }
+%<latexrelease>    \cs_set:Npn \@@_tmp:w #1 #2
+%<latexrelease>      {
+%<latexrelease>        \@@_tl_gset:cx { @@#1~#2 }
+%<latexrelease>          {
+%<latexrelease>            \exp_args:No \exp_not:o
+%<latexrelease>              {
+%<latexrelease>                \cs:w @@#1~#2 \exp_last_unbraced:Ne \cs_end:
+%<latexrelease>                  { \@@_braced_cs_parameter:n { @@#1~#2 } }
+%<latexrelease>              }
+%<latexrelease>          }
+%<latexrelease>      }
+%<latexrelease>    \seq_map_inline:Nn \g_@@_all_seq
+%<latexrelease>      {
+%<latexrelease>        \exp_after:wN \cs_gset_nopar:Npn
+%<latexrelease>          \cs:w g_@@_#1_code_prop \exp_args:NNo \exp_args:No
+%<latexrelease>            \cs_end: { \cs:w g_@@_#1_code_prop \cs_end: }
+%<latexrelease>        \@@_tmp:w { _toplevel } {#1}
+%<latexrelease>        \@@_tmp:w { _next } {#1}
+%<latexrelease>      }
+%<latexrelease>  }
 \ExplSyntaxOff
 %</2ekernel|latexrelease>
 %    \end{macrocode}
 %
+%    \begin{macrocode}
+%<@@=>
+%    \end{macrocode}
 %
 % \Finale
 %

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltlists.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltlists.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltlists.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -31,7 +31,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltlists.dtx}
-             [2020/12/05 v1.0t LaTeX Kernel (List Environments)]
+             [2023/05/17 v1.0t LaTeX Kernel (List Environments)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltlists.dtx}
@@ -68,7 +68,6 @@
 % \begin{quote}
 %        |\list|\marg{LABEL}\marg{COMMANDS} ... |\endlist|
 % \end{quote}
-%
 % which can be invoked by the user as the list environment.  The LABEL
 % argument specifies item labeling.  COMMANDS contains commands for
 % changing the horizontal and vertical spacing parameters.
@@ -187,7 +186,7 @@
 % |\hsize|.
 %
 % Here are the parameters of a list that can be set by commands in
-% the |\list|'s COMMANDS argument.  These parameters are all TeX
+% the |\list|'s COMMANDS argument.  These parameters are all \TeX{}
 % skips or dimensions (defined by |\newskip| or |\newdimen|), so the
 % usual \TeX\ or \LaTeX\ commands can be used to set them.  The
 % commands will be executed in vmode if and only if the |\list| was
@@ -228,7 +227,7 @@
 %                      label.
 %  \item[\cs{labelwidth}:] nominal width of box that contains the label.
 %                      If the natural width of the
-%                         label $< =$ \cs{labelwidth},
+%                         label $\leq$ \cs{labelwidth},
 %                      then the label is flushed right inside a box
 %                      of width \cs{labelwidth} (with an \cs{hfil}).
 %                      Otherwise,

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltmarks.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltmarks.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltmarks.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,7 +1,8 @@
 % \iffalse meta-comment
 %
-%% File: ltmarks.dtx (C) Copyright 2022
-%       Frank Mittelbach, LaTeX Team
+%% File: ltmarks.dtx
+%% Copyright (C) 2022-2023
+%% Frank Mittelbach, The LaTeX Project
 %
 % It may be distributed and/or modified under the conditions of the
 % LaTeX Project Public License (LPPL), either version 1.3c of this

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltmath.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltmath.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltmath.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -38,7 +38,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltmath.dtx}
-              [2022/09/07 v1.2m LaTeX Kernel (Math Setup)]
+              [2023/05/13 v1.2n LaTeX Kernel (Math Setup)]
 % \iffalse
 %</driver>
 %
@@ -1132,9 +1132,29 @@
 \fi
 %    \end{macrocode}
 %
+% \begin{macro}{\eqno}
+% \begin{macro}{\leqno}
+% \changes{v1.2n}{2023/05/13}{add \cs{ignorespaces} gh/1059}
+% Ensure the (deprecated) \verb|$$..\eqno 1 $$| ignores spaces.
 %    \begin{macrocode}
 %</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2023/06/01}%
+%<latexrelease>                 {\eqno}{add ignorespaces to eqno}%
+\let\@kernel at eqno\eqno
+\let\@kernel at leqno\leqno
+\protected\def\eqno{\@kernel at eqno\aftergroup\ignorespaces}
+\protected\def\leqno{\@kernel at leqno\aftergroup\ignorespaces}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease>                 {\eqno}{add ignorespaces to eqno}%
+%<latexrelease>\let\eqno\@kernel at eqno
+%<latexrelease>\let\leqno\@kernel at leqno
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
+% \end{macro}
+% \end{macro}
 %
 %
 %
@@ -1322,6 +1342,5 @@
 % \end{environment}
 %
 %
-%
 % \Finale
 %

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltmeta.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltmeta.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltmeta.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,7 +1,8 @@
 % \iffalse meta-comment
 %
-%% File: ltmeta.dtx (C) Copyright 2021, 2022
-%       Frank Mittelbach, LaTeX Team
+%% File: ltmeta.dtx
+%% Copyright (C) 2021-2023
+%% Frank Mittelbach, The LaTeX Project
 %
 % It may be distributed and/or modified under the conditions of the
 % LaTeX Project Public License (LPPL), either version 1.3c of this

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltpara.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltpara.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltpara.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,7 +1,8 @@
 % \iffalse meta-comment
 %
-%% File: ltpara.dtx (C) Copyright 2020-2023
-%       Frank Mittelbach, LaTeX Team
+%% File: ltpara.dtx
+%% Copyright (C) 2020-2023
+%% Frank Mittelbach, The LaTeX Project
 %
 % It may be distributed and/or modified under the conditions of the
 % LaTeX Project Public License (LPPL), either version 1.3c of this

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltplain.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltplain.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltplain.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -32,7 +32,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltplain.dtx}
-             [2022/01/25 v2.3h LaTeX Kernel (Plain TeX)]
+             [2023/04/15 v2.3i LaTeX Kernel (Plain TeX)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltplain.dtx}
@@ -660,6 +660,10 @@
 \def\extrafloats#1{%
 \ifnum#1>\z@
 \count@\numexpr\float at count-1\relax
+%    \end{macrocode}
+% \changes{v2.3i}{2023/04/15}{Protect box 255 in lualatex gh/1041}
+%    \begin{macrocode}
+  \ifnum\count@<266 \ch at ck0\m at ne\insert\fi
   \ch at ck0\count@\count
   \ch at ck1\count@\dimen
   \ch at ck2\count@\skip
@@ -668,8 +672,12 @@
 \global\expandafter\e at alloc@chardef
             \csname bx@\the\float at count\endcsname\float at count
 \@cons\@freelist{\csname bx@\the\float at count\endcsname}%
-\expandafter
-\extrafloats\expandafter{\numexpr#1-1\relax}%
+%    \end{macrocode}
+% \changes{v2.3i}{2023/04/15}{unwind numexpr and ifnum nesting}
+%    \begin{macrocode}
+\expandafter\extrafloats\expandafter{\the\numexpr#1-1\expandafter}%
+%    \end{macrocode}
+%    \begin{macrocode}
 \fi}%
 %    \end{macrocode}
 %
@@ -880,7 +888,6 @@
 % but the code is commented out if no special value needs to be set.
 % INITEX makes all parameters zero except where noted.
 %
-% \begin{oldcomments}
 %    \begin{macrocode}
 \pretolerance=100
 \tolerance=200 % INITEX sets this to 10000
@@ -897,10 +904,14 @@
 \brokenpenalty=100
 \predisplaypenalty=10000
 %    \end{macrocode}
+%
+%    \begin{macrocode}
 % \postdisplaypenalty=0
 % \interlinepenalty=0
 % \floatingpenalty=0, set during \insert
 % \outputpenalty=0, set before TeX enters \output
+%    \end{macrocode}
+%
 %    \begin{macrocode}
 \doublehyphendemerits=10000
 \finalhyphendemerits=5000
@@ -971,6 +982,8 @@
 %    \begin{macrocode}
 \uchyph=1
 %    \end{macrocode}
+%
+%    \begin{macrocode}
 % \lefthyphenmin=2 \righthyphenmin=3 set below
 % \globaldefs=0
 % \maxdeadcycles=25 % INITEX does this
@@ -978,21 +991,29 @@
 % \fam=0
 % \mag=1000 % INITEX does this
 % \escapechar=`\\ % INITEX does this
+%    \end{macrocode}
+%
 %    \begin{macrocode}
 \defaulthyphenchar=`\-
 \defaultskewchar=-1
 %    \end{macrocode}
+%
+%    \begin{macrocode}
 % \endlinechar=`\^^M % INITEX does this
 % \newlinechar=-1     \LaTeX\ sets this in ltdefns.dtx.
+%    \end{macrocode}
+%
 %    \begin{macrocode}
 \delimiterfactor=901
 %    \end{macrocode}
+%
+%    \begin{macrocode}
 % \time=now % TeX does this at beginning of job
 % \day=now % TeX does this at beginning of job
 % \month=now % TeX does this at beginning of job
 % \year=now % TeX does this at beginning of job
+%    \end{macrocode}
 %
-% \end{oldcomments}
 %    In \LaTeX{} we don't want box information in the transcript
 %    unless we do a full tracing.
 %  \changes{v1.0g}{1994/04/28}{Turn off overfull box tracing in log}
@@ -1012,20 +1033,28 @@
 \boxmaxdepth=\maxdimen
 %    \end{macrocode}
 %
-% \begin{oldcomments}
+%    \begin{macrocode}
 % \lineskiplimit=0pt, changed by \normalbaselines
+%    \end{macrocode}
+%
 %    \begin{macrocode}
 \delimitershortfall=5pt
 \nulldelimiterspace=1.2pt
 \scriptspace=0.5pt
 %    \end{macrocode}
+%
+%    \begin{macrocode}
 % \mathsurround=0pt
 % \predisplaysize=0pt, set before TeX enters $$
 % \displaywidth=0pt, set before TeX enters $$
 % \displayindent=0pt, set before TeX enters $$
+%    \end{macrocode}
+%
 %    \begin{macrocode}
 \parindent=20pt
 %    \end{macrocode}
+%
+%    \begin{macrocode}
 % \hangindent=0pt, zeroed by TeX after each paragraph
 % \hoffset=0pt
 % \voffset=0pt
@@ -1032,6 +1061,8 @@
 %
 % \baselineskip=0pt, changed by \normalbaselines
 % \lineskip=0pt, changed by \normalbaselines
+%    \end{macrocode}
+%
 %    \begin{macrocode}
 \parskip=0pt plus 1pt
 \abovedisplayskip=12pt plus 3pt minus 9pt
@@ -1039,19 +1070,26 @@
 \belowdisplayskip=12pt plus 3pt minus 9pt
 \belowdisplayshortskip=7pt plus 3pt minus 4pt
 %    \end{macrocode}
+%
+%    \begin{macrocode}
 % \leftskip=0pt
 % \rightskip=0pt
+%    \end{macrocode}
+%
 %    \begin{macrocode}
 \topskip=10pt
 \splittopskip=10pt
 %    \end{macrocode}
+%
+%    \begin{macrocode}
 % \tabskip=0pt
 % \spaceskip=0pt
 % \xspaceskip=0pt
+%    \end{macrocode}
+%
 %    \begin{macrocode}
 \parfillskip=0pt plus 1fil
 %    \end{macrocode}
-% \end{oldcomments}
 %
 %
 % \begin{macro}{\normalbaselineskip}
@@ -1215,7 +1253,7 @@
   \gdef\obeylines{\catcode`\^^M\active%
     \let^^M\obeyedline%
 %    \end{macrocode}
-%    
+%
 %    The next line ending the definition is rather curious and it took
 %    me awhile to understand why rollback fails. The problem is the
 %    following: if \texttt{latexrelease} is used, then blocks of

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltshipout.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltshipout.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltshipout.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,7 +1,7 @@
 % \iffalse meta-comment
 %%
 %% Copyright (C) 2020-2023
-%%               Frank Mittelbach, LaTeX Team
+%% Frank Mittelbach, The LaTeX Project
 %%
 %
 % This file is part of the LaTeX base system.

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltspace.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltspace.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltspace.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -32,7 +32,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltspace.dtx}
-             [2022/11/28 v1.3o LaTeX Kernel (spacing)]
+             [2023/03/22 v1.3p LaTeX Kernel (spacing)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltspace.dtx}
@@ -308,8 +308,10 @@
 %  \end{macro}
 %
 %  \begin{macro}{\samepage}
+% \changes{v1.3p}{2023/03/22}{Add \cs{predisplaypenalty} setting (gh/1022)}
 %    \begin{macrocode}
 \DeclareRobustCommand\samepage{\interlinepenalty\@M
+   \predisplaypenalty\@M
    \postdisplaypenalty\@M
    \interdisplaylinepenalty\@M
    \@beginparpenalty\@M

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltvers.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltvers.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltvers.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -115,7 +115,7 @@
    {2023-06-01}
 %</2ekernel|latexrelease>
 %<*2ekernel>
-\def\patch at level{-2}
+\def\patch at level{-3}
 %    \end{macrocode}
 %
 % \begin{macro}{\development at branch@name}

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltxdoc.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltxdoc.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltxdoc.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -30,7 +30,7 @@
 %
 %<class>\NeedsTeXFormat{LaTeX2e}
 %<class>\ProvidesClass{ltxdoc}
-%<class>         [2022/06/22 v2.1i Standard LaTeX documentation class]
+%<class>         [2023/03/28 v2.1j Standard LaTeX documentation class]
 %
 %<*driver>
 \documentclass{ltxdoc}
@@ -182,9 +182,13 @@
 %
 %    Support rolling back \pkg{doc} to version 2:
 % \changes{v2.1e}{2022/05/27}{Support rolling  back doc to version 2}
+% \changes{v2.1j}{2023/03/28}{Define \cs{cs} if doc is rolled back to v2 (gh/981)}
 %    \begin{macrocode}
 \let\ltxdoc at doc@version\@empty  % use current version by default
-\DeclareOption{doc2}{\def\ltxdoc at doc@version{=v2}}
+\DeclareOption{doc2}{%
+  \def\ltxdoc at doc@version{=v2}%
+  \DeclareRobustCommand\cs[1]{\texttt{\bslash #1}}%
+}
 %    \end{macrocode}
 % 
 %    \begin{macrocode}
@@ -670,8 +674,10 @@
 % kernel sources.
 %
 %
-% Copyright 2006, 2007, 2011 Heiko Oberdiek
-% Copyright 2014-2021 The LaTeX Project
+% Copyright 2006, 2007, 2011
+% Heiko Oberdiek
+% Copyright (C) 2014-2023
+% The LaTeX Project
 % 
 
 \ProvidesFile{ltxdoc.cfg}%

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltxref.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltxref.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltxref.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltxref.dtx}
-             [2022/04/12 v1.1p LaTeX Kernel (Cross Referencing)]
+             [2023/05/16 v1.1q LaTeX Kernel (Cross Referencing)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltxref.dtx}
@@ -93,6 +93,15 @@
 %  to align with the use of \pkg{hyperref}. Without \pkg{hyperref} (or some
 %  other package using the starred form) the star is simply ignored.
 %
+%  Note: starting with 2023-06-01 |\label| stores also the current value
+%  of |\@currentlabelname| which should typically contain a (sanitized) title.
+%  (A reference command |\nameref| is provided by the \pkg{nameref} package.)
+%  |\label| also stores |\@currentHref| which if set should refer to a target name
+%  for links. This value is set and used by \pkg{hyperref}. Unlike the other values
+%  |\@currentHref| should be set globally. A fifth value |\@kernel at reserved@label at data|
+%  is reserved for the kernel to allow future extensions of the cross-reference
+%  system.
+%    
 %
 % \MaybeStop{}
 %
@@ -108,7 +117,8 @@
 %  incremented by the command  \refstepcounter{CNT} , which sets
 %  \@currentlabel == {CNT}{eval(\p at cnt\theCNT)}.   The command
 %  \label{FOO} then writes the following on file \@auxout :
-%        \newlabel{FOO}{{eval(\@currentlabel)}{eval(\thepage)}}
+%        \newlabel{FOO}{{eval(\@currentlabel)}{eval(\thepage)}%
+%           {eval(\@currentlabelname)}{eval(\@currentHref)}{eval(\@kernel at reserved@label at data)}}
 %
 %  \ref{FOO} ==
 %    BEGIN
@@ -228,6 +238,10 @@
 %
 % RmS 93/09/08: Added setting of refundefined switch.
 %    \begin{macrocode}
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2023/06/01}%
+%<latexrelease>                 {\@kernel at sref}{store five arguments}%
 \def\@setref#1#2#3{%
   \ifx#1\relax
    \protect\G at refundefinedtrue
@@ -235,19 +249,53 @@
    \@latex at warning{Reference `#3' on page \thepage \space
              undefined}%
   \else
-   \expandafter#2#1\null
+   \expandafter#2#1\@empty\@empty\@empty\null
   \fi}
 %    \end{macrocode}
 %    \begin{macrocode}
-%</2ekernel>
-%<*2ekernel|latexrelease>
+\long\def\@firstoffive#1#2#3#4#5{#1}
+\long\def\@secondoffive#1#2#3#4#5{#2}
+\def\@kernel at sref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoffive{#1}}
+\def\@kernel at spageref#1{\expandafter\@setref\csname r@#1\endcsname
+                 \@secondoffive{#1}}
+%<latexrelease>\EndIncludeInRelease
 %<latexrelease>\IncludeInRelease{2022/06/01}%
+%<latexrelease>                 {\@kernel at sref}{store five arguments}%
+%<latexrelease>\def\@setref#1#2#3{%
+%<latexrelease>  \ifx#1\relax
+%<latexrelease>   \protect\G at refundefinedtrue
+%<latexrelease>   \nfss at text{\reset at font\bfseries ??}%
+%<latexrelease>   \@latex at warning{Reference `#3' on page \thepage \space
+%<latexrelease>             undefined}%
+%<latexrelease>  \else
+%<latexrelease>   \expandafter#2#1\null
+%<latexrelease>  \fi}
+%<latexrelease>\let\@firstoffive\undefined
+%<latexrelease>\let\@secondoffive\undefined
+%<latexrelease>\def\@kernel at sref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}}
+%<latexrelease>\def\@kernel at spageref#1{\expandafter\@setref\csname r@#1\endcsname
+%<latexrelease>                 \@secondoftwo{#1}}
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease>                 {\@kernel at sref}{store five arguments}%
+%<latexrelease>\def\@setref#1#2#3{%
+%<latexrelease>  \ifx#1\relax
+%<latexrelease>   \protect\G at refundefinedtrue
+%<latexrelease>   \nfss at text{\reset at font\bfseries ??}%
+%<latexrelease>   \@latex at warning{Reference `#3' on page \thepage \space
+%<latexrelease>             undefined}%
+%<latexrelease>  \else
+%<latexrelease>   \expandafter#2#1\null
+%<latexrelease>  \fi}
+%<latexrelease>\let\@firstoffive\undefined
+%<latexrelease>\let\@secondoffive\undefined
+%<latexrelease>\let\@kernel at sref\undefined
+%<latexrelease>\let\@kernel at spageref\undefined
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2022/06/01}%
 %<latexrelease>                 {\ref}{Add starred reference commands}%
 %    \end{macrocode}
 %    \begin{macrocode}
-\def\@kernel at sref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}}
-\def\@kernel at spageref#1{\expandafter\@setref\csname r@#1\endcsname
-                 \@secondoftwo{#1}}
 \let\@kernel at ref\@kernel at sref
 \let\@kernel at pageref\@kernel at spageref
 \NewDocumentCommand\ref{s}
@@ -334,6 +382,8 @@
 %  \begin{macro}{\label}
 % \changes{v1.1d}{1994/11/04}{(ASAJ)Added \cs{protected at write}}
 % \changes{v1.1d}{1994/11/04}{(ASAJ)Added \cs{protected at edef}}
+% \changes{v1.1q}{2023/05/12}{(UFi)extended to store five arguments}
+% \changes{v1.1q}{2023/05/12}{(UFi)added a hook with argument} 
 %    The commands |\label| and |\refstepcounter| have been changed to
 %    allow |\protect|'ed commands to work properly.  For example,
 %\begin{verbatim}
@@ -343,16 +393,27 @@
 %    to something like |\foo{4.d}|.  Change made 20 Jul 88.
 %
 %    \begin{macrocode}
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2023/06/01}%
+%<latexrelease>                 {\label}{store five label arguments}%
+\providecommand\@currentlabelname{}
+\providecommand\@currentHref{}
+\providecommand\@kernel at reserved@label at data{}
+\NewHookWithArguments{label}{1}
 \def\label#1{\@bsphack
+  \begingroup
+  \UseHookWithArguments{label}{1}{#1}%
   \protected at write\@auxout{}%
-         {\string\newlabel{#1}{{\@currentlabel}{\thepage}}}%
+         {\string\newlabel{#1}{{\@currentlabel}{\thepage}%
+          {\@currentlabelname}{\@currentHref}{\@kernel at reserved@label at data}}}%
+  \endgroup        
   \@esphack}
+%<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 % \end{macro}
 %
 %    \begin{macrocode}
-%</2ekernel>
-%<*2ekernel|latexrelease>
 %<latexrelease>\IncludeInRelease{2022/06/01}%
 %<latexrelease>                 {\Ref}{Add starred version}%
 %    \end{macrocode}
@@ -432,6 +493,16 @@
 %    \begin{macrocode}
 %</2ekernel|latexrelease>
 %<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease>                 {\label}{store five label arguments}%
+%<latexrelease>\let\@currenttitle\@undefined
+%<latexrelease>\let\@currenttarget\@undefined
+%<latexrelease>\let\@kernel at currentdata\@undefined
+%<latexrelease>\def\label#1{\@bsphack
+%<latexrelease>  \protected at write\@auxout{}%
+%<latexrelease>         {\string\newlabel{#1}{{\@currentlabel}{\thepage}}}%
+%<latexrelease>  \@esphack}
+%<latexrelease>\EndIncludeInRelease
 %<latexrelease>\IncludeInRelease{2020/10/01}%
 %<latexrelease>                 {\Ref}{Add starred version}%
 %<latexrelease>\def\@currentcounter{}

Modified: trunk/Master/texmf-dist/source/latex-dev/base/slifonts.fdd
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/slifonts.fdd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/slifonts.fdd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 1993-2019
+% Copyright (C) 1993-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %

Modified: trunk/Master/texmf-dist/source/latex-dev/base/tulm.fdd
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/tulm.fdd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/base/tulm.fdd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 2016-2021
+% Copyright (C) 2016-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/afterpage.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/afterpage.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/afterpage.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/afterpage.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/afterpage.ins	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/afterpage.ins	2023-05-25 20:39:11 UTC (rev 67218)
@@ -3,7 +3,7 @@
 %% driver files from the doc files in this package when run through
 %% LaTeX or TeX.
 %%
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %%
@@ -45,7 +45,7 @@
 reports for it can be opened at https://latex-project.org/bugs/
 (but please observe conditions on bug reports sent to that address!)
 
-Copyright (C) 1993-2022
+Copyright (C) 1993-2023
 The LaTeX Project and any individual authors listed elsewhere
 in this file.
 

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/array.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/array.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/array.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/bm.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/bm.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/bm.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/bm.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/bm.ins	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/bm.ins	2023-05-25 20:39:11 UTC (rev 67218)
@@ -3,7 +3,7 @@
 %% driver files from the doc files in this package when run through
 %% LaTeX or TeX.
 %%
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %%
@@ -45,7 +45,7 @@
 reports for it can be opened at https://latex-project.org/bugs/
 (but please observe conditions on bug reports sent to that address!)
 
-Copyright (C) 1993-2022
+Copyright (C) 1993-2023
 The LaTeX Project and any individual authors listed elsewhere
 in this file.
 

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/calc.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/calc.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/calc.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/dcolumn.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/dcolumn.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/dcolumn.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/delarray.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/delarray.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/delarray.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/enumerate.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/enumerate.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/enumerate.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/fileerr.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/fileerr.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/fileerr.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/fontsmpl.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/fontsmpl.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/fontsmpl.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/ftnright.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/ftnright.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/ftnright.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/hhline.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/hhline.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/hhline.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/indentfirst.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/indentfirst.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/indentfirst.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/layout.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/layout.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/layout.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/longtable.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/longtable.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/longtable.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/longtable.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/longtable.ins	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/longtable.ins	2023-05-25 20:39:11 UTC (rev 67218)
@@ -3,7 +3,7 @@
 %% driver files from the doc files in this package when run through
 %% LaTeX or TeX.
 %%
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %%
@@ -45,7 +45,7 @@
 reports for it can be opened at https://latex-project.org/bugs/
 (but please observe conditions on bug reports sent to that address!)
 
-Copyright (C) 1993-2022
+Copyright (C) 1993-2023
 The LaTeX Project and any individual authors listed elsewhere
 in this file.
 

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/multicol.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/multicol.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/multicol.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -20,7 +20,7 @@
 % \iffalse    This is a METACOMMENT
 %
 %% Package `multicol' to use with LaTeX2e
-%% Copyright 1989-2019 Frank Mittelbach
+%% Copyright 1989-2023 Frank Mittelbach
 %%
 %%  In addition to the terms of LPPL any distributed version
 %%  (unchanged or modified) of multicol has to keep the statement
@@ -99,7 +99,7 @@
 %<driver> \ProvidesFile{multicol.drv}
 % \fi
 %         \ProvidesFile{multicol.dtx}
-          [2021/11/30 v1.9d  multicolumn formatting (FMi)]
+          [2023/03/30 v1.9f  multicolumn formatting (FMi)]
 %
 %
 %%
@@ -1760,14 +1760,27 @@
                  \kept at firstmark
     \return at nonemptymark{bot}%
                   \kept at botmark
-    \page at sofar
 %    \end{macrocode}
+%    When the boxed multicol is returned to the page it can happen
+%    that it doesn't fit onto it and \LaTeX{} therefore breaks
+%    earlier. The problem in that case is that during the generation
+%    \cs{hsize}, etc.\ got changed and this setting is still in effect
+%    right now, and if this boxed multicol is within, say,
+%    \texttt{multicols*} then its output routine gets very upset. We
+%    therefore delay returning the result by saving it in box for now
+%    until we have left the group below.
+% \changes{v1.9e}{2023/02/25}{Delay returning boxed multicols (gh/1002)}
+%    \begin{macrocode}
+    \global\setbox\mc at boxedresult\vbox{%    
+      \page at sofar
+%    \end{macrocode}
 %
 %    \begin{macrocode}
-    \global\let\kept at firstmark
-               \l at kept@firstmark
-    \global\let\kept at botmark
-            \l at kept@botmark
+      \global\let\kept at firstmark
+                 \l at kept@firstmark
+      \global\let\kept at botmark
+                 \l at kept@botmark
+    }%
 %<*marktrace>
     \mult at info\tw@
       {Restore kept marks to\MessageBreak
@@ -1879,12 +1892,15 @@
 %    \end{macrocode}
 %    Now it's time to return any footnotes if we are in unrestricted
 %    mode. In boxed mode footnotes are kept inside, but in that case
-%    we have to write another column status into the \texttt{.aux}
+%    we have to first return the saved box to the page and then write
+%    another column status into the \texttt{.aux}
 %    file to support \cs{docolaction} in case we have nested
 %    environments.
 % \changes{v1.8s}{2018/04/20}{Support for \cs{docolaction} (issue/39)}
+% \changes{v1.9e}{2023/02/25}{Delay returning boxed multicols (gh/1002)}
 %    \begin{macrocode}
   \if at boxedmulticols
+    \unvbox\mc at boxedresult
     \mc at col@status at write
   \else
     \reinsert at footnotes
@@ -1949,6 +1965,7 @@
 % \SpecialMainIndex{\multicolsep}
 % \SpecialMainIndex{\multicolbaselineskip}
 % \SpecialMainIndex{\partial at page}
+% \SpecialMainIndex{\mc at boxedresult}
 %    Let us end this section by allocating all the registers used so
 %    far.
 %    \begin{macrocode}
@@ -1970,6 +1987,7 @@
 \newskip\multicolbaselineskip
 \newbox\partial at page
 \newbox\last at line
+\newbox\mc at boxedresult
 %    \end{macrocode}
 %    And here are their default values:
 %    \begin{macrocode}
@@ -2119,8 +2137,9 @@
 %    of the character ``p'' since that is one of the depths that
 %    compete for the maximum.
 % \changes{v1.6a}{2003/03/15}{Preparing for adjusting \cs{prevdepth}}
+% \changes{v1.9f}{2023/03/30}{Make column min depth customizable (gh/698)}
 %    \begin{macrocode}
-   \setbox\z@\hbox{p}\global\dimen\tw@\dp\z@
+   \setbox\z@\hbox{\multicolmindepthstring}\global\dimen\tw@\dp\z@
    \moveright\multicol at leftmargin
     \hbox to\full at width{%
 %    \end{macrocode}
@@ -2135,9 +2154,11 @@
 %    The depths of the columns depend on their last lines. To ensure
 %    that we will always get a similar look as far as the rules are
 %    concerned we force the depth to be at least the depth of a
-%    letter~`p' (which is what we set |\dimen2| to above).
+%    letter~`p' or more exactly \cs{multicolmindepthstring} (which is what
+%    we set |\dimen2| to above).
+% \changes{v1.9f}{2023/03/30}{Make column min depth customizable (gh/698)}
 %    \begin{macrocode}
-       \rlap{\phantom p}%
+       \rlap{\phantom \multicolmindepthstring}%
     }%
 %    \end{macrocode}
 %    The processed material might consist of a last line with a
@@ -2179,6 +2200,23 @@
 %    \end{macrocode}
 % \end{macro}
 %
+%
+%  \begin{macro}{\multicolmindepthstring}
+%    The default minimum depth of each column corresponds to the depth
+%    of a `p' in the current font. This makes sense for Latin-based
+%    languages and was hard-wired intitially, but for Asian languages
+%    it is better to use a zero depth (and alternatively one might
+%    want to use the depth of a strut or a parentheses). So we now
+%    offer a way to adjust this while maintaining backward
+%    compatibility. Use \cs{renewcommand} to alter it.
+% \changes{v1.9f}{2023/03/30}{Make column min depth customizable (gh/698)}
+%    \begin{macrocode}
+\def\multicolmindepthstring{p}
+%    \end{macrocode}
+%  \end{macro}
+%
+%
+%
 % \begin{macro}{\columnseprulecolor}
 % \changes{v1.6f}{2006/09/19}{Make the color of the rule a hook}
 %    By default the vertical rule between columns will be in |\normalcolor|.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/multicol.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/multicol.ins	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/multicol.ins	2023-05-25 20:39:11 UTC (rev 67218)
@@ -3,7 +3,7 @@
 %% driver files from the doc files in this package when run through
 %% LaTeX or TeX.
 %%
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %%
@@ -45,7 +45,7 @@
 reports for it can be opened at https://latex-project.org/bugs/
 (but please observe conditions on bug reports sent to that address!)
 
-Copyright (C) 1993-2022
+Copyright (C) 1993-2023
 The LaTeX Project and any individual authors listed elsewhere
 in this file.
 

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/rawfonts.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/rawfonts.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/rawfonts.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/shellesc.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/shellesc.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/shellesc.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse
 %% Source File: shellesc.dtx
-%% Copyright (C) 2015-2022
+%% Copyright (C) 2015-2023
 %%
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
@@ -20,7 +20,7 @@
 %<driver> \ProvidesFile{shellesc.drv}
 % \fi
 %         \ProvidesFile{shellesc.dtx}
-       [2019/11/08 v1.0c unified shell escape interface for LaTeX]
+       [2023/04/15 v1.0d unified shell escape interface for LaTeX]
 %
 % \iffalse
 %<*driver>
@@ -189,6 +189,7 @@
 %
 % \begin{macro}{\ShellEscape at Lua}
 % \changes{v1.0a}{2019/10/13}{loging for gh/195}
+% \changes{v1.0d}{2023/04/15}{Add dots in messages gh/1008}
 % Shared Lua code for \verb|\DelayedShellEscape| and \verb|\ShellEscape|.
 %    \begin{macrocode}
 \ifx\directlua\@undefined\else
@@ -197,15 +198,15 @@
 if status == nil then
     texio.write_nl("log",%
       "runsystem(" .. "\luaescapestring{#1}"%
-       .. ")...(" .. msg .. ")\string\n")
+       .. ")...(" .. msg .. ").\string\n")
   elseif status == 0 then
     texio.write_nl("log",%
       "runsystem(" .. "\luaescapestring{#1}"%
-      .. ")...executed\string\n")
+      .. ")...executed.\string\n")
   else
     texio.write_nl("log",%
       "runsystem(" .. "\luaescapestring{#1}"%
-       .. ")...failed " .. (msg or "") .. "\string\n")
+       .. ")...failed. " .. (msg or "") .. "\string\n")
   end
 }}
 \fi

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/showkeys.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/showkeys.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/showkeys.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
@@ -39,7 +39,7 @@
 %<driver> \ProvidesFile{showkeys.drv}
 % \fi
 %         \ProvidesFile{showkeys.dtx}
-          [2022/04/12 v3.18 Show cite and label keys (DPC, MH)]
+          [2023/05/11 v3.19 Show cite and label keys (DPC, MH)]
 %
 % \iffalse
 %<*driver>
@@ -342,16 +342,20 @@
 % \begin{macro}{\label}
 % \changes{v3.09}{1996/08/30}
 %      {Add extra group so brace hack works. Donald Arseneau tools/2147}
+% \changes{v3.19}{2023/05/11}
+%      {Use label hook if format is new enough.}
 % The new definition, print the argument, and then do the old
 % definition.
 %    \begin{macrocode}
-\def\label#1{%
+\@ifl at t@r\fmtversion{2023-06-01}
+ {\AddToHookWithArguments{label}{\SK@\SK@@label{#1}}}
+ {\def\label#1{%
   \@bsphack
   \SK@\SK@@label{#1}%
   \begingroup
     \SK at label{#1}%
   \endgroup
-  \@esphack}
+  \@esphack}}
 %    \end{macrocode}
 % \end{macro}
 %

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/somedefs.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/somedefs.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/somedefs.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/tabularx.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/tabularx.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/tabularx.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/tabularx.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/tabularx.ins	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/tabularx.ins	2023-05-25 20:39:11 UTC (rev 67218)
@@ -3,7 +3,7 @@
 %% driver files from the doc files in this package when run through
 %% LaTeX or TeX.
 %%
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %%
@@ -45,7 +45,7 @@
 reports for it can be opened at https://latex-project.org/bugs/
 (but please observe conditions on bug reports sent to that address!)
 
-Copyright (C) 1993-2022
+Copyright (C) 1993-2023
 The LaTeX Project and any individual authors listed elsewhere
 in this file.
 

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/theorem.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/theorem.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/theorem.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/tools.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/tools.ins	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/tools.ins	2023-05-25 20:39:11 UTC (rev 67218)
@@ -3,7 +3,7 @@
 %% driver files from the doc files in this package when run through
 %% LaTeX or TeX.
 %%
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %%
@@ -49,7 +49,7 @@
 (but please observe conditions on bug reports sent to that address!)
 
 
-Copyright (C) 1993-2022
+Copyright (C) 1993-2023
 The LaTeX Project and any individual authors listed elsewhere
 in this file.
 

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/trace.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/trace.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/trace.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/varioref.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/varioref.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/varioref.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/varioref.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/varioref.ins	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/varioref.ins	2023-05-25 20:39:11 UTC (rev 67218)
@@ -3,7 +3,7 @@
 %% driver files from the doc files in this package when run through
 %% LaTeX or TeX.
 %%
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %%
@@ -45,7 +45,7 @@
 reports for it can be opened at https://latex-project.org/bugs/
 (but please observe conditions on bug reports sent to that address!)
 
-Copyright (C) 1993-2022
+Copyright (C) 1993-2023
 The LaTeX Project and any individual authors listed elsewhere
 in this file.
 

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/verbatim.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/verbatim.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/verbatim.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/xr.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/xr.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/xr.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/source/latex-dev/tools/xspace.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/tools/xspace.dtx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/source/latex-dev/tools/xspace.dtx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 %
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.

Modified: trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsbsy.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsbsy.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsbsy.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -7,7 +7,7 @@
 %% amsbsy.dtx 
 %% 
 %% Copyright (C) 1995, 1999 American Mathematical Society.
-%% Copyright (C) 2016-2022 LaTeX Project and American Mathematical Society.
+%% Copyright (C) 2016-2023 LaTeX Project and American Mathematical Society.
 %% 
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/tex/latex-dev/amsmath/amscd.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/amsmath/amscd.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/amsmath/amscd.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -7,7 +7,7 @@
 %% amscd.dtx 
 %% 
 %% Copyright (C) 1995, 1999 American Mathematical Society.
-%% Copyright (C) 2016-2022  LaTeX Project and American Mathematical Society.
+%% Copyright (C) 2016-2023  LaTeX Project and American Mathematical Society.
 %% 
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsgen.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsgen.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsgen.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -7,7 +7,7 @@
 %% amsgen.dtx 
 %% 
 %% Copyright (C) 1995, 1999 American Mathematical Society.
-%% Copyright (C) 2016-2022  LaTeX Project and American Mathematical Society.
+%% Copyright (C) 2016-2023  LaTeX Project and American Mathematical Society.
 %% 
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsmath.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsmath.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsmath.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -7,7 +7,7 @@
 %% amsmath.dtx 
 %% 
 %% Copyright (C) 1995, 1999, 2000, 2013 American Mathematical Society.
-%% Copyright (C) 2016-2022  LaTeX Project and American Mathematical Society.
+%% Copyright (C) 2016-2023  LaTeX Project and American Mathematical Society.
 %% 
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3c
@@ -27,7 +27,7 @@
 \providecommand\DeclareCurrentRelease[2]{}
 \DeclareRelease{}{2018-12-01}{amsmath-2018-12-01.sty}
 \DeclareCurrentRelease{}{2019-04-01}
-\ProvidesPackage{amsmath}[2022/04/08 v2.17n AMS math features]
+\ProvidesPackage{amsmath}[2023/05/13 v2.17o AMS math features]
 \edef\@temp{\catcode 96=\number\catcode 96 }
 \catcode\string `\`=12
 \def\do#1{\catcode\number`#1=\number\catcode`#1}
@@ -2766,8 +2766,8 @@
         }
     \fi
 \fi
-\@saveprimitive\leqno\@@leqno
-\@saveprimitive\eqno\@@eqno
+\let\@@eqno\eqno
+\let\@@leqno\leqno
 \def\eqno{\@@eqno\let\eqno\relax\let\leqno\relax}
 \def\leqno{\@@leqno\let\leqno\relax\let\eqno\relax}
 \let\veqno=\@@eqno

Modified: trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsopn.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsopn.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsopn.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -7,7 +7,7 @@
 %% amsopn.dtx 
 %% 
 %% Copyright (C) 1995, 1999 American Mathematical Society.
-%% Copyright (C) 2016-2022  LaTeX Project and American Mathematical Society.
+%% Copyright (C) 2016-2023  LaTeX Project and American Mathematical Society.
 %% 
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/tex/latex-dev/amsmath/amstext.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/amsmath/amstext.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/amsmath/amstext.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -7,7 +7,7 @@
 %% amstext.dtx 
 %% 
 %% Copyright (C) 1995, 1999 American Mathematical Society.
-%% Copyright (C) 2016-2022  LaTeX Project and American Mathematical Society.
+%% Copyright (C) 2016-2023  LaTeX Project and American Mathematical Society.
 %% 
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsxtra.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsxtra.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/amsmath/amsxtra.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -7,7 +7,7 @@
 %% amsxtra.dtx 
 %% 
 %% Copyright (C) 1995, 1999 American Mathematical Society.
-%% Copyright (C) 2016-2022  LaTeX Project and American Mathematical Society.
+%% Copyright (C) 2016-2023  LaTeX Project and American Mathematical Society.
 %% 
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/article.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/article.cls	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/article.cls	2023-05-25 20:39:11 UTC (rev 67218)
@@ -43,7 +43,7 @@
 %% extension .ins) which are part of the distribution.
 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
 \ProvidesClass{article}
-              [2022/07/02 v1.4n
+              [2023/05/17 v1.4n
  Standard LaTeX document class]
 \newcommand\@ptsize{}
 \newif\if at restonecol

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/atbegshi-ltx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/atbegshi-ltx.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/atbegshi-ltx.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -43,7 +43,7 @@
 %% extension .ins) which are part of the distribution.
 %%
 %% Copyright (C) 2020-2023
-%%               Frank Mittelbach, LaTeX Team
+%% Frank Mittelbach, The LaTeX Project
 %%
 %%% From File: ltshipout.dtx
 \providecommand\ltshipoutversion{v1.0n}

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/atveryend-ltx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/atveryend-ltx.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/atveryend-ltx.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -42,8 +42,8 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension .ins) which are part of the distribution.
 %%% From File: ltfilehook.dtx
-\providecommand\ltfilehookversion{v1.0n}
-\providecommand\ltfilehookdate{2022/08/18}
+\providecommand\ltfilehookversion{v1.0o}
+\providecommand\ltfilehookdate{2023/04/02}
 \ProvidesPackage{atveryend-ltx}
    [2020/08/19 v1.0a
      Emulation of the original atveryend package^^Jwith kernel methods]

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/bk10.clo
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/bk10.clo	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/bk10.clo	2023-05-25 20:39:11 UTC (rev 67218)
@@ -42,7 +42,7 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension .ins) which are part of the distribution.
 \ProvidesFile{bk10.clo}
-              [2022/07/02 v1.4n
+              [2023/05/17 v1.4n
       Standard LaTeX file (size option)]
 \renewcommand\normalsize{%
    \@setfontsize\normalsize\@xpt\@xiipt

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/bk11.clo
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/bk11.clo	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/bk11.clo	2023-05-25 20:39:11 UTC (rev 67218)
@@ -42,7 +42,7 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension .ins) which are part of the distribution.
 \ProvidesFile{bk11.clo}
-              [2022/07/02 v1.4n
+              [2023/05/17 v1.4n
       Standard LaTeX file (size option)]
 \renewcommand\normalsize{%
    \@setfontsize\normalsize\@xipt{13.6}%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/bk12.clo
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/bk12.clo	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/bk12.clo	2023-05-25 20:39:11 UTC (rev 67218)
@@ -42,7 +42,7 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension .ins) which are part of the distribution.
 \ProvidesFile{bk12.clo}
-              [2022/07/02 v1.4n
+              [2023/05/17 v1.4n
       Standard LaTeX file (size option)]
 \renewcommand\normalsize{%
    \@setfontsize\normalsize\@xiipt{14.5}%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/book.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/book.cls	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/book.cls	2023-05-25 20:39:11 UTC (rev 67218)
@@ -43,7 +43,7 @@
 %% extension .ins) which are part of the distribution.
 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
 \ProvidesClass{book}
-              [2022/07/02 v1.4n
+              [2023/05/17 v1.4n
  Standard LaTeX document class]
 \newcommand\@ptsize{}
 \newif\if at restonecol

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/latex.ltx
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/latex.ltx	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/latex.ltx	2023-05-25 20:39:11 UTC (rev 67218)
@@ -432,6 +432,7 @@
 \def\extrafloats#1{%
 \ifnum#1>\z@
 \count@\numexpr\float at count-1\relax
+  \ifnum\count@<266 \ch at ck0\m at ne\insert\fi
   \ch at ck0\count@\count
   \ch at ck1\count@\dimen
   \ch at ck2\count@\skip
@@ -440,8 +441,7 @@
 \global\expandafter\e at alloc@chardef
             \csname bx@\the\float at count\endcsname\float at count
 \@cons\@freelist{\csname bx@\the\float at count\endcsname}%
-\expandafter
-\extrafloats\expandafter{\numexpr#1-1\relax}%
+\expandafter\extrafloats\expandafter{\the\numexpr#1-1\expandafter}%
 \fi}%
 \fi
 \def\alloc@#1#2#3#4{\e at alloc#2#3{\count1#1}#4\float at count}
@@ -706,7 +706,7 @@
 \def\fmtname{LaTeX2e}
 \edef\fmtversion
    {2023-06-01}
-\def\patch at level{-2}
+\def\patch at level{-3}
 \edef\development at branch@name{develop \the\year-\the\month-\the\day}
 \iffalse
 \def\reserved at a#1/#2/#3\@nil{%
@@ -1803,8 +1803,8 @@
     \xdef#1{\the\toks@}%
   \endgroup}
 %%% From File: ltcmd.dtx
-\def\ltcmdversion{v1.1b}
-\def\ltcmddate{2022-11-29}
+\def\ltcmdversion{v1.1d}
+\def\ltcmddate{2023-04-13}
 \message{document commands,}
 \ExplSyntaxOn
 \tl_new:N \l__cmd_arg_spec_tl
@@ -2873,7 +2873,9 @@
     \__cmd_set_eq_if_exist:cc { #1 ~ \c_space_tl } { #2 ~ \c_space_tl }
     \__cmd_set_eq_if_exist:cc { #1 ~ defaults } { #2 ~ defaults }
     \exp_after:wN \__cmd_copy_expandable_signature:NnNNNNnnn #4 {#1} {#2}
-    \cs_set_nopar:Npx #3
+    \token_if_protected_macro:NTF #4
+      { \cs_set_protected_nopar:Npx }{ \cs_set_nopar:Npx }
+      #3
       { \exp_after:wN \__cmd_copy_expandable:NnNNNNnnn #4 {#1} {#2} }
   }
 \cs_new:Npn \__cmd_copy_expandable:NnNNNNnnn #1 #2 #3 #4 #5 #6 #7 #8 #9
@@ -3018,8 +3020,9 @@
   { \exp_after:wN \__cmd_show_expandable:NnNNNNnN #1 #1 }
 \cs_new_protected:Npn \__cmd_show_expandable:NnNNNNnN #1 #2 #3 #4 #5 #6 #7 #8
   {
-    \__cmd_show_command_aux:NnNNn \tl_show:x
-      { expandable~document~command } #8 #5 {#2}
+    \exp_args:NNe \__cmd_show_command_aux:NnNNn \tl_show:x
+      { \token_if_protected_macro:NF #8 { expandable~ } document~command }
+      #8 #5 {#2}
   }
 \cs_new_protected:Npn \__cmd_show_command_aux:NnNNn #1 #2 #3 #4 #5
   {
@@ -3472,6 +3475,7 @@
     \tl_set:Nn \l__cmd_signature_tl {#1}
     \group_begin:
       \tex_escapechar:D = 92 \scan_stop:
+      \tex_endlinechar:D = `\^^M \scan_stop:
       \tl_clear:N \l__cmd_v_arg_tl
       \peek_remove_spaces:n
         {
@@ -3489,8 +3493,8 @@
   }
 \cs_new_protected:Npn \__cmd_grab_v_group_end:
   {
-        \exp_args:NNNo
-      \group_end:
+      \exp_args:NNNo
+    \group_end:
     \tl_set:Nn \l__cmd_v_arg_tl { \l__cmd_v_arg_tl }
   }
 \cs_new_protected:Npn \__cmd_grab_v_aux_test:N #1
@@ -3568,7 +3572,6 @@
   {
     \cs_set_eq:NN \do \char_set_catcode_other:N
     \dospecials
-    \tex_endlinechar:D = `\^^M \scan_stop:
     \bool_if:NTF \l__cmd_long_bool
       { \char_set_catcode_other:n { \tex_endlinechar:D } }
       { \char_set_catcode_parameter:n { \tex_endlinechar:D } }
@@ -4617,8 +4620,8 @@
 \ExplSyntaxOff
 
 %%% From File: lthooks.dtx
-\def\lthooksversion{v1.0v}
-\def\lthooksdate{2022/06/15}
+\def\lthooksversion{v1.1d}
+\def\lthooksdate{2023/05/21}
 \ExplSyntaxOn
 \bool_new:N \g__hook_debug_bool
 \cs_new_eq:NN \__hook_debug:n \use_none:n
@@ -4649,61 +4652,77 @@
 \tl_new:N \g__hook_hook_curr_name_tl
 \seq_new:N \g__hook_name_stack_seq
 \cs_new_eq:NN \__hook_tmp:w ?
+\tl_const:Nn \c__hook_empty_tl { }
+\tl_const:Nn \c__hook_nine_parameters_tl { #1#2#3#4#5#6#7#8#9 }
 \cs_generate_variant:Nn \tl_gremove_once:Nn { Nx }
 \cs_generate_variant:Nn \tl_show:n { x }
 \cs_generate_variant:Nn \tl_log:n { x }
+\cs_generate_variant:Nn \tl_set:Nn { Ne }
+\cs_generate_variant:Nn \cs_replacement_spec:N { c }
+\cs_generate_variant:Nn \prop_put:Nnn { Nne }
+\cs_generate_variant:Nn \str_count:n { e }
 \scan_new:N \s__hook_mark
-\cs_new:Npn \__hook_clean_to_scan:w #1 \s__hook_mark { }
-\cs_new_protected:Npn \__hook_tl_set:Nn #1#2
-  { \cs_set_nopar:Npx #1 { \__kernel_exp_not:w {#2} } }
-\cs_new_protected:Npn \__hook_tl_set:Nx #1#2
-  { \cs_set_nopar:Npx #1 {#2} }
-\cs_generate_variant:Nn \__hook_tl_set:Nn { c }
-\cs_generate_variant:Nn \__hook_tl_set:Nx { c }
+\cs_new:Npn \__hook_use_none_delimit_by_s_mark:w #1 \s__hook_mark { }
+\cs_new:Npn \__hook_use_i_delimit_by_s_mark:nw #1 #2 \s__hook_mark {#1}
+\cs_new_protected:Npn \__hook_tl_set:cn #1#2
+  { \cs_set_nopar:cpx {#1} { \__kernel_exp_not:w {#2} } }
 \cs_new_protected:Npn \__hook_tl_gset:Nn #1#2
   { \cs_gset_nopar:Npx #1 { \__kernel_exp_not:w {#2} } }
-\cs_new_protected:Npn \__hook_tl_gset:No #1#2
-  { \cs_gset_nopar:Npx #1 { \__kernel_exp_not:w \exp_after:wN {#2} } }
 \cs_new_protected:Npn \__hook_tl_gset:Nx #1#2
   { \cs_gset_nopar:Npx #1 {#2} }
-\cs_generate_variant:Nn \__hook_tl_gset:Nn { c }
-\cs_generate_variant:Nn \__hook_tl_gset:No { c }
+\cs_generate_variant:Nn \__hook_tl_gset:Nn { c, co }
 \cs_generate_variant:Nn \__hook_tl_gset:Nx { c }
 \cs_new_protected:Npn \__hook_tl_gput_right:Nn #1#2
   { \__hook_tl_gset:Nx #1 { \__kernel_exp_not:w \exp_after:wN { #1 #2 } } }
-\cs_generate_variant:Nn \__hook_tl_gput_right:Nn { No, cn }
+\cs_generate_variant:Nn \__hook_tl_gput_right:Nn { Ne, cn }
 \cs_new_protected:Npn \__hook_tl_gput_left:Nn #1#2
   {
     \__hook_tl_gset:Nx #1
       { \__kernel_exp_not:w {#2} \__kernel_exp_not:w \exp_after:wN {#1} }
   }
-\cs_generate_variant:Nn \__hook_tl_gput_left:Nn { No }
 \cs_new_eq:NN \__hook_tl_gset_eq:NN \tl_gset_eq:NN
 \cs_new_protected:Npn \__hook_tl_gclear:N #1
   { \__hook_tl_gset_eq:NN #1 \c_empty_tl }
 \cs_generate_variant:Nn \__hook_tl_gclear:N { c }
 
-
 \cs_new_protected:Npn \hook_new:n #1
-  { \__hook_normalize_hook_args:Nn \__hook_new:n {#1} }
-\cs_new_protected:Npn \__hook_new:n #1
+  { \__hook_normalize_hook_args:Nn \__hook_new:nn {#1} { 0 } }
+\cs_new_protected:Npn \hook_new_with_args:nn #1 #2
+  { \__hook_normalize_hook_args:Nn \__hook_new:nn {#1} {#2} }
+\cs_new_protected:Npn \__hook_new:nn #1 #2
   {
     \__hook_if_declared:nTF {#1}
       { \msg_error:nnn { hooks } { exists } {#1} }
       {
         \tl_new:c { g__hook_#1_declared_tl }
-        \__hook_make_usable:n {#1}
+        \cs_undefine:c { __hook~#1 }
+        \cs_undefine:c { c__hook_#1_parameter_tl }
+        \__hook_make_usable:nn {#1} {#2}
+        \__hook_update_hook_code:n {#1}
       }
   }
-\cs_new_protected:Npn \__hook_make_usable:n #1
+\cs_new_protected:Npn \__hook_make_usable:nn #1 #2
   {
-    \tl_if_exist:cF { __hook~#1 }
+    \__hook_if_usable:nF {#1}
       {
         \seq_gput_right:Nn \g__hook_all_seq {#1}
-        \tl_new:c { __hook~#1 }
+        \__kernel_cs_parm_from_arg_count:nnF
+          { \tl_const:cn { c__hook_#1_parameter_tl } } {#2}
+          {
+            \msg_error:nnnn { hooks } { too-many-args } {#1} {#2}
+            \tl_const:cx { c__hook_#1_parameter_tl }
+              { \exp_not:V \c__hook_nine_parameters_tl }
+          }
+        \__hook_normalise_cs_args:nn { _toplevel } {#1}
+        \__hook_normalise_cs_args:nn { _next } {#1}
+        \__hook_code_gset:nn {#1} { }
         \__hook_init_structure:n {#1}
-        \clist_new:c { g__hook_#1_labels_clist }
-        \tl_new:c { g__hook_#1_reversed_tl }
+        \__hook_normalise_code_pool:n {#1}
+        \clist_if_exist:cF { g__hook_#1_labels_clist }
+          {
+            \clist_new:c { g__hook_#1_labels_clist }
+            \tl_new:c { g__hook_#1_reversed_tl }
+          }
         \__hook_include_legacy_code_chunk:n {#1}
       }
   }
@@ -4712,19 +4731,40 @@
     \__hook_if_structure_exist:nF {#1}
       {
         \prop_new:c { g__hook_#1_code_prop }
-        \tl_new:c { __hook_toplevel~#1 }
-        \tl_new:c { __hook_next~#1 }
+        \__hook_toplevel_gset:nn {#1} { }
+        \__hook_next_gset:nn {#1} { }
       }
   }
 \cs_new_protected:Npn \hook_new_reversed:n #1
-  { \__hook_normalize_hook_args:Nn \__hook_new_reversed:n {#1} }
-\cs_new_protected:Npn \__hook_new_reversed:n #1
+  { \__hook_normalize_hook_args:Nn \__hook_new_reversed:nn {#1} { 0 } }
+\cs_new_protected:Npn \hook_new_reversed_with_args:nn #1 #2
+  { \__hook_normalize_hook_args:Nn \__hook_new_reversed:nn {#1} {#2} }
+\cs_new_protected:Npn \__hook_new_reversed:nn #1 #2
   {
-    \__hook_new:n {#1}
-    \tl_gset:cn { g__hook_#1_reversed_tl } { - }
+    \__hook_if_declared:nTF {#1}
+      { \msg_error:nnn { hooks } { exists } {#1} }
+      {
+        \__hook_new:nn {#1} {#2}
+        \tl_gset:cn { g__hook_#1_reversed_tl } { - }
+      }
   }
 \cs_new_protected:Npn \hook_new_pair:nn #1#2
-  { \hook_new:n {#1} \hook_new_reversed:n {#2} }
+  { \__hook_normalize_hook_args:Nnn \__hook_new_pair:nnn {#1} {#2} { 0 } }
+\cs_new_protected:Npn \hook_new_pair_with_args:nnn #1#2#3
+  { \__hook_normalize_hook_args:Nnn \__hook_new_pair:nnn {#1} {#2} {#3} }
+\cs_new_protected:Npn \__hook_new_pair:nnn #1 #2 #3
+  {
+    \__hook_if_declared:nTF {#1}
+      { \msg_error:nnn { hooks } { exists } {#1} }
+      {
+        \__hook_if_declared:nTF {#2}
+          { \msg_error:nnn { hooks } { exists } {#2} }
+          {
+            \__hook_new:nn {#1} {#3}
+            \__hook_new_reversed:nn {#2} {#3}
+          }
+      }
+  }
 \cs_new_protected:Npn \__hook_include_legacy_code_chunk:n #1
   {
     \tl_if_exist:cT { @#1hook }
@@ -4731,8 +4771,13 @@
       {
         \tl_if_empty:cF { @#1hook }
           {
-            \exp_args:Nnnv \__hook_hook_gput_code_do:nnn {#1}
-                                  { legacy } { @#1hook }
+            \__hook_replacing_args_false:
+            \use:e
+              {
+                \__hook_hook_gput_code_do:nnn {#1} { legacy }
+                  { \exp_not:v { @#1hook } }
+              }
+            \__hook_replacing_args_reset:
             \__hook_tl_gclear:c { @#1hook }
           }
       }
@@ -4748,7 +4793,7 @@
   {
     \bool_lazy_and:nnTF
         { \tl_if_exist_p:c { g__hook_#1_declared_tl } }
-        { ! \tl_if_exist_p:c { __hook~#1 } }
+        { ! \cs_if_exist_p:c { __hook~#1 } }
       { \prg_return_true: }
       { \prg_return_false: }
   }
@@ -4762,7 +4807,7 @@
         \__hook_if_declared:nF {#1}
           {
             \tl_new:c { g__hook_#1_declared_tl }
-            \__hook_make_usable:n {#1}
+            \__hook_make_usable:nn {#1} { 0 }
             \tl_gset:cx { g__hook_#1_reversed_tl }
               { \__hook_if_generic_reversed:nT {#1} { - } }
             \__hook_update_hook_code:n {#1}
@@ -4909,25 +4954,47 @@
       }
       { \tl_gset:Nn \g__hook_hook_curr_name_tl {#1} }
   }
-\cs_new_protected:Npn \hook_gput_code:nnn #1 #2
-  { \__hook_normalize_hook_args:Nnn \__hook_gput_code:nnn {#1} {#2} }
+\cs_new_protected:Npn \hook_gput_code:nnn #1 #2 #3
+  {
+    \__hook_replacing_args_false:
+    \__hook_normalize_hook_args:Nnn \__hook_gput_code:nnn {#1} {#2} {#3}
+    \__hook_replacing_args_reset:
+  }
+\cs_new_protected:Npn \hook_gput_code_with_args:nnn #1 #2 #3
+  {
+    \__hook_replacing_args_true:
+    \__hook_normalize_hook_args:Nnn \__hook_gput_code:nnn {#1} {#2} {#3}
+    \__hook_replacing_args_reset:
+  }
 \cs_new_protected:Npn \__hook_gput_code:nnn #1 #2 #3
   {
+    \__hook_chk_args_allowed:nn {#1} { AddToHook }
     \__hook_if_execute_immediately:nTF {#1}
-      {#3}
       {
-        \__hook_if_usable:nTF {#1}
+        \__hook_if_replacing_args:TF
           {
-            \__hook_hook_gput_code_do:nnn {#1} {#2} {#3}
-            \__hook_update_hook_code:n {#1}
+            \msg_error:nnnn { hooks } { one-time-args }
+              {#1} { AddToHook }
           }
-          {
-            \__hook_if_disabled:nTF {#1}
-              { \msg_error:nnn { hooks } { hook-disabled } {#1} }
-              { \__hook_try_declaring_generic_hook:nnn {#1} {#2} {#3} }
-          }
+          { }
+        \use:n
       }
+      { \__hook_gput_code_store:nnn {#1} {#2} }
+          {#3}
   }
+\cs_new_protected:Npn \__hook_gput_code_store:nnn #1 #2 #3
+  {
+    \__hook_if_usable:nTF {#1}
+      {
+        \__hook_hook_gput_code_do:nnn {#1} {#2} {#3}
+        \__hook_update_hook_code:n {#1}
+      }
+      {
+        \__hook_if_disabled:nTF {#1}
+          { \msg_error:nnn { hooks } { hook-disabled } {#1} }
+          { \__hook_try_declaring_generic_hook:nnn {#1} {#2} {#3} }
+      }
+  }
 \cs_new_protected:Npn \__hook_hook_gput_code_do:nnn #1 #2 #3
   {
     \__hook_debug:n{\iow_term:x{****~ Add~ to~
@@ -4939,19 +5006,58 @@
         \str_if_eq:eeTF { top-level } { \__hook_currname_or_default: }
           {
             \__hook_init_structure:n {#1}
-            \__hook_tl_gput_right:cn { __hook_toplevel~#1 } {#3}
+            \__hook_cs_gput_right:nnn { _toplevel } {#1} {#3}
           }
           { \msg_error:nnn { hooks } { misused-top-level } {#1} }
       }
       {
-        \prop_get:cnNTF { g__hook_#1_code_prop } {#2} \l__hook_return_tl
+        \exp_args:Nx \__hook_prop_gput_labeled_cleanup:nnn
           {
-            \prop_gput:cno { g__hook_#1_code_prop } {#2}
-              { \l__hook_return_tl #3 }
+            \__hook_if_replacing_args:TF
+              { \exp_not:n }
+              { \__hook_double_hashes:n }
+                {#3}
           }
-          { \prop_gput:cnn { g__hook_#1_code_prop } {#2} {#3} }
+          {#1} {#2}
       }
   }
+\cs_new_protected:Npn \__hook_prop_gput_labeled_cleanup:nnn #1 #2 #3
+  {
+    \tl_set:Nn \l__hook_return_tl {#1}
+    \__hook_if_replacing_args:TF
+      {
+        \__hook_if_usable:nT {#2}
+          {
+            \__hook_set_normalise_fn:nn {#2}
+              { Invalid~code~added~\msg_line_context: }
+            \__hook_normalise_fn:nn {#3} {#1}
+            \prop_get:NnN \l__hook_work_prop {#3} \l__hook_return_tl
+          }
+      }
+      { }
+    \exp_args:NcV \__hook_prop_gput_labeled_do:Nnn
+      { g__hook_#2_code_prop } \l__hook_return_tl {#3}
+  }
+\cs_new_protected:Npn \__hook_prop_gput_labeled_do:Nnn #1 #2 #3
+  {
+    \prop_get:NnNTF #1 {#3} \l__hook_return_tl
+      { \prop_gput:Nno #1 {#3} { \l__hook_return_tl #2 } }
+      { \prop_gput:Nnn #1 {#3} {#2} }
+  }
+\cs_new_protected:Npn \__hook_chk_args_allowed:nn #1 #2
+  {
+    \__hook_if_replacing_args:TF
+      {
+        \__hook_if_declared:nT {#1}
+          { \tl_if_empty:cT { c__hook_#1_parameter_tl } { \use_ii:nn } }
+        \use_none:n
+          {
+            \msg_error:nnnn { hooks } { without-args } {#1} {#2}
+            \__hook_replacing_args_false:
+          }
+      }
+      { }
+  }
 \cs_new_protected:Npn \__hook_gput_undeclared_hook:nnn #1 #2 #3
   {
     \__hook_init_structure:n {#1}
@@ -4960,7 +5066,7 @@
 \cs_new_protected:Npn \__hook_try_declaring_generic_hook:nnn #1
   {
     \__hook_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1}
-      \hook_gput_code:nnn
+      \__hook_gput_code:nnn
       \__hook_gput_undeclared_hook:nnn
         {#1}
   }
@@ -4967,7 +5073,7 @@
 \cs_new_protected:Npn \__hook_try_declaring_generic_next_hook:nn #1
   {
     \__hook_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1}
-      \hook_gput_next_code:nn
+      \__hook_gput_next_code:nn
       \__hook_gput_next_do:nn
         {#1}
   }
@@ -4979,8 +5085,12 @@
         \__hook_if_usable:nF {#5}
           {
             \str_if_eq:nnT {#1} { cmd }
-              { \__hook_try_put_cmd_hook:n {#5} }
-            \__hook_make_usable:n {#5}
+              {
+                \__hook_try_put_cmd_hook:n {#5}
+                \__hook_make_usable:nn {#5} { 9 }
+                \use_none:nnn
+              }
+            \__hook_make_usable:nn {#5} { 0 }
           }
         \__hook_if_generic_reversed:nT {#5}
           { \tl_gset:cn { g__hook_#5_reversed_tl } { - } }
@@ -5020,17 +5130,6 @@
         { #3 / #5 / #4 }
       #1 #2 { #3 / #5 / #4 }
   }
-\prg_new_conditional:Npnn \__hook_if_file_hook:w
-    #1 / #2 \s__hook_mark #3 { TF }
-  {
-    \__hook_if_generic:nTF {#3}
-      {
-        \str_if_eq:nnTF {#1} { file }
-          { \prg_return_true: }
-          { \prg_return_false: }
-      }
-      { \prg_return_false: }
-  }
 \clist_map_inline:nn { cmd , env , file , package , class , include }
   {
     \tl_const:cn { c__hook_generic_#1/./before_tl } { + }
@@ -5046,6 +5145,8 @@
     \tl_const:cn { c__hook_deprecated_#1/./after_tl  } { }
   }
 \tl_const:cn { c__hook_deprecated_include/./end_tl } { }
+\tl_const:cn { c__hook_parameter_cmd/./before_tl } { #1#2#3#4#5#6#7#8#9 }
+\tl_const:cn { c__hook_parameter_cmd/./after_tl }  { #1#2#3#4#5#6#7#8#9 }
 \cs_new_protected:Npn \hook_gremove_code:nn #1 #2
   { \__hook_normalize_hook_args:Nnn \__hook_gremove_code:nn {#1} {#2} }
 \cs_new_protected:Npn \__hook_gremove_code:nn #1 #2
@@ -5055,12 +5156,12 @@
         \str_if_eq:nnTF {#2} {*}
           {
             \prop_gclear:c { g__hook_#1_code_prop }
-            \__hook_tl_gclear:c { __hook_toplevel~#1 }
-            \__hook_tl_gclear:c { __hook_next~#1 }
+            \__hook_toplevel_gset:nn {#1} { }
+            \__hook_next_gset:nn {#1} { }
           }
           {
             \str_if_eq:nnTF {#2} { top-level }
-              { \__hook_tl_gclear:c { __hook_toplevel~#1 } }
+              { \__hook_toplevel_gset:nn {#1} { } }
               {
                 \prop_gpop:cnNF { g__hook_#1_code_prop } {#2} \l__hook_return_tl
                   { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} }
@@ -5078,9 +5179,192 @@
           { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} }
       }
   }
-\prop_new:c {g__hook_??_code_prop}
-\prop_new:c {__hook~??}
-\tl_new:c {g__hook_??_reversed_tl}
+\cs_new_protected:Npn \__hook_cs_gput_right:nnn #1 #2 #3
+  {
+    \cs_if_exist:cF { __hook#1~#2 }
+      { \__hook_code_gset_aux:nnn {#1} {#2} { } }
+    \__hook_code_gset_auxi:eeen
+      {
+        \__hook_if_declared:nTF {#2}
+          { \tl_use:c { c__hook_#2_parameter_tl } }
+          {
+            \__hook_if_generic:nTF {#2}
+              { \__hook_generic_parameter:n {#2} }
+              { \c__hook_nine_parameters_tl }
+          }
+      }
+      {
+        \exp_args:NNo \exp_args:No \__hook_double_hashes:n
+          {
+            \cs:w __hook#1~#2 \exp_last_unbraced:Ne \cs_end:
+              { \__hook_braced_cs_parameter:n { __hook#1~#2 } }
+          }
+      }
+      {
+        \__hook_if_replacing_args:TF
+          { \exp_not:n }
+          { \__hook_double_hashes:n }
+            {#3}
+      }
+      { __hook#1~#2 }
+  }
+\cs_new_protected:Npn \__hook_code_gset_auxi:nnnn #1 #2 #3 #4
+  { \cs_gset:cpn {#4} #1 { #2 #3 } }
+\cs_generate_variant:Nn \__hook_code_gset_auxi:nnnn { eeen }
+\cs_new_protected:Npn \__hook_code_gset:nn
+  { \__hook_code_gset_aux:nnn { } }
+\cs_new_protected:Npn \__hook_toplevel_gset:nn
+  { \__hook_code_gset_aux:nnn { _toplevel } }
+\cs_new_protected:Npn \__hook_next_gset:nn
+  { \__hook_code_gset_aux:nnn { _next } }
+\cs_new_protected:Npn \__hook_code_gset_aux:nnn #1 #2 #3
+  {
+    \cs_gset:cpn { __hook#1~#2 \exp_last_unbraced:Ne }
+      { \__hook_parameter:n {#2} }
+      {#3}
+  }
+\cs_generate_variant:Nn \__hook_code_gset:nn { ne }
+\cs_new_protected:Npn \__hook_normalise_cs_args:nn #1 #2
+  {
+    \cs_if_exist:cT { __hook#1~#2 }
+      {
+        \__hook_code_gset_auxi:eeen
+          { \tl_use:c { c__hook_#2_parameter_tl } }
+          {
+            \exp_args:NNo \exp_args:No \__hook_double_hashes:n
+              {
+                \cs:w __hook#1~#2 \exp_last_unbraced:Ne \cs_end:
+                  { \__hook_braced_cs_parameter:n { __hook#1~#2 } }
+              }
+          }
+          { }
+          { __hook#1~#2 }
+      }
+  }
+\cs_new_protected:Npn \__hook_normalise_code_pool:n #1
+  {
+    \__hook_set_normalise_fn:nn {#1} { Offending~label:~'##1' }
+    \prop_clear:N \l__hook_work_prop
+    \prop_map_function:cN { g__hook_#1_code_prop } \__hook_normalise_fn:nn
+    \prop_gset_eq:cN { g__hook_#1_code_prop } \l__hook_work_prop
+  }
+\cs_new_protected:Npn \__hook_set_normalise_fn:nn #1 #2
+  {
+    \cs_set:Npn \__hook_tmp:w ##1##2##3##4##5##6##7##8##9 { }
+    \tl_set:Ne \l__hook_tmpb_tl
+      { \__hook_braced_cs_parameter:n { __hook_tmp:w } }
+    \group_begin:
+      \__hook_tl_set:cn { c__hook_hash_tl } { \exp_not:N \c__hook_hashes_tl }
+      \use:e
+        {
+    \group_end:
+    \tl_set:Nn \exp_not:N \l__hook_tmpb_tl { \l__hook_tmpb_tl }
+        }
+    \exp_last_unbraced:NNf
+    \cs_set:Npn \__hook_tmp:w { \__hook_parameter:n {#1} } { }
+    \tl_set:Ne \l__hook_tmpa_tl { \__hook_braced_cs_parameter:n { __hook_tmp:w } }
+    \cs_gset_protected:Npx \__hook_normalise_fn:nn ##1 ##2
+      {
+        \group_begin:
+          \int_set:Nn \tex_escapechar:D { -1 }
+          \cs_set:cpn
+              {
+                hook~'#1'. ^^J
+                (hooks) \prg_replicate:nn { 13 } { ~ }
+                #2 % more message text
+              }
+              \exp_not:v { c__hook_#1_parameter_tl }
+            {##2}
+        \group_end:
+        \cs_set:Npn \exp_not:N \__hook_tmp:w
+            \exp_not:V \c__hook_nine_parameters_tl
+          {
+            \prop_put:Nne \exp_not:N \l__hook_work_prop
+              {##1} { \exp_not:N \__hook_double_hashes:n {##2} }
+          }
+        \exp_not:N \__hook_tmp:w
+          \exp_not:V \l__hook_tmpa_tl
+          \exp_args:No \exp_not:o
+            { \exp_after:wN \__hook_tmp:w \l__hook_tmpb_tl }
+      }
+  }
+\cs_new_eq:NN \__hook_normalise_fn:nn ?
+\prg_new_conditional:Npnn \__hook_cs_if_empty:c #1 { p, T, F, TF }
+  {
+    \if:w \scan_stop: \__hook_replacement_spec:c {#1} \scan_stop:
+      \prg_return_true:
+    \else:
+      \prg_return_false:
+    \fi:
+  }
+\cs_new:Npn \__hook_replacement_spec:c #1
+  {
+    \exp_args:Nc \token_if_macro:NT {#1}
+      { \cs_replacement_spec:c {#1} }
+  }
+\cs_new:Npn \__hook_braced_cs_parameter:n #1
+  {
+    \exp_last_unbraced:Ne \__hook_braced_hidden_loop:w
+      { \exp_args:Nc \__hook_cs_parameter_count:N {#1} } ? \s__hook_mark
+  }
+\cs_new:Npn \__hook_braced_hidden_loop:w #1
+  {
+    \if:w ? #1
+      \__hook_use_i_delimit_by_s_mark:nw
+    \fi:
+    { \exp_not:N \c__hook_hash_tl #1 }
+    \__hook_braced_hidden_loop:w
+  }
+\cs_new:Npn \__hook_cs_parameter_count:N #1
+  {
+    \exp_last_unbraced:Nf \__hook_cs_parameter_count:w
+      { \token_if_macro:NT #1 { \cs_parameter_spec:N #1 } }
+      ? \__hook_cs_end:w ? \__hook_cs_end:w ? \__hook_cs_end:w
+      ? \__hook_cs_end:w ? \__hook_cs_end:w ? \__hook_cs_end:w
+      ? \__hook_cs_end:w ? \__hook_cs_end:w ? \__hook_cs_end:w
+      \s__hook_mark
+  }
+\cs_new:Npn \__hook_cs_parameter_count:w #1#2 #3#4 #5#6 #7#8
+  { #2 #4 #6 #8 \__hook_cs_parameter_count:w }
+\cs_new:Npn \__hook_cs_end:w #1 \s__hook_mark { }
+\cs_new:Npn \__hook_braced_parameter:n #1
+  {
+    \if_case:w
+      \int_eval:n
+        { \exp_args:Nv \str_count:n { c__hook_#1_parameter_tl } / 3 }
+      \exp_stop_f:
+    \or: {##1}
+    \or: {##1} {##2}
+    \or: {##1} {##2} {##3}
+    \or: {##1} {##2} {##3} {##4}
+    \or: {##1} {##2} {##3} {##4} {##5}
+    \or: {##1} {##2} {##3} {##4} {##5} {##6}
+    \or: {##1} {##2} {##3} {##4} {##5} {##6} {##7}
+    \or: {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8}
+    \or: {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8} {##9}
+    \else:
+      \msg_expandable_error:nnn { latex2e } { should-not-happen }
+        { Invalid~parameter~spec. }
+    \fi:
+  }
+\cs_new:Npn \__hook_parameter:n #1
+  {
+    \cs:w c__hook_
+    \tl_if_exist:cTF { c__hook_#1_parameter_tl }
+      { #1_parameter } { empty }
+    _tl \cs_end:
+  }
+\cs_new:Npn \__hook_generic_parameter:n #1
+  { \__hook_generic_parameter:w #1 / / / \s__hook_mark }
+\cs_new:Npn \__hook_generic_parameter:w #1 / #2 / #3 / #4 \s__hook_mark
+  {
+    \cs_if_exist_use:cF { c__hook_parameter_#1/./#3_tl }
+      { \c__hook_empty_tl }
+  }
+\prop_new:c { g__hook_??_code_prop }
+\prop_new:c { __hook~?? }
+\tl_new:c { g__hook_??_reversed_tl }
+\tl_const:cn { c__hook_??_parameter_tl } { }
 \cs_new_protected:Npn \hook_gset_rule:nnnn #1#2#3#4
   {
     \__hook_normalize_hook_rule_args:Nnnnn \__hook_gset_rule:nnnn
@@ -5093,13 +5377,13 @@
         \__hook_deprecated_generic_warn:n {#1}
         \__hook_do_deprecated_generic:Nn \__hook_gset_rule:nnnn {#1}
           {#2} {#3} {#4}
-        \__hook_clean_to_scan:w
+        \__hook_use_none_delimit_by_s_mark:w
       }
     \__hook_if_execute_immediately:nT {#1}
       {
         \msg_error:nnnnnn { hooks } { rule-too-late }
           {#1} {#2} {#3} {#4}
-        \__hook_clean_to_scan:w
+        \__hook_use_none_delimit_by_s_mark:w
       }
     \__hook_init_structure:n {#1}
     \__hook_rule_gclear:nnn {#1} {#2} {#4}
@@ -5164,23 +5448,29 @@
     \cs_end:
   }
 \cs_new_eq:NN \__hook_update_hook_code:n \use_none:n
-\cs_new_protected:Npn \__hook_initialize_all: {
-  \cs_gset_eq:NN \__hook_update_hook_code:n \__hook_initialize_hook_code:n
-  \__hook_debug:n { \prop_gclear:N \g__hook_used_prop }
-  \seq_map_inline:Nn \g__hook_all_seq
+\cs_new_protected:Npn \__hook_initialize_all:
+  {
+    \cs_gset_eq:NN \__hook_update_hook_code:n \__hook_initialize_hook_code:n
+    \__hook_debug:n { \prop_gclear:N \g__hook_used_prop }
+    \seq_map_inline:Nn \g__hook_all_seq
       {
+        \tl_if_empty:cTF { c__hook_##1_parameter_tl }
+          { \__hook_replacing_args_false: }
+          { \__hook_replacing_args_true: }
         \__hook_update_hook_code:n {##1}
+        \__hook_replacing_args_reset:
       }
-  \__hook_debug:n
-     { \iow_term:x{^^JAll~ initialized~ (non-empty)~ hooks:}
-       \prop_map_inline:Nn \g__hook_used_prop
-           { \iow_term:x{^^J~ ##1~ ->~
-               \exp_not:v {__hook~##1}~ }
-           }
-     }
-  \cs_gset_eq:NN \hook_use:n \__hook_use_initialized:n
-  \cs_gset_eq:NN \__hook_preamble_hook:n \use_none:n
-}
+    \__hook_debug:n
+      {
+        \iow_term:x { ^^J All~initialized~(non-empty)~hooks: }
+        \prop_map_inline:Nn \g__hook_used_prop
+          {
+            \iow_term:x
+              { ^^J ~ ##1 ~ -> ~ \cs_replacement_spec:c { __hook~##1 } ~ }
+          }
+      }
+    \__hook_post_initialization_defs:
+  }
 \cs_new_protected:Npn \__hook_initialize_hook_code:n #1
   {
     \__hook_debug:n
@@ -5190,10 +5480,10 @@
       {
         \prop_if_empty:cTF { g__hook_#1_code_prop }
           {
-            \__hook_tl_gset:co { __hook~#1 }
+            \__hook_code_gset:ne {#1}
               {
-                \cs:w __hook_toplevel~#1 \exp_after:wN \cs_end:
-                \cs:w __hook_next~#1 \cs_end:
+                \exp_not:c { __hook_toplevel~#1 } \__hook_braced_parameter:n {#1}
+                \exp_not:c { __hook_next~#1 } \__hook_braced_parameter:n {#1}
               }
           }
           {
@@ -5284,8 +5574,15 @@
         \__hook_debug_label_data:N \l__hook_work_prop
         \iow_term:x{====================}
       }
-    \exp_args:NNo \__hook_tl_gput:Nn #1 { \cs:w __hook_toplevel~#3 \cs_end: }
-    \__hook_tl_gput_right:No #1 { \cs:w __hook_next~#3 \cs_end: }
+    \exp_args:NNe \__hook_tl_gput:Nn #1
+      { \exp_not:c { __hook_toplevel~#3 } \__hook_braced_parameter:n {#3} }
+    \__hook_tl_gput_right:Ne #1
+      { \exp_not:c { __hook_next~#3 } \__hook_braced_parameter:n {#3} }
+    \use:e
+      {
+        \cs_gset:cpn { __hook~#3 } \use:c { c__hook_#3_parameter_tl }
+          { \exp_not:V #1 }
+      }
   }
 \cs_generate_variant:Nn \__hook_initialize_single:NNn { cc }
 \cs_new:Npn \__hook_tl_gput:Nn    { \ERROR }
@@ -5412,7 +5709,20 @@
       }
     \__hook_preamble_hook:n {#1}
     \__hook_log_cmd:x
-      { ^^J ->~The~ \__hook_if_generic:nT {#1} { generic~ } hook~'#1': }
+      {
+        ^^J ->~The~
+        \__hook_if_generic:nT {#1} { generic~ }
+        hook~'#1'
+        \__hook_if_disabled:nF {#1}
+          {
+            \exp_args:Nf \__hook_print_args:nn {#1}
+              {
+                \int_eval:n
+                  { \str_count:e { \__hook_parameter:n {#1} } / 3 }
+              }
+          }
+        :
+      }
     \__hook_if_usable:nF {#1}
       { \__hook_log_line:x { The~hook~is~not~declared. } }
     \__hook_if_disabled:nT {#1}
@@ -5425,7 +5735,12 @@
           { \__hook_log_line_indent:x { --- } }
           {
             \prop_map_inline:cn { g__hook_#1_code_prop }
-              { \__hook_log_line_indent:x { ##1~->~\tl_to_str:n {##2} } }
+              {
+                \exp_after:wN \cs_set:Npn \exp_after:wN \__hook_tmp:w
+                  \c__hook_nine_parameters_tl {##2}
+                \__hook_log_line_indent:x
+                  { ##1~->~\cs_replacement_spec:N \__hook_tmp:w }
+              }
           }
         \__hook_log_line:x
           {
@@ -5435,16 +5750,19 @@
           }
         \__hook_log_line_indent:x
           {
-            \tl_if_empty:cTF { __hook_toplevel~#1 }
+            \__hook_cs_if_empty:cTF { __hook_toplevel~#1 }
               { --- }
-              { -> ~ \exp_args:Nv \tl_to_str:n { __hook_toplevel~#1 } }
+              { -> ~ \cs_replacement_spec:c { __hook_toplevel~#1 } }
           }
         \__hook_log_line:x { Extra~code~for~next~invocation: }
         \__hook_log_line_indent:x
           {
-            \tl_if_empty:cTF { __hook_next~#1 }
+            \__hook_cs_if_empty:cTF { __hook_next~#1 }
               { --- }
-              { ->~ \exp_args:Nv \__hook_log_next_code:n { __hook_next~#1 } }
+              {
+                -> ~ \exp_last_unbraced:Nf \__hook_log_next_code:w
+                  { \cs_replacement_spec:c { __hook_next~#1 } }
+              }
           }
         \__hook_log_line:x { Rules: }
         \bool_set_true:N \l__hook_tmpa_bool
@@ -5479,7 +5797,7 @@
                 \@spaces
                 \clist_if_empty:cTF { g__hook_#1_labels_clist }
                   { --- }
-                  { \clist_use:cn {g__hook_#1_labels_clist} { ,~ } }
+                  { \clist_use:cn { g__hook_#1_labels_clist } { ,~ } }
               }
           }
           {
@@ -5493,8 +5811,19 @@
           }
       }
   }
-\cs_new:Npn \__hook_log_next_code:n #1
-  { \exp_args:No \tl_to_str:n { \use_none:nn #1 } }
+\exp_last_unbraced:NNNNo
+\cs_new:Npn \__hook_log_next_code:w #1 \c_right_brace_str { }
+\cs_new:Npn \__hook_print_args:nn #1 #2
+  {
+    \int_compare:nNnT {#2} > { 0 }
+      {
+        \__hook_if_declared:nT {#1} { \use_none:nnn }
+        \__hook_if_cmd_hook:nT {#1}
+          { \use_i:nnn { ~ (unknown ~ } }
+        \use:n { ~ (#2 ~ }
+        argument \int_compare:nNnT {#2} > { 1 } { s } )
+      }
+  }
 \cs_new_protected:Npn \__hook_list_rules:nn #1 #2
   {
     \cs_set_protected:Npn \__hook_tmp:w ##1 ##2 ##3 {#2}
@@ -5540,8 +5869,18 @@
       }
     \exp_args:No \__hook_tmp:w { \use:nn { ~ } { ~ } }
   }
-\cs_new_protected:Npn \hook_gput_next_code:nn #1
-  { \__hook_normalize_hook_args:Nn \__hook_gput_next_code:nn {#1} }
+\cs_new_protected:Npn \hook_gput_next_code:nn #1 #2
+  {
+    \__hook_replacing_args_false:
+    \__hook_normalize_hook_args:Nn \__hook_gput_next_code:nn {#1} {#2}
+    \__hook_replacing_args_reset:
+  }
+\cs_new_protected:Npn \hook_gput_next_code_with_args:nn #1 #2
+  {
+    \__hook_replacing_args_true:
+    \__hook_normalize_hook_args:Nn \__hook_gput_next_code:nn {#1} {#2}
+    \__hook_replacing_args_reset:
+  }
 \cs_new_protected:Npn \__hook_gput_next_code:nn #1 #2
   {
     \__hook_if_disabled:nTF {#1}
@@ -5548,97 +5887,129 @@
       { \msg_error:nnn { hooks } { hook-disabled } {#1} }
       {
         \__hook_if_structure_exist:nTF {#1}
-          { \__hook_gput_next_do:nn {#1} {#2} }
-          { \__hook_try_declaring_generic_next_hook:nn {#1} {#2} }
+          { \__hook_gput_next_do:nn }
+          { \__hook_try_declaring_generic_next_hook:nn }
+              {#1} {#2}
       }
   }
 \cs_new_protected:Npn \__hook_gput_next_do:nn #1
   {
-    \exp_args:Nc \__hook_gput_next_do:Nnn
-      { __hook_next~#1 } {#1}
+    \__hook_init_structure:n {#1}
+    \__hook_chk_args_allowed:nn {#1} { AddToHookNext }
+    \__hook_cs_if_empty:cT { __hook~#1 }
+      { \__hook_update_hook_code:n {#1} }
+    \__hook_cs_if_empty:cT { __hook_next~#1 }
+      { \__hook_next_gset:nn {#1} { \__hook_clear_next:n {#1} } }
+    \__hook_cs_gput_right:nnn { _next } {#1}
   }
-\cs_new_protected:Npn \__hook_gput_next_do:Nnn #1 #2
-  {
-    \tl_if_empty:cT { __hook~#2 }
-      { \__hook_update_hook_code:n {#2} }
-    \tl_if_empty:NT #1
-      { \__hook_tl_gset:Nn #1 { \__hook_clear_next:n {#2} } }
-    \__hook_tl_gput_right:Nn #1
-  }
 \cs_new_protected:Npn \hook_gclear_next_code:n #1
   { \__hook_normalize_hook_args:Nn \__hook_clear_next:n {#1} }
 \cs_new_protected:Npn \__hook_clear_next:n #1
-  { \cs_gset_eq:cN { __hook_next~#1 } \c_empty_tl }
+  { \__hook_next_gset:nn {#1} { } }
 \cs_new_protected:Npn \hook_use:n #1
   {
-    \tl_if_exist:cT { __hook~#1 }
-      {
-        \__hook_preamble_hook:n {#1}
-        \cs:w __hook~#1 \cs_end:
-      }
+    \__hook_preamble_hook:n {#1}
+    \__hook_use_initialized:n {#1}
   }
 \cs_new:Npn \__hook_use_initialized:n #1
   {
     \if_cs_exist:w __hook~#1 \cs_end:
-      \cs:w __hook~#1 \exp_after:wN \cs_end:
+      \cs:w __hook~#1 \use_i:nn
     \fi:
+    \use_none:n
+    \cs_end:
   }
 \cs_new_protected:Npn \__hook_preamble_hook:n #1
-  { \__hook_initialize_hook_code:n {#1} }
+  {
+    \if_cs_exist:w __hook~#1 \cs_end:
+      \__hook_initialize_hook_code:n {#1}
+    \fi:
+  }
+\cs_new_protected:Npn \hook_use:nnw #1
+  {
+    \__hook_preamble_hook:n {#1}
+    \__hook_use_initialized:nnw {#1}
+  }
+\cs_new:Npn \__hook_use_initialized:nnw #1 #2
+  {
+    \cs:w
+      \if_cs_exist:w __hook~#1 \cs_end:
+        __hook~#1
+      \else:
+        use_none: \prg_replicate:nn {#2} { n }
+      \fi:
+    \cs_end:
+  }
+\cs_new_protected:Npn \__hook_post_initialization_defs:
+  {
+    \cs_gset_eq:NN \hook_use:n \__hook_use_initialized:n
+    \cs_gset_eq:NN \hook_use:nnw \__hook_use_initialized:nnw
+    \cs_gset_eq:NN \__hook_preamble_hook:n \use_none:n
+    \cs_gset_eq:NN \__hook_post_initialization_defs: \prg_do_nothing:
+  }
 \cs_new_protected:Npn \hook_use_once:n #1
   {
     \__hook_if_execute_immediately:nF {#1}
-      { \__hook_normalize_hook_args:Nn \__hook_use_once:n { \use:n {#1} } }
+      { \__hook_normalize_hook_args:Nn \__hook_use_once:nn { \use:n {#1} } { 0 } }
   }
-\cs_new_protected:Npn \__hook_use_once:n #1
+\cs_new_protected:Npn \hook_use_once:nnw #1 #2
   {
+    \__hook_if_execute_immediately:nF {#1}
+      { \__hook_normalize_hook_args:Nn \__hook_use_once:nn { \use:n {#1} } {#2} }
+  }
+\cs_new_protected:Npn \__hook_use_once:nn #1 #2
+  {
     \__hook_preamble_hook:n {#1}
     \__hook_use_once_set:n {#1}
-    \__hook_use_initialized:n {#1}
-    \__hook_use_once_clear:n {#1}
+    \__hook_replacing_args_false:
+    \__hook_cs_gput_right:nnn { _next } {#1} { \__hook_use_once_clear:n {#1} }
+    \__hook_replacing_args_reset:
+    \__hook_if_usable:nTF {#1}
+      { \__hook_use_initialized:n {#1} }
+      {
+        \int_compare:nNnT {#2} > { 0 }
+          { \use:c { use_none: \prg_replicate:nn {#2} { n } } }
+      }
   }
 \cs_new_protected:Npn \__hook_use_once_set:n #1
   { \__hook_tl_gset:cn { g__hook_#1_reversed_tl } { I } }
 \cs_new_protected:Npn \__hook_use_once_clear:n #1
   {
-    \__hook_tl_gclear:c { __hook~#1 }
-    \__hook_tl_gclear:c { __hook_next~#1 }
-    \__hook_tl_gclear:c { __hook_toplevel~#1 }
+    \__hook_code_gset:nn {#1} { }
+    \__hook_next_gset:nn {#1} { }
+    \__hook_toplevel_gset:nn {#1} { }
     \prop_gclear_new:c { g__hook_#1_code_prop }
   }
 \prg_new_conditional:Npnn \__hook_if_execute_immediately:n #1 { T, F, TF }
   {
-    \__hook_if_usable:nTF {#1}
-      {
-        \exp_after:wN \__hook_clean_to_scan:w
-        \if:w I \cs:w g__hook_#1_reversed_tl \cs_end:
-          \s__hook_mark \prg_return_true:
-        \else:
-          \s__hook_mark \prg_return_false:
+    \exp_after:wN \__hook_use_none_delimit_by_s_mark:w
+    \if:w I
+        \if_cs_exist:w g__hook_#1_reversed_tl \cs_end:
+          \cs:w g__hook_#1_reversed_tl \exp_after:wN \cs_end:
         \fi:
-      }
-      { \prg_return_false: }
+        X
+      \s__hook_mark \prg_return_true:
+    \else:
+      \s__hook_mark \prg_return_false:
+    \fi:
   }
-
 \prg_new_conditional:Npnn \hook_if_empty:n #1 { p , T , F , TF }
   {
-    \__hook_if_structure_exist:nTF {#1}
-      {
-        \bool_lazy_and:nnTF
-            { \prop_if_empty_p:c { g__hook_#1_code_prop } }
-            {
-              \bool_lazy_and_p:nn
-                { \tl_if_empty_p:c { __hook_toplevel~#1 } }
-                { \tl_if_empty_p:c { __hook_next~#1 } }
-            }
-          { \prg_return_true: }
-          { \prg_return_false: }
-      }
-      { \prg_return_true: }
+    \if:w
+        T
+        \prop_if_exist:cT { g__hook_#1_code_prop }
+          { \prop_if_empty:cF { g__hook_#1_code_prop } { F } }
+        \__hook_cs_if_empty:cF { __hook_toplevel~#1 } { F }
+        \__hook_cs_if_empty:cF { __hook_next~#1 } { F }
+        T
+      \prg_return_true:
+    \else:
+      \prg_return_false:
+    \fi:
   }
 \prg_new_conditional:Npnn \__hook_if_usable:n #1 { p , T , F , TF }
   {
-    \tl_if_exist:cTF { __hook~#1 }
+    \cs_if_exist:cTF { __hook~#1 }
       { \prg_return_true: }
       { \prg_return_false: }
   }
@@ -5656,7 +6027,7 @@
   }
 \prg_new_conditional:Npnn \__hook_if_reversed:n #1 { p , T , F , TF }
   {
-    \exp_after:wN \__hook_clean_to_scan:w
+    \exp_after:wN \__hook_use_none_delimit_by_s_mark:w
     \if:w - \cs:w g__hook_#1_reversed_tl \cs_end:
       \s__hook_mark \prg_return_true:
     \else:
@@ -5683,6 +6054,19 @@
       }
       { \prg_return_false: }
   }
+\prg_new_conditional:Npnn \__hook_if_cmd_hook:n #1 { T }
+  { \__hook_if_cmd_hook:w #1 / / / \s__hook_mark }
+\cs_new:Npn \__hook_if_cmd_hook:w #1 / #2 / #3 / #4 \s__hook_mark
+  {
+    \if:w Y
+          \str_if_eq:nnF {#1} { cmd } { N }
+          \tl_if_exist:cF { c__hook_generic_#1/./#3_tl } { N }
+          Y
+      \prg_return_true:
+    \else:
+      \prg_return_false:
+    \fi:
+  }
 \prg_new_conditional:Npnn \__hook_if_generic_reversed:n #1 { T }
   { \__hook_if_generic_reversed:w #1 / / / \scan_stop: }
 \cs_new:Npn \__hook_if_generic_reversed:w #1 / #2 / #3 / #4 \scan_stop:
@@ -5693,6 +6077,31 @@
       \prg_return_false:
     \fi:
   }
+\seq_new:N \g__hook_replacing_stack_seq
+\cs_new:Npn \__hook_misused_if_replacing_args:nn #1 #2
+  {
+    \msg_expandable_error:nnn { latex2e } { should-not-happen }
+      { Misused~\__hook_if_replacing_args:. }
+  }
+\cs_new:Npn \__hook_if_replacing_args:TF
+  { \__hook_misused_if_replacing_args:nn }
+\cs_new_protected:Npn \__hook_replacing_args_true:
+  {
+    \seq_gpush:No \g__hook_replacing_stack_seq
+      { \__hook_if_replacing_args:TF }
+    \cs_set:Npn \__hook_if_replacing_args:TF { \use_i:nn }
+  }
+\cs_new_protected:Npn \__hook_replacing_args_false:
+  {
+    \seq_gpush:No \g__hook_replacing_stack_seq
+      { \__hook_if_replacing_args:TF }
+    \cs_set:Npn \__hook_if_replacing_args:TF { \use_ii:nn }
+  }
+\cs_new_protected:Npn \__hook_replacing_args_reset:
+  {
+    \seq_gpop:NN \g__hook_replacing_stack_seq \l__hook_return_tl
+    \cs_gset_eq:NN \__hook_if_replacing_args:TF \l__hook_return_tl
+  }
 \prop_gput:Nnn \g_msg_module_type_prop { hooks } { LaTeX }
 \prop_gput:Nnn \g_msg_module_type_prop { latex2e } { LaTeX }
 \prop_gput:Nnn \g_msg_module_name_prop { latex2e } { kernel }
@@ -5711,6 +6120,32 @@
     { There~ already~ exists~ a~ hook~ declaration~ with~ this~
       name.\\
       Please~ use~ a~ different~ name~ for~ your~ hook.}
+\msg_new:nnnn { hooks } { too-many-args }
+  { Too~many~arguments~for~hook~'#1'. }
+  {
+    You~tried~to~declare~a~hook~with~#2~arguments,~but~a~
+    hook~can~only~have~up~to~nine.~LaTeX~will~define~this~
+    hook~with~nine~arguments.
+  }
+\msg_new:nnnn { hooks } { without-args }
+  { Hook~'#1'~has~no~arguments. }
+  {
+    You~tried~to~use~\iow_char:N\\#2WithArguments~
+    on~a~hook~that~takes~no~arguments.\\
+    Check~the~usage~of~the~hook~or~use~\iow_char:N\\#2~instead.\\
+    \\
+    LaTeX~will~use~\iow_char:N\\#2.
+  }
+\msg_new:nnnn { hooks } { one-time-args }
+  { You~can't~have~arguments~in~used~one-time~hook~'#1'. }
+  {
+    You~tried~to~use~\iow_char:N\\#2WithArguments~
+    on~a~one-time~hook~that~has~already~been~used.~
+    You~have~to~add~the~code~before~the~hook~is~used,~
+    or~add~the~code~without~arguments~using~\iow_char:N\\#2~instead.\\
+    \\
+    LaTeX~will~use~\iow_char:N\\#2.
+  }
 \msg_new:nnnn { hooks } { hook-disabled }
   { Cannot~add~code~to~disabled~hook~'#1'. }
   {
@@ -5805,15 +6240,30 @@
     Generic~hook~'#1/#2/#3'~is~deprecated. \\
     Use~hook~'#1/#3/#2'~instead.
   }
-\NewDocumentCommand \NewHook             { m }{ \hook_new:n {#1} }
-\NewDocumentCommand \NewReversedHook     { m }{ \hook_new_reversed:n {#1} }
-\NewDocumentCommand \NewMirroredHookPair { mm }{ \hook_new_pair:nn {#1}{#2} }
-\NewDocumentCommand \ActivateGenericHook { m }{ \hook_activate_generic:n {#1} }
-\NewDocumentCommand \DisableGenericHook { m }{ \hook_disable_generic:n {#1} }
+\NewDocumentCommand \NewHook             { m }
+  { \hook_new:n {#1} }
+\NewDocumentCommand \NewReversedHook     { m }
+  { \hook_new_reversed:n {#1} }
+\NewDocumentCommand \NewMirroredHookPair { mm }
+  { \hook_new_pair:nn {#1}{#2} }
+\NewDocumentCommand \NewHookWithArguments             { mm }
+  { \hook_new_with_args:nn {#1} {#2} }
+\NewDocumentCommand \NewReversedHookWithArguments     { mm }
+  { \hook_new_reversed_with_args:nn {#1} {#2} }
+\NewDocumentCommand \NewMirroredHookPairWithArguments { mmm }
+  { \hook_new_pair_with_args:nnn {#1} {#2} {#3} }
+\NewDocumentCommand \ActivateGenericHook { m }
+  { \hook_activate_generic:n {#1} }
+\NewDocumentCommand \DisableGenericHook { m }
+  { \hook_disable_generic:n {#1} }
 \NewDocumentCommand \AddToHook { m o +m }
   { \hook_gput_code:nnn {#1} {#2} {#3} }
+\NewDocumentCommand \AddToHookWithArguments { m o +m }
+  { \hook_gput_code_with_args:nnn {#1} {#2} {#3} }
 \NewDocumentCommand \AddToHookNext { m +m }
   { \hook_gput_next_code:nn {#1} {#2} }
+\NewDocumentCommand \AddToHookNextWithArguments { m +m }
+  { \hook_gput_next_code_with_args:nn {#1} {#2} }
 \NewDocumentCommand \ClearHookNext { m }
   { \hook_gclear_next_code:n {#1} }
 \NewDocumentCommand \RemoveFromHook { m o }
@@ -5832,6 +6282,8 @@
   }
 \cs_new:Npn \UseHook        { \hook_use:n }
 \cs_new:Npn \UseOneTimeHook { \hook_use_once:n }
+\cs_new:Npn \UseHookWithArguments        { \hook_use:nnw }
+\cs_new:Npn \UseOneTimeHookWithArguments { \hook_use_once:nnw }
 \cs_new_protected:Npn \ShowHook { \hook_show:n }
 \cs_new_protected:Npn \LogHook { \hook_log:n }
 \cs_new_protected:Npn \DebugHooksOn  { \hook_debug_on:  }
@@ -5921,11 +6373,12 @@
               \__hook_curr_name_pop:
 \ExplSyntaxOff
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% File: ltcmdhooks.dtx (C) Copyright 2020-2021
-%%       Frank Mittelbach, Phelype Oleinik, LaTeX Team
+%% File: ltcmdhooks.dtx
+%% Copyright (C) 2020-2023
+%% Frank Mittelbach, Phelype Oleinik, The LaTeX Project
 %%% From File: ltcmdhooks.dtx
-\def\ltcmdhooksversion{v1.0f}
-\def\ltcmdhooksdate{2021/10/20}
+\def\ltcmdhooksversion{v1.0h}
+\def\ltcmdhooksdate{2023/05/21}
 \ExplSyntaxOn
 \tl_new:N \g_hook_patch_action_list_tl
 \int_new:N \l__hook_patch_num_args_int
@@ -5932,7 +6385,8 @@
 \tl_new:N \l__hook_patch_prefixes_tl
 \tl_new:N \l__hook_param_text_tl
 \tl_new:N \l__hook_replace_text_tl
-\tl_const:Nn \c__hook_hash_tl { # # }
+\tl_const:Nn \c__hook_hash_tl { # }
+\tl_const:Nn \c__hook_hashes_tl { # # }
 \cs_new_eq:NN \__hook_exp_not:NN ?
 \cs_new_eq:NN \__hook_def_cmd:w ?
 \quark_new:N \q__hook_recursion_tail
@@ -6080,10 +6534,10 @@
             ##1 \l__hook_replace_text_tl { \__hook_exp_not:n {##2} }
           }
         \bool_if:NTF #1
-          { \__hook_tmp:w \tl_set:Nx { [ \c__hook_hash_tl 1 ] } }
-          { \__hook_tmp:w \tl_set:Nx { { \c__hook_hash_tl 1 } } }
+          { \__hook_tmp:w \tl_set:Nx { [ \c__hook_hashes_tl 1 ] } }
+          { \__hook_tmp:w \tl_set:Nx { { \c__hook_hashes_tl 1 } } }
         \int_step_inline:nnn { 2 } { \l__hook_patch_num_args_int }
-          { \__hook_tmp:w \tl_put_right:Nx { { \c__hook_hash_tl ##1 } } }
+          { \__hook_tmp:w \tl_put_right:Nx { { \c__hook_hashes_tl ##1 } } }
         \tl_set:Nx \l__hook_replace_text_tl
           { \exp_not:N #2 \exp_not:V \l__hook_replace_text_tl }
         \tl_set:Nx \l__hook_replace_text_tl
@@ -6110,16 +6564,24 @@
     \tl_set:Nx \exp_not:N \l__hook_patch_prefixes_tl
       { \exp_not:N \__hook_make_prefixes:w \cs_prefix_spec:N #2 / / }
         }
-    \use:x
+    \__hook_disable:n { cmd / #3 / #4 }
+    \cs_undefine:c { c__hook_cmd / #3 / #4_parameter_tl }
+    \__hook_make_usable:nn { cmd / #3 / #4 } { \l__hook_patch_num_args_int }
+    \use:e
       {
         \__hook_redefine_with_hooks:Nnnn \exp_not:N #2
         \str_if_eq:nnTF {#4} { after }
           { \use_ii_i:nn }
           { \use:nn }
-            { { \__hook_exp_not:NN \exp_not:N \UseHook { cmd / #3 / #4 } } }
+            { {
+                \__hook_exp_not:NN \exp_not:N \UseHookWithArguments
+                  { cmd / #3 / #4 } { \int_use:N \l__hook_patch_num_args_int }
+                  \__hook_braced_parameter:n { cmd / #3 / #4 }
+            } }
             { { } }
             { \__hook_exp_not:NN \exp_not:V \l__hook_replace_text_tl }
       }
+    \__hook_update_hook_code:n { cmd / #3 / #4 }
   }
 \cs_new_protected:Npn \__hook_redefine_with_hooks:Nnnn #1 #2 #3 #4
   {
@@ -6168,7 +6630,11 @@
     \if_meaning:w \q__hook_recursion_tail #1
       \__hook_double_hashes_stop:w
     \fi:
-    \if_meaning:w \c__hook_hash_tl #1
+    \if:w ?
+      \if_meaning:w \c__hook_hash_tl #1 ! \fi:
+      \if_meaning:w \c__hook_hashes_tl #1 ! \fi:
+          ?
+    \else:
       \use_i:nnnn
     \fi:
     \use:n
@@ -6190,10 +6656,10 @@
   { ~ \__hook_double_hashes:w }
 \cs_new_protected:Npn \__hook_retokenize_patch:Nnn #1 #2 #3
   {
-    \__hook_patch_debug:x { ..~command~can~only~be~patched~by~rescanning }
     \str_if_eq:eeTF { \cs_argument_spec:N #1 } { }
       { \__hook_patch_expand_redefine:NNnn \c_false_bool #1 {#2} {#3} }
       {
+        \__hook_patch_debug:x { ..~command~can~only~be~patched~by~rescanning }
         \tl_set:Nx \l__hook_tmpa_tl
           {
             \int_compare:nNnTF { \char_value_catcode:n {`\@ } } = { 12 }
@@ -6231,7 +6697,7 @@
       {
         \__hook_patch_debug:x { ++~macro~can~be~retokenized~cleanly }
         \__hook_patch_debug:x { ==~retokenizing~macro~now }
-        \__hook_patch_retokenize:Nnnn #1 {#2} {#3} {#4}
+        \__hook_patch_retokenize:Nnnn #1 { cmd / #2 / #3 } {#3} {#4}
         \use_i_delimit_by_q_recursion_stop:nw \use_none:n
       }
       {
@@ -6266,8 +6732,41 @@
       { \prg_return_true: }
       { \prg_return_false: }
   }
+\cs_new_protected:Npn \__hook_guess_arg_count:NN #1
+  {
+    \exp_after:wN \__hook_guess_arg_count:wN
+      \token_to_meaning:N #1 \s__hook_mark
+  }
+\exp_last_unbraced:NNNNo
+\cs_new_protected:Npx \__hook_guess_arg_count:wN
+    #1 { \tl_to_str:n { macro: } } #2 \s__hook_mark #3
+  {
+    \int_set:Nn #3
+      {
+        \exp_not:N \__hook_guess_arg_count:nw { 0 } #2
+          \c_hash_str 0 \s__hook_mark
+      }
+  }
+\use:e
+  { \cs_new:Npn \exp_not:N \__hook_guess_arg_count:nw #1 #2 \c_hash_str #3 }
+  {
+    \int_compare:nNnTF { #1 + 1 } = {#3}
+      { \__hook_guess_arg_count:nw {#3} }
+      { #1 \__hook_use_none_delimit_by_s_mark:w }
+  }
 \cs_new_protected:Npn \__hook_patch_retokenize:Nnnn #1 #2 #3 #4
   {
+    \__hook_guess_arg_count:NN #1 \l__hook_patch_num_args_int
+    \__hook_disable:n {#2}
+    \cs_undefine:c { c__hook_#2_parameter_tl }
+    \__hook_make_usable:nn {#2} { \l__hook_patch_num_args_int }
+    \tl_set:Ne \l__hook_tmpa_tl
+      { \exp_args:Ne \tl_to_str:n { \__hook_braced_parameter:n {#2} } }
+    \use:x
+      {
+        \str_replace_all:Nnn \exp_not:N \l__hook_tmpa_tl
+          { #### } { \c_hash_str }
+      }
     \cs_set_eq:NN \kerneltmpDoNotUse \scan_stop:
     \cs_set_eq:NN \__hook_tmp:w \scan_stop:
     \use:x
@@ -6278,10 +6777,18 @@
             ####1 \def \kerneltmpDoNotUse ####2
               {
                 \str_if_eq:nnT {#3} { before }
-                  { \token_to_str:N \UseHook { cmd / #2 / #3 } }
+                  {
+                    \token_to_str:N \UseHookWithArguments {#2}
+                      { \int_use:N \l__hook_patch_num_args_int }
+                      \l__hook_tmpa_tl
+                  }
                 ####3
                 \str_if_eq:nnT {#3} { after }
-                  { \token_to_str:N \UseHook { cmd / #2 / #3 } }
+                  {
+                    \token_to_str:N \UseHookWithArguments {#2}
+                      { \int_use:N \l__hook_patch_num_args_int }
+                      \l__hook_tmpa_tl
+                  }
               }
           }
         \tl_set:Nx \exp_not:N \l__hook_tmpa_tl
@@ -6289,6 +6796,7 @@
       }
     \tl_rescan:nV { #4 \__hook_patch_required_catcodes: } \l__hook_tmpa_tl
     \cs_gset_eq:NN #1 \kerneltmpDoNotUse
+    \__hook_update_hook_code:n {#2}
   }
 \msg_new:nnnn { hooks } { cant-patch }
   {
@@ -6626,7 +7134,9 @@
 \def\@setpar#1{\def\par{#1}\def\@par{#1}}
 \def\@par{\let\par\@@par\par}
 \def\@restorepar{\def\par{\@par}}
-%% File: ltpara.dtx (C) Copyright 2020-2023
+%% File: ltpara.dtx
+%% Copyright (C) 2020-2023
+%% Frank Mittelbach, The LaTeX Project
 %%% From File: ltpara.dtx
 \def\ltparaversion{v1.0l}
 \def\ltparadate{2023/01/30}
@@ -6755,7 +7265,9 @@
 
 \ExplSyntaxOff
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% File: ltmeta.dtx (C) Copyright 2021, 2022
+%% File: ltmeta.dtx
+%% Copyright (C) 2021-2023
+%% Frank Mittelbach, The LaTeX Project
 %%% From File: ltmeta.dtx
 \def\ltmetaversion{v1.0b}
 \def\ltmetadate{2022/05/18}
@@ -6793,6 +7305,7 @@
 \DeclareRobustCommand\linebreak{\@testopt{\@no at lnbk-}4}
 \DeclareRobustCommand\nolinebreak{\@testopt\@no at lnbk4}
 \DeclareRobustCommand\samepage{\interlinepenalty\@M
+   \predisplaypenalty\@M
    \postdisplaypenalty\@M
    \interdisplaylinepenalty\@M
    \@beginparpenalty\@M
@@ -7243,21 +7756,24 @@
   \set at curr@file{#1}%
   \expandafter\IfFileExists@\expandafter{\@curr at file}}
 \long\def \IfFileExists@#1#2#3{%
-  \openin\@inputcheck"#1" %
-  \ifeof\@inputcheck
-    \ifx\input at path\@undefined
+  \edef\@filef at und{\IfFileExists@@{#1}}%
+  \ifx\@filef at und\@empty
+    \if\relax\detokenize{#1}\relax
+      \let\reserved at a\@firstoftwo
+      \def\@filef at und{".tex" }%
+    \else
       \let\reserved at a\@secondoftwo
-    \else
-      \def\reserved at a{\@iffileonpath{#1}}%
     \fi
   \else
-    \closein\@inputcheck
-    \edef\@filef at und{"#1" }%
     \let\reserved at a\@firstoftwo
+    \edef\@filef at und{"\@filef at und" }%
   \fi
   \expandafter\def\expandafter\reserved at a
     \expandafter{\reserved at a{#2}{#3}}%
 \reserved at a}
+\ExplSyntaxOn
+\cs_new_eq:NN \IfFileExists@@ \file_full_name:n
+\ExplSyntaxOff
 \long\def\@iffileonpath#1{%
   \let\reserved at a\@secondoftwo
   \expandafter\@tfor\expandafter\reserved at b\expandafter
@@ -8007,6 +8523,11 @@
          {\@nomath\mathversion
           \expandafter\ifx\csname mv@#1\endcsname\relax
           \@latex at error{Math version `#1' is not defined}\@eha\else
+          \ifcsname mv@\math at version @frozen\endcsname
+            \expandafter\let
+            \csname mv@\math at version @frozen\expandafter\endcsname
+            \csname mv@\math at version\endcsname
+          \fi
           \edef\math at version{#1}%
           \gdef\glb at currsize{}%
           \aftergroup\glb at settings
@@ -11252,11 +11773,13 @@
    \@latex at warning{Reference `#3' on page \thepage \space
              undefined}%
   \else
-   \expandafter#2#1\null
+   \expandafter#2#1\@empty\@empty\@empty\null
   \fi}
-\def\@kernel at sref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}}
+\long\def\@firstoffive#1#2#3#4#5{#1}
+\long\def\@secondoffive#1#2#3#4#5{#2}
+\def\@kernel at sref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoffive{#1}}
 \def\@kernel at spageref#1{\expandafter\@setref\csname r@#1\endcsname
-                 \@secondoftwo{#1}}
+                 \@secondoffive{#1}}
 \let\@kernel at ref\@kernel at sref
 \let\@kernel at pageref\@kernel at spageref
 \NewDocumentCommand\ref{s}
@@ -11277,9 +11800,17 @@
 \def\newlabel{\@newl at bel r}
 \@onlypreamble\@newl at bel
 \let \@multiplelabels \relax
+\providecommand\@currentlabelname{}
+\providecommand\@currentHref{}
+\providecommand\@kernel at reserved@label at data{}
+\NewHookWithArguments{label}{1}
 \def\label#1{\@bsphack
+  \begingroup
+  \UseHookWithArguments{label}{1}{#1}%
   \protected at write\@auxout{}%
-         {\string\newlabel{#1}{{\@currentlabel}{\thepage}}}%
+         {\string\newlabel{#1}{{\@currentlabel}{\thepage}%
+          {\@currentlabelname}{\@currentHref}{\@kernel at reserved@label at data}}}%
+  \endgroup
   \@esphack}
 \def\@currentcounter{}
 \def\refstepcounter#1{\stepcounter{#1}%
@@ -11842,6 +12373,10 @@
 \ifx\mathdefaultsmode\@undefined\else
   \mathdefaultsmode=1
 \fi
+\let\@kernel at eqno\eqno
+\let\@kernel at leqno\leqno
+\protected\def\eqno{\@kernel at eqno\aftergroup\ignorespaces}
+\protected\def\leqno{\@kernel at leqno\aftergroup\ignorespaces}
 %%% From File: ltlists.dtx
 \newskip\topsep
 \newskip\partopsep
@@ -13781,7 +14316,9 @@
 \def\@cite#1#2{[{#1\if at tempswa , #2\fi}]}
 \let\@cite at ofmt\hbox
 \def\@biblabel#1{[#1]}
-%% File: ltmarks.dtx (C) Copyright 2022
+%% File: ltmarks.dtx
+%% Copyright (C) 2022-2023
+%% Frank Mittelbach, The LaTeX Project
 %%% From File: ltmarks.dtx
 \def\ltmarksversion{v1.0d}
 \def\ltmarksdate{2022/06/01}
@@ -14268,6 +14805,7 @@
 \def\IfFormatAtLeastTF{\@ifl at t@r\fmtversion}
 \let\IfPackageAtLeastTF\@ifpackagelater
 \let\IfClassAtLeastTF\@ifclasslater
+\def\IfFileAtLeastTF#1{\expandafter\@ifl at t@r\csname ver@#1\endcsname}
 \def\@ifl at ter#1#2{%
   \expandafter\@ifl at t@r
     \csname ver@#2.#1\endcsname}
@@ -15311,8 +15849,8 @@
   { \__keys_options_expand_module:Nn \keys_set:nn {#1} {#2} }
 \ExplSyntaxOff
 %%% From File: ltfilehook.dtx
-\providecommand\ltfilehookversion{v1.0n}
-\providecommand\ltfilehookdate{2022/08/18}
+\providecommand\ltfilehookversion{v1.0o}
+\providecommand\ltfilehookdate{2023/04/02}
 \ExplSyntaxOn
 \tl_new:N \CurrentFile
 \tl_new:N \CurrentFilePath
@@ -15481,7 +16019,7 @@
 \def\@kernel at make@file at csname#1#2#3{%
   \xdef#1{\expandafter\@set at curr@file at aux
     \csname\expandafter#2\@firstofone#3\@nil\endcsname}}
-\def\@set at curr@file at aux#1{%
+\long\def\@set at curr@file at aux#1{%
   \expandafter\ifx\csname\endcsname#1%
     .tex\else\string#1\fi}
 \def\@filehook at set@CurrentFile{%
@@ -15600,7 +16138,7 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%
 %% Copyright (C) 2020-2023
-%%               Frank Mittelbach, LaTeX Team
+%% Frank Mittelbach, The LaTeX Project
 %%
 %%% From File: ltshipout.dtx
 \providecommand\ltshipoutversion{v1.0n}
@@ -17447,6 +17985,17 @@
 \lccode`\^^[=`\^^[   % oe in OT1
 \fi % End of reset block for 8-bit engines
 \ExplSyntaxOn
+\newcommand*\BCPdata[1]{
+  \str_case:nn {#1}
+    {
+      { language } { en }
+      { region }   { US }
+      { script }   { Latn }
+      { tag }      { en-US }
+    }
+}
+\ExplSyntaxOff
+\ExplSyntaxOn
 \keys_define:nn { __kernel }
   {
     lang   .str_set:N = \reserved at a ,
@@ -17456,26 +18005,17 @@
   {
     \cs_set_nopar:Npn \reserved at a { }
     \tl_if_blank:nTF {#2}
-      { \@@text at case@aux@ }
-      { \keys_set:nn { __kernel } {#2} }
-    \use:c { text_ #1 case:Vn } \reserved at a {#3}
-  }
-\cs_new_protected:Npn \@@text at case@aux@ { }
-\tl_gput_right:Nn \@kernel at after@begindocument
-  {
-    \@ifpackageloaded { babel }
       {
-        \@ifpackagelater { babel } { 2020-01-15 }
+        \str_set:Nx \reserved at a
+          { \BCPdata { casing } }
+        \str_if_empty:NT \reserved at a
           {
-            \cs_gset_protected:Npn \@@text at case@aux@
-              {
-                \str_set:Nx \reserved at a
-                  { \localeinfo* { tag.bcp47 } }
-              }
+            \str_set:Nx \reserved at a
+              { \BCPdata { language } }
           }
-          { }
       }
-      { }
+      { \keys_set:nn { __kernel } {#2} }
+    \use:c { text_ #1 case:Vn } \reserved at a {#3}
   }
 \exp_args_generate:n { cnx }
 \cs_set_protected:Npn \reserved at a #1
@@ -17490,26 +18030,20 @@
 \reserved at a { Lower }
 \reserved at a { Title }
 \cs_new_protected:cpn { MakeLowercase \c_space_tl \c_space_tl \c_space_tl } [#1] #2
-  {
-    \let \kernel at saved@OE \OE
+  {{
     \let \OE \oe
     \@@text at case@aux { lower } {#1} {#2}
-    \let \OE \kernel at saved@OE
-  }
+  }}
 \cs_new_protected:cpn { MakeUppercase \c_space_tl \c_space_tl \c_space_tl } [#1] #2
-  {
-    \let \kernel at saved@oe \oe
+  {{
     \let \oe \OE
     \@@text at case@aux { upper } {#1} {#2}
-    \let \oe \kernel at saved@oe
-  }
+  }}
 \cs_new_protected:cpn { MakeTitlecase \c_space_tl \c_space_tl \c_space_tl } [#1] #2
-  {
-    \let \kernel at saved@oe \oe
+  {{
     \let \oe \OE
     \@@text at case@aux { title } {#1} {#2}
-    \let \oe \kernel at saved@oe
-  }
+  }}
 \cs_new_protected_nopar:Npn\AddToNoCaseChangeList
          {\tl_put_right:Nn \l_text_case_exclude_arg_tl}
 \AddToNoCaseChangeList{ \NoCaseChange }
@@ -17517,6 +18051,27 @@
 \cs_new_eq:NN \CaseSwitch \text_case_switch:nnnn
 \cs_new_eq:NN \DeclareCaseChangeEquivalent
   \text_declare_case_equivalent:Nn
+\NewDocumentCommand \DeclareLowercaseMapping { o m m }
+  {
+    \IFNoValueTF {#1}
+      { \text_declare_lowercase_mapping:nn }
+      { \text_declare_lowercase_mapping:nnn {#1} }
+        {#2} {#3}
+  }
+\NewDocumentCommand \DeclareTitlecaseMapping { o m m }
+  {
+    \IFNoValueTF {#1}
+      { \text_declare_titlecase_mapping:nn }
+      { \text_declare_titlecase_mapping:nnn {#1} }
+        {#2} {#3}
+  }
+\NewDocumentCommand \DeclareUppercaseMapping { o m m }
+  {
+    \IFNoValueTF {#1}
+      { \text_declare_uppercase_mapping:nn }
+      { \text_declare_uppercase_mapping:nnn {#1} }
+        {#2} {#3}
+  }
 \ExplSyntaxOff
 \def\@uclclist{\oe\OE\o\O\ae\AE
       \dh\DH\dj\DJ\l\L\ng\NG\ss\SS\ij\IJ\th\TH}

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/latexrelease.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/latexrelease.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/latexrelease.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -765,6 +765,7 @@
 \def\extrafloats#1{%
 \ifnum#1>\z@
 \count@\numexpr\float at count-1\relax
+  \ifnum\count@<266 \ch at ck0\m at ne\insert\fi
   \ch at ck0\count@\count
   \ch at ck1\count@\dimen
   \ch at ck2\count@\skip
@@ -773,8 +774,7 @@
 \global\expandafter\e at alloc@chardef
             \csname bx@\the\float at count\endcsname\float at count
 \@cons\@freelist{\csname bx@\the\float at count\endcsname}%
-\expandafter
-\extrafloats\expandafter{\numexpr#1-1\relax}%
+\expandafter\extrafloats\expandafter{\the\numexpr#1-1\expandafter}%
 \fi}%
 \fi
 \EndIncludeInRelease
@@ -1986,8 +1986,8 @@
 
 \EndIncludeInRelease
 %%% From File: ltcmd.dtx
-\def\ltcmdversion{v1.1b}
-\def\ltcmddate{2022-11-29}
+\def\ltcmdversion{v1.1d}
+\def\ltcmddate{2023-04-13}
 \edef\@latexrelease at catcode@null{\the\catcode`\^^@ }
 \catcode`\^^@=12
 \ExplSyntaxOn
@@ -3054,6 +3054,12 @@
     \exp_not:c { #8 ~ } \exp_not:c { #8 ~ code }
     \exp_not:n { {#5} {#6} {#7} }
   }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__cmd_copy:NN}%
+  {Support~\NewCommandCopy~in~ltcmd}
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__cmd_copy_expandable:nnNN}%
+  {Distinguish~non-expandable~document~commands}
 \cs_new_protected:Npn \__cmd_copy_expandable:nnNN #1 #2 #3 #4
   {
     \cs_set_eq:cc { #1 ~ code } { #2 ~ code }
@@ -3061,9 +3067,30 @@
     \__cmd_set_eq_if_exist:cc { #1 ~ \c_space_tl } { #2 ~ \c_space_tl }
     \__cmd_set_eq_if_exist:cc { #1 ~ defaults } { #2 ~ defaults }
     \exp_after:wN \__cmd_copy_expandable_signature:NnNNNNnnn #4 {#1} {#2}
+    \token_if_protected_macro:NTF #4
+      { \cs_set_protected_nopar:Npx }{ \cs_set_nopar:Npx }
+      #3
+      { \exp_after:wN \__cmd_copy_expandable:NnNNNNnnn #4 {#1} {#2} }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2021/11/15}{\__cmd_copy_expandable:nnNN}%
+  {Support~\NewCommandCopy~in~ltcmd}
+\cs_new_protected:Npn \__cmd_copy_expandable:nnNN #1 #2 #3 #4
+  {
+    \cs_set_eq:cc { #1 ~ code } { #2 ~ code }
+    \__cmd_set_eq_if_exist:cc { #1 ~ } { #2 ~ }
+    \__cmd_set_eq_if_exist:cc { #1 ~ \c_space_tl } { #2 ~ \c_space_tl }
+    \__cmd_set_eq_if_exist:cc { #1 ~ defaults } { #2 ~ defaults }
+    \exp_after:wN \__cmd_copy_expandable_signature:NnNNNNnnn #4 {#1} {#2}
     \cs_set_nopar:Npx #3
       { \exp_after:wN \__cmd_copy_expandable:NnNNNNnnn #4 {#1} {#2} }
   }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__cmd_copy_expandable:nnNN}%
+  {Support~\NewCommandCopy~in~ltcmd}
+\EndIncludeInRelease
+\IncludeInRelease{2021/11/15}{\__cmd_copy:NN (part 2)}%
+  {Support~\NewCommandCopy~in~ltcmd}
 \cs_new:Npn \__cmd_copy_expandable:NnNNNNnnn #1 #2 #3 #4 #5 #6 #7 #8 #9
   {
     \exp_not:N #1 \exp_not:n { {#2} }
@@ -3180,7 +3207,7 @@
   }
 \exp_args:No \__cmd_tmp:w { \tl_to_str:n { end } }
 \EndIncludeInRelease
-\IncludeInRelease{2020/10/01}{\__cmd_copy:NN}%
+\IncludeInRelease{2020/10/01}{\__cmd_copy:NN (part 2)}%
   {Support~\NewCommandCopy~in~ltcmd}
 \EndIncludeInRelease
 \IncludeInRelease{2021/11/15}{\__cmd_show:N}%
@@ -3210,11 +3237,32 @@
   }
 \cs_new_protected:Npn \__cmd_show_expandable:N #1
   { \exp_after:wN \__cmd_show_expandable:NnNNNNnN #1 #1 }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__cmd_show:N}%
+  {Support~\ShowCommand~in~ltcmd}
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__cmd_show_expandable:NnNNNNnN}%
+  {Distinguish~non-expandable~document~commands}
 \cs_new_protected:Npn \__cmd_show_expandable:NnNNNNnN #1 #2 #3 #4 #5 #6 #7 #8
   {
+    \exp_args:NNe \__cmd_show_command_aux:NnNNn \tl_show:x
+      { \token_if_protected_macro:NF #8 { expandable~ } document~command }
+      #8 #5 {#2}
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2021/11/15}{\__cmd_show_expandable:NnNNNNnN}%
+  {Support~\ShowCommand~in~ltcmd}
+\cs_new_protected:Npn \__cmd_show_expandable:NnNNNNnN #1 #2 #3 #4 #5 #6 #7 #8
+  {
     \__cmd_show_command_aux:NnNNn \tl_show:x
       { expandable~document~command } #8 #5 {#2}
   }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__cmd_show_expandable:NnNNNNnN}%
+  {Support~\ShowCommand~in~ltcmd}
+\EndIncludeInRelease
+\IncludeInRelease{2021/11/15}{\__cmd_show:N (part 2)}%
+  {Support~\ShowCommand~in~ltcmd}
 \cs_new_protected:Npn \__cmd_show_command_aux:NnNNn #1 #2 #3 #4 #5
   {
     \__cmd_split_signature:n {#5}
@@ -3336,7 +3384,7 @@
     \int_incr:N \l__cmd_current_arg_int
   }
 \EndIncludeInRelease
-\IncludeInRelease{2020/10/01}{\__cmd_show:N}%
+\IncludeInRelease{2020/10/01}{\__cmd_show:N (part 2)}%
   {Support~\ShowCommand~in~ltcmd}
 \EndIncludeInRelease
 \cs_new_protected:Npn \__cmd_grab_b:w
@@ -3670,6 +3718,7 @@
     \tl_set:Nn \l__cmd_signature_tl {#1}
     \group_begin:
       \tex_escapechar:D = 92 \scan_stop:
+      \tex_endlinechar:D = `\^^M \scan_stop:
       \tl_clear:N \l__cmd_v_arg_tl
       \peek_remove_spaces:n
         {
@@ -3687,8 +3736,8 @@
   }
 \cs_new_protected:Npn \__cmd_grab_v_group_end:
   {
-        \exp_args:NNNo
-      \group_end:
+      \exp_args:NNNo
+    \group_end:
     \tl_set:Nn \l__cmd_v_arg_tl { \l__cmd_v_arg_tl }
   }
 \cs_new_protected:Npn \__cmd_grab_v_aux_test:N #1
@@ -3766,7 +3815,6 @@
   {
     \cs_set_eq:NN \do \char_set_catcode_other:N
     \dospecials
-    \tex_endlinechar:D = `\^^M \scan_stop:
     \bool_if:NTF \l__cmd_long_bool
       { \char_set_catcode_other:n { \tex_endlinechar:D } }
       { \char_set_catcode_parameter:n { \tex_endlinechar:D } }
@@ -4836,8 +4884,8 @@
 \catcode`\^^@=\@latexrelease at catcode@null\relax
 
 %%% From File: lthooks.dtx
-\def\lthooksversion{v1.0v}
-\def\lthooksdate{2022/06/15}
+\def\lthooksversion{v1.1d}
+\def\lthooksdate{2023/05/21}
 \ExplSyntaxOn
 \NewModuleRelease{2020/10/01}{lthooks}
                  {The~hook~management~system}
@@ -4870,44 +4918,64 @@
 \tl_new:N \g__hook_hook_curr_name_tl
 \seq_new:N \g__hook_name_stack_seq
 \cs_new_eq:NN \__hook_tmp:w ?
+\tl_const:Nn \c__hook_empty_tl { }
+\tl_const:Nn \c__hook_nine_parameters_tl { #1#2#3#4#5#6#7#8#9 }
 \cs_generate_variant:Nn \tl_gremove_once:Nn { Nx }
 \cs_generate_variant:Nn \tl_show:n { x }
 \cs_generate_variant:Nn \tl_log:n { x }
+\cs_generate_variant:Nn \tl_set:Nn { Ne }
+\cs_generate_variant:Nn \cs_replacement_spec:N { c }
+\cs_generate_variant:Nn \prop_put:Nnn { Nne }
+\cs_generate_variant:Nn \str_count:n { e }
 \scan_new:N \s__hook_mark
-\cs_new:Npn \__hook_clean_to_scan:w #1 \s__hook_mark { }
-\cs_new_protected:Npn \__hook_tl_set:Nn #1#2
-  { \cs_set_nopar:Npx #1 { \__kernel_exp_not:w {#2} } }
-\cs_new_protected:Npn \__hook_tl_set:Nx #1#2
-  { \cs_set_nopar:Npx #1 {#2} }
-\cs_generate_variant:Nn \__hook_tl_set:Nn { c }
-\cs_generate_variant:Nn \__hook_tl_set:Nx { c }
+\cs_new:Npn \__hook_use_none_delimit_by_s_mark:w #1 \s__hook_mark { }
+\cs_new:Npn \__hook_use_i_delimit_by_s_mark:nw #1 #2 \s__hook_mark {#1}
+\cs_new_protected:Npn \__hook_tl_set:cn #1#2
+  { \cs_set_nopar:cpx {#1} { \__kernel_exp_not:w {#2} } }
 \cs_new_protected:Npn \__hook_tl_gset:Nn #1#2
   { \cs_gset_nopar:Npx #1 { \__kernel_exp_not:w {#2} } }
-\cs_new_protected:Npn \__hook_tl_gset:No #1#2
-  { \cs_gset_nopar:Npx #1 { \__kernel_exp_not:w \exp_after:wN {#2} } }
 \cs_new_protected:Npn \__hook_tl_gset:Nx #1#2
   { \cs_gset_nopar:Npx #1 {#2} }
-\cs_generate_variant:Nn \__hook_tl_gset:Nn { c }
-\cs_generate_variant:Nn \__hook_tl_gset:No { c }
+\cs_generate_variant:Nn \__hook_tl_gset:Nn { c, co }
 \cs_generate_variant:Nn \__hook_tl_gset:Nx { c }
 \cs_new_protected:Npn \__hook_tl_gput_right:Nn #1#2
   { \__hook_tl_gset:Nx #1 { \__kernel_exp_not:w \exp_after:wN { #1 #2 } } }
-\cs_generate_variant:Nn \__hook_tl_gput_right:Nn { No, cn }
+\cs_generate_variant:Nn \__hook_tl_gput_right:Nn { Ne, cn }
 \cs_new_protected:Npn \__hook_tl_gput_left:Nn #1#2
   {
     \__hook_tl_gset:Nx #1
       { \__kernel_exp_not:w {#2} \__kernel_exp_not:w \exp_after:wN {#1} }
   }
-\cs_generate_variant:Nn \__hook_tl_gput_left:Nn { No }
 \cs_new_eq:NN \__hook_tl_gset_eq:NN \tl_gset_eq:NN
 \cs_new_protected:Npn \__hook_tl_gclear:N #1
   { \__hook_tl_gset_eq:NN #1 \c_empty_tl }
 \cs_generate_variant:Nn \__hook_tl_gclear:N { c }
 
-
+\IncludeInRelease{2023/06/01}{\hook_new_with_args:nn}
+                 {Hooks~with~args}
 \cs_new_protected:Npn \hook_new:n #1
+  { \__hook_normalize_hook_args:Nn \__hook_new:nn {#1} { 0 } }
+\cs_new_protected:Npn \hook_new_with_args:nn #1 #2
+  { \__hook_normalize_hook_args:Nn \__hook_new:nn {#1} {#2} }
+\cs_new_protected:Npn \__hook_new:nn #1 #2
+  {
+    \__hook_if_declared:nTF {#1}
+      { \msg_error:nnn { hooks } { exists } {#1} }
+      {
+        \tl_new:c { g__hook_#1_declared_tl }
+        \cs_undefine:c { __hook~#1 }
+        \cs_undefine:c { c__hook_#1_parameter_tl }
+        \__hook_make_usable:nn {#1} {#2}
+        \__hook_update_hook_code:n {#1}
+      }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\hook_new_with_args:nn}
+                 {Hooks~with~args}
+\cs_gset_protected:Npn \hook_new:n #1
   { \__hook_normalize_hook_args:Nn \__hook_new:n {#1} }
-\cs_new_protected:Npn \__hook_new:n #1
+\cs_undefine:N \__hook_new:nn
+\cs_gset_protected:Npn \__hook_new:n #1
   {
     \__hook_if_declared:nTF {#1}
       { \msg_error:nnn { hooks } { exists } {#1} }
@@ -4916,8 +4984,41 @@
         \__hook_make_usable:n {#1}
       }
   }
-\cs_new_protected:Npn \__hook_make_usable:n #1
+\cs_gset_protected:Npn \hook_new_with_args:nn #1 { }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_make_usable:nn}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \__hook_make_usable:nn #1 #2
   {
+    \__hook_if_usable:nF {#1}
+      {
+        \seq_gput_right:Nn \g__hook_all_seq {#1}
+        \__kernel_cs_parm_from_arg_count:nnF
+          { \tl_const:cn { c__hook_#1_parameter_tl } } {#2}
+          {
+            \msg_error:nnnn { hooks } { too-many-args } {#1} {#2}
+            \tl_const:cx { c__hook_#1_parameter_tl }
+              { \exp_not:V \c__hook_nine_parameters_tl }
+          }
+        \__hook_normalise_cs_args:nn { _toplevel } {#1}
+        \__hook_normalise_cs_args:nn { _next } {#1}
+        \__hook_code_gset:nn {#1} { }
+        \__hook_init_structure:n {#1}
+        \__hook_normalise_code_pool:n {#1}
+        \clist_if_exist:cF { g__hook_#1_labels_clist }
+          {
+            \clist_new:c { g__hook_#1_labels_clist }
+            \tl_new:c { g__hook_#1_reversed_tl }
+          }
+        \__hook_include_legacy_code_chunk:n {#1}
+      }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_make_usable:nn}
+                 {Hooks~with~args}
+\cs_undefine:N \__hook_make_usable:nn
+\cs_gset_protected:Npn \__hook_make_usable:n #1
+  {
     \tl_if_exist:cF { __hook~#1 }
       {
         \seq_gput_right:Nn \g__hook_all_seq {#1}
@@ -4928,24 +5029,92 @@
         \__hook_include_legacy_code_chunk:n {#1}
       }
   }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_init_structure:n}
+                 {Hooks~with~args}
 \cs_new_protected:Npn \__hook_init_structure:n #1
   {
     \__hook_if_structure_exist:nF {#1}
       {
         \prop_new:c { g__hook_#1_code_prop }
+        \__hook_toplevel_gset:nn {#1} { }
+        \__hook_next_gset:nn {#1} { }
+      }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_init_structure:n}
+                 {Hooks~with~args}
+\cs_gset_protected:Npn \__hook_init_structure:n #1
+  {
+    \__hook_if_structure_exist:nF {#1}
+      {
+        \prop_new:c { g__hook_#1_code_prop }
         \tl_new:c { __hook_toplevel~#1 }
         \tl_new:c { __hook_next~#1 }
       }
   }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\hook_new_reversed_with_args:nn}
+                 {Hooks~with~args}
 \cs_new_protected:Npn \hook_new_reversed:n #1
+  { \__hook_normalize_hook_args:Nn \__hook_new_reversed:nn {#1} { 0 } }
+\cs_new_protected:Npn \hook_new_reversed_with_args:nn #1 #2
+  { \__hook_normalize_hook_args:Nn \__hook_new_reversed:nn {#1} {#2} }
+\cs_new_protected:Npn \__hook_new_reversed:nn #1 #2
+  {
+    \__hook_if_declared:nTF {#1}
+      { \msg_error:nnn { hooks } { exists } {#1} }
+      {
+        \__hook_new:nn {#1} {#2}
+        \tl_gset:cn { g__hook_#1_reversed_tl } { - }
+      }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\hook_new_reversed_with_args:nn}
+                 {Hooks~with~args}
+\cs_gset_protected:Npn \hook_new_reversed:n #1
   { \__hook_normalize_hook_args:Nn \__hook_new_reversed:n {#1} }
-\cs_new_protected:Npn \__hook_new_reversed:n #1
+\cs_undefine:N \__hook_new_reversed:nn
+\cs_gset_protected:Npn \__hook_new_reversed:n #1
   {
     \__hook_new:n {#1}
     \tl_gset:cn { g__hook_#1_reversed_tl } { - }
   }
+\cs_undefine:N \__hook_new_reversed:nn
+\cs_gset_protected:Npn \hook_new_reversed_with_args:nn #1 #2 { }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\hook_new_pair_with_args:nnn}
+                 {Hooks~with~args}
 \cs_new_protected:Npn \hook_new_pair:nn #1#2
-  { \hook_new:n {#1} \hook_new_reversed:n {#2} }
+  { \__hook_normalize_hook_args:Nnn \__hook_new_pair:nnn {#1} {#2} { 0 } }
+\cs_new_protected:Npn \hook_new_pair_with_args:nnn #1#2#3
+  { \__hook_normalize_hook_args:Nnn \__hook_new_pair:nnn {#1} {#2} {#3} }
+\cs_new_protected:Npn \__hook_new_pair:nnn #1 #2 #3
+  {
+    \__hook_if_declared:nTF {#1}
+      { \msg_error:nnn { hooks } { exists } {#1} }
+      {
+        \__hook_if_declared:nTF {#2}
+          { \msg_error:nnn { hooks } { exists } {#2} }
+          {
+            \__hook_new:nn {#1} {#3}
+            \__hook_new_reversed:nn {#2} {#3}
+          }
+      }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\hook_new_pair_with_args:nnn}
+                 {Hooks~with~args}
+\cs_gset_protected:Npn \hook_new_pair:nn #1#2
+  {
+    \hook_new:n {#1}
+    \hook_new_reversed:n {#2}
+  }
+\cs_gset_protected:Npn \hook_new_pair_with_args:nnn #1#2#3
+  { }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_include_legacy_code_chunk:n}
+                 {Hooks~with~args}
 \cs_new_protected:Npn \__hook_include_legacy_code_chunk:n #1
   {
     \tl_if_exist:cT { @#1hook }
@@ -4952,14 +5121,35 @@
       {
         \tl_if_empty:cF { @#1hook }
           {
-            \exp_args:Nnnv \__hook_hook_gput_code_do:nnn {#1}
-                                  { legacy } { @#1hook }
+            \__hook_replacing_args_false:
+            \use:e
+              {
+                \__hook_hook_gput_code_do:nnn {#1} { legacy }
+                  { \exp_not:v { @#1hook } }
+              }
+            \__hook_replacing_args_reset:
             \__hook_tl_gclear:c { @#1hook }
           }
       }
   }
-\IncludeInRelease{2021/06/01}%
-         {\hook_disable_generic:n}{Disable~hooks}
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_include_legacy_code_chunk:n}
+                 {Hooks~with~args}
+\cs_gset_protected:Npn \__hook_include_legacy_code_chunk:n #1
+  {
+    \tl_if_exist:cT { @#1hook }
+      {
+        \tl_if_empty:cF { @#1hook }
+          {
+            \exp_args:Nnnv \__hook_hook_gput_code_do:nnn
+              {#1} { legacy } { @#1hook }
+            \__hook_tl_gclear:c { @#1hook }
+          }
+      }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2021/06/01}{\hook_disable_generic:n}
+                 {Disable~hooks}
 \cs_new_protected:Npn \hook_disable_generic:n #1
   { \__hook_normalize_hook_args:Nn \__hook_disable:n {#1} }
 \cs_new_protected:Npn \__hook_disable:n #1
@@ -4971,19 +5161,19 @@
   {
     \bool_lazy_and:nnTF
         { \tl_if_exist_p:c { g__hook_#1_declared_tl } }
-        { ! \tl_if_exist_p:c { __hook~#1 } }
+        { ! \cs_if_exist_p:c { __hook~#1 } }
       { \prg_return_true: }
       { \prg_return_false: }
   }
 \EndIncludeInRelease
-\IncludeInRelease{2020/10/01}
-                 {\hook_disable_generic:n}{Disable~hooks}
+\IncludeInRelease{2020/10/01}{\hook_disable_generic:n}
+                 {Disable~hooks}
 
 \cs_new_protected:Npn \hook_disable_generic:n #1 {}
 
 \EndIncludeInRelease
-\IncludeInRelease{2021/06/01}%
-         {\hook_activate_generic:n}{Providing~hooks}
+\IncludeInRelease{2023/06/01}{\hook_activate_generic:n}
+                 {Providing~hooks}
 \cs_new_protected:Npn \hook_activate_generic:n #1
   { \__hook_normalize_hook_args:Nn \__hook_activate_generic:nn {#1} {   } }
 \cs_new_protected:Npn \__hook_activate_generic:nn #1 #2
@@ -4994,6 +5184,24 @@
         \__hook_if_declared:nF {#1}
           {
             \tl_new:c { g__hook_#1_declared_tl }
+            \__hook_make_usable:nn {#1} { 0 }
+            \tl_gset:cx { g__hook_#1_reversed_tl }
+              { \__hook_if_generic_reversed:nT {#1} { - } }
+            \__hook_update_hook_code:n {#1}
+          }
+      }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2021/06/01}{\hook_activate_generic:n}
+                 {Providing~hooks}
+\cs_gset_protected:Npn \__hook_activate_generic:nn #1 #2
+  {
+    \__hook_if_disabled:nTF {#1}
+      { \msg_warning:nnn { hooks } { activate-disabled } {#1} }
+      {
+        \__hook_if_declared:nF {#1}
+          {
+            \tl_new:c { g__hook_#1_declared_tl }
             \__hook_make_usable:n {#1}
             \tl_gset:cx { g__hook_#1_reversed_tl }
               { \__hook_if_generic_reversed:nT {#1} { - } }
@@ -5002,11 +5210,9 @@
       }
   }
 \EndIncludeInRelease
-\IncludeInRelease{2020/10/01}
-                 {\hook_activate_generic:n}{Providing~hooks}
-
-\cs_new_protected:Npn \hook_activate_generic:n #1 {}
-
+\IncludeInRelease{2020/10/01}{\hook_activate_generic:n}
+                 {Providing~hooks}
+\cs_gset_protected:Npn \hook_activate_generic:n #1 { }
 \EndIncludeInRelease
 \cs_new:Npn \__hook_parse_label_default:n #1
   {
@@ -5161,11 +5367,106 @@
       }
       { \tl_gset:Nn \g__hook_hook_curr_name_tl {#1} }
   }
-\cs_new_protected:Npn \hook_gput_code:nnn #1 #2
-  { \__hook_normalize_hook_args:Nnn \__hook_gput_code:nnn {#1} {#2} }
+\IncludeInRelease{2023/06/01}{\hook_gput_code_with_args:nnn}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \hook_gput_code:nnn #1 #2 #3
+  {
+    \__hook_replacing_args_false:
+    \__hook_normalize_hook_args:Nnn \__hook_gput_code:nnn {#1} {#2} {#3}
+    \__hook_replacing_args_reset:
+  }
+\cs_new_protected:Npn \hook_gput_code_with_args:nnn #1 #2 #3
+  {
+    \__hook_replacing_args_true:
+    \__hook_normalize_hook_args:Nnn \__hook_gput_code:nnn {#1} {#2} {#3}
+    \__hook_replacing_args_reset:
+  }
 \cs_new_protected:Npn \__hook_gput_code:nnn #1 #2 #3
   {
+    \__hook_chk_args_allowed:nn {#1} { AddToHook }
     \__hook_if_execute_immediately:nTF {#1}
+      {
+        \__hook_if_replacing_args:TF
+          {
+            \msg_error:nnnn { hooks } { one-time-args }
+              {#1} { AddToHook }
+          }
+          { }
+        \use:n
+      }
+      { \__hook_gput_code_store:nnn {#1} {#2} }
+          {#3}
+  }
+\cs_new_protected:Npn \__hook_gput_code_store:nnn #1 #2 #3
+  {
+    \__hook_if_usable:nTF {#1}
+      {
+        \__hook_hook_gput_code_do:nnn {#1} {#2} {#3}
+        \__hook_update_hook_code:n {#1}
+      }
+      {
+        \__hook_if_disabled:nTF {#1}
+          { \msg_error:nnn { hooks } { hook-disabled } {#1} }
+          { \__hook_try_declaring_generic_hook:nnn {#1} {#2} {#3} }
+      }
+  }
+\cs_new_protected:Npn \__hook_hook_gput_code_do:nnn #1 #2 #3
+  {
+    \__hook_debug:n{\iow_term:x{****~ Add~ to~
+                      \__hook_if_usable:nF {#1} { undeclared~ }
+                      hook~ #1~ (#2)
+                      \on at line\space <-~ \tl_to_str:n{#3}} }
+    \str_if_eq:nnTF {#2} { top-level }
+      {
+        \str_if_eq:eeTF { top-level } { \__hook_currname_or_default: }
+          {
+            \__hook_init_structure:n {#1}
+            \__hook_cs_gput_right:nnn { _toplevel } {#1} {#3}
+          }
+          { \msg_error:nnn { hooks } { misused-top-level } {#1} }
+      }
+      {
+        \exp_args:Nx \__hook_prop_gput_labeled_cleanup:nnn
+          {
+            \__hook_if_replacing_args:TF
+              { \exp_not:n }
+              { \__hook_double_hashes:n }
+                {#3}
+          }
+          {#1} {#2}
+      }
+  }
+\cs_new_protected:Npn \__hook_prop_gput_labeled_cleanup:nnn #1 #2 #3
+  {
+    \tl_set:Nn \l__hook_return_tl {#1}
+    \__hook_if_replacing_args:TF
+      {
+        \__hook_if_usable:nT {#2}
+          {
+            \__hook_set_normalise_fn:nn {#2}
+              { Invalid~code~added~\msg_line_context: }
+            \__hook_normalise_fn:nn {#3} {#1}
+            \prop_get:NnN \l__hook_work_prop {#3} \l__hook_return_tl
+          }
+      }
+      { }
+    \exp_args:NcV \__hook_prop_gput_labeled_do:Nnn
+      { g__hook_#2_code_prop } \l__hook_return_tl {#3}
+  }
+\cs_new_protected:Npn \__hook_prop_gput_labeled_do:Nnn #1 #2 #3
+  {
+    \prop_get:NnNTF #1 {#3} \l__hook_return_tl
+      { \prop_gput:Nno #1 {#3} { \l__hook_return_tl #2 } }
+      { \prop_gput:Nnn #1 {#3} {#2} }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\hook_gput_code:nnn}
+                 {Providing~hooks}
+\cs_gset_protected:Npn \hook_gput_code:nnn #1 #2
+  { \__hook_normalize_hook_args:Nnn \__hook_gput_code:nnn {#1} {#2} }
+\cs_gset_protected:Npn \__hook_gput_code:nnn #1 #2 #3
+  {
+    \__hook_if_execute_immediately:nTF {#1}
       {#3}
       {
         \__hook_if_usable:nTF {#1}
@@ -5180,7 +5481,7 @@
           }
       }
   }
-\cs_new_protected:Npn \__hook_hook_gput_code_do:nnn #1 #2 #3
+\cs_gset_protected:Npn \__hook_hook_gput_code_do:nnn #1 #2 #3
   {
     \__hook_debug:n{\iow_term:x{****~ Add~ to~
                       \__hook_if_usable:nF {#1} { undeclared~ }
@@ -5204,14 +5505,54 @@
           { \prop_gput:cnn { g__hook_#1_code_prop } {#2} {#3} }
       }
   }
+\cs_gset_protected:Npn \hook_gput_code_with_args:nnn #1#2#3 { }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_chk_args_allowed:nn}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \__hook_chk_args_allowed:nn #1 #2
+  {
+    \__hook_if_replacing_args:TF
+      {
+        \__hook_if_declared:nT {#1}
+          { \tl_if_empty:cT { c__hook_#1_parameter_tl } { \use_ii:nn } }
+        \use_none:n
+          {
+            \msg_error:nnnn { hooks } { without-args } {#1} {#2}
+            \__hook_replacing_args_false:
+          }
+      }
+      { }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_chk_args_allowed:nn}
+                 {Hooks~with~args}
+\cs_undefine:N \__hook_chk_args_allowed:nn
+\EndIncludeInRelease
 \cs_new_protected:Npn \__hook_gput_undeclared_hook:nnn #1 #2 #3
   {
     \__hook_init_structure:n {#1}
     \__hook_hook_gput_code_do:nnn {#1} {#2} {#3}
   }
+\IncludeInRelease{2023/06/01}{\__hook_try_declaring_generic_hook:nnn}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \__hook_try_declaring_generic_hook:nnn #1
+  {
+    \__hook_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1}
+      \__hook_gput_code:nnn
+      \__hook_gput_undeclared_hook:nnn
+        {#1}
+  }
+\cs_new_protected:Npn \__hook_try_declaring_generic_next_hook:nn #1
+  {
+    \__hook_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1}
+      \__hook_gput_next_code:nn
+      \__hook_gput_next_do:nn
+        {#1}
+  }
+\EndIncludeInRelease
 \IncludeInRelease{2021/11/15}{\__hook_try_declaring_generic_hook:nnn}
                  {Standardise~generic~hook~names}
-\cs_new_protected:Npn \__hook_try_declaring_generic_hook:nnn #1
+\cs_gset_protected:Npn \__hook_try_declaring_generic_hook:nnn #1
   {
     \__hook_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1}
       \hook_gput_code:nnn
@@ -5218,7 +5559,7 @@
       \__hook_gput_undeclared_hook:nnn
         {#1}
   }
-\cs_new_protected:Npn \__hook_try_declaring_generic_next_hook:nn #1
+\cs_gset_protected:Npn \__hook_try_declaring_generic_next_hook:nn #1
   {
     \__hook_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1}
       \hook_gput_next_code:nn
@@ -5254,8 +5595,8 @@
       { #3 } {#1}
   }
 \EndIncludeInRelease
-\IncludeInRelease{2021/11/15}{\__hook_try_declaring_generic_hook:wn}%
-                 {Standardise~generic~hook~names}
+\IncludeInRelease{2023/06/01}{\__hook_try_declaring_generic_hook:wn}
+                 {Hooks~with~args}
 \prg_new_protected_conditional:Npnn \__hook_try_declaring_generic_hook:wn
     #1 / #2 / #3 / #4 \scan_stop: #5 { TF }
   {
@@ -5264,8 +5605,12 @@
         \__hook_if_usable:nF {#5}
           {
             \str_if_eq:nnT {#1} { cmd }
-              { \__hook_try_put_cmd_hook:n {#5} }
-            \__hook_make_usable:n {#5}
+              {
+                \__hook_try_put_cmd_hook:n {#5}
+                \__hook_make_usable:nn {#5} { 9 }
+                \use_none:nnn
+              }
+            \__hook_make_usable:nn {#5} { 0 }
           }
         \__hook_if_generic_reversed:nT {#5}
           { \tl_gset:cn { g__hook_#5_reversed_tl } { - } }
@@ -5306,6 +5651,34 @@
       #1 #2 { #3 / #5 / #4 }
   }
 \EndIncludeInRelease
+\IncludeInRelease{2021/11/15}{\__hook_try_declaring_generic_hook:wn}
+                 {Standardise~generic~hook~names}
+\prg_new_protected_conditional:Npnn \__hook_try_declaring_generic_hook:wn
+    #1 / #2 / #3 / #4 \scan_stop: #5 { TF }
+  {
+    \__hook_if_generic:nTF {#5}
+      {
+        \__hook_if_usable:nF {#5}
+          {
+            \str_if_eq:nnT {#1} { cmd }
+              { \__hook_try_put_cmd_hook:n {#5} }
+            \__hook_make_usable:n {#5}
+          }
+        \__hook_if_generic_reversed:nT {#5}
+          { \tl_gset:cn { g__hook_#5_reversed_tl } { - } }
+        \prg_return_true:
+      }
+      {
+        \__hook_if_deprecated_generic:nTF {#5}
+          {
+            \__hook_deprecated_generic_warn:n {#5}
+            \exp_after:wN \__hook_declare_deprecated_generic:NNn
+            \exp:w % \exp_end:
+          }
+          { \prg_return_false: }
+      }
+  }
+\EndIncludeInRelease
 \IncludeInRelease{2021/06/01}{\__hook_try_declaring_generic_hook:wn}
                  {Support~cmd~hooks}
 \prg_new_protected_conditional:Npnn \__hook_try_declaring_generic_hook:wn
@@ -5334,7 +5707,7 @@
       }
   }
 \EndIncludeInRelease
-\IncludeInRelease{2020/10/01}{\__hook_try_declaring_generic_hook:wn}%
+\IncludeInRelease{2020/10/01}{\__hook_try_declaring_generic_hook:wn}
                  {Support~cmd~hooks}
 \prg_new_protected_conditional:Npnn \__hook_try_declaring_generic_hook:wn
     #1 / #2 / #3 / #4 \scan_stop: #5 { TF }
@@ -5356,23 +5729,11 @@
           { \prg_return_false: }
       }
   }
-
 \EndIncludeInRelease
-\IncludeInRelease{2021/11/15}{\__hook_if_file_hook:w}%
+\IncludeInRelease{2021/11/15}{\__hook_if_file_hook:w}
                  {Standardise~generic~hook~names}
-\prg_new_conditional:Npnn \__hook_if_file_hook:w
-    #1 / #2 \s__hook_mark #3 { TF }
-  {
-    \__hook_if_generic:nTF {#3}
-      {
-        \str_if_eq:nnTF {#1} { file }
-          { \prg_return_true: }
-          { \prg_return_false: }
-      }
-      { \prg_return_false: }
-  }
 \EndIncludeInRelease
-\IncludeInRelease{2020/10/01}{\__hook_if_file_hook:w}%
+\IncludeInRelease{2020/10/01}{\__hook_if_file_hook:w}
                  {Standardise~generic~hook~names}
 \prg_new_conditional:Npnn \__hook_if_file_hook:w
     #1 / #2 / #3 \s__hook_mark { TF }
@@ -5392,10 +5753,10 @@
       { \prg_return_false: }
   }
 \EndIncludeInRelease
-\IncludeInRelease{2021/11/15}{\__hook_file_hook_normalize:n}%
+\IncludeInRelease{2021/11/15}{\__hook_file_hook_normalize:n}
                  {Standardise~generic~hook~names}
 \EndIncludeInRelease
-\IncludeInRelease{2020/10/01}{\__hook_file_hook_normalize:n}%
+\IncludeInRelease{2020/10/01}{\__hook_file_hook_normalize:n}
                  {Standardise~generic~hook~names}
 \cs_new:Npn \__hook_file_hook_normalize:n #1
   { \__hook_strip_double_slash:n {#1} }
@@ -5408,7 +5769,7 @@
       { \__hook_strip_double_slash:w #1/#2/#3 / #4 \s__hook_mark }
   }
 \EndIncludeInRelease
-\IncludeInRelease{2021/11/15}{\c__hook_generics_prop}%
+\IncludeInRelease{2021/11/15}{\c__hook_generics_prop}
                  {Standardise~generic~hook~names}
 \clist_map_inline:nn { cmd , env , file , package , class , include }
   {
@@ -5426,20 +5787,30 @@
   }
 \tl_const:cn { c__hook_deprecated_include/./end_tl } { }
 \EndIncludeInRelease
-\IncludeInRelease{2020/10/01}{\c__hook_generics_prop}%
+\IncludeInRelease{2020/10/01}{\c__hook_generics_prop}
                  {Standardise~generic~hook~names}
 \prop_const_from_keyval:Nn \c__hook_generics_prop
      {cmd=,env=,file=,package=,class=,include=}
 \EndIncludeInRelease
-\IncludeInRelease{2021/11/15}{\c__hook_generics_reversed_ii_prop}%
+\IncludeInRelease{2021/11/15}{\c__hook_generics_reversed_ii_prop}
                  {Standardise~generic~hook~names}
 \EndIncludeInRelease
-\IncludeInRelease{2020/10/01}{\c__hook_generics_reversed_ii_prop}%
+\IncludeInRelease{2020/10/01}{\c__hook_generics_reversed_ii_prop}
                  {Standardise~generic~hook~names}
 \prop_const_from_keyval:Nn \c__hook_generics_reversed_ii_prop {after=,end=}
 \prop_const_from_keyval:Nn \c__hook_generics_reversed_iii_prop {after=}
 \prop_const_from_keyval:Nn \c__hook_generics_file_prop {before=,after=}
 \EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\c__hook_parameter_cmd/./before_tl}
+                 {Hooks~with~args}
+\tl_const:cn { c__hook_parameter_cmd/./before_tl } { #1#2#3#4#5#6#7#8#9 }
+\tl_const:cn { c__hook_parameter_cmd/./after_tl }  { #1#2#3#4#5#6#7#8#9 }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\c__hook_parameter_cmd/./before_tl}
+                 {Hooks~with~args}
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\hook_gremove_code:nn}
+                 {Hooks~with~args}
 \cs_new_protected:Npn \hook_gremove_code:nn #1 #2
   { \__hook_normalize_hook_args:Nnn \__hook_gremove_code:nn {#1} {#2} }
 \cs_new_protected:Npn \__hook_gremove_code:nn #1 #2
@@ -5449,6 +5820,39 @@
         \str_if_eq:nnTF {#2} {*}
           {
             \prop_gclear:c { g__hook_#1_code_prop }
+            \__hook_toplevel_gset:nn {#1} { }
+            \__hook_next_gset:nn {#1} { }
+          }
+          {
+            \str_if_eq:nnTF {#2} { top-level }
+              { \__hook_toplevel_gset:nn {#1} { } }
+              {
+                \prop_gpop:cnNF { g__hook_#1_code_prop } {#2} \l__hook_return_tl
+                  { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} }
+              }
+          }
+        \__hook_if_usable:nT {#1}
+          { \__hook_update_hook_code:n {#1} }
+      }
+      {
+        \__hook_if_deprecated_generic:nTF {#1}
+          {
+            \__hook_deprecated_generic_warn:n {#1}
+            \__hook_do_deprecated_generic:Nn \__hook_gremove_code:nn {#1} {#2}
+          }
+          { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} }
+      }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\hook_gremove_code:nn}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \__hook_gremove_code:nn #1 #2
+  {
+    \__hook_if_structure_exist:nTF {#1}
+      {
+        \str_if_eq:nnTF {#2} {*}
+          {
+            \prop_gclear:c { g__hook_#1_code_prop }
             \__hook_tl_gclear:c { __hook_toplevel~#1 }
             \__hook_tl_gclear:c { __hook_next~#1 }
           }
@@ -5472,9 +5876,260 @@
           { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} }
       }
   }
-\prop_new:c {g__hook_??_code_prop}
-\prop_new:c {__hook~??}
-\tl_new:c {g__hook_??_reversed_tl}
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_cs_gput_right:nnn}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \__hook_cs_gput_right:nnn #1 #2 #3
+  {
+    \cs_if_exist:cF { __hook#1~#2 }
+      { \__hook_code_gset_aux:nnn {#1} {#2} { } }
+    \__hook_code_gset_auxi:eeen
+      {
+        \__hook_if_declared:nTF {#2}
+          { \tl_use:c { c__hook_#2_parameter_tl } }
+          {
+            \__hook_if_generic:nTF {#2}
+              { \__hook_generic_parameter:n {#2} }
+              { \c__hook_nine_parameters_tl }
+          }
+      }
+      {
+        \exp_args:NNo \exp_args:No \__hook_double_hashes:n
+          {
+            \cs:w __hook#1~#2 \exp_last_unbraced:Ne \cs_end:
+              { \__hook_braced_cs_parameter:n { __hook#1~#2 } }
+          }
+      }
+      {
+        \__hook_if_replacing_args:TF
+          { \exp_not:n }
+          { \__hook_double_hashes:n }
+            {#3}
+      }
+      { __hook#1~#2 }
+  }
+\cs_new_protected:Npn \__hook_code_gset_auxi:nnnn #1 #2 #3 #4
+  { \cs_gset:cpn {#4} #1 { #2 #3 } }
+\cs_generate_variant:Nn \__hook_code_gset_auxi:nnnn { eeen }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_cs_gput_right:nnn}
+                 {Hooks~with~args}
+\cs_undefine:N \__hook_cs_gput_right:nnn
+\cs_undefine:N \__hook_code_gset_auxi:nnnn
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_code_gset:nn}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \__hook_code_gset:nn
+  { \__hook_code_gset_aux:nnn { } }
+\cs_new_protected:Npn \__hook_toplevel_gset:nn
+  { \__hook_code_gset_aux:nnn { _toplevel } }
+\cs_new_protected:Npn \__hook_next_gset:nn
+  { \__hook_code_gset_aux:nnn { _next } }
+\cs_new_protected:Npn \__hook_code_gset_aux:nnn #1 #2 #3
+  {
+    \cs_gset:cpn { __hook#1~#2 \exp_last_unbraced:Ne }
+      { \__hook_parameter:n {#2} }
+      {#3}
+  }
+\cs_generate_variant:Nn \__hook_code_gset:nn { ne }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_code_gset:nn}
+                 {Hooks~with~args}
+\cs_undefine:N \__hook_code_gset:nn
+\cs_undefine:N \__hook_toplevel_gset:nn
+\cs_undefine:N \__hook_next_gset:nn
+\cs_undefine:N \__hook_code_gset_aux:nnn
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_normalise_cs_args:nn}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \__hook_normalise_cs_args:nn #1 #2
+  {
+    \cs_if_exist:cT { __hook#1~#2 }
+      {
+        \__hook_code_gset_auxi:eeen
+          { \tl_use:c { c__hook_#2_parameter_tl } }
+          {
+            \exp_args:NNo \exp_args:No \__hook_double_hashes:n
+              {
+                \cs:w __hook#1~#2 \exp_last_unbraced:Ne \cs_end:
+                  { \__hook_braced_cs_parameter:n { __hook#1~#2 } }
+              }
+          }
+          { }
+          { __hook#1~#2 }
+      }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_normalise_cs_args:nn}
+                 {Hooks~with~args}
+\cs_undefine:N \__hook_normalise_cs_args:nn
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_normalise_code_pool:n}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \__hook_normalise_code_pool:n #1
+  {
+    \__hook_set_normalise_fn:nn {#1} { Offending~label:~'##1' }
+    \prop_clear:N \l__hook_work_prop
+    \prop_map_function:cN { g__hook_#1_code_prop } \__hook_normalise_fn:nn
+    \prop_gset_eq:cN { g__hook_#1_code_prop } \l__hook_work_prop
+  }
+\cs_new_protected:Npn \__hook_set_normalise_fn:nn #1 #2
+  {
+    \cs_set:Npn \__hook_tmp:w ##1##2##3##4##5##6##7##8##9 { }
+    \tl_set:Ne \l__hook_tmpb_tl
+      { \__hook_braced_cs_parameter:n { __hook_tmp:w } }
+    \group_begin:
+      \__hook_tl_set:cn { c__hook_hash_tl } { \exp_not:N \c__hook_hashes_tl }
+      \use:e
+        {
+    \group_end:
+    \tl_set:Nn \exp_not:N \l__hook_tmpb_tl { \l__hook_tmpb_tl }
+        }
+    \exp_last_unbraced:NNf
+    \cs_set:Npn \__hook_tmp:w { \__hook_parameter:n {#1} } { }
+    \tl_set:Ne \l__hook_tmpa_tl { \__hook_braced_cs_parameter:n { __hook_tmp:w } }
+    \cs_gset_protected:Npx \__hook_normalise_fn:nn ##1 ##2
+      {
+        \group_begin:
+          \int_set:Nn \tex_escapechar:D { -1 }
+          \cs_set:cpn
+              {
+                hook~'#1'. ^^J
+                (hooks) \prg_replicate:nn { 13 } { ~ }
+                #2 % more message text
+              }
+              \exp_not:v { c__hook_#1_parameter_tl }
+            {##2}
+        \group_end:
+        \cs_set:Npn \exp_not:N \__hook_tmp:w
+            \exp_not:V \c__hook_nine_parameters_tl
+          {
+            \prop_put:Nne \exp_not:N \l__hook_work_prop
+              {##1} { \exp_not:N \__hook_double_hashes:n {##2} }
+          }
+        \exp_not:N \__hook_tmp:w
+          \exp_not:V \l__hook_tmpa_tl
+          \exp_args:No \exp_not:o
+            { \exp_after:wN \__hook_tmp:w \l__hook_tmpb_tl }
+      }
+  }
+\cs_new_eq:NN \__hook_normalise_fn:nn ?
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_normalise_code_pool:n}
+                 {Hooks~with~args}
+\cs_undefine:N \__hook_normalise_code_pool:n
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_cs_if_empty:c}
+                 {Hooks~with~args}
+\prg_new_conditional:Npnn \__hook_cs_if_empty:c #1 { p, T, F, TF }
+  {
+    \if:w \scan_stop: \__hook_replacement_spec:c {#1} \scan_stop:
+      \prg_return_true:
+    \else:
+      \prg_return_false:
+    \fi:
+  }
+\cs_new:Npn \__hook_replacement_spec:c #1
+  {
+    \exp_args:Nc \token_if_macro:NT {#1}
+      { \cs_replacement_spec:c {#1} }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_cs_if_empty:c}
+                 {Hooks~with~args}
+\cs_undefine:N \__hook_cs_if_empty:c
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_braced_cs_parameter:n}
+                 {Hooks~with~args}
+\cs_new:Npn \__hook_braced_cs_parameter:n #1
+  {
+    \exp_last_unbraced:Ne \__hook_braced_hidden_loop:w
+      { \exp_args:Nc \__hook_cs_parameter_count:N {#1} } ? \s__hook_mark
+  }
+\cs_new:Npn \__hook_braced_hidden_loop:w #1
+  {
+    \if:w ? #1
+      \__hook_use_i_delimit_by_s_mark:nw
+    \fi:
+    { \exp_not:N \c__hook_hash_tl #1 }
+    \__hook_braced_hidden_loop:w
+  }
+\cs_new:Npn \__hook_cs_parameter_count:N #1
+  {
+    \exp_last_unbraced:Nf \__hook_cs_parameter_count:w
+      { \token_if_macro:NT #1 { \cs_parameter_spec:N #1 } }
+      ? \__hook_cs_end:w ? \__hook_cs_end:w ? \__hook_cs_end:w
+      ? \__hook_cs_end:w ? \__hook_cs_end:w ? \__hook_cs_end:w
+      ? \__hook_cs_end:w ? \__hook_cs_end:w ? \__hook_cs_end:w
+      \s__hook_mark
+  }
+\cs_new:Npn \__hook_cs_parameter_count:w #1#2 #3#4 #5#6 #7#8
+  { #2 #4 #6 #8 \__hook_cs_parameter_count:w }
+\cs_new:Npn \__hook_cs_end:w #1 \s__hook_mark { }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_braced_cs_parameter:n}
+                 {Hooks~with~args}
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_braced_parameter:n}
+                 {Hooks~with~args}
+\cs_new:Npn \__hook_braced_parameter:n #1
+  {
+    \if_case:w
+      \int_eval:n
+        { \exp_args:Nv \str_count:n { c__hook_#1_parameter_tl } / 3 }
+      \exp_stop_f:
+    \or: {##1}
+    \or: {##1} {##2}
+    \or: {##1} {##2} {##3}
+    \or: {##1} {##2} {##3} {##4}
+    \or: {##1} {##2} {##3} {##4} {##5}
+    \or: {##1} {##2} {##3} {##4} {##5} {##6}
+    \or: {##1} {##2} {##3} {##4} {##5} {##6} {##7}
+    \or: {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8}
+    \or: {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8} {##9}
+    \else:
+      \msg_expandable_error:nnn { latex2e } { should-not-happen }
+        { Invalid~parameter~spec. }
+    \fi:
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_braced_parameter:n}
+                 {Hooks~with~args}
+\cs_undefine:N \__hook_braced_parameter:n
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_parameter:n}
+                 {Hooks~with~args}
+\cs_new:Npn \__hook_parameter:n #1
+  {
+    \cs:w c__hook_
+    \tl_if_exist:cTF { c__hook_#1_parameter_tl }
+      { #1_parameter } { empty }
+    _tl \cs_end:
+  }
+\cs_new:Npn \__hook_generic_parameter:n #1
+  { \__hook_generic_parameter:w #1 / / / \s__hook_mark }
+\cs_new:Npn \__hook_generic_parameter:w #1 / #2 / #3 / #4 \s__hook_mark
+  {
+    \cs_if_exist_use:cF { c__hook_parameter_#1/./#3_tl }
+      { \c__hook_empty_tl }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_parameter:n}
+                 {Hooks~with~args}
+\cs_undefine:N \__hook_parameter:n
+\cs_undefine:N \__hook_generic_parameter:n
+\EndIncludeInRelease
+\prop_new:c { g__hook_??_code_prop }
+\prop_new:c { __hook~?? }
+\tl_new:c { g__hook_??_reversed_tl }
+\IncludeInRelease{2023/06/01}{\c__hook_??_parameter_tl}
+                 {Hooks~with~args}
+\tl_const:cn { c__hook_??_parameter_tl } { }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\c__hook_??_parameter_tl}
+                 {Hooks~with~args}
+\cs_undefine:c { c__hook_??_parameter_tl }
+\EndIncludeInRelease
 \cs_new_protected:Npn \hook_gset_rule:nnnn #1#2#3#4
   {
     \__hook_normalize_hook_rule_args:Nnnnn \__hook_gset_rule:nnnn
@@ -5489,13 +6144,13 @@
         \__hook_deprecated_generic_warn:n {#1}
         \__hook_do_deprecated_generic:Nn \__hook_gset_rule:nnnn {#1}
           {#2} {#3} {#4}
-        \__hook_clean_to_scan:w
+        \__hook_use_none_delimit_by_s_mark:w
       }
     \__hook_if_execute_immediately:nT {#1}
       {
         \msg_error:nnnnnn { hooks } { rule-too-late }
           {#1} {#2} {#3} {#4}
-        \__hook_clean_to_scan:w
+        \__hook_use_none_delimit_by_s_mark:w
       }
     \__hook_init_structure:n {#1}
     \__hook_rule_gclear:nnn {#1} {#2} {#4}
@@ -5585,23 +6240,55 @@
     \cs_end:
   }
 \cs_new_eq:NN \__hook_update_hook_code:n \use_none:n
-\cs_new_protected:Npn \__hook_initialize_all: {
-  \cs_gset_eq:NN \__hook_update_hook_code:n \__hook_initialize_hook_code:n
-  \__hook_debug:n { \prop_gclear:N \g__hook_used_prop }
-  \seq_map_inline:Nn \g__hook_all_seq
+\IncludeInRelease{2023/06/01}{\__hook_initialize_all:}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \__hook_initialize_all:
+  {
+    \cs_gset_eq:NN \__hook_update_hook_code:n \__hook_initialize_hook_code:n
+    \__hook_debug:n { \prop_gclear:N \g__hook_used_prop }
+    \seq_map_inline:Nn \g__hook_all_seq
       {
+        \tl_if_empty:cTF { c__hook_##1_parameter_tl }
+          { \__hook_replacing_args_false: }
+          { \__hook_replacing_args_true: }
         \__hook_update_hook_code:n {##1}
+        \__hook_replacing_args_reset:
       }
-  \__hook_debug:n
-     { \iow_term:x{^^JAll~ initialized~ (non-empty)~ hooks:}
-       \prop_map_inline:Nn \g__hook_used_prop
-           { \iow_term:x{^^J~ ##1~ ->~
-               \exp_not:v {__hook~##1}~ }
-           }
-     }
-  \cs_gset_eq:NN \hook_use:n \__hook_use_initialized:n
-  \cs_gset_eq:NN \__hook_preamble_hook:n \use_none:n
-}
+    \__hook_debug:n
+      {
+        \iow_term:x { ^^J All~initialized~(non-empty)~hooks: }
+        \prop_map_inline:Nn \g__hook_used_prop
+          {
+            \iow_term:x
+              { ^^J ~ ##1 ~ -> ~ \cs_replacement_spec:c { __hook~##1 } ~ }
+          }
+      }
+    \__hook_post_initialization_defs:
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_initialize_all:}
+                 {Hooks~with~args}
+\cs_gset_protected:Npn \__hook_initialize_all:
+  {
+    \cs_gset_eq:NN \__hook_update_hook_code:n \__hook_initialize_hook_code:n
+    \__hook_debug:n { \prop_gclear:N \g__hook_used_prop }
+    \seq_map_inline:Nn \g__hook_all_seq
+      { \__hook_update_hook_code:n {##1} }
+    \__hook_debug:n
+      {
+        \iow_term:x{^^JAll~ initialized~ (non-empty)~ hooks:}
+        \prop_map_inline:Nn \g__hook_used_prop
+          {
+            \iow_term:x
+              { ^^J ~ ##1 ~ -> ~ \cs_replacement_spec:c { __hook~##1 } ~ }
+          }
+      }
+    \cs_gset_eq:NN \hook_use:n \__hook_use_initialized:n
+    \cs_gset_eq:NN \__hook_preamble_hook:n \use_none:n
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_initialize_hook_code:n}
+                 {Hooks~with~args}
 \cs_new_protected:Npn \__hook_initialize_hook_code:n #1
   {
     \__hook_debug:n
@@ -5611,6 +6298,38 @@
       {
         \prop_if_empty:cTF { g__hook_#1_code_prop }
           {
+            \__hook_code_gset:ne {#1}
+              {
+                \exp_not:c { __hook_toplevel~#1 } \__hook_braced_parameter:n {#1}
+                \exp_not:c { __hook_next~#1 } \__hook_braced_parameter:n {#1}
+              }
+          }
+          {
+            \__hook_if_reversed:nTF {#1}
+              { \cs_set_eq:NN \__hook_tl_gput:Nn    \__hook_tl_gput_left:Nn
+                \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_left:NV  }
+              { \cs_set_eq:NN \__hook_tl_gput:Nn    \__hook_tl_gput_right:Nn
+                \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_right:NV }
+            \prop_set_eq:Nc \l__hook_work_prop { g__hook_#1_code_prop }
+            \__hook_initialize_single:ccn
+              { __hook~#1 } { g__hook_#1_labels_clist } {#1}
+            \__hook_debug:n
+              { \exp_args:NNx \prop_gput:Nnn \g__hook_used_prop {#1} { } }
+          }
+      }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_initialize_hook_code:n}
+                 {Hooks~with~args}
+\cs_gset_protected:Npn \__hook_initialize_hook_code:n #1
+  {
+    \__hook_debug:n
+      { \iow_term:x { ^^J Update~code~for~hook~'#1' \on at line :^^J } }
+    \__hook_include_legacy_code_chunk:n {#1}
+    \__hook_if_usable:nT {#1}
+      {
+        \prop_if_empty:cTF { g__hook_#1_code_prop }
+          {
             \__hook_tl_gset:co { __hook~#1 }
               {
                 \cs:w __hook_toplevel~#1 \exp_after:wN \cs_end:
@@ -5631,6 +6350,7 @@
           }
       }
   }
+\EndIncludeInRelease
 \cs_new:Npn \__hook_tl_csname:n #1 { l__hook_label_#1_tl }
 \cs_new:Npn \__hook_seq_csname:n #1 { l__hook_label_#1_seq }
 \seq_new:N \l__hook_labels_seq
@@ -5638,6 +6358,8 @@
 \tl_new:N \l__hook_front_tl
 \tl_new:N \l__hook_rear_tl
 \tl_new:c { \__hook_tl_csname:n { 0 } }
+\IncludeInRelease{2023/06/01}{\__hook_initialize_single:NNn}
+                 {Hooks~with~args}
 \cs_new_protected:Npn \__hook_initialize_single:NNn #1#2#3
   {
     \seq_clear:N \l__hook_labels_seq
@@ -5705,10 +6427,92 @@
         \__hook_debug_label_data:N \l__hook_work_prop
         \iow_term:x{====================}
       }
+    \exp_args:NNe \__hook_tl_gput:Nn #1
+      { \exp_not:c { __hook_toplevel~#3 } \__hook_braced_parameter:n {#3} }
+    \__hook_tl_gput_right:Ne #1
+      { \exp_not:c { __hook_next~#3 } \__hook_braced_parameter:n {#3} }
+    \use:e
+      {
+        \cs_gset:cpn { __hook~#3 } \use:c { c__hook_#3_parameter_tl }
+          { \exp_not:V #1 }
+      }
+  }
+\cs_generate_variant:Nn \__hook_initialize_single:NNn { cc }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_initialize_single:NNn}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \__hook_initialize_single:NNn #1#2#3
+  {
+    \seq_clear:N \l__hook_labels_seq
+    \int_zero:N  \l__hook_labels_int
+    \tl_set:Nn \l__hook_cur_hook_tl {#3}
+    \prop_map_inline:Nn \l__hook_work_prop
+       {
+         \int_incr:N \l__hook_labels_int
+         \seq_put_right:Nn \l__hook_labels_seq {##1}
+         \__hook_tl_set:cn { \__hook_tl_csname:n {##1} } { 0 }
+         \seq_clear_new:c { \__hook_seq_csname:n {##1} }
+       }
+    \prop_map_inline:Nn \l__hook_work_prop
+      {
+        \prop_map_inline:Nn \l__hook_work_prop
+          {
+            \__hook_if_label_case:nnnnn {##1} {####1}
+              { \prop_map_break: }
+              { \__hook_apply_label_pair:nnn {##1} {####1} }
+              { \__hook_apply_label_pair:nnn {####1} {##1} }
+                  {#3}
+          }
+      }
+    \__hook_debug:n { \__hook_debug_label_data:N \l__hook_work_prop }
+    \tl_set:Nn \l__hook_rear_tl { 0 }
+    \tl_set:cn { \__hook_tl_csname:n { 0 } } { 0 }
+    \seq_map_inline:Nn \l__hook_labels_seq
+      {
+        \int_compare:nNnT { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0
+            {
+              \tl_set:cn { \__hook_tl_csname:n { \l__hook_rear_tl } }{##1}
+              \tl_set:Nn \l__hook_rear_tl {##1}
+            }
+      }
+    \tl_set_eq:Nc \l__hook_front_tl { \__hook_tl_csname:n { 0 } }
+    \__hook_tl_gclear:N #1
+    \clist_gclear:N #2
+    \bool_while_do:nn { ! \str_if_eq_p:Vn \l__hook_front_tl { 0 } }
+      {
+        \int_decr:N \l__hook_labels_int
+        \prop_get:NVN \l__hook_work_prop \l__hook_front_tl \l__hook_return_tl
+        \exp_args:NNV \__hook_tl_gput:Nn #1 \l__hook_return_tl
+        \__hook_clist_gput:NV #2 \l__hook_front_tl
+        \__hook_debug:n{ \iow_term:x{Handled~ code~ for~ \l__hook_front_tl} }
+        \seq_map_inline:cn { \__hook_seq_csname:n { \l__hook_front_tl } }
+          {
+            \tl_set:cx { \__hook_tl_csname:n {##1} }
+                       { \int_eval:n
+                           { \cs:w \__hook_tl_csname:n {##1} \cs_end: - 1 }
+                       }
+            \int_compare:nNnT
+                { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0
+                {
+                  \tl_set:cn { \__hook_tl_csname:n { \l__hook_rear_tl } } {##1}
+                  \tl_set:Nn \l__hook_rear_tl            {##1}
+                }
+          }
+        \tl_set_eq:Nc \l__hook_front_tl
+                      { \__hook_tl_csname:n { \l__hook_front_tl } }
+      }
+    \int_compare:nNnF \l__hook_labels_int = 0
+      {
+        \iow_term:x{====================}
+        \iow_term:x{Error:~ label~ rules~ are~ incompatible:}
+        \__hook_debug_label_data:N \l__hook_work_prop
+        \iow_term:x{====================}
+      }
     \exp_args:NNo \__hook_tl_gput:Nn #1 { \cs:w __hook_toplevel~#3 \cs_end: }
     \__hook_tl_gput_right:No #1 { \cs:w __hook_next~#3 \cs_end: }
   }
-\cs_generate_variant:Nn \__hook_initialize_single:NNn { cc }
+\cs_generate_variant:Nn \__hook_tl_gput_right:Nn { No }
+\EndIncludeInRelease
 \cs_new:Npn \__hook_tl_gput:Nn    { \ERROR }
 \cs_new:Npn \__hook_clist_gput:NV { \ERROR }
 \cs_new_protected:Npn \__hook_apply_label_pair:nnn #1#2#3
@@ -5823,6 +6627,8 @@
   { \__hook_log_cmd:x { >~#1 } }
 \cs_new_protected:Npn \__hook_log_line_indent:x #1
   { \__hook_log_cmd:x { >~\@spaces #1 } }
+\IncludeInRelease{2023/06/01}{\__hook_log:nN}
+                 {Hooks~with~args}
 \cs_new_protected:Npn \__hook_log:nN #1 #2
   {
     \__hook_if_deprecated_generic:nT {#1}
@@ -5833,6 +6639,121 @@
       }
     \__hook_preamble_hook:n {#1}
     \__hook_log_cmd:x
+      {
+        ^^J ->~The~
+        \__hook_if_generic:nT {#1} { generic~ }
+        hook~'#1'
+        \__hook_if_disabled:nF {#1}
+          {
+            \exp_args:Nf \__hook_print_args:nn {#1}
+              {
+                \int_eval:n
+                  { \str_count:e { \__hook_parameter:n {#1} } / 3 }
+              }
+          }
+        :
+      }
+    \__hook_if_usable:nF {#1}
+      { \__hook_log_line:x { The~hook~is~not~declared. } }
+    \__hook_if_disabled:nT {#1}
+      { \__hook_log_line:x { The~hook~is~disabled. } }
+    \hook_if_empty:nTF {#1}
+      { #2 { The~hook~is~empty } }
+      {
+        \__hook_log_line:x { Code~chunks: }
+        \prop_if_empty:cTF { g__hook_#1_code_prop }
+          { \__hook_log_line_indent:x { --- } }
+          {
+            \prop_map_inline:cn { g__hook_#1_code_prop }
+              {
+                \exp_after:wN \cs_set:Npn \exp_after:wN \__hook_tmp:w
+                  \c__hook_nine_parameters_tl {##2}
+                \__hook_log_line_indent:x
+                  { ##1~->~\cs_replacement_spec:N \__hook_tmp:w }
+              }
+          }
+        \__hook_log_line:x
+          {
+            Document-level~(top-level)~code
+            \__hook_if_usable:nT {#1}
+              { ~(executed~\__hook_if_reversed:nTF {#1} {first} {last} ) } :
+          }
+        \__hook_log_line_indent:x
+          {
+            \__hook_cs_if_empty:cTF { __hook_toplevel~#1 }
+              { --- }
+              { -> ~ \cs_replacement_spec:c { __hook_toplevel~#1 } }
+          }
+        \__hook_log_line:x { Extra~code~for~next~invocation: }
+        \__hook_log_line_indent:x
+          {
+            \__hook_cs_if_empty:cTF { __hook_next~#1 }
+              { --- }
+              {
+                -> ~ \exp_last_unbraced:Nf \__hook_log_next_code:w
+                  { \cs_replacement_spec:c { __hook_next~#1 } }
+              }
+          }
+        \__hook_log_line:x { Rules: }
+        \bool_set_true:N \l__hook_tmpa_bool
+        \__hook_list_rules:nn {#1}
+          {
+            \bool_set_false:N \l__hook_tmpa_bool
+            \__hook_log_line_indent:x
+              {
+                ##2~ with~
+                \str_if_eq:nnT {##3} {??} { default~ }
+                relation~ ##1
+              }
+          }
+        \bool_if:NT \l__hook_tmpa_bool
+          { \__hook_log_line_indent:x { --- } }
+        \bool_lazy_and:nnTF
+            { \__hook_if_usable_p:n {#1} }
+            { ! \hook_if_empty_p:n {#1} }
+          {
+            \__hook_log_line:x
+              {
+                Execution~order
+                \bool_if:NTF \l__hook_tmpa_bool
+                  { \__hook_if_reversed:nT {#1} { ~(after~reversal) } }
+                  { ~(after~
+                    \__hook_if_reversed:nT {#1} { reversal~and~ }
+                    applying~rules)
+                  } :
+              }
+            #2 % \tl_show:n
+              {
+                \@spaces
+                \clist_if_empty:cTF { g__hook_#1_labels_clist }
+                  { --- }
+                  { \clist_use:cn { g__hook_#1_labels_clist } { ,~ } }
+              }
+          }
+          {
+            \__hook_log_line:x { Execution~order: }
+            #2
+              {
+                \@spaces Not~set~because~the~hook~ \__hook_if_usable:nTF {#1}
+                  { code~pool~is~empty }
+                  { is~\__hook_if_disabled:nTF {#1} {disabled} {undeclared} }
+              }
+          }
+      }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_log:nN}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \__hook_log:nN #1 #2
+  {
+    \__hook_if_deprecated_generic:nT {#1}
+      {
+        \__hook_deprecated_generic_warn:n {#1}
+        \__hook_do_deprecated_generic:Nn \__hook_log:nN {#1} #2
+        \exp_after:wN \use_none:nnnnnnnnn \use_none:nnnnn
+      }
+    \__hook_preamble_hook:n {#1}
+    \__hook_log_cmd:x
       { ^^J ->~The~ \__hook_if_generic:nT {#1} { generic~ } hook~'#1': }
     \__hook_if_usable:nF {#1}
       { \__hook_log_line:x { The~hook~is~not~declared. } }
@@ -5900,7 +6821,7 @@
                 \@spaces
                 \clist_if_empty:cTF { g__hook_#1_labels_clist }
                   { --- }
-                  { \clist_use:cn {g__hook_#1_labels_clist} { ,~ } }
+                  { \clist_use:cn { g__hook_#1_labels_clist } { ,~ } }
               }
           }
           {
@@ -5914,8 +6835,28 @@
           }
       }
   }
-\cs_new:Npn \__hook_log_next_code:n #1
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_log_next_code:n}
+                 {Hooks~with~args}
+\exp_last_unbraced:NNNNo
+\cs_new:Npn \__hook_log_next_code:w #1 \c_right_brace_str { }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_log_next_code:n}
+                 {Hooks~with~args}
+\cs_gset:Npn \__hook_log_next_code:n #1
   { \exp_args:No \tl_to_str:n { \use_none:nn #1 } }
+\EndIncludeInRelease
+\cs_new:Npn \__hook_print_args:nn #1 #2
+  {
+    \int_compare:nNnT {#2} > { 0 }
+      {
+        \__hook_if_declared:nT {#1} { \use_none:nnn }
+        \__hook_if_cmd_hook:nT {#1}
+          { \use_i:nnn { ~ (unknown ~ } }
+        \use:n { ~ (#2 ~ }
+        argument \int_compare:nNnT {#2} > { 1 } { s } )
+      }
+  }
 \cs_new_protected:Npn \__hook_list_rules:nn #1 #2
   {
     \cs_set_protected:Npn \__hook_tmp:w ##1 ##2 ##3 {#2}
@@ -5961,8 +6902,27 @@
       }
     \exp_args:No \__hook_tmp:w { \use:nn { ~ } { ~ } }
   }
-\cs_new_protected:Npn \hook_gput_next_code:nn #1
+\IncludeInRelease{2023/06/01}{\hook_gput_next_code:nn}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \hook_gput_next_code:nn #1 #2
+  {
+    \__hook_replacing_args_false:
+    \__hook_normalize_hook_args:Nn \__hook_gput_next_code:nn {#1} {#2}
+    \__hook_replacing_args_reset:
+  }
+\cs_new_protected:Npn \hook_gput_next_code_with_args:nn #1 #2
+  {
+    \__hook_replacing_args_true:
+    \__hook_normalize_hook_args:Nn \__hook_gput_next_code:nn {#1} {#2}
+    \__hook_replacing_args_reset:
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\hook_gput_next_code:nn}
+                 {Hooks~with~args}
+\cs_gset_protected:Npn \hook_gput_next_code:nn #1
   { \__hook_normalize_hook_args:Nn \__hook_gput_next_code:nn {#1} }
+\cs_gset_protected:Npn \hook_gput_next_code_with_args:nn #1 #2 { }
+\EndIncludeInRelease
 \cs_new_protected:Npn \__hook_gput_next_code:nn #1 #2
   {
     \__hook_if_disabled:nTF {#1}
@@ -5969,16 +6929,32 @@
       { \msg_error:nnn { hooks } { hook-disabled } {#1} }
       {
         \__hook_if_structure_exist:nTF {#1}
-          { \__hook_gput_next_do:nn {#1} {#2} }
-          { \__hook_try_declaring_generic_next_hook:nn {#1} {#2} }
+          { \__hook_gput_next_do:nn }
+          { \__hook_try_declaring_generic_next_hook:nn }
+              {#1} {#2}
       }
   }
+\IncludeInRelease{2023/06/01}{\__hook_gput_next_do:nn}
+                 {Hooks~with~args}
 \cs_new_protected:Npn \__hook_gput_next_do:nn #1
   {
+    \__hook_init_structure:n {#1}
+    \__hook_chk_args_allowed:nn {#1} { AddToHookNext }
+    \__hook_cs_if_empty:cT { __hook~#1 }
+      { \__hook_update_hook_code:n {#1} }
+    \__hook_cs_if_empty:cT { __hook_next~#1 }
+      { \__hook_next_gset:nn {#1} { \__hook_clear_next:n {#1} } }
+    \__hook_cs_gput_right:nnn { _next } {#1}
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_gput_next_do:nn}
+                 {Hooks~with~args}
+\cs_gset_protected:Npn \__hook_gput_next_do:nn #1
+  {
     \exp_args:Nc \__hook_gput_next_do:Nnn
       { __hook_next~#1 } {#1}
   }
-\cs_new_protected:Npn \__hook_gput_next_do:Nnn #1 #2
+\cs_gset_protected:Npn \__hook_gput_next_do:Nnn #1 #2
   {
     \tl_if_empty:cT { __hook~#2 }
       { \__hook_update_hook_code:n {#2} }
@@ -5986,10 +6962,41 @@
       { \__hook_tl_gset:Nn #1 { \__hook_clear_next:n {#2} } }
     \__hook_tl_gput_right:Nn #1
   }
+\EndIncludeInRelease
 \cs_new_protected:Npn \hook_gclear_next_code:n #1
   { \__hook_normalize_hook_args:Nn \__hook_clear_next:n {#1} }
+\IncludeInRelease{2023/06/01}{\__hook_clear_next:n}
+                 {Hooks~with~args}
 \cs_new_protected:Npn \__hook_clear_next:n #1
+  { \__hook_next_gset:nn {#1} { } }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_clear_next:n}
+                 {Hooks~with~args}
+\cs_gset_protected:Npn \__hook_clear_next:n #1
   { \cs_gset_eq:cN { __hook_next~#1 } \c_empty_tl }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\hook_use:n}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \hook_use:n #1
+  {
+    \__hook_preamble_hook:n {#1}
+    \__hook_use_initialized:n {#1}
+  }
+\cs_new:Npn \__hook_use_initialized:n #1
+  {
+    \if_cs_exist:w __hook~#1 \cs_end:
+      \cs:w __hook~#1 \use_i:nn
+    \fi:
+    \use_none:n
+    \cs_end:
+  }
+\cs_new_protected:Npn \__hook_preamble_hook:n #1
+  {
+    \if_cs_exist:w __hook~#1 \cs_end:
+      \__hook_initialize_hook_code:n {#1}
+    \fi:
+  }
+\EndIncludeInRelease
 \IncludeInRelease{2021/11/15}{\hook_use:n}
                  {Standardise~generic~hook~names}
 \cs_new_protected:Npn \hook_use:n #1
@@ -6008,6 +7015,7 @@
   }
 \cs_new_protected:Npn \__hook_preamble_hook:n #1
   { \__hook_initialize_hook_code:n {#1} }
+\cs_new:Npn \hook_use:nnw #1 { }
 \EndIncludeInRelease
 \IncludeInRelease{2020/10/01}{\hook_use:n}
                  {Standardise~generic~hook~names}
@@ -6036,7 +7044,45 @@
 \cs_new_protected:Npn \__hook_preamble_hook:n #1
   { \__hook_initialize_hook_code:n {#1} }
 \cs_new_eq:NN \__hook_use_end: \cs_end:
+\cs_new:Npn \hook_use:nnw #1 { }
 \EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\hook_use:nnw}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \hook_use:nnw #1
+  {
+    \__hook_preamble_hook:n {#1}
+    \__hook_use_initialized:nnw {#1}
+  }
+\cs_new:Npn \__hook_use_initialized:nnw #1 #2
+  {
+    \cs:w
+      \if_cs_exist:w __hook~#1 \cs_end:
+        __hook~#1
+      \else:
+        use_none: \prg_replicate:nn {#2} { n }
+      \fi:
+    \cs_end:
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\hook_use:nnw}
+                 {Hooks~with~args}
+\cs_gset:Npn \hook_use:nnw #1 #2
+  { \use:c { use_none: \prg_replicate:nn {#2} { n } } }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_post_initialization_defs:}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \__hook_post_initialization_defs:
+  {
+    \cs_gset_eq:NN \hook_use:n \__hook_use_initialized:n
+    \cs_gset_eq:NN \hook_use:nnw \__hook_use_initialized:nnw
+    \cs_gset_eq:NN \__hook_preamble_hook:n \use_none:n
+    \cs_gset_eq:NN \__hook_post_initialization_defs: \prg_do_nothing:
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_post_initialization_defs:}
+                 {Hooks~with~args}
+\cs_undefine:N \__hook_post_initialization_defs:
+\EndIncludeInRelease
 \IncludeInRelease{2021/11/15}{\__hook_use:wn}
                  {Standardise~generic~hook~names}
 \EndIncludeInRelease
@@ -6066,43 +7112,113 @@
       }
   }
 \EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\hook_use_once:nnw}
+                 {Hooks~with~args}
 \cs_new_protected:Npn \hook_use_once:n #1
   {
     \__hook_if_execute_immediately:nF {#1}
+      { \__hook_normalize_hook_args:Nn \__hook_use_once:nn { \use:n {#1} } { 0 } }
+  }
+\cs_new_protected:Npn \hook_use_once:nnw #1 #2
+  {
+    \__hook_if_execute_immediately:nF {#1}
+      { \__hook_normalize_hook_args:Nn \__hook_use_once:nn { \use:n {#1} } {#2} }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\hook_use_once:nnw}
+                 {Hooks~with~args}
+\cs_gset_protected:Npn \hook_use_once:n #1
+  {
+    \__hook_if_execute_immediately:nF {#1}
       { \__hook_normalize_hook_args:Nn \__hook_use_once:n { \use:n {#1} } }
   }
-\cs_new_protected:Npn \__hook_use_once:n #1
+\cs_gset:Npn \hook_use_once:nnw #1 #2
+  { \use:c { use_none: \prg_replicate:nn {#2} { n } } }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_use_once:nn}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \__hook_use_once:nn #1 #2
   {
     \__hook_preamble_hook:n {#1}
     \__hook_use_once_set:n {#1}
+    \__hook_replacing_args_false:
+    \__hook_cs_gput_right:nnn { _next } {#1} { \__hook_use_once_clear:n {#1} }
+    \__hook_replacing_args_reset:
+    \__hook_if_usable:nTF {#1}
+      { \__hook_use_initialized:n {#1} }
+      {
+        \int_compare:nNnT {#2} > { 0 }
+          { \use:c { use_none: \prg_replicate:nn {#2} { n } } }
+      }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_use_once:nn}
+                 {Hooks~with~args}
+\cs_gset_protected:Npn \__hook_use_once:n #1
+  {
+    \__hook_preamble_hook:n {#1}
+    \__hook_use_once_set:n {#1}
     \__hook_use_initialized:n {#1}
     \__hook_use_once_clear:n {#1}
   }
+\cs_undefine:N \__hook_use_once:nn
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_use_once_clear:n}
+                 {Hooks~with~args}
 \cs_new_protected:Npn \__hook_use_once_set:n #1
   { \__hook_tl_gset:cn { g__hook_#1_reversed_tl } { I } }
 \cs_new_protected:Npn \__hook_use_once_clear:n #1
   {
+    \__hook_code_gset:nn {#1} { }
+    \__hook_next_gset:nn {#1} { }
+    \__hook_toplevel_gset:nn {#1} { }
+    \prop_gclear_new:c { g__hook_#1_code_prop }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_use_once_clear:n}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \__hook_use_once_clear:n #1
+  {
     \__hook_tl_gclear:c { __hook~#1 }
     \__hook_tl_gclear:c { __hook_next~#1 }
     \__hook_tl_gclear:c { __hook_toplevel~#1 }
     \prop_gclear_new:c { g__hook_#1_code_prop }
   }
+\EndIncludeInRelease
 \prg_new_conditional:Npnn \__hook_if_execute_immediately:n #1 { T, F, TF }
   {
-    \__hook_if_usable:nTF {#1}
-      {
-        \exp_after:wN \__hook_clean_to_scan:w
-        \if:w I \cs:w g__hook_#1_reversed_tl \cs_end:
-          \s__hook_mark \prg_return_true:
-        \else:
-          \s__hook_mark \prg_return_false:
+    \exp_after:wN \__hook_use_none_delimit_by_s_mark:w
+    \if:w I
+        \if_cs_exist:w g__hook_#1_reversed_tl \cs_end:
+          \cs:w g__hook_#1_reversed_tl \exp_after:wN \cs_end:
         \fi:
-      }
-      { \prg_return_false: }
+        X
+      \s__hook_mark \prg_return_true:
+    \else:
+      \s__hook_mark \prg_return_false:
+    \fi:
   }
-
+\IncludeInRelease{2023/06/01}{\hook_if_empty:n}
+                 {Hooks~with~args}
 \prg_new_conditional:Npnn \hook_if_empty:n #1 { p , T , F , TF }
   {
+    \if:w
+        T
+        \prop_if_exist:cT { g__hook_#1_code_prop }
+          { \prop_if_empty:cF { g__hook_#1_code_prop } { F } }
+        \__hook_cs_if_empty:cF { __hook_toplevel~#1 } { F }
+        \__hook_cs_if_empty:cF { __hook_next~#1 } { F }
+        T
+      \prg_return_true:
+    \else:
+      \prg_return_false:
+    \fi:
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\hook_if_empty:n}
+                 {Hooks~with~args}
+\prg_new_conditional:Npnn \hook_if_empty:n #1 { p , T , F , TF }
+  {
     \__hook_if_structure_exist:nTF {#1}
       {
         \bool_lazy_and:nnTF
@@ -6117,9 +7233,10 @@
       }
       { \prg_return_true: }
   }
+\EndIncludeInRelease
 \prg_new_conditional:Npnn \__hook_if_usable:n #1 { p , T , F , TF }
   {
-    \tl_if_exist:cTF { __hook~#1 }
+    \cs_if_exist:cTF { __hook~#1 }
       { \prg_return_true: }
       { \prg_return_false: }
   }
@@ -6137,7 +7254,7 @@
   }
 \prg_new_conditional:Npnn \__hook_if_reversed:n #1 { p , T , F , TF }
   {
-    \exp_after:wN \__hook_clean_to_scan:w
+    \exp_after:wN \__hook_use_none_delimit_by_s_mark:w
     \if:w - \cs:w g__hook_#1_reversed_tl \cs_end:
       \s__hook_mark \prg_return_true:
     \else:
@@ -6164,6 +7281,26 @@
       }
       { \prg_return_false: }
   }
+\IncludeInRelease{2023/06/01}{\__hook_if_cmd_hook:n}
+                 {Hooks~with~args}
+\prg_new_conditional:Npnn \__hook_if_cmd_hook:n #1 { T }
+  { \__hook_if_cmd_hook:w #1 / / / \s__hook_mark }
+\cs_new:Npn \__hook_if_cmd_hook:w #1 / #2 / #3 / #4 \s__hook_mark
+  {
+    \if:w Y
+          \str_if_eq:nnF {#1} { cmd } { N }
+          \tl_if_exist:cF { c__hook_generic_#1/./#3_tl } { N }
+          Y
+      \prg_return_true:
+    \else:
+      \prg_return_false:
+    \fi:
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_if_cmd_hook:n}
+                 {Hooks~with~args}
+\cs_undefine:N \__hook_if_cmd_hook:nT
+\EndIncludeInRelease
 \prg_new_conditional:Npnn \__hook_if_generic_reversed:n #1 { T }
   { \__hook_if_generic_reversed:w #1 / / / \scan_stop: }
 \cs_new:Npn \__hook_if_generic_reversed:w #1 / #2 / #3 / #4 \scan_stop:
@@ -6174,6 +7311,31 @@
       \prg_return_false:
     \fi:
   }
+\seq_new:N \g__hook_replacing_stack_seq
+\cs_new:Npn \__hook_misused_if_replacing_args:nn #1 #2
+  {
+    \msg_expandable_error:nnn { latex2e } { should-not-happen }
+      { Misused~\__hook_if_replacing_args:. }
+  }
+\cs_new:Npn \__hook_if_replacing_args:TF
+  { \__hook_misused_if_replacing_args:nn }
+\cs_new_protected:Npn \__hook_replacing_args_true:
+  {
+    \seq_gpush:No \g__hook_replacing_stack_seq
+      { \__hook_if_replacing_args:TF }
+    \cs_set:Npn \__hook_if_replacing_args:TF { \use_i:nn }
+  }
+\cs_new_protected:Npn \__hook_replacing_args_false:
+  {
+    \seq_gpush:No \g__hook_replacing_stack_seq
+      { \__hook_if_replacing_args:TF }
+    \cs_set:Npn \__hook_if_replacing_args:TF { \use_ii:nn }
+  }
+\cs_new_protected:Npn \__hook_replacing_args_reset:
+  {
+    \seq_gpop:NN \g__hook_replacing_stack_seq \l__hook_return_tl
+    \cs_gset_eq:NN \__hook_if_replacing_args:TF \l__hook_return_tl
+  }
 \prop_gput:Nnn \g_msg_module_type_prop { hooks } { LaTeX }
 \prop_gput:Nnn \g_msg_module_type_prop { latex2e } { LaTeX }
 \prop_gput:Nnn \g_msg_module_name_prop { latex2e } { kernel }
@@ -6192,6 +7354,38 @@
     { There~ already~ exists~ a~ hook~ declaration~ with~ this~
       name.\\
       Please~ use~ a~ different~ name~ for~ your~ hook.}
+\IncludeInRelease{2023/06/01}{too-many-args}
+                 {Hooks~with~args}
+\msg_new:nnnn { hooks } { too-many-args }
+  { Too~many~arguments~for~hook~'#1'. }
+  {
+    You~tried~to~declare~a~hook~with~#2~arguments,~but~a~
+    hook~can~only~have~up~to~nine.~LaTeX~will~define~this~
+    hook~with~nine~arguments.
+  }
+\msg_new:nnnn { hooks } { without-args }
+  { Hook~'#1'~has~no~arguments. }
+  {
+    You~tried~to~use~\iow_char:N\\#2WithArguments~
+    on~a~hook~that~takes~no~arguments.\\
+    Check~the~usage~of~the~hook~or~use~\iow_char:N\\#2~instead.\\
+    \\
+    LaTeX~will~use~\iow_char:N\\#2.
+  }
+\msg_new:nnnn { hooks } { one-time-args }
+  { You~can't~have~arguments~in~used~one-time~hook~'#1'. }
+  {
+    You~tried~to~use~\iow_char:N\\#2WithArguments~
+    on~a~one-time~hook~that~has~already~been~used.~
+    You~have~to~add~the~code~before~the~hook~is~used,~
+    or~add~the~code~without~arguments~using~\iow_char:N\\#2~instead.\\
+    \\
+    LaTeX~will~use~\iow_char:N\\#2.
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{too-many-args}
+                 {Hooks~with~args}
+\EndIncludeInRelease
 \msg_new:nnnn { hooks } { hook-disabled }
   { Cannot~add~code~to~disabled~hook~'#1'. }
   {
@@ -6286,24 +7480,61 @@
     Generic~hook~'#1/#2/#3'~is~deprecated. \\
     Use~hook~'#1/#3/#2'~instead.
   }
-\NewDocumentCommand \NewHook             { m }{ \hook_new:n {#1} }
-\NewDocumentCommand \NewReversedHook     { m }{ \hook_new_reversed:n {#1} }
-\NewDocumentCommand \NewMirroredHookPair { mm }{ \hook_new_pair:nn {#1}{#2} }
-\IncludeInRelease{2021/06/01}%
-         {\hook_activate_generic:n}{Providing~hooks}
-\NewDocumentCommand \ActivateGenericHook { m }{ \hook_activate_generic:n {#1} }
-\NewDocumentCommand \DisableGenericHook { m }{ \hook_disable_generic:n {#1} }
+\NewDocumentCommand \NewHook             { m }
+  { \hook_new:n {#1} }
+\NewDocumentCommand \NewReversedHook     { m }
+  { \hook_new_reversed:n {#1} }
+\NewDocumentCommand \NewMirroredHookPair { mm }
+  { \hook_new_pair:nn {#1}{#2} }
+\IncludeInRelease{2023/06/01}{\NewHookWithArguments}
+                 {Hooks~with~args}
+\NewDocumentCommand \NewHookWithArguments             { mm }
+  { \hook_new_with_args:nn {#1} {#2} }
+\NewDocumentCommand \NewReversedHookWithArguments     { mm }
+  { \hook_new_reversed_with_args:nn {#1} {#2} }
+\NewDocumentCommand \NewMirroredHookPairWithArguments { mmm }
+  { \hook_new_pair_with_args:nnn {#1} {#2} {#3} }
 \EndIncludeInRelease
-\IncludeInRelease{2020/10/01}
-                 {\hook_activate_generic:n}{Providing~hooks}
-
-\def \ActivateGenericHook#1{}
-
+\IncludeInRelease{2023/06/01}{\NewHookWithArguments}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \NewHookWithArguments #1 #2 { }
+\cs_new_protected:Npn \NewReversedHookWithArguments #1 #2 { }
+\cs_new_protected:Npn \NewMirroredHookPairWithArguments #1 #2 #3 { }
 \EndIncludeInRelease
+\IncludeInRelease{2021/06/01}{\ActivateGenericHook}
+                 {Providing~hooks}
+\NewDocumentCommand \ActivateGenericHook { m }
+  { \hook_activate_generic:n {#1} }
+\NewDocumentCommand \DisableGenericHook { m }
+  { \hook_disable_generic:n {#1} }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\ActivateGenericHook}
+                 {Providing~hooks}
+\def \ActivateGenericHook #1 { }
+\def \DisableGenericHook #1 { }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\AddToHookWithArguments}
+                 {Hooks~with~args}
 \NewDocumentCommand \AddToHook { m o +m }
   { \hook_gput_code:nnn {#1} {#2} {#3} }
+\NewDocumentCommand \AddToHookWithArguments { m o +m }
+  { \hook_gput_code_with_args:nnn {#1} {#2} {#3} }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\AddToHookWithArguments}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \AddToHookWithArguments #1 #2 #3 { }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\AddToHookNextWithArguments}
+                 {Hooks~with~args}
 \NewDocumentCommand \AddToHookNext { m +m }
   { \hook_gput_next_code:nn {#1} {#2} }
+\NewDocumentCommand \AddToHookNextWithArguments { m +m }
+  { \hook_gput_next_code_with_args:nn {#1} {#2} }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\AddToHookNextWithArguments}
+                 {Hooks~with~args}
+\cs_new_protected:Npn \AddToHookNextWithArguments #1 #2 { }
+\EndIncludeInRelease
 \NewDocumentCommand \ClearHookNext { m }
   { \hook_gclear_next_code:n {#1} }
 \NewDocumentCommand \RemoveFromHook { m o }
@@ -6320,8 +7551,18 @@
     \str_gset:Nx \g_file_curr_name_str {#3}
     #1 #2 {#3}
   }
+\IncludeInRelease{2023/06/01}{\UseHookWithArguments}
+                 {Hooks~with~args}
 \cs_new:Npn \UseHook        { \hook_use:n }
 \cs_new:Npn \UseOneTimeHook { \hook_use_once:n }
+\cs_new:Npn \UseHookWithArguments        { \hook_use:nnw }
+\cs_new:Npn \UseOneTimeHookWithArguments { \hook_use_once:nnw }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\UseHookWithArguments}
+                 {Hooks~with~args}
+\cs_new:Npn \UseHookWithArguments #1 #2 { }
+\cs_new:Npn \UseOneTimeHookWithArguments #1 #2 { }
+\EndIncludeInRelease
 \cs_new_protected:Npn \ShowHook { \hook_show:n }
 \cs_new_protected:Npn \LogHook { \hook_log:n }
 \cs_new_protected:Npn \DebugHooksOn  { \hook_debug_on:  }
@@ -6409,8 +7650,8 @@
               \__hook_initialize_all:
 \cs_new_eq:NN \@expl@@@hook at curr@name at pop@@
               \__hook_curr_name_pop:
-\IncludeInRelease{0000/00/00}%
-                 {lthooks}{The~hook~management}%
+\IncludeInRelease{0000/00/00}{lthooks}
+                 {The~hook~management}%
 
 \def \NewHook#1{}
 \def \NewReversedHook#1{}
@@ -6439,13 +7680,48 @@
 \long\def \IfHookEmptyTF #1#2#3{#2}
 
 \EndModuleRelease
+\cs:w __hook_rollback_tidying: \cs_end:
+\bool_lazy_and:nnT
+    { \int_compare_p:nNn { \sourceLaTeXdate } > { 20230600 } }
+    { \int_compare_p:nNn { \requestedLaTeXdate } < { 20230601 } }
+  {
+    \cs_gset_protected:Npn \__hook_rollback_tidying:
+      {
+        \@latex at error { Rollback~code~executed~twice }
+          {
+            Something~went~wrong~(unless~this~was~
+            done~on~purpose~in~a~testing~environment).
+          }
+        \use_none:nnnn
+      }
+    \cs_set:Npn \__hook_tmp:w #1 #2
+      {
+        \__hook_tl_gset:cx { __hook#1~#2 }
+          {
+            \exp_args:No \exp_not:o
+              {
+                \cs:w __hook#1~#2 \exp_last_unbraced:Ne \cs_end:
+                  { \__hook_braced_cs_parameter:n { __hook#1~#2 } }
+              }
+          }
+      }
+    \seq_map_inline:Nn \g__hook_all_seq
+      {
+        \exp_after:wN \cs_gset_nopar:Npn
+          \cs:w g__hook_#1_code_prop \exp_args:NNo \exp_args:No
+            \cs_end: { \cs:w g__hook_#1_code_prop \cs_end: }
+        \__hook_tmp:w { _toplevel } {#1}
+        \__hook_tmp:w { _next } {#1}
+      }
+  }
 \ExplSyntaxOff
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% File: ltcmdhooks.dtx (C) Copyright 2020-2021
-%%       Frank Mittelbach, Phelype Oleinik, LaTeX Team
+%% File: ltcmdhooks.dtx
+%% Copyright (C) 2020-2023
+%% Frank Mittelbach, Phelype Oleinik, The LaTeX Project
 %%% From File: ltcmdhooks.dtx
-\def\ltcmdhooksversion{v1.0f}
-\def\ltcmdhooksdate{2021/10/20}
+\def\ltcmdhooksversion{v1.0h}
+\def\ltcmdhooksdate{2023/05/21}
 \ExplSyntaxOn
 \NewModuleRelease{2021/06/01}{ltcmdhooks}
                  {The~hook~management~system~for~commands}
@@ -6454,7 +7730,8 @@
 \tl_new:N \l__hook_patch_prefixes_tl
 \tl_new:N \l__hook_param_text_tl
 \tl_new:N \l__hook_replace_text_tl
-\tl_const:Nn \c__hook_hash_tl { # # }
+\tl_const:Nn \c__hook_hash_tl { # }
+\tl_const:Nn \c__hook_hashes_tl { # # }
 \cs_new_eq:NN \__hook_exp_not:NN ?
 \cs_new_eq:NN \__hook_def_cmd:w ?
 \quark_new:N \q__hook_recursion_tail
@@ -6596,6 +7873,8 @@
     \exp_args:NNc \__hook_patch_expand_redefine:NNnn \c_false_bool
       { \cs_to_str:N #1 ~ code }
   }
+\IncludeInRelease{2023/06/01}{\__hook_patch_expand_redefine:NNnn}
+                 {cmd~hooks~with~args}
 \cs_new_protected:Npn \__hook_patch_expand_redefine:NNnn #1 #2 #3 #4
   {
     \__hook_patch_debug:x { ++~command~can~be~patched~without~rescanning }
@@ -6619,6 +7898,81 @@
             ##1 \l__hook_replace_text_tl { \__hook_exp_not:n {##2} }
           }
         \bool_if:NTF #1
+          { \__hook_tmp:w \tl_set:Nx { [ \c__hook_hashes_tl 1 ] } }
+          { \__hook_tmp:w \tl_set:Nx { { \c__hook_hashes_tl 1 } } }
+        \int_step_inline:nnn { 2 } { \l__hook_patch_num_args_int }
+          { \__hook_tmp:w \tl_put_right:Nx { { \c__hook_hashes_tl ##1 } } }
+        \tl_set:Nx \l__hook_replace_text_tl
+          { \exp_not:N #2 \exp_not:V \l__hook_replace_text_tl }
+        \tl_set:Nx \l__hook_replace_text_tl
+          {
+            \token_if_eq_meaning:NNTF \__hook_exp_not:n \exp_not:n
+              { \exp_args:NNV \exp_args:No \__hook_double_hashes:n }
+              { \exp_args:NV \exp_not:o }
+                  \l__hook_replace_text_tl
+          }
+        \cs_set_eq:NN \__hook_def_cmd:w \tex_gdef:D
+        \cs_set_eq:NN \__hook_exp_not:NN \prg_do_nothing:
+      }
+      {
+        \tl_clear:N \l__hook_param_text_tl
+        \tl_set_eq:NN \l__hook_replace_text_tl #2
+        \cs_set_eq:NN \__hook_def_cmd:w \tex_xdef:D
+        \cs_set:Npn \__hook_exp_not:NN ##1 { \exp_not:N ##1 \exp_not:N }
+      }
+    \group_begin:
+      \int_set:Nn \tex_escapechar:D { `\/ }
+      \use:x
+        {
+    \group_end:
+    \tl_set:Nx \exp_not:N \l__hook_patch_prefixes_tl
+      { \exp_not:N \__hook_make_prefixes:w \cs_prefix_spec:N #2 / / }
+        }
+    \__hook_disable:n { cmd / #3 / #4 }
+    \cs_undefine:c { c__hook_cmd / #3 / #4_parameter_tl }
+    \__hook_make_usable:nn { cmd / #3 / #4 } { \l__hook_patch_num_args_int }
+    \use:e
+      {
+        \__hook_redefine_with_hooks:Nnnn \exp_not:N #2
+        \str_if_eq:nnTF {#4} { after }
+          { \use_ii_i:nn }
+          { \use:nn }
+            { {
+                \__hook_exp_not:NN \exp_not:N \UseHookWithArguments
+                  { cmd / #3 / #4 } { \int_use:N \l__hook_patch_num_args_int }
+                  \__hook_braced_parameter:n { cmd / #3 / #4 }
+            } }
+            { { } }
+            { \__hook_exp_not:NN \exp_not:V \l__hook_replace_text_tl }
+      }
+    \__hook_update_hook_code:n { cmd / #3 / #4 }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2021/06/01}{\__hook_patch_expand_redefine:NNnn}
+                 {cmd~hooks~with~args}
+\cs_gset_protected:Npn \__hook_patch_expand_redefine:NNnn #1 #2 #3 #4
+  {
+    \__hook_patch_debug:x { ++~command~can~be~patched~without~rescanning }
+    \int_set:Nn \l__hook_patch_num_args_int
+      {
+        \exp_args:Nf \str_count:n { \cs_argument_spec:N #2 } / 2
+        \bool_if:NT #1 { -1 }
+      }
+    \int_compare:nNnTF { \l__hook_patch_num_args_int } > { \c_zero_int }
+      {
+        \tl_set:Nx \l__hook_tmpa_tl { \bool_if:NTF #1 { [ ] } { { } } }
+        \int_step_inline:nnn { 2 } { \l__hook_patch_num_args_int }
+          { \tl_put_right:Nn \l__hook_tmpa_tl { { } } }
+        \exp_args:NNo \exp_args:No \__hook_if_has_hash:nTF
+            { \exp_after:wN #2 \l__hook_tmpa_tl }
+          { \cs_set_eq:NN \__hook_exp_not:n \exp_not:n }
+          { \cs_set_eq:NN \__hook_exp_not:n \use:n }
+        \cs_set_protected:Npn \__hook_tmp:w ##1 ##2
+          {
+            ##1 \l__hook_param_text_tl   { \use:n ##2 }
+            ##1 \l__hook_replace_text_tl { \__hook_exp_not:n {##2} }
+          }
+        \bool_if:NTF #1
           { \__hook_tmp:w \tl_set:Nx { [ \c__hook_hash_tl 1 ] } }
           { \__hook_tmp:w \tl_set:Nx { { \c__hook_hash_tl 1 } } }
         \int_step_inline:nnn { 2 } { \l__hook_patch_num_args_int }
@@ -6660,6 +8014,7 @@
             { \__hook_exp_not:NN \exp_not:V \l__hook_replace_text_tl }
       }
   }
+\EndIncludeInRelease
 \cs_new_protected:Npn \__hook_redefine_with_hooks:Nnnn #1 #2 #3 #4
   {
     \l__hook_patch_prefixes_tl
@@ -6707,7 +8062,11 @@
     \if_meaning:w \q__hook_recursion_tail #1
       \__hook_double_hashes_stop:w
     \fi:
-    \if_meaning:w \c__hook_hash_tl #1
+    \if:w ?
+      \if_meaning:w \c__hook_hash_tl #1 ! \fi:
+      \if_meaning:w \c__hook_hashes_tl #1 ! \fi:
+          ?
+    \else:
       \use_i:nnnn
     \fi:
     \use:n
@@ -6729,10 +8088,10 @@
   { ~ \__hook_double_hashes:w }
 \cs_new_protected:Npn \__hook_retokenize_patch:Nnn #1 #2 #3
   {
-    \__hook_patch_debug:x { ..~command~can~only~be~patched~by~rescanning }
     \str_if_eq:eeTF { \cs_argument_spec:N #1 } { }
       { \__hook_patch_expand_redefine:NNnn \c_false_bool #1 {#2} {#3} }
       {
+        \__hook_patch_debug:x { ..~command~can~only~be~patched~by~rescanning }
         \tl_set:Nx \l__hook_tmpa_tl
           {
             \int_compare:nNnTF { \char_value_catcode:n {`\@ } } = { 12 }
@@ -6762,6 +8121,8 @@
           }
       }
   }
+\IncludeInRelease{2023/06/01}{\__hook_try_patch_with_catcodes:Nnnnw}
+                 {cmd~hooks~with~args}
 \cs_new_protected:Npn \__hook_try_patch_with_catcodes:Nnnnw #1 #2 #3 #4
   {
     \quark_if_recursion_tail_stop_do:nn {#4} { \use:n }
@@ -6770,6 +8131,25 @@
       {
         \__hook_patch_debug:x { ++~macro~can~be~retokenized~cleanly }
         \__hook_patch_debug:x { ==~retokenizing~macro~now }
+        \__hook_patch_retokenize:Nnnn #1 { cmd / #2 / #3 } {#3} {#4}
+        \use_i_delimit_by_q_recursion_stop:nw \use_none:n
+      }
+      {
+        \__hook_patch_debug:x { --~macro~cannot~be~retokenized~cleanly }
+        \__hook_try_patch_with_catcodes:Nnnnw #1 {#2} {#3}
+      }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2021/06/01}{\__hook_try_patch_with_catcodes:Nnnnw}
+                 {cmd~hooks~with~args}
+\cs_gset_protected:Npn \__hook_try_patch_with_catcodes:Nnnnw #1 #2 #3 #4
+  {
+    \quark_if_recursion_tail_stop_do:nn {#4} { \use:n }
+    \__hook_patch_debug:x { ++~trying~to~patch~by~retokenization }
+    \__hook_cmd_if_scanable:NnTF {#1} {#4}
+      {
+        \__hook_patch_debug:x { ++~macro~can~be~retokenized~cleanly }
+        \__hook_patch_debug:x { ==~retokenizing~macro~now }
         \__hook_patch_retokenize:Nnnn #1 {#2} {#3} {#4}
         \use_i_delimit_by_q_recursion_stop:nw \use_none:n
       }
@@ -6778,6 +8158,7 @@
         \__hook_try_patch_with_catcodes:Nnnnw #1 {#2} {#3}
       }
   }
+\EndIncludeInRelease
 \cs_new_eq:NN \kerneltmpDoNotUse !
 \cs_new_protected:Npn \__hook_patch_required_catcodes:
   {
@@ -6805,8 +8186,50 @@
       { \prg_return_true: }
       { \prg_return_false: }
   }
+\IncludeInRelease{2023/06/01}{\__hook_guess_arg_count:NN}
+                 {cmd~hooks~with~args}
+\cs_new_protected:Npn \__hook_guess_arg_count:NN #1
+  {
+    \exp_after:wN \__hook_guess_arg_count:wN
+      \token_to_meaning:N #1 \s__hook_mark
+  }
+\exp_last_unbraced:NNNNo
+\cs_new_protected:Npx \__hook_guess_arg_count:wN
+    #1 { \tl_to_str:n { macro: } } #2 \s__hook_mark #3
+  {
+    \int_set:Nn #3
+      {
+        \exp_not:N \__hook_guess_arg_count:nw { 0 } #2
+          \c_hash_str 0 \s__hook_mark
+      }
+  }
+\use:e
+  { \cs_new:Npn \exp_not:N \__hook_guess_arg_count:nw #1 #2 \c_hash_str #3 }
+  {
+    \int_compare:nNnTF { #1 + 1 } = {#3}
+      { \__hook_guess_arg_count:nw {#3} }
+      { #1 \__hook_use_none_delimit_by_s_mark:w }
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2021/06/01}{\__hook_guess_arg_count:NN}
+                 {cmd~hooks~with~args}
+\cs_undefine:N \__hook_guess_arg_count:NN
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_patch_retokenize:Nnnn}
+                 {cmd~hooks~with~args}
 \cs_new_protected:Npn \__hook_patch_retokenize:Nnnn #1 #2 #3 #4
   {
+    \__hook_guess_arg_count:NN #1 \l__hook_patch_num_args_int
+    \__hook_disable:n {#2}
+    \cs_undefine:c { c__hook_#2_parameter_tl }
+    \__hook_make_usable:nn {#2} { \l__hook_patch_num_args_int }
+    \tl_set:Ne \l__hook_tmpa_tl
+      { \exp_args:Ne \tl_to_str:n { \__hook_braced_parameter:n {#2} } }
+    \use:x
+      {
+        \str_replace_all:Nnn \exp_not:N \l__hook_tmpa_tl
+          { #### } { \c_hash_str }
+      }
     \cs_set_eq:NN \kerneltmpDoNotUse \scan_stop:
     \cs_set_eq:NN \__hook_tmp:w \scan_stop:
     \use:x
@@ -6817,6 +8240,42 @@
             ####1 \def \kerneltmpDoNotUse ####2
               {
                 \str_if_eq:nnT {#3} { before }
+                  {
+                    \token_to_str:N \UseHookWithArguments {#2}
+                      { \int_use:N \l__hook_patch_num_args_int }
+                      \l__hook_tmpa_tl
+                  }
+                ####3
+                \str_if_eq:nnT {#3} { after }
+                  {
+                    \token_to_str:N \UseHookWithArguments {#2}
+                      { \int_use:N \l__hook_patch_num_args_int }
+                      \l__hook_tmpa_tl
+                  }
+              }
+          }
+        \tl_set:Nx \exp_not:N \l__hook_tmpa_tl
+          { \exp_not:N \__hook_tmp:w \token_to_meaning:N #1 \s__hook_mark }
+      }
+    \tl_rescan:nV { #4 \__hook_patch_required_catcodes: } \l__hook_tmpa_tl
+    \cs_gset_eq:NN #1 \kerneltmpDoNotUse
+    \__hook_update_hook_code:n {#2}
+  }
+\EndIncludeInRelease
+\IncludeInRelease{2021/06/01}{\__hook_patch_retokenize:Nnnn}
+                 {cmd~hooks~with~args}
+\cs_gset_protected:Npn \__hook_patch_retokenize:Nnnn #1 #2 #3 #4
+  {
+    \cs_set_eq:NN \kerneltmpDoNotUse \scan_stop:
+    \cs_set_eq:NN \__hook_tmp:w \scan_stop:
+    \use:x
+      {
+        \cs_set:Npn \__hook_tmp:w
+            ####1 \tl_to_str:n { macro: } ####2 -> ####3 \s__hook_mark
+          {
+            ####1 \def \kerneltmpDoNotUse ####2
+              {
+                \str_if_eq:nnT {#3} { before }
                   { \token_to_str:N \UseHook { cmd / #2 / #3 } }
                 ####3
                 \str_if_eq:nnT {#3} { after }
@@ -6829,6 +8288,7 @@
     \tl_rescan:nV { #4 \__hook_patch_required_catcodes: } \l__hook_tmpa_tl
     \cs_gset_eq:NN #1 \kerneltmpDoNotUse
   }
+\EndIncludeInRelease
 \IncludeInRelease{2021/11/15}{wrong-cmd-hook}%
                  {Standardise~generic~hook~names}
 \EndIncludeInRelease
@@ -6915,7 +8375,9 @@
 \let\@latex at note@no at line\@latex at info@no at line
 \EndIncludeInRelease
 %%% From File: ltpar.dtx
-%% File: ltpara.dtx (C) Copyright 2020-2023
+%% File: ltpara.dtx
+%% Copyright (C) 2020-2023
+%% Frank Mittelbach, The LaTeX Project
 %%% From File: ltpara.dtx
 \def\ltparaversion{v1.0l}
 \def\ltparadate{2023/01/30}
@@ -7097,7 +8559,9 @@
 \EndModuleRelease
 \ExplSyntaxOff
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% File: ltmeta.dtx (C) Copyright 2021, 2022
+%% File: ltmeta.dtx
+%% Copyright (C) 2021-2023
+%% Frank Mittelbach, The LaTeX Project
 %%% From File: ltmeta.dtx
 \def\ltmetaversion{v1.0b}
 \def\ltmetadate{2022/05/18}
@@ -7144,6 +8608,7 @@
 \DeclareRobustCommand\linebreak{\@testopt{\@no at lnbk-}4}
 \DeclareRobustCommand\nolinebreak{\@testopt\@no at lnbk4}
 \DeclareRobustCommand\samepage{\interlinepenalty\@M
+   \predisplaypenalty\@M
    \postdisplaypenalty\@M
    \interdisplaylinepenalty\@M
    \@beginparpenalty\@M
@@ -7890,8 +9355,31 @@
   \reserved at a}
 
 \EndIncludeInRelease
+\IncludeInRelease{2023/05/01}%
+                 {\IfFileExists@}{IfFileExists}
+\long\def \IfFileExists@#1#2#3{%
+  \edef\@filef at und{\IfFileExists@@{#1}}%
+  \ifx\@filef at und\@empty
+    \if\relax\detokenize{#1}\relax
+      \let\reserved at a\@firstoftwo
+      \def\@filef at und{".tex" }%
+    \else
+      \let\reserved at a\@secondoftwo
+    \fi
+  \else
+    \let\reserved at a\@firstoftwo
+    \edef\@filef at und{"\@filef at und" }%
+  \fi
+  \expandafter\def\expandafter\reserved at a
+    \expandafter{\reserved at a{#2}{#3}}%
+\reserved at a}
+\ExplSyntaxOn
+\cs_new_eq:NN \IfFileExists@@ \file_full_name:n
+\ExplSyntaxOff
+\EndIncludeInRelease
 \IncludeInRelease{2021/06/01}%
-                 {\IfFileExists@}{manage unbalanced conditionals}
+                 {\IfFileExists@}{IfFileExists}
+
 \long\def \IfFileExists@#1#2#3{%
   \openin\@inputcheck"#1" %
   \ifeof\@inputcheck
@@ -7908,9 +9396,11 @@
   \expandafter\def\expandafter\reserved at a
     \expandafter{\reserved at a{#2}{#3}}%
 \reserved at a}
+\let\IfFileExists@@\@undefined
 \EndIncludeInRelease
+
 \IncludeInRelease{2019/10/01}%
-                 {\IfFileExists@}{manage unbalanced conditionals}
+                 {\IfFileExists@}{IfFileExists}
 
 \long\def \IfFileExists@#1#2#3{%
   \openin\@inputcheck"#1" %
@@ -7928,7 +9418,7 @@
   \reserved at a}
 \EndIncludeInRelease
 \IncludeInRelease{0000/00/00}%
-                 {\IfFileExists@}{manage unbalanced conditionals}
+                 {\IfFileExists@}{IfFileExists}
 
 \let\IfFileExists@\@undefined
 
@@ -11460,11 +12950,58 @@
 
 %%% From File: ltpageno.dtx
 %%% From File: ltxref.dtx
+\IncludeInRelease{2023/06/01}%
+                 {\@kernel at sref}{store five arguments}%
+\def\@setref#1#2#3{%
+  \ifx#1\relax
+   \protect\G at refundefinedtrue
+   \nfss at text{\reset at font\bfseries ??}%
+   \@latex at warning{Reference `#3' on page \thepage \space
+             undefined}%
+  \else
+   \expandafter#2#1\@empty\@empty\@empty\null
+  \fi}
+\long\def\@firstoffive#1#2#3#4#5{#1}
+\long\def\@secondoffive#1#2#3#4#5{#2}
+\def\@kernel at sref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoffive{#1}}
+\def\@kernel at spageref#1{\expandafter\@setref\csname r@#1\endcsname
+                 \@secondoffive{#1}}
+\EndIncludeInRelease
 \IncludeInRelease{2022/06/01}%
-                 {\ref}{Add starred reference commands}%
+                 {\@kernel at sref}{store five arguments}%
+\def\@setref#1#2#3{%
+  \ifx#1\relax
+   \protect\G at refundefinedtrue
+   \nfss at text{\reset at font\bfseries ??}%
+   \@latex at warning{Reference `#3' on page \thepage \space
+             undefined}%
+  \else
+   \expandafter#2#1\null
+  \fi}
+\let\@firstoffive\undefined
+\let\@secondoffive\undefined
 \def\@kernel at sref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}}
 \def\@kernel at spageref#1{\expandafter\@setref\csname r@#1\endcsname
                  \@secondoftwo{#1}}
+\EndIncludeInRelease
+\IncludeInRelease{0000/00/00}%
+                 {\@kernel at sref}{store five arguments}%
+\def\@setref#1#2#3{%
+  \ifx#1\relax
+   \protect\G at refundefinedtrue
+   \nfss at text{\reset at font\bfseries ??}%
+   \@latex at warning{Reference `#3' on page \thepage \space
+             undefined}%
+  \else
+   \expandafter#2#1\null
+  \fi}
+\let\@firstoffive\undefined
+\let\@secondoffive\undefined
+\let\@kernel at sref\undefined
+\let\@kernel at spageref\undefined
+\EndIncludeInRelease
+\IncludeInRelease{2022/06/01}%
+                 {\ref}{Add starred reference commands}%
 \let\@kernel at ref\@kernel at sref
 \let\@kernel at pageref\@kernel at spageref
 \NewDocumentCommand\ref{s}
@@ -11483,6 +13020,21 @@
                                    \@secondoftwo{#1}}
 
 \EndIncludeInRelease
+\IncludeInRelease{2023/06/01}%
+                 {\label}{store five label arguments}%
+\providecommand\@currentlabelname{}
+\providecommand\@currentHref{}
+\providecommand\@kernel at reserved@label at data{}
+\NewHookWithArguments{label}{1}
+\def\label#1{\@bsphack
+  \begingroup
+  \UseHookWithArguments{label}{1}{#1}%
+  \protected at write\@auxout{}%
+         {\string\newlabel{#1}{{\@currentlabel}{\thepage}%
+          {\@currentlabelname}{\@currentHref}{\@kernel at reserved@label at data}}}%
+  \endgroup
+  \@esphack}
+\EndIncludeInRelease
 \IncludeInRelease{2022/06/01}%
                  {\Ref}{Add starred version}%
 \def\@currentcounter{}
@@ -11499,6 +13051,16 @@
 \NewDocumentCommand\Ref{s}
    {\IfBooleanTF{#1}{\@kernel at sRef}{\@kernel at Ref}}
 \EndIncludeInRelease
+\IncludeInRelease{0000/00/00}%
+                 {\label}{store five label arguments}%
+\let\@currenttitle\@undefined
+\let\@currenttarget\@undefined
+\let\@kernel at currentdata\@undefined
+\def\label#1{\@bsphack
+  \protected at write\@auxout{}%
+         {\string\newlabel{#1}{{\@currentlabel}{\thepage}}}%
+  \@esphack}
+\EndIncludeInRelease
 \IncludeInRelease{2020/10/01}%
                  {\Ref}{Add starred version}%
 \def\@currentcounter{}
@@ -12186,6 +13748,18 @@
    \noalign{\penalty\@eqpen\vskip\jot\vskip #1\relax}%
 }
 \EndIncludeInRelease
+\IncludeInRelease{2023/06/01}%
+                 {\eqno}{add ignorespaces to eqno}%
+\let\@kernel at eqno\eqno
+\let\@kernel at leqno\leqno
+\protected\def\eqno{\@kernel at eqno\aftergroup\ignorespaces}
+\protected\def\leqno{\@kernel at leqno\aftergroup\ignorespaces}
+\EndIncludeInRelease
+\IncludeInRelease{0000/00/00}%
+                 {\eqno}{add ignorespaces to eqno}%
+\let\eqno\@kernel at eqno
+\let\leqno\@kernel at leqno
+\EndIncludeInRelease
 %%% From File: ltlists.dtx
 %%% From File: ltboxes.dtx
 \IncludeInRelease{2015/01/01}%
@@ -13532,7 +15106,9 @@
   \@esphack}
 
 \EndIncludeInRelease
-%% File: ltmarks.dtx (C) Copyright 2022
+%% File: ltmarks.dtx
+%% Copyright (C) 2022-2023
+%% Frank Mittelbach, The LaTeX Project
 %%% From File: ltmarks.dtx
 \def\ltmarksversion{v1.0d}
 \def\ltmarksdate{2022/06/01}
@@ -14019,6 +15595,7 @@
 \def\IfFormatAtLeastTF{\@ifl at t@r\fmtversion}
 \let\IfPackageAtLeastTF\@ifpackagelater
 \let\IfClassAtLeastTF\@ifclasslater
+\def\IfFileAtLeastTF#1{\expandafter\@ifl at t@r\csname ver@#1\endcsname}
 \EndIncludeInRelease
 \IncludeInRelease{0000/00/00}%
                  {\IfFormatAtLeastTF}{Test format date}%
@@ -14025,6 +15602,7 @@
 \def\IfFormatAtLeastTF{\@ifl at t@r\fmtversion}
 \let\IfPackageAtLeastTF\@ifpackagelater
 \let\IfClassAtLeastTF\@ifclasslater
+\def\IfFileAtLeastTF#1{\expandafter\@ifl at t@r\csname ver@#1\endcsname}
 \EndIncludeInRelease
 \IncludeInRelease{2018/04/01}%
                  {\@ifl at t@r}{Guard against bad input}%
@@ -14451,7 +16029,7 @@
 \EndIncludeInRelease
 \IncludeInRelease{2020/10/01}%
       {\@onefilewithoptions}{Hooks and unused options issue}%
-\def\@onefilewithoptions#1[#2][#3]#4{%
+\def\load at onefilewithoptions#1[#2][#3]#4{%
   \@expl@@@filehook at set@curr at file@@nNN{#1.#4}\reserved at a\reserved at b
   \edef\reserved at c{\def\noexpand\reserved at c####1%
     \detokenize\expandafter{\expanded{.#4}}%
@@ -15014,8 +16592,8 @@
 \endgroup%
 \EndIncludeInRelease
 %%% From File: ltfilehook.dtx
-\providecommand\ltfilehookversion{v1.0n}
-\providecommand\ltfilehookdate{2022/08/18}
+\providecommand\ltfilehookversion{v1.0o}
+\providecommand\ltfilehookdate{2023/04/02}
 \IncludeInRelease{2020/10/01}%
                  {\CurrentFile}{Hook management file}%
 \ExplSyntaxOn
@@ -15354,7 +16932,7 @@
 \def\@kernel at make@file at csname#1#2#3{%
   \xdef#1{\expandafter\@set at curr@file at aux
     \csname\expandafter#2\@firstofone#3\@nil\endcsname}}
-\def\@set at curr@file at aux#1{%
+\long\def\@set at curr@file at aux#1{%
   \expandafter\ifx\csname\endcsname#1%
     .tex\else\string#1\fi}
 \def\@filehook at set@CurrentFile{%
@@ -15500,7 +17078,7 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%
 %% Copyright (C) 2020-2023
-%%               Frank Mittelbach, LaTeX Team
+%% Frank Mittelbach, The LaTeX Project
 %%
 %%% From File: ltshipout.dtx
 \providecommand\ltshipoutversion{v1.0n}

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ltnews.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ltnews.cls	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ltnews.cls	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 1993-2020
+% Copyright (C) 1993-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ltxdoc.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ltxdoc.cls	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ltxdoc.cls	2023-05-25 20:39:11 UTC (rev 67218)
@@ -43,13 +43,16 @@
 %% extension .ins) which are part of the distribution.
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltxdoc}
-         [2022/06/22 v2.1i Standard LaTeX documentation class]
+         [2023/03/28 v2.1j Standard LaTeX documentation class]
 \DeclareOption{a5paper}{\@latexerr{Option not supported}%
    {}}
 \newif\ifltxdoc at load@cfg@ \ltxdoc at load@cfg at true
 \DeclareOption{nocfg}{\ltxdoc at load@cfg at false}
 \let\ltxdoc at doc@version\@empty  % use current version by default
-\DeclareOption{doc2}{\def\ltxdoc at doc@version{=v2}}
+\DeclareOption{doc2}{%
+  \def\ltxdoc at doc@version{=v2}%
+  \DeclareRobustCommand\cs[1]{\texttt{\bslash #1}}%
+}
 \DeclareOption*{%
     \PassOptionsToClass  {\CurrentOption}{article}}
 \ProcessOptions

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ltxguide.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ltxguide.cls	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ltxguide.cls	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 1993-2019
+% Copyright (C) 1993-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/minimal.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/minimal.cls	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/minimal.cls	2023-05-25 20:39:11 UTC (rev 67218)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 1993-2019
+% Copyright (C) 1993-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/omlcmm.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/omlcmm.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/omlcmm.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{omlcmm.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \DeclareFontFamily{OML}{cmm}{\skewchar\font127 }
 \DeclareFontShape{OML}{cmm}{m}{it}%
      {<5><6><7><8><9>gen*cmmi%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/omlcmr.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/omlcmr.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/omlcmr.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{omlcmr.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \DeclareFontFamily{OML}{cmr}{\skewchar\font127 }
 \DeclareFontShape{OML}{cmr}{m}{n}%
    {<->ssub*cmm/m/it}{}

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/omscmr.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/omscmr.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/omscmr.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{omscmr.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \DeclareFontFamily{OMS}{cmr}{\skewchar\font48 }
 \DeclareFontShape{OMS}{cmr}{m}{n}%
    {<->ssub*cmsy/m/n}{}

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/omscmsy.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/omscmsy.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/omscmsy.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{omscmsy.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \DeclareFontFamily{OMS}{cmsy}{\skewchar\font48 }
 \DeclareFontShape{OMS}{cmsy}{m}{n}{%
       <5><6><7><8><9><10>gen*cmsy%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/omxcmex.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/omxcmex.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/omxcmex.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{omxcmex.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \DeclareFontFamily{OMX}{cmex}{}
 \DeclareFontShape{OMX}{cmex}{m}{n}{%
    <->sfixed*cmex10%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmdh.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmdh.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmdh.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{ot1cmdh.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \DeclareFontFamily{OT1}{cmdh}{\hyphenchar\font45 }
 \DeclareFontShape{OT1}{cmdh}{m}{n}{%
       <10>cmdunh10%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmfib.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmfib.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmfib.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{ot1cmfib.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \DeclareFontFamily{OT1}{cmfib}{\hyphenchar\font45 }
 \DeclareFontShape{OT1}{cmfib}{m}{n}{%
       <8>cmfib8%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmfr.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmfr.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmfr.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{ot1cmfr.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \DeclareFontFamily{OT1}{cmfr}{\hyphenchar\font45 }
 \DeclareFontShape{OT1}{cmfr}{m}{n}{%
       <10>cmff10%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmr.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmr.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmr.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{ot1cmr.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \DeclareFontFamily{OT1}{cmr}{\hyphenchar\font45 }
 \DeclareFontShape{OT1}{cmr}{m}{n}%
      {<5><6><7><8><9><10><12>gen*cmr%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmss.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmss.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmss.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{ot1cmss.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \DeclareFontFamily{OT1}{cmss}{\hyphenchar\font45 }
 \DeclareFontShape{OT1}{cmss}{m}{n}
      {%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmtt.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmtt.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmtt.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{ot1cmtt.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \DeclareFontFamily{OT1}{cmtt}{\hyphenchar \font\m at ne}
 \DeclareFontShape{OT1}{cmtt}{m}{n}
      {%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmvtt.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmvtt.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ot1cmvtt.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{ot1cmvtt.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \DeclareFontFamily{OT1}{cmvtt}{\hyphenchar\font45 }
 \DeclareFontShape{OT1}{cmvtt}{m}{n}%
      {%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/report.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/report.cls	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/report.cls	2023-05-25 20:39:11 UTC (rev 67218)
@@ -43,7 +43,7 @@
 %% extension .ins) which are part of the distribution.
 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
 \ProvidesClass{report}
-              [2022/07/02 v1.4n
+              [2023/05/17 v1.4n
  Standard LaTeX document class]
 \newcommand\@ptsize{}
 \newif\if at restonecol

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/size10.clo
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/size10.clo	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/size10.clo	2023-05-25 20:39:11 UTC (rev 67218)
@@ -42,7 +42,7 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension .ins) which are part of the distribution.
 \ProvidesFile{size10.clo}
-              [2022/07/02 v1.4n
+              [2023/05/17 v1.4n
       Standard LaTeX file (size option)]
 \renewcommand\normalsize{%
    \@setfontsize\normalsize\@xpt\@xiipt

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/size11.clo
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/size11.clo	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/size11.clo	2023-05-25 20:39:11 UTC (rev 67218)
@@ -42,7 +42,7 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension .ins) which are part of the distribution.
 \ProvidesFile{size11.clo}
-              [2022/07/02 v1.4n
+              [2023/05/17 v1.4n
       Standard LaTeX file (size option)]
 \renewcommand\normalsize{%
    \@setfontsize\normalsize\@xipt{13.6}%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/size12.clo
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/size12.clo	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/size12.clo	2023-05-25 20:39:11 UTC (rev 67218)
@@ -42,7 +42,7 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension .ins) which are part of the distribution.
 \ProvidesFile{size12.clo}
-              [2022/07/02 v1.4n
+              [2023/05/17 v1.4n
       Standard LaTeX file (size option)]
 \renewcommand\normalsize{%
    \@setfontsize\normalsize\@xiipt{14.5}%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/structuredlog.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/structuredlog.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/structuredlog.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -42,8 +42,8 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension .ins) which are part of the distribution.
 %%% From File: ltfilehook.dtx
-\providecommand\ltfilehookversion{v1.0n}
-\providecommand\ltfilehookdate{2022/08/18}
+\providecommand\ltfilehookversion{v1.0o}
+\providecommand\ltfilehookdate{2023/04/02}
 \ProvidesExplPackage
     {structuredlog}{\ltfilehookdate}{\ltfilehookversion}
     {Structuring the TeX transcript file}

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/t1cmdh.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/t1cmdh.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/t1cmdh.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{t1cmdh.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \providecommand{\EC at family}[5]{%
   \DeclareFontShape{#1}{#2}{#3}{#4}%
   {<5><6><7><8><9><10><10.95><12><14.4>%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/t1cmfib.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/t1cmfib.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/t1cmfib.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{t1cmfib.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \providecommand{\EC at family}[5]{%
   \DeclareFontShape{#1}{#2}{#3}{#4}%
   {<5><6><7><8><9><10><10.95><12><14.4>%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/t1cmfr.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/t1cmfr.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/t1cmfr.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{t1cmfr.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \providecommand{\EC at family}[5]{%
   \DeclareFontShape{#1}{#2}{#3}{#4}%
   {<5><6><7><8><9><10><10.95><12><14.4>%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/t1cmr.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/t1cmr.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/t1cmr.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{t1cmr.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \providecommand{\EC at family}[5]{%
   \DeclareFontShape{#1}{#2}{#3}{#4}%
   {<5><6><7><8><9><10><10.95><12><14.4>%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/t1cmss.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/t1cmss.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/t1cmss.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{t1cmss.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \providecommand{\EC at ssfamily}[5]{%
   \DeclareFontShape{#1}{#2}{#3}{#4}%
   {<5><6><7><8>#50800%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/t1cmtt.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/t1cmtt.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/t1cmtt.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{t1cmtt.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \providecommand{\EC at ttfamily}[5]{%
   \DeclareFontShape{#1}{#2}{#3}{#4}%
   {<5><6><7><8>#50800%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/t1cmvtt.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/t1cmvtt.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/t1cmvtt.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{t1cmvtt.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \providecommand{\EC at ttfamily}[5]{%
   \DeclareFontShape{#1}{#2}{#3}{#4}%
   {<5><6><7><8>#50800%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ts1cmr.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ts1cmr.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ts1cmr.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{ts1cmr.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \providecommand{\EC at family}[5]{%
   \DeclareFontShape{#1}{#2}{#3}{#4}%
   {<5><6><7><8><9><10><10.95><12><14.4>%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ts1cmss.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ts1cmss.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ts1cmss.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{ts1cmss.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \providecommand{\EC at family}[5]{%
   \DeclareFontShape{#1}{#2}{#3}{#4}%
   {<5><6><7><8><9><10><10.95><12><14.4>%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ts1cmtt.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ts1cmtt.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ts1cmtt.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{ts1cmtt.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \providecommand{\EC at ttfamily}[5]{%
   \DeclareFontShape{#1}{#2}{#3}{#4}%
   {<5><6><7><8>#50800%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ts1cmvtt.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ts1cmvtt.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ts1cmvtt.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{ts1cmvtt.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \providecommand{\EC at ttfamily}[5]{%
   \DeclareFontShape{#1}{#2}{#3}{#4}%
   {<5><6><7><8>#50800%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ucmr.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ucmr.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ucmr.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{ucmr.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \DeclareFontFamily{U}{cmr}{\hyphenchar\font45 }
 \DeclareFontShape{U}{cmr}{m}{n}%
      {<5><6><7><8><9><10><12>gen*cmr%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ucmss.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ucmss.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ucmss.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{ucmss.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \DeclareFontFamily{U}{cmss}{\hyphenchar\font45 }
 \DeclareFontShape{U}{cmss}{m}{n}%
      {%

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/ucmtt.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/ucmtt.fd	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/ucmtt.fd	2023-05-25 20:39:11 UTC (rev 67218)
@@ -46,7 +46,7 @@
 %% making successful document exchange impossible.
 %% 
 \ProvidesFile{ucmtt.fd}
-        [2022/07/10 v2.5l Standard LaTeX font definitions]
+        [2023/04/13 v2.5m Standard LaTeX font definitions]
 \DeclareFontFamily{U}{cmtt}{\hyphenchar \font\m at ne}
 \DeclareFontShape{U}{cmtt}{m}{n}%
      {%
@@ -76,6 +76,7 @@
   {<->sub*cmtt/m/n}{}
 \DeclareFontShape{U}{cmtt}{bx}{it}%
   {<->sub*cmtt/m/it}{}
+\DeclareFontShape{U}{cmtt}{bx}{sl}
   {<->sub*cmtt/m/n}{}
 \DeclareFontShape{U}{cmtt}{bx}{ui}%
   {<->sub*cmtt/m/it}{}

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/afterpage.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/afterpage.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/afterpage.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -12,7 +12,7 @@
 %% reports for it can be opened at https://latex-project.org/bugs/
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/array.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/array.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/array.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/bm.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/bm.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/bm.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -12,7 +12,7 @@
 %% reports for it can be opened at https://latex-project.org/bugs/
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/calc.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/calc.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/calc.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/dcolumn.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/dcolumn.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/dcolumn.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/delarray.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/delarray.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/delarray.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/e.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/e.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/e.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/enumerate.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/enumerate.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/enumerate.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/fontsmpl.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/fontsmpl.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/fontsmpl.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/fontsmpl.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/fontsmpl.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/fontsmpl.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/ftnright.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/ftnright.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/ftnright.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/h.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/h.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/h.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/hhline.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/hhline.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/hhline.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/indentfirst.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/indentfirst.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/indentfirst.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/layout.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/layout.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/layout.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/longtable.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/longtable.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/longtable.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -12,7 +12,7 @@
 %% reports for it can be opened at https://latex-project.org/bugs/
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/multicol.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/multicol.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/multicol.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -12,7 +12,7 @@
 %% reports for it can be opened at https://latex-project.org/bugs/
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 
@@ -35,7 +35,7 @@
 %% given in the file `manifest.txt'.
 %% 
 %% Package `multicol' to use with LaTeX2e
-%% Copyright 1989-2019 Frank Mittelbach
+%% Copyright 1989-2023 Frank Mittelbach
 %%
 %%  In addition to the terms of LPPL any distributed version
 %%  (unchanged or modified) of multicol has to keep the statement
@@ -108,7 +108,7 @@
 \DeclareCurrentRelease{}{2021-11-15}
 
 \ProvidesPackage{multicol}
-          [2021/11/30 v1.9d  multicolumn formatting (FMi)]
+          [2023/03/30 v1.9f  multicolumn formatting (FMi)]
 %%
 \DeclareOption{twocolumn}
    {\PackageWarning{multicol}{May not work
@@ -319,11 +319,13 @@
                  \kept at firstmark
     \return at nonemptymark{bot}%
                   \kept at botmark
-    \page at sofar
-    \global\let\kept at firstmark
-               \l at kept@firstmark
-    \global\let\kept at botmark
-            \l at kept@botmark
+    \global\setbox\mc at boxedresult\vbox{%
+      \page at sofar
+      \global\let\kept at firstmark
+                 \l at kept@firstmark
+      \global\let\kept at botmark
+                 \l at kept@botmark
+    }%
     \mult at info\tw@
       {Restore kept marks to\MessageBreak
        first: \meaning\kept at firstmark
@@ -349,6 +351,7 @@
   \endgroup
   \global\c at unbalance\z@
   \if at boxedmulticols
+    \unvbox\mc at boxedresult
     \mc at col@status at write
   \else
     \reinsert at footnotes
@@ -378,6 +381,7 @@
 \newskip\multicolbaselineskip
 \newbox\partial at page
 \newbox\last at line
+\newbox\mc at boxedresult
 \c at unbalance   = 0
 \c at collectmore = 0
 \multicoltolerance = 9999
@@ -411,11 +415,11 @@
      }%
 \ifvmode\else\errmessage{Multicol Error}\fi
    \nointerlineskip
-   \setbox\z@\hbox{p}\global\dimen\tw@\dp\z@
+   \setbox\z@\hbox{\multicolmindepthstring}\global\dimen\tw@\dp\z@
    \moveright\multicol at leftmargin
     \hbox to\full at width{%
        \mc at align@columns
-       \rlap{\phantom p}%
+       \rlap{\phantom \multicolmindepthstring}%
     }%
    \prevdepth\z@
  \kern-\dimen\tw@
@@ -425,6 +429,7 @@
       Grid alignment might be broken}%
  \fi
 }
+\def\multicolmindepthstring{p}
 \def\columnseprulecolor{\normalcolor}
 \def\reinsert at footnotes{\ifvoid\footins\else
          \insert\footins{}\fi}

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/q.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/q.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/q.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/r.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/r.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/r.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/rawfonts.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/rawfonts.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/rawfonts.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/s.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/s.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/s.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/shellesc.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/shellesc.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/shellesc.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 
@@ -36,7 +36,7 @@
 %% given in the file `manifest.txt'.
 %% 
 %% Source File: shellesc.dtx
-%% Copyright (C) 2015-2022
+%% Copyright (C) 2015-2023
 %%
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
@@ -49,7 +49,7 @@
 \ifx\PackageWarning\undefined\def\PackageWarning#1#2{\wlog{#1: #2}}\fi
 \expandafter\next\fi
 \ProvidesPackage{shellesc}
-       [2019/11/08 v1.0c unified shell escape interface for LaTeX]
+       [2023/04/15 v1.0d unified shell escape interface for LaTeX]
 \chardef\shellesc at quotecat\catcode`\"
 \chardef\shellesc at underscorecat\catcode`\_
 \@makeother\"
@@ -92,15 +92,15 @@
 if status == nil then
     texio.write_nl("log",%
       "runsystem(" .. "\luaescapestring{#1}"%
-       .. ")...(" .. msg .. ")\string\n")
+       .. ")...(" .. msg .. ").\string\n")
   elseif status == 0 then
     texio.write_nl("log",%
       "runsystem(" .. "\luaescapestring{#1}"%
-      .. ")...executed\string\n")
+      .. ")...executed.\string\n")
   else
     texio.write_nl("log",%
       "runsystem(" .. "\luaescapestring{#1}"%
-       .. ")...failed " .. (msg or "") .. "\string\n")
+       .. ")...failed. " .. (msg or "") .. "\string\n")
   end
 }}
 \fi

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/showkeys.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/showkeys.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/showkeys.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 
@@ -46,7 +46,7 @@
 \DeclareCurrentRelease{}{2022-06-01}
 
 \ProvidesPackage{showkeys}
-          [2022/04/12 v3.18 Show cite and label keys (DPC, MH)]
+          [2023/05/11 v3.19 Show cite and label keys (DPC, MH)]
 \DeclareOption{notref}{\let\SK at ref\@empty}
 \DeclareOption{notcite}{\let\SK at cite\@empty}
 \let\SK at refcolor\relax
@@ -65,13 +65,15 @@
 \let\SK at label\label
 \let\SK at bibitem\@bibitem
 \let\SK at lbibitem\@lbibitem
-\def\label#1{%
+\@ifl at t@r\fmtversion{2023-06-01}
+ {\AddToHookWithArguments{label}{\SK@\SK@@label{#1}}}
+ {\def\label#1{%
   \@bsphack
   \SK@\SK@@label{#1}%
   \begingroup
     \SK at label{#1}%
   \endgroup
-  \@esphack}
+  \@esphack}}
 \def\@bibitem#1{%
   \SK at bibitem{#1}\SK@\SK@@label{#1}\ignorespaces}
 \def\@lbibitem[#1]#2{%

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/somedefs.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/somedefs.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/somedefs.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/tabularx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/tabularx.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/tabularx.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -12,7 +12,7 @@
 %% reports for it can be opened at https://latex-project.org/bugs/
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/thb.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/thb.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/thb.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/thc.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/thc.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/thc.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/thcb.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/thcb.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/thcb.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/theorem.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/theorem.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/theorem.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/thm.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/thm.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/thm.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/thmb.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/thmb.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/thmb.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/thp.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/thp.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/thp.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/trace.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/trace.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/trace.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/varioref.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/varioref.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/varioref.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -12,7 +12,7 @@
 %% reports for it can be opened at https://latex-project.org/bugs/
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/verbatim.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/verbatim.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/verbatim.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/verbtest.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/verbtest.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/verbtest.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/x.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/x.tex	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/x.tex	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/xr.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/xr.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/xr.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 

Modified: trunk/Master/texmf-dist/tex/latex-dev/tools/xspace.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/tools/xspace.sty	2023-05-25 20:37:45 UTC (rev 67217)
+++ trunk/Master/texmf-dist/tex/latex-dev/tools/xspace.sty	2023-05-25 20:39:11 UTC (rev 67218)
@@ -13,7 +13,7 @@
 %% (but please observe conditions on bug reports sent to that address!)
 %% 
 %% 
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
 %% The LaTeX Project and any individual authors listed elsewhere
 %% in this file.
 %% 



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