如图所示,表格不完整,超出了页面范围。我需要将其放入页面内。因此,我需要增加行高并减少列宽。我该怎么做?此外,文本未与中心对齐。我不明白这里的问题所在。
\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}
更新表:
答案1
瞧,下面的解决方法对您来说是可以接受的:
\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}
编辑:
我彻底重新设计了您的表格。在此我使用booktabs
水平规则、makecell
列标题、tabularx
跨文本宽度的表格和简单的列宽确定包。列标题中的字体定义为
\renewcommand\theadfont{\bfseries\normalsize}
Mico 的评论让我印象深刻,许多人(包括我)认为如果列标题中的字体不是粗体,表格会更美观。这可以通过使用以下方法轻松实现:
\renewcommand\theadfont{\normalsize}
在这种情况下,表格的观察结果是: