Alterar a legenda das tabelas

Alterar a legenda das tabelas

Quero mudar a legenda das tabelas para ficar exatamente assim: Elsarticle

Meu código:

\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}

saída: insira a descrição da imagem aqui

Responder1

  • em elsarticlevocê usa reviewa opção. aumenta o espaçamento entre linhas. conseqüentemente o documento possui mais espaços verticais em cada linha, mesmo nas legendas. se você remover esta opção, ou seja: use \documentclass{elsarticle}em vez de \documentclass[review]{elsarticle}que o espaçamento entre linhas se torne igual a \baselineskip.
  • a tabela longa é mais larga que a largura do texto,
  • legenda da tabela longa com a qual você pode mover para a esquerda\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

com essas alterações você obterá:

insira a descrição da imagem aqui

no entanto, você deve considerarcfrcomente abaixo sua pergunta.

informação relacionada