在下面的代码中,我该如何添加一条垂直线来将第二列与其右侧的所有内容分开?此外,表格的内容在水平方向上太宽。我可以看到,如果第 4 列及以上列的对齐效果更好,内容将完全适合页面。最好的方法是什么?提前谢谢。
\documentclass[11pt]{article}
\usepackage{rotating}
\usepackage[
lmargin=1.0in,
rmargin=1.0in,
tmargin=2.0cm,
bmargin=2.0cm
]{geometry}
\usepackage{tabularx, booktabs}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\usepackage{multirow}
\begin{document}
\renewcommand{\arraystretch}{1.1}
\begin{sidewaystable}
\centering
\caption{bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.}
% \scalebox{0.95}{
\begin{tabularx}{\textheight}{@{}l@{\quad}lc*{11}{Y}@{}}
\toprule
& & &\multicolumn{11}{c}{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}\\[1mm]
& & $a$ &$1\times10^2$ & $2\times10^2$ & $3\times10^2$ & $4\times10^2$ & $5\times10^2$ & $6\times10^2$ & $7\times10^2$ & $8\times10^2$ & $9\times10^2$
& $1\times10^3$ & $1\times10^4$\\
%\midrule
\cmidrule[0.6pt]{4-14}
\parbox[t]{3mm}{\multirow{22}{*}{\rotatebox[origin=c]{90}{cccccccccccccccccccccccccccccc}}}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cmidrule{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cmidrule{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cmidrule{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cmidrule{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cmidrule{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cmidrule{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cmidrule{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cmidrule{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cmidrule{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\bottomrule
\end{tabularx}
% } % endof \scalebox
\end{sidewaystable}
\end{document}
答案1
这是一个没有 booktabs 的解决方案,用 代替makecell
,它有用于定义可变宽度水平规则的命令。我还使用包cellspace
,它定义了单元格顶部和上方单元格底部之间的最小垂直间距,以及单元格底部和下方单元格顶部之间的最小间距。如果我们使用footnotesize and reduce
tabcolsep` 到 3pt,表格的宽度就可以了。
我还加载了caption
包以使标题和表格顶部之间有正确的垂直间距(它交换 \abovecaptionskip 和 \belowcaptionskip 的值)并且我简化了一些代码:
\documentclass[11pt]{article}
\usepackage{rotating}
\usepackage[hmargin=1.0in, vmargin=2.0cm, showframe, nomarginpar]{geometry}
\usepackage{tabularx, booktabs, caption}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\usepackage{multirow}
\usepackage{hhline, makecell}
\newcommand\thickhline{\Xhline{1.2pt}}
\newcommand\thickcline[1]{\Xcline{#1}{1.2pt}}
\newcommand\medhline{\Xhline{0.6pt}}
\newcommand\medcline[1]{\Xcline{#1}{0.6pt}}
\usepackage{cellspace}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}
\begin{document}
\renewcommand{\arraystretch}{1.1}
\begin{sidewaystable}
\centering\footnotesize\renewcommand\tabcolsep{3pt}
\caption{bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.}
\begin{tabularx}{\textheight}{@{}l@{\quad}lc!{\vrule width 1.2pt}*{9}{Y}Scc@{}}
\thickcline{2-14}
& & &\multicolumn{11}{c}{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}\\[0.5ex]
& & $a$ &$1\times10^2$ & $2\times10^2$ & $3\times10^2$ & $4\times10^2$ & $5\times10^2$ & $6\times10^2$ & $7\times10^2$ & $8\times10^2$ & $9\times10^2$
& $1\times10^3$ & $1\times10^4$\\[0.5ex]
\medcline{4-14}
\multirow{25}{*}{\rotatebox[origin=c]{90}{cccccccccccccccccccccccccccccc\enspace}}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cline{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cline{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cline{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cline{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cline{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cline{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cline{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cline{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\cline{2-14}
&\multirow{2}{*}{0.0}
&\multirow{2}{*}{0.000000}
& $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
& &
& $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
\thickcline{2-14}
\end{tabularx}
\end{sidewaystable}
\end{document}