tabularray
Tabellen, deren Layout (Spalten, Kopfzeilen, Zellen über mehrere Zeilen oder Spalten, Zeilenfarben) einmal vor dem Inhalt festgelegt wird.
- Example
- Preamble
\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}
% tabularray: tables whose layout (column widths, alignment, colors, cells spanning rows or columns) is set in one
% place in front of the content. It covers what tabularx, multirow, multicolumn, and colortbl do for tabular.
% Doc: https://ctan.org/pkg/tabularray
\usepackage{tabularray}
% \toprule, \midrule, \cmidrule, and \bottomrule inside tblr
\UseTblrLibrary{booktabs}