# equation label within commutative diagram

I would like a commutative diagram like

\begin{equation*}
\begin{tikzcd}[row sep=huge]

A \, \arrow[r] \arrow[d] & B  \arrow[d] \\

C & D \arrow[l] \\

\end{tikzcd}
\end{equation*}


In the commutative diagram I would like the symbol "A" to be replaced by an equation like

\begin{equation} \label{myequation}
\begin{array}{rcl}

E & = & m c^2 \\

E & = & m c^3

\end{array}
\end{equation}


and I would like to reference that equation outside, with \ref{myequation}. How do I do that?

• What do you precisely mean by “an equation with a label”? – egreg Jan 23 '19 at 23:46
• Do you means something of the sort \begin{equation*} \begin{tikzcd}[row sep=huge] equation \, 1 with \, a \, label \, \arrow[r] \arrow[d] & E=m\,c^2\quad(\stepcounter{equation}\theequation) \arrow[d] \\ A & B \arrow[l] \\ \end{tikzcd} \end{equation*}? – user121799 Jan 24 '19 at 0:13
• By "an equation with a label", do you mean a full equation, or do you mean a cross-reference to an equation labelled somewhere else in the document? Please advise. – Mico Jan 24 '19 at 2:22
• @Mico: see my edited question above. Thanks. – district9 Jan 29 '19 at 19:15
• @egreg: see the edited question above. thanks – district9 Jan 29 '19 at 20:54

Still not sure I understand your question, but here is what I think you might want.

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
\begin{equation}
\begin{tikzcd}[row sep=huge,ampersand replacement=\&]
\label{eq:Schmarrn}(\theequation)~\left\{\begin{array}{@{}r@{\,}c@{\,}l}
E & = & m c^2 \\
E & = & m c^3
\end{array}\right.  \, \arrow[r] \arrow[d] \& B  \arrow[d] \\
C \& D \arrow[l] \\
\end{tikzcd} \notag\stepcounter{equation}
\end{equation}
Einstein said that
\begin{equation}\label{eq:Einstein}
E  =  m c^2
\end{equation}
and the second equality in \eqref{eq:Schmarrn} is not quite right. On the other
hand, \eqref{eq:Einstein} is correct.
\end{document} \documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
\begin{align}\label{eq:Schmarrn}
\makebox[\displaywidth]{
\begin{tikzcd}[row sep=huge,ampersand replacement=\&]
A  \, \arrow[r] \arrow[d] \&
\left.\begin{array}{@{}r@{\,}l}
E & =  m c^2 \\
E & =  m c^3
\end{array}\right\}  \arrow[d] \\
C \& D \arrow[l] \\
\end{tikzcd}} \raisetag{24.4ex}
\end{align}
Einstein said that
\begin{equation}\label{eq:Einstein}
E  =  m c^2
\end{equation}
and the second equality in \eqref{eq:Schmarrn} is not quite right. On the other
hand, \eqref{eq:Einstein} is correct.
\end{document} • Yes, thank you. But I also want a multiline equation in place of the "B." Further, I would like the equations to have only 2 columns, adjusted right and left, resp. I know these should be simple changes, but I did the obvious changes, and I keep getting errors from latex. – district9 Feb 1 '19 at 19:41
• @district9 I added something. If you want modifications, please ask a new question. – user121799 Feb 1 '19 at 20:12
• Sorry, now I accepted it. I am new to the site. Thank you! – district9 Feb 1 '19 at 22:23

I think you want something like this: which comes from enclosing your intended text "equation 1 with a label" in \text{...}. Otherwise LaTeX considers equation1withalabel to be a single variable-- where it needs \, as a word-separator.

\documentclass{article}
\usepackage{amsmath,amssymb,tikz-cd}

\begin{document}
\begin{equation*}
\begin{tikzcd}[row sep=huge]
\text{equation 1 with a label } \arrow[r] \arrow[d] &
\text{equation 2 with a label } \arrow[d] \\
A                       &
B   \arrow[l] \\
\end{tikzcd}
\end{equation*}
\end{document}

\end{document}

• Thanks, but not quite. Please see edited question above. – district9 Jan 29 '19 at 21:07