[Tex/LaTex] How to set the options for the endfloat package, when you have to put several packages together in one usepackage{…}

appendicesfloatslongtableoptionstables

I tried something like this: Move tables to appendix
to move tables and figures to the appendix.

However, longtables remain before the appendix. I solved this, following the manual ftp://ftp.rrzn.uni-hannover.de/pub/mirror/tex-archive/macros/latex/contrib/endfloat/endfloat.pdf

But now, I always get an error, if I try to use options for end float, in my case [nomarkers,nolists].

Any idea on how to solve this?

Currently, I get errors with all order of packages.

\usepackage[nomarkers,nolists]{longtable,threeparttable,booktabs,endfloat}
\DeclareDelayedFloatFlavour*{longtable}{table}
    \DeclareDelayedFloatFlavour{threeparttable}{table}
        \DeclareDelayedFloatFlavour{booktabs}{table}

or

\usepackage[nomarkers,nolists]{endfloat,longtable,threeparttable,booktabs}
\usepackage[nomarkers,nolists]{longtable,endfloat,threeparttable,booktabs}

and so on.

I really would like to know what to do about this.

I did not provide an MWE, as the problem is basically the error message, that LaTeX thinks [nomarkers,nolists] is an option to anything else than end float!

Best Answer

What happens is that the tables are written to a file, and then at the end this file is \input and processed normally. Now your tables are floating, but longtable is not floating. Because you have [tb] as position specifier on your tables, these float to the top or the bottom of the page, so they can move across the longtable. If you want to preserve the order you can \usepackage{float} and give your tables the [H] specifier. Then the order will be preserved.

And as others have observed, put the other packages out of the [nomarkers,nolists] options. And the line \DeclareDelayedFloatFlavour{booktabs}{table} does not make sense, as booktabs is not an environment.

Here is a complete example.

\documentclass{report}
\usepackage[nomarkers,nolists]{endfloat}
\renewcommand{\efloatseparator}{\mbox{}} % allows tables to share a page
\usepackage{longtable,threeparttable,booktabs,endfloat}
\DeclareDelayedFloatFlavour*{longtable}{table}
\DeclareDelayedFloatFlavour{threeparttable}{table}
\usepackage{float}

\begin{document}
\chapter{A chapter}

As shown in Tables~\ref{tab:one} and \ref{tab:another}, we have two variables.
\begin{table}[H]
\centering
\begin{tabular}{cc}
A & B \\
1 & 2 \\
3 & 4
\end{tabular}
\caption{\label{tab:one} A Table}
\end{table}

\begin{longtable}{cc}
long & table \\
5 & 6 \\
7 & 8 \\
\caption{\label{tab:another} A Long Table}
\end{longtable}

\begin{table}[H]
\centering
\begin{tabular}{cc}
C & D \\
5 & 6 \\
7 & 8
\end{tabular}
\caption{\label{tab:another} A Second Table}
\end{table}

\appendix
\chapter{An appendix}

\processdelayedfloats

\end{document}
Related Question