# Using endfloat with Chapters [ Figure X about here] has incorrect numbering

• Using endfloat and graphicx package.
• I place a figure in chapter 1. Which is assigned the figure number 2.1.
• A box in the position reads: [ Figure 1 about here ]
• How can we make the box read the correct figure number? It is not figure 1.
• Secondly, how can we make the figure take the correct figure number of 1.1. Since the figure is in chapter 1, not chapter 2? Originally, it was figure 2.1. But we wish to change to the correct figure 1.1.

Example:

\documentclass[a4paper,12pt,twoside]{book}
\usepackage{graphicx}
\usepackage[nolists]{endfloat}

\begin{document}
\chapter{This is Chapter 1}
Some text in chapter 1.  See my figure \ref{fig:MyFigure}.

\begin{figure}
\centering
\includegraphics{Figures/MyFigure.JPG}
\caption{My caption for this figure}
\label{fig:MyFigure}
\end{figure}

\let\cleardoublepage\clearpage
\chapter{This is Chapter 2}
Some text in chapter 2.

\end{document}

-

Quoting from the endfloat documentation, p. 1, first sentence:

The purpose of this style is to put all figures on pages by themselves at the end of an article in a section named Figures.

In other words, endfloat was not designed for document classes featuring the \chapter command (book, report, ...).

As a quick fix, you may add the following to your preamble:

\usepackage{chngcntr}
\counterwithout{figure}{chapter}


This will uncouple the figure counter from the chapter counter, i.e., figures will be numbered simply as 1, 2, ...

Placing figures at the end of the document but numbering them as if they were placed within chapters (Figure 1.1, ...) doesn't seem to possible with endfloat.

EDIT: I should have read the documentation more carefully. Version 2.4 of endfloat introduced the \processdelayedfloats macro. Put this macro at the end of each chapter; this "will process all of the unprocessed tables and figures up to that point" (p. 6). The floats will also be numbered correctly.

EDIT 2: I suppose you will have to live with figures at the end of each chapter, but here's a fix for the "about here" caption.

\documentclass[12pt]{book}

\usepackage[nolists]{endfloat}

% Use the following only together with \processdelayedfloats
\usepackage{chngcntr}
\counterwithin{postfig}{chapter}

\begin{document}

\chapter{This is Chapter~1}

Some text in chapter~1. See my figure \ref{fig:FirstFigure}.

\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{First figure}
\label{fig:FirstFigure}
\end{figure}

\processdelayedfloats

\chapter{This is Chapter~2}

Some text in chapter~2.

\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{Second figure}
\label{fig:SecondFigure}
\end{figure}

\processdelayedfloats

\end{document}

-
yeah I read the documentation and tried "\processdelayedfloats". But, endfloat still places [ figure 1 about here] not [figure 1.1 about here]. Secondly, the figures are at the end of the chapter, not end of the document (which I can live with). But, would prefer a fix if possible. –  Ian Gregory Mar 15 '11 at 11:28
• The following MWE shows how to place all figures and tables at the end of a chapter with the correct:
• Multiple floats are also placed on the same page.
• This should be useful for anyone writing a thesis.
\documentclass[a4paper,12pt,twoside]{book}
\usepackage{graphicx}

\usepackage[nolists]{endfloat}
\renewcommand{\efloatseparator}{\mbox{}}

\begin{document}

\chapter{This is Chapter 1}

Some text in chapter 1.  See my figure \ref{fig:MyFigure1} and my table \ref{tab:MyTable1}.

\renewcommand{\tablename}{Figure} % if no babel
\renewcommand{\tableplace}{%
\begin{center}
[Ian says: Table \ref{tab:MyTable1} about here]
\end{center}}

\begin{table}
\begin{tabular}{ll}
1 & 2  \\
3 & 4  \\
\end{tabular}
\label{tab:MyTable1}
\end{table}

\renewcommand{\figurename}{Figure} % if no babel
\renewcommand{\figureplace}{%
\begin{center}
[Ian says: Figure \ref{fig:MyFigure1} about here]
\end{center}}

\begin{figure}
\centering
\includegraphics{Figures/MyFigure.JPG}
\caption{My caption for this figure}
\label{fig:MyFigure1}
\end{figure}

\renewcommand{\figurename}{Figure} % if no babel
\renewcommand{\figureplace}{%
\begin{center}
[Ian says: Figure \ref{fig:MyFigure2} about here]
\end{center}}

\begin{figure}
\centering
\includegraphics{Figures/MyFigure.JPG}
\caption{My caption for this figure}
\label{fig:MyFigure2}
\end{figure}

\processdelayedfloats
\let\cleardoublepage\clearpage
\chapter{This is Chapter 2}
Some text in chapter 2. See my figure \ref{fig:MyFigure3}.

\renewcommand{\figurename}{Figure} % if no babel
\renewcommand{\figureplace}{%
\begin{center}
[Ian says: Figure \ref{fig:MyFigure3} about here]
\end{center}}

\begin{figure}
\centering
\includegraphics{Figures/MyFigure.JPG}
\caption{My caption for this figure}
\label{fig:MyFigure3}
\end{figure}

\processdelayedfloats
\let\cleardoublepage\clearpage
\chapter{This is Chapter 3}
Some text in chapter 3.

\end{document}

-
Thanks for posting the above code. The text at the beginning is not quite clear to me; in particular the "with the correct:" seems somehow lost, maybe due to formatting issues. Is there any way I can help you improve the formatting, or can you maybe reword it a bit to make it clearer? –  Hendrik Vogt Mar 15 '11 at 14:44
Just in case you didn't see my comment above, here's another notification. I'd still be glad to help you improve the formatting. –  Hendrik Vogt Mar 19 '11 at 16:44