标题部分名称的投影仪颜色设置

标题部分名称的投影仪颜色设置

指导解释如何生成动态标题,其中当前部分被突出显示。

但是我如何控制用于突出显示的颜色?(为了节省空间,我将标题的字体大小设置为较小的值,因此我想添加一些对比度以更清楚地了解我们所处的谈话部分)。

答案1

如果我正确理解了你的问题,这里有一个可能的解决方案;我在一般目录和每个部分开头生成的目录中的部分标题周围添加了彩色框架:

\documentclass{beamer}
\usepackage{tikz}
\usetheme{Malmoe}

\newcommand\sectioncolor{white}

\newcommand\SectionBox[1]{%
  \tikz\node[rectangle,fill=\sectioncolor,rounded corners] {#1};
}

\AtBeginSection{%
  \setbeamercolor{section in toc}{fg=black,bg=\sectioncolor}
  \begin{frame}<beamer>
  \frametitle{Outline \thesection}
  \tableofcontents[currentsection,subsectionstyle=show/show/shaded]
  \end{frame}
}

\setbeamertemplate{section in toc shaded}[default][7]

\makeatletter
\long\def\beamer@section[#1]#2{%
  \beamer@savemode%
  \mode<all>%
  \ifbeamer@inlecture
    \refstepcounter{section}%
      \renewcommand\sectioncolor{%
      \ifcase\value{section}\or blue!20\or green!80!black\or red!80!black!50\or yellow!30!black!50\else orange!30!black!50\fi}
    \beamer@ifempty{#2}%
    {\long\def\secname{#1}\long\def\lastsection{#1}}%
    {\global\advance\beamer@tocsectionnumber by 1\relax%
      \long\def\secname{#2}%
      \long\def\lastsection{#1}%
      \addtocontents{toc}{\protect\beamer@sectionintoc{\the\c@section}%
        {\protect\tikz\protect\node[rectangle,fill=\sectioncolor,rounded corners] {#2};}%
        {\the\c@page}{\the\c@part}%
        {\the\beamer@tocsectionnumber}}}%
    {\let\\=\relax\xdef\sectionlink{{Navigation\the\c@page}{\noexpand\secname}}}%
    \beamer@tempcount=\c@page\advance\beamer@tempcount by -1%
    \beamer@ifempty{#1}{}{%
      \addtocontents{nav}{\protect\headcommand{\protect\sectionentry{\the\c@section}{#1}{\the\c@page}{\secname}{\the\c@part}}}%
      \addtocontents{nav}{\protect\headcommand{\protect\beamer@sectionpages{\the\beamer@sectionstartpage}{\the\beamer@tempcount}}}%
      \addtocontents{nav}{\protect\headcommand{\protect\beamer@subsectionpages{\the\beamer@subsectionstartpage}{\the\beamer@tempcount}}}%
    }%
    \beamer@sectionstartpage=\c@page%
    \beamer@subsectionstartpage=\c@page%
    \def\insertsection{\expandafter\hyperlink\sectionlink}%
    \def\insertsubsection{}%
    \def\insertsubsubsection{}%
    \def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}%
    \def\insertsubsectionhead{}%
    \def\insertsubsubsectionhead{}%
    \def\lastsubsection{}%
    \Hy@writebookmark{\the\c@section}{\secname}{Outline\the\c@part.\the\c@section}{2}{toc}%
    \hyper@anchorstart{Outline\the\c@part.\the\c@section}\hyper@anchorend%
    \beamer@ifempty{#2}{\beamer@atbeginsections}{\beamer@atbeginsection}%
  \fi%
  \beamer@resumemode}%
\makeatother

\begin{document}

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

\section{Test Section One}
\subsection{Test Subsection One One}
\begin{frame}test one\end{frame}
\subsection{Test Subsection One Two}
\begin{frame}test one\end{frame}

\section{Test Section Two}
\subsection{Test Subsection Two One}
\begin{frame}test one\end{frame}
\subsection{Test Subsection Two Two}
\begin{frame}test one\end{frame}
\subsection{Test Subsection Two Three}
\begin{frame}test one\end{frame}

\section{Test Section Three}
\subsection{Test Subsection Three One}
\begin{frame}test one\end{frame}
\subsection{Test Subsection Three Two}
\begin{frame}test one\end{frame}

\end{document}

一般目录:

在此处输入图片描述

章节开头的两个目录:

在此处输入图片描述

在此处输入图片描述

由于需要修改的是导航栏中的部分,而不是我最初认为的目录中的部分,因此解决方案要简单得多:只需重新定义模板section in head/foot(针对当前部分)和section in head/foot shaded(针对不同于当前部分的部分)。在下面的示例中,我为当前部分使用了彩色框架,但您可以使用任何其他您喜欢的样式:

\documentclass{beamer}
\usepackage{tikz}
\usetheme{Singapore}

\definecolor{SectionBox}{RGB}{60,160,0}

\setbeamertemplate{section in head/foot}{\hfill\protect\tikz\protect\node[rectangle,fill=SectionBox!90,rounded corners=1pt,inner sep=1pt,] {\textcolor{white}{\insertsectionhead}};}
\setbeamertemplate{section in head/foot shaded}{\textcolor{structure!40}{\hfill\insertsectionhead}}


\begin{document}

\section{Test Section One}
\subsection{Test Subsection One One}
\begin{frame}test section one\end{frame}
\subsection{Test Subsection One Two}
\begin{frame}test section  one\end{frame}

\section{Test Section Two}
\subsection{Test Subsection Two One}
\begin{frame}test section  two\end{frame}
\subsection{Test Subsection Two Two}
\begin{frame}test section  two\end{frame}
\subsection{Test Subsection Two Three}
\begin{frame}test  section  two\end{frame}

\section{Test Section Three}
\subsection{Test Subsection Three One}
\begin{frame}test section  three\end{frame}
\subsection{Test Subsection Three Two}
\begin{frame}test section  three\end{frame}

\end{document}

部分标题图片:

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

相关内容