Beamer。避免顶线被分成两种不同的颜色

Beamer。避免顶线被分成两种不同的颜色

请参阅以下我的 MWE

\documentclass[10pt,compress]{beamer}
\usetheme{Madrid}
\definecolor{aggiemaroon}{RGB}{153,0,51} 
\usecolortheme[named=aggiemaroon]{structure}
\useoutertheme{shadow}
\useinnertheme{rounded}
\setbeamertemplate{navigation symbols}{}
\setbeamerfont{structure}{family=\rmfamily,series=\bfseries}
\usefonttheme[stillsansseriftext]{serif}
\title[Title]{Title}

\date[\today]{}

\begin{document}


\begin{frame}
\titlepage
\end{frame}


\begin{frame}{Content}
\tableofcontents
\end{frame}


\section{Slide11111111}
\begin{frame}{Slide1}
text
\end{frame} 


\section{Slide22222222222}
\begin{frame}{Slide2}
text
\end{frame} 

\section{Slide3333333333333333}
\begin{frame}{Slide3}
text
\end{frame} 

\section{Slide4444444444444444}
\begin{frame}{Slide4}
text
\end{frame} 

\section{Slide55555555555555}
\begin{frame}{Slide5}
text
\end{frame} 

\end{document}

它生成如下的幻灯片:

在此处输入图片描述

有什么方法可以避免顶行被拆分?我想看看那行上的 5 个部分。

谢谢!

答案1

我必须重新定义 beamer 模板headline

\documentclass[10pt,compress]{beamer}
\usetheme{Madrid}
\definecolor{aggiemaroon}{RGB}{153,0,51} 
\usecolortheme[named=aggiemaroon]{structure}
\useoutertheme{shadow}
\useinnertheme{rounded}
\setbeamertemplate{navigation symbols}{}
\setbeamerfont{structure}{family=\rmfamily,series=\bfseries}
\usefonttheme[stillsansseriftext]{serif}
\title[Title]{Title}

\date[\today]{}

\makeatletter
% redefine template `headline` when compress is true
% see `beamerouterthemesplit.sty`
\defbeamertemplate*{headline}{split theme sec only}
{%
  \leavevmode%
  \begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex]{section in head/foot}%
    \insertsectionnavigationhorizontal{.5\paperwidth}{\hskip0pt plus1filll}{}%
  \end{beamercolorbox}%
  % \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.5ex,dp=1.125ex]{subsection in head/foot}%
  %   \insertsubsectionnavigationhorizontal{.5\paperwidth}{}{\hskip0pt plus1filll}%
  % \end{beamercolorbox}%
}

% add shadow, previously done in `beamerouterthemeshadow.sty`
\addtobeamertemplate{headline}
{}
{%
  \vskip0pt
  \begin{pgfpicture}
    \pgfpathrectangle{\pgfpoint{0pt}{-4pt}}{\pgfpoint{\paperwidth}{4pt}}%
    \pgfsetfading{beamer@topshadowmask}{}%
    \pgfusepath{fill}%
  \end{pgfpicture}
  \vskip-2pt
}
\makeatother

\begin{document}


\begin{frame}
\titlepage
\end{frame}


\begin{frame}{Content}
\tableofcontents
\end{frame}

\makeatletter
\section{Slide11111111}
\begin{frame}{Slide1}
text
\end{frame} 


\section{Slide22222222222}
\begin{frame}{Slide2}
text
\end{frame} 

\section{Slide3333333333333333}
\begin{frame}{Slide3}
text
\end{frame} 

\section{Slide4444444444444444}
\begin{frame}{Slide4}
text
\end{frame} 

\section{Slide55555555555555}
\begin{frame}{Slide5}
text
\end{frame} 

\end{document}

在此处输入图片描述 在此处输入图片描述

答案2

您可以选择不同的外部主题,例如miniframes,它显示整个页面宽度的部分:

\documentclass[10pt,compress]{beamer}
\usetheme{Madrid}
\definecolor{aggiemaroon}{RGB}{153,0,51} 
\usecolortheme[named=aggiemaroon]{structure}
\useoutertheme{shadow}
\useinnertheme{rounded}
\setbeamertemplate{navigation symbols}{}
\setbeamerfont{structure}{family=\rmfamily,series=\bfseries}
\usefonttheme[stillsansseriftext]{serif}
\title[Title]{Title}

\date[\today]{}

\useoutertheme[subsection=false]{miniframes}
\setbeamertemplate{mini frames}{} 
\setbeamercolor{palette tertiary}{bg=black}

\begin{document}


\begin{frame}
\titlepage
\end{frame}


\begin{frame}{Content}
\tableofcontents
\end{frame}


\section{Slide11111111}
\begin{frame}{Slide1}
text
\end{frame} 


\section{Slide22222222222}
\begin{frame}{Slide2}
text
\end{frame} 

\section{Slide3333333333333333}
\begin{frame}{Slide3}
text
\end{frame} 

\section{Slide4444444444444444}
\begin{frame}{Slide4}
text
\end{frame} 

\section{Slide55555555555555}
\begin{frame}{Slide5}
text
\end{frame} 

\end{document}

在此处输入图片描述

相关内容