如何在默认投影仪模板的标题中添加该部分?

如何在默认投影仪模板的标题中添加该部分?

默认的 beamer 模板只在标题中显示子部分。我希望它既显示部分,又显示子部分。可以通过将主题更改为信息行等来实现,但我更喜欢使用默认主题,只需在标题中添加部分名称即可。

原始框架如下所示: 原始框架

以下是我想要的: 所需框架

梅威瑟:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[T1]{fontenc}
\usepackage{graphicx}

%Modify theme
\setbeamertemplate{navigation symbols}{} %get rid of navigation symbols
\setbeamertemplate{sections/subsections in toc}[ball unnumbered] %bullets in table of contents should be balls
\setbeamertemplate{itemize items}[ball] %bullets in frames should be balls

\title{My title}
\author{My name}
\institute{My institute}
\date{\today}

\begin{document}

\maketitle

\begin{frame}{Outline}
\tableofcontents
\end{frame}

\section{Section 1}

\begin{frame}{Section 1}
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\end{frame}

\section{Section 2}
\subsection{Subsection 2.1}
\begin{frame}{Subsection 2.1}
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\end{frame}

\subsection{Subsection 2.2}
\begin{frame}{Subsection 2.2}
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\end{frame}

\end{document}

答案1

一种可能性是(重新)定义一个适当的模板(合理的候选者是headlineframe title)来使用\insertsectionhead\insertsubsectionhead

在此处输入图片描述

代码:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[T1]{fontenc}
\usepackage{graphicx}

%Modify theme
\setbeamertemplate{navigation symbols}{} %get rid of navigation symbols
\setbeamertemplate{sections/subsections in toc}[ball unnumbered] %bullets in table of contents should be balls
\setbeamertemplate{itemize items}[ball] %bullets in frames should be balls

\setbeamertemplate{headline}{%
  \leavevmode%
  \begin{beamercolorbox}[sep=0.3cm,wd=\paperwidth]{section in head/foot}%
  \usebeamercolor[fg]{structure}\Large\insertsectionhead\hfill\insertsubsectionhead%  
  \end{beamercolorbox}%
}

\title{My title}
\author{My name}
\institute{My institute}
\date{\today}

\begin{document}

\maketitle

\begin{frame}{Outline}
\tableofcontents
\end{frame}

\section{Section 1}

\begin{frame}
\frametitle{Title for the frame}
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\end{frame}

\section{Section 2}
\subsection{Subsection 2.1}
\begin{frame}
\frametitle{Title for the frame}
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\end{frame}

\subsection{Subsection 2.2}
\begin{frame}
\frametitle{Title for the frame}
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\end{frame}

\end{document}

相关内容