tikz cd 在 beamer 中无法工作

tikz cd 在 beamer 中无法工作
\documentclass[hyperref={pdfpagelabels=false}]{beamer}
\usetheme{Madrid}
\usecolortheme{rose}
\usepackage{times}
\usefonttheme{structurebold}
\useinnertheme{rounded}
\usepackage[english]{babel}
\usepackage{epsfig, graphicx}
\usepackage{amsmath,amssymb}
\usepackage[latin1]{inputenc}
\usepackage[framesassubsections]{beamerprosper}
\usepackage{amsfonts}
\usepackage{graphics}
\usepackage{colortbl}
\usepackage[english]{babel}
\beamertemplatetransparentcovereddynamic
\newcommand{\tb}{\textbf}

%\newcommand{\Set}[1]{\{#1\}}

\title[Something]
{\large Something else}


\author[Nick Name]{{\bf{Name}}  \and \\
\vskip 0.5cm
\small{\inst{}\\ School of Mathematics\\ 
University}\\
}
\institute[University]{ \small{  }
}
\date{1st August 2019}

\colorlet{redshaded}{red!25!bg}
\colorlet{shaded}{black!25!bg}
\colorlet{shadedshaded}{black!10!bg}
\colorlet{blackshaded}{black!40!bg}

\colorlet{darkred}{red!80!black} \colorlet{darkblue}{blue!80!black}
\colorlet{darkgreen}{green!80!black}

\def\radius{0.96cm}
\def\innerradius{0.85cm}

\def\softness{0.4}
\definecolor{softred}{rgb}{1,\softness,\softness}
\definecolor{softgreen}{rgb}{\softness,1,\softness}
\definecolor{softblue}{rgb}{\softness,\softness,1}

\definecolor{softrg}{rgb}{1,1,\softness}
\definecolor{softrb}{rgb}{1,\softness,1}
\definecolor{softgb}{rgb}{\softness,1,1}
\definecolor{pink}{rgb}{1,0.5,0.5}
\definecolor{rosa}{rgb}{1.0,0.5,1.0}




\begin{document}
\frame{\titlepage}
\frame{
\[\begin{tikzcd}
F(u) \arrow[dd, "\eta(u)"'] \arrow[rr, "F(\alpha)"] &  & F(v) \arrow[dd, "\eta(v)"] \\
                                                    &  &                            \\
G(u) \arrow[rr, "G(\alpha)"']                       &  & G(v)                      
\end{tikzcd}\]
}
\end{document}

这是最小工作示例。请告诉我为什么它不起作用。

答案1

当然,首先你必须加载tikz-cd。然后你有两个选择:要么声明框架为,fragile要么使用ampersand replacement如下所示。

\frame{...}避免使用选项比 更少的语法\begin{frame}...\end{frame}

\documentclass[hyperref={pdfpagelabels=false},xcolor={table}]{beamer}
\usetheme{Madrid}
\usecolortheme{rose}
\usefonttheme{structurebold}
\useinnertheme{rounded}

\usepackage[latin1]{inputenc} % <- really?
\usepackage[english]{babel}

\usepackage{graphicx}
\usepackage{amsmath,amssymb}
\usepackage[framesassubsections]{beamerprosper}
\usepackage{tikz-cd}

\beamertemplatetransparentcovereddynamic

\title[Something]{\large Something else}


\author[Nick Name]{{\bf{Name}}  \and \\
\vskip 0.5cm
\small{\inst{}\\ School of Mathematics\\ 
University}\\
}
\institute[University]{ \small{  }
}
\date{1st August 2019}

\colorlet{redshaded}{red!25!bg}
\colorlet{shaded}{black!25!bg}
\colorlet{shadedshaded}{black!10!bg}
\colorlet{blackshaded}{black!40!bg}

\colorlet{darkred}{red!80!black} \colorlet{darkblue}{blue!80!black}
\colorlet{darkgreen}{green!80!black}

\def\radius{0.96cm}
\def\innerradius{0.85cm}

\def\softness{0.4}
\definecolor{softred}{rgb}{1,\softness,\softness}
\definecolor{softgreen}{rgb}{\softness,1,\softness}
\definecolor{softblue}{rgb}{\softness,\softness,1}

\definecolor{softrg}{rgb}{1,1,\softness}
\definecolor{softrb}{rgb}{1,\softness,1}
\definecolor{softgb}{rgb}{\softness,1,1}
\definecolor{pink}{rgb}{1,0.5,0.5}
\definecolor{rosa}{rgb}{1.0,0.5,1.0}




\begin{document}
\begin{frame}
\titlepage
\end{frame}

\begin{frame}[fragile]
\[
\begin{tikzcd}
F(u) \arrow[dd, "\eta(u)"'] \arrow[rr, "F(\alpha)"] &  & F(v) \arrow[dd, "\eta(v)"] \\
                                                    &  &                            \\
G(u) \arrow[rr, "G(\alpha)"']                       &  & G(v)                      
\end{tikzcd}
\]
\end{frame}

\begin{frame}
\[
\begin{tikzcd}[ampersand replacement=\&]
F(u) \arrow[dd, "\eta(u)"'] \arrow[rr, "F(\alpha)"] \&  \& F(v) \arrow[dd, "\eta(v)"] \\
                                                    \&  \&                            \\
G(u) \arrow[rr, "G(\alpha)"']                       \&  \& G(v)                      
\end{tikzcd}
\]
\end{frame}

\end{document}

在此处输入图片描述

epsfig我已删除了(自 1993 年起已弃用)、amsfonts(已被 加载amssymb) 和graphics(已被 加载)的加载graphicx

你确定你的文件是用 Latin-1 编码的吗?如果是,那么是时候转向 UTF-8 了。

相关内容