summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/luamml/luamml-patches-array.sty
blob: ee40b2c48933f668f60cbc29f2976c96aec06c6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
\ProvidesExplPackage {luamml-patches-array} {2024-08-14} {0.1.0}
  {Feel free to add a description here}

\lua_now:n { require'luamml-array' }

\cs_set:Npn \@classz {
  \@classx
  \@tempcnta \count@
  \prepnext@tok
  \@addtopreamble {
    \ifcase \@chnum
      \hfil
      \hskip 1sp
      \d@llarbegin
      \cs_if_eq:NNTF \d@llarbegin \begingroup {
        \insert@column
        \d@llarend
      } {
        \__luamml_array_init_col:
        \insert@column
        \luamml_flag_save:nn {} {mtd}
        \d@llarend
        \__luamml_array_finalize_col:w 0~
      }
      \do@row@strut
      \hfil
    \or
      \hskip 1sp
      \d@llarbegin
      \cs_if_eq:NNTF \d@llarbegin \begingroup {
        \insert@column
        \d@llarend
      } {
        \__luamml_array_init_col:
        \insert@column
        \luamml_flag_save:nn {} {mtd}
        \d@llarend
        \__luamml_array_finalize_col:w 1~
      }
      \do@row@strut
      \hfil
    \or
      \hfil
      \hskip 1sp
      \d@llarbegin
      \cs_if_eq:NNTF \d@llarbegin \begingroup {
        \insert@column
        \d@llarend
      } {
        \__luamml_array_init_col:
        \insert@column
        \luamml_flag_save:nn {} {mtd}
        \d@llarend
        \__luamml_array_finalize_col:w 2~
      }
      \do@row@strut
    \or
      \setbox \ar@mcellbox \vbox \@startpbox { \@nextchar }
        \insert@column
      \@endpbox
      \ar@align@mcell
      \do@row@strut
    \or
      \vtop \@startpbox { \@nextchar }
        \insert@column
      \@endpbox
      \do@row@strut
    \or
      \vbox \@startpbox { \@nextchar }
        \insert@column
      \@endpbox
      \do@row@strut
    \fi
  }
  \prepnext@tok
}

\cs_set:Npn \endarray {
  \crcr
  \__luamml_array_save_array:
  \egroup
  \egroup
  \mode_if_math:T { \__luamml_array_finalize_array: }
  \@arrayright
  \gdef \@preamble {}
}