# endfloat shifts chunks of text to the end

I am trying to use \endfloat to shift all of the figures to the end of the document. However, some text, several paragraphs typically immediately after some figures also get shifted to the end of the document. Anyone else have this issue, or a solution?

General schema:

\documentclass{article}
\usepackage{endfloat}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage[T1]{fontenc}
\usepackage{lineno}
\usepackage{setspace}
\doublespacing

\begin{document}

\begin{figure}
% \begin{SCfigure}
\centering
\includegraphics[height=.8\textheight]{fig_ch4-stimuli.jpg}
\caption{Exemplars of stimuli used in the experiment. The label for each pattern was generated by the appearance of the stimulus. L'' and ...}
\label{Fig:stimuli}
% \end{SCfigure}
\end{figure}

\end{document}

• Interestingly, I discovered that having a trailing % after \end{tabular} and \end{figure} also resulted in text chunks being pushed to the end. Removing them solved the problem. – ivyleavedtoadflax Oct 7 '15 at 15:42

For TeXnical reasons, \end{figure} should not be indented, as explained in the manual:

## 10.1 Literal strings

When floats are being read, LaTeX is in verbatim mode. Among other things, this means that the lines like

\end{figure}


must appear on lines by themselves without any whitespace before or after them.

Maybe it's not well explained, because blank lines are allowed before or after \end{figure}: the meaning is precisely that \end{figure} should start at column 1 and there should be the end of line after the closing brace.

By the way, you can register also SCfigure with the endfloat package by saying

\DeclareDelayedFloatFlavor{SCfigure}{figure}


in the document preamble. Of course, the same limitation about \end{figure} will hold for \end{SCfigure}.

I used a tab to indent the the following commands:

\begin{figure}
\end{figure}


Removing the tab indent solves the problem.