我有这张表:
% \usepackage{booktabs}
\begin{table*}
\centering
\begin{adjustbox}{max width=\columnwidth}
{\setlength{\extrarowheight}{5pt}%
\begin{tabular}{llllll}
\toprule
& Our Solution & {[}10] & {[}12] & {[}18] & {[}19] \\
\hline
Y & x & x & x & x & x \\
\hline
Y & x & x & x & x & x \\
\hline
Y & x & x & x~ & x & x \\
\hline
Y & x & x & x & x & x \\
\hline
Y & x & x & x & x & x \\
\bottomrule
\end{tabular}}
\end{table*}
我希望它看起来像这样,但无论我怎么尝试它都不起作用,要么字体太小,要么表格看起来太小:
答案1
如果你在调整桌子大小时遇到困难,请参阅我的桌子放不下;我有什么办法吗?。下面是您的表格,通过这些方法使其适合默认文本宽度:
缩短了冗长的最后一栏:
Cost in USD
->Cost (USD)
减少
\tabcolsep
了30%:\setlegnth{\tabcolsep}{0.7\tabcolsep}
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\setlength{\tabcolsep}{0.7\tabcolsep}% Reduce column separation by 30%
\begin{tabular}{ c l r r }
\toprule
Smart contact & Function name & Gas usage & Cost (USD) \\
\midrule
Registration & Deployment & 1,072,013 & 68.17 \\
& registerStakeholder & 58,218 & 3.70 \\
& isStakeholderRegistered(view) & 35,000 & 2.22 \\
\addlinespace % \midrule
Compliance & Deployment & 2,011,085 & 127.89 \\
& submitCertification & 117,087 & 7.44 \\
& approveCertification & 48,334 & 3.07 \\
\addlinespace % \midrule
Garment tracking & Deployment & 752,071 & 47.82 \\
& createBatch & 162,391 & 10.32 \\
& getBatch(view) & 30,000 & 1.90 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
您可以进一步考虑使用siunitx
格式化最终的列以保持一致性,而不是手动执行。