<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%%^^A%% um-code-amsmath.dtx -- part of UNICODE-MATH &lt;wspr.io/unicode-math&gt;
%%^^A%% Compatibility with amsmath.

% \section{Compatibility with \pkg{amsmath}}
%
%    \begin{macrocode}
%&lt;*package&gt;
%    \end{macrocode}
%
% Since the mathcode of |`\-| is greater than eight bits, this piece of |\AtBeginDocument| code from \pkg{amsmath} dies if we try and set the maths font in the preamble:
%    \begin{macrocode}
    \tl_remove_once:Nn \@begindocumenthook
      {
        \mathchardef\std@minus\mathcode`\-\relax
        \mathchardef\std@equal\mathcode`\=\relax
      }
    \AtBeginDocument
      {
        \Umathcharnumdef\std@minus\Umathcodenum`-
        \Umathcharnumdef\std@equal\Umathcodenum`=
      }
%    \end{macrocode}
%
%    \begin{macrocode}
    \cs_set:Npn \@cdots {\mathinner{\unicodecdots}}
    \cs_set_eq:NN \dotsb@ \cdots
%    \end{macrocode}
% This isn't as clever as the \pkg{amsmath} definition but I think it works:
%    \begin{macrocode}
%&lt;*XE&gt;
    \def \resetMathstrut@
      {%
        \setbox\z@\hbox{$($}%)
        \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@
      }
%    \end{macrocode}
% The |subarray| environment uses inappropriate font dimensions.
%    \begin{macrocode}
    \cs_set:Npn \subarray #1
      {
        \vcenter
        \c_group_begin_token
        \Let@
        \restore@math@cr
        \default@tag
        \skip_set:Nn \baselineskip
          {
            \@@_stack_num_up:N \scriptstyle
            + \@@_stack_denom_down:N \scriptstyle
          }
        \lineskip \@@_stack_vgap:N \scriptstyle
        \lineskiplimit \lineskip
        \ialign
        \c_group_begin_token
        \token_if_eq_meaning:NNT c #1 { \hfil }
        \c_math_toggle_token
        \m@th
        \scriptstyle
        \c_parameter_token \c_parameter_token
        \c_math_toggle_token
        \hfil
        \crcr
      }
%&lt;/XE&gt;
%    \end{macrocode}
% The roots need a complete rework.
%    \begin{macrocode}
%&lt;*LU&gt;
  \cs_set_nopar:Npn \plainroot@ #1 \of #2
    {
      \bool_if:nTF
        {
          \@@_int_if_zero_p:n \uproot@ &amp;&amp; \@@_int_if_zero_p:n \leftroot@
        }
        {
          \Uroot \c_@@_radical_sqrt_tl { #1 } { #2 }
        }
        {
          \hbox_set:Nn \rootbox
            {
              \c_math_toggle_token \m@th
              \scriptscriptstyle { #1 }
              \c_math_toggle_token
            }
          \mathchoice
            { \r@@@@t \displaystyle      { #2 } }
            { \r@@@@t \textstyle         { #2 } }
            { \r@@@@t \scriptstyle       { #2 } }
            { \r@@@@t \scriptscriptstyle { #2 } }
        }
       \c_group_end_token
    }
%&lt;/LU&gt;
%    \end{macrocode}
%
%    \begin{macrocode}
  \cs_set_nopar:Npn \r@@@@t #1 #2
%&lt;*LU&gt;
    {
      \hbox_set:Nn \l_tmpa_box
        {
          \c_math_toggle_token \m@th
            #1 \mskip \uproot@ mu
          \c_math_toggle_token
        }
      \Uroot \c_@@_radical_sqrt_tl
        {
          \box_move_up:nn { \box_wd:N \l_tmpa_box }
            {
              \hbox:n
                {
                  \c_math_toggle_token \m@th
                    \mkern -\leftroot@ mu
                    \box_use:N \rootbox
                    \mkern \leftroot@ mu
                  \c_math_toggle_token
                }
            }
        }
        { #2 }
    }
%&lt;/LU&gt;
%&lt;*XE&gt;
    {
      \hbox_set:Nn \l_tmpa_box
        {
          \c_math_toggle_token \m@th
            #1 \sqrtsign { #2 }
          \c_math_toggle_token
        }
      \hbox_set:Nn \l_tmpb_box
        {
          \c_math_toggle_token \m@th
            #1 \mskip \uproot@ mu
          \c_math_toggle_token
        }
      \mkern -\leftroot@ mu
      \@@_mathstyle_scale:NnnN #1 { \kern } { \fontdimen 63 \g_@@_sqrt_font_cmd_tl } \g_@@_sqrt_font_cmd_tl
      \box_move_up:nn
        {
          \box_wd:N \l_tmpb_box + (\box_ht:N \l_tmpa_box - \box_dp:N \l_tmpa_box)
            * \number \fontdimen 65 \g_@@_sqrt_font_cmd_tl / 100
        }
        { \box_use:N \rootbox }
      \@@_mathstyle_scale:NnnN #1 { \kern } { \fontdimen 64 \g_@@_sqrt_font_cmd_tl } \g_@@_sqrt_font_cmd_tl
      \mkern \leftroot@ mu
      \box_use_drop:N \l_tmpa_box
    }
%&lt;/XE&gt;
%    \end{macrocode}
%
%    \begin{macrocode}
%&lt;/package&gt;
%    \end{macrocode}

\endinput

% /©
%
% ------------------------------------------------
% The UNICODE-MATH package  &lt;wspr.io/unicode-math&gt;
% ------------------------------------------------
% This package is free software and may be redistributed and/or modified under
% the conditions of the LaTeX Project Public License, version 1.3c or higher
% (your choice): &lt;http://www.latex-project.org/lppl/&gt;.
% ------------------------------------------------
% Copyright 2006-2019  Will Robertson, LPPL "maintainer"
% Copyright 2010-2017  Philipp Stephani
% Copyright 2011-2017  Joseph Wright
% Copyright 2012-2015  Khaled Hosny
% ------------------------------------------------
%
% ©/
</pre></body></html>