我想要一个交换图
\begin{equation*}
\begin{tikzcd}[row sep=huge]
A \, \arrow[r] \arrow[d] & B \arrow[d] \\
C & D \arrow[l] \\
\end{tikzcd}
\end{equation*}
在交换图中,我希望用如下方程代替符号“A”
\begin{equation} \label{myequation}
\begin{array}{rcl}
E & = & m c^2 \\
E & = & m c^3
\end{array}
\end{equation}
并且我想用 引用外部的那个方程\ref{myequation}
。我该怎么做?
答案1
仍然不确定我是否理解了你的问题,但我想这可能是你想要的。
\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}
答案2
我想你想要这样的东西:
这来自于将你想要的文本“带有标签的方程式 1”括在 中\text{...}
。否则 LaTeX 会认为带标签的方程式1作为一个单一变量——它需要\,
作为单词分隔符。
\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}