表格*和图形*标题存在问题

表格*和图形*标题存在问题

我是 LaTeX 新手,一直在使用 overleaf 写论文。第一个版本可以运行,但我被要求将模板更改为期刊的具体内容。我几乎可以调整所有内容,除了 2 行表格 (table*) 和图形 (figure*) 的标题。无论我做什么,我都无法将它们与表格和图形边框对齐。它们显示如下:在此处输入图片描述

此模板使用 .sty 文件来定义环境。我相信这就是问题所在,.sty 文件中表环境的代码如下:

% Floats 
\def\topfraction{.9}

\def\bottomfraction{.9}
\setcounter{topnumber}{4}
\setcounter{bottomnumber}{3}
\setcounter{totalnumber}{5}
\renewcommand\textfraction{.1}
\renewcommand\floatpagefraction{.9}
\setcounter{dbltopnumber}{2}
\renewcommand\dbltopfraction{.9}
\renewcommand\dblfloatpagefraction{.95}
\newdimen \FullWidth
\FullWidth=\textwidth

\newcolumntype{L}{@{\extracolsep{\fill}}l}
\newcolumntype{R}{@{\extracolsep{\fill}}r}
\newcolumntype{C}{@{\extracolsep{\fill}}c}

\cs_gset_eq:NN \thead  \toprule 
\cs_gset_eq:NN \endthead  \midrule 
\cs_gset_eq:NN \tabref  \ref 

\dim_new:N \l_tbl_width_dim
\dim_set:Nn \l_tbl_width_dim { \linewidth }

\cs_new:Npn \__make_tbl_caption:nn #1#2
{
  \l_tbl_align_tl
  \skip_vertical:N \l_tbl_abovecap_skip 
  % \bool_if:NTF \g_tbl_full_bool
  % { 
  %  \color{scolor!70}\rule{\FullWidth}{2pt}\normalcolor\\
  % } 
  % { \color{scolor!70}\rule{\tblwidth}{2pt}\normalcolor\\ }
  % \fboxsep=4pt
  % \colorbox{white}
  {\parbox{ \dimexpr(\l_tbl_width_dim)}
    {\rightskip=0pt\sffamily\small\textbf{\color{scolor}#1}\par#2\par\vskip4pt }}
  \skip_vertical:N \l_tbl_belowcap_skip
}

\keys_define:nn { cas / tbl }
{
  width     .dim_set:N   =  \l_tbl_width_dim ,
  pos       .tl_set:N    =  \l_tbl_pos_tl ,
  cols      .tl_set:N    =  \l_tbl_cols_tl ,
  align     .tl_set:N    =  \l_tbl_align_tl,
  abovecap  .skip_set:N  =  \l_tbl_abovecap_skip ,
  belowcap  .skip_set:N  =  \l_tbl_belowcap_skip ,
  abovetbl  .skip_set:N  =  \l_tbl_abovetbl_skip ,
  belowtbl  .skip_set:N  =  \l_tbl_belowtbl_skip ,
  full      .bool_gset:N =  \g_tbl_full_bool ,
  unknown   .code:n      = { 
                              \ifstrempty { #1 } 
                                 {
                                   \tl_set:Nn \l_fig_pos_tl { \l_keys_key_tl }
                                 } 
                                 {
                                   \l_keys_key_tl=#1
                                 }  
                           }  
}

\cs_set:Npn \__reset_tbl:
{
  \tl_set:Nx \l_tbl_pos_tl { t }
  \tl_set:Nx \l_tbl_cols_tl { 1 }
  \tl_set:Nn \l_tbl_align_tl { \centering }
  \skip_set:Nn \l_tbl_abovecap_skip { 6pt }
  \skip_set:Nn \l_tbl_belowcap_skip { 0pt }
  \skip_set:Nn \l_tbl_abovetbl_skip { 6pt }
  \skip_set:Nn \l_tbl_belowtbl_skip { 6pt }
  
}

\RenewDocumentEnvironment { table } { O{} }
{
  \__reset_tbl:
  \bool_gset_false:N \g_tbl_full_bool
  \dim_set:Nn \l_tbl_width_dim { \linewidth }
  \keys_set:nn { cas / tbl } { #1 }
  \csxdef{fps@table}{\l_tbl_pos_tl}
  \csgdef{tblwidth}{\dim_use:N \l_tbl_width_dim}
  \cs_set_eq:NN \@makecaption \__make_tbl_caption:nn 
  \@float{table}
  \l_tbl_align_tl
  \sffamily\small
}
{
\end@float                                                       
}

    
\RenewDocumentEnvironment { table* } { O{width=\FullWidth} }
  {
    \__reset_tbl:
    \bool_gset_true:N \g_tbl_full_bool
      \dim_set:Nn \l_tbl_width_dim { \FullWidth }
   \keys_set:nn { cas / tbl } { #1 }
    \csxdef{fps@table}{\l_tbl_pos_tl}
    \csgdef{tblwidth}{\dim_use:N \l_tbl_width_dim}
    \cs_set_eq:NN \@makecaption \__make_tbl_caption:nn 
    \@dblfloat{table}
     \l_tbl_align_tl
     \sffamily\small
 %    \leftskip=-\FullWidth
  }
  {
    \end@dblfloat                                                       
  }
  

以下是我在主文件中定义 Table* 的方式:

   \begin{table*}[htpb]
\small
\caption{Filtration results for XG (1.05 and 2.10 ppb) and CMC (0.525, 1.05 and 2.10 ppb) formulations with 70.10 ppb CaCO$_3$ F.}
\label{tbl:Filt res polymer}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}llllll}
\hline
\textbf{Formulation}    & \multicolumn{2}{c}{\textbf{XG}}                                       & \multicolumn{3}{c}{\textbf{CMC}}                                                                           \\ 
\textbf{{[}ppb{]}}      & \multicolumn{1}{c}{\textbf{1.05}} & \multicolumn{1}{c}{\textbf{2.10}} & \multicolumn{1}{c}{\textbf{0.525}} & \multicolumn{1}{c}{\textbf{1.05}} & \multicolumn{1}{c}{\textbf{2.10}} \\ \hline
\textbf{V$_f$   {[}cm$^3${]}} & 93.77 \textpm\ 1.15                      & 51.43 \textpm\ 2.31                      & 100.77 \textpm\ 7.57                      & 54.10 \textpm\ 2.00                      & 23.10 \textpm\ 1.00                      \\
\textbf{m$_{wc}$   {[}g{]}}  & 57.78 \textpm\ 1.53                      & 35.45 \textpm\ 1.00                      & 94.05 \textpm\ 4.41                       & 58.45 \textpm\ 4.36                      & 19.78 \textpm\ 1.53                      \\
\textbf{m$_{dc}$   {[}g{]}}  & 26.00 \textpm\ 0.44                      & 15.27 \textpm\ 0.60                      & 49.20 \textpm\ 5.41                       & 26.40 \textpm\ 1.39                      & 08.13 \textpm\ 0.76                       \\
\textbf{M$_R$ {[}\%{]}}    & 45.03 \textpm\ 1.86                      & 43.10 \textpm\ 2.43                      & 52.26 \textpm\ 4.52                       & 45.21 \textpm\ 0.97                      & 41.08 \textpm\ 0.93                      \\
\textbf{th {[}mm{]}}    & 09.32 \textpm\ 0.23                       & 07.02 \textpm\ 0.15                       & 15.93 \textpm\ 0.29                       & 08.65 \textpm\ 0.18                       & 04.37 \textpm\ 0.52                       \\
\textbf{T$_{mc}$ {[}mm{]}} \citep{chenevert2001model} & 09.12 \textpm\ 0.38                       & 05.69 \textpm\ 0.26                       & 13.92 \textpm\ 0.71                       & 09.21 \textpm\ 0.77                       & 03.23 \textpm\ 0.23                       \\ \hline
\end{tabular*}
\end{table*}

关于如何解决这个问题,有什么建议吗?

答案1

在我们等待重现您的问题的 MWE(最小工作示例,一个小的完整文档)时,请参阅以下有关如何更好地设计表格的建议:

  • 在序言中你需要加载以下包:
\documentclass[twocolumn]{cas-dc}
\usepackage{natbib}
% unknown part of your premble

\usepackage{amsmath}
\usepackage{array, booktabs, threeparttable}
\NewExpandableDocumentCommand\mcc{O{1}m}{\multicolumn{#1}{c}{#2}}
\usepackage[version=4]{mhchem}
\usepackage{siunitx}

%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}
  • 文档主体与您的表格:
\begin{document}
   \begin{table*}[width=\textwidth] 
    \sisetup{table-format=4.2(3),
             separate-uncertainty}   
    \small
    \setlength\tabcolsep{0pt}
\begin{threeparttable}
    \caption{Filtration results for XG (1.05 and 2.10 ppb) and CMC (0.525, 1.05 and 2.10 ppb) formulations with 70.10 ppb \ce{CaCO3} F.}
    \label{tbl:Filt res polymer}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} >{$}l<{$} *{5}{S} }
    \toprule
\textbf{Formulation}  
    & \mcc[2]{\textbf{XG}}                                       
            & \mcc[3]{\textbf{CMC}}          \\
    \cmidrule{2-3}
    \cmidrule(l){4-6}
\textbf{[ppb]}      
    & \mcc{\textbf{1.05}} 
        & \mcc{\textbf{2.10}} 
            & \mcc{\textbf{0.525}} 
                & \mcc{\textbf{1.05}} 
                    & \mcc{\textbf{2.10}} \\ 
    \midrule
V_f\ [\si{\cubic\centi\metre}]
    & 93.77(115)    & 51.43(231)    & 100.77(757)   & 54.10(200)    & 23.10(100)    \\
m_{wc}\ [\si{\gram}]
    & 57.78(153)    & 35.45(100)    & 94.05(441)    & 58.45(436)    & 19.78(153)    \\
m_{dc}\ [\si{\gram}]
    & 26.00(44)     & 15.27(60)     & 49.20(541)    & 26.40(139)    & 08.13(76)     \\
M_R\ [\si{\%}]      
    & 45.03(186)    & 43.10(243)    & 52.26(452)    & 45.21(97)     & 41.08(93)     \\
\text{th}\ [\si{\milli\metre}]
    & 09.32(23)     & 07.02(15)     & 15.93(29)     & 08.65(18)     & 04.37(52)     \\
T_{mc}\ [\si{\milli\metre}]\tnote{*}  
    & 09.12(38)     & 05.69(26)     & 13.92(71)     & 09.21(77)     & 03.23(23)     \\ \bottomrule
\end{tabular*}
\begin{tablenotes}[flushleft]\small
\item[*]    cite Chenevert and Dewan 2001 reference
\end{tablenotes}
\end{threeparttable}
\end{table*}
\lipsum

% unknown part of article bibliography
\end{document}

如果合并两个代码片段,编译结果将是:

在此处输入图片描述

(红线表示页面布局)

提供 MWE 后即可完成答复。

相关内容