是否有简单的方法来调整表格大小或将文本换入单元格内?
\begin{table}[htbp]
\centering
\caption{\bf Parameters for training and testing of cGAN networks in various scattering scenarios, using a Google Colaboratory Python environment}
\begin{tabular}{c c c c cc cc c}
\hline
&& && SSIM between best model generated and ground truth && JI between best model generated and ground truth\\
\cline{7-8} \cline{5-6}
Scattering Scenario & No. of image pairs for training & Training time/mins & Model no. selected for testing (out of10) & Mean & Median & Mean & Median & Avg.time for reconstruction/sec(N images)\\
\hline
$ 1$ & xx & xx & xx & xx & xx & xx & xx & xx\\
$ 2$ & xx & xx & xx & xx & xx & xx & xx & xx\\
$ 3$ & xx & xx & xx & xx & xx & xx & xx & xx\\
$ 4$ & xx & xx & xx & xx & xx & xx & xx & xx\\
$ 5$ & xx & xx & xx & xx & xx & xx & xx & xx\\
\hline
\end{tabular}
\label{tab:SSIM_comparison}
\end{table}
答案1
正如您所发现的,c
列类型不提供单元格内容的自动换行。
为了取得一些进展,我建议您 (a) 从 a 环境切换tabular
到 atabularx
环境并使用居中版本的X
列类型;(b) 减少列间空白量并省略默认情况下插入在两个表格边缘的空白填充;(c) 替换/
为\slash
以允许在/
(“斜线”)符号处换行。(可选)添加包并分别将和booktabs
的所有实例替换为/ /和。\hline
\cline
\toprule
\midrule
\bottomrule
\cmidrule
由于您的表格有 9 [!!] 列,您确实应该考虑减少标题单元格中的文本量。恐怕我无法为这项任务提供太多指导。
\documentclass{article}
\usepackage[letterpaper,margin=1in]{geometry} % set page size parameters as needed
\usepackage{tabularx,ragged2e,caption,booktabs}
\captionsetup{font=bf,skip=0.333\baselineskip}
\newcolumntype{C}{>{\Centering}X} % centered version of 'X' column type
\begin{document}
\begin{table}[htbp]
\frenchspacing
\caption{Parameters for training and testing of cGAN networks in various scattering scenarios, using a Google Collaboratory Python environment}
\label{tab:SSIM_comparison}
\setlength\tabcolsep{3pt} % default: 6pt
\begin{tabularx}{\textwidth}{@{} *{9}{C} @{}}
\toprule
&&&&
\multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep\relax}C}{%
SSIM between best model generated and ground truth} &
\multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep\relax}C}{%
JI between best model generated and ground truth} \\
\cmidrule(lr){5-6} \cmidrule(lr){7-8}
Scattering Scenario &
No. of image pairs for training &
Training time\slash mins &
Model no. selected for testing (out of 10) &
Mean & Median &
Mean & Median &
Avg. time for reconstruction\slash sec ($N$ images) \\
\midrule
$ 1$ & xx & xx & xx & xx & xx & xx & xx & xx\\
$ 2$ & xx & xx & xx & xx & xx & xx & xx & xx\\
$ 3$ & xx & xx & xx & xx & xx & xx & xx & xx\\
$ 4$ & xx & xx & xx & xx & xx & xx & xx & xx\\
$ 5$ & xx & xx & xx & xx & xx & xx & xx & xx\\
\bottomrule
\end{tabularx}
\end{table}
\end{document}