我的程式碼:
\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
透過此更改,您將獲得:
但是,你應該考慮CFR在您的問題下方評論。