在表格环境中将表格压缩为文本宽度

在表格环境中将表格压缩为文本宽度

我正在尝试缩小宽表的大小以匹配我的论文文本的宽度。我看过其他帖子,但似乎没有一个代码对我有用。我尝试了\textwidth\resizebox命令的不同组合,但没有成功。我的代码如下:

\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*}

我会非常感激任何帮助,因为我很沮丧在这个问题上浪费了宝贵的时间!提前谢谢,霍莉

答案1

使用tabularx环境应该可以完成工作,而不必诉诸\resizebox。顺便说一句,由于您正在使用table*环境,我假设您正在使用twocolumn作为传递给 的选项之一\documentclass

在此处输入图片描述

\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}

答案2

您必须在示例中用 替换。然后,您的表格将在第一行中获得其自然宽度,然后根据 调整大小以tabular*适合文本宽度。tabular\resizebox

\documentclass{article}

\usepackage{graphicx,booktabs,array}

\begin{document}

\begin{table*}[h]
\resizebox{\textwidth}{!}{%
\begin{tabular}{@{\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*}

\end{document}

在此处输入图片描述

相关内容