[Tex/LaTex] Compressing table to text width in tabular environment

tables

I am trying to reduce the size of a wide table to match the width of my text for my thesis. I have looked at other posts but none of the code seems to work for me. I have tried different combinations of the \textwidth and \resizebox commands but have had no luck. My code is as follows:

\begin{table*}[h]
\resizebox{\textwidth}{!}{
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}llllllllll}\toprule
LFA&Lithofacies&Juv.\ \%& Juv. size (mm)&Lithic\ \%&Lithic size (mm)&Matrix\ \%&Ves.\ \%&Ves. Av\ \%&Ves.\ \ size ($\mu$m)\\\midrule
1&mLT&95--100&2--11&0--3&3--7&50--60&8--23&15&30--3000\\
1&Lf&98--100&2--48&0--2&5--16&15--25&12--24&19&12--2000\\
2&bLT&80--99&2--18&1--4&10--39&15--60&2--33&13&119--23500\\
3&mlLT&65--90&2--52&10--17&3--71&15--70&4--58&17&6--11300\\
3&l(n)LT&65--95&2--76&4--35&5--1670&20--30&4--8&15&134--3200\\
4&LTf&71--87&2--8&11--29&5--25&60--70&-&5--25&-\\\bottomrule
\end{tabular*}}
\caption{Summary of measured characteristics of juvenile lapilli and lithics clasts, and vesicle size and percentage for each lithofacies association in the diatremes.}
\label{tb:Table 2}
\end{table*}

I would very much appreciate any help as I am getting frustrated wasting valuable hours on this problem!
Thanks in advance,
Holly

Best Answer

Using a tabularx environment should do the job, without having to resort to \resizebox. Incidentally, since you're using a table* environment, I'm assuming you're using twocolumn as one of the options passed to \documentclass.

enter image description here

\documentclass[twocolumn]{article}
\usepackage{booktabs,tabularx}
\newcolumntype{x}{>{\raggedright\arraybackslash}X}
\begin{document}
\begin{table*}
\setlength\tabcolsep{4pt}
\begin{tabularx}{\textwidth}{@{} l l *{7}{>{\hsize=0.95\hsize}x} >{\hsize=1.35\hsize}x @{}}
\toprule
LFA&Lithofacies &Juv.\ \%& Juv.\ size (mm)&Lithic \%&Lithic size (mm)&Matrix\ \%&Ves.\ \%&Ves.\ Av \%&Ves.\ size ($\mu$m)\\
\midrule
1&mLT&95--100&2--11&0--3&3--7&50--60&8--23&15&30--3000\\
1&Lf&98--100&2--48&0--2&5--16&15--25&12--24&19&12--2000\\
2&bLT&80--99&2--18&1--4&10--39&15--60&2--33&13&119--23500\\
3&mlLT&65--90&2--52&10--17&3--71&15--70&4--58&17&6--11300\\
3&l(n)LT&65--95&2--76&4--35&5--1670&20--30&4--8&15&134--3200\\
4&LTf&71--87&2--8&11--29&5--25&60--70&--&5--25&--\\
\bottomrule
\end{tabularx}
\caption{Summary of measured characteristics of juvenile lapilli and lithics clasts, and vesicle size and percentage for each lithofacies association in the diatremes.}
\label{tb:Table 2}
\end{table*}
\end{document}