\documentclass{beamer}
\usepackage{tikz-cd}
\begin{document}
\[\begin{tikzcd}[sep=huge]
\mathcal{H} \arrow[d,"W_A" swap] \arrow[r,"T"]& \mathcal{H} \arrow[d,"W_A"] \\
\mathbf{R}(A^{1/2}) \arrow[r,"\widetilde{T}" swap] & \mathbf{R}(A^{1/2})
\end{tikzcd}\]
\end{document}
我希望在第一次显示?
在的位置$W_A$
,按下回车键后$W_A$
就会出现。
答案1
这是左边的解决方案。右边可以用同样的方式解决。
\documentclass{beamer}
\usepackage{tikz-cd}
\begin{document}
\begin{frame}[fragile]{frametitle}{subtitle}%
\[
\begin{tikzcd}%[sep=huge]
\mathcal{H} \only<1>{\arrow[d,"?" swap]}\only<2->{\arrow[d,"W_A" swap]} \arrow[r,"T"]& \mathcal{H}
\arrow[d,"W_A"] \\
\mathbf{R}(A^{1/2}) \arrow[r,"\widetilde{T}"] & \mathbf{R}(A^{1/2})
\end{tikzcd}
\]
\end{frame}
\end{document}
答案2
我会用overlay-beamer-styles
它。
\documentclass{beamer}
\usepackage{tikz-cd}
\usetikzlibrary{overlay-beamer-styles}
\begin{document}
\begin{frame}[t,fragile]
\frametitle{A commutative diagram}
\[\begin{tikzcd}[sep=huge]
\mathcal{H} \arrow[d,"?"{swap,visible on=<1>},"W_A" {swap,visible on=<2>}]
\arrow[r,"T"]& \mathcal{H} \arrow[d,"?"{visible on=<1>},"W_A" {visible on=<2>}] \\
\mathbf{R}(A^{1/2}) \arrow[r,"\widetilde{T}" swap] & \mathbf{R}(A^{1/2})
\end{tikzcd}\]
\end{frame}
\end{document}
该overlay-beamer-styles
库有几个优点,其中之一就是它避免了跳转。为了说明这一点,请考虑以下示例\only
:
\documentclass{beamer}
\usepackage{tikz-cd}
\begin{document}
\begin{frame}[t,fragile]
\frametitle{A commutative diagram}
\[\begin{tikzcd}[sep=huge]
\mathcal{H} \arrow[d,"W_A" swap]
\only<1>{\arrow[r]}
\only<2->{\arrow[r,"T"]}& \mathcal{H}
\arrow[d,"W_A"] \\
\mathbf{R}(A^{1/2}) \arrow[r,"\widetilde{T}" swap] & \mathbf{R}(A^{1/2})
\end{tikzcd}\]
\end{frame}
\end{document}
另一方面,类似的构造overlay-beamer-styles
不会跳跃。
\documentclass{beamer}
\usepackage{tikz-cd}
\usetikzlibrary{overlay-beamer-styles}
\begin{document}
\begin{frame}[t,fragile]
\frametitle{A commutative diagram}
\[\begin{tikzcd}[sep=huge]
\mathcal{H} \arrow[d,"W_A" swap]
\arrow[r,"T" {visible on=<2->}]& \mathcal{H}
\arrow[d,"W_A"] \\
\mathbf{R}(A^{1/2}) \arrow[r,"\widetilde{T}" swap] & \mathbf{R}(A^{1/2})
\end{tikzcd}\]
\end{frame}
\end{document}
确实,在您的示例的特殊情况下这不是问题,但一般来说是个问题。