booktabs
Professional table rules (\toprule, \midrule, \bottomrule) for clean, readable tables.
- Example
- Preamble
\begin{table}
\caption{Simple Table}
\label{tab:simple}
\centering
\begin{tabular}{ll}
\toprule
Heading1 & Heading2 \\
\midrule
One & Two \\
Three & Four \\
\bottomrule
\end{tabular}
\end{table}
\begin{table}
\caption{Table with colored cells}
\label{tab:colored}
\centering
\begin{tabular}{ll}
\toprule
\rowcolor{gray!20}
Test & Result \\
\midrule
A & \cellcolor{green!20}pass \\
B & \cellcolor{red!20}fail \\
\bottomrule
\end{tabular}
\end{table}
\begin{table}
\caption{Table with a footnote}
\label{tab:footnote}
\centering
\begin{tabular}{ll}
\toprule
Heading1 & Heading2\tablefootnote{A footnote inside a table.} \\
\midrule
One & Two \\
\bottomrule
\end{tabular}
\end{table}
\begin{table}
\caption{Wide table scaled to the line width}
\label{tab:wide}
\centering
\begin{adjustbox}{max width=\linewidth}
\begin{tabular}{llllllllllll}
\toprule
Jan & Feb & Mar & Apr & May & Jun & Jul & Aug & Sep & Oct & Nov & Dec \\
\midrule
1.11 & 2.22 & 3.33 & 4.44 & 5.55 & 6.66 & 7.77 & 8.88 & 9.99 & 10.10 & 11.11 & 12.12 \\
Rain & Snow & Wind & Sun & Fog & Hail & Heat & Storm & Mist & Frost & Sleet & Calm \\
\bottomrule
\end{tabular}
\end{adjustbox}
\end{table}
% Adapted from https://tex.stackexchange.com/a/468994/9075
\begin{table}
\caption{Table with diagonal line}
\label{tab:diag}
\centering
\begin{tabular}{|l|c|c|} % chktex 44
\hline % chktex 44
\diagbox{Row}{Column} & A & B \\
\hline % chktex 44
1 & x & y \\
\hline % chktex 44
\end{tabular}
\end{table}
% Nicer tables (\toprule, \midrule, \bottomrule)
\usepackage{booktabs}