I'm in the middle of a LaTeX battle with table attributes and so far I got to what you see above and the code I post below:
\begin{center}
\begin{table}
\begin{tabular} {p{1.2cm}p{0.5cm}p{0.9cm}p{1.2cm}p{0.5cm}p{0.9cm}p{0.5cm}p{1.1cm}p{0.5cm}}
\rowcolor[rgb]{0.34,0.58,0.52} categoria & Durata & 2008 & 2009 & 2010 & 2011 & 2012 & Aggregato & Altro \\
infocommercio\cite{citaz121} & 3Q & 2.9\% & 21.0\% & 15.0\% & 52.5\% & 2.2\% & 1.5\% & 0.9\% \\
camera commercio\cite{citaz2} & 2Q & 33.1\% & 18.1\% & 28.5\% & 36.9\% & 12.7\% & 24.3\% & 18.4\% \\
Istat\cite{citazistat} & 12Q & 15.19\% & 89.76\% & 77.49\% & 65.76\% & 70.4\% & 84.5\% & .30\% \\
\end{tabular}
\caption{Percentuali PET dei GDO lombardi}
\label{tabella_gdo_2}
\end{table}
\end{center}
The problem is that I can specify the column width but not the padding, so as you can see there's a lot of wasted space, below I post how I would like the table to look more or less.
so far I have followed advice from http://en.wikibooks.org/wiki/LaTeX/Tables by removing spacing between columns with {@{}c@{}c@{}}
however the table content squeezes leaving a big space between columns unaltered.
Can anyone help please?
Best Answer
My suggestion would be to use
tabularx
:In the above example,
tabularx
takes a width argument, specified as\linewidth
. That implies that table will span the width of the text block within thetable
environment. Additionally, for the sake of consistency, each of the 8 columns (2-9) are given a fixed width of13mm
(usingp{13mm}
and a fixed column gap of2mm
(using@{\hspace{2mm}}
). It would be possible to use other alignments as well by including thearray
package. However, the current MWE seems to provide what you're after.The table still has some padding (a
\tabcolsep
) on either side. This can also be modified, if needed.geometry
was used to modify the page margins, since it seems necessary to fit that amount of information horizontally within the text block.