# Theorem-style numbering for tikzpicture?

I make a lot of diagrams and other illustrations in TikZ, and I've discovered a need to give them reference numbers - is there a good way to do this?

• Normally you put them in figure environments and number those. If this does not apply to your documents, could you perhaps explain their structure more clearly?
– user121799
Jul 4 '19 at 8:48
• @marmot I tried figure, briefly, but it made the actual tikzpicture disappear, so I didn't pursue it. Maybe I should try harder. Jul 4 '19 at 9:23
• It does not make the picture disappear, but figures are by default floats, so they may get moved to another page. If a figure really disappears, you have either very strange settings, or the picture is too large, or both.
– user121799
Jul 4 '19 at 9:25

The float package allows to create new environments which can be numbered:

\documentclass{article}

\usepackage{tikz}
\usepackage{float}

\newfloat{Diagram}{htbp}{dia}

\begin{document}

\begin{Diagram}
\centering
\begin{tikzpicture}
\draw (0,0) circle (1);
\end{tikzpicture}
\caption{text}
\end{Diagram}

\end{document}

• This seems to be just the thing - thanks. Jul 4 '19 at 10:54