更改表格的标题

更改表格的标题

我想将表格的标题更改为如下所示: 文章

我的代码:

\documentclass[review]{elsarticle}
\usepackage{longtable}
\usepackage{array,multirow}
\usepackage{booktabs,amsmath,caption,array}
\newcolumntype{C}[1]{>{\raggedleft\arraybackslash}m{#1}}
\newlength\mylen
\newcommand\myrange{$[-100, 100]$}
\settowidth\mylen{\myrange}
%\usepackage{newtxtext,newtxmath}
\captionsetup[table]{format=plain,
    labelfont=bf,
    labelsep=newline,
    singlelinecheck=false,
    skip=0pt}

\begin{document}

\begin{table}
    \caption{Table caption here.}
    \label{my-label}
    $\begin{array}{@{}ll lcC{\mylen} @{}}
    \toprule
    \text{Function} & f_{\min} & \text{Search} \text{range} \\ 
    \midrule       
    \begin{aligned} 
    &f_{1}(x) = \sum_{i=1}^{n} x_i^{2}  
    \end{aligned}  
    & 0 & [-100, 100]\\
    \bottomrule
\end{array}$
\end{table} 


\begin{table}[]
\centering
\caption{The specific parameters of the algorithms used in the comparison}
\label{my-label}
\begin{tabular}{ll}
    \toprule
    \multicolumn{1}{c}{ZZZZ} & \multicolumn{1}{c}{Parameter} \\     \toprule
    AAA                           & $L = P \times D$\\
    BBB                            & $X_0 = 1$\\
    CCC                           & 0                            \\
    DDD                           & 0    \\
    \bottomrule
\end{tabular}
\end{table}

\begin{longtable}{ccccccc}
    \caption{My caption for this table}
    \label{foo}\\
    \hline
    AA &   & BBB & CCC & DDD & SSA & EEE\\
    \hline
    \endhead % all the lines above this will be repeated on every page
    \multirow{4}{*}{F1} 
    & X 
    & 00000000000   
    & 00000000000   
    & 00000000000   
    & 00000000000   
    & 00000000000 \\
    & Y 
    & 00000000000   
    & 00000000000   
    & 00000000000   
    & 00000000000   
    & 00000000000 \\
    & Z 
    & 00000000000   
    & 00000000000   
    & 00000000000   
    & 00000000000   
    & 00000000000 \\
    & W 
    & 00000000000   
    & 00000000000   
    & 00000000000   
    & 00000000000   
    & 00000000000 \\
    \hline
\end{longtable}

\end{document}

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

答案1

  • elsarticle您使用review选项时,它会增加行距,因此文档的每一行都会有更多垂直空间,甚至在标题中也是如此。如果您删除此选项,即:使用\documentclass{elsarticle}而不是\documentclass[review]{elsarticle},则行距将等于\baselineskip
  • 长表比文本宽度宽,
  • 长表的标题可以向左移动\setlength\LTcapwidth{\linewidth}

\begingroup
\setlength\LTcapwidth{\linewidth}
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\setlength\tabcolsep{0pt}
\begin{longtable}{@{\extracolsep{\fill}}ccccccc}
    \caption{My caption for this table}
    \label{foo}\\
    \hline
    AA &   & BBB & CCC & DDD & SSA & EEE\\
...
\end{longtable}
\endgroup

通过这些改变你将获得:

在此处输入图片描述

然而你应该考虑成本加运费在您的问题下方发表评论。

相关内容