How to resize a table to fit the page's width (without changing font size)?
\documentclass[twocolumn,a4paper]{article}
\usepackage{multirow}
\begin{document}
\begin{table}[h]
\begin{tabular}{c|c|c|c|c}
\hline
\multirow{2}{*}{Types} & \multicolumn{4}{c}{Days} \\ \cline{2-5}
& Day 1 & Day 2 & Day 3 & Day 4 \\ \hline
Type 1 & 12-06-08-07-09-08-18-32-48-101-108& 13-88-08-07-09-08-14-39-36-10 & 56-33-08-07-09-08-18-32-48&26-29-26\\ \hline
Type 2 & 01-07-10-22-55-07-100-32-48& 08-18-32-48-66-36-10 &26-29-26& 10-55-21\\ \hline
\end{tabular}
\end{table}
\end{document}
The table exceeds the width of the page:
Desired output:
Best Answer
Since you don't want to reduce the font size, it's necessary to introduce line breaks. You may want to use the
tabularx
package and itstabularx
environment, modifying that package'sX
column type to centerset the contents of columns 2 through 5.PS If the strings "Type 1" and "Type 2" need to be centered vertically, just encase them in
\multirow{2}{*}{...}
statements.Addendum: You may want to consider giving your table a more "open" or "airy" look. One way to do so would be to get rid of all vertical lines and use the macros of the
booktabs
package to get well-spaced horizontal lines.