1

As seen in the figure, the table is incomplete and extends beyond the page. I need to fit it within the page. So, I need to increase row height and decrease column width. How can I do this? Also, the text is not aligned to the centre. I don't understand the problem here.

\begin{table}[ht]
\begin{center}
\begin{tabular}{||c||c|c||c|c|c|c||} 
\hline
\multirow{2}{2cm}{\textbf{Atlas Resolution}}  & \multicolumn{2}{p{3cm}||}{\centering \textbf{Variant-1}} & \multicolumn{2}{p{3cm}||}{\centering    \textbf{Variant-2}} & \multicolumn{2}{p{3cm}||}{\centering \textbf{Variant-3}} \\ \cline{2-7}
& \textbf{Average Render Time (ms)} & \textbf{IFPS} & \textbf{Average Render Time (ms)} & \textbf{IFPS} & \textbf{Average Render Time (ms)} & \textbf{IFPS}\\ 
\hline\hline
512$\times$512 &  &  &  &  &  &  \\ 
\hline
1024$\times$1024 &  &  &  &  &  &  \\ 
\hline
18432$\times$18432 &  &  &  &  &  &  \\ 
\hline
19456$\times$19456 &  &  &  &  &  &  \\  [1ex]
\hline
\end{tabular}
\caption{List of sizes for various resolution of Dataset-I, compressed variant Dataset-II and different slices variant Dataset-II}
\end{center}
\end{table}
\label{tab:1}

enter image description here

Updated table:

enter image description here

2
  • Please, provide complete small document (MWE: Minimal Working Example) starting with \documentclass{...} and ending with \end{document}.
    – Zarko
    Nov 20, 2016 at 20:05
  • use fixed with columns p{2cm} not c Nov 20, 2016 at 20:17

1 Answer 1

4

See, it the following work around is acceptable to you:

\documentclass{article}
\usepackage{booktabs,makecell,multirow,tabularx}
\renewcommand\theadfont{\bfseries\normalsize}
\newcolumntype{C}{>{\centering\arraybackslash}X}

\usepackage{geometry}

\begin{document}
    \begin{table}[ht]
\centering
\begin{tabularx}{\textwidth}{c L c L c L c }
    \toprule
\multirow{2}{*}{\thead{Atlas\\ Resolution}}
    &   \multicolumn{2}{c}{\thead{Variant-1}}
        &   \multicolumn{2}{c}{\thead{Variant-2}}
            &   \multicolumn{2}{c}{\thead{Variant-3}}    \\
    \cmidrule(lr){2-3}\cmidrule(lr){4-5}\cmidrule(lr){6-7}
    &   \thead[b]{Average\\ Render\\ Time (ms)}  &   \thead[b]{IFPS}
        &   \thead[b]{Average\\ Render\\ Time (ms)}  &   \thead[b]{IFPS}
            &   \thead[b]{Average\\ Render\\ Time (ms)}  &   \thead[b]{IFPS}                \\
    \midrule
512$\times$512      &  &  &  &  &  &  \\
1024$\times$1024    &  &  &  &  &  &  \\
    \addlinespace[2pt]
18432$\times$18432  &  &  &  &  &  &  \\
19456$\times$19456  &  &  &  &  &  &  \\
    \bottomrule
\end{tabularx}
    \caption{List of sizes for various resolution of Dataset-I, compressed variant Dataset-II and different slices variant Dataset-II}
    \label{tab:1}
\end{table}
\end{document}

enter image description here

Edit: I thoroughly redesign your table. In this I use packages booktabs for horizontal rules, makecell for column heads, tabularx for span table over text width and simple determination of columns width. The fonts in column headers is defined with

\renewcommand\theadfont{\bfseries\normalsize}

Comments of Mico remain me, that many people (among them me too) consider table more aesthetically if font in column headers are not in bold face. This is simple achieve with use:

\renewcommand\theadfont{\normalsize}

In this case the table look-out is:

enter image description here

3
  • +1. I would also go ahead and not use bold for the material in the header cells.
    – Mico
    Nov 20, 2016 at 20:38
  • I needed to centre align the data below average render time. So I replaced\begin{tabularx}{\textwidth}{||c|| c| c|| X| c|| X| c|| } with \begin{tabularx}{\textwidth}{||c|| c| c|| c| c|| c| c|| }. Now the text is aligning at centre but an extra horizontal line is seen as shown in the updated pic. I t shouldn't happen that way. Any hints?
    – Prajwal_7
    Nov 21, 2016 at 10:45
  • see edit of my answer. your approach is wrong.
    – Zarko
    Nov 21, 2016 at 11:18

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.