You can do this in a straightforward manner with amsthm; its \newtheorem
command has the following syntax: \newtheorem{environment-name}[matched-counter]{text}[parent-counter]
. Whatever counter is specified for matched-counter
is used to number the created theorem; if none is given, a new counter is created. Thus, leveraging the existing figure counter, the following works:
\documentclass{amsart}
\usepackage{amsthm}
\newtheorem{theorem}[figure]{Theorem}
\newtheorem{definition}[figure]{Definition}
\begin{document}
\begin{theorem}
This is a theorem.
\end{theorem}
\begin{figure}
\caption{This is a figure.}
\end{figure}
\begin{definition}
This is a definition.
\end{definition}
\end{document}
This will produce output along the lines of:
Figure 2. This is a figure.
Theorem 1. This is a theorem.
Definition 3. This is a definition.
So there is one obvious property of this which you might or might not like: figures are numbered as they are introduced in code, not as they appear. This is the standard behavior for figures, and would be less egregious if I actually had some text in my sample document, so I think it's relatively sensible. If you dislike it (as you allude to in your question), I'm not sure what to suggest. You could use the float placement [h]
, which tries to put the float exactly where it's specified in the source; however, TeX will still float it if it needs to. The float package provides an [H]
float placement which unconditionally forces the (no-longer-floating) "float" to appear right there. Personally, I'd probably just let TeX number the floats as it wants to; from the text, the order of reference will probably be clear.