Tables: header fill with multirow
I'm writing my thesis and I'd like to include some good-looking tables.
I've used rules and multicolumns, but the problem is that there's a whitespace to be filled as the same colour of the header.
How can I do that? I'm attaching a MWE.
Note: I shouldn't modify the used packages, as the template offered by my university would likely break. Also, spacing between rows cannot be touched because it's part of the page layout constraints.
Thanks!
In your example, I have loaded nicematrix (unloaded colortbl) and replaced your environment {tabularx} by {NiceTabularX} of nicematrix.
I have directly the expected output (after several compilations).
If you actually want the thin white stripes, here is a code with the tools of nicematrix. The gray shades are drawn under the tabular by using TikZ in the so-called \CodeBefore of the environment.
You need several compilations.
Here is an implementation of your table using the tabularray package.
As for the packages you've loaded:
\usepackage[utf8]{inputenc} is no longer needed since 2018, so you can safely remove it [source];
The package xcolor supersedes color; you only need the former;
The packages tabularx, colortbl, longtable, booktabs, multirow, makecell, and xltabular can all be safely replaced by the tabularray package.
I'm writing my thesis and I'd like to include some good-looking tables.
Start by removing \multirow, color and boldface. The main headers should be on the same line. Multirow cells are ambiguous; instead, empty cells are intended to repeat the above value.
Depending on the nature of the table, a possible alternative shape could be as follows.
One more answer using tabularray package with using amsmath and booktabs libraries.
Regarding booktabs rules: they have small amount vertical space around rules (as you observe as white space), consequently they are not intended for use in table with vertical rules.
However, if you use them in kind of tabularray tables, this vertical space is removed and replaced with rowsep instruction (default is pt).
So your table can be written as follows:
(red lines indicate page layout)