在投影机中突出显示当前部分

在投影机中突出显示当前部分

我想在目录中突出显示当前部分,该部分的所有幻灯片均包含在该部分中。目前,该部分仅在没有子部分的幻灯片上突出显示。(突出显示对我来说意味着目录中部分的颜色为白色)

\documentclass{beamer}

% beamer theme
\usetheme{Marburg}

% german spelling
\usepackage[english,ngerman]{babel}

% set font encoding
\usepackage[T1]{fontenc}

% math stuff
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

% set fonts
\usepackage{xltxtra}
\usefonttheme{professionalfonts}
\setsansfont[
BoldFont={Helvetica Neue Medium},
ItalicFont={Helvetica Neue Italic},
BoldItalicFont={Helvetica Neue Medium Italic},
Ligatures=TeX
]{Helvetica Neue Light}
\setmonofont[Scale=0.9]{Menlo Regular}

% slide numbers in the bottom right corner
\setbeamertemplate{footline}{%
\hfill\usebeamertemplate***{navigation symbols}
\insertframenumber{}\hspace{3mm}\vspace{2mm}}



% removes navigation bar
\beamertemplatenavigationsymbolsempty

% color definitions
\definecolor{konzeBlue}{RGB}{45,170,250}
\definecolor{konzeBlueLight}{RGB}{116,199,252}
\definecolor{mainTextColor}{RGB}{80,80,80}
\definecolor{titleTextColor}{RGB}{120,120,120}

\makeatletter

% title page
\setbeamercolor{title}{fg=titleTextColor}
\setbeamercolor{author}{fg=mainTextColor}
\setbeamercolor{date}{fg=mainTextColor}

% sidebar
\setbeamertemplate{sidebar canvas right}[vertical shading][top=konzeBlue,bottom=konzeBlue]
\setbeamercolor{author in sidebar}{fg=white}
\setbeamercolor{section in sidebar}{fg=white}
\setbeamercolor{section in sidebar}{bg=konzeBlueLight}
\setbeamerfont{section in sidebar}{size=\tiny}
\setbeamerfont{section in sidebar}{series=\bfseries}
\setbeamercolor{subsection in sidebar}{fg=white}
\setbeamercolor{subsection in sidebar}{bg=konzeBlueLight}
\setbeamerfont{subsection in sidebar}{series=\tiny}

% slide number
\setbeamercolor{footline}{fg=white}

% frame
\setbeamercolor{frametitle}{fg=titleTextColor}
\makeatother


\title{Something}
\author{Max Mustermann}
\date{\today}

\begin{document}
\color{mainTextColor}

\section{Section}
\begin{frame}
    Section slide
\end{frame}

\subsection{Subsection}
\begin{frame}
\frametitle{Subsection Slide}
    Regular\\
    \textbf{Bold}\\
    \textit{Italic}\\
    \textit{\textbf{Bold Italic}}\\
    \texttt{Typewriter}\\
    \[\int_a^b x^2\mathrm{d}x\]
    This is $x$, $x$ is a variable.
\end{frame}

\end{document}

PS:我使用xelatex进行编译

答案1

可以通过重新定义来\insertverticalnavigation抑制条件(在下面的代码中用 % NEW 标记的注释掉的行):

\documentclass{beamer}

% beamer theme
\usetheme{Marburg}

% redefinition of \insertverticalnavigation to get the desired highlighting for
% sections in the sidebar
\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% NEW
              {\usebeamertemplate{section in sidebar}}%
            %\else%% NEW
              \ifx\beamer@nav@css\beamer@hidetext%
                {\usebeamertemplate{section in sidebar}}%
              \else%
                {\usebeamertemplate{section in sidebar shaded}}%
              \fi%
            %\fi%% NEW
          \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
% german spelling
\usepackage[english,ngerman]{babel}

% set font encoding
\usepackage[T1]{fontenc}

% math stuff
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

% set fonts
\usepackage{xltxtra}
\usefonttheme{professionalfonts}
%\setsansfont[
%BoldFont={Helvetica Neue Medium},
%ItalicFont={Helvetica Neue Italic},
%BoldItalicFont={Helvetica Neue Medium Italic},
%Ligatures=TeX
%]{Helvetica Neue Light}
%\setmonofont[Scale=0.9]{Menlo Regular}

% slide numbers in the bottom right corner
\addtobeamertemplate{footline}{%
\hfill\usebeamertemplate***{navigation symbols}
\insertframenumber{}\hspace{3mm}\vspace{2mm}}{}

% removes navigation bar
\beamertemplatenavigationsymbolsempty

% color definitions
\definecolor{konzeBlue}{RGB}{45,170,250}
\definecolor{konzeBlueLight}{RGB}{116,199,252}
\definecolor{mainTextColor}{RGB}{80,80,80}
\definecolor{titleTextColor}{RGB}{120,120,120}

\makeatletter

% title page
\setbeamercolor{title}{fg=titleTextColor}
\setbeamercolor{author}{fg=mainTextColor}
\setbeamercolor{date}{fg=mainTextColor}

% sidebar
\setbeamertemplate{sidebar canvas right}[vertical shading][top=konzeBlue,bottom=konzeBlue]
\setbeamercolor{author in sidebar}{fg=white}
\setbeamercolor{section in sidebar}{fg=white}
\setbeamercolor{section in sidebar}{bg=konzeBlueLight}
\setbeamerfont{section in sidebar}{size=\tiny}
\setbeamerfont{section in sidebar}{series=\bfseries}
\setbeamercolor{subsection in sidebar}{fg=white}
\setbeamercolor{subsection in sidebar}{bg=konzeBlueLight}
\setbeamerfont{subsection in sidebar}{series=\tiny}

% slide number
\setbeamercolor{footline}{fg=white}

% frame
\setbeamercolor{frametitle}{fg=titleTextColor}
\makeatother


\title{Something}
\author{Max Mustermann}
\date{\today}

\begin{document}
\color{mainTextColor}

\section{Test section one}
\begin{frame}
test
\end{frame}

\subsection{Test subsection}
\begin{frame}
test
\end{frame}

\subsection{Test subsection}
\begin{frame}
test
\end{frame}

\section{Test section two}
\begin{frame}
test
\end{frame}

\subsection{Test subsection}
\begin{frame}
test
\end{frame}

\subsection{Test subsection}
\begin{frame}
test
\end{frame}

\end{document}

在此处输入图片描述

我注释掉了使用 Helvetica 字体的行,因为我的系统中没有该字体,但这与解决方案无关。

相关内容