如何自定义幻灯片的标题以便在框架标题的上方和下方留出一些空白?
我想我应该按照以下说明更改模板:\setbeamertemplate{headline}
但是如何呢?
提前致谢
答案1
根据您的描述,至少对我而言,不清楚您需要修改哪个模板;headline
或frametile
。无论如何,您可以使用在或\addtobeamertemplate
模板之前(使用第一个参数)和之后(使用第二个参数)添加间距;一个小例子(当然,您可以使用所需的长度代替):headline
frametitle
1cm
\documentclass{beamer}
\usetheme{Warsaw}
\addtobeamertemplate{frametitle}{\vspace*{1cm}}{\vspace*{1cm}}
\begin{document}
\begin{frame}
\frametitle{Test Frame}
test
\end{frame}
\end{document}
根据评论中提出的新要求,需要重新定义模板(因为使用的主题是,所以frametitle
在中定义):beamerouterthemeshadow,sty
Warsaw
\documentclass{beamer}
\usetheme{Warsaw}
\makeatletter
\setbeamertemplate{frametitle}
{%
\nointerlineskip%
\vskip-2pt%
\hbox{\leavevmode
\advance\beamer@leftmargin by -12bp%
\advance\beamer@rightmargin by -12bp%
\beamer@tempdim=\textwidth%
\advance\beamer@tempdim by \beamer@leftmargin%
\advance\beamer@tempdim by \beamer@rightmargin%
\hskip-\Gm@lmargin\hbox{%
\setbox\beamer@tempbox=\hbox{\begin{minipage}[b]{\paperwidth}%
\vbox{}\vskip.50ex% NEW: original \vskip-.75ex
\leftskip0.3cm%
\rightskip0.3cm plus1fil\leavevmode
\insertframetitle%
\ifx\insertframesubtitle\@empty%
\strut\par%
\else
\par{\usebeamerfont*{framesubtitle}{\usebeamercolor[fg]{framesubtitle}\insertframesubtitle}\strut\par\vskip2ex}% NEW: added \vskip2ex
\fi%
\nointerlineskip
\vbox{}%
\end{minipage}}%
\beamer@tempdim=\ht\beamer@tempbox%
\advance\beamer@tempdim by 2pt%
\begin{pgfpicture}{0pt}{0pt}{\paperwidth}{\beamer@tempdim}
\usebeamercolor{frametitle right}
\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\beamer@tempdim}}
\pgfusepath{clip}
\pgftext[left,base]{\pgfuseshading{beamer@frametitleshade}}
\end{pgfpicture}
\hskip-\paperwidth%
\box\beamer@tempbox%
}%
\hskip-\Gm@rmargin%
}%
\nointerlineskip
\vskip-0.2pt
\hbox to\textwidth{\hskip-\Gm@lmargin\pgfuseshading{beamer@topshade}\hskip-\Gm@rmargin}
\vskip-2pt
}
\makeatother
\addtobeamertemplate{frametitle}{\vspace*{1cm}}{\vspace*{1cm}}
\begin{document}
\begin{frame}
\frametitle{Test Frame Title}
\framesubtitle{Test Frame Subtitle}
test
\end{frame}
\end{document}
代码中用 标记了更改的行% NEW
;您可以根据需要调整长度。