如何修改外部主题信息行以将标题和部分包含在标题投影仪中?

如何修改外部主题信息行以将标题和部分包含在标题投影仪中?

我正在使用 CambridgeUS beamer 主题进行演示,我想修改标题以在左侧包含演示文稿的标题,在右侧包含部分,因为我没有太多子部分。修改 infolines 命令似乎是可行的方法,但如果不修改 sty 文件本身,这显然是不可能的。有人有解决办法吗?

答案1

您可以设置headline模板:

\documentclass{beamer}
\usetheme{CambridgeUS}

\setbeamertemplate{headline}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,right,rightskip=1em]{section in head/foot}%
    \usebeamerfont{subsection in head/foot}\hspace*{2ex}\insertshorttitle
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,left,leftskip=1em]{subsection in head/foot}%
    \usebeamerfont{section in head/foot}\insertsectionhead\hspace*{2ex}
  \end{beamercolorbox}}%
  \vskip0pt%
}

\title{The Title}
\author{The Author}

\begin{document}

\section{Test Section One}
\begin{frame}
test
\end{frame}

\section{Test Section Two}
\begin{frame}
test
\end{frame}

\end{document}

请注意,infolines默认情况下会在模板中插入演示文稿的标题footline,因此您还需要重新定义此模板以避免重复的信息;这是一个可能的重新定义:

\documentclass{beamer}
\usetheme{CambridgeUS}

\setbeamertemplate{headline}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,right,rightskip=1em]{section in head/foot}%
    \usebeamerfont{subsection in head/foot}\hspace*{2ex}\insertshorttitle
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,left,leftskip=1em]{subsection in head/foot}%
    \usebeamerfont{section in head/foot}\insertsectionhead\hspace*{2ex}
  \end{beamercolorbox}}%
  \vskip0pt%
}

\makeatletter
\setbeamertemplate{footline}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\insertshortauthor~~\beamer@ifempty{\insertshortinstitute}{}{(\insertshortinstitute)}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
    \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
    \insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 
  \end{beamercolorbox}}%
  \vskip0pt%
}
\makeatother

\title{The Title}
\author{The Author}

\begin{document}

\section{Test Section One}
\begin{frame}
test
\end{frame}

\section{Test Section Two}
\begin{frame}
test
\end{frame}

\end{document}

结果如下:

enter image description here

enter image description here

相关内容