# Problem with Endfloat

What am I doing wrong with the following MWE? The numbering is incorrect and a table which should be listed at the end of chapter 2 is being listed at the end of chapter 1 for some reason.

I need arabic numbering for all the tables (even in the Endfloat markers). I want to print a list of the figures and tables at the end of each chapter.

\documentclass[oneside,12pt]{book}

\usepackage[tablesfirst]{endfloat}
\usepackage{titletoc}

\begin{document}
\renewcommand\theposttable{\arabic{chapter}.\arabic{posttbl}}
\renewcommand\thepostfigure{\arabic{chapter}.\arabic{postfig}}
\chapter{Data}
\startlist{lot}
\begin{table}
\caption{Data chapter table}
\begin{tabular}{c}
123 \\
\end{tabular}
\end{table}
\processdelayedfloats

\chapter{Learning}
\startlist{lot}
\begin{table}
\caption{Learning chapter table}
\begin{tabular}{c}
123 \\
\end{tabular}
\end{table}

\processdelayedfloats

\end{document}


Pass the notablist option so no general LoT is printed and use \printlist to typeset the partial LoTs:

\documentclass[oneside,12pt]{book}
\usepackage[tablesfirst,notablist]{endfloat}
\usepackage{titletoc}

\renewcommand\theposttable{\arabic{chapter}.\arabic{posttbl}}
\renewcommand\thepostfigure{\arabic{chapter}.\arabic{postfig}}

\begin{document}
\chapter{Data}
\startlist{lot}
\begin{table}
\caption{Data chapter table}
\begin{tabular}{c}
123 \\
\end{tabular}
\end{table}

\printlist{lot}{}{\chapter*{List of tables in Chapter~\thechapter}}
\processdelayedfloats

\chapter{Learning}
\startlist{lot}
\begin{table}
\caption{Learning chapter table}
\begin{tabular}{c}
123 \\
\end{tabular}
\end{table}

\printlist{lot}{}{\chapter*{List of tables in Chapter~\thechapter}}
\processdelayedfloats

\end{document}

• I was hoping endfloat would handle all of that. Will the same approach work for figures? Is it \startlist{lof}? How can I handle a chapter that only has figures or only has tables, for example? Jan 30 '14 at 21:55
• @user2146441 endfloat can only handle a general LoT and a general LoF; partial lists require additional work (and titletoc makes this work shorter). For figures, you are right, you have to use \startlist{lof} and \printlist{lof}{}{Some optional formatting here}. In a chapter with no figures, don't use \printlist{lof}{}{Some optional formatting here}. Jan 30 '14 at 22:00