我想要 Boadilla 主题的块样式和默认主题。我遇到了这个问题,这对我很有帮助。但我想进一步自定义框,比如我想给块添加边框。这是 MWE
\documentclass[aspectratio=169]{beamer}
\usetheme{default}
\usepackage[most]{tcolorbox}
\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamercolor{block body example}{bg=red!20!white}
\setbeamercolor{block title example}{fg=red, bg=red!40!white}
% \definecolor{bitsdeepBlue}{RGB}{42, 42, 134}
\newtcolorbox{resp}[1][]{%
enhanced jigsaw,%
colback=red!20!white!90!,%
colframe=red!85!white!90!,%
colbacktitle=red!45!white!90!,
% size=small,%
% boxrule=1pt,%
title=\textbf{\textit{Example}},%
halign title=flush left,%
coltitle=red,%
breakable,%
drop fuzzy shadow=black!70!white,%
}
\begin{document}
\begin{frame}{Frame Title}
\begin{example}
this is default.
\end{example}
\begin{resp}
this is what I am able to get
\end{resp}
\end{frame}
\end{document}
这给我但是块稍微小了一点,阴影也不一样。我甚至不想在标题和正文混合的地方有边框。只要有外边框就可以了。而且块标题没有完全左对齐。
有人能帮我吗?谢谢
答案1
- 您可以使用以下方式将标题(和内容)进一步向左移动
left=0pt
- 删除标题和正文之间的规则:
titlerule=0pt
- 调整高度
top=1pt
和bottom=0pt
- 得到相同的块宽度:
enlarge left by=-0.1cm
和grow to right by=0.21cm
\documentclass[aspectratio=169]{beamer}
\usepackage[most]{tcolorbox}
\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamercolor{block body example}{bg=red!20!white}
\setbeamercolor{block title example}{fg=red, bg=red!40!white}
% \definecolor{bitsdeepBlue}{RGB}{42, 42, 134}
\newtcolorbox{resp}[1][]{%
enhanced jigsaw,%
colback=red!20!white!90!,%
colframe=red!85!white!90!,%
colbacktitle=red!45!white!90!,
% size=small,%
% boxrule=1pt,%
title=\textbf{\textit{Example}},%
halign title=flush left,%
coltitle=red,%
breakable,%
drop fuzzy shadow=black!70!white,%
left=0pt,
titlerule=0pt,
top=1pt,
bottom=0pt,
enlarge left by=-0.1cm,
grow to right by=0.21cm,
}
\begin{document}
\begin{frame}{Frame Title}
\begin{example}
this is default.
\end{example}
\begin{resp}
this is what I am able to get
\end{resp}
\end{frame}
\end{document}
使用新的 tcolorbox 内部主题(https://www.ctan.org/pkg/beamertheme-tcolorbox),现在使用 tcolorboxes 复制 beamer 块的外观和感觉变得更加容易:
\documentclass[aspectratio=169]{beamer}
\setbeamercolor{block body example}{bg=red!20!white, fg=black}
\setbeamercolor{block title example}{fg=red, bg=red!40!white}
\useinnertheme[shadow,rounded]{tcolorbox}
\tcbset{
boxrule=1pt,
frame style={draw,red!85!white}
}
\begin{document}
\begin{frame}{Frame Title}
\begin{example}
this is default.
\end{example}
\end{frame}
\end{document}