Beamer 的自定义水平导航栏

Beamer 的自定义水平导航栏

我想为我的演示文稿创建一个 beamer 主题。我喜欢在演示文稿的标题中显示一个水平导航栏,以便参考演示文稿的进度。

在我的 PowerPoint 演示文稿中,我通常为每个部分添加类似于 tikz 信号的形状,为除当前部分之外的所有内容添加阴影或更改填充颜色,如图所示。

期望的标题结果

在检查了\insertsectionnavigationhorizontal\doheadbeamer 宏的实现方式后,我仍然无法确定每个部分名称和超链接在标题中包含的位置。这是我第一次深入研究 Plain TeX 宏,所以我不完全理解默认定义。将 tikz 节点添加到我的自定义\myinsertsectionnavigationhorizontal定义中允许我为整个标题包含一个通用形状:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes}

\usetheme{default}

\makeatletter
\def\myinsertsectionnavigationhorizontal#1#2#3{%
  \hbox to #1{{%
     \def\slideentry##1##2##3##4##5##6{}%
     #2\hskip.3cm%
     \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
     \setbox\beamer@sectionbox=\hbox{}%
     \ht\beamer@sectionbox=1.875ex%
     \dp\beamer@sectionbox=0.75ex%
     \tikz\node[draw=myblue,fill=myblue,shape=signal,signal to=east,very thick,text=white]%
         {\hskip-1.875ex plus-1fill\dohead\box\beamer@sectionbox\hfil\hskip.3cm};%
     #3}}}
\makeatother

\definecolor{myblue}{RGB}{0,112,188}
\setbeamercolor*{section in head/foot}{fg=white}

\setbeamertemplate{frametitle}
{%
\begin{beamercolorbox}[wd=\paperwidth,ht=1.1cm]{frametitle} 
\begin{tikzpicture}
\useasboundingbox[fill=white](0,0) rectangle(\the\paperwidth,1.2);
\node[anchor=west, myblue,font=\large] at (0.5cm,0.61cm){\insertframetitle};
\end{tikzpicture}
\end{beamercolorbox}
}

\setbeamertemplate{headline}
{%
\begin{beamercolorbox}{section in head/foot}
    \vskip5pt\myinsertsectionnavigationhorizontal{\paperwidth}{\hspace{0.5cm}}{\hspace{0.5cm}}\vskip5pt
\end{beamercolorbox}
}

\begin{document}

\section[Introduction]{Introduction}
\begin{frame}
\frametitle{Introduction}
Text here.
\end{frame}

\section[Prev. Work]{Previous Work}
\begin{frame}
\frametitle{Previous Work Overview}
Text here.
\end{frame}

\section[Design]{Design Procedure}
\begin{frame}
\frametitle{Design Overview}
Text
\end{frame}

\section[Results]{Experiment Results}
\begin{frame}
\frametitle{Results}
Example text.
\end{frame}

\section[Conclusion]{Final Conclusions}
\begin{frame}
\frametitle{Conclusion}
Text.
\end{frame}

\end{document}    

生成的标题样式

如何为每个部分名称指定单独的形状,并且如果可能的话为当前部分指定一个不同的形状?

答案1

你可以做类似的事情:

\documentclass{beamer}


\setbeamertemplate{headline}{%
\leavevmode%
  \hbox{%
    \begin{beamercolorbox}[wd=\paperwidth,ht=4.8ex,dp=0.125ex]{palette}%
        \insertsectionnavigationhorizontal{\paperwidth}{}{\hskip0pt plus1filll}
    \end{beamercolorbox}%
  }
}

\usepackage{tikz}
\usetikzlibrary{shapes}

\setbeamertemplate{section in head/foot}{%
    \if\insertsectionheadnumber1
        \tikz\node[draw=blue,fill=blue,shape=signal,very thick,text=white]{\insertsectionhead\hskip.3cm};
    \else
        \tikz\node[draw=blue,fill=blue,shape=signal,signal from=west, signal to=east,very thick,text=white]     {\insertsectionhead\hskip.3cm};
  \fi
}

\setbeamertemplate{section in head/foot shaded}{%
    \if\insertsectionheadnumber1
        \tikz\node[draw=blue,fill=white,shape=signal,very thick,text=blue]{\insertsectionhead\hskip.3cm};
    \else
        \tikz\node[draw=blue,fill=white,shape=signal,signal from=west, signal to=east,very thick,text=blue]     {\insertsectionhead\hskip.3cm};
  \fi
}

\begin{document}

\section{Introduction}
\subsection{The questions}
\begin{frame}\frametitle{A test frame}Test\end{frame}
\subsection{Another questions}
\begin{frame}\frametitle{Another test frame}Test
%\textcolor‎{‎letterfoot‎}{\rule{2cm}{2cm}}‎
\end{frame}

\section{section2}
\subsection{The questions}
\begin{frame}\frametitle{A test frame}Test\end{frame}
\subsection{Another questions}
\begin{frame}\frametitle{Another test frame}Test
%\textcolor‎{‎letterfoot‎}{\rule{2cm}{2cm}}‎
\end{frame}

\end{document}

在此处输入图片描述

相关内容