在 LyX 上的 beamer 演示文稿中添加交换图(使用 tikzcd)

在 LyX 上的 beamer 演示文稿中添加交换图(使用 tikzcd)

我在 LyX 上使用“beamer-conference-ornate-20min.lyx”模板,我想添加一个交换图,如下所示:

 \[\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}\]

我已经验证过这在 Book 文档类上工作得很好(在 LaTeX 序言中添加“\usepackage{tikz-cd}”之后)。但是,当我在 beamer 文档类文件上执行相同操作并尝试编译为 pdf 时,出现错误。

答案1

添加后\begin{frame}[fragile]您就可以获得所需的输出。

\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}

在此处输入图片描述

相关内容