有没有办法让图中的解决方案?不需要在每个数字中都使用 \multicolumn{}{}?谢谢
\documentclass[12pt,a4paper,oneside,openright]{book}
\usepackage{makeidx}
\usepackage{lipsum}
\usepackage{layaureo}%impagina meglio le pagine, pacchetto grafico su
sezione aurea
\usepackage{emptypage} % non numera le pagine vuote con opzione openright
\usepackage{setspace} %modifica interlinea
\usepackage{float}
\usepackage{adjustbox}
\usepackage{array}
\usepackage{dcolumn}
\usepackage{multirow}%tabelle multiriga
\usepackage{tabularx}
\usepackage{ltablex}
\usepackage{makecell}%To keep spacing of text in tables
\usepackage{subfig}
\usepackage{rotating}
\usepackage{wrapfig}
\begin{document}
\lipsum
\newpage
\begin{sidewaystable}
\centering
\caption{Add caption}
\begin{tabular}{lSSS|SSSSSS}
\toprule
& \multicolumn{3}{c}{2014h1} & \multicolumn{3}{c}{2014h2} & \multicolumn{3}{c}{2015h1} \\
& {PD min} & {PD max} & {PD classe} & {PD min} & {PD max} & {PD classe} & {PD min} & {PD max} & {PD classe} \\
\midrule
A & 0.02 & 0.02 & 0.02 & 0.23 & 0.24 & 0.23 & 0.69 & 0.84 & 0.69 \\
B & 0.03 & 0.05 & 0.04 & 0.27 & 0.47 & 0.38 & 0.90 & 1.30 & 1.05 \\
C & 0.06 & 0.14 & 0.11 & 0.50 & 0.83 & 0.63 & 1.37 & 2.03 & 1.72 \\
D & 0.14 & 0.32 & 0.23 & 0.83 & 1.37 & 1.00 & 2.07 & 3.19 & 2.54 \\
E & 0.32 & 0.74 & 0.52 & 1.47 & 2.49 & 2.11 & 3.22 & 4.95 & 4.31 \\
F & 0.75 & 1.72 & 1.23 & 2.60 & 4.56 & 2.95 & 5.00 & 7.49 & 6.37 \\
G & 1.75 & 3.99 & 2.78 & 5.12 & 7.88 & 6.55 & 7.86 & 11.54 & 8.90 \\
H & 4.00 & 9.11 & 5.34 & 8.17 & 14.12 & 9.09 & 12.62 & 17.73 & 13.12 \\
I & 9.30 & 20.86 & 13.77 & 15.04 & 23.62 & 17.85 & 19.64 & 28.57 & 24.81 \\
L & 22.05 & 47.93 & 35.87 & 31.39 & 44.02 & 38.72 & 29.73 & 40.98 & 35.17 \\
& & & & & & & & & \\
\midrule
& \multicolumn{3}{c}{2015h2} & \multicolumn{3}{c}{2016h1} & & & \\
& {PD min} & {PD max} & {PD classe} & {PD min} & {PD max} & {PD classe} & & & \\
\cmidrule{1-7}
A & 0.30 & 0.33 & 0.31 & 0.05 & 0.08 & 0.08 & & & \\
B & 0.48 & 0.57 & 0.55 & 0.10 & 0.14 & 0.11 & & & \\
C & 0.69 & 0.96 & 0.95 & 0.16 & 0.30 & 0.27 & & & \\
D & 1.12 & 1.67 & 1.53 & 0.33 & 0.64 & 0.46 & & & \\
E & 1.88 & 2.60 & 2.51 & 0.65 & 1.27 & 0.86 & & & \\
F & 2.80 & 3.80 & 3.02 & 1.31 & 2.55 & 2.15 & & & \\
G & 5.38 & 6.27 & 5.74 & 2.60 & 5.06 & 3.19 & & & \\
H & 7.78 & 10.46 & 9.92 & 5.50 & 9.31 & 6.02 & & & \\
I & 12.48 & 16.52 & 16.26 & 10.98 & 17.48 & 14.54 & & & \\
L & 18.74 & 29.69 & 28.42 & 21.46 & 38.41 & 31.45 & & & \\
\cmidrule{1-7}
[![enter image description here][1]][1]\end{tabular}%
\label{tab:addlabel}%
\end{sidewaystable}%
\end{document}
答案1
使用两个表格:
\documentclass[12pt,a4paper,oneside,openright]{book}
\usepackage{makeidx}
\usepackage{lipsum}
\usepackage{layaureo}%impagina meglio le pagine, pacchetto grafico su sezione aurea
\usepackage{emptypage} % non numera le pagine vuote con opzione openright
\usepackage{setspace} %modifica interlinea
\usepackage{float}
\usepackage{adjustbox}
\usepackage{array,booktabs}
\usepackage{dcolumn}
\usepackage{multirow}%tabelle multiriga
\usepackage{tabularx}
\usepackage{ltablex}
\usepackage{makecell}%To keep spacing of text in tables
\usepackage{subfig}
\usepackage{rotating}
\usepackage{wrapfig,siunitx}
\begin{document}
\lipsum
\newpage
\begin{sidewaystable}
\centering
\caption{Add caption}\label{tab:addlabel}%
\begin{varwidth}{\linewidth}
\begin{tabular}{lSSS|SSS|SSS}\toprule
& \multicolumn{3}{c|}{2014h1} & \multicolumn{3}{c|}{2014h2} &
\multicolumn{3}{c}{2015h1} \\
& {PD min} & {PD max} & {PD classe} & {PD min} & {PD max} & {PD classe} & {PD
min} & {PD max} & {PD classe} \\
\midrule
A & 0.02 & 0.02 & 0.02 & 0.23 & 0.24 & 0.23 & 0.69 & 0.84 & 0.69
\\
B & 0.03 & 0.05 & 0.04 & 0.27 & 0.47 & 0.38 & 0.90 & 1.30 & 1.05
\\
C & 0.06 & 0.14 & 0.11 & 0.50 & 0.83 & 0.63 & 1.37 & 2.03 & 1.72
\\
D & 0.14 & 0.32 & 0.23 & 0.83 & 1.37 & 1.00 & 2.07 & 3.19 & 2.54
\\
E & 0.32 & 0.74 & 0.52 & 1.47 & 2.49 & 2.11 & 3.22 & 4.95 & 4.31
\\
F & 0.75 & 1.72 & 1.23 & 2.60 & 4.56 & 2.95 & 5.00 & 7.49 & 6.37
\\
G & 1.75 & 3.99 & 2.78 & 5.12 & 7.88 & 6.55 & 7.86 & 11.54 & 8.90
\\
H & 4.00 & 9.11 & 5.34 & 8.17 & 14.12 & 9.09 & 12.62 & 17.73 & 13.12
\\
I & 9.30 & 20.86 & 13.77 & 15.04 & 23.62 & 17.85 & 19.64 & 28.57 & 24.81
\\
L & 22.05 & 47.93 & 35.87 & 31.39 & 44.02 & 38.72 & 29.73 & 40.98 & 35.17
\\
& & & & & & & & & \\
\midrule
\end{tabular}\\
\begin{tabular}{lSSS|SSSSSS}
& \multicolumn{3}{c|}{2015h2} & \multicolumn{3}{c}{2016h1} & &
&
\\
& {PD min} & {PD max} & {PD classe} & {PD min} & {PD max} & {PD classe}
& & & \\
\cmidrule{1-7}
A & 0.30 & 0.33 & 0.31 & 0.05 & 0.08 & 0.08 & & & \\
B & 0.48 & 0.57 & 0.55 & 0.10 & 0.14 & 0.11 & & & \\
C & 0.69 & 0.96 & 0.95 & 0.16 & 0.30 & 0.27 & & & \\
D & 1.12 & 1.67 & 1.53 & 0.33 & 0.64 & 0.46 & & & \\
E & 1.88 & 2.60 & 2.51 & 0.65 & 1.27 & 0.86 & & & \\
F & 2.80 & 3.80 & 3.02 & 1.31 & 2.55 & 2.15 & & & \\
G & 5.38 & 6.27 & 5.74 & 2.60 & 5.06 & 3.19 & & & \\
H & 7.78 & 10.46 & 9.92 & 5.50 & 9.31 & 6.02 & & & \\
I & 12.48 & 16.52 & 16.26 & 10.98 & 17.48 & 14.54 & & & \\
L & 18.74 & 29.69 & 28.42 & 21.46 & 38.41 & 31.45 & & & \\
\cmidrule{1-7}
\end{tabular}%
\end{varwidth}
\end{sidewaystable}%
\end{document}
答案2
如果您更好地组织表格,则根本不需要垂直线。此外,您甚至不必通过减小水平尺寸来旋转它,这可以通过留出公共部分(在本例中为 PD)来实现。水平折线将清楚地显示表格每三列被拆分。
\documentclass[12pt,a4paper,oneside,openright]{book}
\usepackage{layaureo}
\usepackage{rotating,siunitx,booktabs}
\begin{document}
\begin{table}
\centering
\caption{Add caption}
\label{tab:addlabel}
\begin{tabular}{@{}l*{9}{S[table-format=2.2]}@{}}
\toprule
& \multicolumn{3}{c}{2014h1}
& \multicolumn{3}{c}{2014h2}
& \multicolumn{3}{c}{2015h1}
\\
& \multicolumn{3}{c}{PD}
& \multicolumn{3}{c}{PD}
& \multicolumn{3}{c}{PD}
\\
\cmidrule(lr){2-4} \cmidrule(lr){5-7} \cmidrule(l){8-10}
& {min} & {max} & {classe}
& {min} & {max} & {classe}
& {min} & {max} & {classe}
\\
\midrule
A & 0.02 & 0.02 & 0.02 & 0.23 & 0.24 & 0.23 & 0.69 & 0.84 & 0.69 \\
B & 0.03 & 0.05 & 0.04 & 0.27 & 0.47 & 0.38 & 0.90 & 1.30 & 1.05 \\
C & 0.06 & 0.14 & 0.11 & 0.50 & 0.83 & 0.63 & 1.37 & 2.03 & 1.72 \\
D & 0.14 & 0.32 & 0.23 & 0.83 & 1.37 & 1.00 & 2.07 & 3.19 & 2.54 \\
E & 0.32 & 0.74 & 0.52 & 1.47 & 2.49 & 2.11 & 3.22 & 4.95 & 4.31 \\
F & 0.75 & 1.72 & 1.23 & 2.60 & 4.56 & 2.95 & 5.00 & 7.49 & 6.37 \\
G & 1.75 & 3.99 & 2.78 & 5.12 & 7.88 & 6.55 & 7.86 & 11.54 & 8.90 \\
H & 4.00 & 9.11 & 5.34 & 8.17 & 14.12 & 9.09 & 12.62 & 17.73 & 13.12 \\
I & 9.30 & 20.86 & 13.77 & 15.04 & 23.62 & 17.85 & 19.64 & 28.57 & 24.81 \\
L & 22.05 & 47.93 & 35.87 & 31.39 & 44.02 & 38.72 & 29.73 & 40.98 & 35.17 \\
\midrule[\heavyrulewidth]
& \multicolumn{3}{c}{2015h2}
& \multicolumn{3}{c}{2016h1}
\\
& \multicolumn{3}{c}{PD}
& \multicolumn{3}{c}{PD}
\\
\cmidrule(lr){2-4} \cmidrule(lr){5-7}
& {min} & {max} & {classe}
& {min} & {max} & {classe}
\\
\cmidrule[\lightrulewidth]{1-7}
A & 0.30 & 0.33 & 0.31 & 0.05 & 0.08 & 0.08 \\
B & 0.48 & 0.57 & 0.55 & 0.10 & 0.14 & 0.11 \\
C & 0.69 & 0.96 & 0.95 & 0.16 & 0.30 & 0.27 \\
D & 1.12 & 1.67 & 1.53 & 0.33 & 0.64 & 0.46 \\
E & 1.88 & 2.60 & 2.51 & 0.65 & 1.27 & 0.86 \\
F & 2.80 & 3.80 & 3.02 & 1.31 & 2.55 & 2.15 \\
G & 5.38 & 6.27 & 5.74 & 2.60 & 5.06 & 3.19 \\
H & 7.78 & 10.46 & 9.92 & 5.50 & 9.31 & 6.02 \\
I & 12.48 & 16.52 & 16.26 & 10.98 & 17.48 & 14.54 \\
L & 18.74 & 29.69 & 28.42 & 21.46 & 38.41 & 31.45 \\
\cmidrule[\heavyrulewidth]{1-7}
\end{tabular}
\end{table}
\end{document}