![Beamer 演示文稿中框中的标题](https://linux22.com/image/254417/Beamer%20%E6%BC%94%E7%A4%BA%E6%96%87%E7%A8%BF%E4%B8%AD%E6%A1%86%E4%B8%AD%E7%9A%84%E6%A0%87%E9%A2%98.png)
1)如何将 Beamer 标题页上的标题放到所需颜色的块上?类似主题华沙、柏林... 2)如何控制作者和日期之间的空格?\vspace
似乎不起作用。
1)我用的是这个
\title[TITLE]{TITLE\\[1em]
\includegraphics[height=4cm]{logo}\\[1em]}
\subtitle{\textbf{Subtitle}}
但我希望只在 TITLE 周围显示方框。我该怎么做?
答案1
您可以重新定义title page
模板并对布局进行必要的修改;需要重新定义,因为标题和副标题默认位于同一个模板内,beamercolorbox
因此只需重新定义title
投影仪颜色就会在标题和副标题周围产生一个框(这里不需要):
\documentclass{beamer}
\title{TITLE}
\titlegraphic{\includegraphics[height=4cm]{cat}}
\subtitle{\textbf{Subtitle}}
\author{Author}
\setbeamercolor{title}{bg=orange,fg=white}
\makeatletter
\setbeamertemplate{title page}
{
\vbox{}
\vfill
\begin{centering}
\begin{beamercolorbox}[sep=8pt,center]{title}
\usebeamerfont{title}\inserttitle
\end{beamercolorbox}
\setbeamercolor{title}{bg=white,fg=structure}
\begin{beamercolorbox}[sep=8pt,center]{title}
{\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\par}
\ifx\insertsubtitle\@empty%
\else%
\vskip0.25em%
{\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
\fi%
\end{beamercolorbox}%
\vskip1em\par
\begin{beamercolorbox}[sep=8pt,center]{author}
\usebeamerfont{author}\insertauthor
\end{beamercolorbox}
\vskip-1em\par % change here
\begin{beamercolorbox}[sep=8pt,center]{institute}
\usebeamerfont{institute}\insertinstitute
\end{beamercolorbox}
\begin{beamercolorbox}[sep=8pt,center]{date}
\usebeamerfont{date}\insertdate
\end{beamercolorbox}\vskip0.5em
\end{centering}
\vfill
}
\makeatother
\begin{document}
\maketitle
\end{document}
请注意,现在无需使用\title[TITLE]{TITLE\includegraphics{...}}
,但现在您只需使用\title{TITLE}
\titlegraphic{\includegraphics[]{}}`。当然,您可以根据您的特定需求随意进行必要的调整(您可以使用 \vskip 命令中的长度来调整垂直间距)。
根据评论中的要求,要仅在字幕周围有一个彩色框,需要进行以下修改:
\documentclass{beamer}
\title{TITLE}
\titlegraphic{\includegraphics[height=4cm]{cat}}
\subtitle{\textbf{Subtitle}}
\author{Author}
\makeatletter
\setbeamertemplate{title page}
{
\vbox{}
\vfill
\begin{centering}
\begin{beamercolorbox}[sep=8pt,center]{title}
\usebeamerfont{title}\inserttitle
\end{beamercolorbox}
{\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\par}
\ifx\insertsubtitle\@empty%
\else%
\vskip0.25em%
\setbeamercolor{title}{bg=orange,fg=white}
\begin{beamercolorbox}[sep=8pt,center]{title}
{\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
\fi%
\end{beamercolorbox}%
\vskip1em\par
\begin{beamercolorbox}[sep=8pt,center]{author}
\usebeamerfont{author}\insertauthor
\end{beamercolorbox}
\vskip-1em\par % change here
\begin{beamercolorbox}[sep=8pt,center]{institute}
\usebeamerfont{institute}\insertinstitute
\end{beamercolorbox}
\begin{beamercolorbox}[sep=8pt,center]{date}
\usebeamerfont{date}\insertdate
\end{beamercolorbox}\vskip0.5em
\end{centering}
\vfill
}
\makeatother
\begin{document}
\maketitle
\end{document}
通过新的请求,以下代码可以随意更改用于字幕的框的宽度;根据需要更改用于的长度\subtitwd
(最初设置为):4cm
\documentclass{beamer}
\newlength\subtitwd
\setlength\subtitwd{4cm}% change the width here
\makeatletter
\setbeamertemplate{title page}
{
\vbox{}
\vfill
\begin{centering}
\begin{beamercolorbox}[sep=8pt,center]{title}
\usebeamerfont{title}\inserttitle
\end{beamercolorbox}
{\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\par}
\ifx\insertsubtitle\@empty%
\else%
\vskip0.25em%
\setbeamercolor{title}{bg=orange,fg=white}
\vbox{%
\hfill\begin{beamercolorbox}[wd=\subtitwd,sep=8pt,center]{title}
{\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
\end{beamercolorbox}\hfill\null%
}%
\fi%
\vskip1em\par
\begin{beamercolorbox}[sep=8pt,center]{author}
\usebeamerfont{author}\insertauthor
\end{beamercolorbox}
\vskip-1em\par % change here
\begin{beamercolorbox}[sep=8pt,center]{institute}
\usebeamerfont{institute}\insertinstitute
\end{beamercolorbox}
\begin{beamercolorbox}[sep=8pt,center]{date}
\usebeamerfont{date}\insertdate
\end{beamercolorbox}\vskip0.5em
\end{centering}
\vfill
}
\makeatother
\title{TITLE}
\titlegraphic{\includegraphics[height=4cm]{cat}}
\subtitle{\textbf{Subtitle}}
\author{Author}
\begin{document}
\maketitle
\end{document}