Is it possible to have a table rule span only part of a cell?

Is it possible to have a table rule span only part of a cell? In order to implement LaTeX’s booktabs’s \cmidrule trimming argument. I’ve looked through the table guide, but it doesn’t seem so, yet, without hacks.

See examples for where this is nice in the booktabs docs and Better LaTeX Tables with Booktabs – Nick Higham.

Booktabs docs at https://ctan.math.illinois.edu/macros/latex/contrib/booktabs/booktabs.pdf

Well, it’s possible to implement with the line function, but I believe what you really need is to add a column gutter between groups.

#set page(height: auto, width: auto, margin: 15pt)
#show figure.where(kind: table): set figure.caption(position: top)

#figure(
  caption: lorem(3),
  {
    import table: cell, hline
    table(
      columns: 1 + 2 * 3,
      column-gutter: (0.5em, 0em, 0em, 1em) * 2, // 👈 Here
      inset: (y: 0.6em),
      stroke: none,
      hline(),
      table.header(
        cell(rowspan: 2)[],
        cell(colspan: 3, $"tol" = u_"single"$),
        cell(colspan: 3, $"tol" = u_"double"$),
        hline(stroke: 0.5pt, end: 4),
        hline(stroke: 0.5pt, start: 4),
        $m v$, [Rel. err], [Time],
        $m v$, [Rel. err], [Time],
      ),
      hline(stroke: 0.5pt),
      `trigmv`, [11034], [1.3e-7], [...], [...], [...], [...],
      ..(`...`, [...], [...], [...], [...], [...], [...]) * 3,
      hline(),
    )
  },
)

1 Like

I think the way booktabs does it is by actually only decreasing the size of the midrule, and provides options for doing so on the left/right/both sides. But this might be more correct typesetting-wise? Ah well, it solves the issue. Marking correct

1 Like