%% %% This is file `lualatex-math.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% lualatex-math.dtx (with options: `package') %% %% This is a generated file. %% %% Copyright 2011 by Philipp Stephani %% %% This file 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 2009/09/24 or later. %% \NeedsTeXFormat{LaTeX2e}[2009/09/24] \RequirePackage{expl3}[2011/02/17] \ProvidesExplPackage{lualatex-math}{2011/05/05}{0.1}% {Patches for mathematics typesetting with LuaLaTeX} \RequirePackage { etoolbox } [ 2007/10/08 ] \RequirePackage { luatexbase } [ 2010/05/27 ] \RequirePackage { filehook } [ 2011/03/09 ] \RequireLuaModule { lualatex-math } [ 2011/05/05 ] \cs_new_nopar:Npn \lltxmath_restore_catcode:N #1 { \char_set_catcode:nn { \int_eval:n { `#1 } } { \char_value_catcode:n { `#1 } } } \exp_args:Nx \AtEndOfPackage { \lltxmath_restore_catcode:N \$ } \char_make_math_shift:N \$ \msg_new:nnn { lualatex-math } { luatex-required } { The~ lualatex-math~ package~ requires~ LuaTeX. \\ I~ will~ stop~ loading~ now. } \msg_new:nnn { lualatex-math } { macro-expected } { I've~ expected~ that~ #1~ is~ a~ macro,~ but~ it~ isn't. } \msg_new:nnn { lualatex-math } { wrong-meaning } { I've~ expected~ #1~ to~ have~ the~ meaning \\ #3, \\ but~ it~ has~ the~ meaning \\ #2. } \msg_new:nnn { lualatex-math } { patch-macro } { I'm~ going~ to~ patch~ macro~ #1. } \luatex_if_engine:F { \msg_error:nn { lualatex-math } { luatex-required } \endinput } \chk_if_free_cs:N \lltxmath_temp:w \cs_new_protected_nopar:Npn \lltxmath_patch:NNnnn #1 #2 #3 #4 #5 { \cs_if_exist:NT #1 { \token_if_macro:NTF #1 { \group_begin: #2 \lltxmath_temp:w #3 { #4 } \cs_if_eq:NNTF #1 \lltxmath_temp:w { \msg_info:nnx { lualatex-math } { patch-macro } { \token_to_str:N #1 } \group_end: #2 #1 #3 { #5 } } { \msg_warning:nnxxx { lualatex-math } { wrong-meaning } { \token_to_str:N #1 } { \token_to_meaning:N #1 } { \token_to_meaning:N \lltxmath_temp:w } \group_end: } } { \msg_warning:nnx { lualatex-math } { macro-expected } { \token_to_str:N #1 } } } } \cs_generate_variant:Nn \lltxmath_patch:NNnnn { c } \luatexbase@ensure@primitive { Ustack } \AtEndPreamble { \@ifpackageloaded { amsmath } { } { \lltxmath_patch:NNnnn \frac \cs_set_nopar:Npn { #1 #2 } { { \begingroup #1 \endgroup \over #2 } } { { \luatexUstack { \group_begin: #1 \group_end: \over #2 } } } } } \luatexbase@ensure@primitive { Umathcodenum } \luatexbase@ensure@primitive { Umathchardef } \luatexbase@ensure@primitive { alignmark } \luatexbase@ensure@primitive { Ustartmath } \luatexbase@ensure@primitive { Ustopmath } \luatexbase@ensure@primitive { Umathstacknumup } \luatexbase@ensure@primitive { Umathstackdenomdown } \luatexbase@ensure@primitive { Umathstackvgap } \int_const:Nn \c_lltxmath_std_minus_mathcode_int { "2200 } \int_const:Nn \c_lltxmath_std_equal_mathcode_int { "303D } \cs_new_protected_nopar:Npn \lltxmath_set_mathchar:NN #1 #2 { \luatexUmathchardef #1 \lua_now:x { lualatex.math.print_class_fam_slot( \int_eval:n { `#2 } ) } \scan_stop: } \cs_new_nopar:Npn \lltxmath_char_dim:NN #1 #2 { #1 \textfont \lua_now:x { lualatex.math.print_fam_slot( \int_eval:n { `#2 } ) } } \chk_if_free_cs:N \l_lltxmath_minus_mathchar \chk_if_free_cs:N \l_lltxmath_equal_mathchar \AtBeginOfPackageFile { amsmath } { \lltxmath_set_mathchar:NN \l_lltxmath_minus_mathchar \- \lltxmath_set_mathchar:NN \l_lltxmath_equal_mathchar \= \char_set_mathcode:nn { `\- } { \c_lltxmath_std_minus_mathcode_int } \char_set_mathcode:nn { `\= } { \c_lltxmath_std_equal_mathcode_int } \AtEndOfPackageFile { amsmath } { \cs_set_eq:NN \std@minus \l_lltxmath_minus_mathchar \cs_set_eq:NN \std@equal \l_lltxmath_equal_mathchar \luatexUmathcodenum `\- \l_lltxmath_minus_mathchar \luatexUmathcodenum `\= \l_lltxmath_equal_mathchar } } \AtEndOfPackageFile * { amsmath } { \tl_replace_in:Nnn \@begindocumenthook { \mathchardef \std@minus \mathcode `\- \relax \mathchardef \std@equal \mathcode `\= \relax } { \lltxmath_set_mathchar:NN \std@minus \- \lltxmath_set_mathchar:NN \std@equal \= } \lltxmath_patch:NNnnn \resetMathstrut@ \cs_set_nopar:Npn { } { \setbox \z@ \hbox { \mathchardef \@tempa \mathcode `\( \relax % \) \def \@tempb ##1 "##2 ##3 { \the \textfont "##3 \char" } \expandafter \@tempb \meaning \@tempa \relax } \ht \Mathstrutbox@ \ht \z@ \dp \Mathstrutbox@ \dp \z@ } { \box_set_ht:Nn \Mathstrutbox@ { \lltxmath_char_dim:NN \fontcharht \( % \) } \box_set_dp:Nn \Mathstrutbox@ { \lltxmath_char_dim:NN \fontchardp \) } } \lltxmath_patch: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 { \luatexUmathstacknumup \scriptstyle + \luatexUmathstackdenomdown \scriptstyle } \lineskip \luatexUmathstackvgap \scriptstyle \lineskiplimit \lineskip \ialign \c_group_begin_token \token_if_eq_meaning:NNT c #1 { \hfil } \luatexUstartmath \m@th \scriptstyle \luatexalignmark \luatexalignmark \luatexUstopmath \hfil \crcr } \lltxmath_patch:cNnnn { frac~ } \cs_set:Npn { #1 #2 } { { \begingroup #1 \endgroup \@@over #2 } } { { \luatexUstack { \group_begin: #1 \group_end: \@@over #2 } } } \lltxmath_patch:NNnnn \@genfrac \cs_set_nopar:Npn { #1 #2 #3 #4 #5 } { { #1 { \begingroup #4 \endgroup #2 #3 \relax #5 } } } { { #1 { \luatexUstack { \group_begin: #4 \group_end: #2 #3 \scan_stop: #5 } } } } } \luatexbase@ensure@primitive { crampeddisplaystyle } \luatexbase@ensure@primitive { crampedtextstyle } \luatexbase@ensure@primitive { crampedscriptstyle } \luatexbase@ensure@primitive { crampedscriptscriptstyle } \AtEndOfPackageFile * { mathtools } { \lltxmath_patch:NNnnn \MT_cramped_internal:Nn \cs_set_nopar:Npn { #1 #2 } { \sbox \z@ { $ \m@th #1 \nulldelimiterspace = \z@ \radical \z@ { #2 } $ } \ifx #1 \displaystyle \dimen@ = \fontdimen 8 \textfont 3 \advance \dimen@ .25 \fontdimen 5 \textfont 2 \else \dimen@ = 1.25 \fontdimen 8 \ifx #1 \textstyle \textfont \else \ifx #1 \scriptstyle \scriptfont \else \scriptscriptfont \fi \fi 3 \fi \advance \dimen@ -\ht\z@ \ht\z@ = -\dimen@ \box\z@ } { { \use:c { luatexcramped \cs_to_str:N #1 } #2 } } } \endinput %% %% End of file `lualatex-math.sty'.