表格中的标题位置错误

表格中的标题位置错误

我正在尝试将文档从双列转换为单列 Springer Journal 格式。但是,下表的标题在新格式下未正确对齐。MWC

\documentclass[pdflatex, sn-aps]{sn-jnl}% American Physical Society (APS) Reference Style
%%%% Standard Packages
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{comment}
\usepackage[center]{caption}
\usepackage{subcaption}
\usepackage{float}
\usepackage[misc]{ifsym}
\usepackage{csquotes}
\usepackage[section]{placeins}
\usepackage{siunitx}
%%<additional latex packages if required can be included here>
\usepackage{amsmath}
\usepackage{graphicx}
\graphicspath{{./images/}}
%Table packages
\usepackage[figuresright]{rotating}
\setlength{\rotFPtop}{0pt plus 1fil}
\usepackage{booktabs, makecell, multirow, tabularx}
\renewcommand{\theadfont}{\footnotesize\bfseries}
\renewcommand\theadgape{}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}


\raggedbottom
%%\unnumbered% uncomment this for unnumbered level heads

\begin{document}
%%%%%%%%%%%%%%%%% Accuracy comparison %%%%%%%%%%%%%%%%%%%%%%
\begin{table}[ht]
\centering
% table caption is above the table
\caption{Accuracy comparison with similar approaches}
\label{tab:accuracy comparison}       % Give a unique label
% For LaTeX tables use
\renewcommand\tabularxcolumn[1]{m{#1}}
\renewcommand\arraystretch{1.2}
\begin{tabularx}{\linewidth}{@{} >{\bfseries}X X X S[table-format=2.1] @{}}
    \toprule
\thead{Reference}
&\thead{ Learning\\approach}
& \thead{Initial\\movement}
& {\thead{Accuracy\\claimed(\%)}}   \\
    \midrule
{\cite{Kerdjidj2019}}       & KNN(K=1) & Walking/ running & 93\\
{\cite{chaitep2017}}       & Threshold & Walking & 72\\
{\cite{Lee2019}}       & Threshold & Walking & 87.5\\
Our
system      & Threshold & Walking & 94.45\\
    \bottomrule
\end{tabularx}
    \end{table}
 \end{document} 

输出

答案1

使用tabular*而不是tabularx

\documentclass[pdflatex, sn-aps]{sn-jnl}% American Physical Society (APS) Reference Style
%%%% Standard Packages
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{comment}
%\usepackage[center]{caption}
%\usepackage{subcaption}
\usepackage{float}
\usepackage[misc]{ifsym}
\usepackage{csquotes}
\usepackage[section]{placeins}
\usepackage{siunitx}
%%<additional latex packages if required can be included here>
\usepackage{amsmath}
\usepackage{graphicx}
\graphicspath{{./images/}}
%Table packages
\usepackage[figuresright]{rotating}
\setlength{\rotFPtop}{0pt plus 1fil}
\usepackage{booktabs, makecell, multirow, tabularx}
\renewcommand{\theadfont}{\footnotesize\bfseries}
\renewcommand\theadgape{}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}


\raggedbottom
%%\unnumbered% uncomment this for unnumbered level heads

\begin{document}
%%%%%%%%%%%%%%%%% Accuracy comparison %%%%%%%%%%%%%%%%%%%%%%
\begin{table}[htp]
\renewcommand\arraystretch{1.2}

\caption{Accuracy comparison with similar approaches}
\label{tab:accuracy comparison}

\begin{tabular*}{\textwidth}{
  @{\extracolsep{\fill}}
  >{\bfseries}l
  l
  l
  S[table-format=2.2]
  @{}
}
\toprule
\thead{Reference}
& \thead{Learning\\approach}
& \thead{Initial\\movement}
& {\thead{Accuracy\\claimed(\%)}}   \\
\midrule
\cite{Kerdjidj2019} & KNN(K=1) & Walking/ running & 93    \\
\cite{chaitep2017}  & Threshold & Walking         & 72    \\
\cite{Lee2019}      & Threshold & Walking         & 87.5  \\
Our system          & Threshold & Walking         & 94.45 \\
\bottomrule
\end{tabular*}

\end{table}

\end{document} 

在此处输入图片描述

我评论captionsubcaption因为它们与文档类不兼容,而且它们想要居中标题。使用此类类时,请按照期刊的要求进行操作,不要尝试更改布局。

相关内容