From ea44ee6bf27654752fd90daab99867491e8f494a Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Tue, 1 Oct 2024 12:05:12 +0200 Subject: [PATCH] Tagging721 (#1479) * fix for tagging 721 * mumble * picking up one changed test after another * .. and two more * and another --- required/latex-lab/changes.txt | 6 +++- required/latex-lab/latex-lab-math.dtx | 31 ++++++++++++++----- required/latex-lab/testfiles-LM/LM-3-3.tlg | 4 +-- .../testfiles-math/mathcapture-016.tlg | 4 ++- .../testfiles-math/mtag-005-intertext.tlg | 4 ++- .../latex-lab/testfiles-math/mtag-tlc3.tlg | 26 ++++++++-------- .../testfiles-table-pdftex/table-016-math.tlg | 12 +++++-- required/latex-lab/update-math-all.sh | 9 +++++- 8 files changed, 66 insertions(+), 30 deletions(-) diff --git a/required/latex-lab/changes.txt b/required/latex-lab/changes.txt index 5d8b3a0e6..0d84ebc4b 100644 --- a/required/latex-lab/changes.txt +++ b/required/latex-lab/changes.txt @@ -1,3 +1,8 @@ + +2024-09-30 Frank Mittelbach + * latex-lab-math.dtx (subsection{Content grabbing}): + Correct logic for inserting below skips after displays (tagging/721) + 2024-09-26 Ulrike Fischer * latex-lab-firstaid.dtx: add support for theorems declared with amsthm, amsart, amsbook, amsproc. @@ -27,7 +32,6 @@ engines. 2024-09-02 Frank Mittelbach - * latex-lab-block.dtx (subsubsection{List tags}): Do not close LI and LBody if they were never opened because of a missing \item (issue tagging/641) diff --git a/required/latex-lab/latex-lab-math.dtx b/required/latex-lab/latex-lab-math.dtx index 8a68e5f51..449326a87 100644 --- a/required/latex-lab/latex-lab-math.dtx +++ b/required/latex-lab/latex-lab-math.dtx @@ -19,8 +19,8 @@ % for those people who are interested or want to report an issue. % % -\def\ltlabmathdate{2024-09-19} -\def\ltlabmathversion{0.6e} +\def\ltlabmathdate{2024-09-30} +\def\ltlabmathversion{0.6f} % %<*driver> \documentclass{l3doc} @@ -1726,15 +1726,30 @@ % TODO why is that needed? where is para-tagging disabled? % \begin{macrocode} \tagpdfparaOn +% \end{macrocode} +% The \cs{postdisplaypenalty} was temporarily set to 10000 inside +% the display and the \cs{belowdisplayskip} and the +% \cs{belowdisplayshortskip} was negated, so whatever was inserted +% it should have been a negative skip. Whatever skip was added we +% pick it ups value up here, so that we can correct the spacing +% after the tagging code was inserted. +% \begin{macrocode} \l_@@_tmpa_skip \lastskip - \tag_socket_use:n{math/display/formula/end} - \penalty \postdisplaypenalty + \tag_socket_use:n{math/display/formula/end} % \end{macrocode} -% This reinserts the below display skips. It must be doubled to -% get the right amount: +% Now we add a skip without indroducing a page break possibility, +% that should bring the current vertical position back to the point +% where \TeX{} would add the penalty and the \enquote{below skip}. +% \changes{v0.6f}{2024-09-30}{Correct logic for inserting below skips +% after displays (tagging/721)} % \begin{macrocode} - \skip_vertical:n { -\l_@@_tmpa_skip * 2 } -% + \nobreak + \skip_vertical:n { -\l__math_tmpa_skip } % remove the negative belowdisplayskip +% \end{macrocode} +% Then we finally add the real stuff: +% \begin{macrocode} + \penalty \postdisplaypenalty + \skip_vertical:n { -\l__math_tmpa_skip } % insert the correct skip \@doendpe % this has no \end{...} to take care of it } diff --git a/required/latex-lab/testfiles-LM/LM-3-3.tlg b/required/latex-lab/testfiles-LM/LM-3-3.tlg index c2d3f1e6e..b25bb565b 100644 --- a/required/latex-lab/testfiles-LM/LM-3-3.tlg +++ b/required/latex-lab/testfiles-LM/LM-3-3.tlg @@ -606,6 +606,6 @@ Package tagpdf Info: closing structure 90 tagged /text-unit The sequence \g__tag_mc_main_marks_seq contains the items (without outer braces): > {e+} -> {62} -> {79}. +> {57} +> {74}. [2] diff --git a/required/latex-lab/testfiles-math/mathcapture-016.tlg b/required/latex-lab/testfiles-math/mathcapture-016.tlg index ad8efb023..2278ef0e1 100644 --- a/required/latex-lab/testfiles-math/mathcapture-016.tlg +++ b/required/latex-lab/testfiles-math/mathcapture-016.tlg @@ -96,8 +96,10 @@ Completed box being shipped out [1] ....\OML/cmm/m/it/10 : ...\penalty 10000 ...\glue(\belowdisplayskip) -10.0 plus -2.0 minus -5.0 +...\penalty 10000 +...\glue 10.0 plus 2.0 minus 5.0 ...\penalty 0 -...\glue 20.0 plus 4.0 minus 10.0 +...\glue 10.0 plus 2.0 minus 5.0 ...\glue(\parskip) 0.0 plus 1.0 ...\glue(\parskip) 0.0 ...\glue(\baselineskip) 4.27946 diff --git a/required/latex-lab/testfiles-math/mtag-005-intertext.tlg b/required/latex-lab/testfiles-math/mtag-005-intertext.tlg index 5aee1ca9e..16df30ddf 100644 --- a/required/latex-lab/testfiles-math/mtag-005-intertext.tlg +++ b/required/latex-lab/testfiles-math/mtag-005-intertext.tlg @@ -204,8 +204,10 @@ Completed box being shipped out [1] ...\pdfliteral page{EMC} ...\marks4{e-,7,6,} ...\marks4{e+,7,6,} +...\penalty 10000 +...\glue 10.0 plus 2.0 minus 5.0 ...\penalty 0 -...\glue 20.0 plus 4.0 minus 10.0 +...\glue 10.0 plus 2.0 minus 5.0 ...\glue -3.60004 ...\glue 0.0 plus 1.0fil ...\glue 0.0 plus -1.0fil diff --git a/required/latex-lab/testfiles-math/mtag-tlc3.tlg b/required/latex-lab/testfiles-math/mtag-tlc3.tlg index 07d55a75a..5736ecce7 100644 --- a/required/latex-lab/testfiles-math/mtag-tlc3.tlg +++ b/required/latex-lab/testfiles-math/mtag-tlc3.tlg @@ -41,14 +41,14 @@ Math env align ====>tmpmathcontent=macro:-> &= a^3 + 3a^2b + 3ab^2 + b^3 ====>result=macro:-> &= a^3 + 3a^2b + 3ab^2 + b^3 ====>tmpmathcontent=macro:-> +[1 +] ----------------------------------- Math env align x^2 + y^2 & = 1 \\ x & = \sqrt {1-y^2} ====>first-result=macro:->x^2 + y^2 & = 1 ====>first-tmpmathcontent=macro:-> x & = \sqrt {1-y^2} ====>formula has subparts -[1 -] ====>result=macro:-> x & = \sqrt {1-y^2} ====>tmpmathcontent=macro:-> ----------------------------------- @@ -99,13 +99,13 @@ Math env equation* ====>first-result=macro:->\begin {rcases} \bm {B}' &=-c\nabla \times \bm {E} \\ \bm {E}' &=c\nabla \times \bm {B} - 4\pi \bm {J}\, \end {rcases} \quad \text {Maxwell's equations} ====>first-tmpmathcontent=macro:-> ====>formula has no subparts +[2] ----------------------------------- Math env equation \begin {aligned} V_j &= v_j & X_i &= x_i - q_i x_j & &= u_j + \sum _{i\ne j} q_i \\ V_i &= v_i - q_i v_j & X_j &= x_j & U_i &= u_i \end {aligned} ====>first-result=macro:->\begin {aligned} V_j &= v_j & X_i &= x_i - q_i x_j & &= u_j + \sum _{i\ne j} q_i \\ V_i &= v_i - q_i v_j & X_j &= x_j & U_i &= u_i \end {aligned} ====>first-tmpmathcontent=macro:-> ====>formula has no subparts -[2] ----------------------------------- Math env align A_1 &= N_0 (\lambda ; \Omega ') - \phi ( \lambda ; \Omega ') \\ A_2 &= \phi (\lambda ; \Omega ') \phi (\lambda ; \Omega ) \\ \intertext {and finally} A_3 &= \mathcal {N} (\lambda ; \omega ) @@ -159,11 +159,11 @@ f &= g \label {eq:2A} \\ f' &= g' \label {eq:2B} \\ \mathcal {L}f &= \mathcal {L ====>first-result=macro:->f &= g \label {eq:2A} ====>first-tmpmathcontent=macro:-> f' &= g' \label {eq:2B} \\ \mathcal {L}f &= \mathcal {L}g + K \label {eq:2C} ====>formula has subparts +[3] ====>result=macro:-> f' &= g' \label {eq:2B} ====>tmpmathcontent=macro:-> \mathcal {L}f &= \mathcal {L}g + K \label {eq:2C} ====>result=macro:-> \mathcal {L}f &= \mathcal {L}g + K \label {eq:2C} ====>tmpmathcontent=macro:-> -[3] ----------------------------------- Math env align A_1 &= N_0 (\lambda ; \Omega ') - \phi ( \lambda ; \Omega ') \\ A_2 &= \phi (\lambda ; \Omega ') \, \phi (\lambda ; \Omega ) \tag *{ALSO (\theequation )} \\ A_3 &= \mathcal {N} (\lambda ; \omega ) @@ -214,6 +214,7 @@ Math env multline ====>tmpmathcontent=macro:-> \text {Last line of the multline} ====>result=macro:-> \text {Last line of the multline} ====>tmpmathcontent=macro:-> +[4] ----------------------------------- Math env multline \tag {2} \sum _{t \in \mathbf {T}} \int _a^t \biggl \lbrace \int _a^t f(t - x)^2 \, g(y)^2 \,dx \biggr \rbrace \,dy \\ = \sum _{t \notin \mathbf {T}} \int _t^a \biggl \lbrace g(y)^2 \int _t^a f(x)^2 \,dx \biggr \rbrace \,dy @@ -228,7 +229,6 @@ Math env gather* ====>first-result=macro:->\begin {matrix} 0 & 1 \\ 1 & 0 \end {matrix} \quad \begin {pmatrix} 0 & -i \\ i & 0 \end {pmatrix} ====>first-tmpmathcontent=macro:->[10pt] \begin {bmatrix} 0 & -1 \\ 1 & 0 \end {bmatrix} \quad \begin {Bmatrix} 1 & 0 \\ 0 & -1 \end {Bmatrix} \\[10pt] \begin {vmatrix} a & b \\ c & d \end {vmatrix} \quad \begin {Vmatrix} i & 0 \\ 0 & -i \end {Vmatrix} ====>formula has subparts -[4] ====>result=macro:->[10pt] \begin {bmatrix} 0 & -1 \\ 1 & 0 \end {bmatrix} \quad \begin {Bmatrix} 1 & 0 \\ 0 & -1 \end {Bmatrix} ====>tmpmathcontent=macro:->[10pt] \begin {vmatrix} a & b \\ c & d \end {vmatrix} \quad \begin {Vmatrix} i & 0 \\ 0 & -i \end {Vmatrix} ====>result=macro:->[10pt] \begin {vmatrix} a & b \\ c & d \end {vmatrix} \quad \begin {Vmatrix} i & 0 \\ 0 & -i \end {Vmatrix} @@ -251,6 +251,7 @@ Math env equation* ====>first-result=macro:->0 \xleftarrow [\zeta ]{} F \times \Delta (n - 1) \xrightarrow {\partial _0 \alpha (b)} E^{\partial _0 b} ====>first-tmpmathcontent=macro:-> ====>formula has no subparts +[5] ----------------------------------- Math env align* u & \equiv v + 1 \mod {n^2} \\ u & \equiv v + 1 \bmod {n^2} \\ u & = v + 1 \pmod {n^2} \\ u & = v + 1 \pod {n^2} @@ -281,7 +282,6 @@ A \xLeftarrow {\ x} B \xRightarrow [y\ ]{} C \xLeftrightarrow [y]{\ x\ } D \\ A ====>tmpmathcontent=macro:-> \xmapsto {x>0} A \xleftrightarrow [\text {letters}]{} Z ====>result=macro:-> \xmapsto {x>0} A \xleftrightarrow [\text {letters}]{} Z ====>tmpmathcontent=macro:-> -[5] ----------------------------------- Math env gather* \ropen {a,d}=\closed {a,b} + \lopen {b,c} + \dotsb \\[3pt] \open {\frac {a}{b}} \approx \open *{\frac {a}{b}} \neq \closed [\Bigg ]{x} @@ -312,6 +312,7 @@ A \xlongequal [\text {characters}]{ +12 } M \xLongrightarrow [\text {characters} ====>first-result=macro:->A \xlongequal [\text {characters}]{ +12 } M \xLongrightarrow [\text {characters}]{\text {more}} Z ====>first-tmpmathcontent=macro:-> 0 \xrightarrow {x} \epsilon \xlongrightarrow {x} 1 \\ \xLongleftarrow {1} \xLongrightarrow {2} \xlongleftarrow {3} \xlongrightarrow {4} \xlongleftrightarrow {5} ====>formula has subparts +[6] ====>result=macro:-> 0 \xrightarrow {x} \epsilon \xlongrightarrow {x} 1 ====>tmpmathcontent=macro:-> \xLongleftarrow {1} \xLongrightarrow {2} \xlongleftarrow {3} \xlongrightarrow {4} \xlongleftrightarrow {5} ====>result=macro:-> \xLongleftarrow {1} \xLongrightarrow {2} \xlongleftarrow {3} \xlongrightarrow {4} \xlongleftrightarrow {5} @@ -338,7 +339,6 @@ Math env gather ====>tmpmathcontent=macro:-> \bCSb {a} \cdot \bS {c} = \bS {a} \times \bS {c} ====>result=macro:-> \bCSb {a} \cdot \bS {c} = \bS {a} \times \bS {c} ====>tmpmathcontent=macro:-> -[6] ----------------------------------- Math env equation* \overset {*}{X} > \underset {*}{X} \overunderset {\mathsf {def}}{\mathsf {loc.}}{\iff } \sideset {}{'}\sum _{a,b \in \mathbf {R^*}} \overset {a}{\underset {b}{X}} = X @@ -375,6 +375,7 @@ f(x)=a_0+a_1x+a_2x^2+ \overbrace [B]{a_3x^3 + a_4x^4 + \dots + a_{i-1}x^{i-1} + ====>first-result=macro:->f(x)=a_0+a_1x+a_2x^2+ \overbrace [B]{a_3x^3 + a_4x^4 + \dots + a_{i-1}x^{i-1} + \enspace } ^{\text {some explanation}} ====>first-tmpmathcontent=macro:-> \overbrace [e]{\enspace a_ix^i + a_{i+1}x^{i+1}} + \dots + a_{n-1}x^{n-1} ====>formula has subparts +[7] ====>result=macro:-> \overbrace [e]{\enspace a_ix^i + a_{i+1}x^{i+1}} + \dots + a_{n-1}x^{n-1} ====>tmpmathcontent=macro:-> Overfull \hbox (9.0542pt too wide) detected at line 434 @@ -526,16 +527,15 @@ Overfull \hbox (9.0542pt too wide) detected at line 434 .....\mathoff ....\glue(\tabskip) 0.0 .\pdfliteral page{EMC} -.\marks4{e-,294,322,} -.\marks4{e+,294,322,} -.\write1{\new@label@record{mcid-295}{{tagabspage}{\__property_code_tagabspage: }{tagmcabs}{295}{tagmcid}{\__property_code_tagmcid: }}} +.\marks4{e-,295,322,} +.\marks4{e+,295,322,} +.\write1{\new@label@record{mcid-296}{{tagabspage}{\__property_code_tagabspage: }{tagmcabs}{296}{tagmcid}{\__property_code_tagmcid: }}} .\pdfliteral shipout page{/Formula <> BDC} -.\marks4{b-,295,323,Formula,,,} -.\marks4{b+,295,323,Formula,,,} +.\marks4{b-,296,323,Formula,,,} +.\marks4{b+,296,323,Formula,,,} .\mathoff .\glue 0.0 plus 1.0fil ) -[7] [8] [9] [10] diff --git a/required/latex-lab/testfiles-table-pdftex/table-016-math.tlg b/required/latex-lab/testfiles-table-pdftex/table-016-math.tlg index 413895a20..58c0882fd 100644 --- a/required/latex-lab/testfiles-table-pdftex/table-016-math.tlg +++ b/required/latex-lab/testfiles-table-pdftex/table-016-math.tlg @@ -301,8 +301,10 @@ Completed box being shipped out [1] ...\pdfliteral page{EMC} ...\marks4{e-,9,16,} ...\marks4{e+,9,16,} +...\penalty 10000 +...\glue 6.5 plus 3.5 minus 3.0 ...\penalty 0 -...\glue 13.0 plus 7.0 minus 6.0 +...\glue 6.5 plus 3.5 minus 3.0 ...\write1{\new@label@record{mcid-10}{{tagabspage}{\__property_code_tagabspage: }{tagmcabs}{10}{tagmcid}{\__property_code_tagmcid: }}} ...\pdfliteral shipout page{/Formula <> BDC} ...\marks4{b-,10,19,Formula,,,} @@ -422,8 +424,10 @@ Completed box being shipped out [1] ...\pdfliteral page{EMC} ...\marks4{e-,12,19,} ...\marks4{e+,12,19,} +...\penalty 10000 +...\glue 6.5 plus 3.5 minus 3.0 ...\penalty 0 -...\glue 13.0 plus 7.0 minus 6.0 +...\glue 6.5 plus 3.5 minus 3.0 ...\write1{\new@label@record{mcid-13}{{tagabspage}{\__property_code_tagabspage: }{tagmcabs}{13}{tagmcid}{\__property_code_tagmcid: }}} ...\pdfliteral shipout page{/Formula <> BDC} ...\marks4{b-,13,22,Formula,,,} @@ -543,8 +547,10 @@ Completed box being shipped out [1] ...\pdfliteral page{EMC} ...\marks4{e-,15,22,} ...\marks4{e+,15,22,} +...\penalty 10000 +...\glue 6.5 plus 3.5 minus 3.0 ...\penalty 0 -...\glue 13.0 plus 7.0 minus 6.0 +...\glue 6.5 plus 3.5 minus 3.0 ...\glue -6.0 ...\glue 0.0 plus 1.0fil ...\glue 0.0 plus -1.0fil diff --git a/required/latex-lab/update-math-all.sh b/required/latex-lab/update-math-all.sh index d21185a81..1870b9742 100644 --- a/required/latex-lab/update-math-all.sh +++ b/required/latex-lab/update-math-all.sh @@ -11,12 +11,19 @@ l3build save -cconfig-math \ mathcapture-011 \ mathcapture-012 \ mathcapture-014 \ + mathcapture-015 \ + mathcapture-016 \ + mathcapture-017 \ + mathcapture-018 \ + mathcapture-019 \ mtag-001 \ mtag-002 \ mtag-tlc3 \ mathcapture-tag-001 \ mtag-003 \ - mtag-004 + mtag-004 \ + mtag-005-intertext + exit