内容后的章节标题

Section title after content

我对附录标题有疑问。我有一个 main.tex 文件和几个 .tex 文件(每个部分一个),然后通过 \input{namefile.tex} 命令包含在 main.tex 文件中。

但是,附录部分有一个问题:附录的标题位于其中的前三个 table 之下(所有 table 内容都被隐藏):

main.tex文件的代码如下:

\documentclass[a4paper,fleqn]{cas-sc}
\UseRawInputEncoding

\usepackage[authoryear,longnamesfirst]{natbib}  

% Needed for subfigures
\usepackage{subcaption}

% Needed for better tables
\usepackage{tabularx}
\newcolumntype{g}{X}                                % big column
\newcolumntype{s}{>{\hsize=.5\hsize}X}              % small column
\newcolumntype{Y}{>{\centering\arraybackslash}X}    % centered column in tabularx environment

\usepackage{enumitem}

%%%Author macros
\def\tsc#1{\csdef{#1}{\textsc{\lowercase{#1}}\xspace}}
\tsc{WGM}
\tsc{QE}
%%%

\begin{document}
\let\WriteBookmarks\relax
\def\floatpagepagefraction{1}
\def\textpagefraction{.001}

% Short title
\shorttitle{shorttitle}    

% Short author
\shortauthors{anonymous}  

% Main title of the paper
\title[mode=title]{maintitle}  

% Address/affiliation 
\affiliation[aff]{organization={org},
            %addressline={}, 
            city={city},
%          citysep={}, % Uncomment if no comma needed between city and postcode
            postcode={pk}, 
            %state={st},
            country={c}
            }

% First author
%
% Options: Use if required
%\author[<aff no>]{<author name>}[<options>]

\author[aff]{anonymous}[type=editor]
% Corresponding author indication
\cormark[1]
% Footnote of the first author
%\fnmark[1]
% Email id of the author
\ead{mail}

% Corresponding author text
\cortext[1]{Corresponding author}

\begin{abstract}
Abstract
\end{abstract}

% Keywords
% Each keyword is separated by \sep
\begin{keywords}
kw1 \sep kw2
\end{keywords}

\maketitle

%*************************************************************
% Mainmatter
%*************************************************************

%\input{sections/01}
%\input{sections/02}
%\input{sections/03}
%\input{sections/04}

%% Loading bibliography style file
\bibliographystyle{cas-model2-names}

% Loading bibliography database
\bibliography{bibliography.bib}

\clearpage

%% The Appendices part is started with the command \appendix;
%% appendix sections are then done as normal sections
\appendix
\include{sections/appendix}

\end{document}

appendix.tex代码如下(开头):

\section{Tables and Numerical Results} 
\label{app:tables-results}

% Number the appendix tables as A.1, A.2, ...
\setcounter{table}{0}
\renewcommand{\thetable}{A.\arabic{table}}

\begin{table}[ht]
    \centering
    \renewcommand{\arraystretch}{1.5}
    \begin{tabularx}{\columnwidth}{XYY}
        \hline 
        &&\
        \hline
        &&\
        &&\
        &&\
        &&\
        &&\
        &&\
        &&\
        &&\
        &&\
        \hline
    \end{tabularx}
    \caption{caption}
    \label{tab}
\end{table}

所有其他 table 几乎相同。

我已经尝试通过使用 [h][h!] 来更改 table 的 [ht] 选项,但没有任何结果。

您使用的 class 定义表格和图形的方式使得它们的默认位置仅位于页面顶部。您可以像这样破解代码:

\documentclass[a4paper,fleqn,draft]{cas-sc}

\usepackage[authoryear,longnamesfirst]{natbib}  


\ExplSyntaxOn

\cs_set:Npn \__reset_tbl:
{
  \tl_set:Nx \l_tbl_pos_tl { h }
  \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 }
  
}

\ExplSyntaxOff


\begin{document}


\section{Tables and Numerical Results} 
\label{app:tables-results}
\begin{table}[htbp]
    \caption{caption}
    \label{tab}
\end{table}
text


\end{document}