如何使表格标题左对齐

如何使表格标题左对齐

我想让标题table*左对齐,但是我尝试了很多方法都无法解决问题。这个:在此处输入图片描述 我使用 Elsevier 格式。

\documentclass[a4paper,fleqn]{cas-dc}

\usepackage[numbers]{natbib}
\usepackage{subfigure}
\usepackage{amsmath}

\def\tsc#1{\csdef{#1}{\textsc{\lowercase{#1}}\xspace}}
\tsc{WGM}
\tsc{QE}
\tsc{EP}
\tsc{PMS}
\tsc{BEC}
\tsc{DE}

\usepackage{natbib}
\setcitestyle{authoryear,round}

\begin{document}
\begin{table*}[]
\caption{The performance evaluation of different models on test set.}\label{tbl3}
\begin{tabular}{lcccccccccccc}
\hline
\multicolumn{1}{c|}{\multirow{2}{*}{Method}} & \multicolumn{3}{c}{GSN}                       & \multicolumn{3}{c}{LS}                        & \multicolumn{3}{c}{OTHERS}                    & \multicolumn{3}{c}{Avg.}                      \\ \cline{2-13}
\multicolumn{1}{c|}{}                        & P(\%)         & R(\%)         & F1(\%)        & P(\%)         & R(\%)         & F1(\%)        & P(\%)         & R(\%)         & F1(\%)        & P(\%)         & R(\%)         & F1(\%)        \\ \hline
J48                                          & 67.5          & 64.4          & 65.9          & 64.5          & 73.1          & 68.5          & 86.1          & 84.7          & 85.4          & 79.3          & 79.1          & 79.2          \\
\end{tabular}
\end{table*}

\end{document}

我已经尝试过\captionsetup{singlelinecheck = false, justification=justified}

\usepackage{booktabs}
\usepackage{array, caption, threeparttable}
\usepackage[font=small,labelfont=bf,labelsep=none]{caption}
\captionsetup[table]{
  labelsep=newline,
  singlelinecheck=false,
}

但它们都不正确。

请帮助我,谢谢!

答案1

或许您对下表更满意:

在此处输入图片描述

\documentclass[a4paper,fleqn]{cas-dc}

\usepackage{booktabs}

\usepackage{natbib}
\setcitestyle{authoryear,round}

\begin{document}
\begin{table*}[width=.95\textwidth,cols=13]
\caption{The performance evaluation of different models on test set.}\label{tbl3}
\begin{tabular*}{\tblwidth}{lCCCCCCCCCCCC}
\toprule
Method & \multicolumn{3}{c}{GSN}                       & \multicolumn{3}{c}{LS}                        & \multicolumn{3}{c}{OTHERS}                    & \multicolumn{3}{c}{Avg.}                      \\ 
\cmidrule{2-4} \cmidrule{5-7} \cmidrule{8-10} \cmidrule{11-13}
                       & P(\%)         & R(\%)         & F1(\%)        & P(\%)         & R(\%)         & F1(\%)        & P(\%)         & R(\%)         & F1(\%)        & P(\%)         & R(\%)         & F1(\%)        \\ 
\midrule
J48                                          & 67.5          & 64.4          & 65.9          & 64.5          & 73.1          & 68.5          & 86.1          & 84.7          & 85.4          & 79.3          & 79.1          & 79.2          \\
\bottomrule
\end{tabular*}
\end{table*}

\end{document}

答案2

根据@MadyYuvi 的评论,我建议你不是加载caption包并发出指令

\setlength\FullWidth{\textwidth}

之前\begin{table*}。 (如果要使此指令的范围对整个文档具有全局性,请将其放在序言中。)并且,要使表格占据整个宽度(并且不超过这个宽度!),请使用环境tabular*而不是环境tabular

我还建议您 (a) 省略所有竖线,并使用以下宏,使表格看起来更加开放:书签包来创建间距良好的水平线,并且 (b) 通过将有关测量单位的信息放在单独的行中,为标题材料提供更多的视觉结构。

在此处输入图片描述

\documentclass[a4paper,fleqn]{cas-dc} 
\usepackage{booktabs}
\shorttitle{Thoughts}

\begin{document}
\begingroup
\setlength\FullWidth{\textwidth}
\begin{table*}
\setlength{\tabcolsep}{0pt}
\caption{Performance evaluation of various models on test set.}\label{tbl3}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l *{12}{c} }
\toprule
Method
& \multicolumn{3}{c}{GSN} & \multicolumn{3}{c}{LS} & \multicolumn{3}{c}{Others} & \multicolumn{3}{c}{Avg.} \\ 
\cmidrule{2-4} \cmidrule{5-7} \cmidrule{8-10} \cmidrule{11-13}
& P & R & F1 & P & R & F1 & P & R & F1 & P & R & F1 \\ 
& (\%) & (\%) & (\%) & (\%) & (\%) & (\%) & (\%) & (\%) & (\%) & (\%) & (\%) & (\%) \\
\midrule
J48 & 67.5  & 64.4  & 65.9  & 64.5  & 73.1  & 68.5  & 86.1  & 84.7  & 85.4  & 79.3  & 79.1  & 79.2 \\
Naive Bayes & \\
\dots & \\
\bottomrule
\end{tabular*}
\end{table*}
\endgroup
\end{document}

相关内容