Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tagging/gh767 #1561

Merged
merged 12 commits into from
Nov 25, 2024
16 changes: 15 additions & 1 deletion required/latex-lab/changes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
2024-11-23 Frank Mittelbach <[email protected]>

* latex-lab-block.dtx (subsubsection{Implementation of block templates \ldots}):
Use private storage bin for parindent and not \listparindent to decouple block
and list templates (tagging/767)

(subsubsection{Blockquote instances}):
Theorems use their own block-instance and not displayblock to allow for
customization (tagging/767)

* latex-lab-firstaid.dtx (subsection{ams classes and amsthm}):
Move the theorem link target later to not have to force hmode with \leavevmode.
Otherwise theorems get always an indentation.

2024-11-21 Ulrike Fischer <[email protected]>
* latex-lab-float.dtx: Correct socket declaration.

Expand All @@ -6,7 +20,7 @@

2024-10-25 Ulrike Fischer <[email protected]>
* latex-lab-math.dtx: reorganized luamml and mathml options
to support also structure elements and extended the documentation. Corrected
to support also structure elements and extended the documentation. Corrected
handling of alt-texts. Added examples for the various options.

2024-10-16 Ulrike Fischer <[email protected]>
Expand Down
64 changes: 55 additions & 9 deletions required/latex-lab/latex-lab-block.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
%
% https://www.latex-project.org/lppl.txt
%
\def\ltlabblockdate{2024-10-11}
\def\ltlabblockversion{0.8v}
\def\ltlabblockdate{2024-11-23}
\def\ltlabblockversion{0.8w}
%<*driver>
\documentclass[kernel]{l3doc}
\usepackage{amstext}
Expand Down Expand Up @@ -1244,6 +1244,12 @@
{
item-indent=-1.5em,
parindent=-1.5em,
% \end{macrocode}
%
% \changes{v0.8w}{2024/11/23}{Need to set \cs{listparindent} now that
% block and list templates are decoupled (tagging/767)}
% \begin{macrocode}
listparindent=-1.5em,
item-skip=0pt,
rightmargin=\leftmargin,
leftmargin=\leftmargin+1.5em,
Expand Down Expand Up @@ -1449,7 +1455,12 @@
\def\@begintheorem#1#2{
\UseInstance{blockenv}{theorem}{}
\tagpdfparaOff
\mode_leave_vertical:
% \end{macrocode}
%
% \changes{v0.8w}{2024/11/23}{\LaTeXe{} theorems always start out
% without indentation (tagging/767)}
% \begin{macrocode}
\noindent
\MakeLinkTarget{\l_@@_thm_current_counter_tl}
\tag_struct_begin:n{tag=Caption}
\group_begin:
Expand Down Expand Up @@ -1479,7 +1490,12 @@
\def\@opargbegintheorem#1#2#3{
\UseInstance{blockenv}{theorem}{}
\tagpdfparaOff
\mode_leave_vertical:
% \end{macrocode}
%
% \changes{v0.8w}{2024/11/23}{\LaTeXe{} theorems always start out
% without indentation (tagging/767)}
% \begin{macrocode}
\noindent
\MakeLinkTarget{\l_@@_thm_current_counter_tl}
\tag_struct_begin:n{tag=Caption}
\group_begin:
Expand Down Expand Up @@ -1915,7 +1931,13 @@
%
% \begin{template}{block display}
%
% In contrast to the \LaTeXe{} implementation we do not directly
% use \cs{listparindent} here but a private register of the
% template. The reason is that block template instances are also
% used outside of lists.
% \changes{v0.8s}{2024/10/03}{Offer item-skip key also on block templates}
% \changes{v0.8w}{2024/11/23}{Use private storage bin for parindent
% and not \cs{listparindent} to decouple block and list templates (tagging/767)}
% \begin{macrocode}
\DeclareTemplateCode{block}{display}{1}
{
Expand All @@ -1930,7 +1952,7 @@
endpenalty = \@endparpenalty ,
rightmargin = \rightmargin ,
leftmargin = \leftmargin ,
parindent = \listparindent ,
parindent = \l_@@block_parindent_dim ,
FrankMittelbach marked this conversation as resolved.
Show resolved Hide resolved
}
{
\tl_if_empty:nF {#1} { \SetTemplateKeys{block}{display}{#1} }
Expand Down Expand Up @@ -2018,7 +2040,11 @@
}
\skip_set_eq:NN \@outerparskip \parskip
\skip_set_eq:NN \parskip \parsep
\dim_set_eq:NN \parindent \listparindent
% \end{macrocode}
% \changes{v0.8w}{2024/11/23}{Use private storage bin for parindent
% and not \cs{listparindent} to decouple block and list templates (tagging/767)}
% \begin{macrocode}
\dim_set_eq:NN \parindent \l_@@block_parindent_dim
\dim_add:Nn \linewidth { - \rightmargin - \leftmargin }
\dim_add:Nn \@totalleftmargin { \leftmargin }
\tex_parshape:D 1 ~ \@totalleftmargin \linewidth
Expand Down Expand Up @@ -3098,6 +3124,8 @@
%

%
% \changes{v0.8w}{2024/11/23}{Theorems use their own block-instance
% and not displayblock to allow for customization (tagging/767)}
% \begin{macrocode}
\DeclareInstance{blockenv}{theorem}{display}
{
Expand All @@ -3108,9 +3136,7 @@
inner-level-counter = ,
level-increase = false,
setup-code = ,
block-instance = displayblock ,
% inner-instance-type = innerblock ,
% inner-instance = theorem,
block-instance = theoremblock ,
}
% \end{macrocode}
%
Expand Down Expand Up @@ -3356,6 +3382,26 @@
% \end{instance}
%
%
% \subsubsection{Block instances for the theorems}
%
%
% \begin{instance}{block theoremblock-0 }
FrankMittelbach marked this conversation as resolved.
Show resolved Hide resolved
% Theorems do not support nesting, so we have only one to set up.
% The \LaTeX{} default reused the general value of \cs{parindent}
% and \cs{parskip} and, of course, they start at the outer margin.
% \changes{v0.8w}{2024/11/23}{Add block instance for theorems}
% \begin{macrocode}
\DeclareInstance{block}{theoremblock-0}{display}
{
leftmargin = 0pt ,
parindent = \parindent ,
par-skip = \parskip ,
}
% \end{macrocode}
% \end{instance}
%
%
%
% \subsubsection{Block instances for the standard lists}
%
% \begin{instance}{block list-1,
Expand Down
49 changes: 26 additions & 23 deletions required/latex-lab/latex-lab-firstaid.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
%
% for those people who are interested or want to report an issue.
%
\def\ltlabfirstaiddate{2024-10-16}
\def\ltlabfirstaidversion{0.85h}
\def\ltlabfirstaiddate{2024-11-23}
\def\ltlabfirstaidversion{0.85i}
%<*driver>
\documentclass{l3doc}
\EnableCrossrefs
Expand Down Expand Up @@ -179,35 +179,38 @@
% While create the caption/label we disable para-tagging.
% \begin{macrocode}
\tagpdfparaOff
\mode_leave_vertical:
% \end{macrocode}
% The anchor for links. amsthm allows for unnumbered theorems so we have to test
% for an empty counter.
% \changes{v0.85h}{2024/10/16}{add test if counter is empty tagging/736}
% \begin{macrocode}
\tl_if_empty:NTF \l__block_thm_current_counter_tl
{\MakeLinkTarget[theorem]{}}
{\MakeLinkTarget{\l__block_thm_current_counter_tl}}
\group_begin:
\normalfont
\the\thm@headfont \thm@indent
\normalfont
\the\thm@headfont \thm@indent
% \end{macrocode}
% The anchor for links. It must be inserted when we have started hmode
% (which happens with \cs{thm@indent}). \pkg{amsthm} allows for unnumbered
% theorems so we have to test for an empty counter.
% \changes{v0.85h}{2024/10/16}{add test if counter is empty
% tagging/736}
% \changes{v0.85i}{2024/11/23}{Do not use \cs{leavevmode} but wait
% for hmode to add the link target}
% \begin{macrocode}
\tl_if_empty:NTF \l__block_thm_current_counter_tl
{\MakeLinkTarget[theorem]{}}
{\MakeLinkTarget{\l__block_thm_current_counter_tl}}
\@ifempty{##1}
{\let\thmname\@gobble}
{\let\thmname\@gobble}
% \end{macrocode}
% we insert the MC and the Lbl structure into \cs{thmname},
% \cs{thmnumber} and \cs{thmnote}. This will also work
% with new theorem style as long as they use these command.
% \begin{macrocode}
{\def\thmname####1{\tag_mc_begin:n {}####1\tag_mc_end:}}%
{\def\thmname####1{\tag_mc_begin:n {}####1\tag_mc_end:}}%
\@ifempty{##2}
{\let\thmnumber\@gobble}
{\def\thmnumber####1
{\tag_struct_begin:n{tag=Lbl}\tag_mc_begin:n {}
####1
\tag_mc_end:\tag_struct_end:}}%
{\let\thmnumber\@gobble}
{\def\thmnumber####1
{\tag_struct_begin:n{tag=Lbl}\tag_mc_begin:n {}
####1
\tag_mc_end:\tag_struct_end:}}%
\@ifempty{##3}
{\let\thmnote\@gobble}
{\def\thmnote####1{\tag_mc_begin:n{}####1\tag_mc_end:}}%
{\let\thmnote\@gobble}
{\def\thmnote####1{\tag_mc_begin:n{}####1\tag_mc_end:}}%
\tag_struct_begin:n{tag=Caption}
\thm@swap\swappedhead\thmhead{##1}{##2}{##3}%
\tag_mc_begin:n{}\the\thm@headpunct\tag_mc_end:
Expand All @@ -221,7 +224,7 @@
% be used if tagging is active!
% \begin{macrocode}
\tagpdfparaOn
\UseTaggingSocket{para/begin} %
\UseTaggingSocket{para/begin}
\ignorespaces}
% \end{macrocode}
% This redefines the standard styles for the theorem heads.
Expand Down
1 change: 1 addition & 0 deletions required/latex-lab/testfiles-block/blocks-000.luatex.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ LaTeX template Info: Declaring template type 'item' taking 1 argument(s) on line
\l__par_start_skip=\skip...
\l__block_botsep_skip=\skip...
\l__block_parbotsep_skip=\skip...
\l__blockblock_parindent_dim=\dimen...
\l__block_counter_start_int=\count...
\l__block_one_label_box=\box...
\g__block_labels_box=\box...
Expand Down
1 change: 1 addition & 0 deletions required/latex-lab/testfiles-block/blocks-000.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ LaTeX template Info: Declaring template type 'item' taking 1 argument(s) on line
\l__par_start_skip=\skip...
\l__block_botsep_skip=\skip...
\l__block_parbotsep_skip=\skip...
\l__blockblock_parindent_dim=\dimen...
\l__block_counter_start_int=\count...
\l__block_one_label_box=\box...
\g__block_labels_box=\box...
Expand Down
30 changes: 15 additions & 15 deletions required/latex-lab/testfiles-block/blocks-theorem-01.luatex.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Package tagpdf Info: Parent-Child 'P' --> 'MC'.
Package tagpdf Info: closing structure 11 tagged /text
Package tagpdf Info: closing structure 10 tagged /text-unit
==> theorem-like-env-start
==> use instance: displayblock-0
==> use instance: theoremblock-0
Package tagpdf Info: Parent-Child 'Sect' --> 'Sect'.
(tagpdf) Relation is 1 (='0..n')
(tagpdf) Rolemapped from: 'Sect' --> 'theorem-like' on line ...
Expand Down Expand Up @@ -120,7 +120,7 @@ Package tagpdf Info: Parent-Child 'P' --> 'MC'.
Package tagpdf Info: closing structure 22 tagged /text
Package tagpdf Info: closing structure 21 tagged /text-unit
==> theorem-like-env-start
==> use instance: displayblock-0
==> use instance: theoremblock-0
Package tagpdf Info: Parent-Child 'Sect' --> 'Sect'.
(tagpdf) Relation is 1 (='0..n')
(tagpdf) Rolemapped from: 'Sect' --> 'theorem-like' on line ...
Expand Down Expand Up @@ -154,7 +154,7 @@ Package tagpdf Info: closing structure 26 tagged /text-unit
==> block-end on input line ...
Package tagpdf Info: closing structure 23 tagged /theorem-like
==> theorem-like-env-start
==> use instance: displayblock-0
==> use instance: theoremblock-0
Package tagpdf Info: Parent-Child 'Sect' --> 'Sect'.
(tagpdf) Relation is 1 (='0..n')
(tagpdf) Rolemapped from: 'Sect' --> 'theorem-like' on line ...
Expand Down Expand Up @@ -220,7 +220,7 @@ Package tagpdf Info: Parent-Child 'P' --> 'MC'.
Package tagpdf Info: closing structure 37 tagged /text
Package tagpdf Info: closing structure 36 tagged /text-unit
==> theorem-like-env-start
==> use instance: displayblock-0
==> use instance: theoremblock-0
Package tagpdf Info: Parent-Child 'Sect' --> 'Sect'.
(tagpdf) Relation is 1 (='0..n')
(tagpdf) Rolemapped from: 'Sect' --> 'theorem-like' on line ...
Expand Down Expand Up @@ -268,7 +268,7 @@ Package tagpdf Info: closing structure 43 tagged /text-unit
==> block-end on input line ...
Package tagpdf Info: closing structure 38 tagged /theorem-like
==> theorem-like-env-start
==> use instance: displayblock-0
==> use instance: theoremblock-0
Package tagpdf Info: Parent-Child 'Sect' --> 'Sect'.
(tagpdf) Relation is 1 (='0..n')
(tagpdf) Rolemapped from: 'Sect' --> 'theorem-like' on line ...
Expand Down Expand Up @@ -384,16 +384,6 @@ Package tagpdf Info: closing structure 59 tagged /LI
Package tagpdf Info: Parent-Child 'L' --> 'LI'.
(tagpdf) Relation is 1 (='0..n')
(tagpdf) Rolemapped from: 'L' --> 'LI' on line ...
Package tagpdf Info: -1 has been pushed to the mc stack
Package tagpdf Info: -1 has been removed from the mc stack
Package tagpdf Info: -1 has been pushed to the mc stack
Package tagpdf Info: -1 has been removed from the mc stack
tagpdf: INFO TAG-NOT-TAGGED: this has not been tagged, using artifact
tagpdf: INFO TAG-NOT-TAGGED: this has not been tagged, using artifact
tagpdf: INFO TAG-NOT-TAGGED: this has not been tagged, using artifact
tagpdf: INFO TAG-NOT-TAGGED: this has not been tagged, using artifact
tagpdf: INFO TAG-NOT-TAGGED: this has not been tagged, using artifact [1
]
==> template:item:std
Package tagpdf Info: Parent-Child 'LI' --> 'Lbl'.
(tagpdf) Relation is 1 (='0..n')
Expand All @@ -418,6 +408,16 @@ Package tagpdf Info: Parent-Child 'P' --> 'MC'.
(tagpdf) Rolemapped from: 'P' --> 'MC' on line ...
Package tagpdf Info: closing structure 68 tagged /text
Package tagpdf Info: closing structure 67 tagged /text-unit
Package tagpdf Info: -1 has been pushed to the mc stack
Package tagpdf Info: -1 has been removed from the mc stack
Package tagpdf Info: -1 has been pushed to the mc stack
Package tagpdf Info: -1 has been removed from the mc stack
tagpdf: INFO TAG-NOT-TAGGED: this has not been tagged, using artifact
tagpdf: INFO TAG-NOT-TAGGED: this has not been tagged, using artifact
tagpdf: INFO TAG-NOT-TAGGED: this has not been tagged, using artifact
tagpdf: INFO TAG-NOT-TAGGED: this has not been tagged, using artifact
tagpdf: INFO TAG-NOT-TAGGED: this has not been tagged, using artifact [1
]
Package tagpdf Info: closing structure 66 tagged /LBody
Package tagpdf Info: closing structure 64 tagged /LI
Package tagpdf Info: Parent-Child 'L' --> 'LI'.
Expand Down
Loading