如何在RMarkdown Beamer metropolis主题中隐藏标题页与目录页的页脚
解决方法
你可以通过两种常用方案实现指定页面隐藏页脚的需求,操作都非常简单:
方案1:使用Beamer原生plain属性(推荐)
RMarkdown的Beamer输出支持直接给单个幻灯片页面添加plain类,自动隐藏该页的页眉页脚,不需要修改LaTeX分组逻辑:
- 处理自动生成的标题页:在yaml的
header-includes中新增1行命令,给默认标题页自动应用无页脚配置:- \addtobeamertemplate{title page}{\setbeamertemplate{footline}{}}{} - 处理目录页:给目录所在的幻灯片标题后加
{.plain}属性即可:## Content {.plain} \tableofcontents[]
后续如果有其他需要隐藏页脚的页面,直接在对应幻灯片标题后加{.plain}即可。
方案2:插入LaTeX分组命令
如果需要批量隐藏连续多个页面的页脚,可以直接在RMarkdown中插入你熟悉的LaTeX分组命令:
- 要隐藏页脚的页面前插入:
\begingroup\setbeamertemplate{footline}{} - 所有需要隐藏的页面结束后插入:
\endgroup
修改后的完整可运行示例
--- title: "Title" subtitle: "Subtitle" author: "Simon" institute: "RUB" date: "September 22, 2021" output: beamer_presentation: keep_md: true keep_tex: no latex_engine: xelatex slide_level: 2 incremental: no header-includes: - \usetheme[numbering=fraction]{metropolis} - \definecolor{beaublue}{rgb}{0.74, 0.83, 0.9} - \setbeamertemplate{frame footer}{\tiny{\textcolor{beaublue}{Conference 56. Jahrestagung der DGSMP, 2021}}} # 新增:标题页隐藏页脚 - \addtobeamertemplate{title page}{\setbeamertemplate{footline}{}}{} --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE)
Content {.plain}
\tableofcontents[]
Level I
Test
Slide with Bullets
- Bullet 1
- Bullet 2
- Bullet 3
Slide with R Output
summary(cars)
内容的提问来源于stack exchange,提问作者Simon Ress
相关产品推荐
相关产品推荐

