To change the dimensions of a table in LaTeX, you can adjust width, height, column spacing, and row spacing using various techniques. Here are common ways to control table dimensions:
Use the \resizebox or \scalebox commands from the graphicx package.
\usepackage{graphicx} % in preamble
\resizebox{\textwidth}{!}{%
\begin{tabular}{|c|c|}
\hline
A & B \\
\hline
C & D \\
\hline
\end{tabular}
}
\textwidth: set the table width relative to the text width!: automatically scale height proportionallyUse the p{width} specifier or packages like tabularx.
p{}:\begin{tabular}{|p{4cm}|p{6cm}|}
\hline
Column 1 & Column 2 \\
\hline
\end{tabular}
tabularx:\usepackage{tabularx} % in preamble
\begin{tabularx}{\textwidth}{|X|X|}
\hline
Column 1 & Column 2 \\
\hline
\end{tabularx}
X columns automatically stretch to fill the total widthUse \renewcommand{\arraystretch}{value} to change the vertical spacing between rows.
\renewcommand{\arraystretch}{1.5} % 1.5x default row height
\begin{tabular}{|c|c|}
\hline
A & B \\
\hline
C & D \\
\hline
\end{tabular}
Adjust using @{\hspace{Xcm}} or modify column spec.
\begin{tabular}{|@{\hspace{0.5cm}}c@{\hspace{0.5cm}}|c|}
\hline
A & B \\
\hline
\end{tabular}