如何在一页上放一张长表格

如何在一页上放一张长表格

在此处输入图片描述

\begin{table}
    
    \caption{Description of benchmark functions}
    \label{tab:1}    
    \begin{tabular}{llll}
        \hline\noalign{\smallskip}
        Function & Dim & Range & $f_{min}$  \\
        \noalign{\smallskip}\hline\noalign{\smallskip}
        $F_1 (x)=\sum^{n}_{i=1}x_i^2 $&30   &[-100,100]&0\\
        $F_2 (x)= \sum^{n}_{i=1} |x_i|+\prod^{n}_{i=1}|x_i|$&30 &[-10,10]   &0\\
        $F_3 (x)=\sum^{n}_{i=1}(\sum^{n}_{j-1}x_i^2)^2$&30  &[-100,100] &0\\
        $F_4 (x)=\max_{i}{\{|x_i|,1\leq i\leq n\}}$&30  &[-100,100] &0\\
        $F_5(x)=\sum^{n-1}_{i=1}[100(x_{i+1}-x_i^2)^2+(x_{i}-1)^2]$&30  &[-30,30]   &0\\
        $F_6(x)=\sum^{n}_{i=1}(|x_i+0.5|)^2$&30 &[-100,100] &0\\
        $F_7(x)=\sum^{n}_{i=1}ix_{i}^4+rand(0,1)$&30&   [-1.28,1.28]&   0\\
        $F_8(x)=\sum^{n}_{i=1} - x_i  sin⁡(\sqrt{|x_i |})$&30&  [-500,500]  &−418.9829×5\\
        $F_9(x)=\sum^{n}_{i=1}[x_i^2-cos(2\pi x_i)+10]$&30  &[-5.12,5.12]   &0\\
        $F_{10} (x)=-20\ exp(-0.2 \sqrt{1/n\sum^{n}_{i=1}x_i^2} \ )-exp(\dfrac{1}{n}\sum^{n}_{i=1}cos(2\pi x_i))+20+e$&30   &[-32,32]   &0\\
        $F_{11} (x)=\dfrac{1}{4000} \sum^{n}_{i=1} x_i^2-\pi_{i=1}^n  cos(\dfrac{x_i}{\sqrt{i}})+1$&30& [-600,600]& 0\\
        $F_{12} (x)=\dfrac{\pi}{n}\{10\ sin(\pi y_1 )+\sum^{n}_{i=1} (y_i-1)^2 [1+10\ sin^2⁡(\pi y_{i+1} ) ]+(y_n-1)^2\}+\sum^{n}_{i=1} u(x_i,10,100,4)$&30 &[-50,50]   &0\\
        $y_i=1+\dfrac{x_i+1}{4}\  u(x_i,a,k,m)= 
        \begin{cases}
            k(x_i-a)^m  x_i>a \\
            0-a<x_i<a\\
            k(-x_i-a)^m \ x_i<-a
        \end{cases}$&30&    [-50,50]&   0\\
        $F_{13} (x)=0.1\{sin^2(3\pi x_1 )+\sum^{n}_{i=1} (x_i-1)^2 [1+sin^2⁡(3\pi x_i+1) ]+(x_n-1)^2 [1+sin^2⁡(2\pi x_n ) ] \}+\sum^{n}_{i=1} u(x_i,5,100,4)$&30&   [-50,50]&   0\\
        $F_{14}(x)=(\dfrac{1}{500}+\sum^{25}_{j=1}\dfrac{1}{j+\sum^{2}_{i=1} (x_i-a_{ij} )^6 })^{-1}$&2&    [-65,65]    &1\\
        $F_{15} (x)=\sum^{11}_{i=1} [a_i-(x_1 (b_i^2+b_i x_2 ))/(b_i^2+b_i x_3+x_4 )]^2$&4& [-5,5]  &0.00030\\
        $F_{16} (x)=4x_1^2-2.1x_1^4+\dfrac{1}{3} x_1^6+x_1 x_2-4x_2^2+4x_2^4$&2&    [-5,5]  &-1.0316\\
        $F_{17} (x)=(x_2-\dfrac{5.1}{4\pi^2}  x_1^2+\dfrac{2}{\pi} x_1-6)^2+10(1-\dfrac{1}{8\pi})cos\ ⁡x_1+10$&2&   [-5,5]  &0.398\\
        $F_{18} (x)=[1+(x_1+x_2+1)^2 (19-14x_1+3x_1^2-14x_2+6x_1 x_2+3x_2^2 )]×[30+(2x_1-3x_2 )^2×(18-32x_1+12x_1^2+48x_2-36x_1 x_2+27x_2^2)]$&2&   [-2,2]  &3\\
        $F_{19} (x)=-\sum^{4}_{i=1}\ c_i\ exp⁡(-\sum^{3}_{j=1} a_{ij} (x_j-p_{ij} )^2)$&3&  [1,3]   &-3.86\\
        $F_{20} (x)=-\sum^{4}_{i=1}\ c_i\ exp⁡(-\sum^{6}_{j=1} a_{ij} (x_j-p_{ij} )^2)$&6&  [0,1]   &-3.32\\
        $F_{21} (x)=-\sum^{5}_{i=1} [(x-a_i ) (x-a_i )^T+c_i ]^{-1}$&4& [0,10]  &-10.1532\\
        $F_{22} (x)=-\sum^{7}_{i=1} [(x-a_i ) (x-a_i )^T+c_i ]^{-1}$&4& [0,10]  &-10.4028\\
        $F_{23} (x)=-\sum^{10}_{i=1} [(x-a_i ) (x-a_i )^T+c_i ]^{-1}$&4&    [0,10]  &-10.5363\\
        \noalign{\smallskip}\hline
    \end{tabular}
\end{table}

答案1

为了使表格能够完全适应页面,您必须在公式中允许换行F_{12}F_{13}尤其是。在下面的解决方案中,这是在包环境F_{13}的帮助下完成的。alignedamsmath

我还会用\frac内联样式的分数项替换表达式,例如,用 替换\frac{1}{500}。当然,除非您想破坏公式的外观,否则1/500不要使用。\dfrac

您应该养成书写\sin、、、和的习惯,而不仅仅是、、、和。\cos\exp\min\maxsincosexpminmax

哦,由于表格内容几乎全部采用数学模式(标题行中的几个单词除外),因此我会使用环境array而不是tabular环境。如果没有其他选择,它可以让您摆脱大约 50 个$符号,这对清理代码有很大帮助。

在此处输入图片描述

\documentclass{article} % or some other suitable document classs
\usepackage[letterpaper,margin=1in]{geometry} % set page parameters suitably
\usepackage{array,amsmath,booktabs}
\DeclareMathOperator{\rand}{rand}

\begin{document}
\begin{table}
    \caption{Description of benchmark functions\strut}
    \label{tab:1}    
    \setlength\extrarowheight{4pt} % more vertical space between rows
    
    $\begin{array}{@{} llll @{}}
        \toprule
        \text{Function} & \text{Dim} & \text{Range} & f_{\min}  \\
        \midrule
        F_1 (x)=\sum^{n}_{i=1}x_i^2 & 30 &[-100,100]&0\\
        F_2 (x)= \sum^{n}_{i=1} |x_i|+\prod^{n}_{i=1}|x_i| & 30 & [-10,10]   &0\\
        F_3 (x)=\sum^{n}_{i=1}(\sum^{n}_{j-1}x_i^2)^2 & 30 &[-100,100] &0\\
        F_4 (x)=\max_{i}{\{|x_i|,1\leq i\leq n\}} & 30 &[-100,100] &0\\
        F_5(x)=\sum^{n-1}_{i=1}[100(x_{i+1}-x_i^2)^2+(x_{i}-1)^2] & 30 &[-30,30]   &0\\
        F_6(x)=\sum^{n}_{i=1}(|x_i+0.5|)^2&30 &[-100,100] &0\\
        F_7(x)=\sum^{n}_{i=1}ix_{i}^4+\rand(0,1) & 30 &   [-1.28,1.28]&   0\\
        F_8(x)=\sum^{n}_{i=1} - x_i \sin(\sqrt{|x_i |}\,) & 30 &  [-500,500]  &-418.9829\cdot 5\\  
            % [I replaced a non-printing unicode character with "\cdot". Is that okay?]
        F_9(x)=\sum^{n}_{i=1}[x_i^2-\cos(2\pi x_i)+10] & 30 &[-5.12,5.12]   &0\\
        F_{10} (x) = -20 \exp\bigl(-0.2 \sqrt{\frac{1}{n}\sum^{n}_{i=1}x_i^2} \,\bigr) 
         -\exp\bigl(\frac{1}{n}\sum^{n}_{i=1}\cos(2\pi x_i)\bigr)+20+e 
        &30   &[-32,32]   &0\\
        F_{11} (x)=(1/4000) \sum^{n}_{i=1} x_i^2-\prod_{i=1}^n  \cos(x_i/i)+1 & 30 & [-600,600]& 0\\
        \begin{aligned}[t]
        F_{12} (x) &=\textstyle \frac{\pi}{n}\bigl\{^{\mathstrut} 10 \sin(\pi y_1 )
        +\sum^{n}_{i=1} (y_i-1)^2 [1+10 \sin^2(\pi y_{i+1} ) ]+(y_n-1)^2 \bigr\} \\
        &\qquad\textstyle +\sum^{n}_{i=1} u(x_i,10,100,4)
        \end{aligned} &30 &[-50,50]   &0\\
        \begingroup \setlength\extrarowheight{0pt} 
        \qquad
        y_i=1+\frac{1}{4}(x_i+1) \, u(x_i,a,k,m)= 
        \begin{cases}
            k(x_i-a)^m  & x_i>a \\
            0 & -a<x_i<a\\
            k(-x_i-a)^m & x_i<-a
        \end{cases} \endgroup  & 30 &    [-50,50]&   0\\
        \begin{aligned}[t]
        F_{13} (x)
        &= \textstyle 0.1 \bigl\{ \sin^2(3\pi x_1 )
        +\sum^{n}_{i=1} (x_i-1)^2 [1+\sin^2(3\pi x_i+1) ] \\
        &\qquad\textstyle +(x_n-1)^2 [1+\sin^2(2\pi x_n ) ] \bigr\} 
        +\sum^{n}_{i=1} u(x_i,5,100,4)
        \end{aligned} & 30 &   [-50,50]&   0\\
        F_{14}(x)=\bigl[(1/500)+\sum^{25}_{j=1}(j+\sum^{2}_{i=1} (x_i-a_{ij} )^{-6} \bigr]^{-1} & 2 &    [-65,65]    &1\\
        F_{15} (x)=\sum^{11}_{i=1} \bigl[a_i-(x_1 (b_i^2+b_i x_2 ))/(b_i^2+b_i x_3+x_4 )\bigr]^2 & 4 & [-5,5]  &0.00030\\
        F_{16} (x)=4x_1^2-2.1x_1^4+\frac{1}{3} x_1^6+x_1 x_2-4x_2^2+4x_2^4 & 2 &    [-5,5]  &-1.0316\\
        F_{17} (x)=(x_2-5.1/(4\pi^2)  x_1^2+(2/\pi) x_1-6)^2+10(1-1/(8\pi))\cos x_1+10&2&   [-5,5]  &0.398\\
        \begin{aligned}[t]
        F_{18} (x)
        &=[1+(x_1+x_2+1)^2 (19-14x_1+3x_1^2-14x_2+6x_1 x_2+3x_2^2 )] \\
        &\quad\times[30+(2x_1-3x_2 )^2 (18-32x_1+12x_1^2+48x_2-36x_1 x_2+27x_2^2)]
        \end{aligned} & 2 &   [-2,2]  &3\\
        F_{19} (x)=-\sum^{4}_{i=1} c_i\exp(-\sum^{3}_{j=1} a_{ij} (x_j-p_{ij})^2) & 3 &  [1,3]   &-3.86\\
        F_{20} (x)=-\sum^{4}_{i=1} c_i\exp(-\sum^{6}_{j=1} a_{ij} (x_j-p_{ij})^2) & 6 &  [0,1]   &-3.32\\
        F_{21} (x)=-\sum^{5}_{i=1} [(x-a_i ) (x-a_i )^T+c_i ]^{-1} & 4 & [0,10]  &-10.1532\\
        F_{22} (x)=-\sum^{7}_{i=1} [(x-a_i ) (x-a_i )^T+c_i ]^{-1} & 4 & [0,10]  &-10.4028\\
        F_{23} (x)=-\sum^{10}_{i=1} [(x-a_i ) (x-a_i )^T+c_i ]^{-1} & 4 &    [0,10]  &-10.5363\\
        \bottomrule
    \end{array}$
\end{table}
\end{document}

答案2

嗯,适合一页吗?是的,如果你将字体大小缩小到几乎无法阅读的大小并增加文本块。我宁愿使用普通字体,相应地定义文本块,并在两页上放置表格。

通过在第一列中使用longtable,并使用包定义文本块:displaystylegeometry

\documentclass{article}
\usepackage[showframe,
            hmargin=25mm]{geometry}
\usepackage{mathtools}
\usepackage{array, booktabs, longtable}


\begin{document}
    \setlength\tabcolsep{3pt}
    \begin{longtable}{@{} >{$\displaystyle}l<{$} lll @{}}
    \caption{Description of benchmark functions}
    \label{tab:1}   \\
        \toprule
    Function & Dim & Range & $f_{min}$              \\
        \midrule
\endfirsthead
    \caption[]{Description of benchmark functions}  \\
        \toprule
    Function & Dim & Range & $f_{min}$  \\
        \midrule
\endhead
    \midrule
    \multicolumn{4}{r}{\footnotesize\emph{Continue on the next page}}
\endfoot
\endlastfoot
F_1(x)=\sum^{n}_{i=1}x_i^2          & 30            & [-100,100]    & 0\\
F_2(x)= \sum^{n}_{i=1} |x_i|+\prod^{n}_{i=1}|x_i|
                                    & 30            & [-10,10]      & 0\\
F_3(x)=\sum^{n}_{i=1}(\sum^{n}_{j-1}x_i^2)^2
                                    & 30            & [-100,100]    & 0\\
F_4(x)=\max_{i}{\{|x_i|,1\leq i\leq n\}}
                                    & 30            & [-100,100]    & 0\\
F_5(x)=\sum^{n-1}_{i=1}[100(x_{i+1}-x_i^2)^2+(x_{i}-1)^2]
                                    & 30            & [-30,30]      & 0\\
F_6(x)=\sum^{n}_{i=1}(|x_i+0.5|)^2  & 30            & [-100,100]    & 0\\
F_7(x)=\sum^{n}_{i=1}ix_{i}^4+rand(0,1)
                                    & 30            & [-1.28,1.28]  & 0\\
F_8(x)=\sum^{n}_{i=1} - x_i\sin(\sqrt{|x_i|})
                                    & 30            & [-500,500]    & $-418.9829\times5$   \\
F_9(x)=\sum^{n}_{i=1}[x_i^2-\cos(2\pi x_i)+10]
                                    & 30            &[-5.12,5.12]   & 0 \\
        \begin{multlined}[b]
F_{10} (x)= 
            -20\exp\biggl(-0.2 \sqrt{1/n\sum\nolimits^{n}_{i=1}x_i^2}\biggr) - \\[-2ex]
            \exp\biggl(\frac{1}{n}\sum^{n}_{i=1}\cos(2\pi x_i)\biggr)
        \end{multlined}  + 20 + e
                                    & 30            & [-32,32]      & 0\\
F_{11} (x)=\frac{1}{4000} \sum^{n}_{i=1} x_i^2-\pi_{i=1}^n  cos(\dfrac{x_i}{\sqrt{i}})+1
                                    & 30            & [-600,600]    & 0\\[4ex]
F_{12} (x)=\frac{\pi}{n}
            \left\{\begin{array}{@{} r c @{}}
        10\sin(\pi y_1 )+ &  \\
            \multicolumn{2}{@{\quad}r @{}}{
            \sum\limits^{n}_{i=1} (y_i-1)^2 \Bigl[1 + 10\sin^2(\pi y_{i+1})\Bigr]
                                  } +\\ 
                          & (y_n-1)^2 
            \end{array}\right\}  +
        \sum^{n}_{i=1} u(x_i,10,100,4)
                                    & 30            & [-50,50]      & 0\\[6ex]
y_i=1+\frac{x_i+1}{4} (x_i,a,k,m)=
\begin{cases}
    k(x_i-a)^m  x_i>a \\
    0-a<x_i<a\\
    k(-x_i-a)^m \ x_i<-a
\end{cases}                         & 30            & [-50,50]      & 0\\
        \begin{aligned}[b]
F_{13} (x) = 0.1
        \left\{\begin{array}{@{} c @{}c @{}}
        \sin^2(3\pi x_1 ) + & \begin{array}[t]{c}
            \sum^{n}_{i=1} (x_i-1)^2 \Bigl[1 + \sin^2 (3\pi x_i + 1)\Bigr] + \\[1ex] 
            (x_n-1)^2 \Bigl[1 + \sin^2 (2\pi x_n) \Bigr]
                              \end{array}
        \end{array}\right\} +   \\ 
        \sum^{n}_{i=1} u(x_i,5,100,4)
        \end{aligned}
                                    & 30            & [-50,50]      & 0\\
F_{14}(x)=(\frac{1}{500}+\sum^{25}_{j=1}\frac{1}{j+\sum^{2}_{i=1} (x_i-a_{ij} )^6 })^{-1}
                                    & 2             & [-65,65]      & 1\\
F_{15} (x)=\sum^{11}_{i=1} [a_i-(x_1 (b_i^2+b_i x_2 ))/(b_i^2+b_i x_3+x_4 )]^2
                                    & 4             & [-5,5]        & 0.00030\\
F_{16} (x)=4x_1^2-2.1x_1^4+\frac{1}{3} x_1^6+x_1 x_2-4x_2^2+4x_2^4
                                    & 2             & [-5,5]        & -1.0316\\
F_{17} (x)=(x_2-\frac{5.1}{4\pi^2}  x_1^2+\frac{2}{\pi} x_1-6)^2+10(1-\frac{1}{8\pi}) \cos(x_1) + 10
                                    & 2             & [-5,5]        & 0.398 \\
F_{18} (x)= \begin{multlined}[t]
            [1+(x_1+x_2+1)^2 (19-14x_1+3x_1^2-14x_2+6x_1 x_2+3x_2^2 )] \times\\[-2ex]
            [30+(2x_1-3x_2 )^2×(18-32x_1+12x_1^2+48x_2-36x_1 x_2+27x_2^2)]
            \end{multlined}
                                    & 2             & [-2,2]        & 3 \\
F_{19} (x)=-\sum^{4}_{i=1}\ c_i\exp(-\sum^{3}_{j=1} a_{ij} (x_j-p_{ij} )^2)
                                    & 3             & [1,3]         & -3.86\\
F_{20} (x)=-\sum^{4}_{i=1}\ c_i\exp(-\sum^{6}_{j=1} a_{ij} (x_j-p_{ij} )^2)
                                    & 6             & [0,1]         & -3.32\\
F_{21} (x)=-\sum^{5}_{i=1} [(x-a_i ) (x-a_i )^T+c_i ]^{-1}
                                    & 4             & [0,10]        & -10.1532\\
F_{22} (x)=-\sum^{7}_{i=1} [(x-a_i ) (x-a_i )^T+c_i ]^{-1}
                                    & 4             & [0,10]        & -10.4028\\
F_{23} (x)=-\sum^{10}_{i=1} [(x-a_i ) (x-a_i )^T+c_i ]^{-1}
                                    & 4             & [0,10]        & -10.5363\\
    \bottomrule
    \end{longtable}
\end{document}

在此处输入图片描述 在此处输入图片描述

相关内容