Skip to content

Commit 49afc77

Browse files
Tagging 1199 1202 1203 1207 (latex3#1993)
* fix for latex3/tagging-project#1999 latex3/tagging-project/latex3#1202 and latex3/tagging-project/latex3#1203 * fix test * fix for latex3/tagging-project#1299 latex3/tagging-project#1202 latex3/tagging-project#1203 * fix for latex3/tagging-project#1200 * unboxed captions ... * and a few more * fix for latex3/tagging-project#1207
1 parent 0d38891 commit 49afc77

17 files changed

Lines changed: 1000 additions & 1123 deletions

required/latex-lab/changes.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
2026-02-02 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
2+
3+
* latex-lab-block.dtx (subsection{Template types and template interfaces}):
4+
Add caption-unbreakable key (tagging/1200)
5+
6+
(subsection{Template types and template interfaces}):
7+
Use \proofname as value for title proof template (tagging/1207)
8+
9+
2026-02-01 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
10+
11+
* latex-lab-block.dtx (subsubsection{Declarations for theorem-like environments}):
12+
Argument applied to the wrong keys (tagging/1202)
13+
14+
(subsubsection{The \insttype{thmstyle} instances they use}):
15+
Add further decl keys (tagging/1199)
16+
17+
(subsubsection{The \insttype{thmstyle} instances they use}):
18+
Change order of elements (tagging/1199)
19+
20+
(subsubsection{Supporting QED in proofs}):
21+
Stray definition of \cs{math@qedhere} removed (taggging/1203)
22+
123
2026-01-28 Joseph Wright <Joseph.Wright@latex-project.org>
224
* latex-lab-math.dtx: Support nested alignments when grabbing math
325

required/latex-lab/latex-lab-block.dtx

Lines changed: 103 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
%
1010
% https://www.latex-project.org/lppl.txt
1111
%
12-
\def\ltlabblockdate{2026-01-26}
13-
\def\ltlabblockversion{0.9m}
12+
\def\ltlabblockdate{2026-02-02}
13+
\def\ltlabblockversion{0.9n}
1414

1515
%<*driver>
1616
\DocumentMetadata{tagging=on,pdfstandard=ua-2,lang=en}
@@ -599,13 +599,17 @@
599599
%
600600
% \TemplateKey{title}{tokenlist}
601601
% {Heading for the environment unless overwritten on
602-
% document level.}{Proof}
602+
% document level. The default value, i.e.,
603+
% \cs{proofname} resolves to \enquote{Proof}
604+
% unless changed}{\cs{proofname}}
603605
% \TemplateKey{punct}{tokenlist}
604606
% {Punctuation following the heading.}{.}
605607
% \TemplateKey{caption-placement}{choice}
606608
% {Supported values
607609
% \keyvalue{chained},\keyvalue{unchained}, and
608610
% \keyvalue{standalone}}{unchained}
611+
% \TemplateKey{caption-unbreakable}{boolean}
612+
% {Can this caption have (implicit or explicit) line breaks?}{false}
609613
% \TemplateKey{before-hspace}{skip}
610614
% {Horizontal displacement of the heading.}{0pt}
611615
% \TemplateKey{after-hspace}{skip}
@@ -614,6 +618,12 @@
614618
% \TemplateKey{caption-decls}{tokenlist}
615619
% {Declarations that are applied to the whole caption,
616620
% e.g., some font settings.}{\meta{empty}}
621+
% \TemplateKey{title-decls}{tokenlist}
622+
% {Declarations that are applied only to the caption
623+
% title.}{\meta{empty}}
624+
% \TemplateKey{punct-decls}{tokenlist}
625+
% {Declarations that are applied only to the caption
626+
% punctuation.}{\meta{empty}}
617627
% \TemplateKey{title-format}{function{1}}
618628
% {Formatting applied to the \key{title} value.}{\#1}
619629
% \TemplateKey{punct-format}{function{1}}
@@ -649,6 +659,8 @@
649659
% {Supported values
650660
% \keyvalue{chained},\keyvalue{unchained}, and
651661
% \keyvalue{standalone}}{unchained}
662+
% \TemplateKey{caption-unbreakable}{boolean}
663+
% {Can this caption have (implicit or explicit) line breaks?}{false}
652664
% \TemplateKey{before-hspace}{skip}
653665
% {Horizontal displacement of the heading.}{0pt}
654666
% \TemplateKey{after-hspace}{skip}
@@ -657,10 +669,20 @@
657669
% \TemplateKey{order}{commalist}
658670
% {Order of elements in the environment
659671
% caption/heading. Supported values are \texttt{title},
660-
% \texttt{number}, \texttt{punct}, \texttt{space}, and \texttt{note}.}{title,space,number,space,note}
661-
% \TemplateKey{caption-decls}{tokenlist}
662-
% {Declarations that are applied to the whole caption,
663-
% e.g., some font settings.}{\meta{empty}}
672+
% \texttt{number}, \texttt{punct}, \texttt{space}, and
673+
% \texttt{note}.}{title,space,number,space,note,punct}
674+
% \TemplateKey{title-decls}{tokenlist}
675+
% {Declarations that are applied only to the caption
676+
% title.}{\meta{empty}}
677+
% \TemplateKey{number-decls}{tokenlist}
678+
% {Declarations that are applied only to the caption
679+
% number.}{\meta{empty}}
680+
% \TemplateKey{punct-decls}{tokenlist}
681+
% {Declarations that are applied only to the caption
682+
% punctuation.}{\meta{empty}}
683+
% \TemplateKey{note-decls}{tokenlist}
684+
% {Declarations that are applied only to the caption
685+
% note.}{\meta{empty}}
664686
% \TemplateKey{title-format}{function{1}}
665687
% {Formatting applied to the \key{title} value.}{\#1}
666688
% \TemplateKey{number-format}{function{1}}
@@ -1897,6 +1919,8 @@
18971919
% The main style used for many theorem-like environments, i.e., the
18981920
% one you get if no special \cs{theoremstyle} has been specified.
18991921
%
1922+
% \changes{v0.9n}{2026/02/01}{Change order of elements (tagging/1199)}
1923+
% \changes{v0.9n}{2026/02/01}{Add further decl keys (tagging/1199)}
19001924
% \begin{macrocode}
19011925
\DeclareInstance{thmstyle}{plain}{std}
19021926
{
@@ -1906,8 +1930,12 @@
19061930
,punct = .
19071931
,before-hspace = 0pt
19081932
,after-hspace = 5pt plus 1pt minus 1pt
1909-
,order = {title, space, number, punct, space, note}
1933+
,order = {title, space, number, space, note, punct}
19101934
,caption-decls = \bfseries
1935+
,title-decls =
1936+
,number-decls =
1937+
,punct-decls =
1938+
,note-decls =
19111939
,title-format = #1
19121940
,number-format = #1
19131941
,punct-format = #1
@@ -1924,7 +1952,7 @@
19241952
\DeclareInstanceCopy{thmstyle}{remark}{plain}
19251953
\EditInstance{thmstyle}{remark}
19261954
{
1927-
,caption-decls = \itshape
1955+
,title-decls = \itshape
19281956
,body-decls = \normalfont
19291957
}
19301958
% \end{macrocode}
@@ -2099,10 +2127,11 @@
20992127
% proof because proofs are not numbered and the argument to a proof
21002128
% environment has a somewhat different semantic meaning than that
21012129
% of theorem-like environments.
2130+
%
21022131
% \begin{macrocode}
21032132
\DeclareInstance{captionedtext}{proof}{proof}
21042133
{
2105-
,title = Proof
2134+
,title = \proofname % default value
21062135
,punct = .
21072136
,before-hspace = 0pt
21082137
,after-hspace = 5pt plus 1pt minus 1pt
@@ -3242,39 +3271,62 @@
32423271
% any delegation and therefore shows several keys for customizing
32433272
% the layout (similar to those seen with \insttype{thmstyle}
32443273
% \instname{std}).
3274+
% \changes{v0.9n}{2026/02/01}{Add further decl keys (tagging/1199)}
3275+
% \changes{v0.9n}{2026/02/01}{Add caption-unbreakable key (tagging/1200)}
3276+
% \changes{v0.9n}{2026/02/02}{Use \cs{proofname} as value for title (tagging/1207)}
32453277
% \begin{macrocode}
32463278
\DeclareTemplateInterface{captionedtext}{proof}{4}
32473279
{
3248-
,title : tokenlist = Proof
3280+
,title : tokenlist = \proofname
32493281
,punct : tokenlist = .
32503282
,caption-placement : choice {chained,unchained,standalone} = unchained
3283+
,caption-unbreakable : boolean = false
32513284
,before-hspace : skip = 0pt
32523285
,after-hspace : skip = 5pt
32533286
,caption-decls : tokenlist =
3287+
,title-decls : tokenlist =
3288+
,punct-decls : tokenlist =
32543289
,title-format : function{1} = #1
32553290
,punct-format : function{1} = #1
32563291
,body-decls : tokenlist =
32573292
}
32583293
% \end{macrocode}
32593294
% \end{template}
32603295
%
3296+
% \begin{macro}{\proofname}
3297+
% The \pkg{amsthm} package supported redefinition of \cs{proofname}
3298+
% as a means to alter default caption for proofs. We continue to
3299+
% support this as long as the instance declaration doesn't
3300+
% overwrite it.
3301+
% \changes{v0.9n}{2026/02/02}{Macro \cs{proofname} added (tagging/1207)}
3302+
% \begin{macrocode}
3303+
\newcommand\proofname{Proof}
3304+
% \end{macrocode}
3305+
% \end{macro}
32613306
%
32623307
%
32633308
%
32643309
%
32653310
% \begin{template}{thmstyle std}
32663311
%
3312+
% \changes{v0.9n}{2026/02/01}{Add further decl keys (tagging/1199)}
3313+
% \changes{v0.9n}{2026/02/01}{Add caption-unbreakable key (tagging/1200)}
32673314
% \begin{macrocode}
32683315
\DeclareTemplateInterface{thmstyle}{std}{4}
32693316
{
32703317
,numbered : boolean = true
32713318
,space : tokenlist = \ % <- bad name?
32723319
,punct : tokenlist = .
32733320
,caption-placement : choice {chained,unchained,standalone} = unchained
3321+
,caption-unbreakable : boolean = false
32743322
,before-hspace : skip = 0pt
32753323
,after-hspace : skip = 5pt
32763324
,order : commalist = { title, space, number, punct, space, note }
32773325
,caption-decls : tokenlist =
3326+
,title-decls : tokenlist =
3327+
,number-decls : tokenlist =
3328+
,punct-decls : tokenlist =
3329+
,note-decls : tokenlist =
32783330
,title-format : function{1} = #1
32793331
,number-format : function{1} = #1
32803332
,punct-format : function{1} = #1
@@ -4167,7 +4219,10 @@
41674219
% \begin{macrocode}
41684220
\legacy_if_gset_false:n { @inlabel }
41694221
\para_omit_indent:
4170-
\box_use_drop:N \g_@@_labels_box
4222+
\bool_if:NTF \l_@@_caption_unbreakable_bool
4223+
\box_use_drop:N
4224+
\hbox_unpack_drop:N
4225+
\g_@@_labels_box
41714226
\__kernel_list_label_after:n { \PARALABEL } % <- change
41724227
% this name
41734228
\penalty \c_zero_int
@@ -5084,6 +5139,7 @@
50845139
% separation into two templates is that typically the same design
50855140
% is used for different theorem-like environments only differing in
50865141
% this fixed string.
5142+
% \changes{v0.9n}{2026/02/01}{Add further decl keys (tagging/1199)}
50875143
% \begin{macrocode}
50885144
\DeclareTemplateCode{thmstyle}{std}{4}
50895145
{
@@ -5098,10 +5154,15 @@
50985154
,standalone = \bool_gset_true:N \g_@@_label_standalone_bool
50995155
\bool_gset_false:N \g_@@_label_unchained_bool
51005156
}
5157+
,caption-unbreakable = \l_@@_caption_unbreakable_bool
51015158
,before-hspace = \l_@@_caption_before_skip
51025159
,after-hspace = \l_@@_caption_after_skip
51035160
,order = \l_@@_order_clist
51045161
,caption-decls = \l_@@_caption_decls_tl
5162+
,title-decls = \l_@@_title_decls_tl
5163+
,number-decls = \l_@@_number_decls_tl
5164+
,punct-decls = \l_@@_punct_decls_tl
5165+
,note-decls = \l_@@_note_decls_tl
51055166
,title-format = \@@_title_format:n
51065167
,number-format = \@@_number_format:n
51075168
,punct-format = \@@_punct_format:n
@@ -5282,7 +5343,9 @@
52825343
\@@_insert_spaces:
52835344
% \end{macrocode}
52845345
% The title may have its own formatting:
5346+
% \changes{v0.9n}{2026/02/01}{Add decl key (tagging/1199)}
52855347
% \begin{macrocode}
5348+
\l_@@_title_decls_tl
52865349
\@@_title_format:n \l_@@_title_tl }
52875350
}
52885351
}
@@ -5292,12 +5355,14 @@
52925355
%
52935356
% \begin{macro}{\@@_do_note:}
52945357
% Formatting of a note (if present) uses the same structure.
5358+
% \changes{v0.9n}{2026/02/01}{Add decl key (tagging/1199)}
52955359
% \begin{macrocode}
52965360
\cs_new_protected:Npn \@@_do_note: {
52975361
\tl_if_novalue:oTF \l_@@_note_tl
52985362
{ \@@_drop_spaces: }
52995363
{ \tag_socket_use:nnn {mc} {} {
53005364
\@@_insert_spaces:
5365+
\l_@@_note_decls_tl
53015366
\@@_note_format:n \l_@@_note_tl }
53025367
}
53035368
}
@@ -5308,11 +5373,13 @@
53085373
% \begin{macro}{\@@_do_number:}
53095374
% The number (if present) has a similar formatting but it uses an
53105375
% \UseStructureName{block/theorem-like/label} structure:
5376+
% \changes{v0.9n}{2026/02/01}{Add decl key (tagging/1199)}
53115377
% \begin{macrocode}
53125378
\cs_new_protected:Npn \@@_do_number: {
53135379
\bool_if:NTF \l_@@_numbered_bool
53145380
{ \tag_socket_use:nnn {struct-mc} {tag=\UseStructureName{block/theorem-like/label}}
53155381
{ \@@_insert_spaces:
5382+
\l_@@_number_decls_tl
53165383
\@@_number_format:n {
53175384
\use:c{ the \l_@@_counter_tl } }
53185385
}
@@ -5326,11 +5393,13 @@
53265393
% \begin{macro}{\@@_do_punct:}
53275394
% The punctuation is handled slightly differently. It unconditionally drops any
53285395
% dangling spaces whether or not it is empty:
5396+
% \changes{v0.9n}{2026/02/01}{Add decl key (tagging/1199)}
53295397
% \begin{macrocode}
53305398
\cs_new_protected:Npn \@@_do_punct: {
53315399
\@@_drop_spaces:
53325400
\tl_if_empty:NF \l_@@_punct_tl
53335401
{ \tag_socket_use:nnn {mc} {}{
5402+
\l_@@_punct_decls_tl
53345403
\@@_punct_format:n \l_@@_punct_tl }
53355404
}
53365405
}
@@ -5386,11 +5455,13 @@
53865455
%
53875456
% \begin{template}{captionedtext proof}
53885457
% In case of the templates for proofs we do everything in a single template.
5458+
% \changes{v0.9n}{2026/02/01}{Add further decl keys (tagging/1199)}
5459+
% \changes{v0.9n}{2026/02/01}{Add caption-unbreakable key (tagging/1200)}
53895460
% \begin{macrocode}
53905461
\DeclareTemplateCode{captionedtext}{proof}{4}
53915462
{
5392-
,title = \l_@@_title_tl
5393-
,punct = \l_@@_punct_tl
5463+
,title = \l_@@_title_tl
5464+
,punct = \l_@@_punct_tl
53945465
,caption-placement = {
53955466
chained = \bool_gset_false:N \g_@@_label_standalone_bool
53965467
\bool_gset_false:N \g_@@_label_unchained_bool
@@ -5399,12 +5470,15 @@
53995470
,standalone = \bool_gset_true:N \g_@@_label_standalone_bool
54005471
\bool_gset_false:N \g_@@_label_unchained_bool
54015472
}
5402-
,before-hspace = \l_@@_caption_before_skip
5403-
,after-hspace = \l_@@_caption_after_skip
5404-
,caption-decls = \l_@@_caption_decls_tl
5405-
,title-format = \@@_title_format:n
5406-
,punct-format = \@@_punct_format:n
5407-
,body-decls = \l_@@_body_decls_tl
5473+
,caption-unbreakable = \l_@@_caption_unbreakable_bool
5474+
,before-hspace = \l_@@_caption_before_skip
5475+
,after-hspace = \l_@@_caption_after_skip
5476+
,caption-decls = \l_@@_caption_decls_tl
5477+
,title-decls = \l_@@_title_decls_tl
5478+
,punct-decls = \l_@@_punct_decls_tl
5479+
,title-format = \@@_title_format:n
5480+
,punct-format = \@@_punct_format:n
5481+
,body-decls = \l_@@_body_decls_tl
54085482
}
54095483
{
54105484
% \end{macrocode}
@@ -5448,12 +5522,16 @@
54485522
% \end{macrocode}
54495523
% The remaining code is identical to the one in \insttype{thmstyle}
54505524
% \instname{std}; for documentation see there:
5525+
% \changes{v0.9n}{2026/02/01}{Allow caption to break by default (tagging/1200)}
54515526
% \begin{macrocode}
54525527
\bool_if:NTF \g_@@_label_standalone_bool
54535528
{
54545529
\bool_gset_true:N \g_@@_label_standalone_bool
54555530
\para_omit_indent:
5456-
\box_use_drop:N \g_@@_labels_box
5531+
\bool_if:NTF \l_@@_caption_unbreakable_bool
5532+
\box_use_drop:N
5533+
\hbox_unpack_drop:N
5534+
\g_@@_labels_box
54575535
\par
54585536
}
54595537
{
@@ -6679,11 +6757,12 @@
66796757
\cs_set_protected:Npn \newtheoremstyle #1#2#3#4#5#6#7#8#9 {
66806758
% \end{macrocode}
66816759
% First we build a \insttype{thmstyle} instance:
6760+
% \changes{v0.9n}{2026/02/01}{Argument applied to the wrong keys (tagging/1202)}
66826761
% \begin{macrocode}
66836762
\DeclareInstance{thmstyle}{#1}{std}{
6684-
,caption-decls = {#4}
6763+
,caption-decls = {#6}
66856764
,before-hspace:e = \tl_if_empty:nTF{#5}{0pt}{#5}
6686-
,body-decls = {#6}
6765+
,body-decls = {#4}
66876766
,punct = {#7}
66886767
% \end{macrocode}
66896768
% This setting doesn't cover all syntax possibilities.
@@ -6773,6 +6852,7 @@
67736852
% also not documented---see the \pkg{amsthm} package for
67746853
% documentation for now).
67756854
%
6855+
% \changes{v0.9n}{2026/02/01}{Stray definition of \cs{math@qedhere} removed (taggging/1203)}
67766856
% \begin{macrocode}
67776857
\ExplSyntaxOff
67786858
\def\math@qedhere{%
@@ -6833,8 +6913,6 @@
68336913
\expandafter\let\csname align*@qed\endcsname\align@qed
68346914
\expandafter\let\csname gather*@qed\endcsname\align@qed
68356915
%
6836-
\def\math@qedhere{\quad\hbox{\qedsymbol}}%
6837-
%
68386916
\DeclareRobustCommand{\qed}{%
68396917
\ifmmode \mathqed
68406918
\else

0 commit comments

Comments
 (0)