我想用 Beamer 制作演示文稿。我使用AAU侧边栏主题。
我想使用我自己定义的盒子\newt颜色框。但是,我无法修改标题的背景颜色(返回标题)以及文本的颜色(上下文)。或许其他属性是错误的。
MVE 是:
\documentclass[9pt]{beamer}
\usetheme[shownavsym, left]{AAUsidebar}
% If you want to change the colors of the various elements in the theme, edit and uncomment the following lines
\definecolor{mygreen}{cmyk}{0.82,0.11,1,0.25}
\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamercolor{itemize item}{fg=orange!20!black}
\setbeamertemplate{itemize item}[ball]
\setbeamertemplate{itemize subitem}[triangle]
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[many]{tcolorbox}
\newtcolorbox{MyBox}[1][]{
width=\textwidth,
colframe=red,%beamer@barcolor, % color frame: red!75!black,
colback=orange!50, % color background of the box
colbacktitle=black!50!white, %beamer@barcolor!100, %beamer@barcolor, % color background of the title box blue!85!black
colbacklower=orange, %LimeGreen!75!LightGreen,
% colupper=mygreen , % color of the text in the upper part
% collower=mygreen , % color of the text in the lower part
coltext=mygreen!50, % color of the text (upper et lower parts)
coltitle=mygreen!50,%mygreen!50!black, % color of the title
% fontupper=\bfseries, %text et font avant le texte
% fontlower=\bfseries, %text et font avant le texte
fonttitle=\bfseries, %text et font avant le texte
oversize,
left=0ex,
right=0ex,
top=0pt,
bottom=0pt,
arc=6pt,
outer arc=6pt,
leftrule=0pt,
rightrule=0pt,
toprule=0pt,
bottomrule=0pt,
% breakable,
enhanced,% jigsaw,
% title filled=true, % or false
% rounded corners=northwest ,
drop fuzzy shadow=black!80!white, % orange,
title= #1}
\begin{document}
\begin{frame}{Introduction}
\begin{MyBox}{The title}
\begin{enumerate}
\item my item 1
\item my item 2
\item my item 3
\end{enumerate}
\end{MyBox}
\end{frame}
\end{document}
我的代码有什么错误?
答案1
你的代码是正确的,除了两个小错误。第一个是你声明了mybox
一个可选参数
\newtcolorbox{MyBox}[1][]{
默认情况下为空。您对的调用将\begin{MyBox}{Title}
标题留空,并考虑Title
部分文本。如果您使用,\begin{MyBox}[Title]
标题将被视为这样并按预期打印。
第二个是忘记为beamer
声明自己的颜色enumerate
,因此,当您在框中coltext
包含环境时,它会被覆盖。普通文本是用颜色书写的,但 或中的文本不是。enumerate
coltext
enumerate
itemize
description
如果要更改enumerate
所有文档中的所有颜色文本,请添加
\setbeamercolor{itemize/enumerate body}{fg=mygreen!50}
在您的序言中。但是,如果您只想将其应用到中MyBox
,请将其插入到声明before upper=
中\MyBox
。此命令将更改正文的排版方式,但对于数字或项目,您必须重新定义enumerate item
或itemize item
模板。
\documentclass[9pt]{beamer}
\usetheme[shownavsym, left]{AAUsidebar}
% If you want to change the colors of the various elements in the theme, edit and uncomment the following lines
\definecolor{mygreen}{cmyk}{0.82,0.11,1,0.25}
\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamercolor{itemize item}{fg=orange!20!black}
\setbeamertemplate{itemize item}[ball]
\setbeamertemplate{itemize subitem}[triangle]
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[many]{tcolorbox}
\newtcolorbox{MyBox}[1][]{
width=\textwidth,
colframe=red,%beamer@barcolor, % color frame: red!75!black,
colback=orange!50, % color background of the box
colbacktitle=black!50!white, %beamer@barcolor!100, %beamer@barcolor, % color background of the title box blue!85!black
colbacklower=orange, %LimeGreen!75!LightGreen,
% colupper=mygreen , % color of the text in the upper part
% collower=mygreen , % color of the text in the lower part
coltext=mygreen!50, % color of the text (upper et lower parts)
coltitle=mygreen!50,%mygreen!50!black, % color of the title
% fontupper=\bfseries, %text et font avant le texte
% fontlower=\bfseries, %text et font avant le texte
fonttitle=\bfseries, %text et font avant le texte
oversize,
left=0ex,
right=0ex,
top=0pt,
bottom=0pt,
arc=6pt,
outer arc=6pt,
leftrule=0pt,
rightrule=0pt,
toprule=0pt,
bottomrule=0pt,
% breakable,
enhanced,% jigsaw,
% title filled=true, % or false
% rounded corners=northwest ,
drop fuzzy shadow=black!80!white, % orange,
title= #1,
before upper={ \setbeamercolor{itemize/enumerate body}{fg=mygreen!50}}}
\begin{document}
\begin{frame}{Introduction}
\begin{MyBox}[The title]
\begin{enumerate}
\item my item 1
\item my item 2
\item my item 3
\end{enumerate}
Some text outside enumerate but inside MyBox
\end{MyBox}
Some text outside the box
{\setbeamercolor{enumerate item}{fg=blue}
\begin{enumerate}
\item Some enumerate outside MyBox
\end{enumerate}}
\begin{enumerate}
\item Some enumerate outside MyBox
\end{enumerate}
\end{frame}
\end{document}