Latex changes the order of floats in my document. It moves figure 2 before figure 1. Figure 1 occupies a whole page, therefore I set it to be inserted on a float page, in afterpage environment. How to make sure that all floats appear in the order they are defined in the document? Here's an example:
\documentclass{article}
\pagestyle{plain}
\usepackage{calc}
\usepackage{setspace}
\onehalfspacing
\usepackage[english]{babel}
\usepackage[pangram]{blindtext}
\usepackage{caption}
\usepackage{floatrow}
\usepackage{afterpage}
\setlength{\textfloatsep}{20pt}
\setlength{\intextsep}{20pt}
\begin{document}
\vspace*{0.9\textheight}
\blindtext[8] (See Figure \ref{Fig1}) \blindtext[8]
\afterpage{
\begin{figure}[p]
\ffigbox[\FBwidth]{%
\framebox{\begin{minipage}[t][0.8\textheight]{0.8\textwidth}%
\hspace*{\fill}%
\end{minipage}}}{\caption{\label{Fig1}This is figure 1. \blindtext[8]}}
\end{figure}
\clearpage }
\blindtext[34] (See Figure \ref{Fig2}). \blindtext[12]
\begin{figure}
\ffigbox[\FBwidth]{%
\framebox{\begin{minipage}[t][3cm]{0.8\textwidth}%
\hfill{}%
\end{minipage}}}{\caption{\label{Fig2}This is figure 2. \blindtext[4]}}
\end{figure}
\blindtext[10] (See Figure \ref{Fig3}) \blindtext[5]
\begin{figure}
\noindent \centering{}\ffigbox[\FBwidth]{%
\framebox{\begin{minipage}[t][0.3\textheight]{0.8\textwidth}%
\hspace*{\fill}%
\end{minipage}}}{\caption{\label{Fig3}This is figure 3. \blindtext[4] }}
\end{figure}
\end{document}
And the pdf result:





afterpage"wrapper", the intended ordering prevails. – Mico Mar 14 '15 at 18:59\afterpageusage here theough is simply wrong and will re-order the floats as you found. At the very least you should use\afterpage{\clearpageBut I'd never use a float in an afterpage like this (and I wrote that package) – David Carlisle Mar 14 '15 at 19:56