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

Beamer Metropolis如何移除子章节页页码编号

问题解决方法

问题原因

你当前的代码仅对\section触发的章节过渡页做了隐藏页码、不计入帧编号的配置,但没有对\subsection触发的子章节过渡页做相同处理:Metropolis主题开启subsectionpage=progressbar选项后会自动生成子章节过渡页,这类页面会沿用你全局设置的页码显示逻辑,所以会出现子章节过渡页带页码的问题。

修复逻辑

仿照你现有处理章节过渡页的写法,新增\AtBeginSubsection钩子:子章节过渡帧添加noframenumbering属性避免计入页码计数,帧渲染阶段临时清空放置页码的导航符号区域,渲染完成后再恢复全局页码显示配置即可。

修复后的完整可编译代码

\documentclass{beamer}
\usetheme[progressbar=frametitle, sectionpage=progressbar, subsectionpage=progressbar, block=fill]{metropolis}
\setbeamertemplate{footline}{}
% 全局配置:导航符号位置显示页码
\setbeamertemplate{navigation symbols}{%
    \ifnum\insertframenumber>0
         \normalsize\insertframenumber%
    \fi%
}
 
\title{Title}
\subtitle{Sub-title}
\date{\today}
\author{author}
\institute{institute}
 
 
% 章节过渡页配置:隐藏页码、不计入编号
\AtBeginSection[]
{
    \setbeamertemplate{navigation symbols}{}
    \frame[plain,c,noframenumbering]{
        \sectionpage
        \tableofcontents[currentsection,subsectionstyle=hide]}
    \setbeamertemplate{navigation symbols}{\normalsize\insertframenumber}
}

% 新增:子章节过渡页配置:隐藏页码、不计入编号
\AtBeginSubsection[]
{
    \setbeamertemplate{navigation symbols}{}
    \frame[plain,c,noframenumbering]{
        \subsectionpage
    }
    \setbeamertemplate{navigation symbols}{\normalsize\insertframenumber}
}
 
\makeatletter
\setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{subsection in toc}[subsections numbered]
\makeatother
 
\begin{document}
  \maketitle
 
\section{First section}
 
\begin{frame}
Content 
\end{frame}
 
\section{Second section}
\subsection{First sub section}
\begin{frame}
Content 
\end{frame}   
 
\subsection{Second sub section}
\begin{frame}
Content 
\end{frame} 
 
 
\section{Third section}
\end{document}

编译后所有子章节过渡页不会显示页码,也不会占用页码计数,和章节过渡页的表现完全一致。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.29 04:09:28