I cut-and-paste a basic example from the tikzcd manual and keep getting error messages. Here is a minimal example:
\documentclass{beamer}
\usepackage{tikz-cd}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\begin{document}
\begin{frame}
$$
\begin{tikzcd}
% \\
& C
\end{tikzcd}
$$
\end{frame}
\end{document}
This example works, BUT if uncomment the \ line I get the error message
\pgf@matrix@no@eom@found ->\cr
\noalign {\vskip \pgf@y \ifpgf@matrix@fixed \...
l.14 \end{frame}
And if I keep hitting "return" on these errors messages, I get more and different ones:
?
! Missing } inserted.
<inserted text>
}
l.13 \end{frame}
?
! Missing } inserted.
<inserted text>
}
l.13 \end{frame}
?
! Missing \cr inserted.
<inserted text>
\cr
l.13 \end{frame}
?
! Misplaced \cr.
<inserted text> \cr
l.13 \end{frame}
The code is taken from the manual so I'm confused. In case this matters, I am using TexLive 2017/Debian.
Thanks for your help!

\[ ... \]instead of$$ ... $$(learn why). And then, according to this discussion, using\begin{frame}[fragile]should help – Jasper Habicht Jan 26 '22 at 17:53pdfTeX, Version 3.141592653-2.6-1.40.23 (TeX Live 2021),LaTeX2e <2021-11-15> patch level 1,tikz-cd 2021/05/04 v1.0– gernot Jan 26 '22 at 17:57