![我如何为示例块指定颜色?](https://linux22.com/image/344705/%E6%88%91%E5%A6%82%E4%BD%95%E4%B8%BA%E7%A4%BA%E4%BE%8B%E5%9D%97%E6%8C%87%E5%AE%9A%E9%A2%9C%E8%89%B2%EF%BC%9F.png)
我使用 Beamer 和 XeLaTeX。我没有使用任何 Beamer 主题,因为手动指定一些参数更有用。我为所有块使用了一些颜色,并且所有块都有这些颜色……除了“示例”环境的块。
- 为什么示例环境不使用我的颜色?
- 我该如何修复它?
系统:Windows 7,MikTeX。
\documentclass[pdf,10pt,unicode]{beamer}
\usefonttheme{professionalfonts}
\usepackage{hyperref}
\usepackage{polyglossia}
\usepackage{tikz}
\setromanfont{Times New Roman}
\newfontfamily\cyrillicfontrm{Times New Roman}
\setsansfont[Mapping=tex-text]{Calibri}
\newfontfamily\cyrillicfontsf[Mapping=tex-text]{Calibri}
\setmonofont{Courier New}
\newfontfamily\cyrillicfonttt{Courier New}
\setmainfont{Cambria}
\newfontfamily\cyrillicfont{Cambria}
\usepackage{unicode-math}
\setmathfont{Cambria Math}
\setdefaultlanguage{english}
\defaultfontfeatures{Mapping=tex-text}
\usepackage{amsmath, amsthm}
\setbeamertemplate{blocks}[rounded][shadow=true]
\definecolor{LightViolet}{RGB}{230,220,255}
\setbeamercolor{frametitle}{bg=LightViolet}
\definecolor{NormalBlue}{RGB}{200,200,255}
\setbeamercolor{block title}{bg=NormalBlue}
\definecolor{LightBlue}{RGB}{220,220,255}
\setbeamercolor{block body}{bg=LightBlue}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}[frame number]
\setbeamertemplate{itemize items}[ball]
\setbeamertemplate{enumerate items}[circle]
\parskip=0.5em
\begin{document}
\begin{frame}
\frametitle{Frametitle}
\begin{definition}
This is a definition
\end{definition}
\begin{theorem}
This is a theorem
\end{theorem}
\begin{block}{Block}
This is a regular block
\end{block}
\begin{example}
This is a example block
\end{example}
\end{frame}
\end{document}
答案1
示例和警报块使用自己的颜色,您可以单独设置。
\documentclass[pdf,10pt,unicode]{beamer}
\setbeamertemplate{blocks}[rounded][shadow=true]
\definecolor{LightViolet}{RGB}{230,220,255}
\setbeamercolor{frametitle}{bg=LightViolet}
\definecolor{NormalBlue}{RGB}{200,200,255}
\setbeamercolor{block title}{bg=NormalBlue}
\definecolor{LightBlue}{RGB}{220,220,255}
\setbeamercolor{block body}{bg=LightBlue}
\setbeamercolor{block body example}{bg=red!20!white}
\setbeamercolor{block title example}{fg=red, bg=red!40!white}
\begin{document}
\begin{frame}
\frametitle{Frametitle}
\begin{definition}
This is a definition
\end{definition}
\begin{theorem}
This is a theorem
\end{theorem}
\begin{block}{Block}
This is a regular block
\end{block}
\begin{example}
This is a example block
\end{example}
\end{frame}
\end{document}