5

I want to make the caption of table* left align, but I try many ways that can not deal with the problem. this: enter image description here I use Elsevier format.

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

I have tried \captionsetup{singlelinecheck = false, justification=justified} and

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

But they all not correct.

Pls help me, thanks!

6
  • 1
    Welcome to TeX.SE! With your code fragment is not possible to reproduce your problem, Please instead of fragments provide complete small document, which reproduce your problem.
    – Zarko
    Dec 29, 2020 at 3:35
  • 2
    IIRC, elsevier uses a custom caption, which means that they have gone to a lot of effort to keep people from formatting their own captions. Dec 29, 2020 at 3:55
  • 1
    It is better to provide the MWE from \documentclass to \end{document}
    – MadyYuvi
    Dec 29, 2020 at 5:04
  • Do please tell us which document class you employ. The caption package is incompatible with some document classes.
    – Mico
    Dec 29, 2020 at 5:07
  • \documentclass[a4paper,fleqn]{cas-dc}
    – Tianlin
    Dec 29, 2020 at 6:36

2 Answers 2

3

Probably you are more satified with the following table:

enter image description here

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

Building on @MadyYuvi's comment, I would suggest that you not load the caption package and, instead, issue the directive

\setlength\FullWidth{\textwidth}

before \begin{table*}. (If you want to make scope of this directive global for the entire document, place it in the preamble.) And, to make the table occupy the full width width (and no more than that!), use a tabular* environment instead of a tabular environment.

I would also recommend that you (a) give the table a more open "look" by omitting all vertical bars and using the macros of the booktabs package to create well-spaced horizontal lines and (b) provide more visual structure to the header material by placing the information about unit of measurement to a separate row.

enter image description here

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .