将多列表格宽度调整为文本宽度 latex

将多列表格宽度调整为文本宽度 latex

所以我想让下表适合我的文本宽度。表格比文本长得多。有什么建议吗?提前致谢。这是表格代码(不要注意带有 % 的注释行)

\begin{table}[htbbp] \caption{Methods performance for
random model coefficients using 1000 simulations in a two level
factorial design}\label{Table 1}
{\tiny \centering
\begin{tabular}{@{}|@{}c|c|cc|cc|cc|cc|cc|cc@{}|@{}}
%\multicolumn{14}{c}{{\bf Table 1.} Methods performance for
%random model coefficients using 1000 }\\
%\multicolumn{14}{c}{simulations in a two level factorial design}\\
%\multicolumn{11}{c}{$ $} \\
\hline  \multicolumn{1}{|c|}{$ $}&
\multicolumn{1}{|c|}{$q$}&\multicolumn{2}{|c|}{SCAD(gcv)}&\multicolumn{2}{|c|}{SCAD$(\eta_\nu(\lambda))$}&\multicolumn{2}{|c|}{LASSO(gcv)}&\multicolumn{2}{|c|}
{LASSO$(\eta_\nu(\lambda))$}&\multicolumn{2}{|c|}{Hard(gcv)}&\multicolumn{2}{|c|}{Hard$(\eta_\nu(\lambda))$} \\
\hline {\bf Design}&{\bf Factors}& \mbox{Type I} & Type II &
\mbox{Type I} & Type II & \mbox{Type I} & Type II
& \mbox{Type I} & Type II & \mbox{Type I} & Type II & \mbox{Type I} & Type II \\
\hline $ 2^{5}$FD
&1&0.12&0.00&0.00&0.00&0.11&0.00&0.03&0.00&0.11&0.00&0.01&0.00\\
&2&0.11&0.00&0.01&0.00&0.10&0.00&0.02&0.00&0.10&0.00&0.01&0.00\\
&3&0.10&0.00&0.00&0.00&0.11&0.00&0.02&0.00&0.11&0.00&0.01&0.00\\
&4&0.11&0.00&0.00&0.00&0.10&0.00&0.01&0.00&0.10&0.00&0.01&0.00\\
\hline
\multicolumn{11}{c}{$ $} \\
\multicolumn{11}{c}{$ $} \\
\multicolumn{11}{c}{$ $} \\
\end{tabular}
\end{table}

答案1

我已将代码编译,并修改了一些命令:例如,我隐藏了命令\mbox{}和最后三个\multicolumn{11}{c}{$ $ },因为我不明白它们的用途,并将\bf(plain TeX) 替换为\bfseries(LaTeX)。据我所知,这是一个可以达到您期望的代码。

\documentclass[12pt,a4paper]{article}
    \usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}%
\usepackage[textwidth=16cm, nohead, nomarginpar, showframe]{geometry}

\usepackage{array}
\usepackage{caption}

\begin{document}
\begin{table}[htb]\captionsetup{justification = centerlast, font =scriptsize}
\caption{Methods performance for random model coefficients using \\ 1000 simulations in a   
          two level factorial design}\label{Table 1}
\scriptsize \centering \renewcommand{\tabcolsep}{2pt}\renewcommand{\arraystretch}{1.5}%
\begin{tabular}{|c|c|cc|cc|cc|cc|cc|cc|} %
\hline%
 & $q$ & \multicolumn{2}{c|}{SCAD(gcv)} & \multicolumn{2}{c|}{SCAD$(\eta_\nu(\lambda))$}  
 & \multicolumn{2}{c|}{LASSO(gcv)} & \multicolumn{2}{c|} {LASSO$(\eta_\nu(\lambda))$}  
 & \multicolumn{2}{c|}{Hard(gcv)} & \multicolumn{2}{c|}{Hard$(\eta_\nu(\lambda))$} \\
\hline%
{\bfseries Design} & {\bfseries Factors} &Type I & Type II & Type I & Type II &Type I & Type II & Type I & Type II & Type I & Type II & Type I & Type II \\
\hline%
$ 2^{5}$FD & 1 & 0.12 & 0.00 & 0.00 & 0.00 & 0.11 & 0.00 & 0.03 & 0.00 & 0.11 & 0.00 & 0.01 & 0.00 \\
& 2 & 0.11 & 0.00 & 0.01 & 0.00 & 0.10 & 0.00 & 0.02 & 0.00 & 0.10 & 0.00 & 0.01 & 0.00 \\
& 3 & 0.10 & 0.00 & 0.00 & 0.00 & 0.11 & 0.00 & 0.02 & 0.00 & 0.11 & 0.00 & 0.01 & 0.00 \\
& 4 & 0.11 & 0.00 & 0.00 & 0.00 & 0.10 & 0.00 & 0.01 & 0.00 & 0.10 & 0.00 & 0.01 & 0.00 \\
\hline %
\end{tabular}
\end{table}

\end{document}

结果:

相关内容