1

is there a way to have the solution in the figure? without \multicolumn{}{} in every number? Thanksenter image description here

\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}
0

Use two tabulars:

\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}

enter image description here

1
  • Thanks, didn't taught at the simplier solution at all
    – Jordan_b
    Jun 20 '18 at 17:02
0

You need no vertical rule at all, if you organize better your table. Moreover, you don't even have to rotate it by reducing the horizontal size, which can be achieved by setting aside the common parts (PD, in this case). The horizontal broken rules will make clear that the table is split every three columns.

\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}

enter image description here

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.