I want to place a tikzpicture next to an equation and equip both of them together with an equation number. The reason is that the tikzpicture is a kind of explanation (visualization) for the equation. Therefore I prefer that both appear together as one "equation".
In Placing a tikzpicture next to an align it is explained how to place a tikzpicture next to an align environment using minipages. This works for me, but I have problems equipping the result with an equation number. I tried to enclose both minipages in an equation environment, but this does not really work.
If I use align inside one of the minipages, I get two equation numbers (one for align, the other one for equation, but both actually being the name number). I would expect this, expect from both equation numbers being the same, but this is probably related to the fact that I place align inside equation. I guess one is not supposed to do this.
If I use align* inside one of the minipages, I get no equation number at all, also the equation environment does not carry an equation number. I would expect an equation number for the equation environment.
The result of the following example looks as follows:
\documentclass[10pt]{article}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows}
\usepackage{mathtools}
\usepackage[english]{babel}
\begin{document}
\begin{equation}
\begin{minipage}{0.40\linewidth}
\begin{align*}
A=B
\end{align*}
\end{minipage}
\begin{minipage}{0.40\linewidth}
\begin{center}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes, column sep=20pt]
{
A & B \\
};
\path[->,font=\scriptsize,>=angle 90]
(m-1-1) edge (m-1-2);
\end{tikzpicture}
\end{center}
\end{minipage}
\end{equation}
\begin{equation}
\begin{minipage}{0.40\linewidth}
\begin{align}
A=B
\end{align}
\end{minipage}
\begin{minipage}{0.40\linewidth}
\begin{center}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes, column sep=20pt]
{
A & B \\
};
\path[->,font=\scriptsize,>=angle 90]
(m-1-1) edge (m-1-2);
\end{tikzpicture}
\end{center}
\end{minipage}
\end{equation}
\end{document}