I'm writing a file where I have a tikz-drawn picture in the text. Now I've tried to caption the picture, for what I used the figure environment that I saw recommended elsewhere. Unfortunately this messes up the order of the running text, i.e. now places the figure not after the example it's supposed to illustrate, but between the statement and the proof of the next theorem. How is this preventable and how can I keep my desired order.
\documentclass[12pt]{article} % use larger type; default would be 10pt
\usepackage[utf8]{inputenc} % set input encoding (not needed with XeLaTeX)
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{mathtools}
\usepackage{commath}
\usepackage[sc,osf]{mathpazo}
\usepackage{authblk}
\usepackage{calc}
\usepackage{tkz-graph}
\usepackage{tikz}
\usepackage{amsmath,bm}
\usepackage[sc,osf]{mathpazo}
\usepackage{listings} %for including python code
\usepackage{color}
\usepackage{xcolor}
\usepackage{cite}
\usepackage{hyperref}
\usepackage{caption}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{example}
For a finite field F of order $q$,...
\end{example}
\begin{figure}[h]
\begin{center}
\begin{tikzpicture}
\end{tikzpicture}
\caption{some picture}
\end{center}
\end{figure}
\begin{theorem}\cite[5.7.6]{bekka08}
some statement
\end{theorem}
\captionof{figure}{Description}for this. – dexteritas Jan 16 '20 at 12:39