summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
Diffstat (limited to 'macros')
-rw-r--r--macros/latex/contrib/bithesis/README.md2
-rw-r--r--macros/latex/contrib/bithesis/bithesis.dtx31
-rw-r--r--macros/latex/contrib/bithesis/bithesis.pdfbin339647 -> 339714 bytes
-rw-r--r--macros/latex/contrib/l3backend/CHANGELOG.md11
-rw-r--r--macros/latex/contrib/l3backend/README.md2
-rw-r--r--macros/latex/contrib/l3backend/l3backend-basics.dtx14
-rw-r--r--macros/latex/contrib/l3backend/l3backend-box.dtx2
-rw-r--r--macros/latex/contrib/l3backend/l3backend-code.pdfbin896719 -> 906761 bytes
-rw-r--r--macros/latex/contrib/l3backend/l3backend-color.dtx24
-rw-r--r--macros/latex/contrib/l3backend/l3backend-draw.dtx2
-rw-r--r--macros/latex/contrib/l3backend/l3backend-graphics.dtx184
-rw-r--r--macros/latex/contrib/l3backend/l3backend-header.dtx2
-rw-r--r--macros/latex/contrib/l3backend/l3backend-opacity.dtx2
-rw-r--r--macros/latex/contrib/l3backend/l3backend-pdf.dtx2
-rw-r--r--macros/luatex/generic/lua-widow-control/README.md2
-rw-r--r--macros/luatex/generic/lua-widow-control/lua-widow-control.lua4
-rw-r--r--macros/luatex/generic/lua-widow-control/lua-widow-control.opm61
-rw-r--r--macros/luatex/generic/lua-widow-control/lua-widow-control.pdfbin380127 -> 385607 bytes
-rw-r--r--macros/luatex/generic/lua-widow-control/lua-widow-control.sty24
-rw-r--r--macros/luatex/generic/lua-widow-control/lua-widow-control.tex44
-rw-r--r--macros/luatex/generic/lua-widow-control/lwc-documentation.tex6
-rw-r--r--macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkiv21
-rw-r--r--macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkxl21
23 files changed, 346 insertions, 115 deletions
diff --git a/macros/latex/contrib/bithesis/README.md b/macros/latex/contrib/bithesis/README.md
index a63fde0877..ff7266a5d1 100644
--- a/macros/latex/contrib/bithesis/README.md
+++ b/macros/latex/contrib/bithesis/README.md
@@ -6,7 +6,7 @@
[![BIThesis](./assets/bithesis_badge_solid.svg)](https://bithesis.bitnp.net/)
[![Chinese version](./assets/chinese.svg)](./README-zh.md)
-[![Latexmk](https://badgen.net/badge/compiler/Latexmk?color=blue&labelColor=2b2b2b)](https://mg.readthedocs.io/latexmk.html)
+[![Latexmk](https://badgen.net/badge/compiler/latexmk/blue)](https://mg.readthedocs.io/latexmk.html)
[![License](https://badgen.net/github/license/BITNP/BIThesis?color=008080&labelColor=2b2b2b)](./LICENSE)
[![Join on Slack](https://img.shields.io/badge/Slack%20Community-BIThesis-black?logo=slack&style=social&logoColor=2eb67d)](https://join.slack.com/t/bithesis/shared_invite/zt-epmzkyk0-fJRsUS36AlwMNB2AI_Q~Vw)
diff --git a/macros/latex/contrib/bithesis/bithesis.dtx b/macros/latex/contrib/bithesis/bithesis.dtx
index 8194a4ea5f..4262466e8b 100644
--- a/macros/latex/contrib/bithesis/bithesis.dtx
+++ b/macros/latex/contrib/bithesis/bithesis.dtx
@@ -21,10 +21,10 @@
%<book>\ProvidesClass{bitbook}
%<article>\ProvidesClass{bitart}
%<graduate>\ProvidesClass{bitgrad}
-%<cls> [2022/04/01 v2.0.0 BIT Thesis Templates]
+%<cls> [2022/04/13 v2.1.0 BIT Thesis Templates]
%
%<*driver>
-\ProvidesFile{bithesis.dtx}[2022/04/01 2.0.0 BIT Thesis Templates]
+\ProvidesFile{bithesis.dtx}[2022/04/13 2.1.0 BIT Thesis Templates]
\documentclass{ltxdoc}
\usepackage{dtx-style}
@@ -973,12 +973,17 @@ footskip=0.7cm% 页脚 1.8cm %
% \captionnamefont{\songti\zihao{5}}
% \captiontitlefont{\songti\zihao{5}}
-
-%% sort and compress citations
-\RequirePackage[numbers,square,comma,super,sort&compress]{natbib}
-% 上标引用
-\newcommand{\upcite}[1]{\textsuperscript{\cite{#1}}}
-
+\RequirePackage[
+ backend=biber,
+ style=gb7714-2015,
+ gbalign=gb7714-2015,
+ gbnamefmt=lowercase,
+ gbpub=false,
+ doi=false,
+ url=false,
+ eprint=false,
+ isbn=false,
+]{biblatex}
% 将浮动参数设为较宽松的值
\renewcommand{\textfraction}{0.15}
@@ -1054,9 +1059,6 @@ footskip=0.7cm% 页脚 1.8cm %
% \setitemize[1]{itemsep=0pt,partopsep=0pt,parsep=\parskip,topsep=0pt}
% \setdescription{itemsep=0pt,partopsep=0pt,parsep=\parskip,topsep=5pt}
-% _ 参考文献风格 added by wei.jianwen@gmail.com
-\bibliographystyle{GBT7714-2005NLang}
-
% _ BITspace
% \newcommand\BITspace{\protect\CTEX@spaceChar\protect\CTEX@spaceChar}
\newcommand{\BITspace}[1][1]{\hspace{#1\ccwd}}
@@ -1233,10 +1235,12 @@ footskip=0.7cm% 页脚 1.8cm %
\vskip 5cm
\begin{center}
\setstretch{1.1}
- \begin{minipage}{1em}
+ \begin{minipage}{2em}
+ \begin{center}
{\heiti\zihao{3}\BIT@value@vtitle}
- \vskip 2cm
+ \vskip 2em
{\heiti\zihao{3}\BIT@value@school}
+ \end{center}
\end{minipage}
\end{center}
\clearpage
@@ -1244,7 +1248,6 @@ footskip=0.7cm% 页脚 1.8cm %
\thispagestyle{empty}
\cleardoublepage
\fi
-
}
% 原创性声明
diff --git a/macros/latex/contrib/bithesis/bithesis.pdf b/macros/latex/contrib/bithesis/bithesis.pdf
index 536c9af015..a935fc0e24 100644
--- a/macros/latex/contrib/bithesis/bithesis.pdf
+++ b/macros/latex/contrib/bithesis/bithesis.pdf
Binary files differ
diff --git a/macros/latex/contrib/l3backend/CHANGELOG.md b/macros/latex/contrib/l3backend/CHANGELOG.md
index e94dbb881d..e725149f03 100644
--- a/macros/latex/contrib/l3backend/CHANGELOG.md
+++ b/macros/latex/contrib/l3backend/CHANGELOG.md
@@ -6,6 +6,14 @@ this project uses date-based 'snapshot' version identifiers.
## [Unreleased]
+## [2022-04-14]
+
+### Added
+- Support for SVG graphic inclusion by `dvisvgm`
+
+### Fixed
+- `\color_ensure_current:` backend with DVI-based routes (issue \#1085)
+
## [2022-04-10]
### Added
@@ -230,7 +238,8 @@ this project uses date-based 'snapshot' version identifiers.
- Include `l3backend` in file names
- Moved backend code to internal for each 'parent' module
-[Unreleased]: https://github.com/latex3/latex3/compare/2022-04-10...HEAD
+[Unreleased]: https://github.com/latex3/latex3/compare/2022-04-14...HEAD
+[2022-04-14]: https://github.com/latex3/latex3/compare/2022-04-10...2022-04-14
[2022-04-10]: https://github.com/latex3/latex3/compare/2022-02-07...2022-04-10
[2022-02-07]: https://github.com/latex3/latex3/compare/2022-01-12...2022-02-07
[2022-01-12]: https://github.com/latex3/latex3/compare/2021-12-14...2022-01-12
diff --git a/macros/latex/contrib/l3backend/README.md b/macros/latex/contrib/l3backend/README.md
index 470d6914a0..824db1bdd3 100644
--- a/macros/latex/contrib/l3backend/README.md
+++ b/macros/latex/contrib/l3backend/README.md
@@ -1,7 +1,7 @@
LaTeX3 Backend Drivers
======================
-Release 2022-04-10
+Release 2022-04-14
This package forms parts of `expl3`, and contains the code used to interface
with backends (drivers) across the `expl3` codebase. The functions here are
diff --git a/macros/latex/contrib/l3backend/l3backend-basics.dtx b/macros/latex/contrib/l3backend/l3backend-basics.dtx
index f4bf61fe70..adaf33ee44 100644
--- a/macros/latex/contrib/l3backend/l3backend-basics.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-basics.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2022-04-10}
+% \date{Released 2022-04-14}
%
% \maketitle
%
@@ -70,27 +70,27 @@
% \begin{macrocode}
\ProvidesExplFile
%<*dvipdfmx>
- {l3backend-dvipdfmx.def}{2022-04-10}{}
+ {l3backend-dvipdfmx.def}{2022-04-14}{}
{L3 backend support: dvipdfmx}
%</dvipdfmx>
%<*dvips>
- {l3backend-dvips.def}{2022-04-10}{}
+ {l3backend-dvips.def}{2022-04-14}{}
{L3 backend support: dvips}
%</dvips>
%<*dvisvgm>
- {l3backend-dvisvgm.def}{2022-04-10}{}
+ {l3backend-dvisvgm.def}{2022-04-14}{}
{L3 backend support: dvisvgm}
%</dvisvgm>
%<*luatex>
- {l3backend-luatex.def}{2022-04-10}{}
+ {l3backend-luatex.def}{2022-04-14}{}
{L3 backend support: PDF output (LuaTeX)}
%</luatex>
%<*pdftex>
- {l3backend-pdftex.def}{2022-04-10}{}
+ {l3backend-pdftex.def}{2022-04-14}{}
{L3 backend support: PDF output (pdfTeX)}
%</pdftex>
%<*xetex>
- {l3backend-xetex.def}{2022-04-10}{}
+ {l3backend-xetex.def}{2022-04-14}{}
{L3 backend support: XeTeX}
%</xetex>
% \end{macrocode}
diff --git a/macros/latex/contrib/l3backend/l3backend-box.dtx b/macros/latex/contrib/l3backend/l3backend-box.dtx
index a732d60564..4093f8b3a7 100644
--- a/macros/latex/contrib/l3backend/l3backend-box.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-box.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2022-04-10}
+% \date{Released 2022-04-14}
%
% \maketitle
%
diff --git a/macros/latex/contrib/l3backend/l3backend-code.pdf b/macros/latex/contrib/l3backend/l3backend-code.pdf
index 960a45053c..a5c0020393 100644
--- a/macros/latex/contrib/l3backend/l3backend-code.pdf
+++ b/macros/latex/contrib/l3backend/l3backend-code.pdf
Binary files differ
diff --git a/macros/latex/contrib/l3backend/l3backend-color.dtx b/macros/latex/contrib/l3backend/l3backend-color.dtx
index 815b41302a..7166fb693d 100644
--- a/macros/latex/contrib/l3backend/l3backend-color.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-color.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2022-04-10}
+% \date{Released 2022-04-14}
%
% \maketitle
%
@@ -91,8 +91,8 @@
{
\tl_set:Nx #1
{
+ { named }
{ \exp_after:wN \use:n \current@color }
- { 1 }
}
}
{
@@ -353,18 +353,22 @@
% {
% \@@_backend_select_cmyk:n ,
% \@@_backend_select_gray:n ,
+% \@@_backend_select_named:n ,
% \@@_backend_select_rgb:n ,
% \@@_backend_select:n
% }
% \begin{macro}{\@@_backend_reset:}
% \begin{macro}{color.sc}
% Push the data to the stack. In the case of \texttt{dvips} also saves the
-% drawing color in raw PostScript.
+% drawing color in raw PostScript. The |spot| model is for handling data
+% in classical format.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_select_cmyk:n #1
{ \@@_backend_select:n { cmyk ~ #1 } }
\cs_new_protected:Npn \@@_backend_select_gray:n #1
{ \@@_backend_select:n { gray ~ #1 } }
+\cs_new_protected:Npn \@@_backend_select_named:n #1
+ { \@@_backend_select:n { ~ #1 } }
\cs_new_protected:Npn \@@_backend_select_rgb:n #1
{ \@@_backend_select:n { rgb ~ #1 } }
\cs_new_protected:Npn \@@_backend_select:n #1
@@ -427,6 +431,20 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\@@_backend_select_named:n}
+% For classical named colors, the only value we should get is |Black|.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_select_named:n #1
+ {
+ \str_if_eq:nnTF {#1} { Black }
+ { \@@_backend_select_gray:n { 0 } }
+ { \msg_error:nnn { color } { unknown-named-color } {#1} }
+ }
+\msg_new:nnn { color } { unknown-named-color }
+ { Named~color~'#1'~is~not~known. }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macrocode}
%</dvipdfmx|luatex|pdftex|xetex>
% \end{macrocode}
diff --git a/macros/latex/contrib/l3backend/l3backend-draw.dtx b/macros/latex/contrib/l3backend/l3backend-draw.dtx
index 0f9fcb6008..4a0d779682 100644
--- a/macros/latex/contrib/l3backend/l3backend-draw.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-draw.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2022-04-10}
+% \date{Released 2022-04-14}
%
% \maketitle
%
diff --git a/macros/latex/contrib/l3backend/l3backend-graphics.dtx b/macros/latex/contrib/l3backend/l3backend-graphics.dtx
index 1bd6a7e336..08df3f16b5 100644
--- a/macros/latex/contrib/l3backend/l3backend-graphics.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-graphics.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2022-04-10}
+% \date{Released 2022-04-14}
%
% \maketitle
%
@@ -143,7 +143,7 @@
{
\seq_set_from_clist:Nn
\l_graphics_search_ext_seq
- { .pdf , .eps , .png , .jpg , .jpeg }
+ { .pdf , .eps , .ps , .png , .jpg , .jpeg }
}
% \end{macrocode}
% \end{variable}
@@ -282,9 +282,9 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_backend_getbb_eps:n}
+% \begin{macro}{\@@_backend_getbb_eps:n, \@@_backend_getbb_ps:n}
% \begin{macro}{\@@_backend_getbb_eps:nm}
-% \begin{macro}{\@@_backend_include_eps:n}
+% \begin{macro}{\@@_backend_include_eps:n, \@@_backend_include_ps:n}
% \begin{variable}
% {\l_@@_backend_dir_str, \l_@@_backend_name_str, \l_@@_backend_ext_str}
% EPS graphics may be included in \LuaTeX{}/pdfTeX{} by conversion to
@@ -314,6 +314,7 @@
}
{#1}
}
+ \cs_new_eq:NN \@@_backend_getbb_ps:n \@@_backend_getbb_eps:n
\cs_new_protected:Npn \@@_backend_getbb_eps:nn #1#2
{
\file_compare_timestamp:nNnT {#2} > {#1}
@@ -338,6 +339,7 @@
}
}
}
+ \cs_new_eq:NN \@@_backend_include_ps:n \@@_backend_include_eps:n
}
% \end{macrocode}
% \end{variable}
@@ -379,7 +381,7 @@
%
% \begin{macro}
% {
-% \@@_backend_getbb_eps:n ,
+% \@@_backend_getbb_eps:n , \@@_backend_getbb_ps:n ,
% \@@_backend_getbb_jpg:n , \@@_backend_getbb_jpeg:n ,
% \@@_backend_getbb_pdf:n , \@@_backend_getbb_png:n ,
% \@@_backend_getbb_bmp:n
@@ -640,7 +642,7 @@
% For PDF graphics, properly supporting the |pagebox| concept in \XeTeX{}
% is best done using the |\tex_XeTeXpdffile:D| primitive. The syntax here
% is the same as for the graphic measurement part, although we know at this
-% stage that there must be some valid setting for \cs{l_graphics_pagebox_tl}.
+% stage that there must be some valid setting for \cs{l_@@_pagebox_tl}.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_include_pdf:n #1
{
@@ -683,16 +685,123 @@
{
\seq_set_from_clist:Nn
\l_graphics_search_ext_seq
- { .pdf , .eps , .png , .jpg , .jpeg }
+ { .svg , .pdf , .eps , .ps , .png , .jpg , .jpeg }
}
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}{\@@_backend_getbb_eps:n}
+% \begin{macro}{\@@_backend_getbb_svg:n}
+% \begin{macro}{\@@_backend_getbb_svg_auxi:nNn}
+% \begin{macro}{\@@_backend_getbb_svg_auxii:w}
+% \begin{macro}
+% {
+% \@@_backend_getbb_svg_auxiii:Nw ,
+% \@@_backend_getbb_svg_auxiv:Nw ,
+% \@@_backend_getbb_svg_auxv:Nw
+% }
+% \begin{macro}{\@@_backend_getbb_svg_auxvi:Nn}
+% \begin{macro}{\@@_backend_getbb_svg_auxvii:w}
+% This is relatively similar to reading bounding boxes for |.eps| files. Life
+% is though made more tricky as we cannot pick a single line for the data. So
+% we have to loop until we collect up both height and width. To do that, we
+% can use a marker value. We also have to allow for the default units of the
+% lengths: they are big points and may be omitted.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_getbb_svg:n #1
+ {
+ \@@_bb_restore:nF {#1}
+ {
+ \ior_open:Nn \l_@@_internal_ior {#1}
+ \ior_if_eof:NTF \l_@@_internal_ior
+ { \msg_error:nnn { graphics } { graphic-not-found } {#1} }
+ {
+ \dim_zero:N \l_@@_llx_dim
+ \dim_zero:N \l_@@_lly_dim
+ \dim_set:Nn \l_@@_urx_dim { -\c_max_dim }
+ \dim_set:Nn \l_@@_ury_dim { -\c_max_dim }
+ \ior_str_map_inline:Nn \l_@@_internal_ior
+ {
+ \dim_compare:nNnT \l_@@_urx_dim = { -\c_max_dim }
+ {
+ \@@_backend_getbb_svg_auxi:nNn
+ { width } \l_@@_urx_dim {##1}
+ }
+ \dim_compare:nNnT \l_@@_ury_dim = { -\c_max_dim }
+ {
+ \@@_backend_getbb_svg_auxi:nNn
+ { height } \l_@@_ury_dim {##1}
+ }
+ \bool_lazy_and:nnF
+ { \dim_compare_p:nNn \l_@@_urx_dim = { -\c_max_dim } }
+ { \dim_compare_p:nNn \l_@@_ury_dim = { -\c_max_dim } }
+ { \ior_map_break: }
+ }
+ \@@_bb_save:n {#1}
+ }
+ \ior_close:N \l_@@_internal_ior
+ }
+ }
+\cs_new_protected:Npn \@@_backend_getbb_svg_auxi:nNn #1#2#3
+ {
+ \use:x
+ {
+ \cs_set_protected:Npn \@@_backend_getbb_svg_auxii:w
+ ####1 \tl_to_str:n {#1} = ####2 \tl_to_str:n {#1} = ####3
+ \s_@@_stop
+ }
+ {
+ \tl_if_blank:nF {##2}
+ {
+ \peek_remove_spaces:n
+ {
+ \peek_meaning:NTF ' % '
+ { \@@_backend_getbb_svg_auxiii:Nw #2 }
+ {
+ \peek_meaning:NTF " % "
+ { \@@_backend_getbb_svg_auxiv:Nw #2 }
+ { \@@_backend_getbb_svg_auxv:Nw #2 }
+ }
+ }
+ ##2 \s_@@_stop
+ }
+ }
+ \use:x
+ {
+ \@@_backend_getbb_svg_auxii:w #3
+ \tl_to_str:n {#1} = \tl_to_str:n {#1} =
+ \s_@@_stop
+ }
+ }
+\cs_new_protected:Npn \@@_backend_getbb_svg_auxii:w { }
+\cs_new_protected:Npn \@@_backend_getbb_svg_auxiii:Nw #1 ' #2 ' #3 \s_@@_stop
+ { \@@_backend_getbb_svg_auxvi:Nn #1 {#2} }
+\cs_new_protected:Npn \@@_backend_getbb_svg_auxiv:Nw #1 " #2 " #3 \s_@@_stop
+ { \@@_backend_getbb_svg_auxvi:Nn #1 {#2} }
+\cs_new_protected:Npn \@@_backend_getbb_svg_auxv:Nw #1 #2 ~ #3 \s_@@_stop
+ { \@@_backend_getbb_svg_auxvi:Nn #1 {#2} }
+\cs_new_protected:Npn \@@_backend_getbb_svg_auxvi:Nn #1#2
+ {
+ \tex_afterassignment:D \@@_backend_getbb_svg_auxvii:w
+ \l_@@_internal_dim #2 bp \scan_stop:
+ \dim_set_eq:NN #1 \l_@@_internal_dim
+ }
+\cs_new_protected:Npn \@@_backend_getbb_svg_auxvii:w #1 \scan_stop: { }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@@_backend_getbb_eps:n, \@@_backend_getbb_ps:n}
% Simply use the generic function.
% \begin{macrocode}
\@@_backend_loaded:n
- { \cs_new_eq:NN \@@_backend_getbb_eps:n \@@_read_bb:n }
+ {
+ \cs_new_eq:NN \@@_backend_getbb_eps:n \@@_read_bb:n
+ \cs_new_eq:NN \@@_backend_getbb_ps:n \@@_read_bb:n
+ }
% \end{macrocode}
% \end{macro}
%
@@ -722,13 +831,19 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_backend_include_eps:n, \@@_backend_include_pdf:n}
+% \begin{macro}
+% {
+% \@@_backend_include_eps:n ,
+% \@@_backend_include_ps:n ,
+% \@@_backend_include_pdf:n
+% }
% \begin{macro}{\@@_backend_include:nn}
% The special syntax is relatively clear here: remember we need PostScript
% sizes here. (This is the same as the \texttt{dvips} code.)
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_include_eps:n #1
{ \@@_backend_include:nn { PSfile } {#1} }
+\cs_new_eq:NN \@@_backend_include_ps:n \@@_backend_include_eps:n
\cs_new_protected:Npn \@@_backend_include_pdf:n #1
{ \@@_backend_include:nn { pdffile } {#1} }
\cs_new_protected:Npn \@@_backend_include:nn #1#2
@@ -748,32 +863,43 @@
%
% \begin{macro}
% {
+% \@@_backend_include_svg:n ,
% \@@_backend_include_png:n ,
% \@@_backend_include_jpg:n ,
% \@@_backend_include_jpeg:n
% }
-% \begin{macro}{\@@_backend_include_bitmap_quote:w}
+% \begin{macro}{\@@_backend_include_dequote:w}
% The backend here has built-in support for basic graphic inclusion (see
% \texttt{dvisvgm.def} for a more complex approach, needed if clipping,
-% \emph{etc.}, is covered at the graphic backend level). The only issue is
-% that |#1| must be quote-corrected. The \texttt{dvisvgm:img} operation
-% quotes the file name, but if it is already quoted (contains spaces)
-% then we have an issue: we simply strip off any quotes as a result.
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_backend_include_png:n #1
- {
- \__kernel_backend_literal:x
- {
- dvisvgm:img~
- \dim_to_decimal:n { \l_@@_ury_dim } ~
- \dim_to_decimal:n { \l_@@_ury_dim } ~
- \@@_backend_include_bitmap_quote:w #1 " #1 " \s_@@_stop
- }
+% \emph{etc.}, is covered at the graphic backend level). We have to deal
+% with the fact that the image reference point is at the \emph{top}, so
+% there is a need for a veritcal shift to put it in the right place.
+% The other issue is that |#1| must be quote-corrected. The
+% \texttt{dvisvgm:img} operation quotes the file name, but if it is already
+% quoted (contains spaces) then we have an issue: we simply strip off any
+% quotes as a result.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_include_svg:n #1
+ {
+ \box_move_up:nn { \l_@@_ury_dim }
+ {
+ \hbox:n
+ {
+ \__kernel_backend_literal:x
+ {
+ dvisvgm:img~
+ \dim_to_decimal:n { \l_@@_urx_dim } ~
+ \dim_to_decimal:n { \l_@@_ury_dim } ~
+ \@@_backend_include_dequote:w #1 " #1 " \s_@@_stop
+ }
+ }
+ }
}
-\cs_new_eq:NN \@@_backend_include_jpeg:n \@@_backend_include_png:n
-\cs_new_eq:NN \@@_backend_include_jpg:n \@@_backend_include_png:n
-\cs_new:Npn \@@_backend_include_bitmap_quote:w #1 " #2 " #3 \s_@@_stop
- { " #2 " }
+\cs_new_eq:NN \@@_backend_include_png:n \@@_backend_include_svg:n
+\cs_new_eq:NN \@@_backend_include_jpeg:n \@@_backend_include_svg:n
+\cs_new_eq:NN \@@_backend_include_jpg:n \@@_backend_include_svg:n
+\cs_new:Npn \@@_backend_include_dequote:w #1 " #2 " #3 \s_@@_stop
+ {#2}
% \end{macrocode}
% \end{macro}
% \end{macro}
diff --git a/macros/latex/contrib/l3backend/l3backend-header.dtx b/macros/latex/contrib/l3backend/l3backend-header.dtx
index 5eacda7b9f..2298af2a4e 100644
--- a/macros/latex/contrib/l3backend/l3backend-header.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-header.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2022-04-10}
+% \date{Released 2022-04-14}
%
% \maketitle
%
diff --git a/macros/latex/contrib/l3backend/l3backend-opacity.dtx b/macros/latex/contrib/l3backend/l3backend-opacity.dtx
index 89d60de0df..9fd8426741 100644
--- a/macros/latex/contrib/l3backend/l3backend-opacity.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-opacity.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2022-04-10}
+% \date{Released 2022-04-14}
%
% \maketitle
%
diff --git a/macros/latex/contrib/l3backend/l3backend-pdf.dtx b/macros/latex/contrib/l3backend/l3backend-pdf.dtx
index 03435b2454..071b8805f5 100644
--- a/macros/latex/contrib/l3backend/l3backend-pdf.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-pdf.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2022-04-10}
+% \date{Released 2022-04-14}
%
% \maketitle
%
diff --git a/macros/luatex/generic/lua-widow-control/README.md b/macros/luatex/generic/lua-widow-control/README.md
index 850f034f8e..6d61094c46 100644
--- a/macros/luatex/generic/lua-widow-control/README.md
+++ b/macros/luatex/generic/lua-widow-control/README.md
@@ -48,4 +48,4 @@ Lua-widow-control is licensed under the [_Mozilla Public License_, version 2.0](
Please note that a compiled document is absolutely **not** considered to be an "Executable Form" as defined by the MPL. The use of lua-widow-control in a document does not place **any** obligations on the document's author or distributors. The MPL and CC-BY-SA licenses **only** apply to you if you distribute the lua-widow-control source code or documentation.
---
-_v2.0.4 (2022-04-07)_ <!--%%version %%dashdate-->
+_v2.0.5 (2022-04-13)_ <!--%%version %%dashdate-->
diff --git a/macros/luatex/generic/lua-widow-control/lua-widow-control.lua b/macros/luatex/generic/lua-widow-control/lua-widow-control.lua
index 2e374ac6e1..041b32b465 100644
--- a/macros/luatex/generic/lua-widow-control/lua-widow-control.lua
+++ b/macros/luatex/generic/lua-widow-control/lua-widow-control.lua
@@ -107,8 +107,8 @@ elseif plain or latex or optex then
debug_print("Plain/LaTeX")
luatexbase.provides_module {
name = lwc.name,
- date = "2022/04/07", --%%slashdate
- version = "2.0.4", --%%version
+ date = "2022/04/13", --%%slashdate
+ version = "2.0.5", --%%version
description = [[
This module provides a LuaTeX-based solution to prevent
diff --git a/macros/luatex/generic/lua-widow-control/lua-widow-control.opm b/macros/luatex/generic/lua-widow-control/lua-widow-control.opm
index 6ff6281583..d96bab6c02 100644
--- a/macros/luatex/generic/lua-widow-control/lua-widow-control.opm
+++ b/macros/luatex/generic/lua-widow-control/lua-widow-control.opm
@@ -3,7 +3,8 @@
% SPDX-License-Identifier: MPL-2.0+
% SPDX-FileCopyrightText: 2022 Max Chernoff
-\_codedecl\lwcenable{lua-widow-control <v2.0.4>} %%version
+\_codedecl\lwcenable{lua-widow-control <v2.0.5>} %%version
+\_namespace{lwc}
\_clubpenalty=1
\_widowpenalty=1
@@ -19,11 +20,61 @@
\_directlua{require "lua-widow-control"}
% Define \TeX{} wrappers for Lua functions
-\_def\lwcenable{\_directlua{lwc.enable_callbacks()}}
-\_def\lwcdisable{\_directlua{lwc.disable_callbacks()}}
-\_def\iflwc{\_directlua{lwc.if_lwc_enabled()}}
+\_def\.enable{\_directlua{lwc.enable_callbacks()}}
+\_def\.disable{\_directlua{lwc.disable_callbacks()}}
+\_def\.iflwc{\_directlua{lwc.if_lwc_enabled()}}
+
+\_let\lwcenable=\.enable
+\_let\lwcdisable=\.disable
% Enable \lwc/ by default when the package is loaded.
-\lwcenable
+\.enable
+
+% Expansion of some parts of the document, such as section headings, is quite
+% undesirable, so we'll disable \lwc/ for certain commands.
+
+% We should only reenable \lwc/ at the end if it was already enabled.
+\_newcount\.disable_count
+
+\_def\.patch_pre{%
+ \.iflwc%
+ \_advance\.disable_count by 1%
+ \.disable%
+ \_fi%
+}
+
+\_def\.patch_post{
+ \_ifnum\.disable_count>0%
+ \.enable%
+ \_advance\.disable_count by -1%
+ \_fi
+}
+
+\_def\.extractcomponents #1:#2->#3\STOP{%
+ \_def\.params{#2}%
+ \_def\.body{#3}%
+}
+
+\def\.disable_cmd#1{%
+ \_ifdefined#1%
+ \_ea\.extractcomponents\_meaning#1\STOP%
+ \_begingroup%
+ \_catcode`_=11%
+ \_expanded{%
+ \_noexpand\_scantokens{%
+ \_gdef\_noexpand#1\.params{%
+ \_noexpand\.patch_pre\.body\_noexpand\.patch_post%
+ }%
+ }%
+ }%
+ \_endgroup%
+ \_fi%
+}
+\_let\lwcdisablecmd=\.disable_cmd
+
+\.disable_cmd{\_printchap}
+\.disable_cmd{\_printsec}
+\.disable_cmd{\_printsecc}
+\_endnamespace
\_endcode
diff --git a/macros/luatex/generic/lua-widow-control/lua-widow-control.pdf b/macros/luatex/generic/lua-widow-control/lua-widow-control.pdf
index 007b3136f0..09fee6bcf3 100644
--- a/macros/luatex/generic/lua-widow-control/lua-widow-control.pdf
+++ b/macros/luatex/generic/lua-widow-control/lua-widow-control.pdf
Binary files differ
diff --git a/macros/luatex/generic/lua-widow-control/lua-widow-control.sty b/macros/luatex/generic/lua-widow-control/lua-widow-control.sty
index 0690a23208..62090c061b 100644
--- a/macros/luatex/generic/lua-widow-control/lua-widow-control.sty
+++ b/macros/luatex/generic/lua-widow-control/lua-widow-control.sty
@@ -13,7 +13,7 @@
\DeclareRelease{}{0000-00-00}{lua-widow-control-2022-02-22.sty}
\DeclareRelease{v1.1.6}{2022-02-22}{lua-widow-control-2022-02-22.sty}
-\DeclareCurrentRelease{v2.0.4}{2022-04-07} %%version %%dashdate
+\DeclareCurrentRelease{v2.0.5}{2022-04-13} %%version %%dashdate
% If this version of LaTeX doesn't support command hooks, then we load
% the last v1.1.X version of the package.
@@ -23,8 +23,8 @@
\ProvidesExplPackage
{lua-widow-control}
- {2022/04/07} %%slashdate
- {v2.0.4} %%version
+ {2022/04/13} %%slashdate
+ {v2.0.5} %%version
{Use Lua to remove widows and orphans}
% Unconditional Package Loads
@@ -154,26 +154,25 @@
% Expansion of some parts of the document, such as section headings, is quite
% undesirable, so we'll disable \lwc/ for certain commands.
-\bool_new:N \g__lwc_should_reenable_bool
+\int_new:N \g__lwc_disable_int
\cs_new:Npn \__lwc_patch_pre: {
% We should only reenable \lwc/ at the end if it was already enabled.
- \__lwc_if_enabled:TF {
- \bool_gset_true:N \g__lwc_should_reenable_bool
+ \__lwc_if_enabled:T {
+ \int_gincr:N \g__lwc_disable_int
\__lwc_disable:
- } {
- \bool_gset_false:N \g__lwc_should_reenable_bool
}
}
\cs_new:Npn \__lwc_patch_post: {
- \bool_if:NT { \g__lwc_should_reenable_bool } {
+ \int_compare:nT { \g__lwc_disable_int > 0 } {
\__lwc_enable:
+ \int_gdecr:N \g__lwc_disable_int
}
}
\cs_new:Npn \__lwc_patch_cmd:c #1 {
- \IfFormatAtLeastTF {2021/06/01 } {
+ \IfFormatAtLeastTF { 2021/06/01 } {
\hook_gput_code:nnn { cmd / #1 / before } { \c__lwc_name_str } {
\__lwc_patch_pre:
}
@@ -205,12 +204,17 @@
\clist_map_function:NN \g__lwc_disablecmds_cl \__lwc_patch_cmd:n
}
+%%% Class and package-specifc patches
+
% KOMA-Script
\cs_if_exist:NT \AddtoDoHook {
\AddtoDoHook { heading / begingroup } { \__lwc_patch_pre: \use_none:n }
\AddtoDoHook { heading / endgroup } { \__lwc_patch_post: \use_none:n }
}
+% Memoir
+\cs_gset_nopar:Npn \pen@ltyabovepfbreak { 23 } % GitHub #32
+
% Define some final keys
\keys_define:nn { \c__lwc_name_str } {
enable .choice:,
diff --git a/macros/luatex/generic/lua-widow-control/lua-widow-control.tex b/macros/luatex/generic/lua-widow-control/lua-widow-control.tex
index 4ff5bd993b..f467b0b432 100644
--- a/macros/luatex/generic/lua-widow-control/lua-widow-control.tex
+++ b/macros/luatex/generic/lua-widow-control/lua-widow-control.tex
@@ -3,7 +3,7 @@
% SPDX-License-Identifier: MPL-2.0+
% SPDX-FileCopyrightText: 2022 Max Chernoff
-\wlog{lua-widow-control v2.0.4} %%version
+\wlog{lua-widow-control v2.0.5} %%version
\ifx\directlua\undefined
\errmessage{%
@@ -12,6 +12,8 @@
}
\fi
+\catcode`@=11
+
\input ltluatex % \LuaTeX{}Base
\clubpenalty=1
@@ -43,34 +45,50 @@
% Expansion of some parts of the document, such as section headings, is quite
% undesirable, so we'll disable \lwc/ for certain commands.
-\catcode`@=11
% We should only reenable \lwc/ at the end if it was already enabled.
-\newif\iflwc@should@reenable
+\newcount\lwc@disable@count
\def\lwc@patch@pre{%
\iflwc%
- \lwc@should@reenabletrue%
+ \advance\lwc@disable@count by 1%
\lwcdisable%
- \else%
- \lwc@should@reenablefalse%
\fi%
}
-\def\lwc@patch@post{\iflwc@should@reenable%
- \lwcenable%
-\fi}
+\def\lwc@patch@post{
+ \ifnum\lwc@disable@count>0%
+ \lwcenable%
+ \advance\lwc@disable@count by -1%
+ \fi
+}
+
+\def\lwc@extractcomponents #1:#2->#3\STOP{%
+ \def\lwc@params{#2}%
+ \def\lwc@body{#3}%
+}
\def\lwcdisablecmd#1{%
- \ifdefined#1
- \expandafter\def\expandafter#1\expandafter{\lwc@patch@pre #1\lwc@patch@post}
- \fi
+ \ifdefined#1%
+ \expandafter\lwc@extractcomponents\meaning#1\STOP%
+ \begingroup%
+ \catcode`@=11%
+ \expanded{%
+ \noexpand\scantokens{%
+ \gdef\noexpand#1\lwc@params{%
+ \noexpand\lwc@patch@pre\lwc@body\noexpand\lwc@patch@post%
+ }%
+ }%
+ }%
+ \endgroup%
+ \fi%
}
-\catcode`@=12
\begingroup
\suppressoutererror=1
\lwcdisablecmd{\beginsection} % Sectioning
\endgroup
+
+\catcode`@=12
\endinput
diff --git a/macros/luatex/generic/lua-widow-control/lwc-documentation.tex b/macros/luatex/generic/lua-widow-control/lwc-documentation.tex
index 8d59b2a735..e6b7f0a0e0 100644
--- a/macros/luatex/generic/lua-widow-control/lwc-documentation.tex
+++ b/macros/luatex/generic/lua-widow-control/lwc-documentation.tex
@@ -37,7 +37,7 @@
\startdocument[
title=lua-widow-control,
author=Max Chernoff,
- version=2.0.4, %%version
+ version=2.0.5, %%version
github=https://github.com/gucci-on-fleek/lua-widow-control,
ctan=https://www.ctan.org/pkg/lua-widow-control,
]
@@ -310,12 +310,12 @@ Sometimes, you may want to disable \lwc/ for certain commands where stretching i
You could just disable then reenable \lwc/ every time that you use the command; however, \lwc/ provides a convenience macro that will do this automatically for you.
-\Lwc/ automatically patches the default \LaTeX{}, \ConTeXt{}, and Plain~\TeX{} section commands, so you shouldn't need to patch these yourself. \Lwc/ also patches the commands provided by \sans{memoir}, \sans{\acronym{KOMA}-script}, and \sans{titlesec}. You'll need to patch any other section commands yourself.
+\Lwc/ automatically patches the default \LaTeX{}, \ConTeXt{}, Plain~\TeX{}, and Op\TeX{} section commands, so you shouldn't need to patch these yourself. \Lwc/ also patches the commands provided by \sans{memoir}, \sans{\acronym{KOMA}-script}, and \sans{titlesec}. You'll need to patch any other section commands yourself.
Note that the \LaTeX{} option does not \emph{append} commands to the disable list; rather, it \emph{sets} the list from scratch. This means that you can set an empty list to disable any command patching; however, this also means that if you want to disable one command on top of the defaults, you'll also need to manually include the default list.
\startTABLE
- \NC Plain \TeX{}
+ \NC \plainop/
\NC \inlineTEX{\lwcdisablecmd{$\meta{\backslash macro}$}}
\NC\NR
\NC \LaTeX{}
diff --git a/macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkiv b/macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkiv
index 83f72b3905..9ea5ee5ce2 100644
--- a/macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkiv
+++ b/macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkiv
@@ -1,10 +1,10 @@
%D \module
%D [ file=t-lua-widow-control,
-%D version=2.0.4, %%version
+%D version=2.0.5, %%version
%D title=lua-widow-control,
%D subtitle=\ConTeXt module for lua-widow-control,
%D author=Max Chernoff,
-%D date=2022-04-07, %%dashdate
+%D date=2022-04-13, %%dashdate
%D copyright=Max Chernoff,
%D license=MPL-2.0+,
%D url=https://github.com/gucci-on-fleek/lua-widow-control]
@@ -83,20 +83,21 @@
% Expansion of some parts of the document, such as section headings, is quite
% undesirable, so we'll disable \lwc/ for certain commands.
% We should only reenable \lwc/ at the end if it was already enabled.
-\newif\iflwc_should_reenable
+\newcount\lwc_disable_count
\define\lwc_patch_pre{%
\iflwc%
- \lwc_should_reenabletrue%
- \setuplwc[state=stop]%
- \else%
- \lwc_should_reenablefalse
+ \advance\lwc_disable_count by 1%
+ \setuplwc[\c!state=\v!stop]%
\fi%
}
-\define\lwc_patch_post{\iflwc_should_reenable%
- \setuplwc[state=start]%
-\fi}
+\define\lwc_patch_post{
+ \ifnum\lwc_disable_count>0%
+ \setuplwc[\c!state=\v!start]%
+ \advance\lwc_disable_count by -1%
+ \fi%
+}
\prependtoks\lwc_patch_pre\to\everybeforesectionheadhandle % Sectioning
\prependtoks\lwc_patch_post\to\everyaftersectionheadhandle
diff --git a/macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkxl b/macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkxl
index 83f72b3905..9ea5ee5ce2 100644
--- a/macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkxl
+++ b/macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkxl
@@ -1,10 +1,10 @@
%D \module
%D [ file=t-lua-widow-control,
-%D version=2.0.4, %%version
+%D version=2.0.5, %%version
%D title=lua-widow-control,
%D subtitle=\ConTeXt module for lua-widow-control,
%D author=Max Chernoff,
-%D date=2022-04-07, %%dashdate
+%D date=2022-04-13, %%dashdate
%D copyright=Max Chernoff,
%D license=MPL-2.0+,
%D url=https://github.com/gucci-on-fleek/lua-widow-control]
@@ -83,20 +83,21 @@
% Expansion of some parts of the document, such as section headings, is quite
% undesirable, so we'll disable \lwc/ for certain commands.
% We should only reenable \lwc/ at the end if it was already enabled.
-\newif\iflwc_should_reenable
+\newcount\lwc_disable_count
\define\lwc_patch_pre{%
\iflwc%
- \lwc_should_reenabletrue%
- \setuplwc[state=stop]%
- \else%
- \lwc_should_reenablefalse
+ \advance\lwc_disable_count by 1%
+ \setuplwc[\c!state=\v!stop]%
\fi%
}
-\define\lwc_patch_post{\iflwc_should_reenable%
- \setuplwc[state=start]%
-\fi}
+\define\lwc_patch_post{
+ \ifnum\lwc_disable_count>0%
+ \setuplwc[\c!state=\v!start]%
+ \advance\lwc_disable_count by -1%
+ \fi%
+}
\prependtoks\lwc_patch_pre\to\everybeforesectionheadhandle % Sectioning
\prependtoks\lwc_patch_post\to\everyaftersectionheadhandle