拉伸宽横向表格以适合页面

拉伸宽横向表格以适合页面

我想知道下面的宽表是否可以拉伸以适应页面的更大部分。表的大小还可以,但最好再大一点。任何建议都很棒!

\documentclass{article}

\begin{landscape}
\begin{table}
    \caption {\label{tab:Table 4 - MDI recursive prediction} This table demonstrates the MDI classification report for the individual corporate credit rating classes for an ET. Based on the balance between number of features and predictive performance in Table 3, precision, recall, F1 score and support are evaluated on 20 features for U.S. and global NonESG and ESG samples.}
    \resizebox{\columnwidth}{!}
    {\begin{tabular}{ccccccccccccccccc}
        \toprule
        {} & {\thead{U.S. NonESG \\ precision}} & {\thead{U.S. NonESG \\ recall}} & {\thead{U.S. NonESG \\ F1 score}} & {\thead{U.S. NonESG \\ support}} & {\thead{U.S ESG \\ precision}} & {\thead{U.S ESG \\ recall}} & {\thead{U.S ESG \\ F1 score}} & {\thead{U.S ESG \\ support}} & {\thead{GL NonESG \\ precision}} & {\thead{GL NonESG \\ recall}} & {\thead{GL NonESG \\ F1 score}} & {\thead{GL NonESG \\ support}} & {\thead{GL ESG \\ precision}} & {\thead{GL ESG \\ recall}} & {\thead{GL ESG \\ F1 score}} & {\thead{GL ESG \\ support}} \\
        \midrule\addlinespace  
        AAA & 0.9766 & 0.9843 & 0.9804 & 127 & 1 & 1 & 1 & 55 & 1 & 1 & 1 & 34 & 1 & 1 & 1 & 27 \\
        AA+ & 0.9844 & 0.9403 & 0.9618 & 67 & 0 & 0 & 0 & 0 & 0.9167 & 0.9565 & 0.9362 & 23 & 0.9333 & 0.7778 & 0.8485 & 18 \\
        AA & 0.9703 & 0.9729 & 0.9716 & 369 & 1 & 1 & 1 & 148 & 0.9254 & 0.9688 & 0.9466 & 64 & 0.9219 & 0.9833 & 0.9516 & 60 \\
        AA- & 0.9543 & 0.9730 & 0.9636 & 408 & 1 & 1 & 1 & 96 & 0.9815 & 0.9578 & 0.9695 & 166 & 1 & 0.9645 & 0.9819 & 169 \\
        A+ & 0.9700 & 0.9739 & 0.9719 & 995 & 0.9968 & 1 & 0.9984 & 309 & 0.9804 & 0.9709 & 0.9756 & 309 & 0.9619 & 0.9806 & 0.9712 & 309 \\
        A & 0.9696 & 0.9639 & 0.9667 & 1357 & 0.9684 & 0.9629 & 0.9656 & 350 & 0.9463 & 0.9559 & 0.9511 & 295 & 0.9353 & 0.9455 & 0.9403 & 275 \\
        A- & 0.9577 & 0.9583 & 0.9580 & 1464 & 0.9790 & 0.9689 & 0.9739 & 482 & 0.9618 & 0.9658 & 0.9638 & 730 & 0.9772 & 0.9646 & 0.9709 & 622 \\
        BBB+ & 0.9558 & 0.9663 & 0.9610 & 1901 & 0.9724 & 0.9830 & 0.9776 & 823 & 0.9716 & 0.9716 & 0.9716 & 1090 & 0.9748 & 0.9737 & 0.9743 & 914 \\
        BBB & 0.9613 & 0.9582 & 0.9597 & 2438 & 0.9758 & 0.9697 & 0.9727 & 956 & 0.9537 & 0.9683 & 0.9609 & 914 & 0.9674 & 0.9744 & 0.9709 & 821 \\
        BBB- & 0.9541 & 0.9508 & 0.9524 & 2031 & 0.9701 & 0.9726 & 0.9714 & 802 & 0.9592 & 0.9613 & 0.9603 & 930 & 0.9708 & 0.9708 & 0.9708 & 754 \\
        BB+ & 0.9347 & 0.9474 & 0.9410 & 1406 & 0.9560 & 0.9613 & 0.9587 & 543 & 0.9434 & 0.9488 & 0.9461 & 527 & 0.9504 & 0.9637 & 0.9570 & 358 \\
        BB & 0.9597 & 0.9413 & 0.9504 & 1721 & 0.9415 & 0.9489 & 0.9452 & 509 & 0.9667 & 0.8906 & 0.9271 & 521 & 0.9474 & 0.9375 & 0.9424 & 288 \\
        BB- & 0.9467 & 0.9554 & 0.9510 & 2397 & 0.9712 & 0.9637 & 0.9674 & 524 & 0.9268 & 0.9552 & 0.9408 & 424 & 0.9474 & 0.9083 & 0.9274 & 218 \\
        B+ & 0.9351 & 0.9496 & 0.9423 & 2261 & 0.9728 & 0.9831 & 0.9779 & 473 & 0.9250 & 0.9250 & 0.9250 & 320 & 0.9106 & 0.9412 & 0.9256 & 119 \\
        B & 0.9423 & 0.9262 & 0.9342 & 1341 & 0.9490 & 0.9442 & 0.9466 & 197 & 0.9157 & 0.9373 & 0.9264 & 255 & 0.8830 & 0.8925 & 0.8877 & 93 \\
        B- & 0.9010 & 0.9151 & 0.9080 & 577 & 0.9655 & 0.8889 & 0.9256 & 63 & 0.9409 & 0.8925 & 0.9161 & 214 & 0.9833 & 0.9365 & 0.9593 & 63 \\
        CCC+ & 0.9136 & 0.8627 & 0.8874 & 233 & 0.9730 & 0.9730 & 0.9730 & 37 & 0.7843 & 0.8333 & 0.8081 & 48 & 0.8235 & 0.9333 & 0.8750 & 30 \\
        CCC & 0.8701 & 0.7976 & 0.8323 & 84 & 1 & 1 & 1 & 9 & 0.7857 & 0.9429 & 0.8571 & 35 & 0.8235 & 1 & 0.9032 & 14 \\
        CCC- & 0.8864 & 0.7800 & 0.8298 & 50 & 1 & 0.9412 & 0.9697 & 17 & 0.9231 & 1 & 0.9600 & 36 & 1 & 1 & 1 & 6 \\
        CC & 0.9762 & 0.8200 & 0.8913 & 50 & 1 & 1 & 1 & 11 & 0.9130 & 0.7 & 0.7925 & 30 & 0.875 & 0.7 & 0.7778 & 10 \\
        SD & 0.5556 & 0.7143 & 0.6250 & 7 & 0 & 0 & 0 & 0 & 0.9231 & 1 & 0.9600 & 12 & 0.5 & 0.3333 & 0.4 & 3 \\
        D & 0.9485 & 0.8846 & 0.9154 & 104 & 1 & 1 & 1 & 4 & 0.8889 & 1 & 0.9412 & 32 & 0.8333 & 0.8333 & 0.8333 & 6 \\
        accuracy & 0.9506 & 0.9506 & 0.9506 & 0.9506 & 0.9708 & 0.9708 & 0.9708 & 0.9708 & 0.9518 & 0.9518 & 0.9518 & 0.9518 & 0.9612 & 0.9612 & 0.9612 & 0.9612 \\
        macro avg & 0.9284 & 0.9153 & 0.9207 & 21388 & 0.9796 & 0.9731 & 0.9762 & 6408 & 0.9288 & 0.9410 & 0.9334 & 7009 & 0.9145 & 0.9052 & 0.9077 & 5177 \\
        weighted avg & 0.9507 & 0.9506 & 0.9506 & 21388 & 0.9708 & 0.9708 & 0.9708 & 6408 & 0.9522 & 0.9518 & 0.9517 & 7009 & 0.9614 & 0.9612 & 0.9611 & 5177 \\
        \bottomrule
    \end{tabular}}
\end{table}
\end{landscape}
\end{document}

答案1

  • 重新组织列标题,使列可以变窄
  • 使用S列类型(在siunitx包中定义)
  • 删除\resizebox{...}{...},它使表格几乎无法阅读,而是使用tabular*\linewidth 横向等于\textheight)宽度并将字体大小减小到\small

根据猜测(缺乏有关文档序言的信息),看看以下解决方案是否是您想要的:

\documentclass{article}
\usepackage[margin=25mm]{geometry}
\usepackage{pdflscape}
\usepackage{booktabs, makecell}

\usepackage{siunitx}

\begin{document}
\begin{landscape}
\begin{table}
    \caption {\label{tab:Table 4 - MDI recursive prediction} This table demonstrates the MDI classification report for the individual corporate credit rating classes for an ET. Based on the balance between number of features and predictive performance in Table 3, precision, recall, F1 score and support are evaluated on 20 features for U.S. and global NonESG and ESG samples.}
\small
\setlength\tabcolsep{0pt}
    \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}l 
                                 *{4}{*{3}{S[table-format=1.4]}S[table-format=4.0]}
                                 }
        \toprule
    & \multicolumn{4}{c}{\thead{U.S. NonESG}} 
            & \multicolumn{4}{c}{\thead{U.S. NonESG}}
                    & \multicolumn{4}{c}{\thead{GL NonESG}} 
                            & \multicolumn{4}{c}{\thead{GL ESG}}    \\                 
    \cmidrule(l){2-5}
    \cmidrule(l){6-9}
    \cmidrule(l){10-13}
    \cmidrule(l){14-17}
    & {\thead{precision}} & {\thead{recall}} & {\thead{F1 score}} & {\thead{support}}   
    & {\thead{precision}} & {\thead{recall}} & {\thead{F1 score}} & {\thead{support}}
    & {\thead{precision}} & {\thead{recall}} & {\thead{F1 score}} & {\thead{support}}
    & {\thead{precision}} & {\thead{recall}} & {\thead{F1 score}} & {\thead{support}}
                                                                    \\
        \midrule
AAA & 0.9766 & 0.9843 & 0.9804 & 127 
    & 1      & 1      & 1      & 55 
    & 1      & 1      & 1      & 34 
    & 1      & 1      & 1      & 27                         \\
AA+ & 0.9844 & 0.9403 & 0.9618 & 67 
    & 0      & 0      & 0      & 0 
    & 0.9167 & 0.9565 & 0.9362 & 23 
    & 0.9333 & 0.7778 & 0.8485 & 18                         \\
AA  & 0.9703 & 0.9729 & 0.9716 & 369 
    & 1      & 1      & 1      & 148 
    & 0.9254 & 0.9688 & 0.9466 & 64 
    & 0.9219 & 0.9833 & 0.9516 & 60                         \\
AA- & 0.9543 & 0.9730 & 0.9636 & 408 
    & 1      & 1      & 1      & 96 
    & 0.9815 & 0.9578 & 0.9695 & 166 
    & 1      & 0.9645 & 0.9819 & 169                        \\
A+  & 0.9700 & 0.9739 & 0.9719 & 995 
    & 0.9968 & 1      & 0.9984 & 309 
    & 0.9804 & 0.9709 & 0.9756 & 309 
    & 0.9619 & 0.9806 & 0.9712 & 309                        \\
A   & 0.9696 & 0.9639 & 0.9667 & 1357 
    & 0.9684 & 0.9629 & 0.9656 & 350 
    & 0.9463 & 0.9559 & 0.9511 & 295 
    & 0.9353 & 0.9455 & 0.9403 & 275                        \\
A-  & 0.9577 & 0.9583 & 0.9580 & 1464 
    & 0.9790 & 0.9689 & 0.9739 & 482 
    & 0.9618 & 0.9658 & 0.9638 & 730 
    & 0.9772 & 0.9646 & 0.9709 & 622                        \\
        \addlinespace
BBB+ 
    & 0.9558 & 0.9663 & 0.9610 & 1901 
    & 0.9724 & 0.9830 & 0.9776 & 823 
    & 0.9716 & 0.9716 & 0.9716 & 1090 
    & 0.9748 & 0.9737 & 0.9743 & 914                        \\
BBB & 0.9613 & 0.9582 & 0.9597 & 2438 
    & 0.9758 & 0.9697 & 0.9727 & 956 
    & 0.9537 & 0.9683 & 0.9609 & 914 
    & 0.9674 & 0.9744 & 0.9709 & 821                        \\
BBB- 
    & 0.9541 & 0.9508 & 0.9524 & 2031 
    & 0.9701 & 0.9726 & 0.9714 & 802 
    & 0.9592 & 0.9613 & 0.9603 & 930 
    & 0.9708 & 0.9708 & 0.9708 & 754                        \\
BB+ & 0.9347 & 0.9474 & 0.9410 & 1406 
    & 0.9560 & 0.9613 & 0.9587 & 543 
    & 0.9434 & 0.9488 & 0.9461 & 527 
    & 0.9504 & 0.9637 & 0.9570 & 358                        \\
BB  & 0.9597 & 0.9413 & 0.9504 & 1721 
    & 0.9415 & 0.9489 & 0.9452 & 509 
    & 0.9667 & 0.8906 & 0.9271 & 521 
    & 0.9474 & 0.9375 & 0.9424 & 288                        \\
BB- & 0.9467 & 0.9554 & 0.9510 & 2397 
    & 0.9712 & 0.9637 & 0.9674 & 524 
    & 0.9268 & 0.9552 & 0.9408 & 424 
    & 0.9474 & 0.9083 & 0.9274 & 218                        \\
B+  & 0.9351 & 0.9496 & 0.9423 & 2261 
    & 0.9728 & 0.9831 & 0.9779 & 473 
    & 0.9250 & 0.9250 & 0.9250 & 320 
    & 0.9106 & 0.9412 & 0.9256 & 119                        \\
B   & 0.9423 & 0.9262 & 0.9342 & 1341 
    & 0.9490 & 0.9442 & 0.9466 & 197 
    & 0.9157 & 0.9373 & 0.9264 & 255 
    & 0.8830 & 0.8925 & 0.8877 & 93                         \\
B-  & 0.9010 & 0.9151 & 0.9080 & 577 
    & 0.9655 & 0.8889 & 0.9256 & 63 
    & 0.9409 & 0.8925 & 0.9161 & 214 
    & 0.9833 & 0.9365 & 0.9593 & 63                         \\
        \addlinespace
CCC+ 
    & 0.9136 & 0.8627 & 0.8874 & 233 
    & 0.9730 & 0.9730 & 0.9730 & 37 
    & 0.7843 & 0.8333 & 0.8081 & 48 
    & 0.8235 & 0.9333 & 0.8750 & 30                         \\
CCC & 0.8701 & 0.7976 & 0.8323 & 84 
    & 1      & 1      & 1      & 9 
    & 0.7857 & 0.9429 & 0.8571 & 35 
    & 0.8235 & 1      & 0.9032 & 14                         \\
CCC- 
    & 0.8864 & 0.7800 & 0.8298 & 50 
    & 1      & 0.9412 & 0.9697 & 17 
    & 0.9231 & 1      & 0.9600 & 36 
    & 1      & 1      & 1      & 6                          \\
CC  & 0.9762 & 0.8200 & 0.8913 & 50 
    & 1      & 1      & 1      & 11 
    & 0.9130 & 0.7    & 0.7925 & 30 
    & 0.875  & 0.7    & 0.7778 & 10                         \\
        \addlinespace
SD  & 0.5556 & 0.7143 & 0.6250 & 7 
    & 0      & 0      & 0      & 0 
    & 0.9231 & 1      & 0.9600 & 12 
    & 0.5    & 0.3333 & 0.4    & 3                          \\
D   & 0.9485 & 0.8846 & 0.9154 & 104 
    & 1      & 1      & 1      & 4      
    & 0.8889 & 1      & 0.9412 & 32 
    & 0.8333 & 0.8333 & 0.8333 & 6                          \\
        \midrule
accuracy 
    & 0.9506 & 0.9506 & 0.9506 & {0.9506} 
    & 0.9708 & 0.9708 & 0.9708 & {0.9708} 
    & 0.9518 & 0.9518 & 0.9518 & {0.9518} 
    & 0.9612 & 0.9612 & 0.9612 & {0.9612}                   \\
macro avg 
    & 0.9284 & 0.9153 & 0.9207 & {21388} 
    & 0.9796 & 0.9731 & 0.9762 & {6408} 
    & 0.9288 & 0.9410 & 0.9334 & {7009} 
    & 0.9145 & 0.9052 & 0.9077 & {5177}                     \\
weighted avg 
    & 0.9507 & 0.9506 & 0.9506 & {21388}  
    & 0.9708 & 0.9708 & 0.9708 & {6408}   
    & 0.9522 & 0.9518 & 0.9517 & {7009}   
    & 0.9614 & 0.9612 & 0.9611 & {5177}                       \\
        \bottomrule
    \end{tabular*}
\end{table}
    \end{landscape}
\end{document}

在此处输入图片描述

相关内容