%%
%% This is file `latex-lab-mathtools.ltx',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% latex-lab-mathtools.dtx  (with options: `kernel')
%% 
%% This is a generated file.
%% 
%% Copyright 2021-2026 LaTeX Project
%% 
%% This file was generated from file(s) of the  `LaTeX-lab Bundle'.
%% ------------------------------------------------------------------------------------
%% 
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008 or later.
%% 
%% This file may only be distributed together with a copy of the LaTeX
%% `LaTeX-lab Bundle'. You may however distribute the `LaTeX-lab Bundle'
%% without such generated files.
%% 
%% The newest sources can be found below
%% 
%%    https://github.com/latex3/latex2e/blob/develop/required/latex-lab
%% 
%% Issues may be reported at
%% 
%%    https://github.com/latex3/latex2e/issues
%% 
%% 
%% File: latex-lab-mathtools.dtx
\def\ltlabmathtoolsdate{2026-01-16}
\def\ltlabmathtoolsversion{0.80d}
\ProvidesFile{latex-lab-mathtools.ltx}
        [2025-12-13 v0.1b mathtools adaptions]
\ExplSyntaxOn
\tl_new:N\l__math_mathtools_init_tl
\cs_if_eq:NNTF\intertext@ \MT_intertext:
  {
    \tl_set:Nn \l__math_mathtools_init_tl {\MT_orig_intertext_false:}
  }
  {
    \tl_set:Nn \l__math_mathtools_init_tl {\MT_orig_intertext_true:}
  }
\cs_if_eq:NNTF\shortintertext@ \MT_shortintertext:n
  {
    \tl_put_right:Nn \l__math_mathtools_init_tl
      {\MT_orig_shortintertext_false:}
  }
  {
    \tl_put_right:Nn \l__math_mathtools_init_tl
      {\MT_orig_shortintertext_true:}
  }
\def\MT_intertext: {%
  \def\intertext##1{%
    \ifvmode\else\\\@empty\fi
    \noalign{%
      \penalty\postdisplaypenalty\vskip\belowdisplayskip
      \vskip-\lineskiplimit      % CCS
      \vskip\normallineskiplimit % CCS
      \vskip\l_MT_above_intertext_sep
       \vbox{%
      \ifmeasuring@\tag_suspend:n{\measuring}\fi
      \normalbaselines
        \ifdim
          \ifdim\@totalleftmargin=\z@
            \linewidth
          \else
            -\maxdimen
          \fi
        =\columnwidth
       \else \parshape\@ne \@totalleftmargin \linewidth
       \fi
       \tag_mc_end_push:
        \tagpdfsetup{para/tag=Span}
        \noindent\ignorespaces##1\par
        \tag_mc_begin_pop:n{}}%
      \penalty\predisplaypenalty\vskip\abovedisplayskip%
      \vskip-\lineskiplimit      % CCS
      \vskip\normallineskiplimit % CCS
      \vskip\l_MT_below_intertext_sep
   }%
 }%
 \MH_let:NwN \shortintertext \shortintertext@
}
\def\MT_orig_shortintertext:n #1{%
  \ifvmode\else\\\@empty\fi
  \noalign{%
    \penalty\postdisplaypenalty\vskip\abovedisplayshortskip
    \vbox{%
      \ifmeasuring@\tag_suspend:n{\measuring}\fi
      \normalbaselines
      \MH_if_dim:w
        \MH_if_dim:w \@totalleftmargin=\z@
          \linewidth
        \MH_else:
          -\maxdimen
        \MH_fi:
        =\columnwidth
      \MH_else:
        \parshape\@ne \@totalleftmargin \linewidth
      \MH_fi:
      \tag_mc_end_push:
      \tagpdfsetup{para/tag=Span}
      \tagpdfparaOn
      \noindent\ignorespaces#1\par
      \tag_mc_begin_pop:n{}}
    \penalty\predisplaypenalty\vskip\abovedisplayshortskip%
  }%
}
\def\MT_shortintertext:n #1{%
  \ifvmode\else\\\@empty\fi
  \noalign{%
    \penalty\postdisplaypenalty\vskip\abovedisplayshortskip
    \vskip-\lineskiplimit
    \vskip\normallineskiplimit
    \vskip\l_MT_above_shortintertext_sep
    \vbox{%
    \ifmeasuring@\tag_suspend:n{\measuring}\fi
    \normalbaselines
      \MH_if_dim:w
        \MH_if_dim:w \@totalleftmargin=\z@
          \linewidth
        \MH_else:
          -\maxdimen
        \MH_fi:
        =\columnwidth
      \MH_else:
        \parshape\@ne \@totalleftmargin \linewidth
      \MH_fi:
      \tag_mc_end_push:
      \tagpdfsetup{para/tag=P}
      \tagpdfparaOn
      \noindent\ignorespaces#1\par
      \tag_mc_begin_pop:n{}}%
    \penalty\predisplaypenalty\vskip\abovedisplayshortskip%
    \vskip-\lineskiplimit
    \vskip\normallineskiplimit
    \vskip\l_MT_below_shortintertext_sep
  }%
}
    \renewcommand*\MT_mult_internal:n [1]{
     \MH_if_boolean:nF {outer_mult}{\alignedspace@left} %<-- requires amsmath 2016/11/05
      \MT_next:
      \bgroup
        \Let@
        \def\l_MT_multline_lastline_fint{0 }
        \chardef\dspbrk@context\@ne \restore@math@cr
        \MH_let:NwN \math@cr@@\MT_mult_mathcr_atat:w
        \MH_let:NwN \shoveleft\MT_shoveleft:wn
        \MH_let:NwN \shoveright\MT_shoveright:wn
        \spread@equation
        \MH_set_boolean_F:n {mult_firstline}
        \MT_measure_mult:n {#1}
        \MH_if_dim:w \l_MT_multwidth_dim<\l_MT_multline_measure_fdim
          \MH_setlength:dn \l_MT_multwidth_dim{\l_MT_multline_measure_fdim}
        \fi
        \MH_set_boolean_T:n {mult_firstline}
        \MH_if_num:w \l_MT_multline_lastline_fint=\@ne
          \MH_let:NwN \math@cr@@\MT_mult_firstandlast_mathcr:w
        \MH_fi:
        \ialign\bgroup
          \hfil\strut@$\m@th\displaystyle{}##
          \UseTaggingSocket{math/luamml/save/nNn}{ {} \displaystyle {mtd}}
          $
          \UseTaggingSocket{math/luamml/mtable/finalizecol}{last}
          \hfil
          \crcr
          \hfilneg
          #1
    }
  \l__math_mathtools_init_tl
\ExplSyntaxOff
\endinput
%%
%% End of file `latex-lab-mathtools.ltx'.
