我正在尝试在 beamer 中定义带下划线的块标题,但无法做到。有人能帮我吗?我设法自定义了块标题的特定字体和形状,但到目前为止,下划线还没有成功。我的(成功)代码如下:
\setbeamerfont{block title}{size=\normalsize, series=\bfseries}
\underline
命令不起作用(\ul
灵魂包也不起作用)...欢迎任何帮助!
答案1
附言:(取自此处更改投影仪中块的默认宽度)
\documentclass[10pt,a4paper]{beamer}
\usepackage[latin1]{inputenc}
\usetheme{Warsaw}
\newenvironment<>{varblock}[2][\textwidth]{%
\setlength{\textwidth}{#1}
\begin{actionenv}#3%
\def\insertblocktitle{\underline{#2}}%
\par%
\usebeamertemplate{block begin}}
{\par%
\usebeamertemplate{block end}%
\end{actionenv}}
\begin{document}
\begin{frame}
\frametitle{Sample frame title}
This is a text in the first frame. This is a text in the first frame. This is a text in the first frame.
{\begin{varblock}{title}blabla\end{varblock}}
\end{frame}
\end{document}
结果:
答案2
为了修补所有块以使其具有下划线标题,您可以在 beamer 模板的开头添加\insertblocktitle
as的重新定义。\underline{\insertblocktitle}
block begin
编辑:类似地,对于exampleblock
和alertblock
环境,将相同的行添加到block example begin
和block alerted begin
beamer 模板。
梅威瑟:
\documentclass{beamer}
\addtobeamertemplate{block begin}{%
\let\oldinsertblocktitle\insertblocktitle%
\def\insertblocktitle{\underline{\oldinsertblocktitle}}%
}{}
\addtobeamertemplate{block example begin}{%
\let\oldinsertblocktitle\insertblocktitle%
\def\insertblocktitle{\underline{\oldinsertblocktitle}}%
}{}
\addtobeamertemplate{block alerted begin}{%
\let\oldinsertblocktitle\insertblocktitle%
\def\insertblocktitle{\underline{\oldinsertblocktitle}}%
}{}
\begin{document}
\begin{frame}{My frame}
\begin{block}{My block}
has some content
\end{block}
\begin{exampleblock}{My block}
has some content
\end{exampleblock}
\begin{alertblock}{My block}
has some content
\end{alertblock}
\end{frame}
\end{document}