From cb5def2cb10e3e0116759f74630f67f8bf87dbfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= Date: Fri, 25 Jun 2021 04:21:48 +0200 Subject: [PATCH] {smallmatrix} --- luamml-amsmath.lua | 13 ++++++++++ luamml-patches-amsmath.sty | 51 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/luamml-amsmath.lua b/luamml-amsmath.lua index d4f24aa..2b74265 100644 --- a/luamml-amsmath.lua +++ b/luamml-amsmath.lua @@ -63,6 +63,19 @@ do saved = mml_table end + funcid = luatexbase.new_luafunction'__luamml_amsmath_save_smallmatrix:' + token.set_lua('__luamml_amsmath_save_smallmatrix:', funcid) + lua.get_functions_table()[funcid] = function() + -- TODO: Error handling etc + local mml_table = get_table() + mml_table.align = 'axis' + mml_table.columnalign = 'center' + mml_table.columnspacing = '0.278em' + mml_table.rowspacing = string.format('%.3fpt', tex.lineskip.width/65781.76) + saved = {[0] = 'mpadded', width = '+0.333em', lspace = '0.167em', mml_table} + saved = mml_table + end + funcid = luatexbase.new_luafunction'__luamml_amsmath_finalize_inner_table:' token.set_lua('__luamml_amsmath_finalize_inner_table:', funcid) lua.get_functions_table()[funcid] = function() diff --git a/luamml-patches-amsmath.sty b/luamml-patches-amsmath.sty index df40dab..7e8ced2 100644 --- a/luamml-patches-amsmath.sty +++ b/luamml-patches-amsmath.sty @@ -348,6 +348,57 @@ $$ } +% Finally some slightly different stuff. +% While {matrix} is covered by {array}, we still have {smallmatrix}: +\renewenvironment {smallmatrix} { + \luamml_annotate:en { + core = false + } { + \null + \, + } + \vcenter \bgroup + \Let@ + \restore@math@cr + \default@tag + \baselineskip 6 \ex@ + \lineskip 1.5 \ex@ + \lineskiplimit \lineskip + \ialign \bgroup + \hfil + $ + \m@th + \scriptstyle + ## + \luamml_flag_save:n {mtd} % No \scriptsize here since we want to add the mstyle nodes + $ + \__luamml_amsmath_add_last_to_row: + \hfil + && + \thickspace + \hfil + $ + \m@th + \scriptstyle + ## + \luamml_flag_save:n {mtd} % No \scriptsize here since we want to add the mstyle nodes + $ + \__luamml_amsmath_add_last_to_row: + \hfil + \crcr +}{% + \crcr + \__luamml_amsmath_save_smallmatrix: + \egroup + \egroup + \__luamml_amsmath_finalize_inner_table: + \luamml_annotate:en { + core = false + } { + \, + } +} + \cs_set:Npn \bBigg@ #1 #2 { { \ensuremath {