表格太长我该怎么办?

表格太长我该怎么办?

在此处输入图片描述我的表格宽度太大,但无论如何我都能处理。现在长度太大,超出了边距。我该怎么办?

\documentclass[review]{elsarticle}
%\documentclass[1p]{elsarticle}
\usepackage{geometry}
\usepackage{epsfig}
\usepackage{latexsym}
\usepackage[font={normalsize}]{caption}
\usepackage[para,flushleft]{threeparttable}
\renewcommand{\TPTtagStyle}{\textit}
\usepackage{booktabs}
%\usepackage{nicematrix}
\usepackage{amsmath}
\usepackage{fullpage}
\usepackage{setspace}
\usepackage{mathtools}
\usepackage{fancyhdr}
\usepackage{sectsty}
\usepackage{siunitx}
\usepackage{tabularx}
\usepackage{float}
\usepackage{indentfirst}
\usepackage{changepage}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{rotating}
\usepackage{makecell}
\usepackage{subcaption}
\usepackage{rotating}
%\usepackage{subfigure}

% packages for tables
\usepackage{multirow}
\usepackage[table,xcdraw]{xcolor}
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{caption}
\usepackage{adjustbox}




%\usepackage[normalem]{ulem}
%\usepackage[usenames, dvipsnames]{color}


%\usepackage{nomencl}
%\usepackage{cite}

\usepackage{natbib}




%\usepackage[numbers,super]{natbib}
%\setcitestyle{numbers,super}



\usepackage{enumitem}

\usepackage{lineno,hyperref}
\modulolinenumbers[5]



%\renewcommand{\thefootnote}
\newcommand\degrees[1]{\ensuremath{#1^\circ}}

\newcommand\mycaption[1]{\caption{\footnotesize{#1}}}

\newcommand\myfootnote[1]{\footnote{\small{#1}}}

\newcommand\scalemath[2]{\scalebox{#1}{\mbox{\ensuremath{\displaystyle #2}}}}


\renewcommand{\TPTtagStyle}{\textit}

\newcommand{\splitcell}[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}}




\setlist[enumerate]{label*=\arabic*.}







\bibliographystyle{elsarticle-num}


\begin{document}


\begin{table}[H]
\centering

%\setlength{\tabcolsep}{2pt} % <--- should be local, anyway

\caption{Summary of the relevant state of the art}
\label{SART}% <--- the label refers to the caption

\begin{tabular}{@{}ccccccl@{}}
\toprule
% headers
\splitcell{Independent \\ variables} &
\splitcell{Target \\ variable} &
\splitcell{Data \\ records} &
Train/test (\%) &
Model &
Metrics &
Reference
\\
\midrule
% body
\splitcell{Critical energy relexxxxte \\ un-notched strength\\  young modulus\\ hole diameter \\ width\\ stackixxxxxquences} & Strength &  10000 & 90/10 & \splitcell{XGBoost\\RF\\Gauxxxxan Processes \\ANN}&
RMSE = 0.005 &
Furtado et al. furtado2021methodology
\\ \addlinespace
\splitcell{Young modulus\\ Damage inxxxxstrain\\ xxxtion strain\\ damage curve angle} & f-pod curve &  15000 & 70/30 & \splitcell{LSTM\\ANN}&
RMSE=0.266 &
Reiner et al. reiner2021machine
\\ \addlinespace
\splitcell{particle size\\ curinxxxe,power level\\ volume fraction\\ curing angle} & strength &  46 & 78/22 & \splitcell{ANFIS\\ANN}&
\splitcell{RMSE0.0307\\ MAE=xxx.0098\\ $R^2$=0.99\\ RMSE=0.0827} &xxxxet al. 
\\ \addlinespace
\splitcell{crack poxxxxion\\ pattern type\\ loading angle\\
sample thickness\\cxxxxxngth} & Toughness &  2xxx0 & xx/20 & \splitcell{KNN\\ DT\\ RF\\SVM}&
RMSE=0.266 &  Balcıoğlu exxxx balciouglxxxxmparison
\\ \addlinespace
&  & 4367 &  &  &
  RMSE = 
3$\times$10$^{-6}$ &
  Sun et al.xxxxx21prediction
\\ \addlinespace
&  & 1015 &  &  &
  RMSE = 0.03 &
  Breuer et al.
\\ \addlinespace
&  & 30 &  &  &
  \splitcell{$R^2$ = 0xx6 \\ RMSE = 0.4369 \\ MAE = 0.3265} &
  Zhang et al. zhang2xxxxxchine
\\ \addlinespace
&  & 30 &  &  &
  \splitcell{$R^2$ = 0.99 \\ RMSE = 0.08 \\ MAE = 0.06} &
  Zhang et al. zxxxx
\\ \addlinespace
&  & 922 &  &  &
  \splitcell{RMxxxxxx.131 \\ $R^2$ = 0.735} &
  Yin et al. yin2021machine
\\ \addlinespace
&  & 8960 &  &  &
  $R^2$ = 0.98  &
  This study
\\
\bottomrule
\end{tabular}

\end{table}

答案1

像这样:

在此处输入图片描述

无关

-您需要清理文档序言:删除所有两次(或更多)加载的包,重新考虑是否真的需要所有包,其中一些不再需要

主题明确

  • 您可以考虑新颖的表格包“tabularray”。

  • 使用它及其X列类型将显著简化表代码

  • 由于表格较宽,您可以考虑减小字体大小,例如\footnotesize下面的 MWE。如果这不可行,那么可能的解决方案是旋转表格。

  • 更多选项请参见在此处输入链接描述编辑

  • 完整表格如下:

\documentclass{elsarticle}
\usepackage{fullpage}
\usepackage[skip=1ex,
            font=small, labelfont=bf]{caption}
% packages for tables
\usepackage[table,xcdraw]{xcolor}
\usepackage{tabularx}
\UseTblrLibrary{booktabs, siunitx, varwidth}


\begin{document}
    \begin{table}[ht]
    \footnotesize
\caption{Summary of the relevant state of the art}
\label{tab: SART}% <--- the label refers to the caption

\begin{tblr}{colsep = 3pt,
             colspec={@{} X[1,l]
                          X[0.5,c]
                          Q[c,m,si={table-format=5.0}]
                          Q[c]
                          X[0.8,c]
                          X[0.7,c]
                          X[1,l]
                     @{}},
             row{1} = {font=\bfseries, m},
             row{2-Y} = {rowsep=3pt},
             measure=vbox
             }
   \toprule
% headers
{Independent\\ variables}
    &   {Target\\ variable}
        &   {{{Data\\ records}}}
            &   {Train/\\ test (\%)}
                &   Model
                    &   Metrics
                        &   Reference       \\
    \midrule
% body
Critical energy releted un-notched strength young modulus hole diameter width stackinq sequences
    &   Strength
        &  10000
            & 90/10
                &   XGBoost RF Gausian Processes ANN
                    &   RMSE$ = 0.005$
                        &   Furtado et al. furtado2021methodology
                            \\
%    \addlinespace
Young modulus Damage in strain station strain damage curve angle
    &   f-pod curve
        &   15000
            &   70/30
                &   LSTM ANN
                    &   RMSE=0.266
                        &   Reiner et al. reiner2021machine
                            \\
particle size curing, power level, volume fraction, curing angle
    &   strength
        &   46
            &   78/22
                &   {ANFIS\\ ANN}
                    &   {RMSE0.0307\\
                         MAE=xxx.0098\\
                         $R^2 = 0.99$\\
                         RMSE$ = 0.0827$}
                        &   xxxxet al.
                            \\
crack position, pattern type, loading angle, sample thickness, cxxxxxngth
    &   Toughness
        &   23450
            &   xx/20
                &   {KNN DT\\ RF SVM}
                    &   RMSE$=0.266$
                        &   Balcıoğlu e balciougl comparison
                            \\
    &   &   4367
            &   &   &   RMSE$ = 3\times 10^{-6}$
                        &   Sun et al.xxxxx21prediction
                            \\
    &   &   1015
            &   &   &   RMSE$ = 0.03$
                        &   Breuer et al.
                            \\
    &   &   30
            &   &   &   {$R^2 = 0xx6$ \\
                         RMSE$ = 0.4369$ \\
                         MAE$ = 0.3265$}
                        &   Zhang et al. zhang2xxxxxchine
                            \\
    &   &   30
            &   &   &   {$R^2 = 0.99$ \\
                         RMSE$ = 0.08$ \\
                         MAE$ = 0.06$}
                        &   Zhang et al. zxxxx
                            \\
    &   &   922
            &   &   &   {RMxxxxxx.131 \\
                         $R^2 = 0.735$}
                        &   Yin et al. yin2021machine
                            \\
    &   & 8960  &   &   &   $R^2 = 0.98$
                            &   This study
                            \\
    \bottomrule
\end{tblr}
    \end{table}
\end{document}

附录: 尝试清理并重新组织文档序言。仅考虑包(因为考虑到建议的表设计,您的大多数命令定义不再需要:

\documentclass[review]{elsarticle}
% layout
\usepackage[margin=20mm]{geometry}
\usepackage{changepage}
\usepackage{setspace}
\usepackage{indentfirst}
%
\usepackage{lineno}
\modulolinenumbers[5]
%
\usepackage{fancyhdr}
\usepackage{sectsty}
%
\usepackage[normalem]{ulem}
% math
\usepackage{latexsym, mathtools}
% packages for tables
\usepackage{rotating}
\usepackage[table,xcdraw]{xcolor}
\usepackage[para,flushleft]{threeparttable}
\renewcommand{\TPTtagStyle}{\textit}
\usepackage{rotating}
\usepackage{makecell, multirow, % for %classic" tables
            tabularx}           % for %classic" tables
\usepackage{tabularray}         % novel tabler package
\usepackage{booktabs, siunitx,  % load this package
            varwidth}    
% floats and captions
\usepackage{float}
\usepackage[skip=1ex,
            font=small, labelfont=bf]{caption}
\usepackage{subcaption}
% graphic
\usepackage{adjustbox}  % it load graphicx too
% nomenclature, bib
\usepackage{nomencl}
\usepackage{cite}
\usepackage{natbib}

\usepackage{hyperref}

答案2

由于您使用了文档类选项,所以表格的高度增加了review;不必担心。

不过,我担心表格太宽。下面的代码包含一些(实际上相当多)关于如何改善这种情况的建议。大多数情况下,我不会\splitcell在第一列使用指令,而是允许自动换行。

在此处输入图片描述

\documentclass[review]{elsarticle}
\usepackage{fullpage} % really?
\usepackage[font={normalsize}]{caption}
\usepackage[para,flushleft]{threeparttable}
\renewcommand{\TPTtagStyle}{\textit}
\usepackage{booktabs}

\usepackage{amsmath}
\usepackage{setspace}
\usepackage{mathtools}
\usepackage{fancyhdr}
\usepackage{sectsty}
\usepackage{siunitx}
\usepackage{tabularx}
\usepackage{float}
\usepackage{indentfirst}
\usepackage{changepage}
\usepackage{adjustbox}
\usepackage{rotating}
\usepackage{makecell}
\usepackage{subcaption}
\usepackage{rotating}

\usepackage{multirow}
\usepackage[table,xcdraw]{xcolor}

%\usepackage[normalem]{ulem}
%\usepackage[usenames, dvipsnames]{color}
%\usepackage{nomencl}
%\usepackage{cite}

\usepackage{natbib}
%\usepackage[numbers,super]{natbib}
%\setcitestyle{numbers,super}

\usepackage{enumitem}

\usepackage{lineno,hyperref}
\modulolinenumbers[5]

%\renewcommand{\thefootnote}
\newcommand\degrees[1]{\ensuremath{#1^\circ}}
\newcommand\mycaption[1]{\caption{\footnotesize{#1}}}
\newcommand\myfootnote[1]{\footnote{\small{#1}}}
\newcommand\scalemath[2]{\scalebox{#1}{\mbox{\ensuremath{\displaystyle #2}}}}
\renewcommand{\TPTtagStyle}{\textit}
\newcommand{\splitcell}[1]{\begin{tabular}[t]{@{}l@{}}#1\end{tabular}}
\setlist[enumerate]{label*=\arabic*.}

\bibliographystyle{elsarticle-num}

%% New code:
\captionsetup{skip=0.333\baselineskip}
\usepackage{calc,ragged2e}
\hyphenation{gauss-ian}

\begin{document}


\begin{table}[ht!]

\setlength{\tabcolsep}{1pt}

\caption{Summary of the relevant state of the art}
\label{SART}% <--- \label must come afer \caption

\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} 
     >{\RaggedRight}p{0.21\textwidth}
     >{\RaggedRight}p{\widthof{f-pod curve}} 
     p{\widthof{records}}
     >{\centering\arraybackslash}p{\widthof{Train/test}}
     >{\RaggedRight}p{\widthof{RF, Gauss-}}
     l 
     l @{}}
\toprule
% headers
Independent variables &
Target variable &
Data records &
Train/test (\%) &
Model &
Metrics &
Reference
\\
\midrule

% body
Critical energy relexxxxte, un-notched strength, young modulus, hole diameter, width, stacking sequences & 
Strength &  
10000 & 
90/10 & XGBoost, RF, Gaussian processes, ANN &
RMSE: 0.005 &
Furtado et al. %furtado2021methodology
\\ \addlinespace
Young modulus, Damage initiation strain, xxxtion strain, damage curve angle & 
f-pod curve &  15000 & 70/30 & 
LSTM, ANN &
RMSE: 0.266 &
Reiner et al. %reiner2021machine
\\ \addlinespace
Particle size, curinxxxe, power level, volume fraction, curing angle & 
strength &  46 & 78/22 & 
ANFIS, ANN &
\splitcell{RMSE: 0.0307\\ MAE: 0.0098\\ $R^2$: 0.99\\ RMSE: 0.0827} & Okafor et al. %\okafor2021evaluation
\\ \addlinespace
Crack poxxxxion, pattern type, loading angle, sample thickness, cxxxxxngth & 
Toughness &  200 & 80/20 & 
KNN, DT, RF, SVM &
RMSE: 0.266 &  Balcıoğlu et al. %balciouglu2021comparison
\\ \addlinespace
&  & 4367 &  &  & RMSE: 
$3{\times}10^{-6}$ & Sun et al. %sun2021prediction
\\ \addlinespace
&  & 1015 &  &  &
  RMSE: 0.03 & Breuer et al. %breuer2021prediction
\\ \addlinespace
&  & 30 &  &  &
  \splitcell{$R^2$: 0xx6 \\ RMSE: 0.4369 \\ MAE: 0.3265} & Zhang et al. %zhang202xxchine
\\ \addlinespace
&  & 30 &  &  &
  \splitcell{$R^2$: 0.99 \\ RMSE: 0.08 \\ MAE: 0.06} & Zhang et al. %zhang2021machine
\\ \addlinespace
&  & 922 &  &  &
  \splitcell{RMSE: 0.131 \\ $R^2$: 0.735} & Yin et al. %yin2021machine
\\ \addlinespace
&  & 8960 &  &  &
  $R^2$: 0.98  & This study
\\
\bottomrule
\end{tabular*}

\end{table}
\end{document}

相关内容