[latex3-commits] [git/LaTeX3-latex3-latex2e] everymath: Target each amsmath env. separately (3da84eac)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Jan 9 09:47:37 CET 2023


Repository : https://github.com/latex3/latex2e
On branch  : everymath
Link       : https://github.com/latex3/latex2e/commit/3da84eac2fbe61b1e20e74e429744bcd5897dad4

>---------------------------------------------------------------

commit 3da84eac2fbe61b1e20e74e429744bcd5897dad4
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Jan 9 08:47:37 2023 +0000

    Target each amsmath env. separately
    
    This avoids testing for \split at tag when not needed,
    and may help later as we are now able to adjust
    on a per-env. basis.


>---------------------------------------------------------------

3da84eac2fbe61b1e20e74e429744bcd5897dad4
 required/latex-lab/latex-lab-mathcapture.dtx | 47 +++++++++++++++++-----------
 1 file changed, 28 insertions(+), 19 deletions(-)

diff --git a/required/latex-lab/latex-lab-mathcapture.dtx b/required/latex-lab/latex-lab-mathcapture.dtx
index ff193a8a..475f0457 100644
--- a/required/latex-lab/latex-lab-mathcapture.dtx
+++ b/required/latex-lab/latex-lab-mathcapture.dtx
@@ -407,21 +407,22 @@
 %
 % \subsection{Modifying \pkg{amsmath}}
 %
+% \begin{macro}{\@@_amsmath_align@:nn}
 % \begin{macro}
 %   {
-%     \@@_amsmath_measure@:n  ,
-%     \@@_amsmath_gmeasure@:n ,
-%     \@@_amsmath_mmeasure@:n
+%     \@@_amsmath_gather@:n ,
+%     \@@_amsmath_multline@:n
 %   }
-% \begin{macro}{\measure@, \gmeasure@, \mmeasure@}
+% \begin{macro}{\align@}
+% \begin{macro}{\gather@, \multline@}
 %   Mark up all of the display environments as the content is captured anyway.
 %   We then use the internal for each environment type to insert the processing
-%   code: we can't use \cs{\meta{thing}@} as \cs{align@} takes two arguments!
-%   The test for \cs{split at tag} is required as the \texttt{split} environment
-%   internally uses \texttt{gather} \emph{when not within an \pkg{amsmath}}
-%   environment, for example inside \texttt{equation}. Without the precaution,
-%   we'd get two copies of the grabbed math, the second of which would start
-%   with \cs{split at tag}.
+%   code. Each of these is slightly different, so we cannot use a simple loop
+%   here. The test for \cs{split at tag} is required as the \texttt{split}
+%   environment internally uses \texttt{gather} \emph{when not within an
+%   \pkg{amsmath}} environment, for example inside \texttt{equation}. Without
+%   the precaution, we'd get two copies of the grabbed math, the second of
+%   which would start with \cs{split at tag}.
 %    \begin{macrocode}
 \clist_map_inline:nn
   { align , gather , multline }
@@ -433,16 +434,24 @@
   }
 \tl_gput_right:Nn \@kernel at before@begindocument
   {
-    \clist_map_inline:nn
-      { measure , gmeasure , mmeasure }
+    \cs_new_eq:NN \@@_amsmath_align@:nn \align@
+    \cs_gset_protected:Npn \align@ #1#2
       {
-        \cs_new_eq:cc { @@_amsmath_ #1 @:n } { #1@ }
-        \cs_gset_protected:cpx { #1@ } ##1
-          {
-            \exp_not:N \tl_if_head_eq_meaning:nNF {##1} { \exp_not:N \split at tag }
-              { \exp_not:N \@@_process:Vn \exp_not:N \@currenvir {##1} }
-            \exp_not:c { @@_amsmath_ #1 @:n } {##1}
-          }
+        \@@_process:Vn \@currenvir {#2}
+        \@@_amsmath_align@:nn {#1} {#2}
+      }
+    \cs_new_eq:NN \@@_amsmath_gather@:n \gather@
+    \cs_gset_protected:Npn \gather@ #1
+      {
+        \tl_if_head_eq_meaning:nNF {#1} { \split at tag }
+          { \@@_process:Vn \@currenvir {#1} }
+        \@@_amsmath_gather@:n {#1}
+      }
+    \cs_new_eq:NN \@@_amsmath_multline@:n \multline@
+    \cs_gset_protected:Npn \multline@ #1
+      {
+        \@@_process:Vn \@currenvir {#1}
+        \@@_amsmath_multline@:n {#1}
       }
   }
 %    \end{macrocode}





More information about the latex3-commits mailing list.