警报块和示例块中枚举/逐项列举项目的颜色(Beamer 主题 Torino)

警报块和示例块中枚举/逐项列举项目的颜色(Beamer 主题 Torino)

我正在使用 Beamer 主题 Torino(参见http://blog.barisione.org/2007-09/torino-a-pretty-theme-for-latex-beamer/),我正在用它做演示,但改变了默认定义的颜色。

碰巧的是(虽然我没有改变您可以在代码中看到的颜色),在这个主题中,使用 alertblock 和 exampleblock 中的 itemize 和 enumerate 环境,项目符号的颜色分别不是红色或绿色,而是采用为“标题块”定义的主颜色(它不像在原生 beamer 主题中):

\documentclass[10pt,compress,table]{beamer}
\mode<presentation>{
\usetheme[bullet=circle,alternativetitlepage=true,height=1cm]{Torino}
\usefonttheme[onlymath]{serif}
}
\setbeamertemplate{blocks}[rounded][shadow=false]
\usepackage[spanish]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}  
\usepackage{ragged2e}
\justifying
\theoremstyle{definition}
\definecolor{purple}{RGB}{153,0,51}
\definecolor{maroon}{RGB}{132,89,107}
\definecolor{glade}{RGB}{51,0,51}
\definecolor{tan}{RGB}{181,138,165}
\definecolor{DarkGreen}{RGB}{0,100,0}
\setbeamercolor*{palette primary}{fg=white,bg=tan} 
\setbeamercolor*{palette secondary}{fg=white,bg=maroon} 
\setbeamercolor*{palette tertiary}{fg=white,bg=glade} 
\setbeamercolor*{palette quaternary}{fg=white,bg=purple} 
\setbeamercolor*{titlelike}{bg=purple}
\setbeamercolor*{frametitle}{bg=purple,fg=white}
\setbeamercolor*{part title}{bg=black,fg=tan}
\setbeamercolor*{item}{fg=purple}
\setbeamercolor*{block title}{bg=purple,fg=white}
\setbeamercolor*{block body}{bg=purple!15,fg=black}
\setbeamercolor*{block title alerted}{bg=red,fg=white}
\setbeamercolor*{block body alerted}{bg=red!15,fg=black}
\setbeamercolor*{block title example}{bg=DarkGreen,fg=white}
\setbeamercolor*{block body example}{bg=DarkGreen!15,fg=black}
\setbeamercolor*{separation line}{}
\setbeamercolor*{fine separation line}{}

\begin{document}
\begin{frame}[t]{Lorem Ipsum}
\begin{exampleblock}{Lorem Ipsum}
\begin{itemize}
 \item Aut consilio aut ense
  \item Post tenebras Lux
\end{itemize}
\end{exampleblock}
\begin{alertblock}{Lorem Ipsum}
\begin{itemize}
  \item Aut consilio aut ense
  \item Post tenebras Lux
\end{itemize}
\end{alertblock}
\begin{alertblock}{Lorem Ipsum}
\begin{enumerate}
 \item Aut consilio aut ense
  \item Post tenebras Lux
\end{enumerate}
\end{alertblock}
\begin{exampleblock}{Lorem Ipsum}
\begin{enumerate}
  \item Aut consilio aut ense
  \item Post tenebras Lux
\end{enumerate}
\end{exampleblock}
\end{frame}
\end{document} 

使用etoolbox包和这个答案,我通过在序言中添加以下内容以所需的方式更改颜色:

\usepackage{etoolbox}
\AtBeginEnvironment{alertblock}{\setbeamercolor{itemize item}{fg=red}}
\AtBeginEnvironment{alertblock}{\setbeamercolor{itemize subitem}{fg=red}}
\AtBeginEnvironment{alertblock}{\setbeamercolor{itemize subsubitem}{fg=red}}
\AtBeginEnvironment{alertblock}{\setbeamercolor{enumerate item}{fg=red}}
\AtBeginEnvironment{alertblock}{\setbeamercolor{enumerate subitem}{fg=red}}
\AtBeginEnvironment{alertblock}{\setbeamercolor{enumerate subsubitem}{fg=red}}

\AtBeginEnvironment{exampleblock}{\setbeamercolor{itemize item}{fg=DarkGreen}}
\AtBeginEnvironment{exampleblock}{\setbeamercolor{itemize subitem}{fg=DarkGreen}}
\AtBeginEnvironment{exampleblock}{\setbeamercolor{itemize subsubitem}{fg=DarkGreen}}
\AtBeginEnvironment{exampleblock}{\setbeamercolor{enumerate item}{fg=DarkGreen}}
\AtBeginEnvironment{exampleblock}{\setbeamercolor{enumerate subitem}{fg=DarkGreen}}
\AtBeginEnvironment{exampleblock}{\setbeamercolor{enumerate subsubitem}{fg=DarkGreen}}

没有 etoolbox/有 etoolbox 的差异
我遇到的问题是,当我想使用 更改编号样式时\useinnertheme{circles},编号列表中项目的颜色与不使用 时相同etoolbox。使用 时\useinnertheme{rounded},问题会变得更糟,因为它还会影响分项列表: 在此处输入图片描述

答案1

问题是,当使用其中一个circlesrounded内部主题时,会使用一些不同的模板/颜色/字体,因此您需要更改item projectedsubitem projectedsubsubitem projected,如(仅针对第一级,但对于其他级别的想法相同):

% for inner theme circles
\AtBeginEnvironment{alertblock}{\setbeamercolor{item projected}{bg=red}}
\AtBeginEnvironment{exampleblock}{\setbeamercolor{item projected}{bg=DarkGreen}}

完整示例:

\documentclass[10pt,compress,table]{beamer}
\mode<presentation>{
\usetheme[bullet=circle,alternativetitlepage=true,height=1cm]{Torino}
\usefonttheme[onlymath]{serif}
}
\setbeamertemplate{blocks}[rounded][shadow=false]
\usepackage[spanish]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}  
\usepackage{ragged2e}
\usepackage{etoolbox}
\justifying
\theoremstyle{definition}
\definecolor{purple}{RGB}{153,0,51}
\definecolor{maroon}{RGB}{132,89,107}
\definecolor{glade}{RGB}{51,0,51}
\definecolor{tan}{RGB}{181,138,165}
\definecolor{DarkGreen}{RGB}{0,100,0}
\setbeamercolor*{palette primary}{fg=white,bg=tan} 
\setbeamercolor*{palette secondary}{fg=white,bg=maroon} 
\setbeamercolor*{palette tertiary}{fg=white,bg=glade} 
\setbeamercolor*{palette quaternary}{fg=white,bg=purple} 
\setbeamercolor*{titlelike}{bg=purple}
\setbeamercolor*{frametitle}{bg=purple,fg=white}
\setbeamercolor*{part title}{bg=black,fg=tan}
\setbeamercolor*{item}{fg=purple}
\setbeamercolor*{block title}{bg=purple,fg=white}
\setbeamercolor*{block body}{bg=purple!15,fg=black}
\setbeamercolor*{block title alerted}{bg=red,fg=white}
\setbeamercolor*{block body alerted}{bg=red!15,fg=black}
\setbeamercolor*{block title example}{bg=DarkGreen,fg=white}
\setbeamercolor*{block body example}{bg=DarkGreen!15,fg=black}
\setbeamercolor*{separation line}{}
\setbeamercolor*{fine separation line}{}

\useinnertheme{circles}

\AtBeginEnvironment{alertblock}{\setbeamercolor{itemize item}{fg=red}}
\AtBeginEnvironment{alertblock}{\setbeamercolor{itemize subitem}{fg=red}}
\AtBeginEnvironment{alertblock}{\setbeamercolor{itemize subsubitem}{fg=red}}
\AtBeginEnvironment{alertblock}{\setbeamercolor*{enumerate item}{bg=cyan,fg=red}}
\AtBeginEnvironment{alertblock}{\setbeamercolor{enumerate subitem}{fg=red}}
\AtBeginEnvironment{alertblock}{\setbeamercolor{enumerate subsubitem}{fg=red}}

\AtBeginEnvironment{exampleblock}{\setbeamercolor{itemize item}{fg=DarkGreen}}
\AtBeginEnvironment{exampleblock}{\setbeamercolor{itemize subitem}{fg=DarkGreen}}
\AtBeginEnvironment{exampleblock}{\setbeamercolor{itemize subsubitem}{fg=DarkGreen}}
\AtBeginEnvironment{exampleblock}{\setbeamercolor{enumerate item}{bg=red,fg=DarkGreen}}
\AtBeginEnvironment{exampleblock}{\setbeamercolor{enumerate subitem}{fg=DarkGreen}}
\AtBeginEnvironment{exampleblock}{\setbeamercolor{enumerate subsubitem}{fg=DarkGreen}}

% for inner theme circles
\AtBeginEnvironment{alertblock}{\setbeamercolor{item projected}{bg=red}}
\AtBeginEnvironment{exampleblock}{\setbeamercolor{item projected}{bg=DarkGreen}}


\begin{document}
\begin{frame}[t]{Lorem Ipsum}
\begin{columns}
\column{0.5\textwidth}
\begin{exampleblock}{Lorem Ipsum}
\begin{itemize}
 \item Aut consilio aut ense
  \item Post tenebras Lux
\end{itemize}
\end{exampleblock}
\begin{alertblock}{Lorem Ipsum}
\begin{itemize}
  \item Aut consilio aut ense
  \item Post tenebras Lux
\end{itemize}
\end{alertblock}
\column{0.5\textwidth}
\begin{alertblock}{Lorem Ipsum}
\begin{enumerate}
 \item Aut consilio aut ense
  \item Post tenebras Lux
\end{enumerate}
\end{alertblock}
\begin{exampleblock}{Lorem Ipsum}
\begin{enumerate}
  \item Aut consilio aut ense
  \item Post tenebras Lux
\end{enumerate}
\end{exampleblock}
\end{columns}
\end{frame}

\end{document}

在此处输入图片描述

相关内容