Skip to main content

tabularray

Tables whose layout (columns, header rows, cells spanning rows or columns, row colors) is set once in front of the content.

Rendered LaTeX output
\begin{table}
\caption{Runtime of four sorting algorithms, set with tabularray}
\label{tab:tabularray}
\centering
\begin{tblr}{
colspec = {X[l] Q[r] Q[r] Q[r]},
row{1,2} = {font=\bfseries},
cell{1}{1} = {r=2}{l,m}, % "Algorithm" spans the two header rows
cell{1}{2} = {c=2}{c}, % "Runtime" spans two columns
cell{1}{4} = {r=2}{r,m},
row{4,6} = {bg=black!6}, % every second row on a light gray background
}
\toprule
Algorithm & Runtime (s) & & Memory (MB) \\
\cmidrule{2-3}
& 1\,000 items & 1\,000\,000 items & \\
\midrule
Quicksort & 0.12 & 1.80 & 12 \\
Mergesort & 0.15 & 2.10 & 24 \\
Heapsort & 0.20 & 2.40 & 12 \\
Timsort & 0.10 & 1.50 & 18 \\
\bottomrule
\end{tblr}
\end{table}