2

Is there an easy way to resize the table or wrap the text inside the cells?

\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}
2
  • Welcome to TeX.SE.
    – Mico
    Dec 22, 2021 at 4:34
  • note \bf has not been defined by default in latex since 1993, Dec 22, 2021 at 8:15

1 Answer 1

1

As you've discovered, the c column type does not provide automatic wrapping of cell contents.

To make some progress, I suggest you (a) switch from a tabular to a tabularx environment and use a centered version of the X column type and (b) reduce the amount of intercolumn whitespace and omit the whitespace padding that's inserted at both table edges by default, and (c) replace / with \slash in order to permit line breaking at the / ("slash") symbols. Optionally, add the booktabs package and replace all instances of \hline and \cline with \toprule/\midrule/\bottomrule and \cmidrule, respectively.

Since your table has 9 [!!] columns, you really ought to think about reducing the amount of text in the header cells. That's a task I can't provide much guidance for, I'm afraid.

enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.