3

The first table in the second chapter of this MWE is marked as 'Table 2.2 About here'. The chapter-section numbering is not set up correctly, as Endfloat usually just numbers the tables sequentially throughout the whole document. How do I ensure the first table in Chapter two is listed as 'Table 2.1 About here'?

\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}
4

You can use chngcntr package and reset counters per chapter. Also note that the counters posttbl and postfig have been replaced by posttable andpostfigure' from version 2.5. From manual:

enter image description here

\documentclass[oneside,12pt]{book}
\usepackage[tablesfirst,notablist]{endfloat}
\usepackage{titletoc}
\usepackage{chngcntr}                   %% <-- new
\counterwithin{posttable}{chapter}      %% <-- new
\counterwithin{postfigure}{chapter}     %% <-- new 

\renewcommand\theposttable{\arabic{chapter}.\arabic{posttable}}
\renewcommand\thepostfigure{\arabic{chapter}.\arabic{postfigure}}

\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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.