I'm trying to fit this table to the page width but I can't. I tried the tabularx environment and the contents got mixed. I tried also the tabulary environment: it's better, the contents are not mixed but the table exceed the page width.
The code I'm using for the table, using tabularx is this:
`\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{caption}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{booktabs}
\usepackage{footmisc}
\begin{document}
\begin{table}
\scalebox{1}{
\begin{minipage}{1\textwidth}
\centering
\caption{aaaaa aaaaa aaaa aaaa}
\begin{tabularx}{1\textwidth} {X X X X X X X X}
\toprule
Aaaaa aaa & Bbbbbbbbb & \multicolumn{2}{l}{CCCCCC CCCcccccc} & \multicolumn{2}{l}{Dddddddd} & \multicolumn{2}{l}{Eeeeeeeeee\footnote{ccccc ccccc cc} eeeeeee eeeeeee} \\
\midrule
\multirow{5}[9]{*}{Kitchen} & Refrigerator & 40 & & \multicolumn{1}{l}{14} & \multicolumn{1}{l}{\multirow{5}[9]{*}{40}} & \multirow{2}[4]{*}{28} & \multirow{5}[9]{*}{55} \\
& Separate freezer & 40 & & \multicolumn{1}{l}{10} & \multicolumn{1}{l}{} & & \\
& Dishwasher & 40 & & \multicolumn{1}{l}{7} & \multicolumn{1}{l}{} & \multirow{2}[4]{*}{16} & \\
& Washing machine & 40 & & \multicolumn{1}{l}{9} & \multicolumn{1}{l}{} & & \\
& Others & 40 & & \multicolumn{1}{l}{-} & \multicolumn{1}{l}{} & 11 & \\
\multirow{2}[3]{*}{Electric equipment} & Informatics & \multicolumn{2}{l}{\multirow{2}[3]{*}{33}} & \multicolumn{1}{l}{7} & \multicolumn{1}{l}{\multirow{2}[3]{*}{13}} & 12 & \multirow{2}[3]{*}{21} \\
& Entertainment & \multicolumn{2}{l}{} & \multicolumn{1}{l}{6} & \multicolumn{1}{l}{} & 9 & \\
\multicolumn{2}{l}{Lighting systems} & \multicolumn{2}{l}{13} & \multicolumn{2}{l}{8} & \multicolumn{2}{l}{18} \\
\multirow{3}[6]{*}{HVAC} & Air heating & \multicolumn{1}{l}{9} & \multicolumn{1}{l}{\multirow{3}[6]{*}{11}} & 9 & & \multicolumn{2}{l}{\multirow{2}[4]{*}{n. a.}} \\
& Air cooling & \multicolumn{1}{l}{2} & \multicolumn{1}{l}{} & 9 & & \multicolumn{2}{l}{} \\
& Air conditioner & \multicolumn{1}{l}{-} & \multicolumn{1}{l}{} & 9 & & \multicolumn{2}{l}{2} \\
\multicolumn{2}{l}{Water heating} & \multicolumn{2}{l}{2} & \multicolumn{2}{l}{-} & \multicolumn{2}{l}{n. a.} \\
\multicolumn{2}{l}{Others} & \multicolumn{2}{l}{-} & \multicolumn{2}{l}{30} & \multicolumn{2}{l}{4} \\
\bottomrule
\end{tabularx}
\label{tab:comp_dist_cons_dif_sourc}
\end{minipage}}
\end{table}
\end{document}`
For tabulary I replace:
\begin{tabularx}{1\textwidth} {X X X X X X X X}
…
\end{tabularx}
by this:
\begin{tabulary}{1\textwidth} {J J J J J J J J}
\end{tabulary}
And I got this:
Is there any way to adjust both the table contents and the table width?
Thank you in advance.
Best Answer
Your headers are so wide that the table will not fit. You need to force their widths to be smaller, one solution is to put the multicolumn ones in a
p
type column of specified size: