From f15ab98da224024bdcb9d2b70a263c7f6143a91b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 7 Jan 2018 23:46:58 +0000 Subject: unicode-math (7jan18) git-svn-id: svn://tug.org/texlive/trunk@46240 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/unicode-math/um-code-amsmath.dtx | 225 +++++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100644 Master/texmf-dist/source/latex/unicode-math/um-code-amsmath.dtx (limited to 'Master/texmf-dist/source/latex/unicode-math/um-code-amsmath.dtx') diff --git a/Master/texmf-dist/source/latex/unicode-math/um-code-amsmath.dtx b/Master/texmf-dist/source/latex/unicode-math/um-code-amsmath.dtx new file mode 100644 index 00000000000..7900b3360a6 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/um-code-amsmath.dtx @@ -0,0 +1,225 @@ +%%^^A%% um-code-amsmath.dtx -- part of UNICODE-MATH +%%^^A%% Compatibility with amsmath. + +% \section{Compatibility with \pkg{amsmath}} +% +% \begin{macrocode} +%<*package> +% \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} +\AtEndOfPackageFile * {amsmath} + { + \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} +%<*XE> + \def \resetMathstrut@ + {% + \setbox\z@\hbox{$($}%) + \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@ + } +% \end{macrocode} +% The |subarray| environment uses inappropriate font dimensions. +% \begin{macrocode} + \@@_check_and_fix:NNnnn \subarray \cs_set:Npn { #1 } + { + \vcenter + \bgroup + \Let@ + \restore@math@cr + \default@tag + \baselineskip \fontdimen 10~ \scriptfont \tw@ + \advance \baselineskip \fontdimen 12~ \scriptfont \tw@ + \lineskip \thr@@@@ \fontdimen 8~ \scriptfont \thr@@@@ + \lineskiplimit \lineskip + \ialign + \bgroup + \ifx c #1 \hfil \fi + $ \m@th \scriptstyle ## $ + \hfil + \crcr + } + { + \vcenter + \c_group_begin_token + \Let@ + \restore@math@cr + \default@tag + \skip_set:Nn \baselineskip + { +% \end{macrocode} +% Here we use stack top shift + stack bottom shift, which sounds reasonable. +% \begin{macrocode} + \@@_stack_num_up:N \scriptstyle + + \@@_stack_denom_down:N \scriptstyle + } +% \end{macrocode} +% Here we use the minimum stack gap. +% \begin{macrocode} + \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 + } +% +% \end{macrocode} +% The roots need a complete rework. +% \begin{macrocode} +%<*LU> + \@@_check_and_fix:NNnnn \plainroot@ \cs_set_nopar:Npn { #1 \of #2 } + { + \setbox \rootbox \hbox + { + $ \m@th \scriptscriptstyle { #1 } $ + } + \mathchoice + { \r@@@@t \displaystyle { #2 } } + { \r@@@@t \textstyle { #2 } }~ + { \r@@@@t \scriptstyle { #2 } } + { \r@@@@t \scriptscriptstyle { #2 } } + \egroup + } + { + \bool_if:nTF + { + \int_compare_p:nNn { \uproot@ } = { \c_zero } + && \int_compare_p:nNn { \leftroot@ } = { \c_zero } + } + { + \Uroot \l_@@_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 + } +% +% \end{macrocode} +% +% \begin{macrocode} + \@@_check_and_fix:NNnnn \r@@@@t \cs_set_nopar:Npn { #1 #2 } + { + \setboxz@h { $ \m@th #1 \sqrtsign { #2 } $ } + \dimen@ \ht\z@ + \advance \dimen@ -\dp\z@ + \setbox\@ne \hbox { $ \m@th #1 \mskip \uproot@ mu $ } + \advance \dimen@ by 1.667 \wd\@ne + \mkern -\leftroot@ mu + \mkern 5mu + \raise .6\dimen@ \copy\rootbox + \mkern -10mu + \mkern \leftroot@ mu + \boxz@ + } +%<*LU> + { + \hbox_set:Nn \l_tmpa_box + { + \c_math_toggle_token \m@th + #1 \mskip \uproot@ mu + \c_math_toggle_token + } + \Uroot \l_@@_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 } + } +% +%<*XE> + { + \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:Nnn #1 { \kern } { \fontdimen 63 \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:Nnn #1 { \kern } { \fontdimen 64 \g_@@_sqrt_font_cmd_tl } + \mkern \leftroot@ mu + \box_use_clear:N \l_tmpa_box + } +% + } +% \end{macrocode} +% +% \begin{macrocode} +% +% \end{macrocode} + +\endinput + +% /© +% +% ------------------------------------------------ +% The UNICODE-MATH package +% ------------------------------------------------ +% 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): . +% ------------------------------------------------ +% Copyright 2006-2018 Will Robertson, LPPL "maintainer" +% Copyright 2010-2017 Philipp Stephani +% Copyright 2011-2017 Joseph Wright +% Copyright 2012-2015 Khaled Hosny +% ------------------------------------------------ +% +% ©/ -- cgit v1.2.3