Tables
Utilize tables to present structured data effectively, like comparisons or evaluation results.
Ensure all essential information is included and clearly label each column and/or row. Also, provide a descriptive caption to concisely explain the table’s content.
However, avoid overcrowding tables. It’s often more effective to split dense tables into smaller ones to enhance clarity and underscore their significance.
In terms of design, use lines sparingly as separators: typically, a table requires only three lines:
\toprule
above the header,\midrule
below the header, and\bottomrule
at the bottom.
This minimalist approach takes advantage of cell alignment and spacing to naturally delineate the data. For more complex structures, like in Table 2, only a few additional lines may be necessary.
Creating tables
Creating tables manually is a very tedious task. We recommend the Tables Generator that provides you with a graphical user interface.
Table environments
LaTeX offers several table environments, including tabular
, tabular*
, and tabularx
. These differ in layout, column styling, and compatibility. Choose the format that best fits your data. While tabular*
is a good starting point, switch to tabular
or tabularx
as needed based on the specific requirements of your table. For instance, use tabular*
for Table 2 and opt for tabular
or tabularx
if the table includes lists or more complex data arrangements, similar to Table 1.
Show the code
\begin{table}[]
\centering
\begin{tabular}{l|rr} \toprule
\thead{Task} & \thead{Group 1} & \thead{Group 2} \\ \midrule
A & 15 & 4 \\
B & 22 & 23 \\
C & 3 & 4 \\
D & 15 & 13 \\ \bottomrule
\end{tabular}
\caption{A simple table (tabular)}
\label{tab:simple}
\end{table}
Show the code
\RequirePackage{tabularx} // from template.sty
\begin{table}[t]
\centering
\begin{tabularx}{0.8\linewidth}{XX} \toprule
\thead{Pros} & \thead{Cons} \\ \midrule
\vspace{-\topsep}
\begin{itemize}[topsep=0pt, partopsep=0pt, nosep, before=\setstretch{1}]
\item structured
\item easy to read
\item not too verbose
\item compact
\end{itemize}
\vspace{-\topsep}
&
\vspace{-\topsep}
\begin{itemize}[topsep=0pt, partopsep=0pt, nosep, before=\setstretch{1}]
\item sometimes hard to layout
\item need to be simplified
\item might require further explanations in the text
\end{itemize}
\vspace{-\topsep} \\[-\topsep] \bottomrule
\end{tabularx}
\caption{A table with enumerations (tabularx)}
\label{table:sample-pros-cons}
\end{table}
Show the code
\RequirePackage{multicol} // from template.sty
\begin{table}[t]
\centering
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}llllr} \toprule
\thead{Category}
& \multicolumn{2}{l}{\thead{Tool (long title over two columns)}}
& \thead{For} & \thead[l]{Random} \\
& \thead{Developer} & thead{Name} & & \thead[l]{Number} \\ \midrule
Version & GitHub & Git & Git & 456 \\
Control & GitLab & Git & Git & 75452 \\ \midrule
IDE & Jetbrains & CLion & C/C++ & 7856632 \\
& Jetbrains & IntelliJ IDEA & Java/Kotlin & 1566 \\
& Jetbrains & Webstorm & HTML, CSS, Javascript & 379194 \\
& Misrosoft & Visual Studio Code & C/C++ & 751 \\ \midrule
Editor & & Sublime Text & anything & 132 \\
& & Overleaf & \LaTeX{} & 1337 \\ \bottomrule
\end{tabular*}
\caption{A complex table (tabular*)}
\label{table:sample-tools}
\end{table}