Getting a tikz picture to have an equation number

\begin{equation}
\begin{tikzpicture}[baseline=(current  bounding  box.center)]
......
\end{tikzpicture}
\end{equation}

Copied from Mtikz.pdf.


just place the TikZ picture into a box, for example using \text{} (which is an AMS command).

In case you do not use AMS, you can also use \hbox (which is a plain TeX command) instead.

Example which compiles without extra packages:

\begin{equation}
\hbox{\tikz\draw[draw=black,fill=red] (0,0) circle (5pt);}
\label{eq:test}
\end{equation}

\noindent
In (\ref{eq:test}), we see a TikZ picture.\dotfill

Christian


If your Tikz image lives inside a standalone file, Mephisto's answer will not work since baseline modifications do not carry over to the main document, unfortunately.

Another option that will work in such cases is to wrap the Tikz image in amsmath's aligned environment.

\begin{equation}
\begin{aligned}
    \includestandalone{<tikzimage>}
\end{aligned}
\end{equation}

If this is used frequently (as OP states) one should consider wrapping this construction inside a custom environment.

\newenvironment{alignedeqn}
    {\begin{equation}\begin{aligned}}
    {\end{aligned}\end{equation}\ignorespacesafterend}