In LaTeX, the \addlinespace
command is used to add extra vertical space between rows in tables. This command is part of the ‘booktabs’ package, which is commonly used for creating professional-looking tables. Here’s a guide on how to use \addlinespace
in LaTeX:
Step 1: Load the booktabs package
In your LaTeX document preamble (before \begin{document}
), include the booktabs
package by adding the following line:
\usepackage{booktabs}
Step 2: Create a table environment
Use the tabular environment to create a table. Here’s a basic example:
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\begin{tabular}{ccccc}
\toprule
Column 1 & Column 2 & Column 3 & Column 4 & Column 5 \\
\midrule
A1 & B1 & C1 & D1 & E1 \\
A2 & B2 & C2 & D2 & E2 \\
A3 & B3 & C3 & D3 & E3 \\
A4 & B4 & C4 & D4 & E4 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
Output
This example uses \toprule
, \midrule
, and \bottomrule
to create horizontal lines for the table header, mid-section, and bottom, respectively.
Step 3: Use ‘\addlinespace’ to add space between rows
To add extra space between specific rows, use the \addlinespace
command. Place it where you want to add the additional space. For example:
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\begin{tabular}{ccccc}
\toprule
Column 1 & Column 2 & Column 3 & Column 4 & Column 5 \\
\midrule
A1 & B1 & C1 & D1 & E1 \\
\addlinespace % Add space here
A2 & B2 & C2 & D2 & E2 \\
A3 & B3 & C3 & D3 & E3 \\
\addlinespace % Add space here
A4 & B4 & C4 & D4 & E4 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
Output
You can also adjust the amount of space added by providing an optional argument to \addlinespace
. For instance, \addlinespace[2ex]
would add 2 times the height of an “x” character.
For example
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\begin{tabular}{ccccc}
\toprule
Column 1 & Column 2 & Column 3 & Column 4 & Column 5 \\
\midrule
A1 & B1 & C1 & D1 & E1 \\
\addlinespace[5ex] % Add space here
A2 & B2 & C2 & D2 & E2 \\
A3 & B3 & C3 & D3 & E3 \\
\addlinespace % Add space here
A4 & B4 & C4 & D4 & E4 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
Output
This example demonstrates the basic structure with \addlinespace
for additional spacing between rows.