0

Task description

I have a pretty wide table that I am wanting to include and I am just not quite sure how to go about it. I have some dummy data representing the table I want to use below. I have tried using sidewaystable, adjustbox, landscape but I am having no luck. I don't mind if the table is rotated on one page, fit landscape on one page or fit landscape over two pages. Any suggestions would be really awesome! Thanks

\documentclass{article}
     \begin{document}

\begin{table}[h] \centering \caption{Add caption} \begin{tabular}{p{5em}cccccccccccccccc} \cmidrule{2-17} \multicolumn{1}{c}{} & \multicolumn{1}{p{5em}}{\textbf{AB Approx\newline{}Test AUC}} & \multicolumn{1}{p{5em}}{\textbf{AC Approx\newline{}Test AUC}} & \multicolumn{1}{p{5em}}{\textbf{AD Approx\newline{}Test AUC}} & \multicolumn{1}{p{5em}}{\textbf{AE Approx\newline{}Test AUC}} & \multicolumn{1}{p{5em}}{\textbf{AF Approx\newline{}Test AUC}} & \multicolumn{1}{p{5em}}{\textbf{AG Approx\newline{}Test AUC}} & \multicolumn{1}{p{5em}}{\textbf{AH Approx\newline{}Test AUC}} & \multicolumn{1}{p{5em}}{\textbf{AI Approx\newline{}Test AUC}} & \multicolumn{1}{p{5em}}{\textbf{AJ Approx\newline{}Test AUC}} & \multicolumn{1}{p{5em}}{\textbf{AK Approx\newline{}Test AUC}} & \multicolumn{1}{p{5em}}{\textbf{AL Approx\newline{}Test AUC}} & \multicolumn{1}{p{5em}}{\textbf{AM Approx\newline{}Test AUC}} & \multicolumn{1}{p{5em}}{\textbf{AN Approx\newline{}Test AUC}} & \multicolumn{1}{p{5em}}{\textbf{AO Approx\newline{}Test AUC}} & \multicolumn{1}{p{5em}}{\textbf{AP Approx\newline{}Test AUC}} & \multicolumn{1}{p{5em}}{\textbf{AQ Approx\newline{}Test AUC}} \ \cmidrule{2-17} \multicolumn{4}{l}{\textit{Panel A: Something long will go here}} & & & & & & & & & & & & & \ \multicolumn{1}{c}{50} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{1}{c}{40} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{1}{c}{30} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{1}{c}{20} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{1}{c}{10} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{4}{l}{\textit{Panel B: Something long will go here}} & & & & & & & & & & & & & \ \multicolumn{1}{c}{50} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{1}{c}{40} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{1}{c}{30} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{1}{c}{20} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{1}{c}{10} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{4}{l}{\textit{Panel C: Something long will go here}} & & & & & & & & & & & & & \ \multicolumn{1}{c}{50} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{1}{c}{40} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{1}{c}{30} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{1}{c}{20} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{1}{c}{10} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{4}{l}{\textit{Panel D: Something long will go here}} & & & & & & & & & & & & & \ \multicolumn{1}{c}{50} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{1}{c}{40} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{1}{c}{30} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{1}{c}{20} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 10 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \bottomrule \end{tabular}% \label{tab:addlabel}% \end{table}%

\end{document}

The table would hopefully look like the following image: enter image description here

  • First of all, please always provide a self contained MWE. E.g. \usepackage{booktabs} is missing in your file header to support \cmidrule. – Steradiant Oct 27 '20 at 12:58
  • 1
    In the first of all, you should provide more realistic document example. I doubt, that all columns have the same column headers, why the first column is so wide when in it are only two digit numbers etc. – Zarko Oct 27 '20 at 13:28
  • I will have a look over that link. The columns I am using just have different values for AB, the remaining is consistent. I didn't adjust the first column, apologies for that. – oceanbeach96 Oct 27 '20 at 13:31
  • 1
    Please, edit your question and show us some real content of table columns' headers, correct your example that it will be compilable. Also are all numbers have the same number of digits? – Zarko Oct 27 '20 at 13:56

2 Answers2

1

You can make your table fit a single page loading the geometry package to have more sensible margins, using the landscape environment and playing with the font size & the value of \tabcolsep. I added some improvements (spacing between the panels, use of the S column type) and simplified a bit the code.

\documentclass{article}
\usepackage{geometry}
\usepackage{lscape}
\usepackage{booktabs, caption}
\usepackage{siunitx}

\begin{document}

\begin{landscape} \setlength{\tabcolsep}{3.4pt} \setlength{\extrarowheight}{2pt} \sisetup{table-format=1.4, table-number-alignment=center} \begin{table}[!h] \centering \small \caption{Add caption} \begin{tabular}{@{}wc{3em}*{16}{S}@{}} \toprule & \multicolumn{16}{c}{\bfseries AB Approx Test AUC} \ \cmidrule{2-17} \multicolumn{6}{@{}l}{\textit{Panel A: Something long will go here}} \ 50 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 40 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 30 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 20 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 10 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \addlinespace \multicolumn{6}{@{}l}{\textit{Panel B: Something long will go here}} \ 50 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 40 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 30 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 20 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 10 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \addlinespace \multicolumn{6}{@{}l}{\textit{Panel C: Something long will go here}} \ 50 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 40 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 30 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 20 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 10 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \addlinespace \multicolumn{6}{l}{\textit{Panel D: Something long will go here}}& \ 50 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 40 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 30 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 20 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ 10 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \bottomrule \end{tabular}% \label{tab:addlabel}% \end{table}% \end{landscape}

\end{document}

enter image description here

Bernard
  • 271,350
  • How you know, what is in column headers? – Zarko Oct 27 '20 at 15:26
  • @Zarko: all column headers in the O.P.'s post were the same, so I supposed they were not all different from each other. Maybe I'm wrong, but I suppose he/she'll tell us \ in such a case, it would be a bit more complex. – Bernard Oct 27 '20 at 15:36
  • Just updated the question. Each column is different and all digits are 4, besides the first column – oceanbeach96 Oct 27 '20 at 15:59
  • Well, that was reason why I ask OP for more details and (at same time) suggest to close OP's question as duplicate to famous @Werner question/answer (My table doesn't fit; what are my options?) – Zarko Oct 27 '20 at 16:02
1

You need to redesign your column headers, they are to wide that table can be fit in (landscape) page even if you make headers font size nonreadable small. For example, collect common text from all headers to one \multicolumn cell, i.e. do something like this:

enter image description here

\documentclass{article}
\usepackage[margin=20mm]{geometry}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{rotating}
\usepackage{booktabs, makecell}
\renewcommand\theadfont{\normalsize\bfseries}

\usepackage{lipsum} \begin{document} \begin{sidewaystable} \centering %\setlength\tabcolsep{3pt} \caption{Add caption} \begin{tabular}{l cccccccccccccccc } \cmidrule{2-17}
& \multicolumn{16}{c}{\thead{Approx by Test AUC}} \ & \thead{AB} & \thead{AC} & \thead{AD} & \thead{AE} & \thead{AF} & \thead{AG} & \thead{AH} & \thead{AI} & \thead{AJ} & \thead{AK} & \thead{AL} & \thead{AM} & \thead{AN} & \thead{AO} & \thead{AP} & \thead{AQ}\ \cmidrule{2-17} \multicolumn{17}{l}{\textit{Panel A: Something long will go here}} \ \addlinespace {50} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {40} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {30} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {20} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {10} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{17}{l}{\textit{Panel B: Something long will go here}} \ \addlinespace {50} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {40} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {30} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {20} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {10} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{17}{l}{\textit{Panel C: Something long will go here}} \ \addlinespace {50} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {40} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {30} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {20} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {10} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \multicolumn{17}{l}{\textit{Panel D: Something long will go here}} \ {50} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {40} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {30} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {20} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {10} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \bottomrule \end{tabular}% \label{tab:addlabel}% \end{sidewaystable}%

\end{document}

Addendum: Apparently both answer have no value for OP (also (s)he after this question is not active on site anymore). However, it may happens, that someone else will be interested for some of proposed solutions. Therefore, as addendum, I add one more solution, which for table use tabularray package (version 2022C) and its version of the X column type:

\documentclass{article}
\usepackage{geometry}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage[skip=0.33\baselineskip]{caption}
\usepackage{rotating}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\usepackage{lipsum} \begin{document} \begin{sidewaystable} \centering \caption{Add caption} \begin{tblr}{colsep=3pt, colspec={@{} l *{16}{X[c]} @{}}, column{1} = {rightsep=1em}, row{1,2}={font=\bfseries}, row{4-Z}={rowsep=0.5pt}, row{9,15, 21} = {abovesep=2ex, belowsep=2pt}, } \cmidrule[l,\heavyrulewidth]{2-17} & \SetCell[c=16]{c} Approx by Test AUC & & & & & & & & & & & & & & & \ &AB &AC &AD &AE &AF &AG &AH &AI &AJ &AK &AL &AM &AN &AO &AP &AQ \ \cmidrule[l]{2-17} \SetCell[c=17]{l, font=\itshape} Panel A: Something long will go here & & & & & & & & & & & & & & & & \ {50} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {40} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {30} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {20} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {10} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ % \midrule[dashed, fg=gray] \SetCell[c=17]{l, font=\itshape} Panel B: Something long will go here & & & & & & & & & & & & & & & & \ {50} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {40} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {30} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {20} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {10} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \SetCell[c=17]{l, font=\itshape} Panel C: Something long will go here & & & & & & & & & & & & & & & & \ {50} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {40} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {30} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {20} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {10} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \SetCell[c=17]{l, font=\itshape} Panel D: Something long will go here & & & & & & & & & & & & & & & & \ {50} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {40} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {30} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {20} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ {10} & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \ \bottomrule \end{tblr}% \label{tab:addlabel}% \end{sidewaystable}%

\end{document}

enter image description here

Zarko
  • 296,517