I have been trying to prepare a presentation for which I require a commutative diagram. Now I tried to use tikzcd to draw the diagram, but it didn't work properly. Here's the code:
\begin{frame}{Smooth Structure on Manifolds}
\onslide<1->{Let $(U,\varphi),\ (V,\psi)$ be two charts. If $U\cap V\neq \phi$, then define the map $\psi\circ \varphi^{-1}:\varphi(U\cap V)\to \psi(U\cap V)$, called the \textbf{transition map from $\varphi$ to $\psi$.}}
\onslide<2->{We say that the charts $(U,\varphi),\ (V,\psi)$ are \textbf{smoothly compatible} if either $U\cap V = \phi$, or $\psi\circ \varphi^{-1}$ is a \textit{\underline{diffeomorphism}}.\\}
\onslide<3->{\begin{tikzcd}
U\cap V \arrow[r, "\varphi"] \arrow[d, "psi"]
& \varphi(U\cap V) \arrow[rd, "\psi\circ \varphi^{-1}"] \\
\psi(U\cap V)
\end{tikzcd} \\}
\onslide<4->{A \textit{\underline{diffeomorphism}} is a smooth homeomorphism such that the inverse is also smooth.\\~\\}
\end{frame}
Here is the list of errors:
How do I correct it? Please help.
How do I rectify this. Please help.

ampersand replacement=\&in the options of thetikzcdenvironment (or globally, say\tikzcdset{diagrams={ampersand replacement=\&}}and use\&instead of&. Maybe theonlyenvenvironment with afragileframe can be used without having to change the&. – Qrrbrbirlbel Jul 14 '23 at 12:38ampersand replacement=\&worked perfectly! What was the issue here though? Also, can you please tell me how to align this diagram centrally? – Devansh Kamra Jul 14 '23 at 12:39centerenvironment. – Devansh Kamra Jul 14 '23 at 12:49