You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Beamer添加增量列表后,如何保持标题栏仅显示章节标题及对应圆点?

解决Beamer导航栏章节标题重复显示问题

问题根源

当前问题有两个核心原因:

  • \section{Background}被放在第一个frame内部,导致Beamer错误地将章节与单个帧绑定,而非后续所有相关帧。
  • Dresden主题默认的miniframes外主题会为每个帧显示独立导航条目,造成章节标题重复出现。

解决方案

1. 修正章节命令位置

将\section{Background}移到所有相关frame的外部,确保它能正确关联后续4个帧。

2. 重定义导航模板

通过修改miniframes模板,让章节标题仅显示一次,后续每个帧对应一个圆点。在导言区添加以下代码:

% 重定义miniframes模板,实现章节标题+圆点的导航样式
\makeatletter
\setbeamertemplate{headline}{%
  \begin{beamercolorbox}[colsep=1.5pt]{upper separation line head}
  \end{beamercolorbox}
  \begin{beamercolorbox}{section in head/foot}
    \vskip2pt\insertnavigation{\paperwidth}\vskip2pt
  \end{beamercolorbox}%
  \begin{beamercolorbox}[colsep=1.5pt]{lower separation line head}
  \end{beamercolorbox}
}
\setbeamertemplate{section in head/foot}{%
  \ifbeamer@tree@showhooks
    \leavevmode\setbox\leftbox=\hbox{\insertsectionhead}\kern1.25\wd\leftbox\hskip-1.25\wd\leftbox%
  \fi%
  \insertsectionhead\hfill%
  \usebeamertemplate{section in head/foot shaded}%
}
\setbeamertemplate{section in head/foot shaded}{%
  \ifnum\the\beamer@subsectionmax<\beamer@sectionmax
    \begin{pgfpicture}{0pt}{0pt}{0pt}{4pt}
      \foreach \x in {1,...,\numexpr\beamer@sectionmax-1\relax}
        {\pgfpathcircle{\pgfpoint{\x*10pt}{2pt}}{1.5pt}
         \pgfusepath{fill}}
    \end{pgfpicture}%
  \fi
}
\makeatother

修改后的完整代码

导言区
\documentclass{beamer} %

%%%BASICS
\usepackage[utf8]{inputenc}
\usepackage{csquotes}

%%%START THEME SETTINGS
\usetheme{Dresden}
\usecolortheme{beaver}
\usefonttheme{professionalfonts}
\setbeamertemplate{itemize item}{\color{red}$\blacksquare$}
%%%END THEME SETTINGS

% 重定义miniframes模板,实现章节标题+圆点的导航样式
\makeatletter
\setbeamertemplate{headline}{%
  \begin{beamercolorbox}[colsep=1.5pt]{upper separation line head}
  \end{beamercolorbox}
  \begin{beamercolorbox}{section in head/foot}
    \vskip2pt\insertnavigation{\paperwidth}\vskip2pt
  \end{beamercolorbox}%
  \begin{beamercolorbox}[colsep=1.5pt]{lower separation line head}
  \end{beamercolorbox}
}
\setbeamertemplate{section in head/foot}{%
  \ifbeamer@tree@showhooks
    \leavevmode\setbox\leftbox=\hbox{\insertsectionhead}\kern1.25\wd\leftbox\hskip-1.25\wd\leftbox%
  \fi%
  \insertsectionhead\hfill%
  \usebeamertemplate{section in head/foot shaded}%
}
\setbeamertemplate{section in head/foot shaded}{%
  \ifnum\the\beamer@subsectionmax<\beamer@sectionmax
    \begin{pgfpicture}{0pt}{0pt}{0pt}{4pt}
      \foreach \x in {1,...,\numexpr\beamer@sectionmax-1\relax}
        {\pgfpathcircle{\pgfpoint{\x*10pt}{2pt}}{1.5pt}
         \pgfusepath{fill}}
    \end{pgfpicture}%
  \fi
}
\makeatother

%%%START APA
\usepackage[british]{babel}
\usepackage[backend=bibtex,style=authoryear]{biblatex}
\addbibresource{references.bib}
%% APA citing
%% \cite{t} - Uthor und Richter, 2010
%% \textcite{t} - Uthor und Riter (2010)
%% \parencite{t} - (Uthor & Riter, 2010)
%% \parencite[Chapt.~4]{t} - (Uthor & Riter, 2010, S. 15)
%%%END APA

\setbeamertemplate{sidebar right}{}
\setbeamertemplate{footline}{%
\hfill\usebeamertemplate***{navigation symbols}
\hspace{1cm}\insertframenumber{}/\inserttotalframenumber}
帧内容
\section{Background}

\begin{frame}
\textbf{ABC}
\begin{itemize} [<-+->]
    \item lol
    \item what's up
\end{itemize}
\end{frame}

\begin{frame}
\textbf{DEF}
\begin{itemize} [<-+->]
    \item lol
    \item what's up
\end{itemize}
\end{frame}

\begin{frame}
\textbf{GHI}
\begin{itemize} [<-+->]
    \item lol
    \item what's up
\end{itemize}
\end{frame}

\begin{frame}
\textbf{JKL}
\begin{itemize} [<-+->]
    \item lol
    \item what's up
\end{itemize}
\end{frame}

效果说明

修改后,导航栏会显示一次Background标题,右侧跟随3个圆点(对应章节下的4个帧,标题本身对应第一个帧,后续3个帧用圆点表示),完全符合需求。

内容的提问来源于stack exchange,提问作者hy9fesh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 05:54:57