summaryrefslogtreecommitdiff
path: root/macros/latex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex')
-rw-r--r--macros/latex/base/README.md2
-rw-r--r--macros/latex/base/alltt.pdfbin223831 -> 223831 bytes
-rw-r--r--macros/latex/base/cfgguide.pdfbin264112 -> 264112 bytes
-rw-r--r--macros/latex/base/changes.txt26
-rw-r--r--macros/latex/base/classes.pdfbin560611 -> 560611 bytes
-rw-r--r--macros/latex/base/clsguide.pdfbin414419 -> 414419 bytes
-rw-r--r--macros/latex/base/cmfonts.pdfbin292160 -> 292160 bytes
-rw-r--r--macros/latex/base/cyrguide.pdfbin257314 -> 257314 bytes
-rw-r--r--macros/latex/base/doc-code.pdfbin1077527 -> 1077974 bytes
-rw-r--r--macros/latex/base/doc.pdfbin755064 -> 755564 bytes
-rw-r--r--macros/latex/base/docstrip.pdfbin504553 -> 504635 bytes
-rw-r--r--macros/latex/base/encguide.pdfbin1318126 -> 1318126 bytes
-rw-r--r--macros/latex/base/exscale.pdfbin204711 -> 204711 bytes
-rw-r--r--macros/latex/base/fix-cm.pdfbin287733 -> 287733 bytes
-rw-r--r--macros/latex/base/fntguide.pdfbin517838 -> 517838 bytes
-rw-r--r--macros/latex/base/graphpap.pdfbin161713 -> 161713 bytes
-rw-r--r--macros/latex/base/ifthen.pdfbin221211 -> 221211 bytes
-rw-r--r--macros/latex/base/inputenc.pdfbin318204 -> 318204 bytes
-rw-r--r--macros/latex/base/lamport-manual.pdfbin170878 -> 170878 bytes
-rw-r--r--macros/latex/base/latexrelease.pdfbin281906 -> 281906 bytes
-rw-r--r--macros/latex/base/latexsym.pdfbin200760 -> 200760 bytes
-rw-r--r--macros/latex/base/lb2.pdfbin252140 -> 252140 bytes
-rw-r--r--macros/latex/base/letter.pdfbin337630 -> 337717 bytes
-rw-r--r--macros/latex/base/lgc2.pdfbin215684 -> 215684 bytes
-rw-r--r--macros/latex/base/lppl.pdfbin132382 -> 132382 bytes
-rw-r--r--macros/latex/base/ltcmdhooks-code.pdfbin719104 -> 719498 bytes
-rw-r--r--macros/latex/base/ltcmdhooks-doc.pdfbin478606 -> 478988 bytes
-rw-r--r--macros/latex/base/ltfilehook-code.pdfbin803024 -> 803237 bytes
-rw-r--r--macros/latex/base/ltfilehook-doc.pdfbin547895 -> 548101 bytes
-rw-r--r--macros/latex/base/ltfinal.dtx34
-rw-r--r--macros/latex/base/lthooks-code.pdfbin1091409 -> 1091738 bytes
-rw-r--r--macros/latex/base/lthooks-doc.pdfbin701468 -> 701793 bytes
-rw-r--r--macros/latex/base/ltluatex.pdfbin325457 -> 325457 bytes
-rw-r--r--macros/latex/base/ltmarks-code.pdfbin715524 -> 715851 bytes
-rw-r--r--macros/latex/base/ltmarks-doc.pdfbin585896 -> 586219 bytes
-rw-r--r--macros/latex/base/ltnews.pdfbin1243036 -> 1243036 bytes
-rw-r--r--macros/latex/base/ltnews01.pdfbin161518 -> 161518 bytes
-rw-r--r--macros/latex/base/ltnews02.pdfbin159792 -> 159792 bytes
-rw-r--r--macros/latex/base/ltnews03.pdfbin159332 -> 159332 bytes
-rw-r--r--macros/latex/base/ltnews04.pdfbin152525 -> 152525 bytes
-rw-r--r--macros/latex/base/ltnews05.pdfbin174494 -> 174494 bytes
-rw-r--r--macros/latex/base/ltnews06.pdfbin142849 -> 142849 bytes
-rw-r--r--macros/latex/base/ltnews07.pdfbin137811 -> 137811 bytes
-rw-r--r--macros/latex/base/ltnews08.pdfbin155053 -> 155053 bytes
-rw-r--r--macros/latex/base/ltnews09.pdfbin129570 -> 129570 bytes
-rw-r--r--macros/latex/base/ltnews10.pdfbin169416 -> 169416 bytes
-rw-r--r--macros/latex/base/ltnews11.pdfbin111948 -> 111948 bytes
-rw-r--r--macros/latex/base/ltnews12.pdfbin156551 -> 156551 bytes
-rw-r--r--macros/latex/base/ltnews13.pdfbin182225 -> 182225 bytes
-rw-r--r--macros/latex/base/ltnews14.pdfbin170473 -> 170473 bytes
-rw-r--r--macros/latex/base/ltnews15.pdfbin130309 -> 130309 bytes
-rw-r--r--macros/latex/base/ltnews16.pdfbin138073 -> 138073 bytes
-rw-r--r--macros/latex/base/ltnews17.pdfbin166228 -> 166228 bytes
-rw-r--r--macros/latex/base/ltnews18.pdfbin38033 -> 38033 bytes
-rw-r--r--macros/latex/base/ltnews19.pdfbin230028 -> 230028 bytes
-rw-r--r--macros/latex/base/ltnews20.pdfbin318548 -> 318548 bytes
-rw-r--r--macros/latex/base/ltnews21.pdfbin244867 -> 244867 bytes
-rw-r--r--macros/latex/base/ltnews22.pdfbin317773 -> 317773 bytes
-rw-r--r--macros/latex/base/ltnews23.pdfbin286591 -> 286591 bytes
-rw-r--r--macros/latex/base/ltnews24.pdfbin265279 -> 265279 bytes
-rw-r--r--macros/latex/base/ltnews25.pdfbin204935 -> 204935 bytes
-rw-r--r--macros/latex/base/ltnews26.pdfbin379462 -> 379462 bytes
-rw-r--r--macros/latex/base/ltnews27.pdfbin250592 -> 250592 bytes
-rw-r--r--macros/latex/base/ltnews28.pdfbin376643 -> 376643 bytes
-rw-r--r--macros/latex/base/ltnews29.pdfbin455107 -> 455107 bytes
-rw-r--r--macros/latex/base/ltnews30.pdfbin511909 -> 511909 bytes
-rw-r--r--macros/latex/base/ltnews31.pdfbin526323 -> 526323 bytes
-rw-r--r--macros/latex/base/ltnews32.pdfbin546160 -> 546160 bytes
-rw-r--r--macros/latex/base/ltnews33.pdfbin522412 -> 522412 bytes
-rw-r--r--macros/latex/base/ltnews34.pdfbin508044 -> 508044 bytes
-rw-r--r--macros/latex/base/ltnews35.pdfbin563089 -> 563089 bytes
-rw-r--r--macros/latex/base/ltnews36.pdfbin517577 -> 517577 bytes
-rw-r--r--macros/latex/base/ltpara-code.pdfbin667097 -> 667434 bytes
-rw-r--r--macros/latex/base/ltpara-doc.pdfbin559976 -> 560295 bytes
-rw-r--r--macros/latex/base/ltshipout-code.pdfbin818741 -> 818839 bytes
-rw-r--r--macros/latex/base/ltshipout-doc.pdfbin563518 -> 563617 bytes
-rw-r--r--macros/latex/base/ltspace.dtx16
-rw-r--r--macros/latex/base/ltvers.dtx2
-rw-r--r--macros/latex/base/ltx3info.pdfbin219349 -> 219349 bytes
-rw-r--r--macros/latex/base/ltxdoc.dtx11
-rw-r--r--macros/latex/base/ltxdoc.pdfbin242645 -> 243286 bytes
-rw-r--r--macros/latex/base/makeindx.pdfbin165821 -> 165821 bytes
-rw-r--r--macros/latex/base/modguide.pdfbin257804 -> 257804 bytes
-rw-r--r--macros/latex/base/nfssfont.pdfbin211180 -> 211180 bytes
-rw-r--r--macros/latex/base/proc.pdfbin227059 -> 227059 bytes
-rw-r--r--macros/latex/base/slides.pdfbin375518 -> 375518 bytes
-rw-r--r--macros/latex/base/slifonts.pdfbin234191 -> 234191 bytes
-rw-r--r--macros/latex/base/source2e.pdfbin5767668 -> 5771795 bytes
-rw-r--r--macros/latex/base/syntonly.pdfbin189704 -> 190118 bytes
-rw-r--r--macros/latex/base/tlc2.pdfbin290615 -> 290615 bytes
-rw-r--r--macros/latex/base/tulm.pdfbin162772 -> 162772 bytes
-rw-r--r--macros/latex/base/usrguide-historic.pdfbin438515 -> 438515 bytes
-rw-r--r--macros/latex/base/usrguide.pdfbin473980 -> 473980 bytes
-rw-r--r--macros/latex/base/utf8ienc.pdfbin353237 -> 353664 bytes
-rw-r--r--macros/latex/base/webcomp.pdfbin146198 -> 146198 bytes
-rw-r--r--macros/latex/contrib/fvextra/fvextra.dtx855
-rw-r--r--macros/latex/contrib/fvextra/fvextra.ins5
-rw-r--r--macros/latex/contrib/fvextra/fvextra.pdfbin823961 -> 867095 bytes
-rw-r--r--macros/latex/contrib/ukbill/README15
-rw-r--r--macros/latex/contrib/ukbill/immigration-bill.pdfbin0 -> 85276 bytes
-rw-r--r--macros/latex/contrib/ukbill/immigration-bill.tex251
-rw-r--r--macros/latex/contrib/ukbill/ukbill-documentation.pdfbin0 -> 98091 bytes
-rw-r--r--macros/latex/contrib/ukbill/ukbill-documentation.tex783
-rw-r--r--macros/latex/contrib/ukbill/ukbill.cls609
104 files changed, 2374 insertions, 235 deletions
diff --git a/macros/latex/base/README.md b/macros/latex/base/README.md
index 18b3a5fcc2..eb19004b01 100644
--- a/macros/latex/base/README.md
+++ b/macros/latex/base/README.md
@@ -1,7 +1,7 @@
The LaTeX kernel
================
-Release 2022-11-01
+Release 2022-11-01 patch level 1
Overview
--------
diff --git a/macros/latex/base/alltt.pdf b/macros/latex/base/alltt.pdf
index cf447a5d61..f2614d73e0 100644
--- a/macros/latex/base/alltt.pdf
+++ b/macros/latex/base/alltt.pdf
Binary files differ
diff --git a/macros/latex/base/cfgguide.pdf b/macros/latex/base/cfgguide.pdf
index 1a63114bf0..724ae8aebe 100644
--- a/macros/latex/base/cfgguide.pdf
+++ b/macros/latex/base/cfgguide.pdf
Binary files differ
diff --git a/macros/latex/base/changes.txt b/macros/latex/base/changes.txt
index 0ae9b55c03..fed7e96be3 100644
--- a/macros/latex/base/changes.txt
+++ b/macros/latex/base/changes.txt
@@ -8,7 +8,31 @@ are not part of the distribution.
================================================================================
All changes above are only part of the development branch for the next release.
-================================================================================
+================================================================================
+
+#########################
+# 2022-11-01 PL1 Release
+#########################
+
+2022-11-28 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
+
+ * ltspace.dtx (subsection{Horizontal space (and breaks)}):
+ We use a private register instead of a group with \hspace in case it
+ starts the paragraph.
+ Otherwise \everypar and friends will be executed inside a group (gh/967)
+
+2022-11-28 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
+
+ * ltxdoc.dtx:
+ Revert using \detokenize in \cs (gh/962)
+ Eventually we will need to sync with the code in l3doc but for now
+ we stay with the simpler definition from doc.sty.
+
+2022-11-30 Joseph Wright <Joseph.Wright@latex-project.org>
+
+ * ltfinal.dtx:
+ Set \oe and \OE equal in case changing to allow detection
+ by babel
#########################
# 2022-11-01 Release
diff --git a/macros/latex/base/classes.pdf b/macros/latex/base/classes.pdf
index 6df3b9b2eb..a8296800a3 100644
--- a/macros/latex/base/classes.pdf
+++ b/macros/latex/base/classes.pdf
Binary files differ
diff --git a/macros/latex/base/clsguide.pdf b/macros/latex/base/clsguide.pdf
index c9f85a5f52..14152ab987 100644
--- a/macros/latex/base/clsguide.pdf
+++ b/macros/latex/base/clsguide.pdf
Binary files differ
diff --git a/macros/latex/base/cmfonts.pdf b/macros/latex/base/cmfonts.pdf
index 5eda3d0e00..01bd9f1fa2 100644
--- a/macros/latex/base/cmfonts.pdf
+++ b/macros/latex/base/cmfonts.pdf
Binary files differ
diff --git a/macros/latex/base/cyrguide.pdf b/macros/latex/base/cyrguide.pdf
index e7ac0140e4..6339438a02 100644
--- a/macros/latex/base/cyrguide.pdf
+++ b/macros/latex/base/cyrguide.pdf
Binary files differ
diff --git a/macros/latex/base/doc-code.pdf b/macros/latex/base/doc-code.pdf
index 01ad1c42bb..3b0c7bc965 100644
--- a/macros/latex/base/doc-code.pdf
+++ b/macros/latex/base/doc-code.pdf
Binary files differ
diff --git a/macros/latex/base/doc.pdf b/macros/latex/base/doc.pdf
index 64981124a6..75e804a9c9 100644
--- a/macros/latex/base/doc.pdf
+++ b/macros/latex/base/doc.pdf
Binary files differ
diff --git a/macros/latex/base/docstrip.pdf b/macros/latex/base/docstrip.pdf
index 355dbeed98..83739ec6b3 100644
--- a/macros/latex/base/docstrip.pdf
+++ b/macros/latex/base/docstrip.pdf
Binary files differ
diff --git a/macros/latex/base/encguide.pdf b/macros/latex/base/encguide.pdf
index d18588a172..5ddc6f4fc9 100644
--- a/macros/latex/base/encguide.pdf
+++ b/macros/latex/base/encguide.pdf
Binary files differ
diff --git a/macros/latex/base/exscale.pdf b/macros/latex/base/exscale.pdf
index 2bdb881a90..30af0ff0a7 100644
--- a/macros/latex/base/exscale.pdf
+++ b/macros/latex/base/exscale.pdf
Binary files differ
diff --git a/macros/latex/base/fix-cm.pdf b/macros/latex/base/fix-cm.pdf
index c983a8e947..5d8487c2ea 100644
--- a/macros/latex/base/fix-cm.pdf
+++ b/macros/latex/base/fix-cm.pdf
Binary files differ
diff --git a/macros/latex/base/fntguide.pdf b/macros/latex/base/fntguide.pdf
index a2ef00a6f8..d4c88762f4 100644
--- a/macros/latex/base/fntguide.pdf
+++ b/macros/latex/base/fntguide.pdf
Binary files differ
diff --git a/macros/latex/base/graphpap.pdf b/macros/latex/base/graphpap.pdf
index 003b7a087d..d2385fa786 100644
--- a/macros/latex/base/graphpap.pdf
+++ b/macros/latex/base/graphpap.pdf
Binary files differ
diff --git a/macros/latex/base/ifthen.pdf b/macros/latex/base/ifthen.pdf
index f108383366..4802103db4 100644
--- a/macros/latex/base/ifthen.pdf
+++ b/macros/latex/base/ifthen.pdf
Binary files differ
diff --git a/macros/latex/base/inputenc.pdf b/macros/latex/base/inputenc.pdf
index a82e38bc08..1ea351b1e7 100644
--- a/macros/latex/base/inputenc.pdf
+++ b/macros/latex/base/inputenc.pdf
Binary files differ
diff --git a/macros/latex/base/lamport-manual.pdf b/macros/latex/base/lamport-manual.pdf
index 228b5d5327..2d2e7d4f47 100644
--- a/macros/latex/base/lamport-manual.pdf
+++ b/macros/latex/base/lamport-manual.pdf
Binary files differ
diff --git a/macros/latex/base/latexrelease.pdf b/macros/latex/base/latexrelease.pdf
index eb8fc4bf80..9ab51faa3b 100644
--- a/macros/latex/base/latexrelease.pdf
+++ b/macros/latex/base/latexrelease.pdf
Binary files differ
diff --git a/macros/latex/base/latexsym.pdf b/macros/latex/base/latexsym.pdf
index 27de765603..8546f14f7d 100644
--- a/macros/latex/base/latexsym.pdf
+++ b/macros/latex/base/latexsym.pdf
Binary files differ
diff --git a/macros/latex/base/lb2.pdf b/macros/latex/base/lb2.pdf
index e22f0b68d3..c8f32233af 100644
--- a/macros/latex/base/lb2.pdf
+++ b/macros/latex/base/lb2.pdf
Binary files differ
diff --git a/macros/latex/base/letter.pdf b/macros/latex/base/letter.pdf
index 13e36346bb..51e1f40c55 100644
--- a/macros/latex/base/letter.pdf
+++ b/macros/latex/base/letter.pdf
Binary files differ
diff --git a/macros/latex/base/lgc2.pdf b/macros/latex/base/lgc2.pdf
index 323fa18ce5..43ab034d38 100644
--- a/macros/latex/base/lgc2.pdf
+++ b/macros/latex/base/lgc2.pdf
Binary files differ
diff --git a/macros/latex/base/lppl.pdf b/macros/latex/base/lppl.pdf
index 526ce5730b..81e00214b6 100644
--- a/macros/latex/base/lppl.pdf
+++ b/macros/latex/base/lppl.pdf
Binary files differ
diff --git a/macros/latex/base/ltcmdhooks-code.pdf b/macros/latex/base/ltcmdhooks-code.pdf
index 0ff4218c8d..83670e4463 100644
--- a/macros/latex/base/ltcmdhooks-code.pdf
+++ b/macros/latex/base/ltcmdhooks-code.pdf
Binary files differ
diff --git a/macros/latex/base/ltcmdhooks-doc.pdf b/macros/latex/base/ltcmdhooks-doc.pdf
index 4e902ecb97..fa4ca35a07 100644
--- a/macros/latex/base/ltcmdhooks-doc.pdf
+++ b/macros/latex/base/ltcmdhooks-doc.pdf
Binary files differ
diff --git a/macros/latex/base/ltfilehook-code.pdf b/macros/latex/base/ltfilehook-code.pdf
index 77472b7457..fbaf7f0502 100644
--- a/macros/latex/base/ltfilehook-code.pdf
+++ b/macros/latex/base/ltfilehook-code.pdf
Binary files differ
diff --git a/macros/latex/base/ltfilehook-doc.pdf b/macros/latex/base/ltfilehook-doc.pdf
index c3d3c87cb6..bb38e6a544 100644
--- a/macros/latex/base/ltfilehook-doc.pdf
+++ b/macros/latex/base/ltfilehook-doc.pdf
Binary files differ
diff --git a/macros/latex/base/ltfinal.dtx b/macros/latex/base/ltfinal.dtx
index 7f4bef3bcc..a19ffa8305 100644
--- a/macros/latex/base/ltfinal.dtx
+++ b/macros/latex/base/ltfinal.dtx
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltfinal.dtx}
- [2022/10/26 v2.2x LaTeX Kernel (Final Settings)]
+ [2022/11/30 v2.2y LaTeX Kernel (Final Settings)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltfinal.dtx}
@@ -1151,9 +1151,7 @@
\cs_set_protected:Npn \reserved@a #1
{
\cs_generate_variant:cn { text_ \str_lowercase:n {#1} case:nn } { V }
- \cs_new_protected:cpx { Make#1case \c_space_tl \c_space_tl \c_space_tl } [##1] ##2
- { \exp_not:N \@@text@case@aux { \str_lowercase:n {#1} } {##1} {##2} }
- \ExpandArgs { cnx } \NewExpandableDocumentCommand
+ \ExpandArgs { cnx } \NewExpandableDocumentCommand
{ Make#1case }
{ O{} +m }
{ \exp_not:c { Make#1case \c_space_tl \c_space_tl \c_space_tl } [####1] {####2} }
@@ -1162,6 +1160,34 @@
\reserved@a { Lower }
\reserved@a { Title }
% \end{macrocode}
+% \changes{v2.2y}{2022/11/30}{Set \cs{oe}/\cs{OE} equal to act as a marker for \pkg{babel}}
+% 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
+% approach.
+% \begin{macrocode}
+\cs_new_protected:cpn { MakeLowercase \c_space_tl \c_space_tl \c_space_tl } [#1] #2
+ {
+ \let \kernel@saved@OE \OE
+ \let \OE \oe
+ \@@text@case@aux { lower } {#1} {#2}
+ \let \OE \kernel@saved@OE
+ }
+\cs_new_protected:cpn { MakeUppercase \c_space_tl \c_space_tl \c_space_tl } [#1] #2
+ {
+ \let \kernel@saved@oe \oe
+ \let \oe \OE
+ \@@text@case@aux { upper } {#1} {#2}
+ \let \oe \kernel@saved@oe
+ }
+\cs_new_protected:cpn { MakeTitlecase \c_space_tl \c_space_tl \c_space_tl } [#1] #2
+ {
+ \let \kernel@saved@oe \oe
+ \let \oe \OE
+ \@@text@case@aux { title } {#1} {#2}
+ \let \oe \kernel@saved@oe
+ }
+% \end{macrocode}
%
% \changes{v2.2u}{2022/06/02}{Add \cs{NoCaseChange}}
% \changes{v2.2u}{2022/06/30}{Add \cs{AddToNoCaseChangeList}}
diff --git a/macros/latex/base/lthooks-code.pdf b/macros/latex/base/lthooks-code.pdf
index aacbd95c9d..eac5817e79 100644
--- a/macros/latex/base/lthooks-code.pdf
+++ b/macros/latex/base/lthooks-code.pdf
Binary files differ
diff --git a/macros/latex/base/lthooks-doc.pdf b/macros/latex/base/lthooks-doc.pdf
index ceddafad9f..69ab35fb5a 100644
--- a/macros/latex/base/lthooks-doc.pdf
+++ b/macros/latex/base/lthooks-doc.pdf
Binary files differ
diff --git a/macros/latex/base/ltluatex.pdf b/macros/latex/base/ltluatex.pdf
index de961e8de6..f53e9a5b13 100644
--- a/macros/latex/base/ltluatex.pdf
+++ b/macros/latex/base/ltluatex.pdf
Binary files differ
diff --git a/macros/latex/base/ltmarks-code.pdf b/macros/latex/base/ltmarks-code.pdf
index 4533a3c4f1..7c88582032 100644
--- a/macros/latex/base/ltmarks-code.pdf
+++ b/macros/latex/base/ltmarks-code.pdf
Binary files differ
diff --git a/macros/latex/base/ltmarks-doc.pdf b/macros/latex/base/ltmarks-doc.pdf
index 3ce8f3780f..0aad6985bc 100644
--- a/macros/latex/base/ltmarks-doc.pdf
+++ b/macros/latex/base/ltmarks-doc.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews.pdf b/macros/latex/base/ltnews.pdf
index 1f8e4ea789..5a52a33471 100644
--- a/macros/latex/base/ltnews.pdf
+++ b/macros/latex/base/ltnews.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews01.pdf b/macros/latex/base/ltnews01.pdf
index 6e56630f2b..46f89cea3b 100644
--- a/macros/latex/base/ltnews01.pdf
+++ b/macros/latex/base/ltnews01.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews02.pdf b/macros/latex/base/ltnews02.pdf
index c3c70a8b5e..bbe1c4ebd1 100644
--- a/macros/latex/base/ltnews02.pdf
+++ b/macros/latex/base/ltnews02.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews03.pdf b/macros/latex/base/ltnews03.pdf
index 34bcb747fd..58a9a40d0b 100644
--- a/macros/latex/base/ltnews03.pdf
+++ b/macros/latex/base/ltnews03.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews04.pdf b/macros/latex/base/ltnews04.pdf
index 0846a4453e..5236b48dd8 100644
--- a/macros/latex/base/ltnews04.pdf
+++ b/macros/latex/base/ltnews04.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews05.pdf b/macros/latex/base/ltnews05.pdf
index 65cac33031..82c03a4c12 100644
--- a/macros/latex/base/ltnews05.pdf
+++ b/macros/latex/base/ltnews05.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews06.pdf b/macros/latex/base/ltnews06.pdf
index 0b21c52a0b..0b8753998e 100644
--- a/macros/latex/base/ltnews06.pdf
+++ b/macros/latex/base/ltnews06.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews07.pdf b/macros/latex/base/ltnews07.pdf
index bf73ba4b4e..b8aad35370 100644
--- a/macros/latex/base/ltnews07.pdf
+++ b/macros/latex/base/ltnews07.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews08.pdf b/macros/latex/base/ltnews08.pdf
index 5e0e023b98..c3d9b6b848 100644
--- a/macros/latex/base/ltnews08.pdf
+++ b/macros/latex/base/ltnews08.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews09.pdf b/macros/latex/base/ltnews09.pdf
index a0f5a68f40..92fb1771a0 100644
--- a/macros/latex/base/ltnews09.pdf
+++ b/macros/latex/base/ltnews09.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews10.pdf b/macros/latex/base/ltnews10.pdf
index b06683fbf6..f87a2bd4e2 100644
--- a/macros/latex/base/ltnews10.pdf
+++ b/macros/latex/base/ltnews10.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews11.pdf b/macros/latex/base/ltnews11.pdf
index fc8aedc500..8a9605348b 100644
--- a/macros/latex/base/ltnews11.pdf
+++ b/macros/latex/base/ltnews11.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews12.pdf b/macros/latex/base/ltnews12.pdf
index 0f35c8ab0a..b74dc492f6 100644
--- a/macros/latex/base/ltnews12.pdf
+++ b/macros/latex/base/ltnews12.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews13.pdf b/macros/latex/base/ltnews13.pdf
index b42e6b04aa..014faa5e5f 100644
--- a/macros/latex/base/ltnews13.pdf
+++ b/macros/latex/base/ltnews13.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews14.pdf b/macros/latex/base/ltnews14.pdf
index 8951745573..40972a5a43 100644
--- a/macros/latex/base/ltnews14.pdf
+++ b/macros/latex/base/ltnews14.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews15.pdf b/macros/latex/base/ltnews15.pdf
index 6453f789a7..3fd5dce4aa 100644
--- a/macros/latex/base/ltnews15.pdf
+++ b/macros/latex/base/ltnews15.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews16.pdf b/macros/latex/base/ltnews16.pdf
index a645558f61..5fc21f98ee 100644
--- a/macros/latex/base/ltnews16.pdf
+++ b/macros/latex/base/ltnews16.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews17.pdf b/macros/latex/base/ltnews17.pdf
index 1f745f203e..9806abea05 100644
--- a/macros/latex/base/ltnews17.pdf
+++ b/macros/latex/base/ltnews17.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews18.pdf b/macros/latex/base/ltnews18.pdf
index c3a8941a76..b3628bab08 100644
--- a/macros/latex/base/ltnews18.pdf
+++ b/macros/latex/base/ltnews18.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews19.pdf b/macros/latex/base/ltnews19.pdf
index dc7a6820ba..d6ac262c05 100644
--- a/macros/latex/base/ltnews19.pdf
+++ b/macros/latex/base/ltnews19.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews20.pdf b/macros/latex/base/ltnews20.pdf
index 417ec12536..54544a702f 100644
--- a/macros/latex/base/ltnews20.pdf
+++ b/macros/latex/base/ltnews20.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews21.pdf b/macros/latex/base/ltnews21.pdf
index 1dbfc15e11..69332e0e04 100644
--- a/macros/latex/base/ltnews21.pdf
+++ b/macros/latex/base/ltnews21.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews22.pdf b/macros/latex/base/ltnews22.pdf
index 4e70eb7c6c..429820ea50 100644
--- a/macros/latex/base/ltnews22.pdf
+++ b/macros/latex/base/ltnews22.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews23.pdf b/macros/latex/base/ltnews23.pdf
index 5316031397..86bcb55ada 100644
--- a/macros/latex/base/ltnews23.pdf
+++ b/macros/latex/base/ltnews23.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews24.pdf b/macros/latex/base/ltnews24.pdf
index f248fc3459..30ddd82eba 100644
--- a/macros/latex/base/ltnews24.pdf
+++ b/macros/latex/base/ltnews24.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews25.pdf b/macros/latex/base/ltnews25.pdf
index 2d705f9819..0e2c3fa717 100644
--- a/macros/latex/base/ltnews25.pdf
+++ b/macros/latex/base/ltnews25.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews26.pdf b/macros/latex/base/ltnews26.pdf
index a653967936..0e31e2c482 100644
--- a/macros/latex/base/ltnews26.pdf
+++ b/macros/latex/base/ltnews26.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews27.pdf b/macros/latex/base/ltnews27.pdf
index 27201797d9..260f2b6ebd 100644
--- a/macros/latex/base/ltnews27.pdf
+++ b/macros/latex/base/ltnews27.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews28.pdf b/macros/latex/base/ltnews28.pdf
index 093ed9aa3f..a20223db92 100644
--- a/macros/latex/base/ltnews28.pdf
+++ b/macros/latex/base/ltnews28.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews29.pdf b/macros/latex/base/ltnews29.pdf
index 9aa2007043..95619ddaff 100644
--- a/macros/latex/base/ltnews29.pdf
+++ b/macros/latex/base/ltnews29.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews30.pdf b/macros/latex/base/ltnews30.pdf
index f67a613556..d45d527caa 100644
--- a/macros/latex/base/ltnews30.pdf
+++ b/macros/latex/base/ltnews30.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews31.pdf b/macros/latex/base/ltnews31.pdf
index 2773922f5f..f88b776066 100644
--- a/macros/latex/base/ltnews31.pdf
+++ b/macros/latex/base/ltnews31.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews32.pdf b/macros/latex/base/ltnews32.pdf
index 7367054b65..f6298a7cfb 100644
--- a/macros/latex/base/ltnews32.pdf
+++ b/macros/latex/base/ltnews32.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews33.pdf b/macros/latex/base/ltnews33.pdf
index fc08d010c3..b5132f035e 100644
--- a/macros/latex/base/ltnews33.pdf
+++ b/macros/latex/base/ltnews33.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews34.pdf b/macros/latex/base/ltnews34.pdf
index 9a5115132b..8962193f72 100644
--- a/macros/latex/base/ltnews34.pdf
+++ b/macros/latex/base/ltnews34.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews35.pdf b/macros/latex/base/ltnews35.pdf
index b1c446c642..e044273d06 100644
--- a/macros/latex/base/ltnews35.pdf
+++ b/macros/latex/base/ltnews35.pdf
Binary files differ
diff --git a/macros/latex/base/ltnews36.pdf b/macros/latex/base/ltnews36.pdf
index 5272f171d4..fbbd2036d0 100644
--- a/macros/latex/base/ltnews36.pdf
+++ b/macros/latex/base/ltnews36.pdf
Binary files differ
diff --git a/macros/latex/base/ltpara-code.pdf b/macros/latex/base/ltpara-code.pdf
index 228405ba00..2ad8d90eab 100644
--- a/macros/latex/base/ltpara-code.pdf
+++ b/macros/latex/base/ltpara-code.pdf
Binary files differ
diff --git a/macros/latex/base/ltpara-doc.pdf b/macros/latex/base/ltpara-doc.pdf
index ff7268a831..31ac4d0714 100644
--- a/macros/latex/base/ltpara-doc.pdf
+++ b/macros/latex/base/ltpara-doc.pdf
Binary files differ
diff --git a/macros/latex/base/ltshipout-code.pdf b/macros/latex/base/ltshipout-code.pdf
index 53b30f4165..efc6444c48 100644
--- a/macros/latex/base/ltshipout-code.pdf
+++ b/macros/latex/base/ltshipout-code.pdf
Binary files differ
diff --git a/macros/latex/base/ltshipout-doc.pdf b/macros/latex/base/ltshipout-doc.pdf
index dcd312f0dd..a2d210dda0 100644
--- a/macros/latex/base/ltshipout-doc.pdf
+++ b/macros/latex/base/ltshipout-doc.pdf
Binary files differ
diff --git a/macros/latex/base/ltspace.dtx b/macros/latex/base/ltspace.dtx
index feb82730ec..30bda278fb 100644
--- a/macros/latex/base/ltspace.dtx
+++ b/macros/latex/base/ltspace.dtx
@@ -32,7 +32,7 @@
%<*driver>
% \fi
\ProvidesFile{ltspace.dtx}
- [2020/05/06 v1.3n LaTeX Kernel (spacing)]
+ [2022/11/28 v1.3o LaTeX Kernel (spacing)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltspace.dtx}
@@ -438,12 +438,13 @@
% \cs{setlength}. This way the \texttt{calc} package can operate on
% the argument value.
% \changes{v1.3m}{2020/04/21}{Support calc syntax (gh/152)}
+% \changes{v1.3o}{2022/11/28}{Support calc syntax without a group (gh/967)}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease> {\@vspace@calcify}{Add calc support}%
-\def\@vspace@calcify#1{\begingroup\setlength\skip@{#1}\vskip\skip@\endgroup}
+\def\@vspace@calcify#1{\setlength\sp@ce@skip{#1}\vskip\sp@ce@skip}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
% \end{macrocode}
@@ -1261,12 +1262,21 @@
% {(RmS) Removed superfluous \cs{leavevmode} in \cs{@hspace} and
% \cs{@hspacer}, as suggested by CAR.}
% \changes{v1.3m}{2020/04/21}{Support calc syntax (gh/152)}
+% \changes{v1.3o}{2022/11/28}{Support calc syntax correctly (gh/967)}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease> {\@hspace}{Support calc with \hspace}%
-\def\@hspace#1{\begingroup\setlength\skip@{#1}\hskip\skip@\endgroup}
+% \end{macrocode}
+% We use a private register to calculate the space (if \pkg{calc} is used). Previously
+% we used a group but that results in
+% \cs{everypar} etc.\ being executed inside the group if the \cs{hspace} starts a paragraph.
+% This is a bug fix so
+% we do not provide rollback to the incorrect intermediate version.
+% \begin{macrocode}
+\newskip\sp@ce@skip
+\def\@hspace#1{\setlength\sp@ce@skip{#1}\hskip\sp@ce@skip}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
% \end{macrocode}
diff --git a/macros/latex/base/ltvers.dtx b/macros/latex/base/ltvers.dtx
index e1282139e1..24308589f1 100644
--- a/macros/latex/base/ltvers.dtx
+++ b/macros/latex/base/ltvers.dtx
@@ -115,7 +115,7 @@
{2022-11-01}
%</2ekernel|latexrelease>
%<*2ekernel>
-\def\patch@level{0}
+\def\patch@level{1}
% \end{macrocode}
%
% \begin{macro}{\development@branch@name}
diff --git a/macros/latex/base/ltx3info.pdf b/macros/latex/base/ltx3info.pdf
index ebe0b29cbb..368f3162ad 100644
--- a/macros/latex/base/ltx3info.pdf
+++ b/macros/latex/base/ltx3info.pdf
Binary files differ
diff --git a/macros/latex/base/ltxdoc.dtx b/macros/latex/base/ltxdoc.dtx
index 46c324c590..6863349be3 100644
--- a/macros/latex/base/ltxdoc.dtx
+++ b/macros/latex/base/ltxdoc.dtx
@@ -30,7 +30,7 @@
%
%<class>\NeedsTeXFormat{LaTeX2e}
%<class>\ProvidesClass{ltxdoc}
-%<class> [2022/06/22 v2.1h Standard LaTeX documentation class]
+%<class> [2022/06/22 v2.1i Standard LaTeX documentation class]
%
%<*driver>
\documentclass{ltxdoc}
@@ -633,12 +633,15 @@ Bug reports can be opened (category \texttt{#1}) at\\%
%
% \changes{v2.1f}{2022/06/03}{define \cs{pkg} and other commands}
% \changes{v2.1f}{2022/06/03}{allow \_ in macro names}
-% Some feaures from l3doc.cls
+% Some features from l3doc.cls
% \changes{v2.1g}{2022/06/14}{define \cs{pkg} but delay until begin document}
+% \changes{v2.1i}{2022/11/28}{Revert 2.1f and not use \cs{detokenize} for now (gh/962)}
+% Eventually, \cs{cs} should get the definition from \pkg{l3doc} but for now we
+% revert to the simple one from \pkg{doc}.
% \begin{macrocode}
-\DeclareRobustCommand\cs[1]{\texttt{\bslash\detokenize{#1}}}%
+%\DeclareRobustCommand\cs[1]{\texttt{\bslash #1}}% -- def in doc.sty
\AtBeginDocument{%
- \renewcommand\PrintMacroName[1]{\MacroFont\detokenize{#1}}%
+% \renewcommand\PrintMacroName[1]{\MacroFont\string #1\ }% -- def in doc.sty
% \end{macrocode}
% We provide those delated in case somebody has loaded \texttt{csquotes}
% or makes some definitions in the preamble.
diff --git a/macros/latex/base/ltxdoc.pdf b/macros/latex/base/ltxdoc.pdf
index 972547143f..aae8871c68 100644
--- a/macros/latex/base/ltxdoc.pdf
+++ b/macros/latex/base/ltxdoc.pdf
Binary files differ
diff --git a/macros/latex/base/makeindx.pdf b/macros/latex/base/makeindx.pdf
index bfa6da1e8c..139accd18f 100644
--- a/macros/latex/base/makeindx.pdf
+++ b/macros/latex/base/makeindx.pdf
Binary files differ
diff --git a/macros/latex/base/modguide.pdf b/macros/latex/base/modguide.pdf
index 5ba6e7f6b1..f74e0c15f7 100644
--- a/macros/latex/base/modguide.pdf
+++ b/macros/latex/base/modguide.pdf
Binary files differ
diff --git a/macros/latex/base/nfssfont.pdf b/macros/latex/base/nfssfont.pdf
index 8300d6d57b..4b657e0f39 100644
--- a/macros/latex/base/nfssfont.pdf
+++ b/macros/latex/base/nfssfont.pdf
Binary files differ
diff --git a/macros/latex/base/proc.pdf b/macros/latex/base/proc.pdf
index adb946d0dc..c99e5989d7 100644
--- a/macros/latex/base/proc.pdf
+++ b/macros/latex/base/proc.pdf
Binary files differ
diff --git a/macros/latex/base/slides.pdf b/macros/latex/base/slides.pdf
index 4995bb85fa..cf5f4f9794 100644
--- a/macros/latex/base/slides.pdf
+++ b/macros/latex/base/slides.pdf
Binary files differ
diff --git a/macros/latex/base/slifonts.pdf b/macros/latex/base/slifonts.pdf
index cbfc3a4611..49fcdd0ada 100644
--- a/macros/latex/base/slifonts.pdf
+++ b/macros/latex/base/slifonts.pdf
Binary files differ
diff --git a/macros/latex/base/source2e.pdf b/macros/latex/base/source2e.pdf
index 55c125f099..b837332107 100644
--- a/macros/latex/base/source2e.pdf
+++ b/macros/latex/base/source2e.pdf
Binary files differ
diff --git a/macros/latex/base/syntonly.pdf b/macros/latex/base/syntonly.pdf
index 7a33b0979e..6c9ca64273 100644
--- a/macros/latex/base/syntonly.pdf
+++ b/macros/latex/base/syntonly.pdf
Binary files differ
diff --git a/macros/latex/base/tlc2.pdf b/macros/latex/base/tlc2.pdf
index ec25aed916..e82f587b19 100644
--- a/macros/latex/base/tlc2.pdf
+++ b/macros/latex/base/tlc2.pdf
Binary files differ
diff --git a/macros/latex/base/tulm.pdf b/macros/latex/base/tulm.pdf
index 3e8a257fce..990eba766b 100644
--- a/macros/latex/base/tulm.pdf
+++ b/macros/latex/base/tulm.pdf
Binary files differ
diff --git a/macros/latex/base/usrguide-historic.pdf b/macros/latex/base/usrguide-historic.pdf
index b7dae16ef3..ba663260c9 100644
--- a/macros/latex/base/usrguide-historic.pdf
+++ b/macros/latex/base/usrguide-historic.pdf
Binary files differ
diff --git a/macros/latex/base/usrguide.pdf b/macros/latex/base/usrguide.pdf
index ae46e5ba7b..3bcdae3035 100644
--- a/macros/latex/base/usrguide.pdf
+++ b/macros/latex/base/usrguide.pdf
Binary files differ
diff --git a/macros/latex/base/utf8ienc.pdf b/macros/latex/base/utf8ienc.pdf
index 1beff8335b..5ada2a0c2f 100644
--- a/macros/latex/base/utf8ienc.pdf
+++ b/macros/latex/base/utf8ienc.pdf
Binary files differ
diff --git a/macros/latex/base/webcomp.pdf b/macros/latex/base/webcomp.pdf
index c7998b003b..18aaaf71db 100644
--- a/macros/latex/base/webcomp.pdf
+++ b/macros/latex/base/webcomp.pdf
Binary files differ
diff --git a/macros/latex/contrib/fvextra/fvextra.dtx b/macros/latex/contrib/fvextra/fvextra.dtx
index 22b6b02720..612c885839 100644
--- a/macros/latex/contrib/fvextra/fvextra.dtx
+++ b/macros/latex/contrib/fvextra/fvextra.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2016-2019 by Geoffrey M. Poore <gpoore@gmail.com>
+% Copyright (C) 2016-2022 by Geoffrey M. Poore <gpoore@gmail.com>
% ---------------------------------------------------------------------------
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -26,7 +26,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{fvextra}
%<*package>
- [2019/02/04 v1.4 fvextra - extensions and patches for fancyvrb]
+ [2022/11/30 v1.5 fvextra - extensions and patches for fancyvrb]
%</package>
%
%<*driver>
@@ -230,7 +230,7 @@
%</driver>
% \fi
%
-% \CheckSum{4882}
+% \CheckSum{5254}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -249,6 +249,19 @@
% Right brace \} Tilde \~}
%
%
+% \begin{changelog}{v1.5}{2022/11/30}
+% \item Added \cmd{\FancyVerbFormatInline} for customizing the formatting of inline verbatim, such as \cmd{\Verb}. This parallels \cmd{\FancyVerbFormatLine} and \cmd{\FancyVerbFormatText}.
+% \item Added line breaking option \Verb{breaknonspaceingroup}. When \cmd{commandchars} is used to allow macros within verbatim, this inserts breaks within groups \Verb{{...}}.
+% \item Added \cmd{\FVExtraUnexpandedReadStarOArgMArgBVArg} to support reimplementation of \cmd{\mintinline} for \pkg{minted}.
+% \item Added \cmd{VerbEnv} environment, which is an environment variant of \cmd{\Verb}. This supports reimplementation of \cmd{\mintinline} for \pkg{minted}.
+% \item \cmd{breakbefore} and \cmd{breakafter} now support the escaped comma \cmd{\,} (\#15).
+% \item Fixed unintended line breaks after hyphens under LuaTeX (\#14).
+% \item Added documentation on Pandoc compatibility (\#11).
+% \item Replaced \Verb{breakbeforegroup} with \Verb{breakbeforeinrun}, and replaced \Verb{breakaftergroup} with \Verb{breakafterinrun}. With the introduction of \Verb{breaknonspaceingroup}, ``\Verb{group}'' is now reserved for referring to TeX groups \Verb{{...}}.
+% \item Removed dependency on \Verb{ifthen} package.
+% \item \Verb{breakautoindent} now works correctly with Pygments output that treats leading whitespace as a separate token or as part of a token.
+% \end{changelog}
+%
% \begin{changelog}{v1.4}{2019/02/04}
% \item Reimplemented \texttt{\string\Verb}. It now works as expected inside other commands (with a few limitations), including in movable arguments, and is compatible with \texttt{hyperref} for things like PDF bookmarks. It now supports \texttt{breaklines} and relevant line-breaking options.
% \item Reimplemented \texttt{\string\SaveVerb} and \texttt{\string\UseVerb} to be equivalent to the new \texttt{\string\Verb}. The new option \texttt{retokenize} allows saved verbatim material to be retokenized under new \texttt{commandchars} and \texttt{codes} when it is inserted with \texttt{\string\UseVerb}.
@@ -353,11 +366,39 @@
%
% \fvextra\ may be used as a drop-in replacement for \fancyvrb. It will load \fancyvrb\ if it has not yet been loaded, and then proceeds to patch \fancyvrb\ and define additional features.
%
-% The \pkg{upquote} package is loaded to give correct backticks (\texttt{\textasciigrave}) and typewriter single quotation marks (\texttt{\textquotesingle}). When this is not desirable within a given environment, use the option |curlyquotes|. \fvextra\ modifies the behavior of these and other symbols in typeset math within verbatim, so that they will behave as expected (\cref{sec:patch:math}). \fvextra\ uses the \pkg{lineno} package for working with automatic line breaks. \pkg{lineno} gives a warning when the \pkg{csquotes} package is loaded before it, so \fvextra\ should be loaded before \pkg{csquotes}. The \pkg{ifthen} and \pkg{etoolbox} packages are required. \pkg{color} or \pkg{xcolor} should be loaded manually to use color-dependent features.
+% The \pkg{upquote} package is loaded to give correct backticks (\texttt{\textasciigrave}) and typewriter single quotation marks (\texttt{\textquotesingle}). When this is not desirable within a given environment, use the option |curlyquotes|. \fvextra\ modifies the behavior of these and other symbols in typeset math within verbatim, so that they will behave as expected (\cref{sec:patch:math}). \fvextra\ uses the \pkg{lineno} package for working with automatic line breaks. \pkg{lineno} gives a warning when the \pkg{csquotes} package is loaded before it, so \fvextra\ should be loaded before \pkg{csquotes}. The \pkg{etoolbox} package is required. \pkg{color} or \pkg{xcolor} should be loaded manually to use color-dependent features.
%
% While \fvextra\ attempts to minimize changes to the \fancyvrb\ internals, in some cases it completely overwrites \fancyvrb\ macros with new definitions. New definitions typically follow the original definitions as much as possible, but code that depends on the details of the original \fancyvrb\ implementation may be incompatible with \fvextra.
%
%
+% \subsection{Pandoc compatibility}
+%
+% \pkg{fvextra} supports line breaking in \href{https://pandoc.org/}{Pandoc} \LaTeX\ output that includes highlighted source code. Enabling basic line breaking at spaces is as simple as adding |\usepackage{fvextra}| and |\fvset{breaklines}| to the Pandoc Markdown |header-includes|.
+%
+% By default, more advanced line breaking features such as |breakanywhere|, |breakbefore|, and |breakafter| will not work with Pandoc highlighted output, due to the presence of the syntax highlighting macros. This can be fixed by using |breaknonspaceingroup|, which enables all line breaking features within macros. For example, the following YAML metadata in a Markdown document would redefine the Pandoc |Highlighting| environment to enable line breaking anywhere.
+%
+%\vspace{2ex}
+%\hrule
+%\vspace{2ex}
+%\noindent\begin{minipage}{\linewidth}
+%\begin{Verbatim}[gobble=1]
+%---
+%header-includes:
+% - |
+% ```{=latex}
+% \usepackage{fvextra}
+% \DefineVerbatimEnvironment{Highlighting}{Verbatim}{
+% commandchars=\\\{\},
+% breaklines, breaknonspaceingroup, breakanywhere}
+% ```
+%---
+%\end{Verbatim}
+%\end{minipage}
+%\vspace{2ex}
+%\hrule
+%\vspace{2ex}
+%
+%
%
%
% \section{General options}
@@ -571,7 +612,7 @@
%
% \section{General commands}
%
-% \subsection{Inline formatting with \cmd{\fvinlineset}}
+% \subsection{Inline-only settings with \cmd{\fvinlineset}}
% \DescribeMacro{\fvinlineset\marg{options}}
%
% This is like \cmd{\fvset}, except that options only apply to commands that typeset inline verbatim, like \cmd{\Verb} and \cmd{\EscVerb}. Settings from \cmd{\fvinlineset} override those from \cmd{\fvset}.
@@ -579,12 +620,21 @@
% Note that \cmd{\fvinlineset} only works with commands that are reimplemented, patched, or defined by \fvextra; it is not compatible with the original \fancyvrb\ definitions.
%
%
-% \subsection{Line and text formatting}
+% \subsection{Custom formatting for inline commands like \cmd{\Verb} with \cmd{\FancyVerbFormatInline}}
+%
+% \DescribeMacro{\FancyVerbFormatInline}
+%
+% This can be used to apply custom formatting to inline verbatim text created with commands like \cmd{\Verb}. It only works with commands that are reimplemented, patched, or defined by \fvextra; it is not compatible with the original \fancyvrb\ definitions. The default definition does nothing; it is equivalent to |\newcommand{\FancyVerbFormatInline}[1]{#1}|.
+%
+% This is the inline equivalent of \cmd{\FancyVerbFormatLine} and \cmd{\FancyVerbFormatText}. In the inline context, there is no need to distinguish between entire line formatting and only text formatting, so only \cmd{\FancyVerbFormatInline} exists.
+%
+%
+% \subsection{Custom formatting for environments like \cmd{Verbatim} with \cmd{\FancyVerbFormatLine} and \cmd{\FancyVerbFormatText}}
%
% \DescribeMacro{\FancyVerbFormatLine}
% \DescribeMacro{\FancyVerbFormatText}
%
-% \fancyvrb\ defines |\FancyVerbFormatLine|, which can be used to apply custom formatting to each individual line of text. By default, it takes a line as an argument and inserts it with no modification. This is equivalent to |\newcommand{\FancyVerbFormatLine}[1]{#1}|.\footnote{The actual definition in \fancyvrb\ is |\def\FancyVerbFormatLine#1{\FV@ObeyTabs{#1}}|. This is problematic because redefining the macro could easily eliminate |\FV@ObeyTabs|, which governs tab expansion. \fvextra\ redefines the macro to |\def\FancyVerbFormatLine#1{#1}| and patches all parts of \fancyvrb\ that use |\FancyVerbFormatLine| so that |\FV@ObeyTabs| is explicitly inserted at the appropriate points.}
+% \fancyvrb\ defines |\FancyVerbFormatLine|, which can be used to apply custom formatting to each individual line of text in environments like \cmd{Verbatim}. By default, it takes a line as an argument and inserts it with no modification. This is equivalent to |\newcommand{\FancyVerbFormatLine}[1]{#1}|.\footnote{The actual definition in \fancyvrb\ is |\def\FancyVerbFormatLine#1{\FV@ObeyTabs{#1}}|. This is problematic because redefining the macro could easily eliminate |\FV@ObeyTabs|, which governs tab expansion. \fvextra\ redefines the macro to |\def\FancyVerbFormatLine#1{#1}| and patches all parts of \fancyvrb\ that use |\FancyVerbFormatLine| so that |\FV@ObeyTabs| is explicitly inserted at the appropriate points.}
%
% \fvextra\ introduces line breaking, which complicates line formatting. We might want to apply formatting to the entire line, including line breaks, line continuation symbols, and all indentation, including any extra indentation provided by line breaking. Or we might want to apply formatting only to the actual text of the line. \fvextra\ leaves |\FancyVerbFormatLine| as applying to the entire line, and introduces a new command |\FancyVerbFormatText| that only applies to the text part of the line.\footnote{When |breaklines=true|, each line is wrapped in a |\parbox|. |\FancyVerbFormatLine| is outside the |\parbox|, and |\FancyVerbFormatText| is inside.} By default, |\FancyVerbFormatText| inserts the text unmodified. When it is customized, it should not use boxes that do not allow line breaks to avoid conflicts with line breaking code.
%
@@ -637,7 +687,7 @@
%
% \subsection{\cmd{\SaveVerb}}
%
-% \DescribeMacro{\SaveVerb*\oarg{options}\marg{name}\meta{delim~char~or~\{}\meta{text}\meta{delim~char~or~\}}}
+% \DescribeMacro{\SaveVerb\oarg{options}\marg{name}\meta{delim~char~or~\{}\meta{text}\meta{delim~char~or~\}}}
%
% \cmd{\SaveVerb} is reimplemented so that it is equivalent to the reimplemented \cmd{\Verb}. Like the new \cmd{\Verb}, it accepts \meta{text} delimited by a pair of curly braces |{...}|. It supports \cmd{\fvinlineset}. It also adds support for the new |retokenize| option for \cmd{\UseVerb}.
%
@@ -688,8 +738,19 @@
% \end{description}
%
%
+% \subsection{\cmd{VerbEnv}}
+% \DescribeMacro{\begin\{VerbEnv\}\oarg{options}\\$\langle$\textit{single line}$\rangle$\\\cmd{\end{VerbEnv}}}
%
+% This is an environment variant of \cmd{\Verb}. The environment must contain only a single line of text, and the closing \cmd{\end{VerbEnv}} must be on a line by itself. The $\langle$\textit{options}$\rangle$ and $\langle$\textit{single line}$\rangle$ are read and then passed on to \cmd{\Verb} internally for actual typesetting.
%
+% While \cmd{VerbEnv} can be used by document authors, it is primarily intended for package creators. For example, it is used in \pkg{minted} to implement \cmd{\mintinline}. In that case, highlighted code is always generated within a \cmd{Verbatim} environment. It is possible to process this as inline rather than block verbatim by \cmd{\let}ting \cmd{\Verbatim} to \cmd{\VerbEnv}.
+%
+% \begin{example}
+% BEFORE\begin{VerbEnv}
+% _inline_
+% \end{VerbEnv}
+% AFTER
+% \end{example}
%
%
% \section{Line breaking}
@@ -697,6 +758,8 @@
%
% Automatic line breaking may be turned on with |breaklines=true|. By default, breaks only occur at spaces. Breaks may be allowed anywhere with |breakanywhere|, or only before or after specified characters with |breakbefore| and |breakafter|. Many options are provided for customizing breaks. A good place to start is the description of |breaklines|.
%
+% When a line is broken, the result must fit on a single page. There is no support for breaking a line across multiple pages.
+%
%
% \subsection{Line breaking options}
%
@@ -705,9 +768,9 @@
% \begin{optionlist}
%
% \item[breakafter (string) (\meta{none})]
-% Break lines after specified characters, not just at spaces, when |breaklines=true|. For example, |breakafter=-/| would allow breaks after any hyphens or slashes. Special characters given to |breakafter| should be backslash-escaped (usually |#|, |{|, |}|, |%|, |[|, |]|; the backslash |\| may be obtained via |\\| and the space via |\space|).\footnote{|breakafter| expands each token it is given once, so when it is given a macro like |\%|, the macro should expand to a literal character that will appear in the text to be typeset. \fvextra\ defines special character escapes that are activated for |breakafter| so that this will work with common escapes. The only exception to token expansion is non-ASCII characters under pdfTeX; these should appear literally. |breakafter| is not catcode-sensitive.}
+% Break lines after specified characters, not just at spaces, when |breaklines=true|. For example, |breakafter=-/| would allow breaks after any hyphens or slashes. Special characters given to |breakafter| should be backslash-escaped (usually |#|, |{|, |}|, |%|, |[|, |]|, and the comma |,|; the backslash |\| may be obtained via |\\| and the space via |\space|).\footnote{|breakafter| expands each token it is given once, so when it is given a macro like |\%|, the macro should expand to a literal character that will appear in the text to be typeset. \fvextra\ defines special character escapes that are activated for |breakafter| so that this will work with common escapes. The only exception to token expansion is non-ASCII characters under pdfTeX; these should appear literally. |breakafter| is not catcode-sensitive.}
%
-% For an alternative, see |breakbefore|. When |breakbefore| and |breakafter| are used for the same character, |breakbeforegroup| and |breakaftergroup| must both have the same setting.
+% For an alternative, see |breakbefore|. When |breakbefore| and |breakafter| are used for the same character, |breakbeforeinrun| and |breakafterinrun| must both have the same setting.
%
% Note that when |commandchars| or |codes| are used to include macros within verbatim content, breaks will not occur within mandatory macro arguments by default. Depending on settings, macros that take optional arguments may not work unless the entire macro including arguments is wrapped in a group (curly braces |{}|, or other characters specified with |commandchars|). See \cref{sec:breaklines:advanced} for details.
%
@@ -718,8 +781,8 @@
% \end{longexample}
%
%
-% \item[breakaftergroup (boolean) (true)]
-% When |breakafter| is used, group all adjacent identical characters together, and only allow a break after the last character. When |breakbefore| and |breakafter| are used for the same character, |breakbeforegroup| and |breakaftergroup| must both have the same setting.
+% \item[breakafterinrun (boolean) (false)]
+% When |breakafter| is used, insert breaks within runs of identical characters. If |false|, treat sequences of identical characters as a unit that cannot contain breaks. When |breakbefore| and |breakafter| are used for the same character, |breakbeforeinrun| and |breakafterinrun| must both have the same setting.
%
%
% \item[breakaftersymbolpre (string) (\string\,\string\footnotesize\string\ensuremath\{\_\string\rfloor\}, \,\footnotesize\ensuremath{_\rfloor})]
@@ -755,9 +818,9 @@
%
%
% \item[breakbefore (string) (\meta{none})]
-% Break lines before specified characters, not just at spaces, when |breaklines=true|. For example, |breakbefore=A| would allow breaks before capital A's. Special characters given to |breakbefore| should be backslash-escaped (usually |#|, |{|, |}|, |%|, |[|, |]|; the backslash |\| may be obtained via |\\| and the space via |\space|).\footnote{|breakbefore| expands each token it is given once, so when it is given a macro like |\%|, the macro should expand to a literal character that will appear in the text to be typeset. \fvextra\ defines special character escapes that are activated for |breakbefore| so that this will work with common escapes. The only exception to token expansion is non-ASCII characters under pdfTeX; these should appear literally. |breakbefore| is not catcode-sensitive.}
+% Break lines before specified characters, not just at spaces, when |breaklines=true|. For example, |breakbefore=A| would allow breaks before capital A's. Special characters given to |breakbefore| should be backslash-escaped (usually |#|, |{|, |}|, |%|, |[|, |]|, and the comma |,|; the backslash |\| may be obtained via |\\| and the space via |\space|).\footnote{|breakbefore| expands each token it is given once, so when it is given a macro like |\%|, the macro should expand to a literal character that will appear in the text to be typeset. \fvextra\ defines special character escapes that are activated for |breakbefore| so that this will work with common escapes. The only exception to token expansion is non-ASCII characters under pdfTeX; these should appear literally. |breakbefore| is not catcode-sensitive.}
%
-% For an alternative, see |breakafter|. When |breakbefore| and |breakafter| are used for the same character, |breakbeforegroup| and |breakaftergroup| must both have the same setting.
+% For an alternative, see |breakafter|. When |breakbefore| and |breakafter| are used for the same character, |breakbeforeinrun| and |breakafterinrun| must both have the same setting.
%
% Note that when |commandchars| or |codes| are used to include macros within verbatim content, breaks will not occur within mandatory macro arguments by default. Depending on settings, macros that take optional arguments may not work unless the entire macro including arguments is wrapped in a group (curly braces |{}|, or other characters specified with |commandchars|). See \cref{sec:breaklines:advanced} for details.
%
@@ -768,8 +831,8 @@
% \end{longexample}
%
%
-% \item[breakbeforegroup (boolean) (true)]
-% When |breakbefore| is used, group all adjacent identical characters together, and only allow a break before the first character. When |breakbefore| and |breakafter| are used for the same character, |breakbeforegroup| and |breakaftergroup| must both have the same setting.
+% \item[breakbeforeinrun (boolean) (false)]
+% When |breakbefore| is used, insert breaks within runs of identical characters. If |false|, treat sequences of identical characters as a unit that cannot contain breaks. When |breakbefore| and |breakafter| are used for the same character, |breakbeforeinrun| and |breakafterinrun| must both have the same setting.
%
%
% \item[breakbeforesymbolpre (string) (\string\,\string\footnotesize\string\ensuremath\{\_\string\rfloor\}, \,\footnotesize\ensuremath{_\rfloor})]
@@ -788,7 +851,7 @@
%
%
% \item[breaklines (boolean) (false)]
-% Automatically break long lines.
+% Automatically break long lines. When a line is broken, the result must fit on a single page. There is no support for breaking a line across multiple pages.\footnote{Following the implementation in \pkg{fancyvrb}, each line is typeset within an |\hbox|, so page breaks are not possible.}
%
% By default, automatic breaks occur at spaces. Use |breakanywhere| to enable breaking anywhere; use |breakbefore| and |breakafter| for more fine-tuned breaking.
%
@@ -831,6 +894,12 @@
% \end{longexample}
%
%
+% \item[breaknonspaceingroup (boolean) (false)]
+% By using |commandchars|, it is possible to include \LaTeX\ commands within otherwise verbatim text. In these cases, there can be groups (typically |{...}| but depends on |commandchars|) within verbatim. Spaces within groups are treated as potential line break locations when |breaklines=true|, but by default no other break locations are inserted (|breakbefore|, |breakafter|, |breakanywhere|). This is because inserting non-space break locations can interfere with command functionality. For example, in |\textcolor{red}{text}|, breaks shouldn't be inserted within |red|.
+%
+% |breaknonspaceingroup| allows non-space breaks to be inserted within groups. This option should only be used when |commandchars| is including \LaTeX\ commands that do not take optional arguments and only take mandatory arguments that are typeset. Something like |\textit{text}| is fine, but |\textcolor{red}{text}| is not because one of the mandatory arguments is not typeset but rather provides a setting. For more complex commands, it is typically better to redefine them to insert breaks in appropriate locations using |\FancyVerbBreakStart...\FancyVerbBreakStop|.
+%
+%
% \item[breaksymbol (string) (breaksymbolleft)]
% Alias for |breaksymbolleft|.
%
@@ -1255,7 +1324,6 @@
% \subsection{Required packages}
% The \pkg{upquote} package performs some font checks when it is loaded to determine whether \pkg{textcomp} is needed, but errors can result if the font is changed later in the preamble, so duplicate the package's font check at the end of the preamble. Also check for a package order issue with \pkg{lineno} and \pkg{csquotes}.
% \begin{macrocode}
-\RequirePackage{ifthen}
\RequirePackage{etoolbox}
\RequirePackage{fancyvrb}
\RequirePackage{upquote}
@@ -1547,6 +1615,25 @@
%
% \subsubsection{Tokenization and lookahead}
%
+%
+% \begin{macro}{\FVExtra@ifnextcharAny}
+% A version of |\@ifnextchar| that can detect any character, including catcode 10 spaces. This is an exact copy of the definition from |latex.ltx|, modified with the ``|\let\reserved@d= #1%|'' (note space!) trick from \pkg{amsgen}.
+% \begin{macrocode}
+\long\def\FVExtra@ifnextcharAny#1#2#3{%
+ \let\reserved@d= #1%
+ \def\reserved@a{#2}%
+ \def\reserved@b{#3}%
+ \futurelet\@let@token\FVExtra@ifnchAny}
+\def\FVExtra@ifnchAny{%
+ \ifx\@let@token\reserved@d
+ \expandafter\reserved@a
+ \else
+ \expandafter\reserved@b
+ \fi}
+% \end{macrocode}
+% \end{macro}
+
+%
% \begin{macro}{\FVExtra@ifnextcharVArg}
% This is a wrapper for \cmd{\@ifnextchar} from |latex.ltx| (|ltdefns.dtx|) that tokenizes lookaheads under a mostly verbatim catcode regime rather than the current catcode regime. This is important when looking ahead for stars |*| and optional argument delimiters~|[|, because if these are not present when looking ahead for a verbatim argument, then the first thing tokenized will be the verbatim argument's delimiting character. Ideally, the delimiter should be tokenized under a verbatim catcode regime. This is necessary for instance if the delimiter is \cmd{\active} and \cmd{\outer}.
%
@@ -1597,19 +1684,9 @@
%
%
% \begin{macro}{\FVExtraReadOArgBeforeVEnv}
-% Read an optional argument that comes before the contents of a verbatim environment, after the |\begin{|\meta{environment}|}| but before the start of the next line where the verbatim content begins. Note that this is not needed when an environment takes a mandatory argument that follows the optional argument.
+% Read an optional argument at the start of a verbatim environment, after the |\begin{|\meta{environment}|}| but before the start of the next line where the verbatim content begins. Check for extraneous content after the optional argument and discard the following newline. Note that this is not needed when an environment takes a mandatory argument that follows the optional argument.
%
-% The case with only an optional argument is tricky because the default behavior of \cmd{\@ifnextchar} is to read into the next line looking for the optional argument. Setting |^^M| \cmd{\active} prevents this. That does mean, though, that the end-of-line token will have to be read and removed later as an \cmd{\active} |^^M|. See the definition of \cmd{\FV@BeginScanning} in \fancyvrb\ for an example of doing this:
-% \begin{quote}
-%\begin{verbatim}
-%\begingroup
-%\catcode`\^^M=\active
-% \gdef\FV@BeginScanning#1^^M{%
-% \def\@tempa{#1}\ifx\@tempa\@empty\else\FV@BadBeginError\fi%
-% \FV@GetLine}%
-%\endgroup
-%\end{verbatim}
-% \end{quote}
+% The case with only an optional argument is tricky because the default behavior of \cmd{\@ifnextchar} is to read into the next line looking for the optional argument. Setting |^^M| as \cmd{\active} prevents this. That does mean, though, that the end-of-line token will have to be read and removed later as an \cmd{\active} |^^M|.
%
% \cmd{\@ifnextchar} is used instead of \cmd{\FVExtra@ifnextcharVArg} because the latter is not needed since there is an explicit, required delimiter (|^^M|) before the actual start of verbatim content. Lookahead can never tokenize verbatim content under an incorrect catcode regime.
% \begin{macrocode}
@@ -1617,8 +1694,26 @@
\begingroup
\catcode`\^^M=\active
\@ifnextchar[%
- {\endgroup\FV@ReadOArgContinue{#2}}%
- {\endgroup\FV@ReadOArgContinue{#2}[#1]}}
+ {\endgroup\FVExtraReadOArgBeforeVEnv@i{#2}}%
+ {\endgroup\FVExtraReadOArgBeforeVEnv@i{#2}[#1]}}
+\def\FVExtraReadOArgBeforeVEnv@i#1[#2]{%
+ \begingroup
+ \catcode`\^^M=\active
+ \FVExtraReadOArgBeforeVEnv@ii{#1}{#2}}
+\begingroup
+\catcode`\^^M=\active%
+\gdef\FVExtraReadOArgBeforeVEnv@ii#1#2#3^^M{%
+ \endgroup%
+ \FVExtraReadOArgBeforeVEnv@iii{#1}{#2}{#3}}%
+\endgroup%
+\def\FVExtraReadOArgBeforeVEnv@iii#1#2#3{%
+ \if\relax\detokenize{#3}\relax
+ \else
+ \PackageError{fvextra}%
+ {Discarded invalid text while checking for optional argument of verbatim environment}%
+ {Discarded invalid text while checking for optional argument of verbatim environment}%
+ \fi
+ #1{#2}}
% \end{macrocode}
% \end{macro}
%
@@ -1906,6 +2001,22 @@
% \end{macro}
%
%
+% \begin{macro}{\FVExtraUnexpandedReadStarOArgMArgBVArg}
+% Read arguments for a command that has a mandatory argument before a verbatim argument, such as \pkg{minted}'s \cmd{\mintinline}.
+% \begin{macrocode}
+\def\FVExtraUnexpandedReadStarOArgMArgBVArg#1#{%
+ \FV@UnexpandedReadStarOArgMArgBVArg@i{#1}}
+\def\FV@UnexpandedReadStarOArgMArgBVArg@i#1#2#3{%
+ \FVExtraAlwaysUnexpanded{\FVExtraUnexpandedReadStarOArgMArgBVArg#1{#2}{#3}}}
+\FVExtrapdfstringdefDisableCommands{%
+ \makeatletter
+ \def\FV@UnexpandedReadStarOArgMArgBVArg@i#1#2#3{%
+ \FVExtraPDFStringVerbatimDetokenize{#3}}%
+ \makeatother}
+% \end{macrocode}
+% \end{macro}
+%
+%
%
%
% \subsubsection{Converting detokenized tokens into PDF strings}
@@ -3063,9 +3174,11 @@
\edef\FV@dollarchar{\string$}
\edef\FV@ampchar{\string&}
\edef\FV@underscorechar{\string_}
+\edef\FV@caretchar{\string^}
\edef\FV@tildechar{\string~}
\edef\FV@leftsquarebracket{\string[}
\edef\FV@rightsquarebracket{\string]}
+\edef\FV@commachar{\string,}
\newcommand{\FV@EscChars}{%
\let\#\FV@hashchar
\let\%\@percentchar
@@ -3074,11 +3187,13 @@
\let\$\FV@dollarchar
\let\&\FV@ampchar
\let\_\FV@underscorechar
+ \let\^\FV@caretchar
\let\\\@backslashchar
\let~\FV@tildechar
\let\~\FV@tildechar
\let\[\FV@leftsquarebracket
\let\]\FV@rightsquarebracket
+ \let\,\FV@commachar
} %$ <- highlighting
% \end{macrocode}
% \end{macro}
@@ -3136,6 +3251,15 @@
% \end{macro}
%
%
+% \subsubsection{\cmd{\FancyVerbFormatInline}}
+% This allows customization of inline verbatim material. It is the inline equivalent of \cmd{\FancyVerbFormatLine} and \cmd{\FancyVerbFormatText}.
+% \begin{macro}{\FancyVerbFormatInline}
+% \begin{macrocode}
+\def\FancyVerbFormatInline#1{#1}
+% \end{macrocode}
+% \end{macro}
+%
+%
% \subsubsection{\texttt{\textbackslash Verb}}
%
% \cmd{\Verb} is reimplemented so that it functions as well as possible when used within other commands.
@@ -3212,12 +3336,12 @@
% \begin{macro}{\FVC@Verb@Extra@ii}
% \begin{macrocode}
\def\FVC@Verb@Extra@ii#1{%
- \ifFV@BreakLines
+ \ifFV@breaklines
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
- {\FancyVerbBreakStart#1\FancyVerbBreakStop}%
+ {\FV@InsertBreaks{\FancyVerbFormatInline}{#1}}%
{\mbox{#1}}%
\endgroup}
% \end{macrocode}
@@ -3362,12 +3486,12 @@
% \begin{macro}{\FV@UseVerb@Extra}
% \begin{macrocode}
\def\FV@UseVerb@Extra#1{%
- \ifFV@BreakLines
+ \ifFV@breaklines
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
- {\FancyVerbBreakStart#1\FancyVerbBreakStop}%
+ {\FV@InsertBreaks{\FancyVerbFormatInline}{#1}}%
{\mbox{#1}}%
\endgroup}
% \end{macrocode}
@@ -3425,18 +3549,127 @@
% \begin{macro}{\FVC@EscVerb@ii}
% \begin{macrocode}
\def\FVC@EscVerb@ii#1{%
- \ifFV@BreakLines
+ \ifFV@breaklines
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
- {\FancyVerbBreakStart#1\FancyVerbBreakStop}%
+ {\FV@InsertBreaks{\FancyVerbFormatInline}{#1}}%
{\mbox{#1}}%
\endgroup}
% \end{macrocode}
% \end{macro}
%
%
+% \subsubsection{\cmd{VerbEnv}}
+% Environment variant of \cmd{\Verb}. Depending on how this is used in the future, it may be worth improving error message and error recovery functionality, using techniques from \pkg{fancyvrb}.
+% \begin{macro}{\VerbEnv}
+% \begin{macrocode}
+\def\VerbEnv{%
+ \ifcsname @currenvir\endcsname
+ \ifx\@currenvir\@empty
+ \PackageError{fvextra}{VerbEnv is an environment}{VerbEnv is an environment}%
+ \else
+ \ifx\@currenvir\relax
+ \PackageError{fvextra}{VerbEnv is an environment}{VerbEnv is an environment}%
+ \fi
+ \fi
+ \else
+ \PackageError{fvextra}{VerbEnv is an environment}{VerbEnv is an environment}%
+ \fi
+ \VerbatimEnvironment
+ \FVExtraReadOArgBeforeVEnv{\expandafter\VerbEnv@i\expandafter{\FV@EnvironName}}}
+\def\VerbEnv@i#1#2{%
+ \begingroup
+ \let\do\@makeother\FVExtraDoSpecials
+ \catcode`\ =\active
+ \catcode`\^^I=\active
+ \catcode`\^^M=\active
+ \VerbEnv@ii{#1}{#2}}
+\begingroup
+\catcode`\!=0
+\catcode`\<=1
+\catcode`\>=2
+!catcode`!\=12
+!catcode`!{=12
+!catcode`!}=12
+!catcode`!^^M=!active%
+!gdef!VerbEnv@ii#1#2#3^^M<%
+ !endgroup%
+ !def!VerbEnv@CheckLine##1\end{#1}##2!FV@Sentinel<%
+ !if!relax!detokenize<##2>!relax%
+ !else%
+ !PackageError<fvextra><Missing environment contents><Missing environment contents>%
+ !let!VerbEnv@iii!VerbEnv@iii@Error%
+ !fi>%
+ !VerbEnv@CheckLine#3\end{#1}!FV@Sentinel%
+ !VerbEnv@iii<#1><#2><#3>>%
+!endgroup%
+\def\VerbEnv@iii@Error#1#2#3{}
+\def\VerbEnv@iii#1#2#3{%
+ \begingroup
+ \let\do\@makeother\FVExtraDoSpecials
+ \catcode`\ =10\relax
+ \catcode`\^^M=\active
+ \VerbEnv@iv{#1}{#2}{#3}}
+\begingroup
+\catcode`\!=0
+\catcode`\<=1
+\catcode`\>=2
+!catcode`!\=12
+!catcode`!{=12
+!catcode`!}=12
+!catcode`!^^M=!active%
+!gdef!VerbEnv@iv#1#2#3#4^^M<%
+ !endgroup%
+ !def!VerbEnv@CheckEndDelim##1\end{#1}##2!FV@Sentinel<%
+ !if!relax!detokenize<##2>!relax%
+ !PackageError<fvextra><Missing end for environment !FV@EnvironName><Add environment end>%
+ !let!VerbEnv@v!VerbEnv@v@Error%
+ !else%
+ !VerbEnv@CheckEndLeading##1!FV@Sentinel%
+ !VerbEnv@CheckEndTrailing##2!FV@Sentinel%
+ !fi>%
+ !def!VerbEnv@CheckEndTrailing##1\end{#1}!FV@Sentinel<%
+ !if!relax!detokenize<##1>!relax%
+ !else%
+ !PackageError<fvextra>%
+ <Discarded text after end of environment !FV@EnvironName>%
+ <Discarded text after end of environment !FV@EnvironName>%
+ !let!VerbEnv@v!VerbEnv@v@Error%
+ !fi>%
+ !VerbEnv@CheckEndDelim#4\end{#1}!FV@Sentinel%
+ !VerbEnv@v<#2><#3>>%
+!endgroup
+\def\VerbEnv@CheckEndLeading{%
+ \FVExtra@ifnextcharAny\@sptoken%
+ {\VerbEnv@CheckEndLeading@Continue}%
+ {\ifx\@let@token\FV@Sentinel
+ \expandafter\VerbEnv@CheckEndLeading@End
+ \else
+ \expandafter\VerbEnv@CheckEndLeading@EndError
+ \fi}}
+\def\VerbEnv@CheckEndLeading@Continue#1{%
+ \VerbEnv@CheckEndLeading}
+\def\VerbEnv@CheckEndLeading@End#1\FV@Sentinel{}
+\def\VerbEnv@CheckEndLeading@EndError{%
+ \PackageError{fvextra}%
+ {Discarded text before end of environment \FV@EnvironName}%
+ {Discarded text before end of environment \FV@EnvironName}%
+ \let\VerbEnv@v\VerbEnv@v@Error}
+\def\VerbEnv@v@Error#1#2{}
+\def\VerbEnv@v#1#2{%
+ \Verb[#1]{#2}%
+ \expandafter\end\expandafter{\FV@EnvironName}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\endVerbEnv}
+% \begin{macrocode}
+\def\endVerbEnv{\global\let\FV@EnvironName\relax}
+% \end{macrocode}
+% \end{macro}
+%
+%
%
%
% \subsection{Patches}
@@ -3608,7 +3841,7 @@
% \begin{macro}{FV@ObeyTabs@Whitespace@Tab}
% In a group where runs of whitespace characters are collected, we need to keep track of whether a tab has been found, so we can avoid expansion and the associated |\hbox| for spaces without tabs.
% \begin{macrocode}
-\newboolean{FV@ObeyTabs@Whitespace@Tab}
+\newbool{FV@ObeyTabs@Whitespace@Tab}
% \end{macrocode}
% \end{macro}
%
@@ -4470,26 +4703,43 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{FV@BreakLines}
+% \begin{macro}{FV@breaklines}
% Turn line breaking on or off. The |\FV@ListProcessLine| from \fancyvrb\ is |\let| to a (patched) version of the original or a version that supports line breaks.
% \begin{macrocode}
-\newboolean{FV@BreakLines}
+\newbool{FV@breaklines}
\define@booleankey{FV}{breaklines}%
- {\FV@BreakLinestrue
- \let\FV@ListProcessLine\FV@ListProcessLine@Break}%
- {\FV@BreakLinesfalse
- \let\FV@ListProcessLine\FV@ListProcessLine@NoBreak}
+ {\booltrue{FV@breaklines}%
+ \let\FV@ListProcessLine\FV@ListProcessLine@Break}%
+ {\boolfalse{FV@breaklines}%
+ \let\FV@ListProcessLine\FV@ListProcessLine@NoBreak}
\AtEndOfPackage{\fvset{breaklines=false}}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\FV@BreakLinesLuaTeXHook}
+% Fix hyphen handling under LuaTeX. |\automatichyphenmode=2| would work for environments, but doesn't seem to work inline. Instead, the active hyphen is redefined to |\mbox{-}|.
+%
+% This is needed before |\@noligs| is ever used, so it is placed in |\FV@FormattingPrep@PreHook|.
+% \begin{macrocode}
+\def\FV@BreakLinesLuaTeXHook{%
+ \expandafter\def\expandafter\@noligs\expandafter{\@noligs
+ \begingroup\lccode`\~=`\-\lowercase{\endgroup\def~}{\leavevmode\kern\z@\mbox{-}}}}
+\ifcsname directlua\endcsname
+ \ifx\directlua\relax
+ \else
+ \FV@AddToHook\FV@FormattingPrep@PreHook\FV@BreakLinesLuaTeXHook
+ \fi
+\fi
+% \end{macrocode}
+% \end{macro}
+%
%
% \begin{macro}{\FV@BreakLinesIndentationHook}
% A hook for performing on-the-fly indentation calculations when |breaklines=true|. This is used for all |*NChars| related indentation. It is important to use |\FV@FormattingPrep@PostHook| because it is always invoked \emph{after} any font-related settings.
% \begin{macrocode}
\def\FV@BreakLinesIndentationHook{}
\g@addto@macro\FV@FormattingPrep@PostHook{%
- \ifFV@BreakLines
+ \ifFV@breaklines
\FV@BreakLinesIndentationHook
\fi}
% \end{macrocode}
@@ -4516,12 +4766,12 @@
% \end{macro}
%
%
-% \begin{macro}{FV@BreakAutoIndent}
+% \begin{macro}{FV@breakautoindent}
% Auto indentation of continuation lines to indentation of original line. Adds to |\FV@BreakIndent|.
% \begin{macrocode}
-\newboolean{FV@BreakAutoIndent}
+\newbool{FV@breakautoindent}
\define@booleankey{FV}{breakautoindent}%
- {\FV@BreakAutoIndenttrue}{\FV@BreakAutoIndentfalse}
+ {\booltrue{FV@breakautoindent}}{\boolfalse{FV@breakautoindent}}
\fvset{breakautoindent=true}
% \end{macrocode}
% \end{macro}
@@ -4675,25 +4925,26 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\FV@Break@Token}
-% Macro that controls token handling between |\FancyVerbBreakStart| and |\FancyVerbBreakStop|. Initially |\let| to |\relax|; later |\let| to |\FV@Break@AnyToken| or |\FV@Break@BeforeAfterToken| as appropriate. There is no need to |\let\FV@Break@Token\relax| when |breakanywhere|, |breakbefore|, and |breakafter| are not in use. In that case, |\FancyVerbBreakStart| and |\FancyVerbBreakStop| are |\let| to |\relax|, and |\FV@Break@Token| is never invoked.
+% \begin{macro}{\FV@Break@DefaultToken}
+% Macro that controls default token handling between |\FancyVerbBreakStart| and |\FancyVerbBreakStop|. Initially |\let| to |\FV@Break@NBToken|, which does not insert breaks. Later |\let| to |\FV@Break@AnyToken| or |\FV@Break@BeforeAfterToken| if |breakanywhere| or |breakbefore|/|breakafter| are in use.
% \begin{macrocode}
-\let\FV@Break@Token\relax
+\let\FV@Break@DefaultToken\FV@Break@NBToken
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{FV@BreakAnywhere}
+% \begin{macro}{FV@breakanywhere}
% Allow line breaking (almost) anywhere. Set |\FV@Break| and |\FV@EndBreak| to be used, and |\let| |\FV@Break@Token| to the appropriate macro.
% \begin{macrocode}
-\newboolean{FV@BreakAnywhere}
+\newbool{FV@breakanywhere}
\define@booleankey{FV}{breakanywhere}%
- {\FV@BreakAnywheretrue
+ {\booltrue{FV@breakanywhere}%
\let\FancyVerbBreakStart\FV@Break
\let\FancyVerbBreakStop\FV@EndBreak
- \let\FV@Break@Token\FV@Break@AnyToken}%
- {\FV@BreakAnywherefalse
+ \let\FV@Break@DefaultToken\FV@Break@AnyToken}%
+ {\boolfalse{FV@breakanywhere}%
\let\FancyVerbBreakStart\relax
- \let\FancyVerbBreakStop\relax}
+ \let\FancyVerbBreakStop\relax
+ \let\FV@Break@DefaultToken\FV@Break@NBToken}
\fvset{breakanywhere=false}
% \end{macrocode}
% \end{macro}
@@ -4706,24 +4957,25 @@
\ifstrempty{#1}%
{\let\FV@BreakBefore\@empty
\let\FancyVerbBreakStart\relax
- \let\FancyVerbBreakStop\relax}%
+ \let\FancyVerbBreakStop\relax
+ \let\FV@Break@DefaultToken\FV@Break@NBToken}%
{\def\FV@BreakBefore{#1}%
\let\FancyVerbBreakStart\FV@Break
\let\FancyVerbBreakStop\FV@EndBreak
- \let\FV@Break@Token\FV@Break@BeforeAfterToken}%
+ \let\FV@Break@DefaultToken\FV@Break@BeforeAfterToken}%
}
\fvset{breakbefore={}}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{FV@BreakBeforeGroup}
-% Determine whether breaking before specified characters is always allowed before each individual character, or is only allowed before the first in a group of identical characters.
+% \begin{macro}{FV@breakbeforeinrun}
+% Determine whether breaking before specified characters is always allowed before each individual character, or is only allowed before the first in a run of identical characters.
% \begin{macrocode}
-\newboolean{FV@BreakBeforeGroup}
-\define@booleankey{FV}{breakbeforegroup}%
- {\FV@BreakBeforeGrouptrue}%
- {\FV@BreakBeforeGroupfalse}%
-\fvset{breakbeforegroup=true}
+\newbool{FV@breakbeforeinrun}
+\define@booleankey{FV}{breakbeforeinrun}%
+ {\booltrue{FV@breakbeforeinrun}}%
+ {\boolfalse{FV@breakbeforeinrun}}%
+\fvset{breakbeforeinrun=false}
% \end{macrocode}
% \end{macro}
%
@@ -4770,24 +5022,25 @@
\ifstrempty{#1}%
{\let\FV@BreakAfter\@empty
\let\FancyVerbBreakStart\relax
- \let\FancyVerbBreakStop\relax}%
+ \let\FancyVerbBreakStop\relax
+ \let\FV@Break@DefaultToken\FV@Break@NBToken}%
{\def\FV@BreakAfter{#1}%
\let\FancyVerbBreakStart\FV@Break
\let\FancyVerbBreakStop\FV@EndBreak
- \let\FV@Break@Token\FV@Break@BeforeAfterToken}%
+ \let\FV@Break@DefaultToken\FV@Break@BeforeAfterToken}%
}
\fvset{breakafter={}}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{FV@BreakAfterGroup}
-% Determine whether breaking after specified characters is always allowed after each individual character, or is only allowed after groups of identical characters.
+% \begin{macro}{FV@breakafterinrun}
+% Determine whether breaking after specified characters is always allowed after each individual character, or is only allowed after the last in a run of identical characters.
% \begin{macrocode}
-\newboolean{FV@BreakAfterGroup}
-\define@booleankey{FV}{breakaftergroup}%
- {\FV@BreakAfterGrouptrue}%
- {\FV@BreakAfterGroupfalse}%
-\fvset{breakaftergroup=true}
+\newbool{FV@breakafterinrun}
+\define@booleankey{FV}{breakafterinrun}%
+ {\booltrue{FV@breakafterinrun}}%
+ {\boolfalse{FV@breakafterinrun}}%
+\fvset{breakafterinrun=false}
% \end{macrocode}
% \end{macro}
%
@@ -4810,16 +5063,16 @@
}%
\def\FV@BreakAfter@Process@i##1{%
\ifcsname FV@BreakBefore@Token\detokenize{##1}\endcsname
- \ifthenelse{\boolean{FV@BreakBeforeGroup}}%
- {\ifthenelse{\boolean{FV@BreakAfterGroup}}%
+ \ifbool{FV@breakbeforeinrun}%
+ {\ifbool{FV@breakafterinrun}%
{}%
{\PackageError{fvextra}%
- {Conflicting breakbeforegroup and breakaftergroup for "\detokenize{##1}"}%
- {Conflicting breakbeforegroup and breakaftergroup for "\detokenize{##1}"}}}%
- {\ifthenelse{\boolean{FV@BreakAfterGroup}}%
+ {Conflicting breakbeforeinrun and breakafterinrun for "\detokenize{##1}"}%
+ {Conflicting breakbeforeinrun and breakafterinrun for "\detokenize{##1}"}}}%
+ {\ifbool{FV@breakafterinrun}%
{\PackageError{fvextra}%
- {Conflicting breakbeforegroup and breakaftergroup for "\detokenize{##1}"}%
- {Conflicting breakbeforegroup and breakaftergroup for "\detokenize{##1}"}}%
+ {Conflicting breakbeforeinrun and breakafterinrun for "\detokenize{##1}"}%
+ {Conflicting breakbeforeinrun and breakafterinrun for "\detokenize{##1}"}}%
{}}%
\fi
\g@addto@macro\FV@BreakAfter@Def{%
@@ -4944,6 +5197,20 @@
% \end{macro}
%
%
+% \begin{macro}{breaknonspaceingroup}
+% \begin{macro}{FV@breaknonspaceingroup}
+% When inserting breaks, insert breaks within groups (typically |{...}| but depends on |commandchars|) instead of skipping over them. This isn't the default because it is incompabile with many macros since it inserts breaks into all arguments. For those cases, redefining macros to use |\FancyVerbBreakStart...\FancyVerbBreakStop| to insert breaks is better.
+% \begin{macrocode}
+\newbool{FV@breaknonspaceingroup}
+\define@booleankey{FV}{breaknonspaceingroup}%
+ {\booltrue{FV@breaknonspaceingroup}}%
+ {\boolfalse{FV@breaknonspaceingroup}}
+\fvset{breaknonspaceingroup=false}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
% \subsubsection{Line breaking implementation}
%
% \paragraph{Helper macros}
@@ -4972,26 +5239,29 @@
% \begin{macro}{\FV@GetLineIndent}
% A macro that takes a line and determines the indentation, storing the indentation chars in |\FV@LineIndentChars|.
% \begin{macrocode}
-\def\FV@CleanRemainingChars#1\FV@Undefined{}
-\def\FV@GetLineIndent{\afterassignment\FV@CheckIndentChar\let\FV@NextChar=}
-\def\FV@CheckIndentChar{%
- \ifx\FV@NextChar\FV@Undefined\relax
- \let\FV@Next=\relax
- \else
- \ifx\FV@NextChar\FV@FVSpaceToken\relax
- \g@addto@macro{\FV@LineIndentChars}{\FV@FVSpaceToken}%
- \let\FV@Next=\FV@GetLineIndent
- \else
- \ifx\FV@NextChar\FV@FVTabToken\relax
- \g@addto@macro{\FV@LineIndentChars}{\FV@FVTabToken}%
- \let\FV@Next=\FV@GetLineIndent
+\def\FV@GetLineIndent{%
+ \@ifnextchar\FV@Sentinel
+ {\FV@GetLineIndent@End}%
+ {\ifx\@let@token\FV@FVSpaceToken
+ \let\FV@Next\FV@GetLineIndent@Whitespace
+ \else\ifx\@let@token\FV@FVTabToken
+ \let\FV@Next\FV@GetLineIndent@Whitespace
+ \else\ifcsname FV@PYG@Redefed\endcsname
+ \ifx\@let@token\FV@PYG@Redefed
+ \let\FV@Next\FV@GetLineIndent@Pygments
\else
- \let\FV@Next=\FV@CleanRemainingChars
+ \let\FV@Next\FV@GetLineIndent@End
\fi
- \fi
- \fi
- \FV@Next
-}
+ \else
+ \let\FV@Next\FV@GetLineIndent@End
+ \fi\fi\fi
+ \FV@Next}}
+\def\FV@GetLineIndent@End#1\FV@Sentinel{}
+\def\FV@GetLineIndent@Whitespace#1{%
+ \expandafter\def\expandafter\FV@LineIndentChars\expandafter{\FV@LineIndentChars#1}%
+ \FV@GetLineIndent}
+\def\FV@GetLineIndent@Pygments#1#2#3{%
+ \FV@GetLineIndent#3}
% \end{macrocode}
% \end{macro}
%
@@ -5019,82 +5289,227 @@
%
% \paragraph{Line scanning and break insertion macros}\hfill\\
%
-% \noindent The strategy here is to scan a line token-by-token, and insert breaks at appropriate points. An alternative would be to make characters active, and have them expand to literal versions of themselves plus appropriate breaks. Both approaches have advantages and drawbacks. A catcode-based approach could work, but in general would require redefining some existing active characters to insert both appropriate breaks and their original definitions. The current approach works regardless of catcodes. It is also convenient for working with macros that expand to single characters, such as those created in highlighting code with Pygments (which is used by \pkg{minted} and \pkg{pythontex}). In that case, working with active characters would not be enough, and scanning for macros (or redefining them) is necessary. With the current approach, working with more complex macros is also straightforward. Adding support for line breaks within a macro simply requires wrapping macro contents with |\FancyVerbBreakStart...\FancyVerbBreakStop|. A catcode-based approach could require |\scantokens| or a similar retokenization in some cases, but would have the advantage that in other cases no macro redefinition would be needed.
+% \noindent The strategy here is to scan through text token by token, inserting potential breaks at appropriate points. The final text with breaks inserted is stored in |\FV@BreakBuffer|, which is ultimately passed on to a wrapper macro like |\FancyVerbFormatText| or |\FancyVerbFormatInline|.
%
-% \begin{macro}{\FV@Break}
-% The entry macro for breaking lines, either anywhere or before/after specified characters. The current line (or argument) will be scanned token by token/group by group, and accumulated (with added potential breaks) in |\FV@TmpLine|. After scanning is complete, |\FV@TmpLine| will be inserted. It would be possible to insert each token/group into the document immediately after it is scanned, instead of accumulating them in a ``buffer.'' But that would interfere with macros. Even in the current approach, macros that take optional arguments are problematic.\footnote{Through a suitable definition that tracks the current state and looks for square brackets, this might be circumvented. Then again, in verbatim contexts, macro use should be minimal, so the restriction to macros without optional arguments should generally not be an issue.} The last token is tracked with |\FV@LastToken|, to allow lookbehind when breaking by groups of identical characters. |\FV@LastToken| is |\let| to |\FV@Undefined| any time the last token was something that shouldn't be compared against (for example, a non-empty group), and it is not reset whenever the last token may be ignored (for example, |{}|). When setting |\FV@LastToken|, it is vital always to use |\let\FV@LastToken=...| so that |\let\FV@LastToken==| will work (so that the equals sign |=| won't break things).
+% If user macros insert breaks via |\FancyVerbBreakStart...\FancyVerbBreakStop|, this invokes an additional scanning/insertion pass within each macro after expansion. The scanning/insertion only applies to the part of the expanded macros wrapped in |\FancyVerbBreakStart...\FancyVerbBreakStop|. At the time this occurs, during macro processing, text will already be wrapped in a wrapper macro like |\FancyVerbFormatText| or |\FancyVerbFormatInline|. That is, the built-in break insertion occurs before any typesetting, but user macro break insertion occurs during typesetting.
+%
+% Token comparison is currently based on |\ifx|. This is sufficient for verbatim text but a comparison based on |\detokenize| might be better for cases when |commandchars| is in use. For example, with |commandchars| characters other than the curly braces |{}| might be the group tokens.
+%
+% It would be possible to insert each token/group into the document immediately after it is scanned, instead of accumulating them in a ``buffer.'' But that would interfere with macros. Even in the current approach, macros that take optional arguments are problematic, since with some settings breaks will interference with optional arguments.\footnote{Through a suitable definition that tracks the current state and looks for square brackets, this might be circumvented. Then again, in verbatim contexts, macro use should be minimal, so the restriction to macros without optional arguments should generally not be an issue.}
%
-% The current definition of |\FV@Break@Token| is swapped for a UTF-8 compatible one under pdfTeX when necessary. The standard macros are defined next, since they make the algorithms simpler to understand. The more complex |UTF| variants are defined later.
+% The last token is tracked with |\FV@LastToken|, to allow lookbehind when breaking by groups of identical characters. |\FV@LastToken| is |\let| to |\FV@Undefined| any time the last token was something that shouldn't be compared against (for example, a non-empty group), and it is not reset whenever the last token may be ignored (for example, |{}|). When setting |\FV@LastToken|, it is vital always to use |\let\FV@LastToken=...| so that |\let\FV@LastToken==| will work (so that the equals sign |=| won't break things).
+%
+% \begin{macro}{FV@BreakBufferDepth}
+% Track buffer depth while inserting breaks. Some macros and command sequences require recursive processing. For example, groups |{...}| (with |commandchars| and |breaknonspaceingroup|), math, and nested |\FancyVerbBreakStart...\FancyVerbBreakStop|. Depth starts at zero. The current buffer at depth $n$ is always |\FV@BreakBuffer|, with other buffers |\FV@BreakBuffer<n>| etc.\ named via |\csname| to allow for the integer.
% \begin{macrocode}
-\def\FV@Break{%
- \def\FV@TmpLine{}%
+\newcounter{FV@BreakBufferDepth}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FV@BreakBuffer@Append}
+% Append to |\FV@BreakBuffer|.
+% \begin{macrocode}
+\def\FV@BreakBuffer@Append#1{%
+ \expandafter\def\expandafter\FV@BreakBuffer\expandafter{\FV@BreakBuffer#1}}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FV@BreakBufferStart}
+% Create a new buffer, either at the beginning of scanning or during recursion. The single mandatory argument is the macro for handling tokens, which is |\let| to |\FV@Break@Token|. An intermediate |\FV@BreakBufferStart@i| is used to optimize |\ifx| comparisons for |\FV@BreakBufferStart| during scanning.
+%
+% For recursion, |\FV@BreakBuffer<n>| and |\FV@Break@Token<n>| store the state (buffer and token handling macro) immediately prior to recusion with depth |<n>|.
+% \begin{macrocode}
+\def\FV@BreakBufferStart{%
+ \FV@BreakBufferStart@i}
+\def\FV@BreakBufferStart@i#1{%
+ \ifnum\value{FV@BreakBufferDepth}>0\relax
+ \expandafter\let\csname FV@BreakBuffer\arabic{FV@BreakBufferDepth}\endcsname
+ \FV@BreakBuffer
+ \expandafter\let\csname FV@Break@Token\arabic{FV@BreakBufferDepth}\endcsname
+ \FV@Break@Token
+ \fi
+ \def\FV@BreakBuffer{}%
+ \let\FV@Break@Token=#1%
+ \stepcounter{FV@BreakBufferDepth}%
\let\FV@LastToken=\FV@Undefined
- \ifFV@pdfTeXinputenc
- \ifdefstring{\inputencodingname}{utf8}%
- {\ifx\FV@Break@Token\FV@Break@AnyToken
- \let\FV@Break@Token\FV@Break@AnyToken@UTF
- \else
- \ifx\FV@Break@Token\FV@Break@BeforeAfterToken
- \let\FV@Break@Token\FV@Break@BeforeAfterToken@UTF
- \fi
- \fi}%
- {}%
+ \FV@Break@Scan}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{FV@UserMacroBreaks}
+% Whether a user macro is inserting breaks, as opposed to \pkg{fvextra}'s standard scanning routine. When breaks come from \pkg{fvextra}, |\FV@BreakBufferStop| does nothing with |\FV@BreakBuffer| at buffer depth 0, since |\FV@InsertBreaks| handles buffer insertion. When breaks come from user macros, |\FV@BreakBufferStop| needs to insert |\FV@BreakBuffer| at buffer depth 0.
+% \begin{macrocode}
+\newbool{FV@UserMacroBreaks}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FV@BreakBufferStop}
+% Complete the current buffer. The single mandatory argument is a wrapper macro for |\FV@BreakBuffer|'s contents (for example, insert recursively scanned group into braces |{...}|). If the mandatory argument is empty, no wrapper is used.
+%
+% For \pkg{fvextra}'s standard scanning: If this is the main buffer (depth 0), stop scanning---which ultimately allows |\FV@BreakBuffer| to be handled by |\FV@InsertBreaks|. For user macros: Insert |\FV@BreakBuffer| at buffer depth 0. Otherwise for both cases: Append the current buffer to the previous buffer, and continue scanning.
+%
+% An intermediate |\FV@BreakBufferStop@i| is used to optimize |\ifx| comparisons for |\FV@BreakBufferStop| during scanning.
+% \begin{macrocode}
+\def\FV@BreakBufferStop{%
+ \FV@BreakBufferStop@i}
+\def\FV@BreakBufferStop@i#1{%
+ \addtocounter{FV@BreakBufferDepth}{-1}%
+ \let\FV@LastToken=\FV@Undefined
+ \ifnum\value{FV@BreakBufferDepth}<0\relax
+ \PackageError{fvextra}%
+ {Line break insertion error (extra \string\FancyVerbBreakStop?)}%
+ {Line break insertion error (extra \string\FancyVerbBreakStop?)}%
+ \def\FV@BreakBuffer{}%
\fi
- \FV@Break@Scan
-}
+ \ifnum\value{FV@BreakBufferDepth}>0\relax
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+ {\expandafter\FV@BreakBufferStop@ii\expandafter{\FV@BreakBuffer}{#1}}%
+ {\ifbool{FV@UserMacroBreaks}%
+ {\expandafter\let\expandafter\FV@BreakBuffer\expandafter\FV@Undefined\FV@BreakBuffer}%
+ {}}}
+\def\FV@BreakBufferStop@ii#1#2{%
+ \ifstrempty{#2}%
+ {\FV@BreakBufferStop@iii{#1}}%
+ {\expandafter\FV@BreakBufferStop@iii\expandafter{#2{#1}}}}
+\def\FV@BreakBufferStop@iii#1{%
+ \expandafter\let\expandafter\FV@BreakBufferUpLevel
+ \csname FV@BreakBuffer\arabic{FV@BreakBufferDepth}\endcsname
+ \expandafter\def\expandafter\FV@BreakBuffer\expandafter{\FV@BreakBufferUpLevel#1}%
+ \expandafter\let\expandafter\FV@Break@Token
+ \csname FV@Break@Token\arabic{FV@BreakBufferDepth}\endcsname
+ \FV@Break@Scan}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FV@InsertBreaks}
+% This inserts breaks within text (|#2|) and stores the result in |\FV@BreakBuffer|. Then it invokes a macro (|#1|) on the result. That allows |\FancyVerbFormatInline| and |\FancyVerbFormatText| to operate on the final text (with breaks) directly, rather than being given text without breaks or text wrapped with macros that will (potentially recursively) insert breaks. (Breaks inserted by user macros are not yet present, though, since they are only inserted---potentially recursively---during macro processing.)
+%
+% The initial |\ifx| skips break insertion when break insertion is turned off (|\FancyVerbBreakStart| is |\relax|).
+%
+% The current definition of |\FV@Break@Token| is swapped for a UTF-8 compatible one under pdfTeX when necessary. In what follows, the default macros are defined after |\FV@Break|, since they make the algorithms simpler to understand. The more complex |UTF| variants are defined afterward.
+% \begin{macrocode}
+\def\FV@InsertBreaks#1#2{%
+ \ifx\FancyVerbBreakStart\relax
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+ {#1{#2}}%
+ {\ifFV@pdfTeXinputenc
+ \ifdefstring{\inputencodingname}{utf8}%
+ {\ifx\FV@Break@DefaultToken\FV@Break@AnyToken
+ \let\FV@Break@DefaultToken\FV@Break@AnyToken@UTF
+ \else
+ \ifx\FV@Break@DefaultToken\FV@Break@BeforeAfterToken
+ \let\FV@Break@DefaultToken\FV@Break@BeforeAfterToken@UTF
+ \fi
+ \fi}%
+ {}%
+ \fi
+ \setcounter{FV@BreakBufferDepth}{0}%
+ \boolfalse{FV@UserMacroBreaks}%
+ \FancyVerbBreakStart#2\FancyVerbBreakStop
+ \setcounter{FV@BreakBufferDepth}{0}%
+ \booltrue{FV@UserMacroBreaks}%
+ \expandafter\FV@InsertBreaks@i\expandafter{\FV@BreakBuffer}{#1}}}
+\def\FV@InsertBreaks@i#1#2{%
+ \let\FV@BreakBuffer\FV@Undefined
+ #2{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FV@Break}
+% The entry macro for break insertion. Whatever is delimited (after expansion) by |\FV@Break...\FV@EndBreak| will be scanned token by token/group by group, and accumulated (with any added breaks) in |\FV@BreakBuffer|. After scanning is complete, |\FV@BreakBuffer| will be inserted.
+% \begin{macrocode}
+\def\FV@Break{%
+ \FV@BreakBufferStart{\FV@Break@DefaultToken}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\FV@EndBreak}
% \begin{macrocode}
-\def\FV@EndBreak{\FV@TmpLine}
+\def\FV@EndBreak{%
+ \FV@BreakBufferStop{}}
% \end{macrocode}
% \end{macro}
%
+%
% \begin{macro}{\FV@Break@Scan}
% Look ahead via |\@ifnextchar|. Don't do anything if we're at the end of the region to be scanned. Otherwise, invoke a macro to deal with what's next based on whether it is math, or a group, or something else.
%
-% This and some following macros are defined inside of groups, to ensure proper catcodes.
+% This and some following macros are defined inside of groups to ensure proper catcodes.
+%
+% The check against |\FV@BreakBufferStart| should typically not be necessary; it is included for completeness and to allow for future extensions and customization. |\FV@BreakBufferStart| is only inserted raw (rather than wrapped in |\FancyVerbBreakStart|) in token processing macros, where it initiates (or restarts) scanning and is not itself scanned.
+%
% \begin{macrocode}
\begingroup
-\catcode`\$=3%
+\catcode`\$=3
\gdef\FV@Break@Scan{%
- \@ifnextchar\FV@EndBreak%
+ \@ifnextchar\FancyVerbBreakStart%
{}%
- {\ifx\@let@token$\relax
+ {\ifx\@let@token\FancyVerbBreakStop
+ \let\FV@Break@Next\relax
+ \else\ifx\@let@token\FV@BreakBufferStart
+ \let\FV@Break@Next\relax
+ \else\ifx\@let@token\FV@BreakBufferStop
+ \let\FV@Break@Next\relax
+ \else\ifx\@let@token$
\let\FV@Break@Next\FV@Break@Math
+ \else\ifx\@let@token\bgroup
+ \let\FV@Break@Next\FV@Break@Group
\else
- \ifx\@let@token\bgroup\relax
- \let\FV@Break@Next\FV@Break@Group
- \else
- \let\FV@Break@Next\FV@Break@Token
- \fi
- \fi
- \FV@Break@Next}%
-}
+ \let\FV@Break@Next\FV@Break@Token
+ \fi\fi\fi\fi\fi
+ \FV@Break@Next}}
\endgroup
% \end{macrocode}
% \end{macro}
%
+%
% \begin{macro}{\FV@Break@Math}
-% Grab an entire math span, and insert it into |\FV@TmpLine|. Due to grouping, this works even when math contains things like |\text{$x$}|. After dealing with the math span, continue scanning.
+% Grab an entire math span, and insert it into |\FV@BreakBuffer|. Due to grouping, this works even when math contains things like |\text{$x$}|. After dealing with the math span, continue scanning.
% \begin{macrocode}
\begingroup
\catcode`\$=3%
\gdef\FV@Break@Math$#1${%
- \g@addto@macro{\FV@TmpLine}{$#1$}%
- \let\FV@LastToken=\FV@Undefined
- \FV@Break@Scan}
+ \FV@BreakBufferStart{\FV@Break@NBToken}#1\FV@BreakBufferStop{\FV@Break@MathTemplate}}
+\gdef\FV@Break@MathTemplate#1{$#1$}
\endgroup
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\FV@Break@Group}
-% Grab the group, and insert it into |\FV@TmpLine| (as a group) before continuing scanning.
+% Grab the group, and insert it into |\FV@BreakBuffer| (as a group) before continuing scanning.
% \begin{macrocode}
\def\FV@Break@Group#1{%
- \g@addto@macro{\FV@TmpLine}{{#1}}%
- \ifstrempty{#1}{}{\let\FV@LastToken=\FV@Undefined}%
+ \ifstrempty{#1}%
+ {\FV@BreakBuffer@Append{{}}%
+ \FV@Break@Scan}%
+ {\ifbool{FV@breaknonspaceingroup}%
+ {\FV@BreakBufferStart{\FV@Break@DefaultToken}%
+ #1\FV@BreakBufferStop{\FV@Break@GroupTemplate}}%
+ {\FV@BreakBufferStart{\FV@Break@NBToken}%
+ #1\FV@BreakBufferStop{\FV@Break@GroupTemplate}}}}
+\def\FV@Break@GroupTemplate#1{{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FV@Break@NBToken}
+% Append token to buffer while adding no breaks (|NB|) and reset last token.
+% \begin{macrocode}
+\def\FV@Break@NBToken#1{%
+ \FV@BreakBuffer@Append{#1}%
+ \let\FV@Break@LastToken=\FV@Undefined
\FV@Break@Scan}
% \end{macrocode}
% \end{macro}
@@ -5113,7 +5528,7 @@
%\catcode`\+=12%
%\gdef\FV@Break...
% \ifcat\noexpand#1a%
-% \g@addto@macro{\FV@TmpLine}...
+% \FV@BreakBuffer@Append...
% \else
%...
%\endgroup
@@ -5122,7 +5537,7 @@
%
% \begin{macrocode}
\def\FV@Break@AnyToken#1{%
- \g@addto@macro{\FV@TmpLine}{\FancyVerbBreakAnywhereBreak#1}%
+ \FV@BreakBuffer@Append{\FancyVerbBreakAnywhereBreak#1}%
\FV@Break@Scan}
% \end{macrocode}
% \end{macro}
@@ -5131,6 +5546,8 @@
% Deal with breaking around only specified tokens. This is a bit trickier. We only break if a macro corresponding to the token exists. We also need to check whether the specified token should be grouped, that is, whether breaks are allowed between identical characters. All of this has to be written carefully so that nothing is accidentally inserted into the stream for future scanning.
%
% Dealing with tokens followed by empty groups (for example, |\x{}|) is particularly challenging when we want to avoid breaks between identical characters. When a token is followed by a group, we need to save the current token for later reference (|\x| in the example), then capture and save the following group, and then---only if the group was empty---see if the following token is identical to the old saved token.
+%
+% The |\csname @let@token\endcsname| prevents issues if |\@let@token| is ever |\else| or |\fi|.
% \begin{macrocode}
\def\FV@Break@BeforeAfterToken#1{%
\ifcsname FV@BreakBefore@Token\detokenize{#1}\endcsname
@@ -5145,75 +5562,72 @@
\FV@Break@Next{#1}%
}
\def\FV@Break@BeforeAfterTokenNoBreak#1{%
- \g@addto@macro{\FV@TmpLine}{#1}%
+ \FV@BreakBuffer@Append{#1}%
\let\FV@LastToken=#1%
\FV@Break@Scan}
\def\FV@Break@BeforeTokenBreak#1{%
- \ifthenelse{\boolean{FV@BreakBeforeGroup}}%
+ \ifbool{FV@breakbeforeinrun}%
+ {\ifcsname FV@BreakAfter@Token\detokenize{#1}\endcsname
+ \FV@BreakBuffer@Append{\FancyVerbBreakBeforeBreak}%
+ \let\FV@Break@Next\FV@Break@BeforeTokenBreak@AfterRescan
+ \def\FV@RescanToken{#1}%
+ \else
+ \FV@BreakBuffer@Append{\FancyVerbBreakBeforeBreak#1}%
+ \let\FV@Break@Next\FV@Break@Scan
+ \let\FV@LastToken=#1%
+ \fi}%
{\ifx#1\FV@LastToken\relax
\ifcsname FV@BreakAfter@Token\detokenize{#1}\endcsname
\let\FV@Break@Next\FV@Break@BeforeTokenBreak@AfterRescan
\def\FV@RescanToken{#1}%
\else
- \g@addto@macro{\FV@TmpLine}{#1}%
+ \FV@BreakBuffer@Append{#1}%
\let\FV@Break@Next\FV@Break@Scan
\let\FV@LastToken=#1%
\fi
\else
\ifcsname FV@BreakAfter@Token\detokenize{#1}\endcsname
- \g@addto@macro{\FV@TmpLine}{\FancyVerbBreakBeforeBreak}%
+ \FV@BreakBuffer@Append{\FancyVerbBreakBeforeBreak}%
\let\FV@Break@Next\FV@Break@BeforeTokenBreak@AfterRescan
\def\FV@RescanToken{#1}%
\else
- \g@addto@macro{\FV@TmpLine}{\FancyVerbBreakBeforeBreak#1}%
+ \FV@BreakBuffer@Append{\FancyVerbBreakBeforeBreak#1}%
\let\FV@Break@Next\FV@Break@Scan
\let\FV@LastToken=#1%
\fi
\fi}%
- {\ifcsname FV@BreakAfter@Token\detokenize{#1}\endcsname
- \g@addto@macro{\FV@TmpLine}{\FancyVerbBreakBeforeBreak}%
- \let\FV@Break@Next\FV@Break@BeforeTokenBreak@AfterRescan
- \def\FV@RescanToken{#1}%
- \else
- \g@addto@macro{\FV@TmpLine}{\FancyVerbBreakBeforeBreak#1}%
- \let\FV@Break@Next\FV@Break@Scan
- \let\FV@LastToken=#1%
- \fi}%
\FV@Break@Next}
\def\FV@Break@BeforeTokenBreak@AfterRescan{%
\expandafter\FV@Break@AfterTokenBreak\FV@RescanToken}
\def\FV@Break@AfterTokenBreak#1{%
\let\FV@LastToken=#1%
\@ifnextchar\FV@FVSpaceToken%
- {\g@addto@macro{\FV@TmpLine}{#1}\FV@Break@Scan}%
- {\ifthenelse{\boolean{FV@BreakAfterGroup}}%
+ {\FV@BreakBuffer@Append{#1}\FV@Break@Scan}%
+ {\ifbool{FV@breakafterinrun}%
+ {\FV@BreakBuffer@Append{#1\FancyVerbBreakAfterBreak}%
+ \let\FV@Break@Next\FV@Break@Scan}%
{\ifx\@let@token#1\relax
- \g@addto@macro{\FV@TmpLine}{#1}%
+ \FV@BreakBuffer@Append{#1}%
\let\FV@Break@Next\FV@Break@Scan
\else
- \ifx\@let@token\bgroup\relax
- \g@addto@macro{\FV@TmpLine}{#1}%
+ \expandafter\ifx\csname @let@token\endcsname\bgroup\relax
+ \FV@BreakBuffer@Append{#1}%
\let\FV@Break@Next\FV@Break@AfterTokenBreak@Group
\else
- \g@addto@macro{\FV@TmpLine}{#1\FancyVerbBreakAfterBreak}%
+ \FV@BreakBuffer@Append{#1\FancyVerbBreakAfterBreak}%
\let\FV@Break@Next\FV@Break@Scan
\fi
\fi}%
- {\g@addto@macro{\FV@TmpLine}{#1\FancyVerbBreakAfterBreak}%
- \let\FV@Break@Next\FV@Break@Scan}%
\FV@Break@Next}%
}
\def\FV@Break@AfterTokenBreak@Group#1{%
- \g@addto@macro{\FV@TmpLine}{{#1}}%
\ifstrempty{#1}%
- {\let\FV@Break@Next\FV@Break@AfterTokenBreak@Group@i}%
- {\let\FV@Break@Next\FV@Break@Scan\let\FV@LastToken=\FV@Undefined}%
- \FV@Break@Next}
-\def\FV@Break@AfterTokenBreak@Group@i{%
- \@ifnextchar\FV@LastToken%
- {\FV@Break@Scan}%
- {\g@addto@macro{\FV@TmpLine}{\FancyVerbBreakAfterBreak}%
- \FV@Break@Scan}}
+ {\FV@BreakBuffer@Append{{}}%
+ \@ifnextchar\FV@LastToken%
+ {\FV@Break@Scan}%
+ {\FV@BreakBuffer@Append{\FancyVerbBreakAfterBreak}%
+ \FV@Break@Scan}}%
+ {\FV@Break@Group{#1}}}
% \end{macrocode}
% \end{macro}
%
@@ -5289,16 +5703,16 @@
\expandafter\FV@BreakAfter@Process@ii\expandafter{##1}}%
\def\FV@BreakAfter@Process@ii##1{%
\ifcsname FV@BreakBefore@Token\detokenize{##1}\endcsname
- \ifthenelse{\boolean{FV@BreakBeforeGroup}}%
- {\ifthenelse{\boolean{FV@BreakAfterGroup}}%
+ \ifbool{FV@breakbeforeinrun}%
+ {\ifbool{FV@breakafterinrun}%
{}%
{\PackageError{fvextra}%
- {Conflicting breakbeforegroup and breakaftergroup for "\detokenize{##1}"}%
- {Conflicting breakbeforegroup and breakaftergroup for "\detokenize{##1}"}}}%
- {\ifthenelse{\boolean{FV@BreakAfterGroup}}%
+ {Conflicting breakbeforeinrun and breakafterinrun for "\detokenize{##1}"}%
+ {Conflicting breakbeforeinrun and breakafterinrun for "\detokenize{##1}"}}}%
+ {\ifbool{FV@breakafterinrun}%
{\PackageError{fvextra}%
- {Conflicting breakbeforegroup and breakaftergroup for "\detokenize{##1}"}%
- {Conflicting breakbeforegroup and breakaftergroup for "\detokenize{##1}"}}%
+ {Conflicting breakbeforeinrun and breakafterinrun for "\detokenize{##1}"}%
+ {Conflicting breakbeforeinrun and breakafterinrun for "\detokenize{##1}"}}%
{}}%
\fi
\g@addto@macro\FV@BreakAfter@Def{%
@@ -5318,7 +5732,7 @@
%
%
% \begin{macro}{\FV@Break@AnyToken@UTF}
-% Instead of just adding each token to |\FV@TmpLine| with a preceding break, also check for multi-byte code points and capture the remaining bytes when they are encountered.
+% Instead of just adding each token to |\FV@BreakBuffer| with a preceding break, also check for multi-byte code points and capture the remaining bytes when they are encountered.
% \begin{macrocode}
\def\FV@Break@AnyToken@UTF#1{%
\ifcsname FV@U8:\detokenize{#1}\endcsname
@@ -5330,7 +5744,7 @@
\FV@Break@Next{#1}%
}
\def\FV@Break@AnyToken@UTF@i#1{%
- \g@addto@macro{\FV@TmpLine}{\FancyVerbBreakAnywhereBreak#1}%
+ \FV@BreakBuffer@Append{\FancyVerbBreakAnywhereBreak#1}%
\FV@Break@Scan}
% \end{macrocode}
% \end{macro}
@@ -5362,57 +5776,57 @@
\FV@Break@Next{#1}%
}
\def\FV@Break@BeforeAfterTokenNoBreak@UTF#1{%
- \g@addto@macro{\FV@TmpLine}{#1}%
+ \FV@BreakBuffer@Append{#1}%
\def\FV@LastToken{#1}%
\FV@Break@Scan}
\def\FV@Break@BeforeTokenBreak@UTF#1{%
\def\FV@CurrentToken{#1}%
- \ifthenelse{\boolean{FV@BreakBeforeGroup}}%
+ \ifbool{FV@breakbeforeinrun}%
+ {\ifcsname FV@BreakAfter@Token\detokenize{#1}\endcsname
+ \FV@BreakBuffer@Append{\FancyVerbBreakBeforeBreak}%
+ \let\FV@Break@Next\FV@Break@BeforeTokenBreak@AfterRescan@UTF
+ \def\FV@RescanToken{#1}%
+ \else
+ \FV@BreakBuffer@Append{\FancyVerbBreakBeforeBreak#1}%
+ \let\FV@Break@Next\FV@Break@Scan
+ \def\FV@LastToken{#1}%
+ \fi}%
{\ifx\FV@CurrentToken\FV@LastToken\relax
\ifcsname FV@BreakAfter@Token\detokenize{#1}\endcsname
\let\FV@Break@Next\FV@Break@BeforeTokenBreak@AfterRescan@UTF
\def\FV@RescanToken{#1}%
\else
- \g@addto@macro{\FV@TmpLine}{#1}%
+ \FV@BreakBuffer@Append{#1}%
\let\FV@Break@Next\FV@Break@Scan
\def\FV@LastToken{#1}%
\fi
\else
\ifcsname FV@BreakAfter@Token\detokenize{#1}\endcsname
- \g@addto@macro{\FV@TmpLine}{\FancyVerbBreakBeforeBreak}%
+ \FV@BreakBuffer@Append{\FancyVerbBreakBeforeBreak}%
\let\FV@Break@Next\FV@Break@BeforeTokenBreak@AfterRescan@UTF
\def\FV@RescanToken{#1}%
\else
- \g@addto@macro{\FV@TmpLine}{\FancyVerbBreakBeforeBreak#1}%
+ \FV@BreakBuffer@Append{\FancyVerbBreakBeforeBreak#1}%
\let\FV@Break@Next\FV@Break@Scan
\def\FV@LastToken{#1}%
\fi
\fi}%
- {\ifcsname FV@BreakAfter@Token\detokenize{#1}\endcsname
- \g@addto@macro{\FV@TmpLine}{\FancyVerbBreakBeforeBreak}%
- \let\FV@Break@Next\FV@Break@BeforeTokenBreak@AfterRescan@UTF
- \def\FV@RescanToken{#1}%
- \else
- \g@addto@macro{\FV@TmpLine}{\FancyVerbBreakBeforeBreak#1}%
- \let\FV@Break@Next\FV@Break@Scan
- \def\FV@LastToken{#1}%
- \fi}%
\FV@Break@Next}
\def\FV@Break@BeforeTokenBreak@AfterRescan@UTF{%
\expandafter\FV@Break@AfterTokenBreak@UTF\expandafter{\FV@RescanToken}}
\def\FV@Break@AfterTokenBreak@UTF#1{%
\def\FV@LastToken{#1}%
\@ifnextchar\FV@FVSpaceToken%
- {\g@addto@macro{\FV@TmpLine}{#1}\FV@Break@Scan}%
- {\ifthenelse{\boolean{FV@BreakAfterGroup}}%
- {\g@addto@macro{\FV@TmpLine}{#1}%
+ {\FV@BreakBuffer@Append{#1}\FV@Break@Scan}%
+ {\ifbool{FV@breakafterinrun}%
+ {\FV@BreakBuffer@Append{#1\FancyVerbBreakAfterBreak}%
+ \let\FV@Break@Next\FV@Break@Scan}%
+ {\FV@BreakBuffer@Append{#1}%
\ifx\@let@token\bgroup\relax
\let\FV@Break@Next\FV@Break@AfterTokenBreak@Group@UTF
\else
\let\FV@Break@Next\FV@Break@AfterTokenBreak@UTF@i
\fi}%
- {\g@addto@macro{\FV@TmpLine}{#1\FancyVerbBreakAfterBreak}%
- \let\FV@Break@Next\FV@Break@Scan}%
\FV@Break@Next}%
}
\def\FV@Break@AfterTokenBreak@UTF@i#1{%
@@ -5423,30 +5837,27 @@
\def\FV@NextToken{#1}%
\ifx\FV@LastToken\FV@NextToken
\else
- \g@addto@macro{\FV@TmpLine}{\FancyVerbBreakAfterBreak}%
+ \FV@BreakBuffer@Append{\FancyVerbBreakAfterBreak}%
\fi
\let\FV@Break@Next\FV@Break@Scan
\fi
\FV@Break@Next#1}
\def\FV@Break@AfterTokenBreak@Group@UTF#1{%
- \g@addto@macro{\FV@TmpLine}{{#1}}%
\ifstrempty{#1}%
- {\let\FV@Break@Next\FV@Break@AfterTokenBreak@Group@UTF@i}%
- {\let\FV@Break@Next\FV@Break@Scan\let\FV@LastToken=\FV@Undefined}%
- \FV@Break@Next}
-\def\FV@Break@AfterTokenBreak@Group@UTF@i{%
- \@ifnextchar\bgroup%
- {\FV@Break@Scan}%
- {\FV@Break@AfterTokenBreak@Group@UTF@ii}}
-\def\FV@Break@AfterTokenBreak@Group@UTF@ii#1{%
+ {\FV@BreakBuffer@Append{{}}%
+ \@ifnextchar\bgroup
+ {\FV@Break@Group}%
+ {\FV@Break@AfterTokenBreak@Group@UTF@i}}%
+ {\FV@Break@Group{#1}}}
+\def\FV@Break@AfterTokenBreak@Group@UTF@i#1{%
\ifcsname FV@U8:\detokenize{#1}\endcsname
\expandafter\let\expandafter\FV@Break@Next\csname FV@U8:\detokenize{#1}\endcsname
- \let\FV@UTF@octets@after\FV@Break@AfterTokenBreak@Group@UTF@ii
+ \let\FV@UTF@octets@after\FV@Break@AfterTokenBreak@Group@UTF@i
\else
\def\FV@NextToken{#1}%
\ifx\FV@LastToken\FV@NextToken
\else
- \g@addto@macro{\FV@TmpLine}{\FancyVerbBreakAfterBreak}%
+ \FV@BreakBuffer@Append{\FancyVerbBreakAfterBreak}%
\fi
\let\FV@Break@Next\FV@Break@Scan
\fi
@@ -5508,9 +5919,9 @@
\savebox{\FV@LineBox}{%
\advance\FV@LineWidth by -\FV@BreakIndent
\hbox to \FV@BreakIndent{\hfill}%
- \ifthenelse{\boolean{FV@BreakAutoIndent}}%
+ \ifbool{FV@breakautoindent}%
{\let\FV@LineIndentChars\@empty
- \FV@GetLineIndent#1\FV@Undefined
+ \FV@GetLineIndent#1\FV@Sentinel
\savebox{\FV@LineIndentBox}{\FV@LineIndentChars}%
\hbox to \wd\FV@LineIndentBox{\hfill}%
\advance\FV@LineWidth by -\wd\FV@LineIndentBox
@@ -5529,12 +5940,11 @@
\noindent\hspace*{-\FV@BreakIndent}%
\ifdefempty{\FancyVerbBreakSymbolLeft}{}{%
\hspace*{-\FV@BreakSymbolIndentLeft}}%
- \ifthenelse{\boolean{FV@BreakAutoIndent}}%
+ \ifbool{FV@breakautoindent}%
{\hspace*{-\wd\FV@LineIndentBox}}%
{}%
\FV@BreakByTokenAnywhereHook
- \strut\FancyVerbFormatText{%
- \FancyVerbBreakStart #1\FancyVerbBreakStop}\nobreak\strut
+ \strut\FV@InsertBreaks{\FancyVerbFormatText}{#1}\nobreak\strut
\end{internallinenumbers*}
}%
\ifdefempty{\FancyVerbBreakSymbolRight}{}%
@@ -5569,6 +5979,8 @@
\setcounter{FV@TrueTabCounter}{0}%
\fi
\sbox{\FV@LineBox}{%
+ \let\FancyVerbBreakStart\relax
+ \let\FancyVerbBreakStop\relax
\FancyVerbFormatLine{%
%\FancyVerbHighlightLine %<-- Default definition using \rlap breaks breaking
{\FV@ObeyTabs{\FancyVerbFormatText{#1}}}}}%
@@ -5596,6 +6008,8 @@
\let\FV@Tab\FV@TrueTab
\fi
\else
+ \let\FancyVerbBreakStart\relax
+ \let\FancyVerbBreakStop\relax
\FV@LeftListNumber
\FV@LeftListFrame
\FancyVerbFormatLine{%
@@ -5790,6 +6204,8 @@
% In the |breakbytoken| cases, an |\hbox| is used to prevent breaks within the macro (breaks could occur at spaces even without |\FancyVerbBreakStart|). The |breakbytokenanywhere| case is similar but a little tricky. |\FV@BreakByTokenAnywhereHook|, which is inside |\FV@SaveLineBox| where line breaking occurs, is used to define |\FV@BreakByTokenAnywhereBreak| so that it will ``do nothing'' the first time it is used and on subsequent invocations become |\FancyVerbBreakByTokenAnywhereBreak|. Because the hook is within the |internallinenumbers*| environment, the redefinition doesn't escape, and the default global definition of |\FV@BreakByTokenAnywhereBreak| as |\relax| is not affected. We don't want the actual break to appear before the first Pygments macro in case it might cause a spurious break after leading whitespace. But we must have breaks \emph{before} Pygments macros because otherwise lookahead would be necessary.
%
% An intermediate variable |\FV@PYG| is defined to avoid problems in case |#1|$=$|#2|. There is also a check for a non-existant |#2| (|\PYG|\meta{style\_name} may not be created until a later compile in the \pkg{pythontex} case); if |#2| does not exist, fall back to |#1|. For the existance check, |\ifx...\relax| must be used instead of |\ifcsname|, because |#2| will be a macro, and will typically be created with |\csname...\endcsname| which will |\let| the macro to |\relax| if it doesn't already exist.
+%
+% |\FV@PYG@Redefed| is |\let| to the Pygments macro that appears literally (after redefinition), so that it can be detected elsewhere to allow for special processing, such as in |breakautoindent|.
% \begin{macrocode}
\def\FV@VerbatimPygments#1#2{%
\edef\FV@PYG@Literal{\expandafter\FV@DetokMacro@StripSpace\detokenize{#1}}%
@@ -5798,9 +6214,9 @@
\def\FV@BreakAfterPrep@PygmentsHook{%
\expandafter\FV@BreakAfterPrep@Pygments\expandafter{\FV@PYG@Literal}}%
\ifx#2\relax
- \let\FV@PYG#1%
+ \let\FV@PYG=#1\relax
\else
- \let\FV@PYG#2%
+ \let\FV@PYG=#2\relax
\fi
\ifbool{FV@breakbytoken}%
{\ifbool{FV@breakbytokenanywhere}%
@@ -5814,6 +6230,7 @@
\leavevmode\hbox{\FV@PYG{##1}{##2}}}}}%
{\def#1##1##2{%
\FV@PYG{##1}{\FancyVerbBreakStart##2\FancyVerbBreakStop}}}%
+ \let\FV@PYG@Redefed=#1\relax
}
\let\FV@BreakByTokenAnywhereBreak\relax
\def\FV@DetokMacro@StripSpace#1 {#1}
diff --git a/macros/latex/contrib/fvextra/fvextra.ins b/macros/latex/contrib/fvextra/fvextra.ins
index f51badf010..f36b3c4715 100644
--- a/macros/latex/contrib/fvextra/fvextra.ins
+++ b/macros/latex/contrib/fvextra/fvextra.ins
@@ -1,4 +1,4 @@
-%% Copyright (C) 2016-2017 by Geoffrey M. Poore <gpoore@gmail.com>
+%% Copyright (C) 2016-2022 by Geoffrey M. Poore <gpoore@gmail.com>
%% --------------------------------------------------------------------------
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -18,6 +18,7 @@
\input docstrip.tex
\keepsilent
+\askforoverwritefalse
\usedir{tex/latex/fvextra}
@@ -25,7 +26,7 @@
This is a generated file.
-Copyright (C) 2016-2017 by Geoffrey M. Poore <gpoore@gmail.com>
+Copyright (C) 2016-2022 by Geoffrey M. Poore <gpoore@gmail.com>
--------------------------------------------------------------------------
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
diff --git a/macros/latex/contrib/fvextra/fvextra.pdf b/macros/latex/contrib/fvextra/fvextra.pdf
index 2ab6b4c164..d66fe66d14 100644
--- a/macros/latex/contrib/fvextra/fvextra.pdf
+++ b/macros/latex/contrib/fvextra/fvextra.pdf
Binary files differ
diff --git a/macros/latex/contrib/ukbill/README b/macros/latex/contrib/ukbill/README
new file mode 100644
index 0000000000..37a43be539
--- /dev/null
+++ b/macros/latex/contrib/ukbill/README
@@ -0,0 +1,15 @@
+ukbill - easily typeset UK legislation
+
+version: 1.0.0
+
+This package provides formatting to easily typeset draft UK legislation. The libre font Palatine Parliamentary is required to use this package: https://github.com/ezgranet/palatine-parliamentary
+
+This work may be distributed and/or modified under the conditions of the
+LaTeX Project Public License (LPPL), version 1.3c or later.
+
+
+For suggestions, feature requests, and bug reports, please use the project's
+GitHub site: https://github.com/ezgranet/ukbill
+
+Version history:
+1/12/2022: package creation \ No newline at end of file
diff --git a/macros/latex/contrib/ukbill/immigration-bill.pdf b/macros/latex/contrib/ukbill/immigration-bill.pdf
new file mode 100644
index 0000000000..14322d0ae7
--- /dev/null
+++ b/macros/latex/contrib/ukbill/immigration-bill.pdf
Binary files differ
diff --git a/macros/latex/contrib/ukbill/immigration-bill.tex b/macros/latex/contrib/ukbill/immigration-bill.tex
new file mode 100644
index 0000000000..ff40d40aad
--- /dev/null
+++ b/macros/latex/contrib/ukbill/immigration-bill.tex
@@ -0,0 +1,251 @@
+\documentclass[private]{ukbill}
+\drafter{The Drafter of the Bill (Mr E Z Granet)}
+\billcopyright{\ccbysa\, This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International Licence.}
+\publishedby{the drafter}
+\billtitle{Commonwealth (Designated Realms) Bill}
+\billto{Make provision in connection with citizens of certain Commonwealth Realms.}
+\humanrights{\printdrafter\ has made the following statement, which a minister would be obliged to give under section 19(1)(a), of the Human Rights Act 1998:
+\vspace{1ex}
+
+In my view the provisions of the \printbilltitle are compatible with the Convention rights.\\
+}
+\exptitle{Explanatory Notes}
+\exptext{Explanatory notes to the Bill, prepared by the Drafter, are forthcoming.}
+\billnum{00/01}
+\whereas{\begin{numstat}
+ \item It behooves me
+\end{numstat}}
+\begin{document}
+\chapter{Introductory Provisions}
+\section{General Definitions}
+
+\begin{numstat}
+\item In this Act, the following definitions apply:
+\begin{alphstat}
+ \item `public authority' has the same meaning as under the Human Rights Act 1998;
+ \item the term `Application Day' refers to the date one-hundred and eighty days following the commencement of this Act
+ \end{alphstat}
+\end{numstat}
+
+\section{Definition of `non-designated Realm'}
+\begin{numstat}
+ \item In this Act, the term `non-designated Realm' refers to an independent sovereign State recognised by His Majesty's Government, which fulfils all of the following criteria:
+\begin{alphstat}
+\item the State is a member of the Commonwealth of Nations
+\item the the headship of state is vested in the person of His Majesty the King, and her heirs and successors according to law;
+\item in the State's legal system, final appellate jurisdiction does not lie with His Majesty in Council.
+ \end{alphstat}
+ \end{numstat}
+
+\section{Definition of `designated Realm'}
+\begin{numstat}
+ \item In this Act, the term `designated Realm' refers to the following:
+ \begin{alphstat}\item An independent sovereign State recognised by His Majesty's Government, which fulfils all of the following criteria:
+\begin{romstat}
+\item the State is a member of the Commonwealth of Nations
+\item the the headship of state is vested in the person of His Majesty the King, and her heirs and successors according to law;
+\item in the State's legal system, final appellate jurisdiction lies with His Majesty in Council.
+ \end{romstat}
+\item A non-independent polity (including, but not limited to: province, federal state, sub-division, territory, dependency, or associated state) which fulfils all of the following criteria:
+ \begin{romstat}
+ \item it shares a common citizenship with a non-designated Realm
+ \item in the legal system of the non-independent sub-division, territory, dependency, or associated state, final appellate jurisdiction lies with His Majesty in Council.
+ \end{romstat}
+
+ \end{alphstat}
+
+ \end{numstat}
+
+
+
+\section{Definition of `citizen of a designated Realm'}
+\begin{numstat}
+\item The term `citizen of a designated Realm' refers to all of the following:
+\begin{alphstat}
+ \item with regards to designated Realms which are independent States, individuals, who, under the respective law of a designated Realm, possesses the citizenship of said designated Realm
+ \begin{romstat}
+ \item The preceding provision does not apply in cases where an individual holds the citizenship of a designated Realm aquired primarily as the result of investment or investments, payment, or other pecuniary considerations (including cases where the individual is the dependent of the person who made the pecuniary contribution to aquire such citizenship, or where they have their citizenship only as the result of descent from an individual who gave such pecuniary contribution to aquire citizenship), as opposed to residence, unless such an individual has spent at least least four years of a continguous five year period physically present in the sovereign territory of the designated Realm
+ \end{romstat}
+ \item with regards to to designated realms which are not independent States, individuals who both:
+\begin{romstat}
+ \item hold the citizenship of the non-designated Realm of or to which the designated Realm is part or affiliated, under the domestic law of the non-designated Realm; and
+ \item have not aquired such citizenship primarily as the result of investment or investments, payment, or other pecuniary considerations, as opposed to residence, unless such an individual has spent at least least four years of a continguous five year period physically present in the sovereign territory of the non-designated Realm
+ \item hold, in the designated Realm, a permanent status of affiliation, which may be referred to by terms including but not limited to: `permanent residence', `belonger status', `nationality'
+\end{romstat}
+\end{alphstat}
+
+\end{numstat}
+
+
+\section{Register of designated Realms}
+\begin{numstat}
+\item Schedule 1 of this Act shall be referred to as the Register of designated Realms (hereinafter, `the Register')
+\begin{alphstat}
+ \item The Register is a comprehensive record of all polities which meet the criteria to designated Realms
+ \item With regards to designated Realms which are not independent States, the Register also records the status or statuses (as the case may be) of permanent affiliation acceptable under the domestic law of the designated Realm which serve to help qualify an individual as a citizen of a designated Realm under the criterion in section 4(\emph{b})(ii) of this Act.
+\end{alphstat}
+\item In the event subsequent to the passage of this Act that changes in the domestic legal and constitutional arrangements of a polity listed on the Register are such that the Secretary of State no longer considers the polity to constitute a designated Realm as defined in this Act, the Secretary of State shall have the power to amend the Register, by way of statutory instrument so as to remove the polity in question from it.
+\begin{alphstat}
+ \item The instrument shall specify the date upon which it takes effect, provided that the instrument removing a polity from the register may take effect sooner than 1 year following its laying.
+ \item Subject to the preceding provision, Secretary of State may vary the date at which delisting takes effect by further statutory instrument.
+ \item In the period between the laying of the instrument and it taking effect, the Secretary of State shall grant all citizens of the polity being removed who are domiciled in the United Kingdom the opportunity to apply, without charge, for permanent settlement in the UK following the delisting of their polity of citizenship from the Register, and shall generally grant such settled status except where clear and convincing circumstances indicate that it is a necessary and proportionate measure in the public interest to deny such status to an applicant.
+\end{alphstat}
+
+\item In the event subsequent to the passage of this Act that changes in the domestic legal and constitutional arrangements of a polity not listed on the Register are such that the Secretary of State now considers the State (or, as the case may be, non-independent polity eligible to be considered a designated Realm) to constitute a designated Realm, the Secretary of State shall have the power to amend the Register, by way of statutory instrument so as to add the State (or, as the case may be, non-independent polity eligible to be considered a designated Realm) in question to it.
+
+\item In the event subsequent to the passage of this act that changes in the domestic legal and constitutional arrangements of a non-independent polity considered a designated Realm are such that the Secretary of State now considers that the qualifying permanent status of affiliation listed in the Register requires revision, or that a new non-independent polity is added to the Register, the Secretary of State shall have the power to amend the Register, by way of statutory instrument so as alter or add a record of qualifying status of permanent affiliation recorded there.
+\item In the event that a designated Realm changes its official name, the Secretary of State shall have to amend the Register, by way of statutory instrument, so as to record the correct name.
+\item A court or tribunal shall regard a State's presence or absence from the Register as conclusive, irrebutable evidence of whether or not a State (or, as the case may be, non-independent polity eligible to be considered a designated Realm) is or is not a designated Realm.
+\begin{alphstat}
+\item The preceding provision does not in any way affect the amenability or unamenability (as the case may be) to judicial review of the decisions of the Secretary of State under existing law, expressly including those decisions with regards to the content of the Register.
+ \end{alphstat}
+\item A statutory instrument containing amendments under this section is subject to annulment in pursuance of a resolution of either House of Parliament.
+ \end{numstat}
+
+
+
+\chapter{Treatment of Citizens}
+
+\section{Treatment of citizens of designated Realms}
+
+
+\begin{numstat}
+\item The succeeding provisions in this section shall come into force upon Application Day
+\item A public authority shall treat and regard citizens of designated Realms in like manner to how said authority treats and regards citizens of Ireland (with reference to all of law, policy, custom and practice) according to the former category of citizens all the rights, privileges, and obligations enjoyed by and incumbent upon the latter category of citizens.
+\item Except where to do so would cause manifest absurdity, all references in existing legislation to citizens of Ireland shall be generally interpreted as applying to citizens of designated Realms
+ \begin{alphstat}
+\item The references in the preceding provisions to the manner of treatment of the citizens of Ireland and the rights, privileges, and obligations enjoyed by and incumbent upon said citizens shall be interpreted as referring only to the manner treatment of and rights, privileges, and obligations enjoyed by and incumbent upon said citizens subsisting prior to Application Day.
+\item In accordance with the above, no changes to the manner of treatment of nor the rights, privileges, and obligations enjoyed by and incumbent upon the citizens of Ireland which occur subsequent to Application Day shall be relevant for the purposes of this Act.
+
+\end{alphstat}
+\item The applicability of the preceding provision shall be subject to the provisions contained in the subsequent sections of this Act. \end{numstat}
+\section{Saving provisions}
+\begin{numstat}
+\item Nothing in this Act shall be construed so as to affect, diminish, or erase criminal nor civil liability for actions which were unlawful prior to the coming into force of this Act, and, following the commencement of this act, a public authority may continue bring criminal prosecutions, civil actions, administrative penalties, and similar measures against citizens of designated Realms for circumstances occurring prior to Application Day.
+\item Notwithstanding anything else in this Act, the following shall continue to remain valid, legal, executable, and enforceable following lawfulness of the following, and a public authority may disapply section 3 of this Act to the extent necessary to maintain said validity, legality, executability, and enforceability, insofar as the following occurred, arose, commenced, began, or were initiated (as applicable) prior to Application Day:
+\begin{alphstat}
+ \item Removal orders
+ \item Lawful detention, including for the purposes of immigration enforcement
+ \item All administrative measures and policies with the effect of banning or excluding an individual from entering the United Kingdom, either temporarily or permanently
+ \begin{romstat}
+ \item The preceding provision applies only to those administrative measures and policies which name the specific individual banned or excluded, and does not apply to administrative measures or policies general or non-specific bans or exclusions \end{romstat}
+ \end{alphstat}
+\end{numstat}
+\section{Disapplication}
+\begin{numstat}
+ \item Other than as expressly provided for in the provisions of this Act, a public authority may not disapply section 3 of this Act.
+ \item Where a citizen of a designated Realm committed a criminal offence or offences prior to Application Day which, but for the operation of section 3 of this Act, would have given rise to liability to removal from the United Kingdom, a public authority may disapply section 3 of this Act and seek the removal of said citizen of a designated Realm.
+ \item Where a citizen of a designated Realm engaged in fraud or deception prior to Application Day which, but for the operation of section 3 of this Act, would have given rise to liability to removal from the United Kingdom, a public authority may disapply section 3 of this Act and seek the removal of said citizen of a designated Realm.
+ \item In the event that circumstances individual to a particular citizen of a designated Realm are such that the application of section 3 of this Act to said citizen of a designated Realm would pose a severe and imperative threat to national security, public health, public order, animal life, plant life, or human life, and disapplication is a necessary and proportionate response to this danger, and where no lesser measures would suffice, the Secretary of Statemay, by means of a public notice published in the London Gazette, disapply section 3 of this Act with respect to that individual.\begin{alphstat}
+ \item Such a declaration must contain detailed reasons for the Secretary of State's decision.
+ \item Such a notice shall take effect, unless otherwise specified, seven days following its publication in the London Gazette.
+ \item No declaration under this subsection shall be effective if it refers to more than one individual.
+\end{alphstat}
+\end{numstat}
+
+\section{Consequential and supplementary provision}
+\begin{nostat}
+\item The Secretary of State or any appropriate Minister may at any time by order make such incidental, consequential, transitional or supplementary provision as may appear to him or her to be necessary or proper for the general or any particular purposes of this Act or in consequence of any of the provisions thereof or for giving full effect thereto.
+\end{nostat}
+
+
+
+
+\chapter{Identification matters}
+\section{Evidence of citizenship (case of independent designated Realms)}
+\begin{numstat}
+\item Where a public authority or private actor requires evidence that a person is a citizen of an independent designated Realm, a passport from such an independent designated Realm shall be acceptable evidence, provided that there is no reasonable suspicion that the passport belongs to an individual other than the bearer, or is forged or altered.
+\begin{alphstat}
+\item The Secretary of State is empowered to create, by way of statutory instrument, other forms of identification, such as national identity cards, issued by an independent designated Realm or Realms which will suffice as evidence
+\begin{romstat}
+ \item In the event such an instrument is issued, the Secretary of State shall issued detailed guidance for public authorities and private actors on how to recognise authentic forms of such identification.
+\end{romstat}
+\end{alphstat}
+\end{numstat}
+
+\section{Evidence of citizenship (case of non-independent designated Realms)}
+\begin{numstat}
+\item Subsection one of this section shall apply to citizens of non-independent designated Realms with regards to evidencing the required status described in section 4(\textit{b})(i) of this Act.
+\item For the additional status described in section 4(\textit{b})(ii) of this Act, an endorsement in a passport, or record of location of birth in a passport, will suffice as evidence for a public authority or private actor unless there is reason to suspect the endorsement or location of birth does not refer to the bearer or is fraudulent.
+\item The Secretary of State may, by way of statutory instrument, designate, for each non-independent polity, specific requirements for proof of the status in section 4(\textit{b})(ii) of this Act.
+\item For each non-independent polity on the Register, the Secretary of State shall issued detailed guidance on how to identify the authentic forms of recognised identification.
+\end{numstat}
+
+\section{Special rules for designated realms which sell citizenship}
+\begin{numstat}
+ \item At least 28 days before Application Day, the Secretary of State shall publish, by way of statutory instrument, a list of designated Realms which are known to to sell or grant citizenship in exchange for investments, payments, or other primarily pecuniary considerations (hereinafter referred to as `designated Realms which sell citizenship').
+ \item The Secretary of State may, by way of statutory instrument alter this register from time to time as necessary to reflect any changes in the factual circumstances.
+ \item For individuals who are citizens of designated Realms which sell citizenship, the evidence for demonstrating citizenship set out in sections nine and ten of this Act must be accompanied by one of the following to be sufficient:
+ \begin{alphstat}
+ \item A sworn declaration witnessed by a member of a profession authorised to act as a Comissioner for Oaths attesting that the individual did not aquire their citizenship in exchange for pecuniary considerations as defined in section four of this Act.
+ \item sworn declaration witnessed by a member of a profession authorised to act as a Comissioner for Oaths attesting that the individual did aquire their citizenship in exchange for pecuniary considerations as defined by section four of this Act, but meet the criteria for the residency exception set out in section four of this Act for.
+ \end{alphstat}
+ \item Any individual unable to provide such evidence shall not be considered a citizen of a designated Realm.
+ \item For the purposes of clarifying existing criminal law, declarations made under the preceeding provisions which are untrue are considered to constitute the common law offence of perverting the course of justice.
+
+\end{numstat}
+\section{Negating effect of deception}
+\begin{nostat}
+ \item No individual shall be considered a citizen of a designated realm where the preponderance of available evidence demonstrates that the individual engaged in deception towards a public authority or private person regarding any matter related to evidence of his or her citizenship of a designated Realm.
+\end{nostat}
+
+
+\section{Short title and extent}
+\begin{numstat}
+ \item This Act may be cited as the Commonwealth (Designated Realms) Act 2022.
+ \item This Act applies to England, Wales, Scotland, and Northern Ireland.
+\end{numstat}
+
+%\begin{numstat}
+%
+%
+%\end{numstat}
+%
+
+\startschedule
+
+\schedule{Register of designated Realms}
+\schdpart{Designated Realms which are independent States}
+
+\begin{nostat}
+\item[1] The following States are designated Realms:
+\begin{numstat}
+ \item Antigua and Barbuda
+ \item Commonwealth of the Bahamas
+ \item Grenada
+ \item Jamaica
+ \item Federation of Saint Christopher (Saint Kitts) and Nevis
+ \item Saint Lucia
+ \item Saint Vincent and the Grenadines
+ \item Tuvalu
+\end{numstat}
+
+\end{nostat}
+
+
+\schdpart{Designated Realms which are not independent States}
+
+\noindent\emph{List of polities}
+
+\begin{nostat}
+\item[1] The following polities are designated Realms:
+\begin{numstat}
+\item Cook Islands
+\begin{alphstat}
+ \item For the above polity, the statuses of `Cook Islander' and `permanent resident', as endorsed in a New Zealand passport, qualify for the purposes of section 5(4)(\textit{b})(iii) of this Act
+\end{alphstat}
+\item Niue
+\begin{alphstat}
+ \item For the above polity, the following statuses or qualities qualify for the purposes of section 5(4)(\textit{b})(iii) of this Act:
+ \begin{romstat}
+ \item permanent resident
+ \item Birth in Niue (both for Niueans and non-Niueans)
+ \item Someone whose parent is a New Zealand citizen born in Niue
+ \item Someone who has at least one parent who is a New Zealand citizen born in Niue
+ \item Someone who has at least one parent who is a permanent resident and ordinarily resident in Niue, as defined by the Immigration Act 2011 (Niue)
+ \end{romstat}
+\end{alphstat}
+\end{numstat}
+\end{nostat}
+
+\end{document} \ No newline at end of file
diff --git a/macros/latex/contrib/ukbill/ukbill-documentation.pdf b/macros/latex/contrib/ukbill/ukbill-documentation.pdf
new file mode 100644
index 0000000000..4aa3296367
--- /dev/null
+++ b/macros/latex/contrib/ukbill/ukbill-documentation.pdf
Binary files differ
diff --git a/macros/latex/contrib/ukbill/ukbill-documentation.tex b/macros/latex/contrib/ukbill/ukbill-documentation.tex
new file mode 100644
index 0000000000..9548c4c7ae
--- /dev/null
+++ b/macros/latex/contrib/ukbill/ukbill-documentation.tex
@@ -0,0 +1,783 @@
+\documentclass{article}
+\usepackage{verbatim}
+\usepackage{xcolor}
+\usepackage{luaquotes}
+\usepackage{longtable}
+\definecolor{darkspringgreen}{rgb}{0.09, 0.45, 0.27}
+\definecolor{dsg}{rgb}{0.09, 0.45, 0.27}
+\usepackage[hidelinks]{hyperref}
+\usepackage{hologo}
+\usepackage[british]{babel}
+\usepackage[useregional]{datetime2}
+\DTMlangsetup[en-GB]{ord=omit}
+\definecolor{LightGray}{gray}{0.9}
+%\usepackage{mathpazo}
+\usepackage{fontspec}
+\IfFontExistsTF{Palatine Parliamentary}{\setromanfont[RawFeature={+onum,+pnum},%
+BoldFont={Palatine Parliamentary Bold},
+ItalicFont={Palatine Parliamentary Italic}]{Palatine Parliamentary Regular}
+}{\setromanfont[RawFeature={+onum,+pnum}]{TeX Gyre PagellaX}}
+\setmonofont[Scale=.9]{Source Code Pro}
+%\newfontface\primeback[Scale=1.01]{Libertinus Serif}
+\newcommand{\primeback}{}
+
+\newfontface\boxy{DejaVu Sans}
+\newcommand{\thebox}{{\boxy ▯}}
+%\usepackage[firstnumber=last]{fancyvrb}
+\usepackage{minted}
+\date{\today\\\smallskip\ttfamily Version 1.0.0}
+\author{Elijah Z Granet\thanks{e-mail: \href{mailto:ezg21@cantab.ac.uk}{\ttfamily ezg21@cantab.ac.uk}}}
+
+\title{\texttt{ukbill}:\\A package for typesetting UK legislation}
+
+\begin{document}
+\maketitle
+\tableofcontents
+\clearpage
+\section{Overview}
+This is a class for typesetting bills in the standard used by the Parliament of the United Kingdom. It is meant to be of use to students of law and politics, to Parliamentary agents and lawyers drafting private bills, and to aid in the construct of proposals for law reform. The use of this package requires the libre font `Palatine Parliamentary', which imitates the official typeface of the UK Parliament.\footnote{The font is available at this link: \url{https://github.com/ezgranet/palatine-parliamentary}}
+\section{Usage}
+For an example of the usage of the package, please see the attached `\texttt{immigration-bill.tex}' example in the package archive.
+
+\subsection{Calling the package}
+Call the package with {\color{darkspringgreen}\ttfamily \verb|\documentclass{ukbill}|}
+\subsection{Declaring variables}
+In your preamble, declare the following variables to populate your bill.
+\begin{center}
+\begin{tabular}{lp{2.5in}}
+\bfseries Variable name & \bfseries Explanation\\
+\ttfamily \verb|\drafter{}| & The drafter of the bill\\
+\ttfamily \verb|\billcopyright{}| & Copyright notice at the end of the bill \\
+\ttfamily \verb|\publishedby{}| & The publisher of the bill for notice at the end of the bill \\
+\ttfamily\verb|\billtitle{}| & The title of the bill\\
+\ttfamily \verb|billto{}| & { The purpose or long title of the bill}\\
+\ttfamily \verb|\humanrights{}| & The statutorily required statement under the Human Rights Act 1998\\
+\ttfamily \verb|\exptitle{}| & The title of the explanatory section—if you have extra notes added separately, title it `Explanatory Notes'; otherwise use `Explanatory Memorandum'\\
+\ttfamily \verb|\exptext{}| & The content of the explanatory memorandum (or notice about separate explanatory notes)\\
+\ttfamily \verb|\billnum{}| & The number of the bill for the cover sheet and back page\\
+\ttfamily \verb|\whereas{}| &
+This variable is needed \textbf{only} in the \texttt{private} option of the class. It contains the recitals, best formatted as a numbered list
+\end{tabular}
+
+\end{center}
+
+
+\subsection{Bill parts}
+The command {\color{darkspringgreen}\ttfamily\verb|\chapter|} divides the main content of the bill up into appropriate parts noted in the Table of Contents. For example, `Introductory Provisions'.
+\subsection{Sections}
+The section is the main unit of legislation and is titled with {\color{darkspringgreen}\ttfamily\verb|\section|}. Most sections will be numbered and numbered subsections use the {\color{darkspringgreen}\ttfamily\verb|numstat|} environment as follows:
+\begin{minted}[
+frame=lines,
+framesep=2mm,
+baselinestretch=1.2,
+bgcolor=LightGray,
+fontsize=\footnotesize,
+breaklines,
+firstnumber=last
+]
+{latex}
+\begin{numstat}
+ \item The first provision
+ \item The second provision
+\end{numstat}
+\end{minted}
+
+Often, these sections will be nested with alphabetical subsubsections, Roman paragraphs, and double alphabetical (\textit{ie}, `aa') subparagraphs. These are called with {\color{darkspringgreen}\ttfamily\verb|alphstat|}, {\color{darkspringgreen}\ttfamily\verb|romstat|}, and {\color{darkspringgreen}\ttfamily\verb|twoalphstat|}, respectively.
+\begin{minted}[
+frame=lines,
+framesep=2mm,
+baselinestretch=1.2,
+bgcolor=LightGray,
+fontsize=\footnotesize,
+breaklines,
+firstnumber=last
+]
+{latex}
+\begin{numstat}
+ \item A subsection
+ \begin{alphstat}
+ \item Nesting
+ \begin{romstat}
+ \item Even more nesting
+ \begin{twoalphstat}
+ \item this is too much nesting now, lads
+ \end{twoalphstat}
+ \end{romstat}
+ \end{alphstat}
+ \item a subsection again
+\end{numstat}
+\end{minted}
+
+
+Occasionally, a section will have only one provision, and therefore no numbering is needed. In this case, use the {\color{darkspringgreen}\ttfamily\verb|nostat|} environment.
+
+\begin{minted}[
+frame=lines,
+framesep=2mm,
+baselinestretch=1.2,
+bgcolor=LightGray,
+fontsize=\footnotesize,
+breaklines,
+firstnumber=last
+]
+{latex}
+\begin{nostat}
+ \item The first provision
+ \item The second provision
+\end{nostat}
+\end{minted}
+
+\subsection{Schedules}
+
+Some legislation requires schedules appended to the body of main legislation. To begin typesetting schedules (as opposed to the preceding main content of the bill), use the command {\color{darkspringgreen}\ttfamily\verb|\startschedule|}
+
+A schedule is then named by the command {\color{darkspringgreen}\ttfamily\verb|\schedule{Name}|}, while a Part (\textit{ie}, a subset of a schedule) is called using {\color{darkspringgreen}\ttfamily\verb|\schdpart{name}|}
+
+\subsection{The `private' Option}
+
+Private bills have a different enacting formula and also make use of recitals. Drafting private bills therefore requires you to call the class with the option {\color{darkspringgreen}\ttfamily\verb|\documentclass[private]{ukbill}|}
+
+ \section{Future Development }
+ The package's online repository is the best place to report bugs, feature requests, or other contributions, and is located at: \\\url{github.com/ezgranet/ukbill}.
+
+ \section{Licence}
+ This project is licensed under the Latex Public Project Licence version 1.3\textit{c}. This documentation is copyright of the author but licensed under CC-BY-SA 4.0.
+ \section{Version History}
+\subsection{\normalfont\texttt{1.0.0}}
+\ttfamily 1 December 2022: Class Creation
+
+
+ \clearpage\section{Implementation}
+
+\begin{minted}[
+frame=lines,
+framesep=2mm,
+baselinestretch=1.2,
+bgcolor=LightGray,
+fontsize=\footnotesize,
+linenos,
+breaklines,
+firstnumber=last
+]
+{latex}
+\NeedsTeXFormat{LaTeX2e}
+\def\ukbillversionnumber{1.0.0}
+\ProvidesClass{ukbill}[2022-12-01 A Class for Legal Notes]
+ % !TeX program = lualatex
+% !TeX encoding = utf8
+% This work 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 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Elijah Z Granet
+
+
+\LoadClass[a4paper,12pt]{memoir}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% schedule divisions
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand{\schdpart}[1]{\subsubsection{#1}}
+\newcommand{\startschedule}{\clearpage
+\setcounter{schedon}{1}
+%\setcounter{subsection}{}
+\setcounter{part}{0}
+\begin{center}
+ \large\textsc{SCHEDULES}
+\end{center}
+\addcontentsline{toc}{chapter}{\rule{.45\textwidth}{1pt}}
+}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Variables
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\makeatletter
+\newcommand{\drafter}[1]{\def\@drafter{#1}}
+\newcommand{\printdrafter}{\@drafter}
+\def\@drafter{\@latex@warning@no@line{No \noexpand\drafter given}}
+\newcommand{\billcopyright}[1]{\def\@billcopyright{#1}}
+\newcommand{\printbillcopyright}{\@billcopyright}
+\def\@billcopyright{\@latex@warning@no@line{No \noexpand\billcopyright given}}
+\newcommand{\billto}[1]{\def\@billto{#1}}
+\newcommand{\printbillto}{\@billto}
+\def\@billto{\@latex@warning@no@line{No \noexpand\billto given}}
+\newcommand{\whereas}[1]{\def\@whereas{#1}}
+\newcommand{\printwhereas}{\@whereas}
+
+\newcommand{\publishedby}[1]{\def\@publishedby{#1}}
+\newcommand{\printpublishedby}{\@publishedby}
+\def\@publishedby{\@latex@warning@no@line{No \noexpand\publishedby given}}
+\newcommand{\billtitle}[1]{\def\@billtitle{#1}}
+\newcommand{\printbilltitle}{\@billtitle}
+\def\@billtitle{\@latex@warning@no@line{No \noexpand\billtitle given}}
+\newcommand{\humanrights}[1]{\def\@humanrights{#1}}
+\newcommand{\printhumanrights}{\@humanrights}
+\def\@humanrights{\@latex@warning@no@line{No \noexpand\humanrightsgiven}
+}
+\newcommand{\exptitle}[1]{\def\@exptitle{#1}}
+\newcommand{\printexptitle}{\@exptitle}
+\def\@exptitle{\@latex@warning@no@line{No \noexpand\exptitle given}}
+\newcommand{\exptext}[1]{\def\@exptext{#1}}
+\newcommand{\printexptext}{\@exptext}
+\def\@exptext{\@latex@warning@no@line{No \noexpand\exptext given}}
+\newcommand{\billnum}[1]{\def\@billnum{#1}}
+\newcommand{\printbillnum}{\@billnum}
+\def\@billnum{\@latex@warning@no@line{No \noexpand\billnum given}}
+
+
+\makeatother
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% hyphenation
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\RequirePackage[none]{hyphenat}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% list organisation
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\RequirePackage{paralist}
+ \let\itemize\compactitem
+ \let\enditemize\endcompactitem
+ \let\enumerate\compactenum
+ \let\endenumerate\endcompactenum
+ \let\description\compactdesc
+ \let\enddescription\endcompactdesc
+ \pltopsep=-12pt
+ \plitemsep=0pt
+ \plparsep=0pt
+\newcounter{schedcount}
+\counterwithout{section}{chapter}
+
+\counterwithin{schedcount}{subsubsection}
+\setsecnumdepth{subsubsection}
+\def\tocmark{\markboth{\MakeTextUppercase{}}{}}
+\RequirePackage[absolute]{textpos}
+\setlength{\TPHorizModule}{10mm}
+\setlength{\TPVertModule}{10mm}
+\TPGrid[15mm,1mm]{8}{9} % Divide page in 9x9 grid
+\DeclareRobustCommand{\Leftblock}{{
+\begin{textblock}{10}(0.5,1.8)\footnotesize\itshape 5\end{textblock}
+\begin{textblock}{10}(0.5,2.7)\footnotesize\itshape 10\end{textblock}
+\begin{textblock}{10}(0.5,3.6)\footnotesize\itshape 15\end{textblock}
+\begin{textblock}{10}(0.5,4.5)\footnotesize\itshape 20\end{textblock}
+\begin{textblock}{10}(0.5,5.4)\footnotesize\itshape 25\end{textblock}
+\begin{textblock}{10}(0.5,6.3)\footnotesize\itshape 30\end{textblock}
+\begin{textblock}{10}(0.5,7.2)\footnotesize\itshape 35\end{textblock}
+}}
+\DeclareRobustCommand{\Rightblock}{{
+\begin{textblock}{10}(7.75,1.8)\footnotesize\itshape 5\end{textblock}
+\begin{textblock}{10}(7.75,2.7)\footnotesize\itshape 10\end{textblock}
+\begin{textblock}{10}(7.75,3.6)\footnotesize\itshape 15\end{textblock}
+\begin{textblock}{10}(7.75,4.5)\footnotesize\itshape 20\end{textblock}
+\begin{textblock}{10}(7.75,5.4)\footnotesize\itshape 25\end{textblock}
+\begin{textblock}{10}(7.75,6.3)\footnotesize\itshape 30\end{textblock}
+\begin{textblock}{10}(7.75,7.2)\footnotesize\itshape 35\end{textblock}
+}}
+\DeclareRobustCommand{\Firstblock}{{
+%\begin{textblock}{10}(7.75,1.8)\footnotesize\itshape 5\end{textblock}
+%\begin{textblock}{10}(7.75,2.7)\footnotesize\itshape 10\end{textblock}
+%\begin{textblock}{10}(7.75,3.6)\footnotesize\itshape 15\end{textblock}
+\begin{textblock}{10}(7.75,4.5)\footnotesize\itshape 5\end{textblock}
+\begin{textblock}{5}(7.75,5.4)\footnotesize\itshape 10\end{textblock}
+\begin{textblock}{10}(7.75,6.3)\footnotesize\itshape 15\end{textblock}
+\begin{textblock}{10}(7.75,7.2)\footnotesize\itshape 20\end{textblock}
+}}
+
+\RequirePackage{ccicons}
+ \makepagestyle{bill}
+ \makepagestyle{billfirst}
+
+ \makeatletter
+ \makepsmarks {bill}{
+\nouppercaseheads}
+\makeatother
+\makeatletter
+ \renewcommand{\bookpagemark}[1]{\itshape\thetitle\\}
+ \makepsmarks {billfirst}{
+\nouppercaseheads}
+\makeatother
+ \renewcommand{\bookpagemark}[1]{\noindent\itshape\thetitle\\}
+
+% \renewcommand{\partpagemark}[1]{\itshape\thetitle\\}
+ \makepagestyle{front}
+
+ \makepagestyle{sched}
+ \makeatletter
+ \makepsmarks {sched}{
+\nouppercaseheads}
+\makeatother
+ \renewcommand{\bookpagemark}[1]{\itshape\thetitle\\}
+% \renewcommand{\partpagemark}[1]{\itshape\thetitle\\}
+\clearmark{chapter}
+\clearmark{section}
+
+\createmark{part}{both}{shownumber}{\partname\space}{.\space}
+
+
+ \RequirePackage[margin=3.25cm,headheight=100pt]{geometry}
+ \makeatletter
+ \makeevenfoot{front}{}{}{\printbillnum}
+ \makeoddfoot{front}{}{}{\printbillnum}
+ \makeatother
+
+\renewcommand{\bookname}{\printbilltitle}
+\makeheadrule{bill}{\textwidth}{1pt}
+ \makeevenhead{bill}{\Rightblock\normalsize\thepage\ifnum\value{part}>0\\\else\fi\ifnum\value{schedon}=1\\\else\fi\ifnum\value{subsubsection}>0\vskip 12pt\else\fi}{}{\footnotesize\itshape\bookname
+ \ifnum\value{schedon}=1
+\\ \itshape Schedule \arabic{subsection}\hspace{1ex}—\hspace{1ex}\currentsubsection \else\fi
+ \ifnum\value{part}>0
+\\Part \arabic{part}\hspace{1ex}—\hspace{1ex}\rightmark
+ \else\fi\ifnum\value{subsubsection}>0\\Part \arabic{subsubsection}\hspace{1ex}—\hspace{1ex}\currentsubsubsection\else\fi}
+ \makeoddhead{bill}{\Rightblock\footnotesize\itshape\bookname
+ \ifnum\value{schedon}=1
+\\ \itshape Schedule \arabic{subsection}\hspace{1ex}—\hspace{1ex}\currentsubsection \else\fi
+ \ifnum\value{part}>0
+\\Part \arabic{part}\hspace{1ex}—\hspace{1ex}\rightmark
+ \else\fi\ifnum\value{subsubsection}>0\\Part \arabic{subsubsection}\hspace{1ex}—\hspace{1ex}\currentsubsubsection\else\fi}{}{\normalsize\thepage\ifnum\value{part}>0\\\else\fi\ifnum\value{schedon}=1\\\else\fi\ifnum\value{subsubsection}>0\vskip 12pt\else\fi}
+ \makeoddfoot{bill}{}{}{}
+%\renewcommand{\subsectionmark}[1]{#1}
+
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% bill-first
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\makeheadrule{billfirst}{\textwidth}{1pt}
+ \makeevenhead{billfirst}{\Firstblock\normalsize\thepage\ifnum\value{part}>0\\\else\fi\ifnum\value{schedon}=1\\\else\fi\ifnum\value{subsubsection}>0\vskip 12pt\else\fi}{}{\footnotesize\itshape\bookname
+ \ifnum\value{schedon}=1
+\\ \itshape Schedule \arabic{subsection}\hspace{1ex}—\hspace{1ex}\currentsubsection \else\fi
+ \ifnum\value{part}>0
+\\Part \arabic{part}\hspace{1ex}—\hspace{1ex}\rightmark
+ \else\fi\ifnum\value{subsubsection}>0\\Part \arabic{subsubsection}\hspace{1ex}—\hspace{1ex}\currentsubsubsection\else\fi}
+ \makeoddhead{billfirst}{\Firstblock\footnotesize\itshape\bookname
+ \ifnum\value{schedon}=1
+\\ \itshape Schedule \arabic{subsection}\hspace{1ex}—\hspace{1ex}\currentsubsection \else\fi
+ \ifnum\value{part}>0
+\\Part \arabic{part}\hspace{1ex}—\hspace{1ex}\rightmark
+ \else\fi\ifnum\value{subsubsection}>0\\Part \arabic{subsubsection}\hspace{1ex}—\hspace{1ex}\currentsubsubsection\else\fi}{}{\normalsize\thepage\ifnum\value{part}>0\\\else\fi\ifnum\value{schedon}=1\\\else\fi\ifnum\value{subsubsection}>0\vskip 12pt\else\fi}
+ \makeoddfoot{billfirst}{}{}{}
+%\renewcommand{\subsectionmark}[1]{#1}
+
+
+
+\renewcommand{\chaptermark}[1]{#1}
+\cftpagenumbersoff{part}
+\cftpagenumbersoff{chapter}
+\cftpagenumbersoff{subsection}
+\cftpagenumbersoff{subsubsection}
+\renewcommand{\cftsubsectionpresnum}{\flushleft Schedule\hspace{1ex}}% Prefix to number for \subsection in ToC
+
+\renewcommand{\cftsubsubsectionpresnum}{Part\hspace{1ex}}% Prefix to number for \subsection in ToC
+
+\renewcommand{\thesubsection}{\arabic{subsection}}
+\renewcommand{\thesubsubsection}{\arabic{subsubsection}}
+\renewcommand{\cftsubsectionaftersnum}{\hspace{1ex}—\hspace{1ex}}
+\renewcommand{\cftsubsubsectionaftersnum}{\hspace{1ex}—\hspace{1ex}}
+
+\settocdepth{subsubsection}
+\cftpagenumbersoff{section}
+\makeatletter
+\let\stdl@chapter\l@chapter
+\renewcommand*{\l@chapter}[2]{\stdl@chapter{\centerline{#1}}{#2}}
+\makeatother
+\cftsetindents{subsection}{1.75cm}{10em}
+\cftsetindents{subsubsection}{1.75cm}{10em}
+
+\renewcommand{\cftsubsectionpresnum}{Schedule\hfill}
+\renewcommand{\cftsubsectionaftersnum}{\quad—\quad}
+\renewcommand{\cftsubsubsectionpresnum}{\qquad Part\hfill}
+\renewcommand{\cftsubsubsectionaftersnum}{\quad—\quad}
+
+%\setlength\cftsubsectionnumwidth{7.3em}
+%\setlength\cftsubsubsectionnumwidth{4em}
+
+\renewcommand{\title}{\printbilltitle}
+\RequirePackage{changepage} % for the adjustwidth environment
+\renewcommand{\part}[1]{\stepcounter{part}\markright{#1}
+\begin{center}
+\printpartname\hspace{1ex}\arabic{part}\\
+\printparttitle{#1}\normalfont\normalsize\\\end{center}
+\addcontentsline{toc}{part}{\normalsize\bfseries\printpartname\hspace{1ex}%
+\arabic{part}\normalfont\\
+\centerline{\normalsize\normalfont\scshape\printparttitle{#1}}}
+}
+ \renewcommand\contentsname{CONTENTS}%
+
+\renewcommand{\chapter}[1]{\stepcounter{chapter}\markright{#1}
+\begin{center}
+\itshape\printchaptertitle{#1}\normalfont\normalsize\\%
+\end{center}
+\addcontentsline{toc}{chapter}{\normalsize\itshape
+\centerline{\normalsize\normalfont\itshape\printchaptertitle{#1}}}
+}
+
+\renewcommand{\partnamefont}{\normalfont\centering\bfseries\scshape}
+\renewcommand{\parttitlefont}{\normalfont\centering\scshape}
+\makeatletter
+\renewcommand{\partnumberline}[1]{\hfil\hspace\@tocrmarg #1~}
+\makeatother
+
+\renewcommand{\partnumfont}{\normalfont\bfseries\centering\normalsize\scshape}
+\renewcommand{\partnamenum}{\normalfont\bfseries\centering\normalsize\scshape}
+\RequirePackage{setspace}
+\renewcommand{\chapterheadstart}{\vspace*{\beforechapskip}}
+\renewcommand{\printchaptername}{\chapnamefont \@chapapp}
+\renewcommand{\chapternamenum}{\space}
+\renewcommand{\printchapternum}{\chapnumfont \thechapter}
+\renewcommand{\afterchapternum}{\par\nobreak\vskip \midchapskip}
+\renewcommand{\printchapternonum}{}
+\renewcommand{\chapterheadstart}{}
+\renewcommand{\printchaptername}{}
+\renewcommand{\chapternamenum}{}
+\renewcommand{\printchapternum}{}
+\renewcommand{\afterchapternum}{}
+\setlength{\parskip}{0pt}
+\renewcommand{\printchaptertitle}[1]{\chaptitlefont #1}
+\renewcommand{\afterchaptertitle}{\par\nobreak\vskip \afterchapskip}
+\renewcommand{\printtoctitle}[1]{\large\scshape\centerline{\MakeUppercase{#1}}}
+\renewcommand{\chapnamefont}{\normalfont\centering\itshape}
+\renewcommand{\chapnumfont}{\normalfont\centering\itshape}
+\renewcommand{\chaptitlefont}{\normalfont\centering\itshape}
+
+\setlength{\beforechapskip}{12pt}
+\setlength{\midchapskip}{0pt}
+\setlength{\afterchapskip}{12pt}
+\setbeforesecskip{-1em}
+\setaftersecskip{-1em}
+\setbeforesubsecskip{-1em}
+\setaftersubsecskip{-1em}
+\renewcommand*{\thesection}{\arabic{section}}
+\setsecnumformat{\csname the#1\endcsname\hspace{5ex}}
+%\setsubsecnumformat{\csname the#1\endcsname\hspace{5ex}}
+%\setsubsecheadstyle{\bfseries}
+%\setsubsecheadstyle{\scshape\centering}
+%\setsubsectionnumformat{SCHEDULE\quad\csname the#1\endcsname\newline}
+\RequirePackage[compact]{titlesec}
+\titleformat{\subsection}[display]
+ {\normalfont\centering\scshape}{SCHEDULE \hspace{2ex }\thesubsection}{5pt}{}
+\titleformat{\subsubsection}[display]
+ {\normalfont\centering\scshape}{Part \thesubsubsection}{5pt}{}
+
+\setsecheadstyle{\centering\bfseries}
+\renewcommand{\part}[1]{\stepcounter{part}\markright{#1}
+\begin{center}
+\normalfont\normalsize\itshape\printchaptertitle{#1}\normalfont\normalsidze\\\end{center}
+\addcontentsline{toc}{chapter}{
+\centerline{\normalsize\normalfont\itshape\printchaptertitle{#1}}}
+}
+\RequirePackage{fontspec}
+\IfFontExistsTF{Palatine Parliamentary}{
+\setmainfont[
+Scale=.98,
+SmallCapsFeatures={LetterSpace=10,RawFeature={+smcp,},},
+BoldFeatures = {SmallCapsFont= {PalatineP-Bold},SmallCapsFeatures={%
+RawFeature={+smcp,}%
+}},
+BoldFont={PalatineP-Bold},
+ ItalicFont={PalatineP-Italic},
+ BoldItalicFont={PalatineP-BoldItalic}]{PalatineP-Regular}
+\newfontface{\extfont}[SmallCapsFont={Times New Roman}]{Times New Roman}}{\ClassWarning{Please install the Palatine Parliamentary Font}}
+
+\RequirePackage[english]{babel}
+%\RequirePackage{csquotes}
+%\MakeOuterQuote{"}
+%%\DeclareQuoteStyle{english}%
+%% {{\extfont\textquotedblleft}}
+%% [\extfont\textquotedblleft]
+%% {{\extfont\textquotedblright}}
+%% [0.05em]
+%% {{\extfont\textquoteleft}}
+%% [{\extfont\textquoteleft}]
+%% {{\extfont\textquoteright}}
+\RequirePackage{enumitem}
+\newenvironment{statquote}%
+{
+\begin{list}{}%
+{%
+\setlength{\topsep}{0ex}%
+\setlength{\partopsep}{0ex}%
+\setlength{\parsep}{0.5ex}%
+\setlength{\itemsep}{i}%
+\addtolength{\leftmargin}{3em}%
+\addtolength{\rightmargin}{3em}%
+}%
+\item[]}%
+{\end{list}}
+\newenvironment{nostat}{\begin{enumerate}[nosep,leftmargin=1.25cm,%
+labelindent=5pt,itemindent=-15pt,label=]}{\end{enumerate}}
+\newenvironment{numstat}%
+{%
+%\vspace{-9ex}%
+\begin{enumerate}[nosep,partopsep=0pt,
+%parsep=0.5ex,
+%itemsep=1ex,
+labelsep=3ex,
+leftmargin=4em,rightmargin=1.5em,label=(\arabic*)]%
+\item[]}%
+{\end{enumerate}%
+\vspace{1ex}\normalfont}%
+\newenvironment{schumstat}%
+{%
+%\vspace{-9ex}%
+\begin{enumerate}[nosep,partopsep=0pt,
+%parsep=0.5ex,
+itemsep=0ex,
+labelsep=0ex,
+leftmargin=0em,rightmargin=0em,label=]%
+\item[]}%
+{\end{enumerate}%
+\vspace{1ex}\normalfont}%
+
+\newcounter{alphcount}
+
+\newenvironment{instatquote}%
+{%
+\setcounter{alphcount}{0}
+\vspace{-3ex}%
+\begin{list}{}%
+{%
+\setlength{\topsep}{0ex}%
+\setlength{\partopsep}{1ex}%
+\setlength{\parsep}{0.5ex}%
+\setlength{\itemsep}{0ex}%
+}%
+\item[]}%
+{\end{list}%
+}%
+\newenvironment{alphstat}%
+{%
+\vspace{-3ex}%
+\begin{enumerate}[leftmargin=7.5ex,topsep=0ex,partopsep=1ex,parsep=0.5ex,%
+itemsep=0ex,labelsep=3ex,label=({\alph*})]%
+
+\item[]}%
+{\end{enumerate}%
+}%
+\newenvironment{romstat}%
+{%
+\vspace{-3ex}%
+\begin{enumerate}[topsep=0ex,partopsep=1ex,parsep=0.5ex,itemsep=0ex,%
+label=(\roman*)]%
+
+\item[]}%
+{\end{enumerate}%
+}%
+\newenvironment{twoalphstat}%
+{%
+\vspace{-3ex}%
+\begin{enumerate}[leftmargin=7.5ex,topsep=0ex,partopsep=1ex,parsep=0.5ex,%
+itemsep=0ex,labelsep=3ex,label=({\alph*}{\alph*})]%
+
+\item[]}%
+{\end{enumerate}%
+}%
+
+\newcommand*\statquotelabel[1]{}
+
+\newcommand{\stat}[2]{
+\item[(#1)]#2
+}
+
+\newcommand{\stathead}[2]{
+\textbf{#1}\hspace{5ex}\textbf{#2}
+}
+
+
+
+
+\setlength{\parindent}{0pt}
+\RequirePackage{lettrine}
+\setcounter{DefaultLines}{2}
+%\renewcommand{\DefaultLraise}{0.05}
+%\renewcommand{\DefaultLoversize}{.07}
+%\renewcommand{\LettrineFontHook}{\initials}
+%\RequirePackage{initials}
+%\RequirePackage{Romantik}%\romantik{}
+%\RequirePackage{Royal}%\royal
+
+\newcommand{\intl}[2]{\lettrine{#1}{\hspace{1ex}\textsc{#2}}}
+\renewcommand{\maketitle}{\thispagestyle{front}
+ \begin{center}
+ {\Huge\textbf{\title}}\\\rule{\textwidth}{1pt}\\\rule[16pt]{\textwidth}{2pt}
+ \end{center}
+ }
+ \newcommand{\schedule}[1]{\subsection{#1}}
+\newcounter{schedon}
+\setcounter{schedon}{0}
+
+\newcommand{\currentsubsection}{}
+\let\oldsubsection\subsection
+\renewcommand{\subsection}[1]{\oldsubsection{#1}\renewcommand{%
+\currentsubsection}{#1}}
+
+\newcommand{\currentsubsubsection}{}
+\let\oldsubsubsection\subsubsection
+\renewcommand{\subsubsection}[1]{\oldsubsubsection{#1}\renewcommand{%
+\currentsubsubsection}{#1}}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% enacting
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand{\enactingformula}{
+\intl{B}{e it enacted} by the King's most Excellent Majesty, by and with the advice and consent of the Lords Spiritual and Temporal, and Commons, in this present Parliament assembled, and by the authority of the same, as follows:---}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%enacting option
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\DeclareOption{private}{
+\makeatletter
+\renewcommand{\enactingformula}{
+\intl{W}{hereas}---
+
+\hspace{2em}\begin{minipage}{.75\textwidth}
+
+\printwhereas
+\end{minipage}
+
+\medskip
+
+\intl{M}{ay} it therefore please Your Majesty that it may be enacted, and be it enacted, by
+the King’s Most Excellent Majesty, by and with the advice and consent of the Lords
+Spiritual and Temporal, and Commons, in this present Parliament assembled, and by
+the authority of the same, as follows:―
+}
+
+
+\makeatother
+
+}
+
+\ProcessOptions\relax
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% begindoc
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\AtBeginDocument{\emergencystretch 3em
+\sloppy
+\OnehalfSpacing
+\pagestyle{front}
+\pagenumbering{roman}
+\maketitle
+\medskip
+\extfont
+\begin{center}\scshape\MakeUppercase{\printexptitle}\end{center}
+
+\printexptext
+\medskip
+
+\begin{center}\scshape EUROPEAN CONVENTION ON HUMAN RIGHTS\end{center}
+
+\printhumanrights
+\normalfont
+\clearpage\maketitle
+\begin{KeepFromToc}
+\normalfont\normalsize
+\tableofcontents
+\end{KeepFromToc}
+
+\vskip 3ex
+\mainmatter
+\pagenumbering{arabic}
+\pagestyle{bill}\thispagestyle{billfirst}
+\begin{center}
+ \scshape a
+ \medskip
+
+ \normalfont\Huge\bfseries B\hspace{.5ex}I\hspace{.5ex}L\hspace{.5ex}L
+
+ \medskip
+
+ \normalfont\normalsize\scshape to\normalfont
+
+\end{center}
+
+ \medskip
+
+\noindent\footnotesize\extfont\printbillto\normalsize \normalfont
+
+\medskip
+
+\enactingformula
+
+\medskip
+
+
+
+}
+
+
+\AtEndDocument{\cleardoublepage
+
+
+ \setcounter{page}{0}
+ \pagenumbering{arabic}
+ \setcounter{page}{1}
+\thispagestyle{front}
+
+ \begin{center}
+ {\Huge\textbf{\title}}\\\rule{\textwidth}{1pt}\\\rule[16pt]{\textwidth}{2pt}
+ \end{center}
+
+\begin{center}
+ \normalfont\scshape a
+ \medskip
+
+ \normalfont\Huge\bfseries B\hspace{.5ex}I\hspace{.5ex}L\hspace{.5ex}L
+
+ \vskip 3ex
+ \end{center}
+
+\normalsize To make provision in connection with the citizens of certain Commonwealth Realms
+
+ \vskip 3ex
+ \begin{center}
+
+\normalsize\normalfont\itshape Presented by \printdrafter
+
+\vskip 3ex
+
+\rule{.45\textwidth}{1pt}
+\vspace{1ex}
+
+\begin{minipage}{.4\textwidth}\centering
+\itshape Ordered, by\normalfont\ \printdrafter\itshape\ to be Printed, \normalfont 19\itshape th March \normalfont 2020\itshape.
+\end{minipage}
+
+\vspace{1ex}
+
+\rule{.45\textwidth}{1pt}
+
+\vskip 5ex
+
+\normalfont\footnotesize\printbillcopyright
+
+
+\vskip 1ex
+
+\normalfont\scshape\MakeUppercase{Published By \printpublishedby}
+\end{center}
+}
+\end{minted}
+
+
+\end{document} \ No newline at end of file
diff --git a/macros/latex/contrib/ukbill/ukbill.cls b/macros/latex/contrib/ukbill/ukbill.cls
new file mode 100644
index 0000000000..ebabf63344
--- /dev/null
+++ b/macros/latex/contrib/ukbill/ukbill.cls
@@ -0,0 +1,609 @@
+\NeedsTeXFormat{LaTeX2e}
+\def\ukbillversionnumber{1.0.0}
+\ProvidesClass{ukbill}[2022-12-01 A Class for Legal Notes]
+ % !TeX program = lualatex
+% !TeX encoding = utf8
+% This work 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 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Elijah Z Granet
+
+
+\LoadClass[a4paper,12pt]{memoir}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% schedule divisions
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand{\schdpart}[1]{\subsubsection{#1}}
+\newcommand{\startschedule}{\clearpage
+\setcounter{schedon}{1}
+%\setcounter{subsection}{}
+\setcounter{part}{0}
+\begin{center}
+ \large\textsc{SCHEDULES}
+\end{center}
+\addcontentsline{toc}{chapter}{\rule{.45\textwidth}{1pt}}
+}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Variables
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\makeatletter
+\newcommand{\drafter}[1]{\def\@drafter{#1}}
+\newcommand{\printdrafter}{\@drafter}
+\def\@drafter{\@latex@warning@no@line{No \noexpand\drafter given}}
+\newcommand{\billcopyright}[1]{\def\@billcopyright{#1}}
+\newcommand{\printbillcopyright}{\@billcopyright}
+\def\@billcopyright{\@latex@warning@no@line{No \noexpand\billcopyright given}}
+\newcommand{\billto}[1]{\def\@billto{#1}}
+\newcommand{\printbillto}{\@billto}
+\def\@billto{\@latex@warning@no@line{No \noexpand\billto given}}
+\newcommand{\whereas}[1]{\def\@whereas{#1}}
+\newcommand{\printwhereas}{\@whereas}
+
+\newcommand{\publishedby}[1]{\def\@publishedby{#1}}
+\newcommand{\printpublishedby}{\@publishedby}
+\def\@publishedby{\@latex@warning@no@line{No \noexpand\publishedby given}}
+\newcommand{\billtitle}[1]{\def\@billtitle{#1}}
+\newcommand{\printbilltitle}{\@billtitle}
+\def\@billtitle{\@latex@warning@no@line{No \noexpand\billtitle given}}
+\newcommand{\humanrights}[1]{\def\@humanrights{#1}}
+\newcommand{\printhumanrights}{\@humanrights}
+\def\@humanrights{\@latex@warning@no@line{No \noexpand\humanrightsgiven}
+}
+\newcommand{\exptitle}[1]{\def\@exptitle{#1}}
+\newcommand{\printexptitle}{\@exptitle}
+\def\@exptitle{\@latex@warning@no@line{No \noexpand\exptitle given}}
+\newcommand{\exptext}[1]{\def\@exptext{#1}}
+\newcommand{\printexptext}{\@exptext}
+\def\@exptext{\@latex@warning@no@line{No \noexpand\exptext given}}
+\newcommand{\billnum}[1]{\def\@billnum{#1}}
+\newcommand{\printbillnum}{\@billnum}
+\def\@billnum{\@latex@warning@no@line{No \noexpand\billnum given}}
+
+
+\makeatother
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% hyphenation
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\RequirePackage[none]{hyphenat}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% list organisation
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\RequirePackage{paralist}
+ \let\itemize\compactitem
+ \let\enditemize\endcompactitem
+ \let\enumerate\compactenum
+ \let\endenumerate\endcompactenum
+ \let\description\compactdesc
+ \let\enddescription\endcompactdesc
+ \pltopsep=-12pt
+ \plitemsep=0pt
+ \plparsep=0pt
+\newcounter{schedcount}
+\counterwithout{section}{chapter}
+
+\counterwithin{schedcount}{subsubsection}
+\setsecnumdepth{subsubsection}
+\def\tocmark{\markboth{\MakeTextUppercase{}}{}}
+\RequirePackage[absolute]{textpos}
+\setlength{\TPHorizModule}{10mm}
+\setlength{\TPVertModule}{10mm}
+\TPGrid[15mm,1mm]{8}{9} % Divide page in 9x9 grid
+\DeclareRobustCommand{\Leftblock}{{
+\begin{textblock}{10}(0.5,1.8)\footnotesize\itshape 5\end{textblock}
+\begin{textblock}{10}(0.5,2.7)\footnotesize\itshape 10\end{textblock}
+\begin{textblock}{10}(0.5,3.6)\footnotesize\itshape 15\end{textblock}
+\begin{textblock}{10}(0.5,4.5)\footnotesize\itshape 20\end{textblock}
+\begin{textblock}{10}(0.5,5.4)\footnotesize\itshape 25\end{textblock}
+\begin{textblock}{10}(0.5,6.3)\footnotesize\itshape 30\end{textblock}
+\begin{textblock}{10}(0.5,7.2)\footnotesize\itshape 35\end{textblock}
+}}
+\DeclareRobustCommand{\Rightblock}{{
+\begin{textblock}{10}(7.75,1.8)\footnotesize\itshape 5\end{textblock}
+\begin{textblock}{10}(7.75,2.7)\footnotesize\itshape 10\end{textblock}
+\begin{textblock}{10}(7.75,3.6)\footnotesize\itshape 15\end{textblock}
+\begin{textblock}{10}(7.75,4.5)\footnotesize\itshape 20\end{textblock}
+\begin{textblock}{10}(7.75,5.4)\footnotesize\itshape 25\end{textblock}
+\begin{textblock}{10}(7.75,6.3)\footnotesize\itshape 30\end{textblock}
+\begin{textblock}{10}(7.75,7.2)\footnotesize\itshape 35\end{textblock}
+}}
+\DeclareRobustCommand{\Firstblock}{{
+%\begin{textblock}{10}(7.75,1.8)\footnotesize\itshape 5\end{textblock}
+%\begin{textblock}{10}(7.75,2.7)\footnotesize\itshape 10\end{textblock}
+%\begin{textblock}{10}(7.75,3.6)\footnotesize\itshape 15\end{textblock}
+\begin{textblock}{10}(7.75,4.5)\footnotesize\itshape 5\end{textblock}
+\begin{textblock}{5}(7.75,5.4)\footnotesize\itshape 10\end{textblock}
+\begin{textblock}{10}(7.75,6.3)\footnotesize\itshape 15\end{textblock}
+\begin{textblock}{10}(7.75,7.2)\footnotesize\itshape 20\end{textblock}
+}}
+
+\RequirePackage{ccicons}
+ \makepagestyle{bill}
+ \makepagestyle{billfirst}
+
+ \makeatletter
+ \makepsmarks {bill}{
+\nouppercaseheads}
+\makeatother
+\makeatletter
+ \renewcommand{\bookpagemark}[1]{\itshape\thetitle\\}
+ \makepsmarks {billfirst}{
+\nouppercaseheads}
+\makeatother
+ \renewcommand{\bookpagemark}[1]{\noindent\itshape\thetitle\\}
+
+% \renewcommand{\partpagemark}[1]{\itshape\thetitle\\}
+ \makepagestyle{front}
+
+ \makepagestyle{sched}
+ \makeatletter
+ \makepsmarks {sched}{
+\nouppercaseheads}
+\makeatother
+ \renewcommand{\bookpagemark}[1]{\itshape\thetitle\\}
+% \renewcommand{\partpagemark}[1]{\itshape\thetitle\\}
+\clearmark{chapter}
+\clearmark{section}
+
+\createmark{part}{both}{shownumber}{\partname\space}{.\space}
+
+
+ \RequirePackage[margin=3.25cm,headheight=100pt]{geometry}
+ \makeatletter
+ \makeevenfoot{front}{}{}{\printbillnum}
+ \makeoddfoot{front}{}{}{\printbillnum}
+ \makeatother
+
+\renewcommand{\bookname}{\printbilltitle}
+\makeheadrule{bill}{\textwidth}{1pt}
+ \makeevenhead{bill}{\Rightblock\normalsize\thepage\ifnum\value{part}>0\\\else\fi\ifnum\value{schedon}=1\\\else\fi\ifnum\value{subsubsection}>0\vskip 12pt\else\fi}{}{\footnotesize\itshape\bookname
+ \ifnum\value{schedon}=1
+\\ \itshape Schedule \arabic{subsection}\hspace{1ex}—\hspace{1ex}\currentsubsection \else\fi
+ \ifnum\value{part}>0
+\\Part \arabic{part}\hspace{1ex}—\hspace{1ex}\rightmark
+ \else\fi\ifnum\value{subsubsection}>0\\Part \arabic{subsubsection}\hspace{1ex}—\hspace{1ex}\currentsubsubsection\else\fi}
+ \makeoddhead{bill}{\Rightblock\footnotesize\itshape\bookname
+ \ifnum\value{schedon}=1
+\\ \itshape Schedule \arabic{subsection}\hspace{1ex}—\hspace{1ex}\currentsubsection \else\fi
+ \ifnum\value{part}>0
+\\Part \arabic{part}\hspace{1ex}—\hspace{1ex}\rightmark
+ \else\fi\ifnum\value{subsubsection}>0\\Part \arabic{subsubsection}\hspace{1ex}—\hspace{1ex}\currentsubsubsection\else\fi}{}{\normalsize\thepage\ifnum\value{part}>0\\\else\fi\ifnum\value{schedon}=1\\\else\fi\ifnum\value{subsubsection}>0\vskip 12pt\else\fi}
+ \makeoddfoot{bill}{}{}{}
+%\renewcommand{\subsectionmark}[1]{#1}
+
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% bill-first
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\makeheadrule{billfirst}{\textwidth}{1pt}
+ \makeevenhead{billfirst}{\Firstblock\normalsize\thepage\ifnum\value{part}>0\\\else\fi\ifnum\value{schedon}=1\\\else\fi\ifnum\value{subsubsection}>0\vskip 12pt\else\fi}{}{\footnotesize\itshape\bookname
+ \ifnum\value{schedon}=1
+\\ \itshape Schedule \arabic{subsection}\hspace{1ex}—\hspace{1ex}\currentsubsection \else\fi
+ \ifnum\value{part}>0
+\\Part \arabic{part}\hspace{1ex}—\hspace{1ex}\rightmark
+ \else\fi\ifnum\value{subsubsection}>0\\Part \arabic{subsubsection}\hspace{1ex}—\hspace{1ex}\currentsubsubsection\else\fi}
+ \makeoddhead{billfirst}{\Firstblock\footnotesize\itshape\bookname
+ \ifnum\value{schedon}=1
+\\ \itshape Schedule \arabic{subsection}\hspace{1ex}—\hspace{1ex}\currentsubsection \else\fi
+ \ifnum\value{part}>0
+\\Part \arabic{part}\hspace{1ex}—\hspace{1ex}\rightmark
+ \else\fi\ifnum\value{subsubsection}>0\\Part \arabic{subsubsection}\hspace{1ex}—\hspace{1ex}\currentsubsubsection\else\fi}{}{\normalsize\thepage\ifnum\value{part}>0\\\else\fi\ifnum\value{schedon}=1\\\else\fi\ifnum\value{subsubsection}>0\vskip 12pt\else\fi}
+ \makeoddfoot{billfirst}{}{}{}
+%\renewcommand{\subsectionmark}[1]{#1}
+
+
+
+\renewcommand{\chaptermark}[1]{#1}
+\cftpagenumbersoff{part}
+\cftpagenumbersoff{chapter}
+\cftpagenumbersoff{subsection}
+\cftpagenumbersoff{subsubsection}
+\renewcommand{\cftsubsectionpresnum}{\flushleft Schedule\hspace{1ex}}% Prefix to number for \subsection in ToC
+
+\renewcommand{\cftsubsubsectionpresnum}{Part\hspace{1ex}}% Prefix to number for \subsection in ToC
+
+\renewcommand{\thesubsection}{\arabic{subsection}}
+\renewcommand{\thesubsubsection}{\arabic{subsubsection}}
+\renewcommand{\cftsubsectionaftersnum}{\hspace{1ex}—\hspace{1ex}}
+\renewcommand{\cftsubsubsectionaftersnum}{\hspace{1ex}—\hspace{1ex}}
+
+\settocdepth{subsubsection}
+\cftpagenumbersoff{section}
+\makeatletter
+\let\stdl@chapter\l@chapter
+\renewcommand*{\l@chapter}[2]{\stdl@chapter{\centerline{#1}}{#2}}
+\makeatother
+\cftsetindents{subsection}{1.75cm}{10em}
+\cftsetindents{subsubsection}{1.75cm}{10em}
+
+\renewcommand{\cftsubsectionpresnum}{Schedule\hfill}
+\renewcommand{\cftsubsectionaftersnum}{\quad—\quad}
+\renewcommand{\cftsubsubsectionpresnum}{\qquad Part\hfill}
+\renewcommand{\cftsubsubsectionaftersnum}{\quad—\quad}
+
+%\setlength\cftsubsectionnumwidth{7.3em}
+%\setlength\cftsubsubsectionnumwidth{4em}
+
+\renewcommand{\title}{\printbilltitle}
+\RequirePackage{changepage} % for the adjustwidth environment
+\renewcommand{\part}[1]{\stepcounter{part}\markright{#1}
+\begin{center}
+\printpartname\hspace{1ex}\arabic{part}\\
+\printparttitle{#1}\normalfont\normalsize\\\end{center}
+\addcontentsline{toc}{part}{\normalsize\bfseries\printpartname\hspace{1ex}\arabic{part}\normalfont\\
+\centerline{\normalsize\normalfont\scshape\printparttitle{#1}}}
+}
+ \renewcommand\contentsname{CONTENTS}%
+
+\renewcommand{\chapter}[1]{\stepcounter{chapter}\markright{#1}
+\begin{center}
+\itshape\printchaptertitle{#1}\normalfont\normalsize\\\end{center}
+\addcontentsline{toc}{chapter}{\normalsize\itshape
+\centerline{\normalsize\normalfont\itshape\printchaptertitle{#1}}}
+}
+
+\renewcommand{\partnamefont}{\normalfont\centering\bfseries\scshape}
+\renewcommand{\parttitlefont}{\normalfont\centering\scshape}
+\makeatletter
+\renewcommand{\partnumberline}[1]{\hfil\hspace\@tocrmarg #1~}
+\makeatother
+
+\renewcommand{\partnumfont}{\normalfont\bfseries\centering\normalsize\scshape}
+\renewcommand{\partnamenum}{\normalfont\bfseries\centering\normalsize\scshape}
+\RequirePackage{setspace}
+\renewcommand{\chapterheadstart}{\vspace*{\beforechapskip}}
+\renewcommand{\printchaptername}{\chapnamefont \@chapapp}
+\renewcommand{\chapternamenum}{\space}
+\renewcommand{\printchapternum}{\chapnumfont \thechapter}
+\renewcommand{\afterchapternum}{\par\nobreak\vskip \midchapskip}
+\renewcommand{\printchapternonum}{}
+\renewcommand{\chapterheadstart}{}
+\renewcommand{\printchaptername}{}
+\renewcommand{\chapternamenum}{}
+\renewcommand{\printchapternum}{}
+\renewcommand{\afterchapternum}{}
+\setlength{\parskip}{0pt}
+\renewcommand{\printchaptertitle}[1]{\chaptitlefont #1}
+\renewcommand{\afterchaptertitle}{\par\nobreak\vskip \afterchapskip}
+\renewcommand{\printtoctitle}[1]{\large\scshape\centerline{\MakeUppercase{#1}}}
+\renewcommand{\chapnamefont}{\normalfont\centering\itshape}
+\renewcommand{\chapnumfont}{\normalfont\centering\itshape}
+\renewcommand{\chaptitlefont}{\normalfont\centering\itshape}
+
+\setlength{\beforechapskip}{12pt}
+\setlength{\midchapskip}{0pt}
+\setlength{\afterchapskip}{12pt}
+\setbeforesecskip{-1em}
+\setaftersecskip{-1em}
+\setbeforesubsecskip{-1em}
+\setaftersubsecskip{-1em}
+\renewcommand*{\thesection}{\arabic{section}}
+\setsecnumformat{\csname the#1\endcsname\hspace{5ex}}
+%\setsubsecnumformat{\csname the#1\endcsname\hspace{5ex}}
+%\setsubsecheadstyle{\bfseries}
+%\setsubsecheadstyle{\scshape\centering}
+%\setsubsectionnumformat{SCHEDULE\quad\csname the#1\endcsname\newline}
+\RequirePackage[compact]{titlesec}
+\titleformat{\subsection}[display]
+ {\normalfont\centering\scshape}{SCHEDULE \hspace{2ex }\thesubsection}{5pt}{}
+\titleformat{\subsubsection}[display]
+ {\normalfont\centering\scshape}{Part \thesubsubsection}{5pt}{}
+
+\setsecheadstyle{\centering\bfseries}
+\renewcommand{\part}[1]{\stepcounter{part}\markright{#1}
+\begin{center}
+\normalfont\normalsize\itshape\printchaptertitle{#1}\normalfont\normalsidze\\\end{center}
+\addcontentsline{toc}{chapter}{
+\centerline{\normalsize\normalfont\itshape\printchaptertitle{#1}}}
+}
+\RequirePackage{fontspec}
+\IfFontExistsTF{Palatine Parliamentary}{
+\setmainfont[
+Scale=.98,
+SmallCapsFeatures={LetterSpace=10,RawFeature={+smcp,},},
+BoldFeatures = {SmallCapsFont= {PalatineP-Bold},SmallCapsFeatures={%
+RawFeature={+smcp,}%
+}},
+BoldFont={PalatineP-Bold},
+ ItalicFont={PalatineP-Italic},
+ BoldItalicFont={PalatineP-BoldItalic}]{PalatineP-Regular}
+\newfontface{\extfont}[SmallCapsFont={Times New Roman}]{Times New Roman}}{\ClassWarning{Please install the Palatine Parliamentary Font}}
+
+\RequirePackage[english]{babel}
+%\RequirePackage{csquotes}
+%\MakeOuterQuote{"}
+%%\DeclareQuoteStyle{english}%
+%% {{\extfont\textquotedblleft}}
+%% [\extfont\textquotedblleft]
+%% {{\extfont\textquotedblright}}
+%% [0.05em]
+%% {{\extfont\textquoteleft}}
+%% [{\extfont\textquoteleft}]
+%% {{\extfont\textquoteright}}
+\RequirePackage{enumitem}
+\newenvironment{statquote}%
+{
+\begin{list}{}%
+{%
+\setlength{\topsep}{0ex}%
+\setlength{\partopsep}{0ex}%
+\setlength{\parsep}{0.5ex}%
+\setlength{\itemsep}{i}%
+\addtolength{\leftmargin}{3em}%
+\addtolength{\rightmargin}{3em}%
+}%
+\item[]}%
+{\end{list}}
+\newenvironment{nostat}{\begin{enumerate}[nosep,leftmargin=1.25cm,labelindent=5pt,itemindent=-15pt,label=]}{\end{enumerate}}
+\newenvironment{numstat}%
+{%
+%\vspace{-9ex}%
+\begin{enumerate}[nosep,partopsep=0pt,
+%parsep=0.5ex,
+%itemsep=1ex,
+labelsep=3ex,
+leftmargin=4em,rightmargin=1.5em,label=(\arabic*)]%
+\item[]}%
+{\end{enumerate}%
+\vspace{1ex}\normalfont}%
+\newenvironment{schumstat}%
+{%
+%\vspace{-9ex}%
+\begin{enumerate}[nosep,partopsep=0pt,
+%parsep=0.5ex,
+itemsep=0ex,
+labelsep=0ex,
+leftmargin=0em,rightmargin=0em,label=]%
+\item[]}%
+{\end{enumerate}%
+\vspace{1ex}\normalfont}%
+
+\newcounter{alphcount}
+
+\newenvironment{instatquote}%
+{%
+\setcounter{alphcount}{0}
+\vspace{-3ex}%
+\begin{list}{}%
+{%
+\setlength{\topsep}{0ex}%
+\setlength{\partopsep}{1ex}%
+\setlength{\parsep}{0.5ex}%
+\setlength{\itemsep}{0ex}%
+}%
+\item[]}%
+{\end{list}%
+}%
+\newenvironment{alphstat}%
+{%
+\vspace{-3ex}%
+\begin{enumerate}[leftmargin=7.5ex,topsep=0ex,partopsep=1ex,parsep=0.5ex,itemsep=0ex,labelsep=3ex,label=({\alph*})]%
+
+\item[]}%
+{\end{enumerate}%
+}%
+\newenvironment{romstat}%
+{%
+\vspace{-3ex}%
+\begin{enumerate}[topsep=0ex,partopsep=1ex,parsep=0.5ex,itemsep=0ex,label=(\roman*)]%
+
+\item[]}%
+{\end{enumerate}%
+}%
+\newenvironment{twoalphstat}%
+{%
+\vspace{-3ex}%
+\begin{enumerate}[leftmargin=7.5ex,topsep=0ex,partopsep=1ex,parsep=0.5ex,itemsep=0ex,labelsep=3ex,label=({\alph*}{\alph*})]%
+
+\item[]}%
+{\end{enumerate}%
+}%
+
+\newcommand*\statquotelabel[1]{}
+
+\newcommand{\stat}[2]{
+\item[(#1)]#2
+}
+
+\newcommand{\stathead}[2]{
+\textbf{#1}\hspace{5ex}\textbf{#2}
+}
+
+
+
+
+\setlength{\parindent}{0pt}
+\RequirePackage{lettrine}
+\setcounter{DefaultLines}{2}
+%\renewcommand{\DefaultLraise}{0.05}
+%\renewcommand{\DefaultLoversize}{.07}
+%\renewcommand{\LettrineFontHook}{\initials}
+%\RequirePackage{initials}
+%\RequirePackage{Romantik}%\romantik{}
+%\RequirePackage{Royal}%\royal
+
+\newcommand{\intl}[2]{\lettrine{#1}{\hspace{1ex}\textsc{#2}}}
+\renewcommand{\maketitle}{\thispagestyle{front}
+ \begin{center}
+ {\Huge\textbf{\title}}\\\rule{\textwidth}{1pt}\\\rule[16pt]{\textwidth}{2pt}
+ \end{center}
+ }
+ \newcommand{\schedule}[1]{\subsection{#1}}
+\newcounter{schedon}
+\setcounter{schedon}{0}
+
+\newcommand{\currentsubsection}{}
+\let\oldsubsection\subsection
+\renewcommand{\subsection}[1]{\oldsubsection{#1}\renewcommand{\currentsubsection}{#1}}
+
+\newcommand{\currentsubsubsection}{}
+\let\oldsubsubsection\subsubsection
+\renewcommand{\subsubsection}[1]{\oldsubsubsection{#1}\renewcommand{\currentsubsubsection}{#1}}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% enacting
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand{\enactingformula}{
+\intl{B}{e it enacted} by the King's most Excellent Majesty, by and with the advice and consent of the Lords Spiritual and Temporal, and Commons, in this present Parliament assembled, and by the authority of the same, as follows:---}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%enacting option
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\DeclareOption{private}{
+\makeatletter
+\renewcommand{\enactingformula}{
+\intl{W}{hereas}---
+
+\hspace{2em}\begin{minipage}{.75\textwidth}
+
+\printwhereas
+\end{minipage}
+
+\medskip
+
+\intl{M}{ay} it therefore please Your Majesty that it may be enacted, and be it enacted, by
+the King’s Most Excellent Majesty, by and with the advice and consent of the Lords
+Spiritual and Temporal, and Commons, in this present Parliament assembled, and by
+the authority of the same, as follows:―
+}
+
+
+\makeatother
+
+}
+
+\ProcessOptions\relax
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% begindoc
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\AtBeginDocument{\emergencystretch 3em
+\sloppy
+\OnehalfSpacing
+\pagestyle{front}
+\pagenumbering{roman}
+\maketitle
+\medskip
+\extfont
+\begin{center}\scshape\MakeUppercase{\printexptitle}\end{center}
+
+\printexptext
+\medskip
+
+\begin{center}\scshape EUROPEAN CONVENTION ON HUMAN RIGHTS\end{center}
+
+\printhumanrights
+\normalfont
+\clearpage\maketitle
+\begin{KeepFromToc}
+\normalfont\normalsize
+\tableofcontents
+\end{KeepFromToc}
+
+\vskip 3ex
+\mainmatter
+\pagenumbering{arabic}
+\pagestyle{bill}\thispagestyle{billfirst}
+\begin{center}
+ \scshape a
+ \medskip
+
+ \normalfont\Huge\bfseries B\hspace{.5ex}I\hspace{.5ex}L\hspace{.5ex}L
+
+ \medskip
+
+ \normalfont\normalsize\scshape to\normalfont
+
+\end{center}
+
+ \medskip
+
+\noindent\footnotesize\extfont\printbillto\normalsize \normalfont
+
+\medskip
+
+\enactingformula
+
+\medskip
+
+
+
+}
+
+
+\AtEndDocument{\cleardoublepage
+
+
+ \setcounter{page}{0}
+ \pagenumbering{arabic}
+ \setcounter{page}{1}
+\thispagestyle{front}
+
+ \begin{center}
+ {\Huge\textbf{\title}}\\\rule{\textwidth}{1pt}\\\rule[16pt]{\textwidth}{2pt}
+ \end{center}
+
+\begin{center}
+ \normalfont\scshape a
+ \medskip
+
+ \normalfont\Huge\bfseries B\hspace{.5ex}I\hspace{.5ex}L\hspace{.5ex}L
+
+ \vskip 3ex
+ \end{center}
+
+\normalsize To make provision in connection with the citizens of certain Commonwealth Realms
+
+ \vskip 3ex
+ \begin{center}
+
+\normalsize\normalfont\itshape Presented by \printdrafter
+
+\vskip 3ex
+
+\rule{.45\textwidth}{1pt}
+\vspace{1ex}
+
+\begin{minipage}{.4\textwidth}\centering
+\itshape Ordered, by\normalfont\ \printdrafter\itshape\ to be Printed, \normalfont 19\itshape th March \normalfont 2020\itshape.
+\end{minipage}
+
+\vspace{1ex}
+
+\rule{.45\textwidth}{1pt}
+
+\vskip 5ex
+
+\normalfont\footnotesize\printbillcopyright
+
+
+\vskip 1ex
+
+\normalfont\scshape\MakeUppercase{Published By \printpublishedby}
+\end{center}
+}