0

I'm using the “beamer-conference-ornate-20min.lyx” template on LyX and I'd like to add a commutative diagram as follows:

 \[\begin{tikzcd}   \ldots & {C_{p+1}} & {C_p} & {C_{p+1}} & \ldots \\  \ldots & {D_{p+1}} & {D_p} & {D_{p+1}} & \ldots     \arrow["{\partial_{p+2}}", from=1-1, to=1-2]    \arrow["{\partial_{p+1}}", from=1-2, to=1-3]    \arrow["{\partial_{p}}", from=1-3, to=1-4]  \arrow["{\partial_{p-1}}", from=1-4, to=1-5]    \arrow["{f_{p+1}}"', from=1-2, to=2-2]  \arrow["{\partial'_{p+2}}", from=2-1, to=2-2]   \arrow["{\partial'_{p+1}}", from=2-2, to=2-3]   \arrow["{f_p}"', from=1-3, to=2-3]  \arrow["{\partial'_{p}}", from=2-3, to=2-4]     \arrow["{f_{p+1}}"', from=1-4, to=2-4]  \arrow["{\partial'_{p-1}}", from=2-4, to=2-5] \end{tikzcd}\]

I've already verified this works just fine on a Book document class (after adding "\usepackage{tikz-cd}" to the LaTeX preamble). However, I get errors when I do the same on the beamer document class file and try to compile to a pdf.

dahemar
  • 103

1 Answers1

3

Adding \begin{frame}[fragile] you can obtain the desired output.

\documentclass[12pt]{beamer}
\usepackage{tikz-cd}

\begin{document} \begin{frame}[fragile] %<-----------------------

[\begin{tikzcd} \ldots & {C_{p+1}} & {C_p} & {C_{p+1}} & \ldots \ \ldots & {D_{p+1}} & {D_p} & {D_{p+1}} & \ldots \arrow["{\partial_{p+2}}", from=1-1, to=1-2] \arrow["{\partial_{p+1}}", from=1-2, to=1-3] \arrow["{\partial_{p}}", from=1-3, to=1-4] \arrow["{\partial_{p-1}}", from=1-4, to=1-5] \arrow["{f_{p+1}}"', from=1-2, to=2-2] \arrow["{\partial'{p+2}}", from=2-1, to=2-2] \arrow["{\partial'{p+1}}", from=2-2, to=2-3] \arrow["{f_p}"', from=1-3, to=2-3] \arrow["{\partial'{p}}", from=2-3, to=2-4] \arrow["{f{p+1}}"', from=1-4, to=2-4] \arrow["{\partial'_{p-1}}", from=2-4, to=2-5] \end{tikzcd}] \end{frame} \end{document}

enter image description here

Bernard
  • 271,350
Sebastiano
  • 54,118