Apr 19, 2026 2.4 KB x-latex
1\documentclass[12pt]{article}
2\usepackage{booktabs}
3\usepackage{multirow}
4\usepackage{array}
5\usepackage{microtype}
6\usepackage{xcolor, colortbl}
7
8\title{Tables in LaTeX}
9\author{sublimated}
10\date{}
11
12\begin{document}
13\maketitle
14
15\section{Basic Table}
16
17\begin{table}[h]
18\centering
19\caption{Hash algorithm comparison}
20\label{tab:hashes}
21\begin{tabular}{lcc}
22 \toprule
23 Algorithm & Output (bits) & Speed (GB/s) \\
24 \midrule
25 SHA-1 & 160 & 1.2 \\
26 SHA-256 & 256 & 0.8 \\
27 BLAKE3 & 256 & 6.4 \\
28 \bottomrule
29\end{tabular}
30\end{table}
31
32Reference: Table~\ref{tab:hashes}.
33
34\section{Column Alignment}
35
36\begin{center}
37\begin{tabular}{l r r r}
38 \toprule
39 Region & Q1 & Q2 & Q3 \\
40 \midrule
41 North America & \$1,200 & \$1,350 & \$1,100 \\
42 Europe & \$980 & \$1,020 & \$1,150 \\
43 Asia Pacific & \$750 & \$890 & \$920 \\
44 \bottomrule
45\end{tabular}
46\end{center}
47
48\section{Multicolumn and Multirow}
49
50\begin{table}[h]
51\centering
52\caption{Conference submission deadlines}
53\begin{tabular}{llcc}
54 \toprule
55 \multirow{2}{*}{Conference} & \multirow{2}{*}{Field} & \multicolumn{2}{c}{Deadlines} \\
56 \cmidrule(lr){3-4}
57 & & Submission & Notification \\
58 \midrule
59 NeurIPS & ML & May 2026 & Sep 2026 \\
60 ICML & ML & Jan 2026 & Apr 2026 \\
61 ACL & NLP & Feb 2026 & May 2026 \\
62 CVPR & Vision & Nov 2025 & Feb 2026 \\
63 \bottomrule
64\end{tabular}
65\end{table}
66
67\section{Colored Rows}
68
69\begin{center}
70\begin{tabular}{l l l}
71 \toprule
72 \rowcolor{blue!10} Format & Extension & Use Case \\
73 \midrule
74 LaTeX & .tex & Academic papers \\
75 \rowcolor{gray!10} Typst & .typ & Modern documents \\
76 Markdown & .md & Notes and docs \\
77 \rowcolor{gray!10} Org Mode & .org & Literate programming \\
78 \bottomrule
79\end{tabular}
80\end{center}
81
82\section{Wide Table with Fixed Columns}
83
84\begin{table}[h]
85\centering
86\caption{Item types in sublimated}
87\begin{tabular}{l >{\raggedright\arraybackslash}p{5cm} l}
88 \toprule
89 Type & Description & Compilation \\
90 \midrule
91 \texttt{file} & Generic file, no special processing & None \\
92 \texttt{typst\_document} & Typst source file & PDF + SVG \\
93 \texttt{latex\_document} & LaTeX source file & PDF + HTML + SVG \\
94 \texttt{function} & TypeScript function (esbuild + WfP) & JavaScript bundle \\
95 \texttt{mermaid\_diagram} & Mermaid diagram source & SVG \\
96 \bottomrule
97\end{tabular}
98\end{table}
99
100\end{document}