将主表/图浮动在正文之后,然后添加附录和附录表

将主表/图浮动在正文之后,然后添加附录和附录表

我正在与\usepackage{endfloat}\documentclass[12pt]{elsarticle}和阑尾斗争。

我想要的是:

我想要正文,然后是插入/引用的表格和图片(浮动到仅限主文档末尾),然后我希望附录及其表格准确位于指定的位置。我希望主文本表格编号为 1、2、...、T。我希望附录表格编号为 A1、A2、...、A。

我还希望主文档通过末尾浮动表格编号为 1、2、...、P。然后我希望附录以罗马数字重新开始。

以下是我尝试过的:

\documentclass[12pt]{elsarticle}
\usepackage[notablist]{endfloat}
\usepackage{threeparttable}
\usepackage[toc,page]{appendix}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{}
\chead{}
\fancyfoot[C]{}
\rhead{My short title \thepage}
\renewcommand{\headrulewidth}{0pt}

% get rid of footer included in elsarticle
\makeatletter
\def\ps@pprintTitle{%
 \let\@oddhead\@empty
 \let\@evenhead\@empty
 \def\@oddfoot{}%
 \let\@evenfoot\@oddfoot}
\makeatother

% appendix page numbering
\let\origappendix\appendix % save the existing appendix command
\renewcommand\appendix{\clearpage\pagenumbering{roman}\origappendix}


\begin{document}\thispagestyle{empty}

\begin{frontmatter}
\title{My long title}

\author[add1]{Me\corref{cor1}}
\ead{[email protected]}
\author[add1]{You}
\ead{[email protected]}

\cortext[cor1]{Please address correspondence to me}
\address[add1]{Address}

\begin{abstract}
Abstract
  \end{abstract}
  \begin{keyword}
    Keywords
  \end{keyword}

\end{frontmatter}

My text page 1

\newpage
My text page 2 and Table \ref{tab}.

\newpage
My page 3

\newpage

\begin{table}
\centerline{\begin{threeparttable}
  \caption{My table}
  \label{tab}
  \centering
  \begin{tabular}{lrr}
  \toprule
 Col1 & Col2 & Col3 \\
  \midrule
  1 & 2 & 3 \\
  4 & 5 & 6 \\
  \bottomrule
  \end{tabular}
  \begin{tablenotes}
  \small
  \item My note
  \end{tablenotes}
  \end{threeparttable}}
\end{table}

\thispagestyle{plain}

\makeatletter
\efloat@restorefloats
\makeatother
\setcounter{figure}{0} % Start again
\renewcommand\thefigure{\arabic{figure}}
\setcounter{table}{0} % Start again
\renewcommand\thefigure{\arabic{table}}

\appendix

My appendix and Table \ref{apptab}. I want the appendix to appear after Table \ref{tab} which should be floated to the end of the main document. 

In other words, I want the main text, followed by tables and figures inserted in the main text (floated to the end), and then I want the appendix with its tables exactly where specified. 

\begin{table}[H]
\centerline{\begin{threeparttable}
  \caption{Table should be in appendix}
  \label{apptab}
  \centering
  \begin{tabular}{lrr}
  \toprule
 Col1 & Col2 & Col3 \\
  \midrule
  7 & 8 & 9 \\
  10 & 11 & 12 \\
  \bottomrule
  \end{tabular}
  \begin{tablenotes}
  \small
  \item My note
  \end{tablenotes}
  \end{threeparttable}}
\end{table}

\end{document}

答案1

来自@wasteofspace:

我认为该包可以完成这项工作。使用beforeendfloat从文档主体中获取浮点数;以正常方式处理附录中出现的浮点数以结束文档。\processdelayedfloats\appendix

这对我有用。

相关内容