Beamer:设置 beamercolorbox 的字体大小

Beamer:设置 beamercolorbox 的字体大小

我不知道如何在 Beamer 中设置特定 beamercolorbox 的字体大小。我有一个名为“box”的 beamercolorbox,我使用以下命令调用它:

\begin{beamercolorbox}[sep=4pt]{box}

我想设置此框中文本的字体大小。我尝试在序言中输入以下内容:

\setbeamerfont{box}{size={10}{12}}

但这没有任何效果。我遗漏了什么?

以下是 MWE:

\documentclass{beamer}

\usepackage[utf8]{inputenc}

\usecolortheme{beetle}

\setbeamercolor{box}{fg=black,bg=gray!50}

\begin{document}

\begin{frame}
\frametitle{Title of frame}

\begin{beamercolorbox}[sep=4pt]{box}
“A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote.”
\end{beamercolorbox}

\end{frame}

\end{document}

输出如下:

在此处输入图片描述

我想减小 beamercolorbox 的字体大小,以便长引文能够更好地适应页面,不仅适用于这个特定的框,而且适用于所有“框”类型的框。

在此先感谢您的帮助!

答案1

如果您想用 固定字体大小{10}{12},您必须使用选项。并在您想要的位置使用size*命令。\usebeamerfont

如果您想将此尺寸应用于所有box框,您可以按照以下代码newenvironment声明。mybox

\documentclass{beamer}

\usepackage[utf8]{inputenc}

\usecolortheme{beetle}

\setbeamercolor{box}{fg=black,bg=gray!50}
\setbeamerfont{box}{size*={10}{12}}

\newenvironment<>{mybox}[1][]%
{\begin{beamercolorbox}[#1]{box}\usebeamerfont{box}}{\end{beamercolorbox}}

\begin{document}

\begin{frame}
\frametitle{Title of frame}

\begin{mybox}[sep=4pt]
“A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote. A long quote.”
\end{mybox}

\end{frame}

\end{document}

在此处输入图片描述

相关内容