#[
#let nhead = 2;
#let nrow = 12;
#let ncol = 5;

// start figure preamble
#figure(
  
  kind: "tinytable",
  supplement: none,
// end figure preamble

  #let fill-array = ( 
    // tinytable cell fill after
    (y: 6, x: 4, fill: blue),
    (y: 6, x: 3, fill: blue),
    (y: 6, x: 2, fill: blue),
    (y: 6, x: 1, fill: blue),
    (y: 6, x: 0, fill: blue),
    (y: 5, x: 4, fill: blue),
    (y: 5, x: 3, fill: blue),
    (y: 5, x: 2, fill: blue),
    (y: 5, x: 1, fill: blue),
    (y: 5, x: 0, fill: blue),
    (y: 4, x: 4, fill: blue),
    (y: 4, x: 3, fill: blue),
    (y: 4, x: 2, fill: blue),
    (y: 4, x: 1, fill: blue),
    (y: 4, x: 0, fill: blue),
    (y: 3, x: 4, fill: blue),
    (y: 3, x: 3, fill: blue),
    (y: 3, x: 2, fill: blue),
    (y: 3, x: 1, fill: blue),
    (y: 3, x: 0, fill: blue),
    (y: 2, x: 4, fill: blue),
    (y: 2, x: 3, fill: blue),
    (y: 2, x: 2, fill: blue),
    (y: 2, x: 1, fill: blue),
    (y: 2, x: 0, fill: blue),
  )
  #let style-array = ( 
    // tinytable cell style after
    (y: 6, x: 4, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 6, x: 3, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 6, x: 2, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 6, x: 1, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 6, x: 0, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 5, x: 4, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 5, x: 3, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 5, x: 2, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 5, x: 1, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 5, x: 0, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 4, x: 4, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 4, x: 3, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 4, x: 2, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 4, x: 1, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 4, x: 0, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 3, x: 4, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 3, x: 3, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 3, x: 2, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 3, x: 1, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 3, x: 0, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 2, x: 4, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 2, x: 3, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 2, x: 2, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 2, x: 1, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
    (y: 2, x: 0, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em),
  )
  #show table.cell: it => {
    let tmp = it
    let data = style-array.find(data => data.x == it.x and data.y == it.y)
    if data != none {
      set text(data.color)
      set text(data.fontsize)
      if data.underline == true { tmp = underline(tmp) }
      if data.italic == true { tmp = emph(tmp) }
      if data.bold == true { tmp = strong(tmp) }
      if data.mono == true { tmp = math.mono(tmp) }
      if data.strikeout == true { tmp = strike(tmp) }
      tmp
    } else {
      tmp
    }
  }

  #align(center, [

  table( // tinytable table start
align: (center),
    column-gutter: 5pt,
    columns: (auto, auto, auto, auto, auto),
    stroke: none,
    fill: (x, y) => {
      let data = fill-array.find(data => data.x == x and data.y == y)
      if data != none {
        data.fill
      }
    },

    // tinytable lines after
table.hline(y: 14, start: 0, end: 5, stroke: 0.1em + black),
table.hline(y: 2, start: 0, end: 5, stroke: 0.05em + black),
table.hline(y: 0, start: 0, end: 5, stroke: 0.1em + black),

    table.header(
      repeat: true,
[ ],table.cell(stroke: (bottom: .05em + black), colspan: 2, align: center)[First],table.cell(stroke: (bottom: .05em + black), colspan: 2, align: center)[Second],
[mpg], [cyl], [disp], [hp], [drat],
    ),

    // tinytable cell content after
[21.0], [6], [160.0], [110], [3.90],
[21.0], [6], [160.0], [110], [3.90],
table.cell(colspan: 5)[Feta],
[22.8], [4], [108.0], [ 93], [3.85],
[21.4], [6], [258.0], [110], [3.08],
[18.7], [8], [360.0], [175], [3.15],
[18.1], [6], [225.0], [105], [2.76],
table.cell(colspan: 5)[Brie],
[14.3], [8], [360.0], [245], [3.21],
[24.4], [4], [146.7], [ 62], [3.69],
[22.8], [4], [140.8], [ 95], [3.92],
[19.2], [6], [167.6], [123], [3.92],
    table.footer(
      repeat: false,
      // tinytable notes after
    ),
  ) // end table

  ]) // end align

) // end figure
] 
