I am setting a figure in landscape and then two other figures in normal mode. However, the landscape figure goes between the normal figures and the numbering gets messed up, including in the table of contents. How do I avoid the numbers being in the wrong order?

Unfortunately, I was not able to create a minimal example where this happens. Here is the structure of what I am using:

```
\clearpage
\begin{landscape}
  % figure 2
\end{landscape}
% figure 1
% figure 3

```

I'll tried with and without `\clearpage` before and after the landscape environment.

**Edit:**

Due to the comment by David, I saw that it is actually the following that causes the problem:

```
\afterpage{
  \clearpage
  \begin{landscape}
    % figure 2
  \end{landscape}
}
% figure 1
% figure 3

```

**Edit 2:**

Finally, a minimal example:

```
\documentclass{article}
\usepackage{blindtext}
\usepackage{afterpage}
\usepackage{pdflscape}
\usepackage{float}
\begin{document}
\listoffigures
\clearpage
\blindtext[4]
\afterpage{
\begin{landscape}
\begin{figure}
... figure contents ...
\caption{Figure 1}
\end{figure}
\end{landscape}
}
\begin{figure}
... figure contents ...
\caption{Figure 2}
\end{figure}
\begin{figure}[H]
... figure contents ...
\caption{Figure 3}
\end{figure}
\blindtext[4]
\end{document}

```

Note: Removing the [H] option of the third figure produces a whole page for just one small figure which isn't desired.

**Edit 3:**

Removing the [H] option does not change the order of figures either.

**Edit 4:**

For reference, here is what seems to be the result I was looking for: <https://tex.stackexchange.com/a/472608/36836>