我想知道如何自定义侧边栏,以便它仅显示我当前正在呈现的当前部分和小节,以及如何从标题幻灯片中删除导航栏。
答案1
隐藏其他子部分很容易:使用hideothersubsections
选项就足够了(无论是主题还是侧边栏外部主题)。隐藏其他部分并不那么简单;它涉及重新定义,\insertverticalnavigation
如在中实现的beamerbasenavigation.sty
。使用框架的选项可以隐藏标题框架中的导航栏plain
。以下示例代码包含所需的代码:
\documentclass{beamer}
\usetheme[hideothersubsections]{PaloAlto}
\makeatletter
\def\insertverticalnavigation#1{%
\vbox{%
\def\sectionentry##1##2##3##4##5{%
\ifnum##5=\c@part%
\def\insertsectionhead{##2}%
\def\insertsectionheadnumber{##1}%
\def\insertpartheadnumber{##5}%
\hbox{{%
\usebeamerfont{section in sidebar}\usebeamercolor[fg]{section in sidebar}%
\hyperlink{Navigation##3}{%
\ifnum\c@section=##1%
\ifnum\c@subsection=0\relax%
{\usebeamertemplate{section in sidebar}}%
\else%
\ifx\beamer@nav@css\beamer@hidetext%
{\usebeamertemplate{section in sidebar}}%
\else%
{\usebeamertemplate{section in sidebar shaded}}%
\fi%
\fi%
\else
%{\usebeamertemplate{section in sidebar shaded}}%
\fi}}}%
\beamer@currentsubsection=0\relax\fi}%
\def\slideentry##1##2##3##4##5##6{}%
\def\beamer@subsectionentry##1##2##3##4##5{%
\ifnum##1=\c@part%
\def\insertpartheadnumber{##1}%
\def\insertsectionheadnumber{##2}%
\def\insertsubsectionheadnumber{##3}%
\def\insertsubsectionhead{##5}%
\beamer@tocifnothide{\ifnum\c@section=##2\ifnum\c@subsection=##3\beamer@nav@css\else\beamer@nav@oss\fi\else\beamer@nav@ooss\fi}%
{\hbox{{%
\usebeamerfont{subsection in sidebar}\usebeamercolor[fg]{subsection in sidebar}%
\hyperlink{Navigation##4}{%
\ifnum\c@section=##2%
\ifnum\c@subsection=##3%
\ifnum\c@subsubsection=0\relax%
{\usebeamertemplate{subsection in sidebar}}%
\else%
{\usebeamertemplate{subsection in sidebar shaded}}%
\fi%
\else%
{\usebeamertemplate{subsection in sidebar shaded}}%
\fi%
\else%
{\usebeamertemplate{subsection in sidebar shaded}}%
\fi}}}%
}%
\fi}%
\def\beamer@subsubsectionentry##1##2##3##4##5##6{%
\ifnum##1=\c@part%
\def\insertpartheadnumber{##1}%
\def\insertsectionheadnumber{##2}%
\def\insertsubsectionheadnumber{##3}%
\def\insertsubsubsectionheadnumber{##3}%
\def\insertsubsubsectionhead{##6}%
\beamer@tocifnothide{\ifnum\c@section=##2\ifnum\c@subsection=##3\beamer@nav@css\else\beamer@nav@oss\fi\else\beamer@nav@ooss\fi}%
{\hbox{{%
\usebeamerfont{subsubsection in sidebar}\usebeamercolor[fg]{subsubsection in sidebar}%
\hyperlink{Navigation##5}{%
\ifnum\c@section=##2%
\ifnum\c@subsection=##3%
\ifnum\c@subsubsection=##4%
{\usebeamertemplate{subsubsection in sidebar}}%
\else
{\usebeamertemplate{subsubsection in sidebar shaded}}%
\fi%
\else%
{\usebeamertemplate{subsubsection in sidebar shaded}}%
\fi%
\else%
{\usebeamertemplate{subsubsection in sidebar shaded}}%
\fi}}}%
}%
\fi}%
%\beamer@currentsubsection=0\relax%
\dohead%
}%
}
\makeatother
\title{The Title}
\author{The Author}
\institute{The Institute}
\begin{document}
\begin{frame}[plain]
\maketitle
\end{frame}
\section{Test section one}
\begin{frame} test frame for section one\end{frame}
\subsection{Test subsection one one}
\begin{frame} test frame for section one\end{frame}
\subsection{Test subsection one two}
\begin{frame} test frame for section one\end{frame}
\section{Test section two}
\begin{frame} test frame for section two\end{frame}
\subsection{Test subsection two one}
\begin{frame} test frame for section two\end{frame}
\subsection{Test subsection two two}
\begin{frame} test frame for section two\end{frame}
\end{document}